summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-06-08 20:35:48 +0200
committerEike Rathke <erack@redhat.com>2015-06-08 22:29:04 +0200
commit5db9892115826c3c88a66f3b8a482a74d63faf24 (patch)
treed780693a6257ebbe5d0674d05b78e27cf4847f96 /sc
parent2e5b7cf524ad2b2f4206e52c8463f5d8633f5b3c (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 (cherry picked from commit 97fea63ddf21f48ebb3950952b7d5c6c5f648de4)
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/document.cxx32
1 files changed, 20 insertions, 12 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index c445d63fcd62..57a8393e232b 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -1786,28 +1786,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,