summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.co.uk>2017-08-30 18:14:15 +0530
committerEike Rathke <erack@redhat.com>2017-09-07 14:18:15 +0200
commitf69cdbe0252a2c70a2a7db1157b06a3041bd39ad (patch)
tree3972a45b2e68b842676a2e018e62ef9cd2177b6b
parent63da940c6e31b615269846424a965ba8ce0837a3 (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> (cherry picked from commit f2c29539d52095ea7b914b20ef7f564469d2aa96) Reviewed-on: https://gerrit.libreoffice.org/42036 Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/source/ui/inc/undocell.hxx1
-rw-r--r--sc/source/ui/undo/undocell.cxx12
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 0050bb6eeae3..a087a20d79c1 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -389,6 +389,7 @@ void ScUndoSetCell::Undo()
{
BeginUndo();
SetValue(maOldValue);
+ MoveCursorToCell();
pDocShell->PostPaintCell(maPos);
ScDocument& rDoc = pDocShell->GetDocument();
@@ -403,6 +404,7 @@ void ScUndoSetCell::Redo()
{
BeginRedo();
SetValue(maNewValue);
+ MoveCursorToCell();
pDocShell->PostPaintCell(maPos);
SetChangeTrack();
EndRedo();
@@ -471,6 +473,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 ) :