[Libreoffice-commits] core.git: 3 commits - sc/inc sc/source

Eike Rathke erack at redhat.com
Wed Dec 3 14:57:43 PST 2014


 sc/inc/table.hxx                 |    2 +-
 sc/source/core/data/documen7.cxx |   23 +++++++++++++++++------
 sc/source/core/data/document.cxx |    2 +-
 sc/source/core/data/table2.cxx   |    4 ++--
 4 files changed, 21 insertions(+), 10 deletions(-)

New commits:
commit 7b95b0cc2b7806aa00e5b201e0cd922274d0c04d
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Dec 3 21:09:41 2014 +0100

    do not construct an ScAddress on each iteration
    
    Change-Id: I3c89e649c289cd50035929d4025d0c18968b36f9

diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index dc511a5..45c9416 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -157,10 +157,15 @@ void ScDocument::BroadcastCells( const ScRange& rRange, sal_uLong nHint )
         ScConditionalFormatList* pCondFormList = GetCondFormList(nTab);
         if (pCondFormList)
         {
+            ScAddress aAddress( 0, 0, nTab);
             for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
             {
+                aAddress.SetRow(nRow);
                 for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
-                    pCondFormList->SourceChanged(ScAddress(nCol,nRow,nTab));
+                {
+                    aAddress.SetCol(nCol);
+                    pCondFormList->SourceChanged(aAddress);
+                }
             }
         }
     }
commit 99270aefbfbec2f759f1f96e8777f76bc113dabc
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Dec 3 20:41:33 2014 +0100

    slightly speed-up things by using ScTable access
    
    Change-Id: I378cd0e1eaa0f41799e4e18d1daae813540da77d

diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 6429fa5..dc511a5 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -120,16 +120,22 @@ void ScDocument::BroadcastCells( const ScRange& rRange, sal_uLong nHint )
 
         for (SCTAB nTab = nTab1; nTab <= nTab2; ++nTab)
         {
+            ScTable* pTab = FetchTable(nTab);
+            if (!pTab)
+                continue;
+
             rPos.SetTab(nTab);
-            for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
+            for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
             {
-                rPos.SetRow(nRow);
-                for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
+                rPos.SetCol(nCol);
+                /* TODO: to speed-up things a per column iterator to
+                 * cell-broadcast in a range of rows would come handy. */
+                for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
                 {
-                    rPos.SetCol(nCol);
-                    SvtBroadcaster* pBC = GetBroadcaster(rPos);
+                    SvtBroadcaster* pBC = pTab->GetBroadcaster( nCol, nRow);
                     if (pBC)
                     {
+                        rPos.SetRow(nRow);
                         pBC->Broadcast(aHint);
                         bIsBroadcasted = true;
                     }
commit b8a7c39cf26f6d417efc34acdf6f4c2a6762052d
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Dec 3 19:37:18 2014 +0100

    introduce bool bBroadcast parameter for ScTable::SetDirty()
    
    Change-Id: I62c3714c8036fe8d4b70ee188546c7d69ece1ea5

diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 318805a..d5cb383 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -532,7 +532,7 @@ public:
     void        ResetChanged( const ScRange& rRange );
 
     void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
-    void        SetDirty( const ScRange&, bool bIncludeEmptyCells );
+    void        SetDirty( const ScRange&, bool bBroadcast, bool bIncludeEmptyCells );
     void        SetDirtyAfterLoad();
     void        SetDirtyVar();
     void        SetTableOpDirty( const ScRange& );
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index fdab204..a654eba 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3627,7 +3627,7 @@ void ScDocument::SetDirty( const ScRange& rRange, bool bIncludeEmptyCells )
         ScBulkBroadcast aBulkBroadcast( GetBASM());
         SCTAB nTab2 = rRange.aEnd.Tab();
         for (SCTAB i=rRange.aStart.Tab(); i<=nTab2 && i < static_cast<SCTAB>(maTabs.size()); i++)
-            if (maTabs[i]) maTabs[i]->SetDirty( rRange, bIncludeEmptyCells );
+            if (maTabs[i]) maTabs[i]->SetDirty( rRange, true, bIncludeEmptyCells );
     }
     SetAutoCalc( bOldAutoCalc );
 }
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index fad5443..3665765 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1684,13 +1684,13 @@ void ScTable::SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt )
         aCol[i].SetAllFormulasDirty(rCxt);
 }
 
-void ScTable::SetDirty( const ScRange& rRange, bool bIncludeEmptyCells )
+void ScTable::SetDirty( const ScRange& rRange, bool bBroadcast, bool bIncludeEmptyCells )
 {
     bool bOldAutoCalc = pDocument->GetAutoCalc();
     pDocument->SetAutoCalc( false );    // Mehrfachberechnungen vermeiden
     SCCOL nCol2 = rRange.aEnd.Col();
     for (SCCOL i=rRange.aStart.Col(); i<=nCol2; i++)
-        aCol[i].SetDirty(rRange.aStart.Row(), rRange.aEnd.Row(), true, bIncludeEmptyCells);
+        aCol[i].SetDirty(rRange.aStart.Row(), rRange.aEnd.Row(), bBroadcast, bIncludeEmptyCells);
     pDocument->SetAutoCalc( bOldAutoCalc );
 }
 


More information about the Libreoffice-commits mailing list