diff options
author | Jim Raykowski <raykowj@gmail.com> | 2018-04-13 21:42:22 -0800 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-14 20:35:51 +0200 |
commit | f7d155e71dec5024f2d06dcf3697d1dcf505716a (patch) | |
tree | 979bd6ed35b243687b252731d59c61e567338da0 /sw | |
parent | 9bb6ed114c1b23ecde1df02d954a3bb1abb17e49 (diff) |
tdf#115600 Display messages in Findbar for Table navigation
...and make Table navigation wrap
Change-Id: Iac645cb7db65517519cfb791ca1eb26f2567ee7c
Reviewed-on: https://gerrit.libreoffice.org/52865
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/crsr/trvltbl.cxx | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx index 051dffe9be08..43a5f7e90be6 100644 --- a/sw/source/core/crsr/trvltbl.cxx +++ b/sw/source/core/crsr/trvltbl.cxx @@ -38,6 +38,7 @@ #include <cellfrm.hxx> #include <rowfrm.hxx> #include <IDocumentLayoutAccess.hxx> +#include <svx/srchdlg.hxx> /// set cursor into next/previous cell bool SwCursorShell::GoNextCell( bool bAppendLine ) @@ -480,6 +481,8 @@ static bool lcl_FindPrevCell( SwNodeIndex& rIdx, bool bInReadOnly ) bool GotoPrevTable( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosTable, bool bInReadOnly ) { + SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty ); + SwNodeIndex aIdx( rCurrentCursor.GetPoint()->nNode ); SwTableNode* pTableNd = aIdx.GetNode().FindTableNode(); @@ -497,12 +500,27 @@ bool GotoPrevTable( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosTable aIdx.Assign( *pTableNd, - 1 ); } + SwNodeIndex aOldIdx = aIdx; + sal_uLong nLastNd = rCurrentCursor.GetDoc()->GetNodes().Count() - 1; do { while( aIdx.GetIndex() && nullptr == ( pTableNd = aIdx.GetNode().StartOfSectionNode()->GetTableNode()) ) + { --aIdx; + if ( aIdx == aOldIdx ) + { + SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound ); + return false; + } + } + + if ( !aIdx.GetIndex() ) + { + SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped ); + aIdx = nLastNd; + continue; + } - if( pTableNd ) // any further table node? { if( &fnPosTable == &fnMoveForward ) // at the beginning? { @@ -535,7 +553,7 @@ bool GotoPrevTable( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosTable } return true; } - } while( pTableNd ); + } while( true ); return false; } @@ -543,18 +561,35 @@ bool GotoPrevTable( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosTable bool GotoNextTable( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosTable, bool bInReadOnly ) { + SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty ); + SwNodeIndex aIdx( rCurrentCursor.GetPoint()->nNode ); SwTableNode* pTableNd = aIdx.GetNode().FindTableNode(); if( pTableNd ) aIdx.Assign( *pTableNd->EndOfSectionNode(), 1 ); + SwNodeIndex aOldIdx = aIdx; sal_uLong nLastNd = rCurrentCursor.GetDoc()->GetNodes().Count() - 1; do { while( aIdx.GetIndex() < nLastNd && nullptr == ( pTableNd = aIdx.GetNode().GetTableNode()) ) + { ++aIdx; - if( pTableNd ) // any further table node? + if ( aIdx == aOldIdx ) + { + SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound ); + return false; + } + } + + if ( aIdx.GetIndex() == nLastNd ) + { + SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped ); + aIdx = 0; + continue; + } + { if( &fnPosTable == &fnMoveForward ) // at the beginning? { @@ -587,7 +622,7 @@ bool GotoNextTable( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosTable } return true; } - } while( pTableNd ); + } while( true ); return false; } |