summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-12-09 12:44:44 +0100
committerEike Rathke <erack@redhat.com>2014-12-09 13:19:26 +0100
commit65a44185a66450aa5bc0c7bc6cdd1c2f0efdd672 (patch)
tree136836c67f157785010044ddbdb771cb52b904c3 /sc
parent6ddde10b4006ece33bc358a391a13e108a35f6fa (diff)
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
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/document.hxx2
-rw-r--r--sc/source/core/data/documen7.cxx37
-rw-r--r--sc/source/core/data/document.cxx5
3 files changed, 25 insertions, 19 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index c1355081aedb..52a252e75519 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 5b6c3a430b3f..64fc158cb36f 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 c48d5bcbd5e4..248cc9da9229 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 );
}