sw/source/core/inc/flyfrm.hxx | 2 +- sw/source/core/inc/flyfrms.hxx | 4 ++-- sw/source/core/layout/fly.cxx | 7 +++++-- sw/source/core/layout/flycnt.cxx | 6 +++--- sw/source/core/layout/flylay.cxx | 4 ++-- 5 files changed, 13 insertions(+), 10 deletions(-)
New commits: commit 8855813f8147f430348a32703b89dfb7b0793fee Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Fri Feb 3 08:17:57 2023 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Feb 3 08:12:41 2023 +0000 sw: avoid unwanted initial content in split/follow fly frames If the fly on the first gets split, SwFrame::GetNextFlyLeaf() will create a follow fly frame. Don't fill this one with content, we'll instead want to move some of the content of the master here. (Which is not yet working.) InsertCnt() is called *really* early, so we can't check if this frame has a master -- just pass a bool around instead. This fixes the unwanted first paragraph in the follow fly frame at least. (The one that fits the master already.) Towards an initial layout for multi-page fly frames. Change-Id: If364fdaf7595fbc5addbc6b3b3b0092e958c5380 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146539 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx index 1931054b0ce0..cc6d969401bf 100644 --- a/sw/source/core/inc/flyfrm.hxx +++ b/sw/source/core/inc/flyfrm.hxx @@ -147,7 +147,7 @@ protected: Size CalcRel( const SwFormatFrameSize &rSz ) const; - SwFlyFrame( SwFlyFrameFormat*, SwFrame*, SwFrame *pAnchor ); + SwFlyFrame( SwFlyFrameFormat*, SwFrame*, SwFrame *pAnchor, bool bFollow = false ); virtual void DestroyImpl() override; virtual ~SwFlyFrame() override; diff --git a/sw/source/core/inc/flyfrms.hxx b/sw/source/core/inc/flyfrms.hxx index 01ac3872dcd6..61a40d8a8f8c 100644 --- a/sw/source/core/inc/flyfrms.hxx +++ b/sw/source/core/inc/flyfrms.hxx @@ -71,7 +71,7 @@ protected: friend class SwFlyNotify; virtual void NotifyBackground( SwPageFrame *pPage, const SwRect& rRect, PrepareHint eHint) override; - SwFlyFreeFrame( SwFlyFrameFormat*, SwFrame*, SwFrame *pAnchor ); + SwFlyFreeFrame( SwFlyFrameFormat*, SwFrame*, SwFrame *pAnchor, bool bFollow = false ); virtual void DestroyImpl() override; virtual ~SwFlyFreeFrame() override; @@ -177,7 +177,7 @@ class SwFlyAtContentFrame final: public SwFlyFreeFrame, public SwFlowFrame public: // #i28701# - SwFlyAtContentFrame( SwFlyFrameFormat*, SwFrame*, SwFrame *pAnchor ); + SwFlyAtContentFrame( SwFlyFrameFormat*, SwFrame*, SwFrame *pAnchor, bool bFollow = false ); SwFlyAtContentFrame(SwFlyAtContentFrame& rPrecede); void SetAbsPos( const Point &rNew ); diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 91188af711c9..e256a0b9e0ac 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -81,7 +81,7 @@ using namespace ::com::sun::star; static SwTwips lcl_CalcAutoWidth( const SwLayoutFrame& rFrame ); -SwFlyFrame::SwFlyFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch ) : +SwFlyFrame::SwFlyFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch, bool bFollow ) : SwLayoutFrame( pFormat, pSib ), // #i26791# m_pPrevLink( nullptr ), @@ -171,7 +171,10 @@ SwFlyFrame::SwFlyFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch Chain( pAnch ); - InsertCnt(); + if (!bFollow) + { + InsertCnt(); + } // Put it somewhere outside so that out document is not formatted unnecessarily often SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this); diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index c2fd6bc28666..427ac5b9c37b 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -74,8 +74,8 @@ SwTwips lcl_GetTopForObjPos(const SwContentFrame* pCnt, const bool bVert, const } -SwFlyAtContentFrame::SwFlyAtContentFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch ) : - SwFlyFreeFrame( pFormat, pSib, pAnch ), +SwFlyAtContentFrame::SwFlyAtContentFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch, bool bFollow ) : + SwFlyFreeFrame( pFormat, pSib, pAnch, bFollow ), SwFlowFrame(static_cast<SwFrame&>(*this)) { m_bAtCnt = true; @@ -84,7 +84,7 @@ SwFlyAtContentFrame::SwFlyAtContentFrame( SwFlyFrameFormat *pFormat, SwFrame* pS SwFlyAtContentFrame::SwFlyAtContentFrame(SwFlyAtContentFrame& rPrecede) : SwFlyAtContentFrame(rPrecede.GetFormat(), const_cast<SwFrame*>(rPrecede.GetAnchorFrame()), - const_cast<SwFrame*>(rPrecede.GetAnchorFrame())) + const_cast<SwFrame*>(rPrecede.GetAnchorFrame()), /*bFollow=*/true) { SetFollow(rPrecede.GetFollow()); rPrecede.SetFollow(this); diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 05770eeed33a..b1bfe32aab10 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -52,8 +52,8 @@ using namespace ::com::sun::star; -SwFlyFreeFrame::SwFlyFreeFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch ) -: SwFlyFrame( pFormat, pSib, pAnch ), +SwFlyFreeFrame::SwFlyFreeFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch, bool bFollow ) +: SwFlyFrame( pFormat, pSib, pAnch, bFollow ), // #i34753# mbNoMakePos( false ), // #i37068#