sc/inc/cell.hxx | 4 ++-- sc/inc/document.hxx | 6 ++++-- sc/source/core/data/cell.cxx | 11 ++++++----- sc/source/core/data/documen4.cxx | 5 +++-- sc/source/core/data/documen7.cxx | 5 +++-- sc/source/filter/xml/xmlsubti.cxx | 2 +- sc/source/ui/docshell/docsh.cxx | 2 +- 7 files changed, 20 insertions(+), 15 deletions(-)
New commits: commit f4b6cc0d3d7bb762f3778c3230ec17c25a991f3e Author: Daniel Bankston <daniel.e.banks...@gmail.com> Date: Sat Jul 28 03:24:57 2012 -0500 Improve matrix import performance without breaking dependent cells Change-Id: I961f69b0117d4261f8afefb6d94173105f0925b2 diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx index f609a46..79e99db 100644 --- a/sc/inc/cell.hxx +++ b/sc/inc/cell.hxx @@ -376,7 +376,7 @@ public: void GetFormula( rtl::OUStringBuffer& rBuffer, const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT ) const; - void SetDirty(); + void SetDirty( bool bDirtyFlag=true ); void SetDirtyVar(); // If setting entire document dirty after load, no broadcasts but still append to FormulaTree. void SetDirtyAfterLoad(); @@ -472,7 +472,7 @@ public: virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint); void SetCompile( bool bVal ) { bCompile = bVal; } ScDocument* GetDocument() const { return pDocument; } - void SetMatColsRows( SCCOL nCols, SCROW nRows ); + void SetMatColsRows( SCCOL nCols, SCROW nRows, bool bDirtyFlag=true ); void GetMatColsRows( SCCOL& nCols, SCROW& nRows ) const; // cell belongs to ChangeTrack and not to the real document diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 6d4a02e..8fb2788 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -770,7 +770,8 @@ public: const ScMarkData& rMark, const rtl::OUString& rFormula, const ScTokenArray* p = NULL, - const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT ); + const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT, + bool bDirtyFlag=true ); SC_DLLPUBLIC void InsertTableOp(const ScTabOpParam& rParam, // multi-operation SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark); @@ -1660,7 +1661,8 @@ public: void PutInFormulaTree( ScFormulaCell* pCell ); void RemoveFromFormulaTree( ScFormulaCell* pCell ); void CalcFormulaTree( bool bOnlyForced = false, - bool bNoProgressBar = false ); + bool bNoProgressBar = false, + bool bDirtyFlag=true ); void ClearFormulaTree(); void AppendToFormulaTrack( ScFormulaCell* pCell ); void RemoveFromFormulaTrack( ScFormulaCell* pCell ); diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx index 4676cc8..8f3a0a4 100644 --- a/sc/source/core/data/cell.cxx +++ b/sc/source/core/data/cell.cxx @@ -1726,17 +1726,17 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam ) } -void ScFormulaCell::SetMatColsRows( SCCOL nCols, SCROW nRows ) +void ScFormulaCell::SetMatColsRows( SCCOL nCols, SCROW nRows, bool bDirtyFlag ) { ScMatrixFormulaCellToken* pMat = aResult.GetMatrixFormulaCellTokenNonConst(); if (pMat) - pMat->SetMatColsRows( nCols, nRows); + pMat->SetMatColsRows( nCols, nRows ); else if (nCols || nRows) { aResult.SetToken( new ScMatrixFormulaCellToken( nCols, nRows)); // Setting the new token actually forces an empty result at this top // left cell, so have that recalculated. - SetDirty(); + SetDirty( bDirtyFlag ); } } @@ -1805,7 +1805,7 @@ void ScFormulaCell::Notify( SvtBroadcaster&, const SfxHint& rHint) } } -void ScFormulaCell::SetDirty() +void ScFormulaCell::SetDirty( bool bDirtyFlag ) { if ( !IsInChangeTrack() ) { @@ -1819,7 +1819,8 @@ void ScFormulaCell::SetDirty() // setzen, z.B. in CompileTokenArray if ( !bDirty || !pDocument->IsInFormulaTree( this ) ) { - SetDirtyVar(); + if( bDirtyFlag ) + SetDirtyVar(); pDocument->AppendToFormulaTrack( this ); pDocument->TrackFormulas(); } diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index 41e058a..9b9faa5 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -123,7 +123,8 @@ void ScDocument::InsertMatrixFormula(SCCOL nCol1, SCROW nRow1, const ScMarkData& rMark, const rtl::OUString& rFormula, const ScTokenArray* pArr, - const formula::FormulaGrammar::Grammar eGram ) + const formula::FormulaGrammar::Grammar eGram, + bool bDirtyFlag ) { PutInOrder(nCol1, nCol2); PutInOrder(nRow1, nRow2); @@ -157,7 +158,7 @@ void ScDocument::InsertMatrixFormula(SCCOL nCol1, SCROW nRow1, pCell = new ScFormulaCell( this, aPos, pArr, eGram, MM_FORMULA ); else pCell = new ScFormulaCell( this, aPos, rFormula, eGram, MM_FORMULA ); - pCell->SetMatColsRows( nCol2 - nCol1 + 1, nRow2 - nRow1 + 1 ); + pCell->SetMatColsRows( nCol2 - nCol1 + 1, nRow2 - nRow1 + 1, bDirtyFlag ); itr = rMark.begin(); for (; itr != itrEnd && *itr < nMax; ++itr) { diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx index 71bf25b..e9af746 100644 --- a/sc/source/core/data/documen7.cxx +++ b/sc/source/core/data/documen7.cxx @@ -280,7 +280,7 @@ bool ScDocument::IsInFormulaTree( ScFormulaCell* pCell ) const } -void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bNoProgress ) +void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bNoProgress, bool bDirtyFlag ) { OSL_ENSURE( !IsCalculatingFormulaTree(), "CalcFormulaTree recursion" ); // never ever recurse into this, might end up lost in infinity @@ -317,7 +317,8 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bNoProgress ) } else { // andere simpel berechnen - pCell->SetDirtyVar(); + if( bDirtyFlag ) + pCell->SetDirtyVar(); pCell = pCell->GetNext(); } } diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx index 87cd34e..b1eeb9d 100644 --- a/sc/source/filter/xml/xmlsubti.cxx +++ b/sc/source/filter/xml/xmlsubti.cxx @@ -297,7 +297,7 @@ void ScMyTables::AddMatrixRange( pDoc->InsertMatrixFormula( aScRange.aStart.Col(), aScRange.aStart.Row(), aScRange.aEnd.Col(), aScRange.aEnd.Row(), - aMark, EMPTY_STRING, pCode, eGrammar ); + aMark, EMPTY_STRING, pCode, eGrammar, false ); delete pCode; pDoc->IncXMLImportedFormulaCount( rFormula.getLength() ); } diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 4bbefba..3f800c3 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -438,7 +438,7 @@ sal_Bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::un if(sGenerator.indexOf(SC_LIBO_PROD_NAME) == -1) DoHardRecalc(false); else //still need to recalc volatile formula cells - DoRecalc(false); + aDocument.CalcFormulaTree(false, false, false); aDocument.EnableAdjustHeight(false); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits