sc/inc/column.hxx | 5 +++-- sc/source/core/data/column.cxx | 12 +++++++----- sc/source/core/data/column2.cxx | 9 +++++---- sc/source/core/data/column3.cxx | 8 +++++--- sc/source/core/data/table1.cxx | 3 ++- sc/source/ui/docshell/impex.cxx | 8 ++++---- sc/source/ui/inc/impex.hxx | 2 +- 7 files changed, 27 insertions(+), 20 deletions(-)
New commits: commit 7504b3dd8ca4424fd7da91195741b566ce42a2c0 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Wed Oct 30 22:57:45 2013 +0100 extend the position hint to GetRangeScriptType brings a bit more performance benefits. Still not as much as I expected. Change-Id: I1abead8694acdd965520a9353e84824a68672988 diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 61af67c..3ee53d6 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 63433c5..018f9e1 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 207718c..5176d82 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 ee1ed95..ca8a07c 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 commit 89d7363b0029458cb924169f3b0d207a29916fd0 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Wed Oct 30 22:56:41 2013 +0100 don't update row height for csv import, fdo#69009 Multiline cells are already updated and we can skip the other cells. Change-Id: I6690beeaad01543c12cb42247baec6fbc18aaa77 diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index df74149..025737f 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -234,9 +234,9 @@ bool ScImportExport::StartPaste() // Nachbereitung Insert: Undo/Redo-Aktionen erzeugen, Invalidate/Repaint -void ScImportExport::EndPaste() +void ScImportExport::EndPaste(bool bAutoRowHeight) { - bool bHeight = pDocSh && pDocSh->AdjustRowHeight( + bool bHeight = bAutoRowHeight && pDocSh && pDocSh->AdjustRowHeight( aRange.aStart.Row(), aRange.aEnd.Row(), aRange.aStart.Tab() ); if( pUndoDoc && pDoc->IsUndoEnabled() ) @@ -1470,7 +1470,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) nRow = nStartRow; if (!StartPaste()) { - EndPaste(); + EndPaste(false); return false; } } @@ -1481,7 +1481,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) xProgress.reset(); // make room for AdjustRowHeight progress if (bRangeIsDetermined) - EndPaste(); + EndPaste(false); return true; } diff --git a/sc/source/ui/inc/impex.hxx b/sc/source/ui/inc/impex.hxx index 0535c94..4356154 100644 --- a/sc/source/ui/inc/impex.hxx +++ b/sc/source/ui/inc/impex.hxx @@ -70,7 +70,7 @@ class ScImportExport ScAsciiOptions* pExtOptions; // extended options bool StartPaste(); // Protect check, set up Undo - void EndPaste(); // Undo/Redo actions, Repaint + void EndPaste(bool bAutoRowHeight = true); // Undo/Redo actions, Repaint bool Doc2Text( SvStream& ); bool Text2Doc( SvStream& ); bool Doc2Sylk( SvStream& ); commit e7f3330c98d83282f957513941fd7b5a7b9c00b7 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Wed Oct 30 00:50:45 2013 +0100 use positional hint for UpdateScript, fdo#69006 Change-Id: Ie1bdc905e869d56625440e2a52d48993fa2fda9d diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 44ddf38..61af67c 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -544,7 +544,7 @@ private: void ActivateNewFormulaCell( const sc::CellStoreType::iterator& itPos, SCROW nRow, ScFormulaCell& rCell, bool bJoin = true ); void ActivateNewFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell, bool bJoin = true ); void BroadcastNewCell( SCROW nRow ); - bool UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow ); + bool UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, sc::CellStoreType::iterator& itr ); const ScFormulaCell* FetchFormulaCell( SCROW nRow ) const; diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index c7b8f26..207718c 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -2056,13 +2056,14 @@ 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)) + if (UpdateScriptType(rVal, nRow, itr)) bUpdated = true; nScriptType |= rVal.mnScriptType; } @@ -2073,6 +2074,7 @@ sal_uInt8 ScColumn::GetRangeScriptType( nRow += itPos->size - aRet.second; } + sc::CellStoreType::iterator itr = maCells.position(nRow).first; while (nRow <= nRow2) { ++itPos; @@ -2094,7 +2096,7 @@ sal_uInt8 ScColumn::GetRangeScriptType( return nScriptType; sc::CellTextAttr& rVal = *it; - if (UpdateScriptType(rVal, nRow)) + if (UpdateScriptType(rVal, nRow, itr)) bUpdated = true; nScriptType |= rVal.mnScriptType; diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index e1cb2a1..685a8df 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -430,7 +430,7 @@ void ScColumn::BroadcastNewCell( SCROW nRow ) Broadcast(nRow); } -bool ScColumn::UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow ) +bool ScColumn::UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, sc::CellStoreType::iterator& itr ) { if (rAttr.mnScriptType != SC_SCRIPTTYPE_UNKNOWN) // Already updated. Nothing to do. @@ -442,9 +442,11 @@ bool ScColumn::UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow ) if (!pPattern) return false; - ScRefCellValue aCell; + sc::CellStoreType::position_type pos = maCells.position(itr, nRow); + itr = pos.first; + size_t nOffset = pos.second; + ScRefCellValue aCell = GetCellValue( itr, nOffset ); ScAddress aPos(nCol, nRow, nTab); - aCell.assign(*pDocument, aPos); const SfxItemSet* pCondSet = NULL; ScConditionalFormatList* pCFList = pDocument->GetCondFormList(nTab); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits