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 a36fda0d7c70ffd344f9636ca436e77e41dc01f1
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: Fri Apr 14 13:27:46 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>

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 7298a3f314ac..9b7834afcd47 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -290,6 +290,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 13c65b977bf5..47bbf801dfef 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1113,9 +1113,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 )
     {

Reply via email to