summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-11-07 23:49:46 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-11-11 15:29:31 +0000
commite64460d8d2e6deeb234d744f7618f11e70385e81 (patch)
tree459a5feeb57c0fbfd9d508020d52253b87526b22 /sc
parent2bb209eeb9db2243d4a0e9d460adb210c8bfd0c8 (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. (cherry picked from commit 05d2a66955f8a6552a79696474386ca9f45f9ef2) Backported. Conflicts: sc/inc/bulkdatahint.hxx sc/inc/document.hxx sc/source/core/data/bcaslot.cxx sc/source/core/data/documen7.cxx sc/source/core/data/document.cxx sc/source/core/inc/bcaslot.hxx sc/source/core/tool/bulkdatahint.cxx sc/source/core/tool/grouparealistener.cxx Change-Id: I765f7c95f7aeab295f35dcf6949a3b1926cbe248 Reviewed-on: https://gerrit.libreoffice.org/30701 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/bulkdatahint.hxx2
-rw-r--r--sc/source/core/data/bcaslot.cxx10
-rw-r--r--sc/source/core/data/documen2.cxx2
-rw-r--r--sc/source/core/data/documen7.cxx6
-rw-r--r--sc/source/core/data/document.cxx8
-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
9 files changed, 35 insertions, 35 deletions
diff --git a/sc/inc/bulkdatahint.hxx b/sc/inc/bulkdatahint.hxx
index 4b375848f87b..c35e0275f74a 100644
--- a/sc/inc/bulkdatahint.hxx
+++ b/sc/inc/bulkdatahint.hxx
@@ -28,7 +28,7 @@ class BulkDataHint : public SfxSimpleHint
BulkDataHint& operator= ( const BulkDataHint& ) = delete;
public:
- BulkDataHint( ScDocument& rDoc, const ColumnSpanSet* pSpans );
+ BulkDataHint( ScDocument& rDoc, const ColumnSpanSet* pSpans, sal_uInt32 nHintId );
virtual ~BulkDataHint();
void setSpans( const ColumnSpanSet* pSpans );
diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx
index 8d5e1bb24623..c171b44c8edb 100644
--- a/sc/source/core/data/bcaslot.cxx
+++ b/sc/source/core/data/bcaslot.cxx
@@ -1091,14 +1091,14 @@ void ScBroadcastAreaSlotMachine::EnterBulkBroadcast()
++nInBulkBroadcast;
}
-void ScBroadcastAreaSlotMachine::LeaveBulkBroadcast()
+void ScBroadcastAreaSlotMachine::LeaveBulkBroadcast( sal_uInt32 nHintId )
{
if (nInBulkBroadcast > 0)
{
if (--nInBulkBroadcast == 0)
{
ScBroadcastAreasBulk().swap( aBulkBroadcastAreas);
- BulkBroadcastGroupAreas();
+ BulkBroadcastGroupAreas( nHintId );
}
}
}
@@ -1122,12 +1122,12 @@ void ScBroadcastAreaSlotMachine::InsertBulkGroupArea( ScBroadcastArea* pArea, co
pSet->set(rRange, true);
}
-void ScBroadcastAreaSlotMachine::BulkBroadcastGroupAreas()
+void ScBroadcastAreaSlotMachine::BulkBroadcastGroupAreas( sal_uInt32 nHintId )
{
if (m_BulkGroupAreas.empty())
return;
- sc::BulkDataHint aHint(*pDoc, nullptr);
+ sc::BulkDataHint aHint(*pDoc, nullptr, nHintId);
bool bBroadcasted = false;
BulkGroupAreasType::iterator it = m_BulkGroupAreas.begin(), itEnd = m_BulkGroupAreas.end();
@@ -1154,7 +1154,7 @@ void ScBroadcastAreaSlotMachine::BulkBroadcastGroupAreas()
m_BulkGroupAreas.clear();
if (bBroadcasted)
- pDoc->TrackFormulas();
+ pDoc->TrackFormulas( nHintId );
}
size_t ScBroadcastAreaSlotMachine::RemoveBulkArea( const ScBroadcastArea* pArea )
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index dddcde6aed63..9c30f0f4740e 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -1005,7 +1005,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 681601051ea3..70e7fba41143 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() );
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 1ae845440acf..3ce2df46be7e 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2904,7 +2904,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.
@@ -2992,7 +2992,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(
@@ -3722,7 +3722,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)
@@ -3743,7 +3743,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 479c17a8e6c4..923005a0d250 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 a7d020b3ff3c..e4f0dbd32987 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 );
- void BulkBroadcastGroupAreas();
+ void 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 72ac7c025a2b..fde0012eac46 100644
--- a/sc/source/core/tool/bulkdatahint.cxx
+++ b/sc/source/core/tool/bulkdatahint.cxx
@@ -21,8 +21,8 @@ struct BulkDataHint::Impl
mpSpans(pSpans) {}
};
-BulkDataHint::BulkDataHint( ScDocument& rDoc, const ColumnSpanSet* pSpans ) :
- SfxSimpleHint(SC_HINT_BULK_DATACHANGED), mpImpl(new Impl(rDoc, pSpans)) {}
+BulkDataHint::BulkDataHint( ScDocument& rDoc, const ColumnSpanSet* pSpans, sal_uInt32 nHintId ) :
+ SfxSimpleHint( SC_HINT_BULK_DATACHANGED | nHintId ), mpImpl(new Impl(rDoc, pSpans)) {}
BulkDataHint::~BulkDataHint()
{
diff --git a/sc/source/core/tool/grouparealistener.cxx b/sc/source/core/tool/grouparealistener.cxx
index 70847d826fcb..dd89c6994f87 100644
--- a/sc/source/core/tool/grouparealistener.cxx
+++ b/sc/source/core/tool/grouparealistener.cxx
@@ -111,19 +111,16 @@ void FormulaGroupAreaListener::Notify( const SfxHint& rHint )
if (!pSimpleHint)
return;
- switch (pSimpleHint->GetId())
+ // SC_HINT_BULK_DATACHANGED may include (SC_HINT_DATACHANGED |
+ // SC_HINT_TABLEOPDIRTY) so has to be checked first.
+ if (pSimpleHint->GetId() & SC_HINT_BULK_DATACHANGED)
{
- case SC_HINT_DATACHANGED:
- notifyCellChange(rHint, static_cast<const ScHint*>(pSimpleHint)->GetAddress());
- break;
- case SC_HINT_BULK_DATACHANGED:
- {
- const BulkDataHint& rBulkHint = static_cast<const BulkDataHint&>(*pSimpleHint);
- notifyBulkChange(rBulkHint);
- }
- break;
- default:
- ;
+ const BulkDataHint& rBulkHint = static_cast<const BulkDataHint&>(rHint);
+ notifyBulkChange(rBulkHint);
+ }
+ else if (pSimpleHint->GetId() & (SC_HINT_DATACHANGED | SC_HINT_TABLEOPDIRTY))
+ {
+ notifyCellChange(rHint, static_cast<const ScHint*>(&rHint)->GetAddress());
}
}