sw/qa/extras/layout/layout4.cxx | 7 +++++++ sw/source/core/layout/tabfrm.cxx | 25 +++---------------------- 2 files changed, 10 insertions(+), 22 deletions(-)
New commits: commit b3e1d66d944106bef177a01f7d180ed507c9716c Author: Justin Luth <jl...@mail.com> AuthorDate: Tue May 6 12:15:59 2025 -0400 Commit: Justin Luth <jl...@mail.com> CommitDate: Tue May 6 23:41:09 2025 +0200 tdf#166474 revert tdf#164907 sw: Calculate row height ... #2 This reverts 25.8 commit e9ed6f1d2cc145e7514bf0a27b8c77f370ceab2d (backported to 25.2.2). It turns out that Oliver's 25.2 commit was correct after all, and that "other factors" were coming into play that had confused the issue. I found this by doing an mso-test against my commits for tdf#164907 and tdf#165492. I noticed that the improvements for DOC files seemed to only be half-improved. I hadn't clued in to that while going through DOCX files, but afterwards I revisited them and then could see a similar need. make CppunitTest_sw_layoutwriter4 \ CPPUNIT_TEST_NAME=TestTdf164907_rowHeightAtLeast Change-Id: Ib35094583562b8ec36c8583c8fa47c5542b6b1e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184999 Reviewed-by: Justin Luth <jl...@mail.com> Tested-by: Jenkins diff --git a/sw/qa/extras/layout/layout4.cxx b/sw/qa/extras/layout/layout4.cxx index 072a675aa1d9..8e5a12735c2d 100644 --- a/sw/qa/extras/layout/layout4.cxx +++ b/sw/qa/extras/layout/layout4.cxx @@ -1615,6 +1615,13 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, TestTdf164907_rowHeightAtLeast) createSwDoc("tdf164907_rowHeightAtLeast.docx"); CPPUNIT_ASSERT_EQUAL(1, getPages()); + + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + sal_Int32 nRowHeight = getXPath(pXmlDoc, "//body/tab/row[1]/infos/bounds", "bottom").toInt32(); + + // The first row has top and bottom padding - both should be added to the row's "minimum height" + // Without the fix, this was Actual : 2732 + CPPUNIT_ASSERT_EQUAL(sal_Int32(2852), nRowHeight); } CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, TestTdf157829LTR) diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index f65de7960667..2c33166f12ec 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -215,7 +215,6 @@ static bool lcl_InnerCalcLayout( SwFrame *pFrame, // cell height. static SwTwips lcl_CalcMinRowHeight( const SwRowFrame *pRow, const bool _bConsiderObjs ); -static sal_uInt16 lcl_GetLineWidth(const SwRowFrame& rRow, const SvxBoxItemLine& rLine); static sal_uInt16 lcl_GetTopSpace( const SwRowFrame& rRow ); static sal_uInt16 lcl_GetBottomLineDist(const SwRowFrame& rRow); @@ -4997,9 +4996,9 @@ static SwTwips lcl_CalcMinRowHeight( const SwRowFrame* _pRow, nHeight = rSz.GetHeight(); if (bMinRowHeightInclBorder) // handle MS Word 'atLeast' oddities { - // add (only) top horizontal border - nHeight += lcl_GetLineWidth(*_pRow, SvxBoxItemLine::TOP); - // MS Word also adds the bottom border padding in addition to the minHeight + line + // add top horizontal border line, along with its padding. + nHeight += lcl_GetTopSpace(*_pRow); + // MS Word also adds the bottom border padding (but not the bottom border line) nHeight += lcl_GetBottomLineDist(*_pRow); } @@ -5074,24 +5073,6 @@ static SwTwips lcl_CalcMinRowHeight( const SwRowFrame* _pRow, return nHeight; } -// Calculate the maximum border-line thickness (CalcLineWidth) of all the cells in the row -static sal_uInt16 lcl_GetLineWidth(const SwRowFrame& rRow, const SvxBoxItemLine& rLine) -{ - sal_uInt16 nBorderThickness = 0; - for (const SwCellFrame* pCell = static_cast<const SwCellFrame*>(rRow.Lower()); pCell; - pCell = static_cast<const SwCellFrame*>(pCell->GetNext())) - { - sal_uInt16 nTmpWidth = 0; - const SwFrame* pLower = pCell->Lower(); - if (pLower && pLower->IsRowFrame()) - nTmpWidth = lcl_GetLineWidth(*static_cast<const SwRowFrame*>(pLower), rLine); - else - nTmpWidth = pCell->GetFormat()->GetAttrSet().GetBox().CalcLineWidth(rLine); - nBorderThickness = std::max(nBorderThickness, nTmpWidth); - } - return nBorderThickness; -} - // #i29550# // Calculate the maximum of (TopLineSize + TopLineDist) over all lowers: