diff options
author | Eike Rathke <erack@redhat.com> | 2015-06-08 20:35:48 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-06-08 20:54:07 +0200 |
commit | 97fea63ddf21f48ebb3950952b7d5c6c5f648de4 (patch) | |
tree | 903b925aa2bed4840f92000a160cca43a1da1621 | |
parent | f6eb112faae4ba79616a40f34a90eec13093cc05 (diff) |
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
-rw-r--r-- | sc/source/core/data/document.cxx | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 1f4db41acf6b..da6f2a98470b 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -1787,28 +1787,36 @@ void ScDocument::DeleteArea( PutInOrder( nCol1, nCol2 ); PutInOrder( nRow1, nRow2 ); - // Record the positions of top and/or bottom formula groups that intersect - // the area borders. std::vector<ScAddress> aGroupPos; - sc::EndListeningContext aCxt(*this); - ScRange aRange(nCol1, nRow1, 0, nCol2, nRow2, 0); - for (size_t i = 0; i < maTabs.size(); ++i) + // Destroy and reconstruct listeners only if content is affected. + bool bDelContent = ((nDelFlag & ~IDF_CONTENTS) != nDelFlag); + if (bDelContent) { - aRange.aStart.SetTab(i); - aRange.aEnd.SetTab(i); + // Record the positions of top and/or bottom formula groups that intersect + // 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++) if (maTabs[i]) if ( rMark.GetTableSelect(i) || bIsUndo ) maTabs[i]->DeleteArea(nCol1, nRow1, nCol2, nRow2, nDelFlag, bBroadcast, pBroadcastSpans); - // Re-start listeners on those top bottom groups that have been split. - SetNeedsListeningGroups(aGroupPos); - StartNeededListeners(); + if (bDelContent) + { + // Re-start listeners on those top bottom groups that have been split. + SetNeedsListeningGroups(aGroupPos); + StartNeededListeners(); + } } void ScDocument::DeleteAreaTab(SCCOL nCol1, SCROW nRow1, |