summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.co.uk>2017-07-13 11:35:41 +0530
committerAndras Timar <andras.timar@collabora.com>2017-07-14 12:11:04 +0200
commit7b0c7ca2ea294a14f09609b8b2e28cad0d715c99 (patch)
tree156f199fe5ef6323421535d5526072f55dc17e31 /sc
parent5508e6b1f77da2e2333c1f62e87927309d111c63 (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> (cherry picked from commit 951af0302f60dfd5fc082552d85d8ddb522fc5a2)
Diffstat (limited to 'sc')
-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 4c6471f781a0..73d31106ab19 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3211,7 +3211,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
@@ -3300,7 +3302,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;