[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sc/source

Dennis Francis dennis.francis at collabora.co.uk
Fri Jul 14 07:23:58 UTC 2017


 sc/source/core/data/formulacell.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 951af0302f60dfd5fc082552d85d8ddb522fc5a2
Author: Dennis Francis <dennis.francis at collabora.co.uk>
Date:   Thu Jul 13 11:35:41 2017 +0530

    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 at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at 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 at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>

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;


More information about the Libreoffice-commits mailing list