summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-11-07 23:49:46 +0100
committerEike Rathke <erack@redhat.com>2016-11-08 00:03:45 +0100
commit05d2a66955f8a6552a79696474386ca9f45f9ef2 (patch)
treea21e51c08da05c57be27eaf2087548aaf783c8fc
parent64a708cba9b954afe3331f63c58218eb53b3d0ce (diff)
Resolves: tdf#103701 bulk-broadcast the correct hint ID for formula groups
BulkBroadcastGroupAreas() and BulkDataHint and thus FormulaGroupAreaListener::Notify() omitted to transport the actual hint and assumed SC_HINT_DATACHANGED, but SC_HINT_TABLEOPDIRTY needs to be handled as well. Change-Id: I765f7c95f7aeab295f35dcf6949a3b1926cbe248
-rw-r--r--sc/inc/bulkdatahint.hxx2
-rw-r--r--sc/inc/document.hxx2
-rw-r--r--sc/source/core/data/bcaslot.cxx12
-rw-r--r--sc/source/core/data/documen2.cxx2
-rw-r--r--sc/source/core/data/documen7.cxx14
-rw-r--r--sc/source/core/data/document.cxx10
-rw-r--r--sc/source/core/data/table2.cxx6
-rw-r--r--sc/source/core/inc/bcaslot.hxx11
-rw-r--r--sc/source/core/tool/bulkdatahint.cxx4
-rw-r--r--sc/source/core/tool/grouparealistener.cxx21
10 files changed, 42 insertions, 42 deletions
diff --git a/sc/inc/bulkdatahint.hxx b/sc/inc/bulkdatahint.hxx
index 96ee1035cf14..0fc35feeebf6 100644
--- a/sc/inc/bulkdatahint.hxx
+++ b/sc/inc/bulkdatahint.hxx
@@ -28,7 +28,7 @@ class BulkDataHint : public SfxHint
BulkDataHint& operator= ( const BulkDataHint& ) = delete;
public:
- BulkDataHint( ScDocument& rDoc );
+ BulkDataHint( ScDocument& rDoc, sal_uInt32 nHintId );
virtual ~BulkDataHint() override;
void setSpans( const ColumnSpanSet* pSpans );
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index fac198f3dcbe..1a710a0489a9 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2087,7 +2087,7 @@ public:
void TrackFormulas( sal_uInt32 nHintId = SC_HINT_DATACHANGED );
void SetTrackFormulasPending() { mbTrackFormulasPending = true; }
bool IsTrackFormulasPending() const { return mbTrackFormulasPending; }
- void FinalTrackFormulas();
+ void FinalTrackFormulas( sal_uInt32 nHintId );
bool IsFinalTrackFormulas() const { return mbFinalTrackFormulas; }
bool IsInFormulaTree( ScFormulaCell* pCell ) const;
bool IsInFormulaTrack( ScFormulaCell* pCell ) const;
diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx
index 368906232740..8eb426b35af3 100644
--- a/sc/source/core/data/bcaslot.cxx
+++ b/sc/source/core/data/bcaslot.cxx
@@ -1091,19 +1091,19 @@ void ScBroadcastAreaSlotMachine::EnterBulkBroadcast()
++nInBulkBroadcast;
}
-void ScBroadcastAreaSlotMachine::LeaveBulkBroadcast()
+void ScBroadcastAreaSlotMachine::LeaveBulkBroadcast( sal_uInt32 nHintId )
{
if (nInBulkBroadcast > 0)
{
if (--nInBulkBroadcast == 0)
{
ScBroadcastAreasBulk().swap( aBulkBroadcastAreas);
- bool bBroadcasted = BulkBroadcastGroupAreas();
+ bool bBroadcasted = BulkBroadcastGroupAreas( nHintId );
// Trigger the "final" tracking.
if (pDoc->IsTrackFormulasPending())
- pDoc->FinalTrackFormulas();
+ pDoc->FinalTrackFormulas( nHintId );
else if (bBroadcasted)
- pDoc->TrackFormulas();
+ pDoc->TrackFormulas( nHintId );
}
}
}
@@ -1127,12 +1127,12 @@ void ScBroadcastAreaSlotMachine::InsertBulkGroupArea( ScBroadcastArea* pArea, co
pSet->set(rRange, true);
}
-bool ScBroadcastAreaSlotMachine::BulkBroadcastGroupAreas()
+bool ScBroadcastAreaSlotMachine::BulkBroadcastGroupAreas( sal_uInt32 nHintId )
{
if (m_BulkGroupAreas.empty())
return false;
- sc::BulkDataHint aHint(*pDoc);
+ sc::BulkDataHint aHint( *pDoc, nHintId);
bool bBroadcasted = false;
BulkGroupAreasType::iterator it = m_BulkGroupAreas.begin(), itEnd = m_BulkGroupAreas.end();
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 4e60404d613f..20db59e1ad80 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -1003,7 +1003,7 @@ sal_uLong ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
sc::CopyToDocContext aCxt(*this);
nDestPos = std::min(nDestPos, (SCTAB)(GetTableCount() - 1));
{ // scope for bulk broadcast
- ScBulkBroadcast aBulkBroadcast( pBASM);
+ ScBulkBroadcast aBulkBroadcast( pBASM, SC_HINT_DATACHANGED);
if (!bResultsOnly)
{
const bool bGlobalNamesToLocal = false;
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 27538b6dbab2..437cf4c815e6 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -62,7 +62,7 @@ void ScDocument::Broadcast( const ScHint& rHint )
return ; // Clipboard or Undo
if ( eHardRecalcState == HARDRECALCSTATE_OFF )
{
- ScBulkBroadcast aBulkBroadcast( pBASM); // scoped bulk broadcast
+ ScBulkBroadcast aBulkBroadcast( pBASM, rHint.GetId()); // scoped bulk broadcast
bool bIsBroadcasted = false;
SvtBroadcaster* pBC = GetBroadcaster(rHint.GetAddress());
if ( pBC )
@@ -98,7 +98,7 @@ void ScDocument::BroadcastCells( const ScRange& rRange, sal_uInt32 nHint, bool b
if (eHardRecalcState == HARDRECALCSTATE_OFF)
{
- ScBulkBroadcast aBulkBroadcast( pBASM); // scoped bulk broadcast
+ ScBulkBroadcast aBulkBroadcast( pBASM, nHint); // scoped bulk broadcast
bool bIsBroadcasted = false;
if (bBroadcastSingleBroadcasters)
@@ -226,7 +226,7 @@ void ScDocument::AreaBroadcast( const ScHint& rHint )
return ; // Clipboard or Undo
if (eHardRecalcState == HARDRECALCSTATE_OFF)
{
- ScBulkBroadcast aBulkBroadcast( pBASM); // scoped bulk broadcast
+ ScBulkBroadcast aBulkBroadcast( pBASM, rHint.GetId()); // scoped bulk broadcast
if ( pBASM->AreaBroadcast( rHint ) )
TrackFormulas( rHint.GetId() );
}
@@ -535,18 +535,18 @@ bool ScDocument::IsInFormulaTrack( ScFormulaCell* pCell ) const
return pCell->GetPreviousTrack() || pFormulaTrack == pCell;
}
-void ScDocument::FinalTrackFormulas()
+void ScDocument::FinalTrackFormulas( sal_uInt32 nHintId )
{
mbTrackFormulasPending = false;
mbFinalTrackFormulas = true;
{
- ScBulkBroadcast aBulk( GetBASM());
+ ScBulkBroadcast aBulk( GetBASM(), nHintId);
// Collect all pending formula cells in bulk.
- TrackFormulas();
+ TrackFormulas( nHintId );
}
// A final round not in bulk to track all remaining formula cells and their
// dependents that were collected during ScBulkBroadcast dtor.
- TrackFormulas();
+ TrackFormulas( nHintId );
mbFinalTrackFormulas = false;
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 5883506b2195..0d653d07721f 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -1241,7 +1241,7 @@ struct BroadcastRecalcOnRefMoveHandler : std::unary_function<ScTable*, void>
explicit BroadcastRecalcOnRefMoveHandler( ScDocument* pDoc ) :
aSwitch( *pDoc, false),
- aBulk( pDoc->GetBASM())
+ aBulk( pDoc->GetBASM(), SC_HINT_DATACHANGED)
{
}
@@ -2943,7 +2943,7 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
StartListeningFromClip( nAllCol1, nAllRow1, nAllCol2, nAllRow2, rMark, nInsFlag );
{
- ScBulkBroadcast aBulkBroadcast( GetBASM());
+ ScBulkBroadcast aBulkBroadcast( GetBASM(), SC_HINT_DATACHANGED);
// Set all formula cells dirty, and collect non-empty non-formula cell
// positions so that we can broadcast on them below.
@@ -3031,7 +3031,7 @@ void ScDocument::CopyMultiRangeFromClip(
aDestRange.aEnd.Col(), aDestRange.aEnd.Row(), rMark, nInsFlag );
{
- ScBulkBroadcast aBulkBroadcast( GetBASM());
+ ScBulkBroadcast aBulkBroadcast( GetBASM(), SC_HINT_DATACHANGED);
// Set formula cells dirty and collect non-formula cells.
SetDirtyFromClip(
@@ -3774,7 +3774,7 @@ void ScDocument::SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt )
bool bOldAutoCalc = GetAutoCalc();
bAutoCalc = false; // no mulitple calculations
{ // scope for bulk broadcast
- ScBulkBroadcast aBulkBroadcast( GetBASM());
+ ScBulkBroadcast aBulkBroadcast( GetBASM(), SC_HINT_DATACHANGED);
TableContainer::iterator it = maTabs.begin();
for (;it != maTabs.end(); ++it)
if (*it)
@@ -3795,7 +3795,7 @@ void ScDocument::SetDirty( const ScRange& rRange, bool bIncludeEmptyCells )
bool bOldAutoCalc = GetAutoCalc();
bAutoCalc = false; // no mulitple calculations
{ // scope for bulk broadcast
- ScBulkBroadcast aBulkBroadcast( GetBASM());
+ ScBulkBroadcast aBulkBroadcast( GetBASM(), SC_HINT_DATACHANGED);
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,
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index ddcbbaaf343a..55afa01a540e 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -242,7 +242,7 @@ void ScTable::DeleteRow(
}
{ // scope for bulk broadcast
- ScBulkBroadcast aBulkBroadcast( pDocument->GetBASM());
+ ScBulkBroadcast aBulkBroadcast( pDocument->GetBASM(), SC_HINT_DATACHANGED);
for (SCCOL j=nStartCol; j<=nEndCol; j++)
aCol[j].DeleteRow(nStartRow, nSize, pGroupPos);
}
@@ -430,7 +430,7 @@ void ScTable::DeleteArea(
if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2))
{
{ // scope for bulk broadcast
- ScBulkBroadcast aBulkBroadcast( pDocument->GetBASM());
+ ScBulkBroadcast aBulkBroadcast( pDocument->GetBASM(), SC_HINT_DATACHANGED);
for (SCCOL i = nCol1; i <= nCol2; i++)
aCol[i].DeleteArea(nRow1, nRow2, nDelFlag, bBroadcast, pBroadcastSpans);
}
@@ -457,7 +457,7 @@ void ScTable::DeleteArea(
void ScTable::DeleteSelection( InsertDeleteFlags nDelFlag, const ScMarkData& rMark, bool bBroadcast )
{
{ // scope for bulk broadcast
- ScBulkBroadcast aBulkBroadcast( pDocument->GetBASM());
+ ScBulkBroadcast aBulkBroadcast( pDocument->GetBASM(), SC_HINT_DATACHANGED);
for (SCCOL i=0; i<=MAXCOL; i++)
aCol[i].DeleteSelection(nDelFlag, rMark, bBroadcast);
}
diff --git a/sc/source/core/inc/bcaslot.hxx b/sc/source/core/inc/bcaslot.hxx
index 9ff6b9720a9c..732d18dcb343 100644
--- a/sc/source/core/inc/bcaslot.hxx
+++ b/sc/source/core/inc/bcaslot.hxx
@@ -318,12 +318,12 @@ public:
const ScRange& rRange,
SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
void EnterBulkBroadcast();
- void LeaveBulkBroadcast();
+ void LeaveBulkBroadcast( sal_uInt32 nHintId );
bool InsertBulkArea( const ScBroadcastArea* p );
void InsertBulkGroupArea( ScBroadcastArea* pArea, const ScRange& rRange );
void RemoveBulkGroupArea( ScBroadcastArea* pArea );
- bool BulkBroadcastGroupAreas();
+ bool BulkBroadcastGroupAreas( sal_uInt32 nHintId );
/// @return: how many removed
size_t RemoveBulkArea( const ScBroadcastArea* p );
@@ -350,8 +350,11 @@ public:
class ScBulkBroadcast
{
ScBroadcastAreaSlotMachine* pBASM;
+ sal_uInt32 mnHintId;
public:
- explicit ScBulkBroadcast( ScBroadcastAreaSlotMachine* p ) : pBASM(p)
+ explicit ScBulkBroadcast( ScBroadcastAreaSlotMachine* p, sal_uInt32 nHintId ) :
+ pBASM(p),
+ mnHintId(nHintId)
{
if (pBASM)
pBASM->EnterBulkBroadcast();
@@ -359,7 +362,7 @@ public:
~ScBulkBroadcast()
{
if (pBASM)
- pBASM->LeaveBulkBroadcast();
+ pBASM->LeaveBulkBroadcast( mnHintId );
}
};
diff --git a/sc/source/core/tool/bulkdatahint.cxx b/sc/source/core/tool/bulkdatahint.cxx
index 506942a23faa..4b71c74e84ae 100644
--- a/sc/source/core/tool/bulkdatahint.cxx
+++ b/sc/source/core/tool/bulkdatahint.cxx
@@ -21,8 +21,8 @@ struct BulkDataHint::Impl
mpSpans(nullptr) {}
};
-BulkDataHint::BulkDataHint( ScDocument& rDoc ) :
- SfxHint(SC_HINT_BULK_DATACHANGED), mpImpl(new Impl(rDoc)) {}
+BulkDataHint::BulkDataHint( ScDocument& rDoc, sal_uInt32 nHintId ) :
+ SfxHint( SC_HINT_BULK_DATACHANGED | nHintId ), mpImpl(new Impl(rDoc)) {}
BulkDataHint::~BulkDataHint()
{
diff --git a/sc/source/core/tool/grouparealistener.cxx b/sc/source/core/tool/grouparealistener.cxx
index c4f27730f0c0..5c5b0a310c5c 100644
--- a/sc/source/core/tool/grouparealistener.cxx
+++ b/sc/source/core/tool/grouparealistener.cxx
@@ -107,19 +107,16 @@ ScRange FormulaGroupAreaListener::getListeningRange() const
void FormulaGroupAreaListener::Notify( const SfxHint& rHint )
{
- switch (rHint.GetId())
+ // SC_HINT_BULK_DATACHANGED may include (SC_HINT_DATACHANGED |
+ // SC_HINT_TABLEOPDIRTY) so has to be checked first.
+ if (rHint.GetId() & SC_HINT_BULK_DATACHANGED)
{
- case SC_HINT_DATACHANGED:
- notifyCellChange(rHint, static_cast<const ScHint*>(&rHint)->GetAddress());
- break;
- case SC_HINT_BULK_DATACHANGED:
- {
- const BulkDataHint& rBulkHint = static_cast<const BulkDataHint&>(rHint);
- notifyBulkChange(rBulkHint);
- }
- break;
- default:
- ;
+ const BulkDataHint& rBulkHint = static_cast<const BulkDataHint&>(rHint);
+ notifyBulkChange(rBulkHint);
+ }
+ else if (rHint.GetId() & (SC_HINT_DATACHANGED | SC_HINT_TABLEOPDIRTY))
+ {
+ notifyCellChange(rHint, static_cast<const ScHint*>(&rHint)->GetAddress());
}
}