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

Kohei Yoshida kohei.yoshida at collabora.com
Tue Apr 25 13:18:50 UTC 2017


 sc/source/core/tool/token.cxx     |   10 ++++++++++
 sc/source/ui/docshell/docfunc.cxx |    2 +-
 sc/source/ui/undo/undoblk.cxx     |    2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 7e2ee5ad4aca628b2bfa90b20154f42f42bfe6ba
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Apr 5 21:09:59 2017 -0400

    tdf#92650: handle overwritten references correctly in undo.
    
    (cherry picked from commit de39b6ba3a9edd20a476937ef0c78920df2f5c6d)
    
     Conflicts:
            sc/source/ui/docshell/docfunc.cxx
            sc/source/ui/undo/undoblk.cxx
    
    Change-Id: Idc3fbd78f8163c97a9cd80a3ff474b6da0349353
    Reviewed-on: https://gerrit.libreoffice.org/36540
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit 7f5614209ffa2eef2e78bdb976d30d2f5b7fff48)
    Reviewed-on: https://gerrit.libreoffice.org/36649
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    Tested-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index e7714801dac0..6671a5ab5dbc 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3210,6 +3210,11 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove(
                                 aAbs = aErrorPos;
                             aRes.mbReferenceModified = true;
                         }
+                        else if (rCxt.maRange.In(aAbs))
+                        {
+                            // Referenced cell has been overwritten.
+                            aRes.mbValueChanged = true;
+                        }
 
                         rRef.SetAddress(aAbs, rNewPos);
                         rRef.SetFlag3D(aAbs.Tab() != rNewPos.Tab() || !rRef.IsTabRel());
@@ -3226,6 +3231,11 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove(
                                 aAbs = aErrorRange;
                             aRes.mbReferenceModified = true;
                         }
+                        else if (rCxt.maRange.In(aAbs))
+                        {
+                            // Referenced range has been entirely overwritten.
+                            aRes.mbValueChanged = true;
+                        }
 
                         rRef.SetRange(aAbs, rNewPos);
                         // Absolute sheet reference => set 3D flag.
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 8aacaad8f163..e314e3b35273 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -2816,7 +2816,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
         ScDrawLayer::MoveCells() which may move away inserted objects to wrong
         positions (e.g. if source and destination range overlaps).*/
     rDoc.CopyFromClip( aPasteDest, aDestMark, InsertDeleteFlags::ALL & ~(InsertDeleteFlags::OBJECTS),
-                        nullptr, pClipDoc, true, false, bIncludeFiltered );
+                        pUndoDoc, pClipDoc, true, false, bIncludeFiltered );
 
     // skipped rows and merged cells don't mix
     if ( !bIncludeFiltered && pClipDoc->HasClipFilteredRows() )
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index e42ca42f7b8f..157540535667 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1102,7 +1102,7 @@ bool ScUndoPaste::CanRepeat(SfxRepeatTarget& rTarget) const
 ScUndoDragDrop::ScUndoDragDrop( ScDocShell* pNewDocShell,
                     const ScRange& rRange, ScAddress aNewDestPos, bool bNewCut,
                     ScDocument* pUndoDocument, ScRefUndoData* pRefData, bool bScenario ) :
-    ScMoveUndo( pNewDocShell, pUndoDocument, pRefData, SC_UNDO_REFFIRST ),
+    ScMoveUndo( pNewDocShell, pUndoDocument, pRefData, SC_UNDO_REFLAST ),
     mnPaintExtFlags( 0 ),
     aSrcRange( rRange ),
     bCut( bNewCut ),


More information about the Libreoffice-commits mailing list