From f62ba688ca1c22fcdcf7efd811d702e982799882 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 18 Sep 2018 16:21:44 +0200 Subject: sw: rework annoying GetFrameOfModify/getLayoutFrame parameters The bCalcFrame is only evaluated if a pPoint is given; this is surprising and should be more visible in the interface, so people don't go on a goose chase to find places that may do formatting in inappropriate places. So put these parameters into a pair instead, which doesn't have particularly good ergonomics in C++, particularly since compilers warn about taking the address of a temporary object... Change-Id: I101c6eeb5bd6baf83c2bd9a6cb91ccaa04036cc3 --- sw/inc/node.hxx | 7 ++- sw/source/core/crsr/callnk.cxx | 7 +-- sw/source/core/crsr/crsrsh.cxx | 66 +++++++++++++++++--------- sw/source/core/crsr/crstrvl.cxx | 70 +++++++++++++++++++--------- sw/source/core/crsr/pam.cxx | 18 +++++-- sw/source/core/crsr/swcrsr.cxx | 30 ++++++++---- sw/source/core/crsr/trvlfnfl.cxx | 5 +- sw/source/core/crsr/trvltbl.cxx | 5 +- sw/source/core/crsr/viscrs.cxx | 13 ++++-- sw/source/core/doc/DocumentFieldsManager.cxx | 10 +++- sw/source/core/doc/docedt.cxx | 2 +- sw/source/core/doc/docfld.cxx | 9 +++- sw/source/core/doc/docfly.cxx | 8 +++- sw/source/core/doc/doctxm.cxx | 4 +- sw/source/core/docnode/ndtbl1.cxx | 6 ++- sw/source/core/docnode/node.cxx | 25 ++++++---- sw/source/core/docnode/node2lay.cxx | 8 +++- sw/source/core/edit/editsh.cxx | 5 +- sw/source/core/edit/edlingu.cxx | 8 +++- sw/source/core/edit/edsect.cxx | 3 +- sw/source/core/fields/cellfml.cxx | 3 +- sw/source/core/fields/docufld.cxx | 17 +++++-- sw/source/core/fields/reffld.cxx | 8 ++-- sw/source/core/frmedt/fecopy.cxx | 4 +- sw/source/core/frmedt/fedesc.cxx | 5 +- sw/source/core/frmedt/fefly1.cxx | 17 ++++--- sw/source/core/frmedt/feshview.cxx | 6 ++- sw/source/core/frmedt/fetab.cxx | 3 +- sw/source/core/frmedt/fews.cxx | 6 ++- sw/source/core/frmedt/tblsel.cxx | 59 +++++++++++++++-------- sw/source/core/inc/frmtool.hxx | 16 +++++-- sw/source/core/layout/atrfrm.cxx | 19 ++++++-- sw/source/core/layout/flycnt.cxx | 3 +- sw/source/core/layout/flylay.cxx | 2 +- sw/source/core/layout/frmtool.cxx | 18 +++---- sw/source/core/layout/ftnfrm.cxx | 2 +- sw/source/core/layout/pagedesc.cxx | 3 +- sw/source/core/layout/trvlfrm.cxx | 17 ++++--- sw/source/core/tox/txmsrt.cxx | 5 +- sw/source/core/txtnode/ndtxt.cxx | 2 +- sw/source/core/txtnode/txtedt.cxx | 9 +++- sw/source/core/undo/rolbck.cxx | 2 +- sw/source/core/view/vprint.cxx | 2 +- sw/source/uibase/uiview/viewling.cxx | 5 +- 44 files changed, 377 insertions(+), 165 deletions(-) diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx index f46ea9132c71..43ceb38e724c 100644 --- a/sw/inc/node.hxx +++ b/sw/inc/node.hxx @@ -394,11 +394,10 @@ public: bool GoNext(SwIndex *, sal_uInt16 nMode ) const; bool GoPrevious(SwIndex *, sal_uInt16 nMode ) const; - /// Replacement for good old GetFrame(..): + /// @see GetFrameOfModify SwContentFrame *getLayoutFrame( const SwRootFrame*, - const Point* pDocPos = nullptr, - const SwPosition *pPos = nullptr, - const bool bCalcFrame = true ) const; + const SwPosition *pPos = nullptr, + std::pair const* pViewPosAndCalcFrame = nullptr) const; /** @return the real size of the frame or an empty rectangle if no layout exists. Needed for export filters. */ SwRect FindLayoutRect( const bool bPrtArea = false, diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx index f1f7a3f200ef..4b2e963dd9e0 100644 --- a/sw/source/core/crsr/callnk.cxx +++ b/sw/source/core/crsr/callnk.cxx @@ -203,7 +203,7 @@ SwCallLink::~SwCallLink() COVERITY_NOEXCEPT_FALSE const SwFrame* pFrame; const SwFlyFrame *pFlyFrame; - if( !rShell.ActionPend() && nullptr != ( pFrame = pCNd->getLayoutFrame(rShell.GetLayout(), nullptr, nullptr, false) ) && + if (!rShell.ActionPend() && nullptr != (pFrame = pCNd->getLayoutFrame(rShell.GetLayout(), nullptr, nullptr)) && nullptr != ( pFlyFrame = pFrame->FindFlyFrame() ) && !rShell.IsTableMode() ) { const SwNodeIndex* pIndex = pFlyFrame->GetFormat()->GetContent().GetContentIdx(); @@ -220,9 +220,10 @@ SwCallLink::~SwCallLink() COVERITY_NOEXCEPT_FALSE } } -long SwCallLink::getLayoutFrame( const SwRootFrame* pRoot, SwTextNode const & rNd, sal_Int32 nCntPos, bool bCalcFrame ) +long SwCallLink::getLayoutFrame(const SwRootFrame* pRoot, + SwTextNode const & rNd, sal_Int32 nCntPos, bool /*bCalcFrame*/) { - SwTextFrame* pFrame = static_cast(rNd.getLayoutFrame(pRoot,nullptr,nullptr,bCalcFrame)); + SwTextFrame* pFrame = static_cast(rNd.getLayoutFrame(pRoot, nullptr, nullptr)); SwTextFrame* pNext; if ( pFrame && !pFrame->IsHiddenNow() ) { 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 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 tmp(pShellCursor->GetPtPos(), false); + SwContentFrame *const pFrame = pCNode + ? pCNode->getLayoutFrame(GetLayout(), pShellCursor->GetPoint(), &tmp) + : nullptr; return !pFrame || (pFrame->IsTextFrame() && static_cast(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 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 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(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 tmp(m_aCharRect.Pos(), false); SwFrame* pOld = static_cast(aPos.nNode.GetNode()).getLayoutFrame( - GetLayout(), &m_aCharRect.Pos(), nullptr, false ); + GetLayout(), nullptr, &tmp); + tmp.first = aPt; SwFrame* pNew = static_cast(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 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 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 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 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 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(&mnStartAction); ++(*pST); const Size aOldSz( GetDocSize() ); - pRet = pNd->getLayoutFrame( GetLayout(), &m_pCurrentCursor->GetPtPos(), m_pCurrentCursor->GetPoint() ); + std::pair const tmp(m_pCurrentCursor->GetPtPos(), true); + pRet = pNd->getLayoutFrame(GetLayout(), m_pCurrentCursor->GetPoint(), &tmp); --(*pST); if( aOldSz != GetDocSize() ) const_cast(this)->SizeChgNotify(); } else - pRet = pNd->getLayoutFrame( GetLayout(), &m_pCurrentCursor->GetPtPos(), m_pCurrentCursor->GetPoint(), false); + { + std::pair 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 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 const tmp(rPt, false); + SwContentFrame *pContentFrame = pContentNode->getLayoutFrame( + GetLayout(), pCursor->GetPoint(), &tmp); pContentFrame->GetCharRect( aStartRect, *pCursor->GetPoint(), &aState ); rContent = nWordEnd - 1; diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 5c74dd1eccaf..1cedfc908ec8 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -84,8 +84,9 @@ void SwCursorShell::MoveCursorToNum() // try to set cursor onto this position, at half of the char- // SRectangle's height Point aPt( m_pCurrentCursor->GetPtPos() ); - SwContentFrame * pFrame = m_pCurrentCursor->GetContentNode()->getLayoutFrame( GetLayout(), &aPt, - m_pCurrentCursor->GetPoint() ); + std::pair const tmp(aPt, true); + SwContentFrame * pFrame = m_pCurrentCursor->GetContentNode()->getLayoutFrame( + GetLayout(), m_pCurrentCursor->GetPoint(), &tmp); pFrame->GetCharRect( m_aCharRect, *m_pCurrentCursor->GetPoint() ); pFrame->Calc(GetOut()); if( pFrame->IsVertical() ) @@ -236,7 +237,8 @@ bool SwCursorShell::SetCursorInHdFt( size_t nDescNo, bool bInHeader ) Point aPt( m_pCurrentCursor->GetPtPos() ); - if( pCNd && nullptr != pCNd->getLayoutFrame( GetLayout(), &aPt, nullptr, false ) ) + std::pair const tmp(aPt, false); + if (pCNd && nullptr != pCNd->getLayoutFrame(GetLayout(), nullptr, &tmp)) { // then we can set the cursor in here SwCallLink aLk( *this ); // watch Cursor-Moves @@ -441,9 +443,12 @@ bool SwCursorShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors ) } if( rPos.nNode < GetDoc()->GetNodes().GetEndOfExtras() ) + { // also at collection use only the first frame + std::pair const tmp(aPt, false); aCurGEF.SetBodyPos( *rPos.nNode.GetNode().GetContentNode()->getLayoutFrame( GetLayout(), - &aPt, &rPos, false ) ); + &rPos, &tmp) ); + } { sal_uInt32 n, nMaxItems = GetDoc()->GetAttrPool().GetItemCount2( RES_BOXATR_FORMULA ); @@ -466,7 +471,8 @@ bool SwCursorShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors ) const SwContentFrame* pCFrame; SwNodeIndex aIdx( *pTBox->GetSttNd() ); const SwContentNode* pCNd = GetDoc()->GetNodes().GoNext( &aIdx ); - if( pCNd && nullptr != ( pCFrame = pCNd->getLayoutFrame( GetLayout(), &aPt, nullptr, false ) ) && + std::pair const tmp(aPt, false); + if (pCNd && nullptr != (pCFrame = pCNd->getLayoutFrame(GetLayout(), nullptr, &tmp)) && (IsReadOnlyAvailable() || !pCFrame->IsProtected() )) { SetGetExpField aCmp( *pTBox ); @@ -541,9 +547,12 @@ bool SwCursorShell::GotoNxtPrvTOXMark( bool bNext ) SetGetExpField aFndGEF( aFndPos ), aCurGEF( rPos ); if( rPos.nNode.GetIndex() < GetDoc()->GetNodes().GetEndOfExtras().GetIndex() ) + { // also at collection use only the first frame + std::pair const tmp(aPt, false); aCurGEF.SetBodyPos( *rPos.nNode.GetNode(). - GetContentNode()->getLayoutFrame( GetLayout(), &aPt, &rPos, false ) ); + GetContentNode()->getLayoutFrame(GetLayout(), &rPos, &tmp)); + } { const SwTextNode* pTextNd; @@ -558,11 +567,12 @@ bool SwCursorShell::GotoNxtPrvTOXMark( bool bNext ) const SfxPoolItem* pItem; const SwContentFrame* pCFrame; + std::pair const tmp(aPt, false); if( nullptr != (pItem = GetDoc()->GetAttrPool().GetItem2( RES_TXTATR_TOXMARK, n ) ) && nullptr != (pTextTOX = static_cast(pItem)->GetTextTOXMark() ) && ( pTextNd = &pTextTOX->GetTextNode())->GetNodes().IsDocNodes() && - nullptr != ( pCFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt, nullptr, false )) && + nullptr != (pCFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp)) && ( IsReadOnlyAvailable() || !pCFrame->IsProtected() )) { SwNodeIndex aNdIndex( *pTextNd ); // UNIX needs this object @@ -656,8 +666,11 @@ static void lcl_MakeFieldLst( || static_cast(pTextField->GetFormatField().GetField())->GetInputFlag() ) ) { const SwTextNode& rTextNode = pTextField->GetTextNode(); + std::pair const tmp(aPt, false); const SwContentFrame* pCFrame = - rTextNode.getLayoutFrame( rTextNode.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, nullptr, false ); + rTextNode.getLayoutFrame( + rTextNode.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + nullptr, &tmp); if ( pCFrame != nullptr && ( bInReadOnly || !pCFrame->IsProtected() ) ) { @@ -691,7 +704,8 @@ lcl_FindField(bool & o_rFound, SetGetExpFields const& rSrtLst, { // also at collection use only the first frame Point aPt; - pSrch->SetBodyPos(*pTextNode->getLayoutFrame(pLayout, &aPt, &rPos, false)); + std::pair const tmp(aPt, false); + pSrch->SetBodyPos(*pTextNode->getLayoutFrame(pLayout, &rPos, &tmp)); } SetGetExpFields::const_iterator it = rSrtLst.lower_bound(pSrch.get()); @@ -1286,7 +1300,8 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, { rContentAtPos.eContentAtPos = IsAttrAtPos::SmartTag; - if( pFieldRect && nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) ) + std::pair tmp(aPt, true); + if (pFieldRect && nullptr != (pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp))) pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState ); } } @@ -1308,7 +1323,8 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, if ( pField ) { - if( pFieldRect && nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) ) + std::pair tmp(aPt, true); + if (pFieldRect && nullptr != (pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp))) { //tdf#116397 now that we looking for the bounds of the field drop the SmartTag //index within field setting so we don't the bounds of the char within the field @@ -1413,7 +1429,8 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, rContentAtPos.pFndTextAttr = pTextAttr; rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr(); - if( pFieldRect && nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) ) + std::pair tmp(aPt, true); + if (pFieldRect && nullptr != (pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp))) pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState ); } } @@ -1479,7 +1496,8 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, rContentAtPos.pFndTextAttr = pTextAttr; rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr(); - if( pFieldRect && nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) ) + std::pair tmp(aPt, true); + if (pFieldRect && nullptr != (pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp))) pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState ); } } @@ -1518,7 +1536,8 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, rContentAtPos.eContentAtPos = IsAttrAtPos::InetAttr; rContentAtPos.pFndTextAttr = pTextAttr; - if( pFieldRect && nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) ) + std::pair tmp(aPt, true); + if (pFieldRect && nullptr != (pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp))) { //get bounding box of range SwRect aStart; @@ -1549,7 +1568,8 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, rContentAtPos.pFndTextAttr = nullptr; bRet = true; - if( pFieldRect && nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) ) + std::pair tmp(aPt, true); + if (pFieldRect && nullptr != (pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp))) { // not sure if this should be limited to one // paragraph, or mark the entire redline; let's @@ -1609,7 +1629,8 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, #endif ) { - SwFrame* pF = pTextNd->getLayoutFrame( GetLayout(), &aPt ); + std::pair tmp(aPt, true); + SwFrame* pF = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp); if( pF ) { // then the CellFrame @@ -1809,7 +1830,7 @@ bool SwContentAtPos::IsInProtectSect() const const SwContentFrame* pFrame; return pNd && ( pNd->IsInProtectSect() || - ( nullptr != ( pFrame = pNd->getLayoutFrame( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr, false)) && + (nullptr != (pFrame = pNd->getLayoutFrame(pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr)) && pFrame->IsProtected() )); } @@ -2330,7 +2351,8 @@ bool SwCursorShell::SelectNxtPrvHyperlink( bool bNext ) { const SwContentNode* pCNd = aCurPos.GetNodeFromContent()->GetContentNode(); SwContentFrame* pFrame; - if( pCNd && nullptr != ( pFrame = pCNd->getLayoutFrame( GetLayout(), &aPt )) ) + std::pair tmp(aPt, true); + if (pCNd && nullptr != (pFrame = pCNd->getLayoutFrame(GetLayout(), nullptr, &tmp))) aCurPos.SetBodyPos( *pFrame ); } @@ -2350,9 +2372,15 @@ bool SwCursorShell::SelectNxtPrvHyperlink( bool bNext ) SwPosition aTmpPos( *pTextNd ); SetGetExpField aPos( aTmpPos.nNode, rAttr ); SwContentFrame* pFrame; - if( pTextNd->GetIndex() < nBodySttNdIdx && - nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt )) ) - aPos.SetBodyPos( *pFrame ); + if (pTextNd->GetIndex() < nBodySttNdIdx) + { + std::pair tmp(aPt, true); + pFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp); + if (pFrame) + { + aPos.SetBodyPos( *pFrame ); + } + } if( bNext ? ( aPos < aCmpPos && aCurPos < aPos ) diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index 31e54222d064..7971195a6052 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -533,8 +533,14 @@ sal_uInt16 SwPaM::GetPageNum( bool bAtPoint, const Point* pLayPos ) const SwContentNode *pNd ; const SwPosition* pPos = bAtPoint ? m_pPoint : m_pMark; + std::pair tmp; + if (pLayPos) + { + tmp.first = *pLayPos; + tmp.second = false; + } if( nullptr != ( pNd = pPos->nNode.GetNode().GetContentNode() ) && - nullptr != ( pCFrame = pNd->getLayoutFrame( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), pLayPos, pPos, false )) && + nullptr != (pCFrame = pNd->getLayoutFrame(pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), pPos, pLayPos ? &tmp : nullptr)) && nullptr != ( pPg = pCFrame->FindPageFrame() )) return pPg->GetPhyPageNum(); return 0; @@ -575,7 +581,10 @@ bool SwPaM::HasReadonlySel( bool bFormView ) const if ( pNd != nullptr ) { Point aTmpPt; - pFrame = pNd->getLayoutFrame( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aTmpPt, GetPoint(), false ); + std::pair const tmp(aTmpPt, false); + pFrame = pNd->getLayoutFrame( + pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + GetPoint(), &tmp); } // Will be set if point are inside edit-in-readonly environment @@ -608,7 +617,10 @@ bool SwPaM::HasReadonlySel( bool bFormView ) const if ( pNd != nullptr ) { Point aTmpPt; - pFrame = pNd->getLayoutFrame( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aTmpPt, GetMark(), false ); + std::pair const tmp(aTmpPt, false); + pFrame = pNd->getLayoutFrame( + pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + GetMark(), &tmp); } const SwFrame* pMarkEditInReadonlyFrame = nullptr; diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 6578d9e2b1ca..7f8086955169 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -1680,7 +1680,10 @@ SwCursor::DoSetBidiLevelLeftRight( // for visual cursor travelling (used in bidi layout) // we first have to convert the logic to a visual position Point aPt; - pSttFrame = rTNd.getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + std::pair const tmp(aPt, true); + pSttFrame = rTNd.getLayoutFrame( + GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + GetPoint(), &tmp); if( pSttFrame ) { sal_uInt8 nCursorLevel = GetCursorBidiLevel(); @@ -1864,7 +1867,10 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, if ( &rTmpNode != &rNode && rTmpNode.IsTextNode() ) { Point aPt; - const SwContentFrame* pEndFrame = rTmpNode.GetTextNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + std::pair const tmp(aPt, true); + const SwContentFrame* pEndFrame = rTmpNode.GetTextNode()->getLayoutFrame( + GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + GetPoint(), &tmp); if ( pEndFrame ) { if ( ! pEndFrame->IsRightToLeft() != ! pSttFrame->IsRightToLeft() ) @@ -1936,7 +1942,8 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, Point aPt; if( pPt ) aPt = *pPt; - SwContentFrame* pFrame = GetContentNode()->getLayoutFrame(&rLayout, &aPt, GetPoint()); + std::pair const temp(aPt, true); + SwContentFrame* pFrame = GetContentNode()->getLayoutFrame(&rLayout, GetPoint(), &temp); if( pFrame ) { @@ -1972,7 +1979,8 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, const SwNode* pEndNd = pTableNd->EndOfSectionNode(); GetPoint()->nNode = *pEndNd; pTableCursor->Move( fnMoveBackward, GoInNode ); - pFrame = GetContentNode()->getLayoutFrame(&rLayout, &aPt, GetPoint()); + std::pair const tmp(aPt, true); + pFrame = GetContentNode()->getLayoutFrame(&rLayout, GetPoint(), &tmp); } } @@ -1981,7 +1989,8 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, : pFrame->UnitDown( this, nUpDownX, bInReadOnly ) ) && CheckNodesRange( aOldPos.nNode, GetPoint()->nNode, bChkRange )) { - pFrame = GetContentNode()->getLayoutFrame(&rLayout, &aPt, GetPoint()); + std::pair const tmp(aPt, true); + pFrame = GetContentNode()->getLayoutFrame(&rLayout, GetPoint(), &tmp); --nCnt; } @@ -1993,7 +2002,8 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, { // try to position the cursor at half of the char-rect's height DisableCallbackAction a(rLayout); - pFrame = GetContentNode()->getLayoutFrame(&rLayout, &aPt, GetPoint()); + std::pair const tmp(aPt, true); + pFrame = GetContentNode()->getLayoutFrame(&rLayout, GetPoint(), &tmp); SwCursorMoveState eTmpState( MV_UPDOWN ); eTmpState.m_bSetInReadOnly = bInReadOnly; SwRect aTmpRect; @@ -2025,7 +2035,9 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, bool SwCursor::LeftRightMargin( bool bLeft, bool bAPI ) { Point aPt; - SwContentFrame * pFrame = GetContentNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + std::pair const tmp(aPt, true); + SwContentFrame *const pFrame = GetContentNode()->getLayoutFrame( + GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), GetPoint(), &tmp); // calculate cursor bidi level if ( pFrame ) @@ -2041,7 +2053,9 @@ bool SwCursor::IsAtLeftRightMargin( bool bLeft, bool bAPI ) const { bool bRet = false; Point aPt; - SwContentFrame * pFrame = GetContentNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + std::pair const tmp(aPt, true); + SwContentFrame *const pFrame = GetContentNode()->getLayoutFrame( + GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), GetPoint(), &tmp); if( pFrame ) { SwPaM aPam( *GetPoint() ); diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx index 1c579e2b3569..359e63319d53 100644 --- a/sw/source/core/crsr/trvlfnfl.cxx +++ b/sw/source/core/crsr/trvlfnfl.cxx @@ -94,8 +94,9 @@ bool SwCursorShell::GotoFootnoteText() GetCursor_()->GetPoint()->nNode.GetNode().GetTextNode() : nullptr; if( pTextNd ) { - const SwFrame *pFrame = pTextNd->getLayoutFrame( GetLayout(), &GetCursor_()->GetSttPos(), - GetCursor_()->Start() ); + std::pair const tmp(GetCursor_()->GetSttPos(), true); + const SwFrame *pFrame = pTextNd->getLayoutFrame( GetLayout(), + GetCursor_()->Start(), &tmp); const SwFootnoteBossFrame* pFootnoteBoss; bool bSkip = pFrame && pFrame->IsInFootnote(); while( pFrame && nullptr != ( pFootnoteBoss = pFrame->FindFootnoteBossFrame() ) ) diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx index 1763af7216cc..a36298901f5b 100644 --- a/sw/source/core/crsr/trvltbl.cxx +++ b/sw/source/core/crsr/trvltbl.cxx @@ -180,7 +180,10 @@ bool SwCursorShell::SelTableRowOrCol( bool bRow, bool bRowSimple ) const SwShellCursor *pCursor = GetCursor_(); const SwFrame* pStartFrame = pFrame; const SwContentNode *pCNd = pCursor->GetContentNode( false ); - const SwFrame* pEndFrame = pCNd ? pCNd->getLayoutFrame( GetLayout(), &pCursor->GetMkPos() ) : nullptr; + std::pair const tmp(pCursor->GetMkPos(), true); + const SwFrame* pEndFrame = pCNd + ? pCNd->getLayoutFrame(GetLayout(), nullptr, &tmp) + : nullptr; if ( bRow ) { diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 4a2b73d5a194..1b437fe76e33 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -142,7 +142,7 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * pViewShell) if( rNode.IsTextNode() ) { const SwTextNode& rTNd = *rNode.GetTextNode(); - const SwFrame* pFrame = rTNd.getLayoutFrame( m_pCursorShell->GetLayout(), nullptr, nullptr, false ); + const SwFrame* pFrame = rTNd.getLayoutFrame(m_pCursorShell->GetLayout(), nullptr, nullptr); if ( pFrame ) { const SwScriptInfo* pSI = static_cast(pFrame)->GetScriptInfo(); @@ -290,7 +290,10 @@ void SwSelPaintRects::Hide() static SwRect lcl_getLayoutRect(const Point& rPoint, const SwPosition& rPosition) { const SwContentNode* pNode = rPosition.nNode.GetNode().GetContentNode(); - const SwContentFrame* pFrame = pNode->getLayoutFrame(pNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &rPoint, &rPosition); + std::pair const tmp(rPoint, true); + const SwContentFrame* pFrame = pNode->getLayoutFrame( + pNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + &rPosition, &tmp); SwRect aRect; pFrame->GetCharRect(aRect, rPosition); return aRect; @@ -784,7 +787,8 @@ void SwShellTableCursor::FillRects() if( !pCNd ) continue; - SwFrame* pFrame = pCNd->getLayoutFrame( GetShell()->GetLayout(), &GetSttPos() ); + std::pair const tmp(GetSttPos(), true); + SwFrame* pFrame = pCNd->getLayoutFrame(GetShell()->GetLayout(), nullptr, &tmp); while( pFrame && !pFrame->IsCellFrame() ) pFrame = pFrame->GetUpper(); @@ -833,7 +837,8 @@ bool SwShellTableCursor::IsInside( const Point& rPt ) const if( !pCNd ) continue; - SwFrame* pFrame = pCNd->getLayoutFrame( GetShell()->GetLayout(), &GetPtPos() ); + std::pair const tmp(GetPtPos(), true); + SwFrame* pFrame = pCNd->getLayoutFrame(GetShell()->GetLayout(), nullptr, &tmp); while( pFrame && !pFrame->IsCellFrame() ) pFrame = pFrame->GetUpper(); OSL_ENSURE( pFrame, "Node not in a table" ); diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index c683895e9543..74d2c41b0fd4 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -713,7 +713,10 @@ void DocumentFieldsManager::UpdateTableFields( SfxPoolItem* pHt ) { // is in the special section, that's expensive! Point aPt; // return the first frame of the layout - Tab.Headline!! - pFrame = rTextNd.getLayoutFrame( m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout(), &aPt ); + std::pair const tmp(aPt, true); + pFrame = rTextNd.getLayoutFrame( + m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout(), + nullptr, &tmp); if( pFrame ) { SwPosition aPos( *pTableNd ); @@ -783,7 +786,10 @@ void DocumentFieldsManager::UpdateTableFields( SfxPoolItem* pHt ) if( !pCNd ) pCNd = m_rDoc.GetNodes().GoNext( &aCNdIdx ); - if( pCNd && nullptr != (pFrame = pCNd->getLayoutFrame( m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout(), &aPt )) ) + std::pair const tmp(aPt, true); + if (pCNd && nullptr != (pFrame = pCNd->getLayoutFrame( + m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout(), + nullptr, &tmp))) { SwPosition aPos( *pCNd ); if( GetBodyTextNode( m_rDoc, aPos, *pFrame ) ) diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 74de269c36fb..15cde84afbb4 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -79,7 +79,7 @@ void RestFlyInRange( SaveFlyArr & rArr, const SwNodeIndex& rSttIdx, // SetFormatAttr should call Modify() and add it to the node pFormat->SetFormatAttr( aAnchor ); SwContentNode* pCNd = aPos.nNode.GetNode().GetContentNode(); - if( pCNd && pCNd->getLayoutFrame( pFormat->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr, false ) ) + if (pCNd && pCNd->getLayoutFrame(pFormat->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr)) pFormat->MakeFrames(); } sw::CheckAnchoredFlyConsistency(*rSttIdx.GetNode().GetDoc()); diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index c017172eed6d..873a69b62cbe 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -997,7 +997,9 @@ void SwDocUpdateField::GetBodyNode( const SwTextField& rTField, SwFieldIds nFiel // always the first! (in tab headline, header-/footer) Point aPt; - const SwContentFrame* pFrame = rTextNd.getLayoutFrame( rDoc.getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, nullptr, false ); + std::pair const tmp(aPt, false); + const SwContentFrame* pFrame = rTextNd.getLayoutFrame( + rDoc.getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp); SetGetExpField* pNew = nullptr; bool bIsInBody = false; @@ -1061,7 +1063,10 @@ void SwDocUpdateField::GetBodyNode( const SwSectionNode& rSectNd ) // always the first! (in tab headline, header-/footer) Point aPt; - const SwContentFrame* pFrame = pCNd->getLayoutFrame( rDoc.getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, nullptr, false ); + std::pair const tmp(aPt, false); + const SwContentFrame* pFrame = pCNd->getLayoutFrame( + rDoc.getIDocumentLayoutAccess().GetCurrentLayout(), + nullptr, &tmp); if( !pFrame ) break; diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 06eff1e33958..404298868882 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -234,7 +234,8 @@ static Point lcl_FindAnchorLayPos( SwDoc& rDoc, const SwFormatAnchor& rAnch, { const SwPosition *pPos = rAnch.GetContentAnchor(); const SwContentNode* pNd = pPos->nNode.GetNode().GetContentNode(); - const SwFrame* pOld = pNd ? pNd->getLayoutFrame( rDoc.getIDocumentLayoutAccess().GetCurrentLayout(), &aRet, nullptr, false ) : nullptr; + std::pair const tmp(aRet, false); + const SwFrame* pOld = pNd ? pNd->getLayoutFrame(rDoc.getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp) : nullptr; if( pOld ) aRet = pOld->getFrameArea().Pos(); } @@ -824,8 +825,11 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, getIDocumentLayoutAccess().GetCurrentLayout()->GetCursorOfst( &aPos, aPoint, &aState ); // consider that drawing objects can be in // header/footer. Thus, by left-top-corner + std::pair const tmp(aPt, false); pTextFrame = aPos.nNode.GetNode(). - GetContentNode()->getLayoutFrame( getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, nullptr, false ); + GetContentNode()->getLayoutFrame( + getIDocumentLayoutAccess().GetCurrentLayout(), + nullptr, &tmp); } const SwFrame *pTmp = ::FindAnchor( pTextFrame, aPt ); pNewAnchorFrame = pTmp->FindFlyFrame(); diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index d07d606dee09..25d7a66829c8 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -252,7 +252,9 @@ const SwTOXMark& SwDoc::GotoTOXMark( const SwTOXMark& rCurTOXMark, continue; Point aPt; - const SwContentFrame* pCFrame = pTOXSrc->getLayoutFrame( getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, nullptr, false ); + std::pair const tmp(aPt, false); + const SwContentFrame* pCFrame = pTOXSrc->getLayoutFrame( + getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp); if (!pCFrame) continue; diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index fabde76a4c80..a7568a0991f0 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -126,8 +126,10 @@ static void lcl_GetStartEndCell( const SwCursor& rCursor, SwContentNode* pPointNd = rCursor.GetContentNode(); SwContentNode* pMarkNd = rCursor.GetContentNode(false); - SwFrame* pPointFrame = pPointNd ? pPointNd->getLayoutFrame( pPointNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPtPos ) : nullptr; - SwFrame* pMarkFrame = pMarkNd ? pMarkNd->getLayoutFrame( pMarkNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aMkPos ) : nullptr; + std::pair tmp(aPtPos, true); + SwFrame *const pPointFrame = pPointNd ? pPointNd->getLayoutFrame(pPointNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp) : nullptr; + tmp.first = aMkPos; + SwFrame *const pMarkFrame = pMarkNd ? pMarkNd->getLayoutFrame(pMarkNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp) : nullptr; prStart = pPointFrame ? pPointFrame->GetUpper() : nullptr; prEnd = pMarkFrame ? pMarkFrame->GetUpper() : nullptr; diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 1182f0982ce6..d592796fd248 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -384,7 +384,7 @@ bool SwNode::IsInVisibleArea( SwViewShell const * pSh ) const if( pSh ) { const SwFrame* pFrame; - if( pNd && nullptr != ( pFrame = pNd->getLayoutFrame( pSh->GetLayout(), nullptr, nullptr, false ) ) ) + if (pNd && nullptr != (pFrame = pNd->getLayoutFrame(pSh->GetLayout(), nullptr, nullptr))) { if ( pFrame->IsInTab() ) @@ -495,7 +495,7 @@ const SwPageDesc* SwNode::FindPageDesc( size_t* pPgDescNdIdx ) const { const SwFrame* pFrame; const SwPageFrame* pPage; - if( pNode && nullptr != ( pFrame = pNode->getLayoutFrame( pNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr, false/*bCalcLay*/ ) ) && + if (pNode && nullptr != (pFrame = pNode->getLayoutFrame(pNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr)) && nullptr != ( pPage = pFrame->FindPageFrame() ) ) { pPgDesc = pPage->GetPageDesc(); @@ -789,8 +789,9 @@ const SwTextNode* SwNode::FindOutlineNodeOfLevel( sal_uInt8 nLvl ) const const SwContentNode* pCNd = GetContentNode(); Point aPt( 0, 0 ); - const SwFrame* pFrame = pRet->getLayoutFrame( pRet->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, nullptr, false ), - * pMyFrame = pCNd ? pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, nullptr, false ) : nullptr; + std::pair const tmp(aPt, false); + const SwFrame* pFrame = pRet->getLayoutFrame(pRet->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp), + * pMyFrame = pCNd ? pCNd->getLayoutFrame(pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp) : nullptr; const SwPageFrame* pPgFrame = pFrame ? pFrame->FindPageFrame() : nullptr; if( pPgFrame && pMyFrame && pPgFrame->getFrameArea().Top() > pMyFrame->getFrameArea().Top() ) @@ -1132,17 +1133,24 @@ bool SwContentNode::InvalidateNumRule() } SwContentFrame *SwContentNode::getLayoutFrame( const SwRootFrame* _pRoot, - const Point* pPoint, const SwPosition *pPos, const bool bCalcFrame ) const + const SwPosition *const pPos, + std::pair const*const pViewPosAndCalcFrame) const { return static_cast( ::GetFrameOfModify( _pRoot, *this, FRM_CNTNT, - pPoint, pPos, bCalcFrame )); + pPos, pViewPosAndCalcFrame)); } SwRect SwContentNode::FindLayoutRect( const bool bPrtArea, const Point* pPoint ) const { SwRect aRet; + std::pair tmp; + if (pPoint) + { + tmp.first = *pPoint; + tmp.second = false; + } SwContentFrame* pFrame = static_cast( ::GetFrameOfModify( nullptr, *this, - FRM_CNTNT, pPoint ) ); + FRM_CNTNT, nullptr, pPoint ? &tmp : nullptr) ); if( pFrame ) aRet = bPrtArea ? pFrame->getFramePrintArea() : pFrame->getFrameArea(); return aRet; @@ -1962,7 +1970,8 @@ SvxFrameDirection SwContentNode::GetTextDirection( const SwPosition& rPos, aPt = *pPt; // #i72024# - No format of the frame, because this can cause recursive layout actions - SwFrame* pFrame = getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, &rPos, false ); + std::pair const tmp(aPt, false); + SwFrame* pFrame = getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &rPos, &tmp); if ( pFrame ) { diff --git a/sw/source/core/docnode/node2lay.cxx b/sw/source/core/docnode/node2lay.cxx index 0c9f4ae99ff6..8411274ab9de 100644 --- a/sw/source/core/docnode/node2lay.cxx +++ b/sw/source/core/docnode/node2lay.cxx @@ -416,7 +416,13 @@ void SwNode2LayImpl::RestoreUpperFrames( SwNodes& rNds, sal_uLong nStt, sal_uLon SwFrame* SwNode2LayImpl::GetFrame( const Point* pDocPos ) const { // test if change of member pIter -> pMod broke anything - return pMod ? ::GetFrameOfModify( nullptr, *pMod, FRM_ALL, pDocPos, nullptr ) : nullptr; + std::pair tmp; + if (pDocPos) + { + tmp.first = *pDocPos; + tmp.second = false; + } + return pMod ? ::GetFrameOfModify(nullptr, *pMod, FRM_ALL, nullptr, pDocPos ? &tmp : nullptr) : nullptr; } SwNode2Layout::SwNode2Layout( const SwNode& rNd, sal_uLong nIdx ) diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 87efba3c8d18..52390c61f07b 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -137,10 +137,11 @@ void SwEditShell::Insert2(const OUString &rStr, const bool bForceExpandHints ) if ( ! pSI ) { // seems to be an empty paragraph. - Point aPt; // why ??? + Point aPt; + std::pair const tmp(aPt, false); pFrame = static_cast( static_cast(rNode).getLayoutFrame( - GetLayout(), &aPt, pTmpCursor->GetPoint(), false)); + GetLayout(), pTmpCursor->GetPoint(), &tmp)); SwScriptInfo aScriptInfo; aScriptInfo.InitScriptInfo(static_cast(rNode), diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index c6a28d3162e2..2953fdb9d567 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -857,7 +857,13 @@ void SwEditShell::HandleCorrectionError(const OUString& aText, SwPosition aPos, SwCursorMoveState aState; aState.m_bRealWidth = true; SwContentNode* pContentNode = pCursor->GetContentNode(); - SwContentFrame *pContentFrame = pContentNode->getLayoutFrame( GetLayout(), pPt, pCursor->GetPoint(), false); + std::pair tmp; + if (pPt) + { + tmp.first = *pPt; + tmp.second = false; + } + SwContentFrame *const pContentFrame = pContentNode->getLayoutFrame(GetLayout(), pCursor->GetPoint(), pPt ? &tmp : nullptr); pContentFrame->GetCharRect( aStartRect, *pCursor->GetPoint(), &aState ); rContent = nWordEnd - 1; diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx index d816896dd7e4..8ec298bcba51 100644 --- a/sw/source/core/edit/edsect.cxx +++ b/sw/source/core/edit/edsect.cxx @@ -89,7 +89,8 @@ SwSection* SwEditShell::GetAnySection( bool bOutOfTab, const Point* pPt ) Point aPt( *pPt ); GetLayout()->GetCursorOfst( &aPos, aPt ); SwContentNode *pNd = aPos.nNode.GetNode().GetContentNode(); - pFrame = pNd->getLayoutFrame( GetLayout(), pPt ); + std::pair const tmp(*pPt, true); + pFrame = pNd->getLayoutFrame(GetLayout(), nullptr, &tmp); } else pFrame = GetCurrFrame( false ); diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index 8afa4f28d2ac..72ac817d2341 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -728,7 +728,8 @@ static const SwFrame* lcl_GetBoxFrame( const SwTableBox& rBox ) SwContentNode* pCNd = aIdx.GetNodes().GoNext( &aIdx ); OSL_ENSURE( pCNd, "Box has no TextNode" ); Point aPt; // get the first frame of the layout - table headline - return pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, nullptr, false ); + std::pair const tmp(aPt, false); + return pCNd->getLayoutFrame(pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp); } static sal_Int32 lcl_GetLongBoxNum( OUString& rStr ) diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 99255a6a77d6..19a5c71bab24 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -2189,7 +2189,10 @@ bool SwRefPageGetFieldType::MakeSetList( SetGetExpFields& rTmpLst ) // Always the first! (in Tab-Headline, header/footer ) Point aPt; - const SwContentFrame* pFrame = rTextNd.getLayoutFrame( rTextNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, nullptr, false ); + std::pair const tmp(aPt, false); + const SwContentFrame *const pFrame = rTextNd.getLayoutFrame( + rTextNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + nullptr, &tmp); SetGetExpField* pNew; @@ -2247,8 +2250,12 @@ void SwRefPageGetFieldType::UpdateField( SwTextField const * pTextField, { // determine the correct offset Point aPt; - const SwContentFrame* pFrame = pTextNode->getLayoutFrame( pTextNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, nullptr, false ); - const SwContentFrame* pRefFrame = pRefTextField->GetTextNode().getLayoutFrame( pRefTextField->GetTextNode().GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, nullptr, false ); + std::pair const tmp(aPt, false); + const SwContentFrame *const pFrame = pTextNode->getLayoutFrame( + pTextNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp); + const SwContentFrame *const pRefFrame = pRefTextField->GetTextNode().getLayoutFrame( + pRefTextField->GetTextNode().GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + nullptr, &tmp); const SwPageFrame* pPgFrame = nullptr; const short nDiff = ( pFrame && pRefFrame ) ? (pPgFrame = pFrame->FindPageFrame())->GetPhyPageNum() - @@ -2330,7 +2337,9 @@ void SwRefPageGetField::ChangeExpansion( const SwFrame* pFrame, const SwRefPageSetField* pSetField = static_cast(pRefTextField->GetFormatField().GetField()); Point aPt; - const SwContentFrame* pRefFrame = pRefTextField->GetTextNode().getLayoutFrame( pFrame->getRootFrame(), &aPt, nullptr, false ); + std::pair const tmp(aPt, false); + const SwContentFrame *const pRefFrame = pRefTextField->GetTextNode().getLayoutFrame( + pFrame->getRootFrame(), nullptr, &tmp); if( pSetField->IsOn() && pRefFrame ) { // determine the correct offset diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index e1ca14410486..b80fe0403295 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -94,8 +94,10 @@ static void lcl_GetLayTree( const SwFrame* pFrame, std::vector& bool IsFrameBehind( const SwTextNode& rMyNd, sal_Int32 nMySttPos, const SwTextNode& rBehindNd, sal_Int32 nSttPos ) { - const SwTextFrame *pMyFrame = static_cast(rMyNd.getLayoutFrame( rMyNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr, false) ), - *pFrame = static_cast(rBehindNd.getLayoutFrame( rBehindNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr, false) ); + const SwTextFrame * pMyFrame = static_cast(rMyNd.getLayoutFrame( + rMyNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr)); + const SwTextFrame * pFrame = static_cast(rBehindNd.getLayoutFrame( + rBehindNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr)); if( !pFrame || !pMyFrame) return false; @@ -568,7 +570,7 @@ void SwGetRefField::UpdateField( const SwTextField* pFieldTextAttr ) case REF_PAGE: case REF_PAGE_PGDESC: { - const SwTextFrame* pFrame = static_cast(pTextNd->getLayoutFrame( pDoc->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr, false)), + const SwTextFrame* pFrame = static_cast(pTextNd->getLayoutFrame( pDoc->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr)), *pSave = pFrame; if (pFrame) { diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index d0f69864d9e0..1a40e6b401b1 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -252,7 +252,9 @@ static bool lcl_SetAnchor( const SwPosition& rPos, const SwNode& rNd, SwFlyFrame { bool bRet = true; rAnchor.SetAnchor( &rPos ); - SwContentFrame* pTmpFrame = rNd.GetContentNode()->getLayoutFrame( rDestShell.GetLayout(), &rInsPt, nullptr, false ); + std::pair const tmp(rInsPt, false); + SwContentFrame *const pTmpFrame = rNd.GetContentNode()->getLayoutFrame( + rDestShell.GetLayout(), nullptr, &tmp); SwFlyFrame *pTmpFly = pTmpFrame->FindFlyFrame(); if( pTmpFly && bCheckFlyRecur && pFly->IsUpperOf( *pTmpFly ) ) { diff --git a/sw/source/core/frmedt/fedesc.cxx b/sw/source/core/frmedt/fedesc.cxx index 2177047e19aa..89c0af0b475b 100644 --- a/sw/source/core/frmedt/fedesc.cxx +++ b/sw/source/core/frmedt/fedesc.cxx @@ -187,19 +187,20 @@ const SwPageDesc* SwFEShell::GetSelectedPageDescs() const const SwFrame* pMkFrame, *pPtFrame; const SwPageDesc* pFnd, *pRetDesc = reinterpret_cast(sal_IntPtr(-1)); const Point aNulPt; + std::pair const tmp(aNulPt, false); for(SwPaM& rPaM : GetCursor()->GetRingContainer()) { if( nullptr != (pCNd = rPaM.GetContentNode() ) && - nullptr != ( pPtFrame = pCNd->getLayoutFrame( GetLayout(), &aNulPt, nullptr, false )) ) + nullptr != (pPtFrame = pCNd->getLayoutFrame(GetLayout(), nullptr, &tmp))) pPtFrame = pPtFrame->FindPageFrame(); else pPtFrame = nullptr; if( rPaM.HasMark() && nullptr != (pCNd = rPaM.GetContentNode( false ) ) && - nullptr != ( pMkFrame = pCNd->getLayoutFrame( GetLayout(), &aNulPt, nullptr, false )) ) + nullptr != (pMkFrame = pCNd->getLayoutFrame(GetLayout(), nullptr, &tmp))) pMkFrame = pMkFrame->FindPageFrame(); else pMkFrame = pPtFrame; diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 25bac8a5e46a..7d2ce8e6015f 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -94,7 +94,10 @@ static bool lcl_SetNewFlyPos( const SwNode& rNode, SwFormatAnchor& rAnchor, else { const SwContentNode *pCntNd = rNode.GetContentNode(); - const SwContentFrame* pCFrame = pCntNd ? pCntNd->getLayoutFrame( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &rPt, nullptr, false ) : nullptr; + std::pair const tmp(rPt, false); + const SwContentFrame* pCFrame = pCntNd ? pCntNd->getLayoutFrame( + pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + nullptr, &tmp) : nullptr; const SwPageFrame *pPg = pCFrame ? pCFrame->FindPageFrame() : nullptr; rAnchor.SetPageNum( pPg ? pPg->GetPhyPageNum() : 1 ); @@ -177,7 +180,7 @@ static bool lcl_FindAnchorPos( aTmpPnt.setX(aTmpPnt.getX() - 1); // do not land in the fly! rDoc.getIDocumentLayoutAccess().GetCurrentLayout()->GetCursorOfst( &aPos, aTmpPnt, &aState ); pNewAnch = ::FindAnchor( - aPos.nNode.GetNode().GetContentNode()->getLayoutFrame( rFrame.getRootFrame(), nullptr, nullptr, false ), + aPos.nNode.GetNode().GetContentNode()->getLayoutFrame(rFrame.getRootFrame(), nullptr, nullptr), aTmpPnt )->FindFlyFrame(); if( pNewAnch && &rFrame != pNewAnch && !pNewAnch->IsProtected() ) @@ -354,7 +357,8 @@ const SwFrameFormat* SwFEShell::IsFlyInFly() GetLayout()->GetCursorOfst( &aPos, aPoint, &aState ); // determine text frame by left-top-corner of object SwContentNode *pNd = aPos.nNode.GetNode().GetContentNode(); - pTextFrame = pNd ? pNd->getLayoutFrame(GetLayout(), &aTmpPos, nullptr, false) : nullptr; + std::pair const tmp(aTmpPos, false); + pTextFrame = pNd ? pNd->getLayoutFrame(GetLayout(), nullptr, &tmp) : nullptr; } const SwFrame *pTmp = pTextFrame ? ::FindAnchor(pTextFrame, aTmpPos) : nullptr; const SwFlyFrame *pFly = pTmp ? pTmp->FindFlyFrame() : nullptr; @@ -480,7 +484,7 @@ Point SwFEShell::FindAnchorPos( const Point& rAbsPos, bool bMoveIt ) { SwContentNode* pCNode = aPos.nNode.GetNode().GetContentNode(); assert(pCNode); - pTextFrame = pCNode->getLayoutFrame(GetLayout(), nullptr, &aPos, false); + pTextFrame = pCNode->getLayoutFrame(GetLayout(), &aPos, nullptr); } } const SwFrame *pNewAnch = nullptr; @@ -924,7 +928,7 @@ void SwFEShell::InsertDrawObj( SdrObject& rDrawObj, SwCursorMoveState aState( MV_SETONLYTEXT ); Point aTmpPt( rInsertPosition ); GetLayout()->GetCursorOfst( aPam.GetPoint(), aTmpPt, &aState ); - const SwFrame* pFrame = aPam.GetContentNode()->getLayoutFrame( GetLayout(), nullptr, nullptr, false ); + const SwFrame* pFrame = aPam.GetContentNode()->getLayoutFrame(GetLayout(), nullptr, nullptr); const Point aRelPos( rInsertPosition.X() - pFrame->getFrameArea().Left(), rInsertPosition.Y() - pFrame->getFrameArea().Top() ); rDrawObj.SetRelativePos( aRelPos ); @@ -1615,7 +1619,8 @@ const SwFrameFormat* SwFEShell::GetFormatFromAnyObj( const Point& rPt ) const Point aPt( rPt ); GetLayout()->GetCursorOfst( &aPos, aPt ); SwContentNode *pNd = aPos.nNode.GetNode().GetContentNode(); - SwFrame* pFrame = pNd->getLayoutFrame( GetLayout(), &rPt, nullptr, false )->FindFlyFrame(); + std::pair const tmp(rPt, false); + SwFrame* pFrame = pNd->getLayoutFrame(GetLayout(), nullptr, &tmp)->FindFlyFrame(); pRet = pFrame ? static_cast(pFrame)->GetFormat() : nullptr; } return pRet; diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 30543a47b605..3b272f4ef007 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -1808,7 +1808,8 @@ bool SwFEShell::ImpEndCreate() // characterbinding not allowed in readonly-content if( !aPos.nNode.GetNode().IsProtect() ) { - pAnch = aPos.nNode.GetNode().GetContentNode()->getLayoutFrame( GetLayout(), &aPoint, &aPos ); + std::pair const tmp(aPoint, true); + pAnch = aPos.nNode.GetNode().GetContentNode()->getLayoutFrame(GetLayout(), &aPos, &tmp); SwRect aTmp; pAnch->GetCharRect( aTmp, aPos ); @@ -1859,7 +1860,8 @@ bool SwFEShell::ImpEndCreate() } SwContentNode* pCNode = aPos.nNode.GetNode().GetContentNode(); - pAnch = pCNode ? pCNode->getLayoutFrame( GetLayout(), &aPoint, nullptr, false ) : nullptr; + std::pair const tmp(aPoint, false); + pAnch = pCNode ? pCNode->getLayoutFrame(GetLayout(), nullptr, &tmp) : nullptr; if (!pAnch) { // Hidden content. Anchor to the page instead diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index a46593d2a12b..5bf6dd468477 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -1020,8 +1020,9 @@ static sal_uInt16 lcl_GetRowNumber( const SwPosition& rPos ) const SwContentNode *pNd; const SwContentFrame *pFrame; + std::pair const tmp(aTmpPt, false); if( nullptr != ( pNd = rPos.nNode.GetNode().GetContentNode() )) - pFrame = pNd->getLayoutFrame( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aTmpPt, &rPos, false ); + pFrame = pNd->getLayoutFrame(pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &rPos, &tmp); else pFrame = nullptr; diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index 9035c0e85f7c..8b2247eacc05 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -93,7 +93,8 @@ const SwRect& SwFEShell::GetAnyCurRect( CurRectType eType, const Point* pPt, Point aPt( *pPt ); GetLayout()->GetCursorOfst( &aPos, aPt ); SwContentNode *pNd = aPos.nNode.GetNode().GetContentNode(); - pFrame = pNd->getLayoutFrame( GetLayout(), pPt ); + std::pair const tmp(*pPt, true); + pFrame = pNd->getLayoutFrame(GetLayout(), nullptr, &tmp); } else { @@ -232,7 +233,8 @@ FrameTypeFlags SwFEShell::GetFrameType( const Point *pPt, bool bStopAtFly ) cons Point aPt( *pPt ); GetLayout()->GetCursorOfst( &aPos, aPt ); SwContentNode *pNd = aPos.nNode.GetNode().GetContentNode(); - pFrame = pNd->getLayoutFrame( GetLayout(), pPt ); + std::pair const tmp(*pPt, true); + pFrame = pNd->getLayoutFrame(GetLayout(), nullptr, &tmp); } else pFrame = GetCurrFrame( false ); diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 23553e79ae16..06dd1cf815cd 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -227,11 +227,13 @@ void GetTableSel( const SwCursor& rCursor, SwSelBoxes& rBoxes, aMkPos = pShCursor->GetMkPos(); } const SwContentNode *pCntNd = rCursor.GetContentNode(); + std::pair tmp(aPtPos, true); const SwLayoutFrame *pStart = pCntNd ? - pCntNd->getLayoutFrame( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPtPos )->GetUpper() : nullptr; + pCntNd->getLayoutFrame(pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp)->GetUpper() : nullptr; pCntNd = rCursor.GetContentNode(false); + tmp.first = aMkPos; const SwLayoutFrame *pEnd = pCntNd ? - pCntNd->getLayoutFrame( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aMkPos )->GetUpper() : nullptr; + pCntNd->getLayoutFrame(pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp)->GetUpper() : nullptr; if( pStart && pEnd ) GetTableSel( pStart, pEnd, rBoxes, nullptr, eSearchType ); } @@ -438,7 +440,10 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) if ( !pCNd || pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) == nullptr ) return false; - const SwLayoutFrame *pStart = pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aNullPos )->GetUpper(); + std::pair tmp(aNullPos, true); + const SwLayoutFrame *const pStart = pCNd->getLayoutFrame( + pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + nullptr, &tmp)->GetUpper(); OSL_ENSURE( pStart, "without frame nothing works" ); aIdx = rEndNd; @@ -452,7 +457,9 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) return false; } - const SwLayoutFrame *pEnd = pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aNullPos )->GetUpper(); + const SwLayoutFrame *const pEnd = pCNd->getLayoutFrame( + pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + nullptr, &tmp)->GetUpper(); OSL_ENSURE( pEnd, "without frame nothing works" ); bool bValidChartSel; @@ -682,10 +689,12 @@ bool GetAutoSumSel( const SwCursorShell& rShell, SwCellFrames& rBoxes ) if ( rShell.IsTableMode() ) pCursor = rShell.m_pTableCursor; - const SwLayoutFrame *pStart = pCursor->GetContentNode()->getLayoutFrame( rShell.GetLayout(), - &pCursor->GetPtPos() )->GetUpper(), - *pEnd = pCursor->GetContentNode(false)->getLayoutFrame( rShell.GetLayout(), - &pCursor->GetMkPos() )->GetUpper(); + std::pair tmp(pCursor->GetPtPos(), true); + const SwLayoutFrame *const pStart = pCursor->GetContentNode()->getLayoutFrame( + rShell.GetLayout(), nullptr, &tmp)->GetUpper(); + tmp.first = pCursor->GetMkPos(); + const SwLayoutFrame *const pEnd = pCursor->GetContentNode(false)->getLayoutFrame( + rShell.GetLayout(), nullptr, &tmp)->GetUpper(); const SwLayoutFrame* pSttCell = pStart; while( pSttCell && !pSttCell->IsCellFrame() ) @@ -919,11 +928,14 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, Point aPt( 0, 0 ); const SwContentNode* pCntNd = rPam.GetContentNode(); - const SwLayoutFrame *pStart = pCntNd->getLayoutFrame( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), - &aPt )->GetUpper(); + std::pair const tmp(aPt, true); + const SwLayoutFrame *const pStart = pCntNd->getLayoutFrame( + pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + nullptr, &tmp)->GetUpper(); pCntNd = rPam.GetContentNode(false); - const SwLayoutFrame *pEnd = pCntNd->getLayoutFrame( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), - &aPt )->GetUpper(); + const SwLayoutFrame *const pEnd = pCntNd->getLayoutFrame( + pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + nullptr, &tmp)->GetUpper(); // First, compute tables and rectangles SwSelUnions aUnions; @@ -1434,11 +1446,14 @@ TableMergeErr CheckMergeSel( const SwPaM& rPam ) Point aPt; const SwContentNode* pCntNd = rPam.GetContentNode(); - const SwLayoutFrame *pStart = pCntNd->getLayoutFrame( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), - &aPt )->GetUpper(); + std::pair tmp(aPt, true); + const SwLayoutFrame *const pStart = pCntNd->getLayoutFrame( + pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + nullptr, &tmp)->GetUpper(); pCntNd = rPam.GetContentNode(false); - const SwLayoutFrame *pEnd = pCntNd->getLayoutFrame( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), - &aPt )->GetUpper(); + const SwLayoutFrame *const pEnd = pCntNd->getLayoutFrame( + pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + nullptr, &tmp)->GetUpper(); GetTableSel( pStart, pEnd, aBoxes, nullptr ); return CheckMergeSel( aBoxes ); } @@ -1962,11 +1977,15 @@ bool CheckSplitCells( const SwCursor& rCursor, sal_uInt16 nDiv, } const SwContentNode* pCntNd = rCursor.GetContentNode(); - const SwLayoutFrame *pStart = pCntNd->getLayoutFrame( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), - &aPtPos )->GetUpper(); + std::pair tmp(aPtPos, true); + const SwLayoutFrame *const pStart = pCntNd->getLayoutFrame( + pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + nullptr, &tmp)->GetUpper(); pCntNd = rCursor.GetContentNode(false); - const SwLayoutFrame *pEnd = pCntNd->getLayoutFrame( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), - &aMkPos )->GetUpper(); + tmp.first = aMkPos; + const SwLayoutFrame *const pEnd = pCntNd->getLayoutFrame( + pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + nullptr, &tmp)->GetUpper(); SwRectFnSet aRectFnSet(pStart->GetUpper()); diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx index 8f77beeae358..2e587daa6c6e 100644 --- a/sw/source/core/inc/frmtool.hxx +++ b/sw/source/core/inc/frmtool.hxx @@ -171,13 +171,23 @@ bool IsFrameInSameContext( const SwFrame *pInnerFrame, const SwFrame *pFrame ); const SwFrame * FindPage( const SwRect &rRect, const SwFrame *pPage ); -// used by SwContentNode::GetFrame and SwFlyFrame::GetFrame +/** @see SwContentNode::getLayoutFrame() + @param pPos + Document model position; for a text frame, the returned frame will be + one containing this position. + @param pViewPosAndCalcFrame + First is a point in the document view; the returned frame will be the one + with the minimal distance to this point. To get the first frame in the + document, pass in a default-initialized Point with coordinates 0,0. + Second indicates whether the frames should be formatted before retrieving + their position for the test; this cannot be done by every caller so use + with care! + */ SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const&, SwFrameType const nFrameType, - const Point* = nullptr, const SwPosition *pPos = nullptr, - const bool bCalcFrame = false ); + std::pair const* pViewPosAndCalcFrame = nullptr); // Should extra data (redline stroke, line numbers) be painted? bool IsExtraData( const SwDoc *pDoc ); diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 15335abbc426..9a7f977a7d97 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -2697,7 +2697,13 @@ SwRect SwFrameFormat::FindLayoutRect( const bool bPrtArea, const Point* pPoint ) else { const SwFrameType nFrameType = RES_FLYFRMFMT == Which() ? SwFrameType::Fly : FRM_ALL; - pFrame = ::GetFrameOfModify( nullptr, *this, nFrameType, pPoint); + std::pair tmp; + if (pPoint) + { + tmp.first = *pPoint; + tmp.second = false; + } + pFrame = ::GetFrameOfModify(nullptr, *this, nFrameType, nullptr, pPoint ? &tmp : nullptr); } if( pFrame ) @@ -2715,8 +2721,9 @@ SdrObject* SwFrameFormat::FindRealSdrObject() if( RES_FLYFRMFMT == Which() ) { Point aNullPt; + std::pair const tmp(aNullPt, false); SwFlyFrame* pFly = static_cast(::GetFrameOfModify( nullptr, *this, SwFrameType::Fly, - &aNullPt )); + nullptr, &tmp)); return pFly ? pFly->GetVirtDrawObj() : nullptr; } return FindSdrObject(); @@ -3058,8 +3065,14 @@ void SwFlyFrameFormat::MakeFrames() SwFlyFrame* SwFlyFrameFormat::GetFrame( const Point* pPoint ) const { + std::pair tmp; + if (pPoint) + { + tmp.first = *pPoint; + tmp.second = false; + } return static_cast(::GetFrameOfModify( nullptr, *this, SwFrameType::Fly, - pPoint )); + nullptr, &tmp)); } SwAnchoredObject* SwFlyFrameFormat::GetAnchoredObj() const diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index f756318af219..5d9f1ba2fce5 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -169,7 +169,8 @@ void SwFlyAtContentFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pN if ( !pContent ) { SwContentNode *pNode = aNewIdx.GetNode().GetContentNode(); - pContent = pNode->getLayoutFrame( getRootFrame(), &pOldAnchor->getFrameArea().Pos(), nullptr, false ); + std::pair const tmp(pOldAnchor->getFrameArea().Pos(), false); + pContent = pNode->getLayoutFrame(getRootFrame(), nullptr, &tmp); OSL_ENSURE( pContent, "New anchor not found" ); } //Flys are never attached to a follow, but always on the master which diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 36bc46ba762c..d9d2120bfdda 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -781,7 +781,7 @@ void SwFlyLayFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) { SwNodeIndex aIdx( pAnch->GetContentAnchor()->nNode ); SwContentFrame *pContent = GetFormat()->GetDoc()->GetNodes().GoNext( &aIdx )-> - GetContentNode()->getLayoutFrame( getRootFrame(), nullptr, nullptr, false ); + GetContentNode()->getLayoutFrame(getRootFrame(), nullptr, nullptr); if( pContent ) { SwFlyFrame *pTmp = pContent->FindFlyFrame(); diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index d9c3a0f5cc8b..766761b719fe 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -3422,8 +3422,9 @@ void SwFrameHolder::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } } -SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, SwFrameType const nFrameType, - const Point* pPoint, const SwPosition *pPos, const bool bCalcFrame ) +SwFrame* GetFrameOfModify(SwRootFrame const*const pLayout, SwModify const& rMod, + SwFrameType const nFrameType, SwPosition const*const pPos, + std::pair const*const pViewPosAndCalcFrame) { SwFrame *pMinFrame = nullptr, *pTmpFrame; SwFrameHolder aHolder; @@ -3444,7 +3445,7 @@ SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, SwF (!pTmpFrame->IsFlowFrame() || !SwFlowFrame::CastFlowFrame( pTmpFrame )->IsFollow() )) { - if( pPoint ) + if (pViewPosAndCalcFrame) { // watch for Frame being deleted if ( pMinFrame ) @@ -3452,7 +3453,7 @@ SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, SwF else aHolder.Reset(); - if( bCalcFrame ) + if (pViewPosAndCalcFrame->second) { // tdf#108118 prevent recursion DisableCallbackAction a(*pTmpFrame->getRootFrame()); @@ -3480,7 +3481,8 @@ SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, SwF } // for Flys go via the parent if the Fly is not yet "formatted" - if( !bCalcFrame && pTmpFrame->GetType() & SwFrameType::Fly && + if (!pViewPosAndCalcFrame->second && + pTmpFrame->GetType() & SwFrameType::Fly && static_cast(pTmpFrame)->GetAnchorFrame() && FAR_AWAY == pTmpFrame->getFrameArea().Pos().getX() && FAR_AWAY == pTmpFrame->getFrameArea().Pos().getY() ) @@ -3488,7 +3490,7 @@ SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, SwF else aCalcRect = pTmpFrame->getFrameArea(); - if ( aCalcRect.IsInside( *pPoint ) ) + if (aCalcRect.IsInside(pViewPosAndCalcFrame->first)) { pMinFrame = pTmpFrame; break; @@ -3496,7 +3498,7 @@ SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, SwF // Point not in rectangle. Compare distances: const Point aCalcRectCenter = aCalcRect.Center(); - const Point aDiff = aCalcRectCenter - *pPoint; + const Point aDiff = aCalcRectCenter - pViewPosAndCalcFrame->first; const sal_uInt64 nCurrentDist = sal_Int64(aDiff.getX()) * sal_Int64(aDiff.getX()) + sal_Int64(aDiff.getY()) * sal_Int64(aDiff.getY()); // opt: no sqrt if ( !pMinFrame || nCurrentDist < nMinDist ) { @@ -3506,7 +3508,7 @@ SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, SwF } else { - // if no pPoint is provided, take the first one + // if no pViewPosAndCalcFrame is provided, take the first one pMinFrame = pTmpFrame; break; } diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index 1911206a5228..de19e6ffec2e 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -2838,7 +2838,7 @@ SwContentFrame* SwFootnoteFrame::GetRefFromAttr() assert(mpAttribute && "invalid Attribute"); SwTextNode& rTNd = const_cast(mpAttribute->GetTextNode()); SwPosition aPos( rTNd, SwIndex( &rTNd, mpAttribute->GetStart() )); - SwContentFrame* pCFrame = rTNd.getLayoutFrame( getRootFrame(), nullptr, &aPos, false ); + SwContentFrame* pCFrame = rTNd.getLayoutFrame(getRootFrame(), &aPos); return pCFrame; } diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx index aab5b2c90d78..8dc2ad33a1d9 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -299,7 +299,8 @@ static const SwFrame* lcl_GetFrameOfNode( const SwNode& rNd ) pMod = nullptr; Point aNullPt; - return pMod ? ::GetFrameOfModify( nullptr, *pMod, nFrameType, &aNullPt ) + std::pair const tmp(aNullPt, false); + return pMod ? ::GetFrameOfModify(nullptr, *pMod, nFrameType, nullptr, &tmp) : nullptr; } diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index 8f523cf32390..2f076858fbfe 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -983,9 +983,8 @@ sal_uInt16 SwRootFrame::GetCurrPage( const SwPaM *pActualCursor ) const { OSL_ENSURE( pActualCursor, "got no page cursor" ); SwFrame const*const pActFrame = pActualCursor->GetPoint()->nNode.GetNode(). - GetContentNode()->getLayoutFrame( this, nullptr, - pActualCursor->GetPoint(), - false ); + GetContentNode()->getLayoutFrame(this, + pActualCursor->GetPoint()); return pActFrame->FindPageFrame()->GetPhyPageNum(); } @@ -1893,8 +1892,10 @@ bool SwRootFrame::MakeTableCursors( SwTableCursor& rTableCursor ) const SwContentNode* pTmpStartNode = rTableCursor.GetContentNode(); const SwContentNode* pTmpEndNode = rTableCursor.GetContentNode(false); - const SwFrame* pTmpStartFrame = pTmpStartNode ? pTmpStartNode->getLayoutFrame( this, &aPtPt, nullptr, false ) : nullptr; - const SwFrame* pTmpEndFrame = pTmpEndNode ? pTmpEndNode->getLayoutFrame( this, &aMkPt, nullptr, false ) : nullptr; + std::pair tmp(aPtPt, false); + const SwFrame *const pTmpStartFrame = pTmpStartNode ? pTmpStartNode->getLayoutFrame(this, nullptr, &tmp) : nullptr; + tmp.first = aMkPt; + const SwFrame *const pTmpEndFrame = pTmpEndNode ? pTmpEndNode->getLayoutFrame(this, nullptr, &tmp) : nullptr; const SwLayoutFrame* pStart = pTmpStartFrame ? pTmpStartFrame->GetUpper() : nullptr; const SwLayoutFrame* pEnd = pTmpEndFrame ? pTmpEndFrame->GetUpper() : nullptr; @@ -2040,11 +2041,13 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor) //First obtain the ContentFrames for the start and the end - those are needed //anyway. + std::pair tmp(rCursor.GetSttPos(), true); SwContentFrame* pStartFrame = pStartPos->nNode.GetNode(). - GetContentNode()->getLayoutFrame( this, &rCursor.GetSttPos(), pStartPos ); + GetContentNode()->getLayoutFrame(this, pStartPos, &tmp); + tmp.first = rCursor.GetEndPos(); SwContentFrame* pEndFrame = pEndPos->nNode.GetNode(). - GetContentNode()->getLayoutFrame( this, &rCursor.GetEndPos(), pEndPos ); + GetContentNode()->getLayoutFrame(this, pEndPos, &tmp); assert(pStartFrame && pEndFrame && "No ContentFrames found."); //tdf#119224 start and end are expected to exist for the scope of this function diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index 801c7679d26d..21897e4c8530 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -158,7 +158,10 @@ SwTOXSortTabBase::SwTOXSortTabBase( TOXSortType nTyp, const SwContentNode* pNd, { // Then get the 'anchor' (body) position Point aPt; - const SwContentFrame* pFrame = pNd->getLayoutFrame( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, nullptr, false ); + std::pair tmp(aPt, false); + const SwContentFrame *const pFrame = pNd->getLayoutFrame( + pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + nullptr, &tmp); if( pFrame ) { SwPosition aPos( *pNd ); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 14f87719a334..514efdfc1c84 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -105,7 +105,7 @@ typedef std::vector SwpHts; pNd->GetpSwpHints()->Check(true); } #define CHECK_SWPHINTS_IF_FRM(pNd) { if( pNd->GetpSwpHints() && \ !pNd->GetDoc()->IsInReading() ) \ - pNd->GetpSwpHints()->Check(getLayoutFrame(nullptr, nullptr, nullptr, false) != nullptr); } + pNd->GetpSwpHints()->Check(getLayoutFrame(nullptr, nullptr, nullptr) != nullptr); } #else #define CHECK_SWPHINTS(pNd) #define CHECK_SWPHINTS_IF_FRM(pNd) diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index bbd4ccc268fd..d6847e65bf1d 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -1658,9 +1658,16 @@ bool SwTextNode::Hyphenate( SwInterHyphInfo &rHyphInf ) SwTextFrame *pFrame = ::sw::SwHyphIterCacheLastTextFrame(this, [&rHyphInf, this]() { + std::pair tmp; + Point const*const pPoint = rHyphInf.GetCursorPos(); + if (pPoint) + { + tmp.first = *pPoint; + tmp.second = true; + } return static_cast(this->getLayoutFrame( this->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), - rHyphInf.GetCursorPos())); + nullptr, pPoint ? &tmp : nullptr)); }); if (!pFrame) { diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index c7160cb463d4..df199cd5a472 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -803,7 +803,7 @@ void SwHistoryChangeFlyAnchor::SetInDoc( SwDoc* pDoc, bool ) aTmp.SetAnchor( &aPos ); // so the Layout does not get confused - if ( !pCNd || !pCNd->getLayoutFrame( pDoc->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr, false ) ) + if (!pCNd || !pCNd->getLayoutFrame(pDoc->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr)) { m_rFormat.DelFrames(); } diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index ebae2c55c8f0..1be0aa17b7e4 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -359,7 +359,7 @@ void SwViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) SwShellTableCursor* pShellTableCursor = pFESh->GetTableCursor(); const SwContentNode* pContentNode = pShellTableCursor->GetNode().GetContentNode(); - const SwContentFrame *pContentFrame = pContentNode ? pContentNode->getLayoutFrame( GetLayout(), nullptr, pShellTableCursor->Start() ) : nullptr; + const SwContentFrame *const pContentFrame = pContentNode ? pContentNode->getLayoutFrame(GetLayout(), pShellTableCursor->Start()) : nullptr; if( pContentFrame ) { SwRect aCharRect; diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index 1e0b389aefb0..6824ea96bca9 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -651,9 +651,10 @@ bool SwView::ExecSpellPopup(const Point& rPt) !pCursorShell->IsTableMode() && !pCursor->HasMark() && !pCursor->IsMultiSelection()) { - SwContentFrame *pContentFrame = pCursor->GetContentNode()->getLayoutFrame( + std::pair const tmp(rPt, false); + SwContentFrame *const pContentFrame = pCursor->GetContentNode()->getLayoutFrame( pCursorShell->GetLayout(), - &rPt, &aPoint, false); + &aPoint, &tmp); if (pContentFrame) { SwRect aRepaint(static_cast(pContentFrame)->AutoSpell_( -- cgit