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

Eike Rathke erack at redhat.com
Wed Jul 4 12:11:33 UTC 2018


 sc/inc/table.hxx               |    2 +-
 sc/source/core/data/table1.cxx |   21 +++++++++++++--------
 sc/source/ui/view/tabview3.cxx |    6 +++---
 3 files changed, 17 insertions(+), 12 deletions(-)

New commits:
commit 5d774434743fbc40a5d19daadc9d5b73d2552c41
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Jul 4 11:34:02 2018 +0200

    Resolves: tdf#117458 let Enter move left/right again, tdf#68290 follow-up
    
    Regression from
    
        commit b0a391d62c1df7525069a02913a52af940d92ecc
        CommitDate: Tue Jan 30 23:12:04 2018 +0100
    
            Circular movement of cursor in a table with  hidden columns/rows, tdf#68290 related
    
    where for nMoveX case nNewX - nCurX and nNewY - nCurY were both 0.
    
    Also don't abuse the bMarked flag for GetNextPos() as bUnprotected
    if nothing is marked, in which case also bKeepSel doesn't make
    sense.
    
    Change-Id: I59af09f1cfa397e68ce16d151ba7eee6e6598a75
    Reviewed-on: https://gerrit.libreoffice.org/56935
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins

diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 2065ce2b130f..97f1f44fc08f 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -589,7 +589,7 @@ public:
                                 bool bMarked, bool bUnprotected, const ScMarkData& rMark ) const;
 
     bool        SkipRow( const SCCOL rCol, SCROW& rRow, const SCROW nMovY, const ScMarkData& rMark,
-                         const bool bUp, const SCROW nUsedY, const bool bSheetProtected ) const;
+                         const bool bUp, const SCROW nUsedY, const bool bMarked, const bool bSheetProtected ) const;
     void        LimitChartArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ) const;
 
     bool        HasData( SCCOL nCol, SCROW nRow ) const;
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 76cd876e1d49..21301356e049 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1325,7 +1325,8 @@ bool ScTable::ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark,
 
 // Skips the current cell if it is Hidden, Overlapped or Protected and Sheet is Protected
 bool ScTable::SkipRow( const SCCOL nCol, SCROW& rRow, const SCROW nMovY,
-        const ScMarkData& rMark, const bool bUp, const SCROW nUsedY, const bool bSheetProtected ) const
+        const ScMarkData& rMark, const bool bUp, const SCROW nUsedY,
+        const bool bMarked, const bool bSheetProtected ) const
 {
     if ( !ValidRow( rRow ))
         return false;
@@ -1337,7 +1338,8 @@ bool ScTable::SkipRow( const SCCOL nCol, SCROW& rRow, const SCROW nMovY,
         else
             rRow += nMovY;
 
-        rRow  = rMark.GetNextMarked( nCol, rRow, bUp );
+        if (bMarked)
+            rRow  = rMark.GetNextMarked( nCol, rRow, bUp );
 
         return true;
     }
@@ -1349,7 +1351,8 @@ bool ScTable::SkipRow( const SCCOL nCol, SCROW& rRow, const SCROW nMovY,
         if ( bRowHidden || bOverlapped )
         {
             rRow += nMovY;
-            rRow  = rMark.GetNextMarked( nCol, rRow, bUp );
+            if (bMarked)
+                rRow = rMark.GetNextMarked( nCol, rRow, bUp );
 
             return true;
         }
@@ -1376,16 +1379,17 @@ void ScTable::GetNextPos( SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY,
     OSL_ENSURE( !nMovY || !bUnprotected,
                 "GetNextPos with bUnprotected horizontal not implemented" );
 
-    if ( nMovY && bMarked )
+    if ( nMovY && (bMarked || bUnprotected))
     {
         bool  bUp    = ( nMovY < 0 );
         SCROW nUsedY = nRow;
         SCCOL nUsedX = nCol;
 
-        nRow = rMark.GetNextMarked( nCol, nRow, bUp );
+        if (bMarked)
+            nRow = rMark.GetNextMarked( nCol, nRow, bUp );
         pDocument->GetPrintArea( nTab, nUsedX, nUsedY );
 
-        while ( SkipRow( nCol, nRow, nMovY, rMark, bUp, nUsedY, bSheetProtected ))
+        while ( SkipRow( nCol, nRow, nMovY, rMark, bUp, nUsedY, bMarked, bSheetProtected ))
             ;
 
         while ( nRow < 0 || nRow > MAXROW )
@@ -1413,9 +1417,10 @@ void ScTable::GetNextPos( SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY,
             else if (nRow > MAXROW)
                 nRow = 0;
 
-            nRow = rMark.GetNextMarked( nCol, nRow, bUp );
+            if (bMarked)
+                nRow = rMark.GetNextMarked( nCol, nRow, bUp );
 
-            while ( SkipRow( nCol, nRow, nMovY, rMark, bUp, nUsedY, bSheetProtected ))
+            while ( SkipRow( nCol, nRow, nMovY, rMark, bUp, nUsedY, bMarked, bSheetProtected ))
                 ;
         }
     }
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index b79ea4ff0079..393735d3df6b 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1388,10 +1388,10 @@ void ScTabView::MoveCursorEnter( bool bShift )          // bShift -> up/down
     }
     else
     {
+        pDoc->GetNextPos( nNewX, nNewY, nTab, nMoveX, nMoveY, false, true, rMark );
+
         if ( nMoveY != 0 && !nMoveX )
         {
-            pDoc->GetNextPos( nNewX, nNewY, nTab, nMoveX, nMoveY, true, false, rMark );
-
             // after Tab and Enter back to the starting column again
             SCCOL nTabCol = aViewData.GetTabStartCol();
             if (nTabCol != SC_TABSTART_NONE)
@@ -1400,7 +1400,7 @@ void ScTabView::MoveCursorEnter( bool bShift )          // bShift -> up/down
             }
         }
 
-        MoveCursorRel( nNewX - nCurX, nNewY - nCurY, SC_FOLLOW_LINE, false, true );
+        MoveCursorRel( nNewX - nCurX, nNewY - nCurY, SC_FOLLOW_LINE, false);
     }
 }
 


More information about the Libreoffice-commits mailing list