summaryrefslogtreecommitdiff
path: root/sw/source/core/crsr/crstrvl.cxx
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-10-25 11:06:38 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2018-11-15 15:10:02 +0100
commitd0e9cc832d19b622532f01580d9cf78ee0b215db (patch)
tree055c6966a9696c74bc6c4efa784f2f26a1fdcb0b /sw/source/core/crsr/crstrvl.cxx
parent71c03c2a0701a898d853292b1fa0cc10619f3249 (diff)
sw_redlinehide_3: adapt GotoOutline for SwCursrShell
Adapt SwDoc::GotoOutline(), SwCursorShell::GotoNextOutline(), SwCursorShell::GotoPrevOutline() to skip over outline nodes that are merged away in the layout. Change-Id: Id6f6bb93177753ed21a438c89dc6d90098e11455
Diffstat (limited to 'sw/source/core/crsr/crstrvl.cxx')
-rw-r--r--sw/source/core/crsr/crstrvl.cxx82
1 files changed, 66 insertions, 16 deletions
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 956efc128f1a..5f0d28946218 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1001,7 +1001,8 @@ bool SwCursorShell::GotoOutline( const OUString& rName )
SwCursorSaveState aSaveState( *pCursor );
bool bRet = false;
- if( mxDoc->GotoOutline( *pCursor->GetPoint(), rName ) && !pCursor->IsSelOvr() )
+ if (mxDoc->GotoOutline(*pCursor->GetPoint(), rName, GetLayout())
+ && !pCursor->IsSelOvr())
{
UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY);
bRet = true;
@@ -1023,18 +1024,45 @@ bool SwCursorShell::GotoNextOutline()
SwCursor* pCursor = getShellCursor( true );
SwNode* pNd = &(pCursor->GetNode());
SwOutlineNodes::size_type nPos;
- if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos ))
- ++nPos;
+ bool bUseFirst = !rNds.GetOutLineNds().Seek_Entry( pNd, &nPos );
+ SwOutlineNodes::size_type const nStartPos(nPos);
+
+ do
+ {
+ if (nPos == rNds.GetOutLineNds().size())
+ {
+ nPos = 0;
+ }
+ else if (!bUseFirst)
+ {
+ ++nPos;
+ }
+
+ if (bUseFirst)
+ {
+ bUseFirst = false;
+ }
+ else
+ {
+ if (nPos == nStartPos)
+ {
+ SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
+ return false;
+ }
+ }
- if( nPos == rNds.GetOutLineNds().size() )
+ pNd = rNds.GetOutLineNds()[ nPos ];
+ }
+ while (!sw::IsParaPropsNode(*GetLayout(), *pNd->GetTextNode()));
+
+ if (nPos < nStartPos)
{
- nPos = 0;
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped );
}
else
+ {
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
-
- pNd = rNds.GetOutLineNds()[ nPos ];
+ }
SET_CURR_SHELL( this );
SwCallLink aLk( *this ); // watch Cursor-Moves
@@ -1064,20 +1092,38 @@ bool SwCursorShell::GotoPrevOutline()
SwOutlineNodes::size_type nPos;
bool bRet = false;
(void)rNds.GetOutLineNds().Seek_Entry(pNd, &nPos);
- if ( nPos == 0 )
- {
- nPos = rNds.GetOutLineNds().size();
- SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped );
- }
- else
- SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
+ SwOutlineNodes::size_type const nStartPos(nPos);
- if (nPos)
+ do
{
- --nPos; // before
+ if (nPos == 0)
+ {
+ nPos = rNds.GetOutLineNds().size() - 1;
+ }
+ else
+ {
+ --nPos; // before
+ }
+ if (nPos == nStartPos)
+ {
+ pNd = nullptr;
+ break;
+ }
pNd = rNds.GetOutLineNds()[ nPos ];
+ }
+ while (!sw::IsParaPropsNode(*GetLayout(), *pNd->GetTextNode()));
+ if (pNd)
+ {
+ if (nStartPos < nPos)
+ {
+ SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped );
+ }
+ else
+ {
+ SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
+ }
SET_CURR_SHELL( this );
SwCallLink aLk( *this ); // watch Cursor-Moves
SwCursorSaveState aSaveState( *pCursor );
@@ -1088,6 +1134,10 @@ bool SwCursorShell::GotoPrevOutline()
if( bRet )
UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY);
}
+ else
+ {
+ SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
+ }
return bRet;
}