sw/source/core/inc/flyfrm.hxx     |    3 +++
 sw/source/core/layout/findfrm.cxx |    6 ++++--
 sw/source/core/layout/fly.cxx     |   12 +++++++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)

New commits:
commit b052ec2f2fbe0f3044ba824c064a280a5ee9cd7f
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Wed Feb 1 08:07:39 2023 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Feb 1 10:48:40 2023 +0000

    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 <vmik...@collabora.com>
    Tested-by: Jenkins

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.

Reply via email to