diff options
author | Dennis Francis <dennis.francis@collabora.co.uk> | 2017-08-30 18:14:15 +0530 |
---|---|---|
committer | Dennis Francis <dennis.francis@collabora.co.uk> | 2017-09-07 03:39:07 +0200 |
commit | f2c29539d52095ea7b914b20ef7f564469d2aa96 (patch) | |
tree | c34c7e440182da789b9da7214f6afa0ecea85d53 | |
parent | 115bed941d7b7ed1b95d6424bfb98456c1d87546 (diff) |
tdf#107952: Move cursor to changed cell after undo/redo in ScUndoSetCell
Change-Id: Id9f2ba2ed2d77f03c9bd56c41b958aa23921da0d
Reviewed-on: https://gerrit.libreoffice.org/42014
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Dennis Francis <dennis.francis@collabora.co.uk>
-rw-r--r-- | sc/source/ui/inc/undocell.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/undo/undocell.cxx | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/sc/source/ui/inc/undocell.hxx b/sc/source/ui/inc/undocell.hxx index 2eca5ee23328..65a9ea6f22d8 100644 --- a/sc/source/ui/inc/undocell.hxx +++ b/sc/source/ui/inc/undocell.hxx @@ -158,6 +158,7 @@ public: private: void SetChangeTrack(); void SetValue( const ScCellValue& rVal ); + void MoveCursorToCell(); private: ScAddress maPos; diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index 360135d6cb97..5e0a20b3bebc 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -387,6 +387,7 @@ void ScUndoSetCell::Undo() { BeginUndo(); SetValue(maOldValue); + MoveCursorToCell(); pDocShell->PostPaintCell(maPos); ScDocument& rDoc = pDocShell->GetDocument(); @@ -401,6 +402,7 @@ void ScUndoSetCell::Redo() { BeginRedo(); SetValue(maNewValue); + MoveCursorToCell(); pDocShell->PostPaintCell(maPos); SetChangeTrack(); EndRedo(); @@ -469,6 +471,16 @@ void ScUndoSetCell::SetValue( const ScCellValue& rVal ) } } +void ScUndoSetCell::MoveCursorToCell() +{ + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); + if ( pViewShell ) + { + pViewShell->SetTabNo( maPos.Tab() ); + pViewShell->MoveCursorAbs( maPos.Col(), maPos.Row(), SC_FOLLOW_JUMP, false, false ); + } +} + ScUndoPageBreak::ScUndoPageBreak( ScDocShell* pNewDocShell, SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, bool bNewColumn, bool bNewInsert ) : |