[Libreoffice-commits] core.git: sc/source

Dennis Francis dennis.francis at collabora.co.uk
Thu Sep 7 01:39:30 UTC 2017


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

New commits:
commit f2c29539d52095ea7b914b20ef7f564469d2aa96
Author: Dennis Francis <dennis.francis at 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 <ci at libreoffice.org>
    Reviewed-by: Dennis Francis <dennis.francis at collabora.co.uk>

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 ) :


More information about the Libreoffice-commits mailing list