sc/source/ui/inc/undocell.hxx  |    1 +
 sc/source/ui/undo/undocell.cxx |   12 ++++++++++++
 2 files changed, 13 insertions(+)

New commits:
commit f69cdbe0252a2c70a2a7db1157b06a3041bd39ad
Author: Dennis Francis <dennis.fran...@collabora.co.uk>
Date:   Wed Aug 30 18:14:15 2017 +0530

    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 <c...@libreoffice.org>
    Reviewed-by: Dennis Francis <dennis.fran...@collabora.co.uk>
    (cherry picked from commit f2c29539d52095ea7b914b20ef7f564469d2aa96)
    Reviewed-on: https://gerrit.libreoffice.org/42036
    Reviewed-by: Eike Rathke <er...@redhat.com>

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 ) :
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to