diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-02-01 08:07:39 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-02-01 10:48:40 +0000 |
commit | b052ec2f2fbe0f3044ba824c064a280a5ee9cd7f (patch) | |
tree | 04b44aded2c93a4c09c859564705c9600191499d /sw/source | |
parent | 6028e9fda96d0ed5da266b1c54a7755f7ba3408c (diff) |
sw: introduce SwFlyFrame::IsFlySplitAllowed()
And use it in SwFrame::IsMoveable(). With this,
SwContentFrame::MakeAll() calls into SwFlowFrame::MoveFwd() for a
paragraph that's inside a fly frame that doesn't fit is body frame in
fly split mode.
Towards an initial layout for multi-page fly frames.
Change-Id: I5a1d5ca499c08dd32432cfacf49d01f393e5d324
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146427
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/inc/flyfrm.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/layout/findfrm.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/layout/fly.cxx | 12 |
3 files changed, 18 insertions, 3 deletions
diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx index 467407d1654e..1931054b0ce0 100644 --- a/sw/source/core/inc/flyfrm.hxx +++ b/sw/source/core/inc/flyfrm.hxx @@ -199,6 +199,9 @@ public: SwFlyFrame *FindChainNeighbour( SwFrameFormat const &rFormat, SwFrame *pAnch = nullptr ); + /// Is this fly allowed to split across pages? (Disabled by default.) + bool IsFlySplitAllowed() const; + // #i26791# const SwVirtFlyDrawObj* GetVirtDrawObj() const; SwVirtFlyDrawObj *GetVirtDrawObj(); diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index d6a70186231a..a58c74afa876 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -40,6 +40,7 @@ #include <osl/diagnose.h> #include <sal/log.hxx> #include <IDocumentSettingAccess.hxx> +#include <formatflysplit.hxx> /// Searches the first ContentFrame in BodyText below the page. @@ -1447,9 +1448,10 @@ bool SwFrame::IsMoveable( const SwLayoutFrame* _pLayoutFrame ) const { if ( _pLayoutFrame->IsInFly() ) { - // if fly frame has a follow (next linked fly frame), + // if fly frame has a follow (next linked fly frame) or can split, // frame is moveable. - if ( const_cast<SwLayoutFrame*>(_pLayoutFrame)->FindFlyFrame()->GetNextLink() ) + SwFlyFrame* pFlyFrame = const_cast<SwLayoutFrame*>(_pLayoutFrame)->FindFlyFrame(); + if ( pFlyFrame->GetNextLink() || pFlyFrame->IsFlySplitAllowed() ) { bRetVal = true; } diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 1ece49fb78b5..91188af711c9 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -594,6 +594,16 @@ SwFlyFrame *SwFlyFrame::FindChainNeighbour( SwFrameFormat const &rChain, SwFrame return pFly; } +bool SwFlyFrame::IsFlySplitAllowed() const +{ + if (!IsFlyAtContentFrame()) + { + return false; + } + + return GetFormat()->GetFlySplit().GetValue(); +} + SwFrame *SwFlyFrame::FindLastLower() { SwFrame *pRet = ContainsAny(); @@ -1306,7 +1316,7 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA const SwFrame* pAnchor = GetAnchorFrame(); const SwFrame* pAnchorUpper = pAnchor ? pAnchor->GetUpper() : nullptr; - if (pAnchorUpper && GetFormat()->GetFlySplit().GetValue()) + if (pAnchorUpper && IsFlySplitAllowed()) { // If the fly is allowed to be split, then limit its size to the upper of the // anchor. |