sw/qa/extras/ooxmlexport/data/tdf156372.doc |binary
 sw/qa/extras/ooxmlexport/ooxmlexport19.cxx  |   11 +++++++++++
 sw/source/core/layout/flowfrm.cxx           |    6 ++++--
 3 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit a3d2630901608a0816bfbc490f695dde7c962952
Author:     Satya <skompe...@opentext.com>
AuthorDate: Mon Jul 31 14:31:10 2023 +0530
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Mon Jul 31 15:49:53 2023 +0200

    tdf#156372 sw: Stop adding GetLower to every cell in header table
    
    The code was doubling the lower spacing of the last paragraph
    in every cell of the table. This change is to not add the space
    when in tables, since that was intended to only apply
    to the last paragraph in the header.
    
    make CppunitTest_sw_ooxmlexport19 CPPUNIT_TEST_NAME=testTdf156372
    
    Change-Id: I4f676820634390416e6e96ea4149e48fbf0d8908
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155084
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/ooxmlexport/data/tdf156372.doc 
b/sw/qa/extras/ooxmlexport/data/tdf156372.doc
new file mode 100644
index 000000000000..3b8ade19f83d
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf156372.doc differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx
index a7c4b2c068d1..2769423eeb43 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx
@@ -1028,6 +1028,17 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf133560)
     CPPUNIT_ASSERT_EQUAL(12.0f, getProperty<float>(getParagraph(4), 
"CharHeight"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf156372, "tdf156372.doc")
+{
+    sal_Int32 nHeight = parseDump("//page[1]/header/tab/row[1]/infos/bounds", 
"height").toInt32();
+    // Without a fix in place, this would fail with
+    // - Expected: 847
+    // - Actual  : 1327
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(847), nHeight, 5);
+
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/flowfrm.cxx 
b/sw/source/core/layout/flowfrm.cxx
index 41b6b8fff953..b7356ec0a059 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1835,9 +1835,11 @@ SwTwips SwFlowFrame::CalcLowerSpace( const 
SwBorderAttrs* _pAttrs ) const
     // tdf#128195 Consider para spacing below last paragraph in header
     bool bHasSpacingBelowPara = 
m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess().get(
         DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA);
-    if (bHasSpacingBelowPara && !m_rThis.IsInFly() && 
m_rThis.FindFooterOrHeader() && !GetFollow()
-        && !m_rThis.GetIndNext())
+    if (bHasSpacingBelowPara && !m_rThis.IsInTab() && !m_rThis.IsInFly()
+        && m_rThis.FindFooterOrHeader() && !GetFollow() && 
!m_rThis.GetIndNext())
+    {
         nLowerSpace += _pAttrs->GetULSpace().GetLower() + 
_pAttrs->CalcLineSpacing();
+    }
 
     return nLowerSpace;
 }

Reply via email to