[Libreoffice-commits] core.git: sw/source
Jim Raykowski
raykowj at gmail.com
Wed Jun 13 07:56:12 UTC 2018
sw/source/core/crsr/crstrvl.cxx | 76 +++++++++++++++++++++++++++-------------
1 file changed, 53 insertions(+), 23 deletions(-)
New commits:
commit dbe3f1c451cf834926d0ddf03c29bcbbea87e49c
Author: Jim Raykowski <raykowj at gmail.com>
Date: Wed May 30 15:16:57 2018 -0800
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 at libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
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;
}
More information about the Libreoffice-commits
mailing list