sw/qa/extras/ooxmlexport/data/tdf165478_bottomAligned.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport25.cxx | 14 +++++++++++++ sw/source/core/layout/tabfrm.cxx | 4 +-- 3 files changed, 16 insertions(+), 2 deletions(-)
New commits: commit c7f049069c5022ee09d73841d9e32b685a3bd9d8 Author: Justin Luth <jl...@mail.com> AuthorDate: Wed May 21 16:44:10 2025 -0400 Commit: Justin Luth <jl...@mail.com> CommitDate: Wed May 28 11:37:35 2025 +0200 tdf#165478 revert ConsiderWrapOnObjPos: always affect anchoring cell This reverts my 6.0 commit e56f61c4637c09afbf125fa02f131b0c49e36351 for tdf#37153 which was likely fixed properly by some layoutInCell fixes for 25.2. make CppunitTest_sw_ooxmlexport24 CPPUNIT_TEST_NAME=testTdf37153 make CppunitTest_sw_ooxmlexport25 CPPUNIT_TEST_NAME=testTdf165478_bottomAligned Change-Id: I0413504228d25aa311318c37478261e17346e3db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185634 Reviewed-by: Justin Luth <jl...@mail.com> Tested-by: Jenkins diff --git a/sw/qa/extras/ooxmlexport/data/tdf165478_bottomAligned.docx b/sw/qa/extras/ooxmlexport/data/tdf165478_bottomAligned.docx new file mode 100644 index 000000000000..6e3264f2667a Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf165478_bottomAligned.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport25.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport25.cxx index 3f920a0cf4dc..88769ef361ac 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport25.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport25.cxx @@ -55,6 +55,20 @@ DECLARE_OOXMLEXPORT_TEST(testTdf166510_sectPr_bottomSpacing, "tdf166510_sectPr_b CPPUNIT_ASSERT_EQUAL(sal_Int32(4253), nHeight); } +DECLARE_OOXMLEXPORT_TEST(testTdf165478_bottomAligned, "tdf165478_bottomAligned.docx") +{ + // given a layoutInCell, wrap-through image, paragraph-anchored to a bottom-aligned cell + auto pXmlDoc = parseLayoutDump(); + + // The text in the cell should be at the bottom of the cell + assertXPathContent(pXmlDoc, "//cell[2]/txt", u"Bottom aligned"); + sal_Int32 nTextBottom = getXPath(pXmlDoc, "//cell[2]/txt/infos/bounds", "bottom").toInt32(); + sal_Int32 nCellBottom = getXPath(pXmlDoc, "//cell[2]/infos/bounds", "bottom").toInt32(); + + // Without the fix, the text was at the top of the cell (2002) instead of at the bottom (4423) + CPPUNIT_ASSERT_EQUAL(nCellBottom, nTextBottom); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf166620) { createSwDoc(); diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 2c33166f12ec..b7632cbab074 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -6194,8 +6194,7 @@ void SwCellFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder for (SwAnchoredObject* pAnchoredObj : *pPg->GetSortedObjs()) { SwRect aTmp( pAnchoredObj->GetObjRect() ); - const SwFrame* pAnch = pAnchoredObj->GetAnchorFrame(); - if ( (bConsiderWrapOnObjPos && IsAnLower( pAnch )) || (!bConsiderWrapOnObjPos && aTmp.Overlaps( aRect )) ) + if (aTmp.Overlaps(aRect)) { const SwFrameFormat* pAnchoredObjFrameFormat = pAnchoredObj->GetFrameFormat(); const SwFormatSurround &rSur = pAnchoredObjFrameFormat->GetSurround(); @@ -6209,6 +6208,7 @@ void SwCellFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder continue; } + const SwFrame* pAnch = pAnchoredObj->GetAnchorFrame(); // #i43913# // #i52904# - no vertical alignment, // if object, anchored inside cell, has temporarily