summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2023-08-23 15:51:32 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2023-08-24 12:43:19 +0200
commit7b1c03ed87f7a21606e09863b23074e6b96e26d1 (patch)
tree4649fcde36ca892542d924d9aab7a12725fc71bf /sw
parent492ddef596c99a9c24d2778276025aafc612a7cb (diff)
tdf#154775 sw: layout: avoid breaking this with following commits
The problem with commit 1b5bc2ae2f19a190bf588a5a26c4d125c3960991 is that the fix only works in case the fly is invalid at the time when SwTabFrame::CalcFlyOffsets() is called; if it is valid (which will be the case with following commits, for non-obvious reasons) then the fix does nothing, causing testTablePrintAreaLeft to fail. In Word 2013, this fly causes the table to shift down, despite its HoriOrient being LEFT; so adapt SwTabFrame::CalcFlyOffsets() to also shift down in this case. Likely it would be best not to check HoriOrient at all for ShiftDown case, but needs checking first what Word does in other cases. Change-Id: I465a55bbf1a783abce8b8d6d65099bd9df5695f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155987 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/layout/tabfrm.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index ea2b963f76f9..4acef7ffe5d1 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2969,9 +2969,12 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper,
// text frame has already changed its page.
const SwTextFrame* pAnchorCharFrame = pFly->FindAnchorCharFrame();
const SwFormatHoriOrient& rHori= pFly->GetFormat()->GetHoriOrient();
+ // TODO: why not just ignore HoriOrient?
+ bool isHoriOrientShiftDown =
+ rHori.GetHoriOrient() == text::HoriOrientation::NONE
+ || rHori.GetHoriOrient() == text::HoriOrientation::LEFT;
// Only consider invalid Writer fly frames if they'll be shifted down.
- bool bIgnoreFlyValidity
- = bAddVerticalFlyOffsets && rHori.GetHoriOrient() == text::HoriOrientation::NONE;
+ bool bIgnoreFlyValidity = bAddVerticalFlyOffsets && isHoriOrientShiftDown;
bool bConsiderFly =
// #i46807# - do not consider invalid
// Writer fly frames.
@@ -3027,8 +3030,7 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper,
bool bShiftDown = css::text::WrapTextMode_NONE == nSurround;
if (!bShiftDown && bAddVerticalFlyOffsets)
{
- if (nSurround == text::WrapTextMode_PARALLEL
- && rHori.GetHoriOrient() == text::HoriOrientation::NONE)
+ if (nSurround == text::WrapTextMode_PARALLEL && isHoriOrientShiftDown)
{
// We know that wrapping was requested and the table frame overlaps with
// the fly frame. Check if the print area overlaps with the fly frame as
@@ -3090,7 +3092,8 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper,
if ((css::text::WrapTextMode_RIGHT == nSurround
|| css::text::WrapTextMode_PARALLEL == nSurround)
- && text::HoriOrientation::LEFT == rHori.GetHoriOrient())
+ && text::HoriOrientation::LEFT == rHori.GetHoriOrient()
+ && !bShiftDown)
{
const tools::Long nWidth
= aRectFnSet.XDiff(aRectFnSet.GetRight(aFlyRect),