Kaydet (Commit) 97fea63d authored tarafından Eike Rathke's avatar Eike Rathke

destroy and reconstruct listeners only if content is affected

Pasting formula content that created a formula group always constructed
group listeners, then destroyed those listeners again and reconstructed
the same listeners, because ScDocument::DeleteArea() is called with
IDF_OBJECTS again if nothing is excluded from paste. Do the listener
stuff only if one or more of the IDF_CONTENTS bits are set.

Change-Id: I8c6b7f7bb3402590f2b1f3259ee730f26a906cdf
üst f6eb112f
...@@ -1787,28 +1787,36 @@ void ScDocument::DeleteArea( ...@@ -1787,28 +1787,36 @@ void ScDocument::DeleteArea(
PutInOrder( nCol1, nCol2 ); PutInOrder( nCol1, nCol2 );
PutInOrder( nRow1, nRow2 ); PutInOrder( nRow1, nRow2 );
// Record the positions of top and/or bottom formula groups that intersect
// the area borders.
std::vector<ScAddress> aGroupPos; std::vector<ScAddress> aGroupPos;
sc::EndListeningContext aCxt(*this); // Destroy and reconstruct listeners only if content is affected.
ScRange aRange(nCol1, nRow1, 0, nCol2, nRow2, 0); bool bDelContent = ((nDelFlag & ~IDF_CONTENTS) != nDelFlag);
for (size_t i = 0; i < maTabs.size(); ++i) if (bDelContent)
{ {
aRange.aStart.SetTab(i); // Record the positions of top and/or bottom formula groups that intersect
aRange.aEnd.SetTab(i); // the area borders.
sc::EndListeningContext aCxt(*this);
ScRange aRange(nCol1, nRow1, 0, nCol2, nRow2, 0);
for (size_t i = 0; i < maTabs.size(); ++i)
{
aRange.aStart.SetTab(i);
aRange.aEnd.SetTab(i);
EndListeningIntersectedGroups(aCxt, aRange, &aGroupPos); EndListeningIntersectedGroups(aCxt, aRange, &aGroupPos);
}
aCxt.purgeEmptyBroadcasters();
} }
aCxt.purgeEmptyBroadcasters();
for (SCTAB i = 0; i < static_cast<SCTAB>(maTabs.size()); i++) for (SCTAB i = 0; i < static_cast<SCTAB>(maTabs.size()); i++)
if (maTabs[i]) if (maTabs[i])
if ( rMark.GetTableSelect(i) || bIsUndo ) if ( rMark.GetTableSelect(i) || bIsUndo )
maTabs[i]->DeleteArea(nCol1, nRow1, nCol2, nRow2, nDelFlag, bBroadcast, pBroadcastSpans); maTabs[i]->DeleteArea(nCol1, nRow1, nCol2, nRow2, nDelFlag, bBroadcast, pBroadcastSpans);
// Re-start listeners on those top bottom groups that have been split. if (bDelContent)
SetNeedsListeningGroups(aGroupPos); {
StartNeededListeners(); // Re-start listeners on those top bottom groups that have been split.
SetNeedsListeningGroups(aGroupPos);
StartNeededListeners();
}
} }
void ScDocument::DeleteAreaTab(SCCOL nCol1, SCROW nRow1, void ScDocument::DeleteAreaTab(SCCOL nCol1, SCROW nRow1,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment