summaryrefslogtreecommitdiff
path: root/sc/source/core/data/document.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-11-20 21:43:25 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-11-20 22:22:29 -0500
commitc0e74352b1a1c7bdcfd15acdd8780df9f4d18200 (patch)
tree497a4eb9f8a02aeaa23c64562a8014b4e970adcf /sc/source/core/data/document.cxx
parent52b7e6bfc848a467baf02c320c29e7f77b92cc93 (diff)
Adjust InsertRow() for group area listeners.
Change-Id: I813b45d015eb1ae8dc7bd1242152ef734b5fe08c (cherry picked from commit 01e14bd403e749116844b6ab0b0a7afc66347e90)
Diffstat (limited to 'sc/source/core/data/document.cxx')
-rw-r--r--sc/source/core/data/document.cxx26
1 files changed, 22 insertions, 4 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 9f9e45ee41ee..a4133883d104 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -1218,11 +1218,22 @@ bool ScDocument::InsertRow( SCCOL nStartCol, SCTAB nStartTab,
SCTAB nTabRangeStart = nStartTab;
SCTAB nTabRangeEnd = nEndTab;
lcl_GetFirstTabRange( nTabRangeStart, nTabRangeEnd, pTabMark, static_cast<SCTAB>(maTabs.size()) );
+ ScRange aShiftedRange(nStartCol, nStartRow, nTabRangeStart, nEndCol, MAXROW, nTabRangeEnd);
+ sc::EndListeningContext aEndListenCxt(*this);
+
+ std::vector<ScAddress> aGroupPos;
do
{
- UpdateBroadcastAreas( URM_INSDEL, ScRange(
- ScAddress( nStartCol, nStartRow, nTabRangeStart ),
- ScAddress( nEndCol, MAXROW, nTabRangeEnd )), 0, static_cast<SCsROW>(nSize), 0 );
+ aShiftedRange.aStart.SetTab(nTabRangeStart);
+ aShiftedRange.aEnd.SetTab(nTabRangeEnd);
+
+ // Collect all formula groups that will get split by the shifting,
+ // and end all their listening. Record the position of the top
+ // cell of the topmost group, and the postion of the bottom cell
+ // of the bottommost group.
+ EndListeningIntersectedGroups(aEndListenCxt, aShiftedRange, &aGroupPos);
+
+ UpdateBroadcastAreas(URM_INSDEL, aShiftedRange, 0, static_cast<SCsROW>(nSize), 0);
}
while ( lcl_GetNextTabRange( nTabRangeStart, nTabRangeEnd, pTabMark, static_cast<SCTAB>(maTabs.size()) ) );
@@ -1230,14 +1241,21 @@ bool ScDocument::InsertRow( SCCOL nStartCol, SCTAB nStartTab,
sc::RefUpdateContext aCxt(*this);
aCxt.meMode = URM_INSDEL;
- aCxt.maRange = ScRange(nStartCol, nStartRow, nTabRangeStart, nEndCol, MAXROW, nTabRangeEnd);
+ aCxt.maRange = aShiftedRange;
aCxt.mnRowDelta = nSize;
do
{
+ aCxt.maRange.aStart.SetTab(nTabRangeStart);
+ aCxt.maRange.aEnd.SetTab(nTabRangeEnd);
UpdateReference(aCxt, pRefUndoDoc, false); // without drawing objects
}
while ( lcl_GetNextTabRange( nTabRangeStart, nTabRangeEnd, pTabMark, static_cast<SCTAB>(maTabs.size()) ) );
+ // UpdateReference should have set "needs listening" flags to those
+ // whose references have been modified. We also need to set this flag
+ // to those that were in the groups that got split by shifting.
+ SetNeedsListeningGroups(aGroupPos);
+
for (i=nStartTab; i<=nEndTab && i < static_cast<SCTAB>(maTabs.size()); i++)
if (maTabs[i] && (!pTabMark || pTabMark->GetTableSelect(i)))
maTabs[i]->InsertRow( nStartCol, nEndCol, nStartRow, nSize );