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

Michael Meeks michael.meeks at suse.com
Mon Mar 18 09:33:28 PDT 2013


 sc/inc/document.hxx              |    1 +
 sc/inc/table.hxx                 |    1 +
 sc/source/core/data/cell.cxx     |    5 +++++
 sc/source/core/data/column3.cxx  |    4 ++++
 sc/source/core/data/documen9.cxx |    8 ++++++++
 sc/source/core/data/table6.cxx   |    6 ++++++
 6 files changed, 25 insertions(+)

New commits:
commit 222c37d00d44f50362f4fbf57af61c972c840af8
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Mon Mar 18 16:23:04 2013 +0000

    re-build formula groups inside Interpret instead.
    
    Change-Id: Ied1b82011b88f4eacfd5285176f58bf56c057f67

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 175bf14..4dc0602 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1684,6 +1684,7 @@ public:
     SC_DLLPUBLIC void CalcFormulaTree(
         bool bOnlyForced = false, bool bProgressBar = true, bool bSetAllDirty = true );
     void                ClearFormulaTree();
+    void                RebuildFormulaGroups();
     void                AppendToFormulaTrack( ScFormulaCell* pCell );
     void                RemoveFromFormulaTrack( ScFormulaCell* pCell );
     void                TrackFormulas( sal_uLong nHintId = SC_HINT_DATACHANGED );
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 25f4f7a..6a0b078 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -882,6 +882,7 @@ private:
     void        CompileDBFormula( bool bCreateFormulaString );
     void        CompileNameFormula( bool bCreateFormulaString );
     void        CompileColRowNameFormula();
+    void        RebuildFormulaGroups();
 
     void        StartListening( const ScAddress& rAddress, SvtListener* pListener );
     void        EndListening( const ScAddress& rAddress, SvtListener* pListener );
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index a7133c2..c2247c1 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -1193,6 +1193,11 @@ void ScFormulaCell::Interpret()
     if (!IsDirtyOrInTableOpDirty() || pDocument->GetRecursionHelper().IsInReturn())
         return;     // no double/triple processing
 
+    // Re-build formulae groups - ideally this is done at import / insert / delete etc.
+    // and is reflected in the dependency data ...
+    pDocument->RebuildFormulaGroups();
+
+
     //! HACK:
     //  If the call originates from a Reschedule in DdeLink update, leave dirty
     //  Better: Do a Dde Link Update without Reschedule or do it completely asynchronously!
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 5ddb3f1..d288625 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2036,6 +2036,7 @@ void ScColumn::RebuildFormulaGroups()
         ScFormulaCell *pCur = static_cast< ScFormulaCell *>( rCur.pCell );
         ScFormulaCell *pPrev = static_cast< ScFormulaCell *>( rPrev.pCell );
 
+#ifdef BUILD_FORMULA_GROUPS
         fprintf( stderr, "column has contiguous formulae\n" );
         ScSimilarFormulaDelta *pDelta = pPrev->BuildDeltaTo( pCur );
 
@@ -2080,6 +2081,9 @@ void ScColumn::RebuildFormulaGroups()
 
             pCur->ReleaseDelta( pDelta );
         }
+#else
+        (void)pCur; (void) pPrev;
+#endif
     }
 
     bDirtyGroups = false;
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index b0214b1..4a261e8 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -695,4 +695,12 @@ void ScDocument::ApplyAsianEditSettings( ScEditEngineDefaulter& rEngine )
     rEngine.SetKernAsianPunctuation( GetAsianKerning() );
 }
 
+void ScDocument::RebuildFormulaGroups()
+{
+    SCTAB nTab;
+    for (nTab=0; nTab < static_cast<SCTAB>(maTabs.size()); nTab++)
+        if (maTabs[nTab])
+            maTabs[nTab]->RebuildFormulaGroups();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 8206cd8..f4a5d25 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -1027,4 +1027,10 @@ bool ScTable::SearchRangeForAllEmptyCells(
     return bFound;
 }
 
+void ScTable::RebuildFormulaGroups()
+{
+    for (SCCOL i=0; i<=MAXCOL; i++)
+        aCol[i].RebuildFormulaGroups();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list