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 e9107d6873df273463d8ed6a221cb8978043c19e Author: Eike Rathke <[email protected]> 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 <[email protected]> Tested-by: Jenkins (cherry picked from commit 5d774434743fbc40a5d19daadc9d5b73d2552c41) Reviewed-on: https://gerrit.libreoffice.org/56946 diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index dd8ef8ad51cf..dae1f6f36eaf 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -595,7 +595,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 c6627ab126d0..e7faf4d87f10 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -1324,7 +1324,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; @@ -1336,7 +1337,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; } @@ -1348,7 +1350,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; } @@ -1375,16 +1378,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 ) @@ -1412,9 +1416,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 4621d6ce120a..5d2d3cf2a4fe 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); } } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
