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/source/core/doc/docfly.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sw/source/core/doc/docfly.cxx') 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(); -- cgit