sw/qa/extras/odfexport/data/tdf150149.fodt | 79 +++++++++++++++++++++++++++++ sw/qa/extras/odfexport/odfexport.cxx | 10 +++ sw/source/core/layout/tabfrm.cxx | 11 +++- 3 files changed, 98 insertions(+), 2 deletions(-)
New commits: commit a1f63eaa6810f9f8b0402b97938989ecf937346e Author: László Németh <nem...@numbertext.org> AuthorDate: Fri Apr 14 11:07:47 2023 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Mon Apr 17 08:55:32 2023 +0200 tdf#150149 sw: fix table header in multi-column sections Disabling long repeating table header on pages resulted lost table header within multi-column sections. To fix this, revert commit f7e071a00542c414a7e9d7bcf4434d908f225e59 for tables in sections. Regression from commit f7e071a00542c414a7e9d7bcf4434d908f225e59 "tdf#88496 DOCX: disable long repeating table header". Change-Id: Idb7b9ea014be5430a185489cf449463f534c1916 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150393 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit 6f868961f4e6060c1cdc27710b605c936be8685a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150324 diff --git a/sw/qa/extras/odfexport/data/tdf150149.fodt b/sw/qa/extras/odfexport/data/tdf150149.fodt new file mode 100644 index 000000000000..51aea046a218 --- /dev/null +++ b/sw/qa/extras/odfexport/data/tdf150149.fodt @@ -0,0 +1,79 @@ +<?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:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:automatic-styles> + <style:style style:name="Table1" style:family="table"> + <style:table-properties style:width="5cm" table:align="left"/> + </style:style> + <style:style style:name="Sect1" style:family="section"> + <style:section-properties text:dont-balance-text-columns="false" style:editable="false"> + <style:columns fo:column-count="3" fo:column-gap="0.5cm"> + </style:columns> + </style:section-properties> + </style:style> + </office:automatic-styles> + <office:body> + <office:text> + <text:section text:style-name="Sect1" text:name="Section1"> + <table:table table:name="Table1" table:style-name="Table1"> + <table:table-column table:number-columns-repeated="3"/> + <table:table-header-rows> + <table:table-row> + <table:table-cell> + <text:p>A</text:p> + </table:table-cell> + <table:table-cell> + <text:p>B</text:p> + </table:table-cell> + <table:table-cell> + <text:p>C</text:p> + </table:table-cell> + </table:table-row> + </table:table-header-rows> + <table:table-row> + <table:table-cell/> + <table:table-cell/> + <table:table-cell/> + </table:table-row> + <table:table-row> + <table:table-cell/> + <table:table-cell/> + <table:table-cell/> + </table:table-row> + <table:table-row> + <table:table-cell/> + <table:table-cell/> + <table:table-cell/> + </table:table-row> + <table:table-row> + <table:table-cell/> + <table:table-cell/> + <table:table-cell/> + </table:table-row> + <table:table-row> + <table:table-cell/> + <table:table-cell/> + <table:table-cell/> + </table:table-row> + <table:table-row> + <table:table-cell/> + <table:table-cell/> + <table:table-cell/> + </table:table-row> + <table:table-row> + <table:table-cell/> + <table:table-cell/> + <table:table-cell/> + </table:table-row> + <table:table-row> + <table:table-cell/> + <table:table-cell/> + <table:table-cell/> + </table:table-row> + </table:table> + <text:p/> + </text:section> + </office:text> + </office:body> +</office:document> + diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index bfc75df25ad7..e34f2914af96 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -291,6 +291,16 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf125877) CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); } +CPPUNIT_TEST_FIXTURE(Test, testTdf150149) +{ + loadAndReload("tdf150149.fodt"); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + // This was 0 (lost table header in multi-column section) + assertXPath(pXmlDoc, "//table:table-header-rows", 1); + assertXPath(pXmlDoc, "//table:table-header-rows/table:table-row/table:table-cell", 3); +} + DECLARE_ODFEXPORT_TEST(testTdf103567, "tdf103567.odt") { CPPUNIT_ASSERT_EQUAL(1, getShapes()); diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index b95f8ca45b25..d75a20955409 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -1097,9 +1097,16 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowK // First case: One of the repeated headline does not fit to the page anymore. // tdf#88496 Disable repeated headline (like for #i44910#) to avoid loops and // to fix interoperability problems (very long tables only with headline) + // tdf#150149 except in multi-column sections, where it's possible to enlarge + // the height of the section frame instead of using this fallback OSL_ENSURE( !GetIndPrev(), "Table is supposed to be at beginning" ); - m_pTable->SetRowsToRepeat(0); - return false; + if ( !IsInSct() ) + { + m_pTable->SetRowsToRepeat(0); + return false; + } + else + bKeepNextRow = true; } else if ( !GetIndPrev() && nRepeat == nRowCount ) {