summaryrefslogtreecommitdiff
path: root/sw/source/core/crsr/crstrvl.cxx
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2020-07-05 02:20:52 +0200
committerBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2020-07-05 13:24:17 +0200
commit3b9aa11d885c91a3b040cb2b103b815c75d170bc (patch)
tree6d27ceaa5b4683214438523aacdd080f550c8893 /sw/source/core/crsr/crstrvl.cxx
parent25c1a9be773fd3248463bdbd64c30140ac0d2406 (diff)
GotoTOXMarkBase: SwIterator no more ...
Change-Id: I60935850596eeb7209bd84782c954919c02cb259 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98050 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
Diffstat (limited to 'sw/source/core/crsr/crstrvl.cxx')
-rw-r--r--sw/source/core/crsr/crstrvl.cxx58
1 files changed, 12 insertions, 46 deletions
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 8be87766dc66..5ee44842b56f 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -366,53 +366,19 @@ bool SwCursorShell::GotoPrevTOXBase( const OUString* pName )
/// jump to index of TOXMark
void SwCursorShell::GotoTOXMarkBase()
{
- bool bRet = false;
-
SwTOXMarks aMarks;
- sal_uInt16 nCnt = SwDoc::GetCurTOXMark( *m_pCurrentCursor->GetPoint(), aMarks );
- if( nCnt )
- {
- // Take the 1. and get the index type. Search in its dependency list
- // for the actual index
- const SwTOXType* pType = aMarks[0]->GetTOXType();
- SwIterator<SwTOXBase,SwTOXType> aIter( *pType );
-
- for( SwTOXBase* pTOX = aIter.First(); pTOX; pTOX = aIter.Next() )
- {
- auto pTOXBaseSection = dynamic_cast<const SwTOXBaseSection*>( pTOX);
- if( !pTOXBaseSection )
- continue;
- auto pSectFormat = pTOXBaseSection->GetFormat();
- if( !pSectFormat )
- continue;
- const SwSectionNode* pSectNd = pSectFormat->GetSectionNode();
- if (!pSectNd)
- continue;
- SwNodeIndex aIdx( *pSectNd, 1 );
- SwContentNode* pCNd = aIdx.GetNode().GetContentNode();
- if( !pCNd )
- pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
- if( !pCNd )
- continue;
- if( pCNd->EndOfSectionIndex() >= pSectNd->EndOfSectionIndex() )
- continue;
- const SwContentFrame* pCFrame = pCNd->getLayoutFrame( GetLayout() );
- if( pCFrame && ( IsReadOnlyAvailable() || !pCFrame->IsProtected() ) )
- {
- SwCallLink aLk( *this ); // watch Cursor-Moves
- SwCursorSaveState aSaveState( *m_pCurrentCursor );
- assert(pCFrame->IsTextFrame());
- *m_pCurrentCursor->GetPoint() =
- static_cast<SwTextFrame const*>(pCFrame)
- ->MapViewToModelPos(TextFrameIndex(0));
- bRet = !m_pCurrentCursor->IsInProtectTable() &&
- !m_pCurrentCursor->IsSelOvr();
- if( bRet )
- UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY);
- break;
- }
- }
- }
+ sal_uInt16 nCnt = SwDoc::GetCurTOXMark(*m_pCurrentCursor->GetPoint(), aMarks);
+ if(!nCnt)
+ return;
+ // Take the 1. and get the index type. Ask it for the actual index.
+ const SwTOXType* pType = aMarks[0]->GetTOXType();
+ auto pContentFrame = pType->FindContentFrame(*GetDoc(), *GetLayout(), IsReadOnlyAvailable());
+ SwCallLink aLk(*this); // watch Cursor-Moves
+ SwCursorSaveState aSaveState(*m_pCurrentCursor);
+ assert(pContentFrame->IsTextFrame());
+ *m_pCurrentCursor->GetPoint() = static_cast<SwTextFrame const*>(pContentFrame)->MapViewToModelPos(TextFrameIndex(0));
+ if(!m_pCurrentCursor->IsInProtectTable() && !m_pCurrentCursor->IsSelOvr())
+ UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY);
}
/// Jump to next/previous table formula