diff options
author | Eike Rathke <erack@redhat.com> | 2014-12-08 20:11:06 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2014-12-09 03:53:21 +0100 |
commit | 03956d83774cc2d5b0f02ec36105342b3c457931 (patch) | |
tree | 52878cd777797fd46d93403176f13df166d7c7da /sc | |
parent | 6163291b25d2dac74ac353c3879fdc520bee747e (diff) |
introduce ScColumn::BroadcastMode instead of bBroadcast, bIncludeEmptyCells
Not only are multiple boolean parameters ugly, but prepare also for the
new broadcasters-only mode yet to be implemented.
Change-Id: Ie6383826e76a771b88e7b4b29e5de9a58c598ad5
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/column.hxx | 12 | ||||
-rw-r--r-- | sc/inc/table.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/column.cxx | 32 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/table2.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/table4.cxx | 2 |
6 files changed, 35 insertions, 20 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index f07cf8abe908..f7223bb634e6 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -165,6 +165,16 @@ friend class sc::TableValues; ScSetStringParam* pParam ); public: + + /** Broadcast mode for SetDirty(SCROW,SCROW,BroadcastMode). */ + enum BroadcastMode + { + BROADCAST_NONE, ///< no broadcasting + BROADCAST_DATA_POSITIONS, ///< broadcast existing cells with position => does AreaBroadcast + BROADCAST_ALL_POSITIONS, ///< broadcast all cells, including empty, with position => does AreaBroadcast + BROADCAST_BROADCASTERS ///< broadcast only existing cell broadcasters => no AreaBroadcast of range! + }; + ScColumn(); ~ScColumn(); @@ -362,7 +372,7 @@ public: void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt ); void SetDirtyFromClip( SCROW nRow1, SCROW nRow2, sc::ColumnSpanSet& rBroadcastSpans ); - void SetDirty( SCROW nRow1, SCROW nRow2, bool bBroadcast, bool bIncludeEmptyCells ); + void SetDirty( SCROW nRow1, SCROW nRow2, BroadcastMode ); void SetDirtyVar(); void SetDirtyAfterLoad(); void SetTableOpDirty( const ScRange& ); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 1053ea70f296..7661fdace7a7 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&, ScColumn::BroadcastMode ); void SetDirtyAfterLoad(); void SetDirtyVar(); void SetTableOpDirty( const ScRange& ); diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 5185c3aa450f..9fb7470c5718 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -3055,29 +3055,33 @@ void ScColumn::SetDirtyFromClip( SCROW nRow1, SCROW nRow2, sc::ColumnSpanSet& rB aHdl.fillBroadcastSpans(rBroadcastSpans); } -void ScColumn::SetDirty( SCROW nRow1, SCROW nRow2, bool bBroadcast, bool bIncludeEmptyCells ) +void ScColumn::SetDirty( SCROW nRow1, SCROW nRow2, BroadcastMode eMode ) { // broadcasts everything within the range, with FormulaTracking sc::AutoCalcSwitch aSwitch(*pDocument, false); SetDirtyOnRangeHandler aHdl(*this); sc::ProcessFormula(maCells.begin(), maCells, nRow1, nRow2, aHdl, aHdl); - if (bBroadcast) + switch (eMode) { - if (bIncludeEmptyCells) - { - // Broadcast the changes. - ScHint aHint( SC_HINT_DATACHANGED, ScAddress( nCol, 0, nTab)); - for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow) + case BROADCAST_NONE: + break; + case BROADCAST_DATA_POSITIONS: + aHdl.broadcast(); + break; + case BROADCAST_ALL_POSITIONS: + /* TODO: handle BROADCAST_BROADCASTERS separately and as it is + * intended when we handle the AreaBroadcast on the upper levels. */ + case BROADCAST_BROADCASTERS: { - aHint.GetAddress().SetRow(nRow); - pDocument->Broadcast(aHint); + ScHint aHint( SC_HINT_DATACHANGED, ScAddress( nCol, 0, nTab)); + for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow) + { + aHint.GetAddress().SetRow(nRow); + pDocument->Broadcast(aHint); + } } - } - else - { - aHdl.broadcast(); - } + break; } } diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index fdab20404c04..c48d5bcbd5e4 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3627,7 +3627,8 @@ 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, + (bIncludeEmptyCells ? ScColumn::BROADCAST_ALL_POSITIONS : ScColumn::BROADCAST_DATA_POSITIONS)); } SetAutoCalc( bOldAutoCalc ); } diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index fad5443badce..c462d6162731 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, ScColumn::BroadcastMode eMode ) { 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(), eMode); pDocument->SetAutoCalc( bOldAutoCalc ); } diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 61a0be46bca6..bdf1a6aa2b09 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -1184,7 +1184,7 @@ void ScTable::FillFormulaVertical( std::vector<sc::RowSpan>::const_iterator it = aSpans.begin(), itEnd = aSpans.end(); for (; it != itEnd; ++it) - aCol[nCol].SetDirty(it->mnRow1, it->mnRow2, false, false); + aCol[nCol].SetDirty(it->mnRow1, it->mnRow2, ScColumn::BROADCAST_NONE); rProgress += nRow2 - nRow1 + 1; if (pProgress) |