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 <vmiklos@collabora.com>
Tested-by: Jenkins
diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx
index 1931054..cc6d969 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 01ac387..61a40d8 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 91188af..e256a0b 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 c2fd6bc..427ac5b9 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 05770ee..b1bfe32 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#