summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.co.uk>2017-07-13 11:35:41 +0530
committerEike Rathke <erack@redhat.com>2017-07-14 09:23:29 +0200
commit951af0302f60dfd5fc082552d85d8ddb522fc5a2 (patch)
treef6136fa8fc64a7d73ca0e47ad1f0e1076a766c21
parent2f64f2871d4e4091061d791db647de57ed390109 (diff)
tdf#108758 : do not write to undo document when...
...updating references during a block move, for formula cells that are in the target range of the move operation. The fix is for formula cells that are not grouped. For the grouped case, it was already doing correctly. Added two unit tests in ucalc_formula.cxx for grouped formula and non-grouped formula cases. Reviewed-on: https://gerrit.libreoffice.org/39883 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 2caaf9bfe8d3f81517467daf36de0bd8ddd6b543) Conflicts: sc/qa/unit/ucalc.hxx sc/qa/unit/ucalc_formula.cxx Backported, excluding conflicting unit tests. Change-Id: I9f4d988f5e154f56670bd1c0cc366ee6704fb858 Reviewed-on: https://gerrit.libreoffice.org/39922 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r--sc/source/core/data/formulacell.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index b19bfba89bc9..381fb173d4b7 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3201,7 +3201,9 @@ bool ScFormulaCell::UpdateReferenceOnMove(
aUndoPos = *pUndoCellPos;
ScAddress aOldPos( aPos );
- if (rCxt.maRange.In(aPos))
+ bool bCellInMoveTarget = rCxt.maRange.In(aPos);
+
+ if ( bCellInMoveTarget )
{
// The cell is being moved or copied to a new position. I guess the
// position has been updated prior to this call? Determine
@@ -3290,7 +3292,7 @@ bool ScFormulaCell::UpdateReferenceOnMove(
(bValChanged && bHasRelName ) || bOnRefMove)
bNeedDirty = true;
- if (pUndoDoc && (bValChanged || bRefModified || bOnRefMove))
+ if (pUndoDoc && !bCellInMoveTarget && (bValChanged || bRefModified || bOnRefMove))
setOldCodeToUndo(pUndoDoc, aUndoPos, pOldCode.get(), eTempGrammar, cMatrixFlag);
bValChanged = false;