sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx |    7 
+++++++
 1 file changed, 7 insertions(+)

New commits:
commit 435f1aadf7dd8087a8997924bedfccff0f496ba2
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Fri Oct 27 08:11:05 2023 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Oct 27 09:47:42 2023 +0200

    tdf#99822 sw floattable: allow nomimal overlap of objects from different 
cells
    
    The bugdoc had a table with a single row and 2 columns, both cells had
    too wide content. The first column had a too wide chart and the second
    column had a too wide (multi-page) floating table.
    
    What happened is that SwTabFrame::Split() wanted to recalc the split
    row, and there the overlap detection code pushed down the 2nd shape to
    the next page, but that next page only contained the 2nd shape, so the
    shifted down shape wanted to go up to its original position and this way
    the "format all content lowers" iteration in
    SwContentFrame::CalcLowers() never returned.
    
    Fix the problem by limiting the overlap detection to the same uppers,
    i.e. in case two floating tables are anchored in the same cell (the
    anchors have the same upper) to avoid the overlap, but in case the
    anchors have different uppers, then don't worry about this. This seems
    to match what Word does.
    
    Regression from commit 5127b1961b762643d47a26704556fd9b8664c6fc (sw
    floattable, nesting: add DOCX import, 2023-09-13), the original problem
    was already solved by 63007619da7e6c4a6d0c466a8fe54324252be14b
    (tdf#144798 DOCX import: handle ZOrder of chart objects, 2021-10-18), it
    seems.
    
    Change-Id: I21b9f0ae53bbc69d54a9a9f6870580e3a748ba7f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158520
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx 
b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
index 69951ba08a2c..31802ee4c184 100644
--- a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
@@ -1204,6 +1204,7 @@ void SwToContentAnchoredObjectPosition::CalcOverlap(const 
SwTextFrame* pAnchorFr
 
     // Get the list of objects.
     auto pSortedObjs = pAnchorFrameForVertPos->GetDrawObjs();
+    const SwLayoutFrame* pAnchorUpper = pAnchorFrameForVertPos->GetUpper();
 
     bool bSplitFly = false;
     SwFlyFrame* pFlyFrame = GetAnchoredObj().DynCastFlyFrame();
@@ -1267,6 +1268,12 @@ void 
SwToContentAnchoredObjectPosition::CalcOverlap(const SwTextFrame* pAnchorFr
                 // An inner fly overlapping with its outer fly is fine.
                 continue;
             }
+
+            if (pAnchoredObjFlyAnchor && pAnchoredObjFlyAnchor->GetUpper() != 
pAnchorUpper)
+            {
+                // A fly overlapping with a fly from an other upper is fine.
+                continue;
+            }
         }
 
         css::text::WrapTextMode eWrap = 
pAnchoredObj->GetFrameFormat().GetSurround().GetSurround();

Reply via email to