diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-10-30 22:57:45 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-10-30 23:13:21 +0100 |
commit | 7504b3dd8ca4424fd7da91195741b566ce42a2c0 (patch) | |
tree | fbfad118fa92ddfc176ddc5ac8c6979edd88cf04 | |
parent | don't update row height for csv import, fdo#69009 (diff) | |
download | core-7504b3dd8ca4424fd7da91195741b566ce42a2c0.tar.gz core-7504b3dd8ca4424fd7da91195741b566ce42a2c0.zip |
extend the position hint to GetRangeScriptType
brings a bit more performance benefits. Still not as much as I expected.
Change-Id: I1abead8694acdd965520a9353e84824a68672988
-rw-r--r-- | sc/inc/column.hxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/column.cxx | 12 | ||||
-rw-r--r-- | sc/source/core/data/column2.cxx | 11 | ||||
-rw-r--r-- | sc/source/core/data/table1.cxx | 3 |
4 files changed, 16 insertions, 13 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 61af67cd5b48..3ee53d6a02da 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -470,7 +470,8 @@ public: * Get combined script types of the specified range. This method may * update script types on demand if they have not been determined. */ - sal_uInt8 GetRangeScriptType( sc::CellTextAttrStoreType::iterator& itPos, SCROW nRow1, SCROW nRow2 ); + sal_uInt8 GetRangeScriptType( sc::CellTextAttrStoreType::iterator& itPos, SCROW nRow1, SCROW nRow2, + sc::CellStoreType::iterator itr); void SetScriptType( SCROW nRow, sal_uInt8 nType ); diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 63433c558353..018f9e11361e 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2952,10 +2952,12 @@ class FindEditCellsHandler { ScColumn& mrColumn; sc::CellTextAttrStoreType::iterator miAttrPos; + sc::CellStoreType::iterator miCellPos; public: - FindEditCellsHandler(ScColumn& rColumn, sc::CellTextAttrStoreType& rAttrs) : - mrColumn(rColumn), miAttrPos(rAttrs.begin()) {} + FindEditCellsHandler(ScColumn& rColumn, sc::CellTextAttrStoreType& rAttrs, + sc::CellStoreType::iterator rCellItr) : + mrColumn(rColumn), miAttrPos(rAttrs.begin()), miCellPos(rCellItr) {} bool operator() (size_t, const EditTextObject*) { @@ -2964,7 +2966,7 @@ public: bool operator() (size_t nRow, const ScFormulaCell* p) { - sal_uInt8 nScriptType = mrColumn.GetRangeScriptType(miAttrPos, nRow, nRow); + sal_uInt8 nScriptType = mrColumn.GetRangeScriptType(miAttrPos, nRow, nRow, miCellPos); if (IsAmbiguousScriptNonZero(nScriptType)) return true; @@ -2981,7 +2983,7 @@ public: for (size_t i = 0; i < nDataSize; ++i) { SCROW nRow = nTopRow + i; - sal_uInt8 nScriptType = mrColumn.GetRangeScriptType(miAttrPos, nRow, nRow); + sal_uInt8 nScriptType = mrColumn.GetRangeScriptType(miAttrPos, nRow, nRow, miCellPos); if (IsAmbiguousScriptNonZero(nScriptType)) // Return the offset from the first row. return RetType(i, true); @@ -3216,7 +3218,7 @@ bool ScColumn::HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW& rFirst) { // used in GetOptimalHeight - ambiguous script type counts as edit cell - FindEditCellsHandler aFunc(*this, maCellTextAttrs); + FindEditCellsHandler aFunc(*this, maCellTextAttrs, maCells.begin()); std::pair<sc::CellStoreType::const_iterator,size_t> aPos = sc::FindFormulaEditText(maCells, nStartRow, nEndRow, aFunc); diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 207718c3ce7b..5176d82fea2e 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -874,11 +874,12 @@ void ScColumn::GetOptimalHeight( // check for cells with different script type sc::CellTextAttrStoreType::iterator itAttr = maCellTextAttrs.begin(); sc::SingleColumnSpanSet::SpansType::const_iterator it = aSpans.begin(), itEnd = aSpans.end(); + sc::CellStoreType::iterator itCells = maCells.begin(); for (; it != itEnd; ++it) { for (SCROW nRow = it->mnRow1; nRow <= it->mnRow2; ++nRow) { - sal_uInt8 nScript = GetRangeScriptType(itAttr, nRow, nRow); + sal_uInt8 nScript = GetRangeScriptType(itAttr, nRow, nRow, itCells); if (nScript == nDefScript) continue; @@ -2038,7 +2039,7 @@ sal_uInt8 ScColumn::GetScriptType( SCROW nRow ) const } sal_uInt8 ScColumn::GetRangeScriptType( - sc::CellTextAttrStoreType::iterator& itPos, SCROW nRow1, SCROW nRow2 ) + sc::CellTextAttrStoreType::iterator& itPos, SCROW nRow1, SCROW nRow2, sc::CellStoreType::iterator itrCells ) { if (!ValidRow(nRow1) || !ValidRow(nRow2) || nRow1 > nRow2) return 0; @@ -2056,14 +2057,13 @@ sal_uInt8 ScColumn::GetRangeScriptType( sc::celltextattr_block::iterator it = sc::celltextattr_block::begin(*itPos->data); sc::celltextattr_block::iterator itEnd = sc::celltextattr_block::end(*itPos->data); std::advance(it, aRet.second); - sc::CellStoreType::iterator itr = maCells.position(nRow).first; for (; it != itEnd; ++it, ++nRow) { if (nRow > nRow2) return nScriptType; sc::CellTextAttr& rVal = *it; - if (UpdateScriptType(rVal, nRow, itr)) + if (UpdateScriptType(rVal, nRow, itrCells)) bUpdated = true; nScriptType |= rVal.mnScriptType; } @@ -2074,7 +2074,6 @@ sal_uInt8 ScColumn::GetRangeScriptType( nRow += itPos->size - aRet.second; } - sc::CellStoreType::iterator itr = maCells.position(nRow).first; while (nRow <= nRow2) { ++itPos; @@ -2096,7 +2095,7 @@ sal_uInt8 ScColumn::GetRangeScriptType( return nScriptType; sc::CellTextAttr& rVal = *it; - if (UpdateScriptType(rVal, nRow, itr)) + if (UpdateScriptType(rVal, nRow, itrCells)) bUpdated = true; nScriptType |= rVal.mnScriptType; diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index ee1ed95cd5ba..ca8a07c0ede9 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -2129,7 +2129,8 @@ sal_uInt8 ScTable::GetRangeScriptType( if (!ValidCol(nCol)) return 0; - return aCol[nCol].GetRangeScriptType(rBlockPos.miCellTextAttrPos, nRow1, nRow2); + sc::CellStoreType::iterator itr = aCol[nCol].maCells.begin(); + return aCol[nCol].GetRangeScriptType(rBlockPos.miCellTextAttrPos, nRow1, nRow2, itr); } size_t ScTable::GetFormulaHash( SCCOL nCol, SCROW nRow ) const |