diff options
Diffstat (limited to 'sw/source/core/crsr/crsrsh.cxx')
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 66 |
1 files changed, 44 insertions, 22 deletions
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 90348e42189d..565acb6d60fd 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -623,8 +623,9 @@ bool SwCursorShell::MovePage( SwWhichPage fnWhichPage, SwPosPage fnPosPage ) SwCursorSaveState aSaveState( *m_pCurrentCursor ); Point& rPt = m_pCurrentCursor->GetPtPos(); + std::pair<Point, bool> tmp(rPt, false); SwContentFrame * pFrame = m_pCurrentCursor->GetContentNode()-> - getLayoutFrame( GetLayout(), &rPt, m_pCurrentCursor->GetPoint(), false ); + getLayoutFrame(GetLayout(), m_pCurrentCursor->GetPoint(), &tmp); if( pFrame && ( bRet = GetFrameInPage( pFrame, fnWhichPage, fnPosPage, m_pCurrentCursor ) ) && !m_pCurrentCursor->IsSelOvr( SwCursorSelOverFlags::Toggle | @@ -639,8 +640,10 @@ bool SwCursorShell::MovePage( SwWhichPage fnWhichPage, SwPosPage fnPosPage ) bool SwCursorShell::isInHiddenTextFrame(SwShellCursor* pShellCursor) { SwContentNode *pCNode = pShellCursor->GetContentNode(); - SwContentFrame *pFrame = pCNode ? - pCNode->getLayoutFrame( GetLayout(), &pShellCursor->GetPtPos(), pShellCursor->GetPoint(), false ) : nullptr; + std::pair<Point, bool> tmp(pShellCursor->GetPtPos(), false); + SwContentFrame *const pFrame = pCNode + ? pCNode->getLayoutFrame(GetLayout(), pShellCursor->GetPoint(), &tmp) + : nullptr; return !pFrame || (pFrame->IsTextFrame() && static_cast<SwTextFrame*>(pFrame)->IsHiddenNow()); } @@ -650,9 +653,9 @@ static bool IsAtStartOrEndOfFrame(SwCursorShell const*const pShell, { SwContentNode *const pCNode = pShellCursor->GetContentNode(); assert(pCNode); // surely can't have moved otherwise? + std::pair<Point, bool> tmp(pShellCursor->GetPtPos(), false); SwContentFrame const*const pFrame = pCNode->getLayoutFrame( - pShell->GetLayout(), &pShellCursor->GetPtPos(), - pShellCursor->GetPoint(), false); + pShell->GetLayout(), pShellCursor->GetPoint(), &tmp); if (!pFrame || !pFrame->IsTextFrame()) { return false; @@ -714,7 +717,10 @@ static SwFrame* lcl_IsInHeaderFooter( const SwNodeIndex& rIdx, Point& rPt ) SwContentNode* pCNd = rIdx.GetNode().GetContentNode(); if( pCNd ) { - SwContentFrame *pContentFrame = pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &rPt, nullptr, false ); + std::pair<Point, bool> tmp(rPt, false); + SwContentFrame *pContentFrame = pCNd->getLayoutFrame( + pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + nullptr, &tmp); pFrame = pContentFrame ? pContentFrame->GetUpper() : nullptr; while( pFrame && !pFrame->IsHeaderFrame() && !pFrame->IsFooterFrame() ) pFrame = pFrame->IsFlyFrame() ? static_cast<SwFlyFrame*>(pFrame)->AnchorFrame() @@ -798,10 +804,12 @@ int SwCursorShell::SetCursor( const Point &rLPt, bool bOnlyText, bool bBlock ) else if( aPos.nNode.GetNode().IsContentNode() ) { // in the same frame? + std::pair<Point, bool> tmp(m_aCharRect.Pos(), false); SwFrame* pOld = static_cast<SwContentNode&>(aPos.nNode.GetNode()).getLayoutFrame( - GetLayout(), &m_aCharRect.Pos(), nullptr, false ); + GetLayout(), nullptr, &tmp); + tmp.first = aPt; SwFrame* pNew = static_cast<SwContentNode&>(aPos.nNode.GetNode()).getLayoutFrame( - GetLayout(), &aPt, nullptr, false ); + GetLayout(), nullptr, &tmp); if( pNew == pOld ) return bRet; } @@ -1570,8 +1578,9 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd ) lcl_CheckHiddenPara( *pITmpCursor->GetMark() ); } + std::pair<Point, bool> const tmp(aTmpPt, false); SwContentFrame *pTableFrame = pPos->nNode.GetNode().GetContentNode()-> - getLayoutFrame( GetLayout(), &aTmpPt, pPos, false ); + getLayoutFrame( GetLayout(), pPos, &tmp); OSL_ENSURE( pTableFrame, "Table Cursor not in Content ??" ); @@ -1587,8 +1596,9 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd ) // Second check if mark is in repeated headline: if ( !bInRepeatedHeadline ) { + std::pair<Point, bool> const tmp1(aTmpMk, false); SwContentFrame* pMarkTableFrame = pITmpCursor->GetContentNode( false )-> - getLayoutFrame( GetLayout(), &aTmpMk, pITmpCursor->GetMark(), false ); + getLayoutFrame(GetLayout(), pITmpCursor->GetMark(), &tmp1); OSL_ENSURE( pMarkTableFrame, "Table Cursor not in Content ??" ); if ( pMarkTableFrame ) @@ -1801,8 +1811,9 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd ) bool bAgainst; do { bAgainst = false; - pFrame = pShellCursor->GetContentNode()->getLayoutFrame( GetLayout(), - &pShellCursor->GetPtPos(), pShellCursor->GetPoint(), false ); + std::pair<Point, bool> const tmp1(pShellCursor->GetPtPos(), false); + pFrame = pShellCursor->GetContentNode()->getLayoutFrame(GetLayout(), + pShellCursor->GetPoint(), &tmp1); // if the Frame doesn't exist anymore, the complete Layout has to be // created, because there used to be a Frame here! if ( !pFrame ) @@ -1810,8 +1821,9 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd ) do { CalcLayout(); - pFrame = pShellCursor->GetContentNode()->getLayoutFrame( GetLayout(), - &pShellCursor->GetPtPos(), pShellCursor->GetPoint(), false ); + std::pair<Point, bool> const tmp(pShellCursor->GetPtPos(), false); + pFrame = pShellCursor->GetContentNode()->getLayoutFrame( + GetLayout(), pShellCursor->GetPoint(), &tmp); } while( !pFrame ); } else if ( Imp()->IsIdleAction() ) @@ -1995,7 +2007,9 @@ void SwCursorShell::RefreshBlockCursor() assert(m_pBlockCursor); SwShellCursor &rBlock = m_pBlockCursor->getShellCursor(); Point aPt = rBlock.GetPtPos(); - SwContentFrame* pFrame = rBlock.GetContentNode()->getLayoutFrame( GetLayout(), &aPt, rBlock.GetPoint(), false ); + std::pair<Point, bool> const tmp(aPt, false); + SwContentFrame* pFrame = rBlock.GetContentNode()->getLayoutFrame( + GetLayout(), rBlock.GetPoint(), &tmp); Point aMk; if( m_pBlockCursor->getEndPoint() && m_pBlockCursor->getStartPoint() ) { @@ -2319,13 +2333,17 @@ SwContentFrame *SwCursorShell::GetCurrFrame( const bool bCalcFrame ) const sal_uInt16* pST = const_cast<sal_uInt16*>(&mnStartAction); ++(*pST); const Size aOldSz( GetDocSize() ); - pRet = pNd->getLayoutFrame( GetLayout(), &m_pCurrentCursor->GetPtPos(), m_pCurrentCursor->GetPoint() ); + std::pair<Point, bool> const tmp(m_pCurrentCursor->GetPtPos(), true); + pRet = pNd->getLayoutFrame(GetLayout(), m_pCurrentCursor->GetPoint(), &tmp); --(*pST); if( aOldSz != GetDocSize() ) const_cast<SwCursorShell*>(this)->SizeChgNotify(); } else - pRet = pNd->getLayoutFrame( GetLayout(), &m_pCurrentCursor->GetPtPos(), m_pCurrentCursor->GetPoint(), false); + { + std::pair<Point, bool> const tmp(m_pCurrentCursor->GetPtPos(), false); + pRet = pNd->getLayoutFrame(GetLayout(), m_pCurrentCursor->GetPoint(), &tmp); + } } return pRet; } @@ -2525,7 +2543,8 @@ bool SwCursorShell::SetVisibleCursor( const Point &rPt ) pSectNd->GetSection().IsProtectFlag())) ) return false; - SwContentFrame *pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt, &aPos ); + std::pair<Point, bool> const tmp(aPt, true); + SwContentFrame *pFrame = pTextNd->getLayoutFrame(GetLayout(), &aPos, &tmp); if ( Imp()->IsIdleAction() ) pFrame->PrepareCursor(); SwRect aTmp( m_aCharRect ); @@ -2969,7 +2988,7 @@ bool SwCursorShell::FindValidContentNode( bool bOnlyText ) SwContentNode* pCNd = rNdIdx.GetNode().GetContentNode(); const SwContentFrame * pFrame; - if( pCNd && nullptr != (pFrame = pCNd->getLayoutFrame( GetLayout(), nullptr, m_pCurrentCursor->GetPoint(), false)) && + if (pCNd && nullptr != (pFrame = pCNd->getLayoutFrame(GetLayout(), m_pCurrentCursor->GetPoint())) && !IsReadOnlyAvailable() && pFrame->IsProtected() && nNdIdx < rNds.GetEndOfExtras().GetIndex() ) { @@ -3087,7 +3106,8 @@ bool SwCursorShell::FindValidContentNode( bool bOnlyText ) if( bOk && rNdIdx.GetIndex() < rNds.GetEndOfExtras().GetIndex() ) { // also check for Fly - might be protected as well - if( nullptr == (pFrame = pCNd->getLayoutFrame( GetLayout(), nullptr, nullptr, false)) || + pFrame = pCNd->getLayoutFrame(GetLayout(), nullptr, nullptr); + if (nullptr == pFrame || ( !IsReadOnlyAvailable() && pFrame->IsProtected() ) || ( bOnlyText && pCNd->IsNoTextNode() ) ) { @@ -3116,7 +3136,7 @@ bool SwCursorShell::FindValidContentNode( bool bOnlyText ) { pCNd = rNdIdx.GetNode().GetContentNode(); // if cursor in hidden frame, always move it - if( !pCNd || !pCNd->getLayoutFrame( GetLayout(), nullptr, nullptr, false) ) + if (!pCNd || !pCNd->getLayoutFrame(GetLayout(), nullptr, nullptr)) { SwCursorMoveState aTmpState( MV_NONE ); aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable(); @@ -3646,7 +3666,9 @@ void SwCursorShell::GetSmartTagRect( const Point& rPt, SwRect& rSelectRect ) SwCursorMoveState aState; aState.m_bRealWidth = true; SwContentNode* pContentNode = pCursor->GetContentNode(); - SwContentFrame *pContentFrame = pContentNode->getLayoutFrame( GetLayout(), &rPt, pCursor->GetPoint(), false); + std::pair<Point, bool> const tmp(rPt, false); + SwContentFrame *pContentFrame = pContentNode->getLayoutFrame( + GetLayout(), pCursor->GetPoint(), &tmp); pContentFrame->GetCharRect( aStartRect, *pCursor->GetPoint(), &aState ); rContent = nWordEnd - 1; |