diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-09-26 16:21:12 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-10-22 18:07:25 -0400 |
commit | 8922f72d1ea1dd8af8a43d265253eac4f82baffc (patch) | |
tree | 0625221487251295b5920bc2a9e3989906c27cfc /sc | |
parent | 04ee80c1a6d476171d2394a57011dc98c2aa86bc (diff) |
Annotate FindEditCellsHandler.
Change-Id: Ib49a7a3eccee62e5496f7f19824631866e072b6a
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/column.cxx | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 521b942cb9af..5aeaf4c904a3 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2839,17 +2839,21 @@ class FindEditCellsHandler sc::CellStoreType::iterator miCellPos; public: - FindEditCellsHandler(ScColumn& rColumn, sc::CellTextAttrStoreType& rAttrs, - const sc::CellStoreType::iterator& rCellItr) : - mrColumn(rColumn), miAttrPos(rAttrs.begin()), miCellPos(rCellItr) {} + FindEditCellsHandler(ScColumn& rCol) : + mrColumn(rCol), + miAttrPos(rCol.GetCellAttrStore().begin()), + miCellPos(rCol.GetCellStore().begin()) {} bool operator() (size_t, const EditTextObject*) { + // This is definitely an edit text cell. return true; } bool operator() (size_t nRow, const ScFormulaCell* p) { + // With a formula cell, it's considered an edit text cell when either + // the result is multi-line or it has more than one script types. sal_uInt8 nScriptType = mrColumn.GetRangeScriptType(miAttrPos, nRow, nRow, miCellPos); if (IsAmbiguousScriptNonZero(nScriptType)) return true; @@ -2857,13 +2861,19 @@ public: return const_cast<ScFormulaCell*>(p)->IsMultilineResult(); } + /** + * Callback for a block of other types. + */ std::pair<size_t,bool> operator() (const sc::CellStoreType::value_type& node, size_t nOffset, size_t nDataSize) { typedef std::pair<size_t,bool> RetType; if (node.type == sc::element_type_empty) + // Ignore empty blocks. return RetType(0, false); + // Check the script type of a non-empty element and see if it has + // multiple script types. for (size_t i = 0; i < nDataSize; ++i) { SCROW nRow = node.position + i + nOffset; @@ -2873,6 +2883,7 @@ public: return RetType(i+nOffset, true); } + // No edit text cell found. return RetType(0, false); } }; @@ -3238,7 +3249,7 @@ bool ScColumn::HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW& rFirst) { // used in GetOptimalHeight - ambiguous script type counts as edit cell - FindEditCellsHandler aFunc(*this, maCellTextAttrs, maCells.begin()); + FindEditCellsHandler aFunc(*this); std::pair<sc::CellStoreType::const_iterator,size_t> aPos = sc::FindFormulaEditText(maCells, nStartRow, nEndRow, aFunc); |