sw/source/core/crsr/crstrvl.cxx | 62 +++++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 19 deletions(-)
New commits: commit cdc6075e41a9f920b47dbf2c48fbb0c3632a0c8a Author: Jim Raykowski <rayk...@gmail.com> Date: Sat May 26 11:52:57 2018 -0800 tdf#115600 Display messages in Findbar for Index entry navigation ...and make Index entry navigation wrap Change-Id: Ia579b65f85ee1cbf0c4f88f4ff599a5193aea1e3 Reviewed-on: https://gerrit.libreoffice.org/54891 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index c12c9900cfed..fe4c0f8e8ed1 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -493,6 +493,8 @@ bool SwCursorShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors ) /// jump to next/previous index marker bool SwCursorShell::GotoNxtPrvTOXMark( bool bNext ) { + SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty ); + if( IsTableMode() ) return false; @@ -515,30 +517,52 @@ bool SwCursorShell::GotoNxtPrvTOXMark( bool bNext ) const SwTextTOXMark* pTextTOX; sal_uInt32 n, nMaxItems = GetDoc()->GetAttrPool().GetItemCount2( RES_TXTATR_TOXMARK ); - for( n = 0; n < nMaxItems; ++n ) + if( nMaxItems > 0 ) { - const SfxPoolItem* pItem; - const SwContentFrame* pCFrame; - - if( nullptr != (pItem = GetDoc()->GetAttrPool().GetItem2( - RES_TXTATR_TOXMARK, n ) ) && - nullptr != (pTextTOX = static_cast<const SwTOXMark*>(pItem)->GetTextTOXMark() ) && - ( pTextNd = &pTextTOX->GetTextNode())->GetNodes().IsDocNodes() && - nullptr != ( pCFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt, nullptr, false )) && - ( IsReadOnlyAvailable() || !pCFrame->IsProtected() )) - { - SwNodeIndex aNdIndex( *pTextNd ); // UNIX needs this object - SetGetExpField aCmp( aNdIndex, *pTextTOX ); - aCmp.SetBodyPos( *pCFrame ); + do { + for( n = 0; n < nMaxItems; ++n ) + { + const SfxPoolItem* pItem; + const SwContentFrame* pCFrame; + + if( nullptr != (pItem = GetDoc()->GetAttrPool().GetItem2( + RES_TXTATR_TOXMARK, n ) ) && + nullptr != (pTextTOX = static_cast<const SwTOXMark*>(pItem)->GetTextTOXMark() ) && + ( pTextNd = &pTextTOX->GetTextNode())->GetNodes().IsDocNodes() && + nullptr != ( pCFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt, nullptr, false )) && + ( IsReadOnlyAvailable() || !pCFrame->IsProtected() )) + { + SwNodeIndex aNdIndex( *pTextNd ); // UNIX needs this object + SetGetExpField aCmp( aNdIndex, *pTextTOX ); + aCmp.SetBodyPos( *pCFrame ); - if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF ) - : ( aCmp < aCurGEF && aFndGEF < aCmp )) + if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF ) + : ( aCmp < aCurGEF && aFndGEF < aCmp )) + { + aFndGEF = aCmp; + bFnd = true; + } + } + } + if( !bFnd ) { - aFndGEF = aCmp; - bFnd = true; + if ( bNext ) + { + rPos.nNode = 0; + rPos.nContent = 0; + aCurGEF = SetGetExpField( rPos ); + SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped ); + } + else + { + aCurGEF = SetGetExpField( SwPosition( GetDoc()->GetNodes().GetEndOfContent() ) ); + SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped ); + } } - } + } while ( !bFnd ); } + else + SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound ); } if( bFnd ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits