diff options
-rw-r--r-- | sw/source/core/layout/flycnt.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/layout/objectformattertxtfrm.cxx | 27 | ||||
-rw-r--r-- | sw/source/core/layout/objectformattertxtfrm.hxx | 2 |
3 files changed, 19 insertions, 13 deletions
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 474e51697785..22f4ac74567f 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -418,7 +418,8 @@ void SwFlyAtContentFrame::MakeAll(vcl::RenderContext* pRenderContext) bool bDummy( false ); bool bPageHasFlysAnchoredBelowThis(false); if ( SwObjectFormatterTextFrame::CheckMovedFwdCondition( - *this, GetPageFrame()->GetPhyPageNum(), +// TODO: what if this fly moved bc it's in table? does sth prevent that? + *this, *GetPageFrame(), bAnchoredAtMaster, nToPageNum, bDummy, bPageHasFlysAnchoredBelowThis) ) { diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx b/sw/source/core/layout/objectformattertxtfrm.cxx index 5f482039a378..4f91ee46226e 100644 --- a/sw/source/core/layout/objectformattertxtfrm.cxx +++ b/sw/source/core/layout/objectformattertxtfrm.cxx @@ -234,9 +234,12 @@ bool SwObjectFormatterTextFrame::DoFormatObj( SwAnchoredObject& _rAnchoredObj, // #i43913# bool bDummy( false ); bool bPageHasFlysAnchoredBelowThis(false); - // #i58182# - consider new method signature + // see how SwObjectFormatter::FormatObjsAtFrame_() checks + // "pPageFrameOfAnchor == &mrPageFrame" - only caller relevant for + // this subclass + assert(GetPageFrame().GetPhyPageNum() == GetPgNumOfCollected(nIdx)); if ( SwObjectFormatterTextFrame::CheckMovedFwdCondition( *GetCollectedObj( nIdx ), - GetPgNumOfCollected( nIdx ), + GetPageFrame(), IsCollectedAnchoredAtMaster( nIdx ), nToPageNum, bDummy, bPageHasFlysAnchoredBelowThis)) @@ -550,11 +553,14 @@ SwAnchoredObject* SwObjectFormatterTextFrame::GetFirstObjWithMovedFwdAnchor( // #i35017# - handle ITERATIVE as ONCE_SUCCESSIVE GetWrapInfluenceOnObjPos( true ) == _nWrapInfluenceOnPosition ) { + // see how SwObjectFormatter::FormatObjsAtFrame_() checks + // "pPageFrameOfAnchor == &mrPageFrame" - only caller relevant for + // this subclass + assert(GetPageFrame().GetPhyPageNum() == GetPgNumOfCollected(i)); // #i26945# - use new method <_CheckMovedFwdCondition(..)> // #i43913# - // #i58182# - consider new method signature if ( SwObjectFormatterTextFrame::CheckMovedFwdCondition( *GetCollectedObj( i ), - GetPgNumOfCollected( i ), + GetPageFrame(), IsCollectedAnchoredAtMaster( i ), _noToPageNum, _boInFollow, o_rbPageHasFlysAnchoredBelowThis) ) @@ -604,12 +610,13 @@ static SwContentFrame const* FindFrameInBody(SwAnchoredObject const& rAnchored) // - replace private method by corresponding static public method bool SwObjectFormatterTextFrame::CheckMovedFwdCondition( SwAnchoredObject& _rAnchoredObj, - const sal_uInt32 _nFromPageNum, + SwPageFrame const& rFromPageFrame, const bool _bAnchoredAtMasterBeforeFormatAnchor, sal_uInt32& _noToPageNum, bool& _boInFollow, bool& o_rbPageHasFlysAnchoredBelowThis) { + const sal_uInt32 _nFromPageNum(rFromPageFrame.GetPhyPageNum()); bool bAnchorIsMovedForward( false ); SwPageFrame* pPageFrameOfAnchor = _rAnchoredObj.FindPageFrameOfAnchor(); @@ -686,21 +693,19 @@ bool SwObjectFormatterTextFrame::CheckMovedFwdCondition( if (bAnchorIsMovedForward) { - // tdf#138518 try to determine if there is a fly on page _nFromPageNum + // tdf#138518 try to determine if there is a fly on page rFromPageFrame // which is anchored in a frame that is "below" the anchor frame // of _rAnchoredObj, such that it should move to the next page before // _rAnchoredObj does - SwPageFrame const& rAnchoredObjPage(*_rAnchoredObj.GetPageFrame()); - assert(rAnchoredObjPage.GetPhyPageNum() == _nFromPageNum); - if (auto * pObjs = rAnchoredObjPage.GetSortedObjs()) + if (auto * pObjs = rFromPageFrame.GetSortedObjs()) { for (SwAnchoredObject *const pObj : *pObjs) { SwPageFrame const*const pObjAnchorPage(pObj->FindPageFrameOfAnchor()); assert(pObjAnchorPage); - if ((pObjAnchorPage == &rAnchoredObjPage + if ((pObjAnchorPage == &rFromPageFrame ? _boInFollow // same-page but will move forward - : rAnchoredObjPage.GetPhyPageNum() < pObjAnchorPage->GetPhyPageNum()) + : rFromPageFrame.GetPhyPageNum() < pObjAnchorPage->GetPhyPageNum()) && pObj->GetFrameFormat().GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR) { diff --git a/sw/source/core/layout/objectformattertxtfrm.hxx b/sw/source/core/layout/objectformattertxtfrm.hxx index 1fc6160507c6..25a7a7e92b77 100644 --- a/sw/source/core/layout/objectformattertxtfrm.hxx +++ b/sw/source/core/layout/objectformattertxtfrm.hxx @@ -178,7 +178,7 @@ class SwObjectFormatterTextFrame : public SwObjectFormatter indicating, if 'anchor is moved forward' */ static bool CheckMovedFwdCondition( SwAnchoredObject& _rAnchoredObj, - const sal_uInt32 _nFromPageNum, + SwPageFrame const& rFromPageFrame, const bool _bAnchoredAtMasterBeforeFormatAnchor, sal_uInt32& _noToPageNum, bool& _boInFollow, |