sw/source/core/layout/tabfrm.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
New commits: commit 38bea89416c8b4ebc37a2590a0fdc7de2366ebc7 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed Aug 23 15:51:32 2023 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Dec 11 11:19:38 2023 +0100 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. (cherry picked from commit 7b1c03ed87f7a21606e09863b23074e6b96e26d1) Conflicts: sw/source/core/layout/tabfrm.cxx Change-Id: I465a55bbf1a783abce8b8d6d65099bd9df5695f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160559 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 87ab7c05c26f..23d53350fc55 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -3072,9 +3072,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. @@ -3134,8 +3137,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 @@ -3196,7 +3198,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),