path: root/sw/source/core/layout/tabfrm.cxx
diff options
authorMiklos Vajna <>2020-03-23 21:05:43 +0100
committerMiklos Vajna <>2020-03-24 09:07:21 +0100
commite68d961a361a784df1000a978bd02eca57e30565 (patch)
tree78f8a55e98bfbffc1db5d57c204823aeffcf23e9 /sw/source/core/layout/tabfrm.cxx
parentcc76ac6b9e7de8d120e3b57ab4ab63a10d73825e (diff)
tdf#131282 sw layout: fix shifted down table next to a fly frame
Regression from commit fd7749fddc5a767461dfced55369af48e5a6d561 (sw: fix handling of table vs fly overlaps in the AddVerticalFlyOffsets case, 2020-02-14), the problem was that the rectangle of the fly frame included spacing when overlapping was checked. Given that this code was explicitly added for Word compat purposes, change it to ignore spacing. You can see that Word doesn't care about spacing: increase the left margin of e.g. the pie chart in the bugdoc to some large value and the table is still not shifted down. Writer shifted the table down as the small spacing was already enough to detect an overlap: debug:21457:21457: SwTabFrame::CalcFlyOffsets: aTabRange is 896 -> 3698 debug:21457:21457: SwTabFrame::CalcFlyOffsets: aFlyRange is 3650 -> 6290 If we don't include that ~3 px spacing, then we don't overlap, similar to Word. Change-Id: I154c211bb0700d132fd168f49c1bbfb29e8caeb7 Reviewed-on: Tested-by: Jenkins Reviewed-by: Miklos Vajna <>
Diffstat (limited to 'sw/source/core/layout/tabfrm.cxx')
1 files changed, 7 insertions, 2 deletions
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 9beef619ed4a..be9fb1aef224 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2806,8 +2806,13 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper,
aRectFnSet.GetLeft(aRect) + aRectFnSet.GetLeft(getFramePrintArea()),
aRectFnSet.GetLeft(aRect) + aRectFnSet.GetLeft(getFramePrintArea())
+ aRectFnSet.GetWidth(getFramePrintArea()));
- basegfx::B1DRange aFlyRange(aRectFnSet.GetLeft(aFlyRect),
- aRectFnSet.GetRight(aFlyRect));
+ // Ignore spacing when determining the left/right edge of the fly, like
+ // Word does.
+ const SwRect aFlyRectWithoutSpaces = pFly->GetObjRect();
+ basegfx::B1DRange aFlyRange(aRectFnSet.GetLeft(aFlyRectWithoutSpaces),
+ aRectFnSet.GetRight(aFlyRectWithoutSpaces));
// If it does, shift the table down. Do this only in the compat case,
// normally an SwFlyPortion is created instead that increases the height
// of the first table row.