diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2017-04-05 21:09:59 -0400 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-04-18 22:04:56 +0200 |
commit | 856a2d868fedd010d58d6082d3cb4753a019408a (patch) | |
tree | 801279f80baef7b22d8a989f1bd753cfa2970d24 | |
parent | 7c1314bb1e63f9c3460175a8ee30422ebf3c4d37 (diff) |
tdf#92650: handle overwritten references correctly in undo.
(cherry picked from commit de39b6ba3a9edd20a476937ef0c78920df2f5c6d)
Conflicts:
sc/source/ui/docshell/docfunc.cxx
Change-Id: Idc3fbd78f8163c97a9cd80a3ff474b6da0349353
Reviewed-on: https://gerrit.libreoffice.org/36539
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r-- | sc/source/core/tool/token.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/undo/undoblk.cxx | 2 |
3 files changed, 12 insertions, 2 deletions
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 23f986981784..bf25d135f728 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -3166,6 +3166,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()); @@ -3182,6 +3187,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 d84c47da3c90..7b01d94ab9a4 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -2826,7 +2826,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 2c19695b6b86..6d0466dd1dd3 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, bool bScenario ) : - ScMoveUndo( pNewDocShell, pUndoDocument, nullptr, SC_UNDO_REFFIRST ), + ScMoveUndo( pNewDocShell, pUndoDocument, nullptr, SC_UNDO_REFLAST ), mnPaintExtFlags( 0 ), aSrcRange( rRange ), bCut( bNewCut ), |