sw/source/core/text/itratr.cxx |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 48659fa6cf8b2c5e3810696cf0c9257ddb57dd4d
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Mon Jun 10 19:48:27 2024 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Tue Jun 11 17:14:50 2024 +0200

    (related: tdf#161215) sw: layout: fix another floating table loop
    
    The full bugdoc loops; text frame 3160 (on which a floating table is
    anchored) is split, immediately joined, and split again...
    
    SwTextFrame::IsEmptyWithSplitFly() has a wrong condition that compares
    document coordinates with relative position inside the frame; try to use
    the confusing SwRectFnSet to compare instead, which prevents this frame
    from splitting because it actually fits into its upper.
    
    Another problem in that function is that it checks RES_PAGEDESC but not
    RES_BREAK; try to fix that too.
    
    (regression from commit 16b5b21d36da87be9b50235acbbb8008ed23b8bb)
    
    Change-Id: I94251b7443e51303b28d14f0597b0bf782142480
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168668
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index e498db01c323..1c31831dd27f 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -32,6 +32,7 @@
 #include <fmtflcnt.hxx>
 #include <fmtcntnt.hxx>
 #include <fmtftn.hxx>
+#include <fmtpdsc.hxx>
 #include <frmatr.hxx>
 #include <frmfmt.hxx>
 #include <fmtfld.hxx>
@@ -1553,12 +1554,16 @@ bool SwTextFrame::IsEmptyWithSplitFly() const
         return false;
     }
 
-    if (GetTextNodeFirst()->GetSwAttrSet().HasItem(RES_PAGEDESC))
+    if (SvxBreak const eBreak = GetBreakItem().GetBreak();
+           eBreak == SvxBreak::ColumnBefore || eBreak == SvxBreak::ColumnBoth
+        || eBreak == SvxBreak::PageBefore || eBreak == SvxBreak::PageBoth
+        || GetPageDescItem().GetPageDesc() != nullptr)
     {
         return false;
     }
 
-    if (getFrameArea().Bottom() <= GetUpper()->getFramePrintArea().Bottom())
+    SwRectFnSet fnUpper(GetUpper());
+    if (fnUpper.YDiff(fnUpper.GetBottom(getFrameArea()), 
fnUpper.GetPrtBottom(*GetUpper())) <= 0)
     {
         return false;
     }

Reply via email to