sw/qa/extras/ooxmlexport/data/tdf134649_pageBreak.fodt |   86 +++++++++++++++++
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx             |    6 +
 sw/source/filter/ww8/docxattributeoutput.cxx           |    7 +
 3 files changed, 99 insertions(+)

New commits:
commit 3d1bde017ffd68f4518d7add1b46ce24353aa4cf
Author:     László Németh <[email protected]>
AuthorDate: Tue Sep 1 08:48:53 2020 +0200
Commit:     Gabor Kelemen <[email protected]>
CommitDate: Wed Jan 6 16:23:42 2021 +0100

    tdf#134649 DOCX export: fix page break between tables
    
    Section break between tables wasn't exported,
    resulting missing page break and table content.
    
    For example, a table on a new landscape page was
    merged to the previous table, removing not only the
    landscape page, but hiding half of the table because
    of the narrower width of the previous page with
    portrait orientation.
    
    Change-Id: Id02529d023a6306fb5be42486d25f252d8821f2f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101823
    Tested-by: Jenkins
    Reviewed-by: László Németh <[email protected]>
    (cherry picked from commit 4a96b2b7787900b6ca45e772daa0fc284b3a4e0f)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108871
    Tested-by: Gabor Kelemen <[email protected]>
    Reviewed-by: Gabor Kelemen <[email protected]>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf134649_pageBreak.fodt 
b/sw/qa/extras/ooxmlexport/data/tdf134649_pageBreak.fodt
new file mode 100644
index 000000000000..7d05c3e3ce99
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf134649_pageBreak.fodt
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:styles>
+  <style:default-style style:family="paragraph">
+  </style:default-style>
+  <style:default-style style:family="table">
+   <style:table-properties table:border-model="collapsing"/>
+  </style:default-style>
+  <style:default-style style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:default-style>
+  <style:style style:name="Standard" style:family="paragraph" 
style:class="text"/>
+  <style:style style:name="Heading" style:family="paragraph" 
style:parent-style-name="Standard" style:next-style-name="Text_20_body" 
style:class="text">
+  </style:style>
+  <style:style style:name="Text_20_body" style:display-name="Text body" 
style:family="paragraph" style:parent-style-name="Standard" style:class="text">
+  </style:style>
+  <style:style style:name="Table_20_Contents" style:display-name="Table 
Contents" style:family="paragraph" style:parent-style-name="Standard" 
style:class="extra">
+  </style:style>
+ </office:styles>
+ <office:automatic-styles>
+  <style:style style:name="Table1" style:family="table">
+   <style:table-properties style:width="11.509cm" table:align="left"/>
+  </style:style>
+  <style:style style:name="Table2" style:family="table" 
style:master-page-name="Landscape">
+   <style:table-properties style:page-number="auto" table:align="margins"/>
+  </style:style>
+  <style:page-layout style:name="pm1">
+   <style:page-layout-properties fo:page-width="21.59cm" 
fo:page-height="27.94cm" style:print-orientation="portrait"/>
+  </style:page-layout>
+  <style:page-layout style:name="pm2">
+   <style:page-layout-properties fo:page-height="21.59cm" 
fo:page-width="27.94cm" style:print-orientation="landscape"/>
+   <style:header-style/>
+   <style:footer-style/>
+  </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+  <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+  <style:master-page style:name="Landscape" style:page-layout-name="pm2"/>
+ </office:master-styles>
+ <office:body>
+  <office:text text:use-soft-page-breaks="true">
+   <text:p>Two tables, one pagebreak:</text:p>
+   <table:table table:name="Table1" table:style-name="Table1">
+    <table:table-column/>
+    <table:table-column/>
+    <table:table-row>
+     <table:table-cell office:value-type="string">
+      <text:p>Hello1</text:p>
+     </table:table-cell>
+     <table:table-cell office:value-type="string">
+      <text:p text:style-name="Table_20_Contents"/>
+     </table:table-cell>
+    </table:table-row>
+    <table:table-row>
+     <table:table-cell office:value-type="string">
+      <text:p>World1</text:p>
+     </table:table-cell>
+     <table:table-cell office:value-type="string">
+      <text:p text:style-name="Table_20_Contents"/>
+     </table:table-cell>
+    </table:table-row>
+   </table:table>
+   <table:table table:name="Table2" table:style-name="Table2">
+    <table:table-column/>
+    <table:table-column/>
+    <table:table-row>
+     <table:table-cell office:value-type="string">
+      <text:p>Hello2</text:p>
+     </table:table-cell>
+     <table:table-cell office:value-type="string">
+      <text:p text:style-name="Table_20_Contents"/>
+     </table:table-cell>
+    </table:table-row>
+    <table:table-row>
+     <table:table-cell office:value-type="string">
+      <text:p>World2</text:p>
+     </table:table-cell>
+     <table:table-cell office:value-type="string">
+      <text:p text:style-name="Table_20_Contents"/>
+     </table:table-cell>
+    </table:table-row>
+   </table:table>
+   <text:p/>
+  </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 7a7b7d519016..3f8c025e8aa8 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -123,6 +123,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf131801, "tdf131801.docx")
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:p[8]/w:pPr/w:rPr/w:rStyle", 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf134649_pageBreak, "tdf134649_pageBreak.fodt")
+{
+    // This was 1 (missing page break between tables).
+    CPPUNIT_ASSERT_EQUAL(2, getPages());
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf135973, "tdf135973.odt")
 {
     CPPUNIT_ASSERT_EQUAL(1, getPages());
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index f592bcd7c981..f38dc1dde917 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1029,6 +1029,13 @@ void DocxAttributeOutput::SectionBreaks(const SwNode& 
rNode)
             if (rNode.StartOfSectionNode()->IsTableNode() || 
rNode.StartOfSectionNode()->IsSectionNode())
                 m_rExport.OutputSectionBreaks(pTextNode->GetpSwAttrSet(), 
*pTextNode, m_tableReference->m_bTableCellOpen, pTextNode->GetText().isEmpty());
         }
+        else if (aNextIndex.GetNode().IsTableNode())
+        {
+            // Handle section break between tables.
+            const SwTableNode* pTableNode = 
static_cast<SwTableNode*>(&aNextIndex.GetNode());
+            const SwFrameFormat *pFormat = 
pTableNode->GetTable().GetFrameFormat();
+            m_rExport.OutputSectionBreaks(&(pFormat->GetAttrSet()), 
*pTableNode);
+        }
     }
 }
 
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to