sw/qa/extras/layout/data/line-spacing-80percent.fodt | 53 +++++++++++++++++++ sw/qa/extras/layout/layout5.cxx | 34 ++++++++++++ sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 4 - sw/source/core/text/porrst.cxx | 2 4 files changed, 90 insertions(+), 3 deletions(-)
New commits: commit 786fbd5afaa77818df1494bfbc82d7e3bb18b9dc Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Tue May 20 00:41:55 2025 +0500 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue May 20 09:36:16 2025 +0200 tdf#166652: do not use FormatEmpty for proportional spacing < 100% The FormatEmpty optimization can't handle this spacing mode, it uses the text height without modification. The change in testTdf143384_tableInFoot_negativeMargins (fixing the test checking incorrect page number) is directly related: there are empty paragraphs there, with spacing formatted to 75% - ignoring which was the reason of excessive height causing an extra page. Change-Id: Ibfae8b102f88656a1b703cc73b71ab6ef28a3ef4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185542 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 9ab2578b3a832e75ad3c71477ad1850be236cc3f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185549 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/layout/data/line-spacing-80percent.fodt b/sw/qa/extras/layout/data/line-spacing-80percent.fodt new file mode 100644 index 000000000000..72d35cdd16d2 --- /dev/null +++ b/sw/qa/extras/layout/data/line-spacing-80percent.fodt @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:font-face-decls> + <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/> + </office:font-face-decls> + <office:styles> + <style:style style:name="Custom" style:family="paragraph"> + <style:paragraph-properties fo:line-height="80%"/> + <style:text-properties style:font-name="Liberation Serif" fo:font-size="30pt"/> + </style:style> + </office:styles> + <office:automatic-styles> + <style:style style:name="Table1.A1" style:family="table-cell"> + <style:table-cell-properties fo:padding="2mm" fo:border="0.5pt solid #000000"/> + </style:style> + </office:automatic-styles> + <office:body> + <office:text> + <table:table table:name="Table1"> + <table:table-column table:number-columns-repeated="2"/> + <table:table-row> + <table:table-cell table:style-name="Table1.A1" office:value-type="string"> + <text:p text:style-name="Custom">lorem</text:p> + <text:p text:style-name="Custom"/> + <text:p text:style-name="Custom">ipsum</text:p> + <text:p text:style-name="Custom"/> + <text:p text:style-name="Custom">lorem</text:p> + <text:p text:style-name="Custom"/> + <text:p text:style-name="Custom">ipsum</text:p> + <text:p text:style-name="Custom"/> + <text:p text:style-name="Custom">lorem</text:p> + <text:p text:style-name="Custom"/> + <text:p text:style-name="Custom">ipsum</text:p> + </table:table-cell> + <table:table-cell table:style-name="Table1.A1" office:value-type="string"> + <text:p text:style-name="Custom">lorem</text:p> + <text:p text:style-name="Custom">-</text:p> + <text:p text:style-name="Custom">ipsum</text:p> + <text:p text:style-name="Custom">-</text:p> + <text:p text:style-name="Custom">lorem</text:p> + <text:p text:style-name="Custom">-</text:p> + <text:p text:style-name="Custom">ipsum</text:p> + <text:p text:style-name="Custom">-</text:p> + <text:p text:style-name="Custom">lorem</text:p> + <text:p text:style-name="Custom">-</text:p> + <text:p text:style-name="Custom">ipsum</text:p> + </table:table-cell> + </table:table-row> + </table:table> + </office:text> + </office:body> +</office:document> \ No newline at end of file diff --git a/sw/qa/extras/layout/layout5.cxx b/sw/qa/extras/layout/layout5.cxx index 078a359fb364..67f889c988f8 100644 --- a/sw/qa/extras/layout/layout5.cxx +++ b/sw/qa/extras/layout/layout5.cxx @@ -1663,6 +1663,40 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf88752) CPPUNIT_ASSERT_LESS(sal_Int32(1690), nHeight); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf166652) +{ + createSwDoc("line-spacing-80percent.fodt"); + auto pXmlDoc = parseLayoutDump(); + + // Check that all line heights are identical + assertXPath(pXmlDoc, "//cell[1]/txt", 11); + assertXPath(pXmlDoc, "//cell[1]/txt[1]/infos/bounds", "height", u"552"); + // Before the fix, this was 691 + assertXPath(pXmlDoc, "//cell[1]/txt[2]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[1]/txt[3]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[1]/txt[4]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[1]/txt[5]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[1]/txt[6]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[1]/txt[7]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[1]/txt[8]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[1]/txt[9]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[1]/txt[10]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[1]/txt[11]/infos/bounds", "height", u"552"); + + assertXPath(pXmlDoc, "//cell[2]/txt", 11); + assertXPath(pXmlDoc, "//cell[2]/txt[1]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[2]/txt[2]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[2]/txt[3]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[2]/txt[4]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[2]/txt[5]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[2]/txt[6]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[2]/txt[7]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[2]/txt[8]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[2]/txt[9]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[2]/txt[10]/infos/bounds", "height", u"552"); + assertXPath(pXmlDoc, "//cell[2]/txt[11]/infos/bounds", "height", u"552"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index e34b17467348..af32d3ebf216 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -2295,9 +2295,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf143384_tableInFoot_negativeMargins, "tdf143384_tableInFoot_negativeMargins.docx") { // There should be no crash during loading of the document - // so, let's check just how much pages we have - // Ideally this would be 1, matching Word. - CPPUNIT_ASSERT_EQUAL(2, getPages()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 9331add1e58c..9b71af6a7b40 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -448,6 +448,8 @@ bool SwTextFrame::FormatEmpty() const SvxLineSpacingItem &rSpacing = aSet.GetLineSpacing(); if( !bCollapse && ( SvxLineSpaceRule::Min == rSpacing.GetLineSpaceRule() || SvxLineSpaceRule::Fix == rSpacing.GetLineSpaceRule() || + (rSpacing.GetInterLineSpaceRule() == SvxInterLineSpaceRule::Prop + && rSpacing.GetPropLineSpace() < 100) || aSet.GetFirstLineIndent().IsAutoFirst())) { return false;