diff options
author | Jim Raykowski <raykowj@gmail.com> | 2018-05-30 15:16:57 -0800 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-06-13 09:55:49 +0200 |
commit | dbe3f1c451cf834926d0ddf03c29bcbbea87e49c (patch) | |
tree | 5873be07029b545fbbfeddda19d92a0ff7fdb7d8 | |
parent | e3248c2ac6d1f090b58489d087f029d85d060637 (diff) |
tdf#115600 Display messages in Findbar for Table formula navigation
...and make Table formula navigation wrap
This patch is for both Table formula and Wrong table formula navigation.
Change-Id: I79938ef876040ac15eb3e56c7d262f69431629a6
Reviewed-on: https://gerrit.libreoffice.org/55358
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r-- | sw/source/core/crsr/crstrvl.cxx | 76 |
1 files changed, 53 insertions, 23 deletions
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index cdb870f664fa..8976b6ba220a 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -413,10 +413,13 @@ void SwCursorShell::GotoTOXMarkBase() /// Optionally it is possible to also jump to broken formulas bool SwCursorShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors ) { + SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty ); + if( IsTableMode() ) return false; bool bFnd = false; + SwPosition aOldPos = *m_pCurrentCursor->GetPoint(); SwPosition& rPos = *m_pCurrentCursor->GetPoint(); Point aPt; @@ -443,35 +446,56 @@ bool SwCursorShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors ) { sal_uInt32 n, nMaxItems = GetDoc()->GetAttrPool().GetItemCount2( RES_BOXATR_FORMULA ); - for( n = 0; n < nMaxItems; ++n ) + if( nMaxItems > 0 ) { - const SwTableBox* pTBox; - const SfxPoolItem* pItem; - if( nullptr != (pItem = GetDoc()->GetAttrPool().GetItem2( - RES_BOXATR_FORMULA, n ) ) && - nullptr != (pTBox = static_cast<const SwTableBoxFormula*>(pItem)->GetTableBox() ) && - pTBox->GetSttNd() && - pTBox->GetSttNd()->GetNodes().IsDocNodes() && - ( !bOnlyErrors || - !static_cast<const SwTableBoxFormula*>(pItem)->HasValidBoxes() ) ) - { - const SwContentFrame* pCFrame; - SwNodeIndex aIdx( *pTBox->GetSttNd() ); - const SwContentNode* pCNd = GetDoc()->GetNodes().GoNext( &aIdx ); - if( pCNd && nullptr != ( pCFrame = pCNd->getLayoutFrame( GetLayout(), &aPt, nullptr, false ) ) && - (IsReadOnlyAvailable() || !pCFrame->IsProtected() )) + sal_uInt8 nMaxDo = 2; + do { + for( n = 0; n < nMaxItems; ++n ) { - SetGetExpField aCmp( *pTBox ); - aCmp.SetBodyPos( *pCFrame ); + const SwTableBox* pTBox; + const SfxPoolItem* pItem; + if( nullptr != (pItem = GetDoc()->GetAttrPool().GetItem2( + RES_BOXATR_FORMULA, n ) ) && + nullptr != (pTBox = static_cast<const SwTableBoxFormula*>(pItem)->GetTableBox() ) && + pTBox->GetSttNd() && + pTBox->GetSttNd()->GetNodes().IsDocNodes() && + ( !bOnlyErrors || + !static_cast<const SwTableBoxFormula*>(pItem)->HasValidBoxes() ) ) + { + const SwContentFrame* pCFrame; + SwNodeIndex aIdx( *pTBox->GetSttNd() ); + const SwContentNode* pCNd = GetDoc()->GetNodes().GoNext( &aIdx ); + if( pCNd && nullptr != ( pCFrame = pCNd->getLayoutFrame( GetLayout(), &aPt, nullptr, false ) ) && + (IsReadOnlyAvailable() || !pCFrame->IsProtected() )) + { + SetGetExpField aCmp( *pTBox ); + 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 ) + { + if( bNext ) { - aFndGEF = aCmp; - bFnd = true; + 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 && --nMaxDo ); } } @@ -489,6 +513,12 @@ bool SwCursorShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors ) UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE | SwCursorShell::READONLY ); } + else + { + rPos = aOldPos; + SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound ); + } + return bFnd; } |