sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 8 ++++++++ sw/source/core/layout/tabfrm.cxx | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-)
New commits: commit a2eb29995f8f4ba91496242ed7b98237f6c0e763 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Sep 4 13:19:47 2024 +0500 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Sep 5 09:02:52 2024 +0200 tdf#162781: also shift down tables with text::HoriOrientation::RIGHT As said in commit 7b1c03ed87f7a21606e09863b23074e6b96e26d1 (tdf#154775 sw: layout: avoid breaking this with following commits, 2023-08-24), it would be best not to check HoriOrient at all, but needs checking first what Word does in other cases. So I just add another case that is known to require the shift. Change-Id: I05a8e17ec53741e99b004369629fd9fecf78526d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172855 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 6d3a98a0011b70570ce3ef0b7873d0d1ee26a35a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172887 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index ad4057adf300..ea9d652b44a3 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -847,6 +847,14 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf162746) { // Without the fix in place this hangs (and eventually OOMs) on opening loadAndSave("tdf162746.docx"); + // tdf#162781: test the page body table vertical offset and width + xmlDocUniquePtr pDump = parseLayoutDump(); + // Without the fix, this would be 0 - i.e., the page body table didn't shift down + // below the header's floating table + assertXPath(pDump, "//page[1]/body/tab/infos/prtBounds"_ostr, "top"_ostr, u"35"_ustr); + // Without the fix, this would be 100, because the page body table only used tiny space + // to the left of the header's floating table + assertXPath(pDump, "//page[1]/body/tab/infos/prtBounds"_ostr, "width"_ostr, u"9360"_ustr); } } // end of anonymous namespace diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index a7286a4860b9..dc948b5d5634 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -3307,7 +3307,8 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper, // TODO: why not just ignore HoriOrient? bool isHoriOrientShiftDown = rHori.GetHoriOrient() == text::HoriOrientation::NONE - || rHori.GetHoriOrient() == text::HoriOrientation::LEFT; + || rHori.GetHoriOrient() == text::HoriOrientation::LEFT + || rHori.GetHoriOrient() == text::HoriOrientation::RIGHT; // Only consider invalid Writer fly frames if they'll be shifted down. bool bIgnoreFlyValidity = bAddVerticalFlyOffsets && isHoriOrientShiftDown; bool bConsiderFly = @@ -3473,7 +3474,8 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper, } if ((css::text::WrapTextMode_LEFT == nSurround || css::text::WrapTextMode_PARALLEL == nSurround) - && text::HoriOrientation::RIGHT == rHori.GetHoriOrient()) + && text::HoriOrientation::RIGHT == rHori.GetHoriOrient() + && !bShiftDown) { const tools::Long nWidth = aRectFnSet.XDiff(aRectFnSet.GetRight(pFly->GetAnchorFrame()->getFrameArea()),