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

Eike Rathke erack at redhat.com
Tue Dec 9 04:19:55 PST 2014


 sc/inc/document.hxx              |    2 +-
 sc/source/core/data/documen7.cxx |   37 ++++++++++++++++++++-----------------
 sc/source/core/data/document.cxx |    5 ++++-
 3 files changed, 25 insertions(+), 19 deletions(-)

New commits:
commit 65a44185a66450aa5bc0c7bc6cdd1c2f0efdd672
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Dec 9 12:44:44 2014 +0100

    activate BROADCAST_BROADCASTERS to speedup SetDirty with range
    
    No need to iterate through all cell positions and attempt a broadcast if
    no one is listening. Instead, broadcast only the cell broadcasters and
    use AreaBroadcast for the area listeners.
    
    Change-Id: I1e666e8ff19ac0715f73d73f54da2e4c8d523173

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index c135508..52a252e 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1869,7 +1869,7 @@ public:
                          */
     void                Broadcast( const ScHint& rHint );
 
-    void BroadcastCells( const ScRange& rRange, sal_uLong nHint );
+    void BroadcastCells( const ScRange& rRange, sal_uLong nHint, bool bBroadcastSingleBroadcasters = true );
     void BroadcastRefMoved( const sc::RefMovedHint& rHint );
 
                         /// only area, no cell broadcast
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 5b6c3a4..64fc158 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -96,7 +96,7 @@ void ScDocument::Broadcast( const ScHint& rHint )
     }
 }
 
-void ScDocument::BroadcastCells( const ScRange& rRange, sal_uLong nHint )
+void ScDocument::BroadcastCells( const ScRange& rRange, sal_uLong nHint, bool bBroadcastSingleBroadcasters )
 {
     ClearFormulaContext();
 
@@ -118,26 +118,29 @@ void ScDocument::BroadcastCells( const ScRange& rRange, sal_uLong nHint )
         ScBulkBroadcast aBulkBroadcast( pBASM);     // scoped bulk broadcast
         bool bIsBroadcasted = false;
 
-        for (SCTAB nTab = nTab1; nTab <= nTab2; ++nTab)
+        if (bBroadcastSingleBroadcasters)
         {
-            ScTable* pTab = FetchTable(nTab);
-            if (!pTab)
-                continue;
-
-            rPos.SetTab(nTab);
-            for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
+            for (SCTAB nTab = nTab1; nTab <= nTab2; ++nTab)
             {
-                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)
+                ScTable* pTab = FetchTable(nTab);
+                if (!pTab)
+                    continue;
+
+                rPos.SetTab(nTab);
+                for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
                 {
-                    SvtBroadcaster* pBC = pTab->GetBroadcaster( nCol, nRow);
-                    if (pBC)
+                    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.SetRow(nRow);
-                        pBC->Broadcast(aHint);
-                        bIsBroadcasted = true;
+                        SvtBroadcaster* pBC = pTab->GetBroadcaster( nCol, nRow);
+                        if (pBC)
+                        {
+                            rPos.SetRow(nRow);
+                            pBC->Broadcast(aHint);
+                            bIsBroadcasted = true;
+                        }
                     }
                 }
             }
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index c48d5bc..248cc9d 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3628,7 +3628,10 @@ void ScDocument::SetDirty( const ScRange& rRange, bool bIncludeEmptyCells )
         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 ? ScColumn::BROADCAST_ALL_POSITIONS : ScColumn::BROADCAST_DATA_POSITIONS));
+                    (bIncludeEmptyCells ? ScColumn::BROADCAST_BROADCASTERS : ScColumn::BROADCAST_DATA_POSITIONS));
+
+        if (bIncludeEmptyCells)
+            BroadcastCells( rRange, SC_HINT_DATACHANGED, false);
     }
     SetAutoCalc( bOldAutoCalc );
 }


More information about the Libreoffice-commits mailing list