summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2023-04-14 11:07:47 +0200
committerLászló Németh <nemeth@numbertext.org>2023-04-18 11:42:04 +0200
commit0f976c3b5608ec77dc3ad539e9a8d83b2e423a60 (patch)
treec81d65d597afb46949e87a9b189f8d5a9e877a65
parent73e4009dc2a645b1bf9f06ce34711e135c147082 (diff)
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 <nemeth@numbertext.org> (cherry picked from commit a36fda0d7c70ffd344f9636ca436e77e41dc01f1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150325 Tested-by: László Németh <nemeth@numbertext.org>
-rw-r--r--sw/qa/extras/odfexport/data/tdf150149.fodt79
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx10
-rw-r--r--sw/source/core/layout/tabfrm.cxx11
3 files changed, 98 insertions, 2 deletions
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 87a7f93893cf..88a0d657f506 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -296,6 +296,16 @@ DECLARE_ODFEXPORT_TEST(testTdf125877, "tdf95806.docx")
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 9b3816685560..8e3a1b5dc1d1 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 )
{