diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-11-20 11:31:42 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-11-20 11:34:26 -0500 |
commit | 49a3f0c43e8f0ad236445a374b9524634645f824 (patch) | |
tree | fdb9449380d390e3b3aa828e65a09aa350ac8933 | |
parent | c3a9a9542b018f781ee12e6c8c943d4f19641afe (diff) |
No need to start listening in CalcAfterLoad for xls import.
We do that prior to it, and in fact, doing it here would unregister all
group area listeners and re-register non-group ones, which is massively
slower with huge documents.
Change-Id: I693f681df05f036eb1aa53554e601066c469f49a
-rw-r--r-- | sc/inc/column.hxx | 2 | ||||
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/inc/formulacell.hxx | 2 | ||||
-rw-r--r-- | sc/inc/table.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/column.cxx | 11 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/data/table2.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/excel/read.cxx | 4 |
9 files changed, 21 insertions, 16 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index a46e55da2cb8..da940248f672 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -355,7 +355,7 @@ public: void SetDirtyAfterLoad(); void SetTableOpDirty( const ScRange& ); void CalcAll(); - void CalcAfterLoad( sc::CompileFormulaContext& rCxt ); + void CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartListening ); void CompileAll( sc::CompileFormulaContext& rCxt ); void CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress ); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index d9044739a30b..ee43f2c97b1a 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1016,7 +1016,7 @@ public: void SetTableOpDirty( const ScRange& ); // for Interpreter TableOp void InterpretDirtyCells( const ScRangeList& rRanges ); SC_DLLPUBLIC void CalcAll(); - SC_DLLPUBLIC void CalcAfterLoad(); + SC_DLLPUBLIC void CalcAfterLoad( bool bStartListening = true ); void CompileAll(); void CompileXML(); diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index 67381a01a002..50a6f6cb3a64 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -237,7 +237,7 @@ public: void CompileTokenArray( bool bNoListening = false ); void CompileTokenArray( sc::CompileFormulaContext& rCxt, bool bNoListening = false ); void CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress ); // compile temporary string tokens - void CalcAfterLoad( sc::CompileFormulaContext& rCxt ); + void CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartListening ); bool MarkUsedExternalReferences(); void Interpret(); bool IsIterCell() const { return bIsIterCell; } diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 02a88efb3175..04ebaa94d7d1 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -533,7 +533,7 @@ public: void SetDirtyVar(); void SetTableOpDirty( const ScRange& ); void CalcAll(); - void CalcAfterLoad( sc::CompileFormulaContext& rCxt ); + void CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartListening ); void CompileAll( sc::CompileFormulaContext& rCxt ); void CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress ); diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index f3821966ea28..c0e2991912c3 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2824,12 +2824,15 @@ public: class CalcAfterLoadHandler { sc::CompileFormulaContext& mrCxt; + bool mbStartListening; + public: - CalcAfterLoadHandler( sc::CompileFormulaContext& rCxt ) : mrCxt(rCxt) {} + CalcAfterLoadHandler( sc::CompileFormulaContext& rCxt, bool bStartListening ) : + mrCxt(rCxt), mbStartListening(bStartListening) {} void operator() (size_t /*nRow*/, ScFormulaCell* pCell) { - pCell->CalcAfterLoad(mrCxt); + pCell->CalcAfterLoad(mrCxt, mbStartListening); } }; @@ -3257,9 +3260,9 @@ bool ScColumn::CompileErrorCells( sc::CompileFormulaContext& rCxt, sal_uInt16 nE return aHdl.isCompiled(); } -void ScColumn::CalcAfterLoad( sc::CompileFormulaContext& rCxt ) +void ScColumn::CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartListening ) { - CalcAfterLoadHandler aFunc(rCxt); + CalcAfterLoadHandler aFunc(rCxt, bStartListening); sc::ProcessFormula(maCells, aFunc); } diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index a8a370786c66..9f9e45ee41ee 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3740,7 +3740,7 @@ bool ScDocument::CompileErrorCells(sal_uInt16 nErrCode) return bCompiled; } -void ScDocument::CalcAfterLoad() +void ScDocument::CalcAfterLoad( bool bStartListening ) { if (bIsClip) // Excel-Dateien werden aus dem Clipboard in ein Clip-Doc geladen return; // dann wird erst beim Einfuegen in das richtige Doc berechnet @@ -3751,7 +3751,7 @@ void ScDocument::CalcAfterLoad() TableContainer::iterator it = maTabs.begin(); for (; it != maTabs.end(); ++it) if (*it) - (*it)->CalcAfterLoad(aCxt); + (*it)->CalcAfterLoad(aCxt, bStartListening); for (it = maTabs.begin(); it != maTabs.end(); ++it) if (*it) (*it)->SetDirtyAfterLoad(); diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 9fe02a20b8e5..dfeda726016f 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -1283,7 +1283,7 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr pDocument->PutInFormulaTree(this); } -void ScFormulaCell::CalcAfterLoad( sc::CompileFormulaContext& rCxt ) +void ScFormulaCell::CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartListening ) { bool bNewCompiled = false; // If a Calc 1.0-doc is read, we have a result, but no token array @@ -1332,7 +1332,9 @@ void ScFormulaCell::CalcAfterLoad( sc::CompileFormulaContext& rCxt ) // the listener and Recalculate (if needed) if not RECALCMODE_NORMAL if( !bNewCompiled || !pCode->GetCodeError() ) { - StartListeningTo( pDocument ); + if (bStartListening) + StartListeningTo(pDocument); + if( !pCode->IsRecalcModeNormal() ) bDirty = true; } diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index ef81e6d35fd5..a787f6374bf4 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -1772,10 +1772,10 @@ bool ScTable::CompileErrorCells( sc::CompileFormulaContext& rCxt, sal_uInt16 nEr return bCompiled; } -void ScTable::CalcAfterLoad( sc::CompileFormulaContext& rCxt ) +void ScTable::CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartListening ) { for (SCCOL i = 0; i <= MAXCOL; ++i) - aCol[i].CalcAfterLoad(rCxt); + aCol[i].CalcAfterLoad(rCxt, bStartListening); } void ScTable::ResetChanged( const ScRange& rRange ) diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx index 30d50453888e..777088bc593f 100644 --- a/sc/source/filter/excel/read.cxx +++ b/sc/source/filter/excel/read.cxx @@ -752,7 +752,7 @@ FltError ImportExcel::Read( void ) AdjustRowHeight(); PostDocLoad(); - pD->CalcAfterLoad(); + pD->CalcAfterLoad(false); const XclImpAddressConverter& rAddrConv = GetAddressConverter(); if( rAddrConv.IsTabTruncated() ) @@ -1291,7 +1291,7 @@ FltError ImportExcel8::Read( void ) #endif PostDocLoad(); - pD->CalcAfterLoad(); + pD->CalcAfterLoad(false); // import change tracking data XclImpChangeTrack aImpChTr( GetRoot(), maStrm ); |