[Libreoffice-commits] core.git: Branch 'feature/perfwork5' - sc/inc sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Thu Nov 20 08:32:23 PST 2014


 sc/inc/column.hxx                   |    2 +-
 sc/inc/document.hxx                 |    2 +-
 sc/inc/formulacell.hxx              |    2 +-
 sc/inc/table.hxx                    |    2 +-
 sc/source/core/data/column.cxx      |   11 +++++++----
 sc/source/core/data/document.cxx    |    4 ++--
 sc/source/core/data/formulacell.cxx |    6 ++++--
 sc/source/core/data/table2.cxx      |    4 ++--
 sc/source/filter/excel/read.cxx     |    4 ++--
 9 files changed, 21 insertions(+), 16 deletions(-)

New commits:
commit d84749f6208d179f12a7ad3fcc7d39d060017496
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Nov 20 11:31:42 2014 -0500

    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

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 709840a..81419c8 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -357,7 +357,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 a3bfa07..4b617e5 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1015,7 +1015,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 67381a0..50a6f6c 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 02a88ef..04ebaa9 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 1100d92..4cbb318 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2850,12 +2850,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);
     }
 };
 
@@ -3283,9 +3286,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 40a4672..a513898 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 a4f8944..aa597c3 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 6c6f828..938b6b0 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 30d5045..777088b 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 );


More information about the Libreoffice-commits mailing list