[Libreoffice-commits] core.git: sw/qa sw/source

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 31 12:00:41 UTC 2020


 sw/qa/extras/ooxmlexport/data/tdf132149_pgBreak.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx          |   12 ++++++++++++
 sw/source/filter/ww8/wrtw8nds.cxx                   |   15 ---------------
 3 files changed, 12 insertions(+), 15 deletions(-)

New commits:
commit a0da393cac0a44c648238b815970245684173c99
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Wed Aug 26 17:06:22 2020 +0300
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Mon Aug 31 13:59:53 2020 +0200

    tdf#132149 ww8export: nextNode has nothing to do with pageDesc
    
    While it can often be assumed that the next paragraph following
    one that has just soft-page-breaked in the middle will be on the
    same page, it isn't necessarily correct. Either the paragraph
    could span multiple pages, or a page-break could push it to
    the next page.
    
    Thus, strip the code out completely, and simply prepare a
    new page style based on the follow style - which by definition
    is different enough to not be a plausible single word section.
    
    A few followup commits will add enhancements, but this is
    broken up into minute bits in order to aid in regression
    identification.
    
    Change-Id: I80e4e17be69a49f45a624d819c9c4158541ee065
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101424
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf132149_pgBreak.odt b/sw/qa/extras/ooxmlexport/data/tdf132149_pgBreak.odt
new file mode 100644
index 000000000000..b88e660a7458
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf132149_pgBreak.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 821a254ea0fe..397b9040e026 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -329,6 +329,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135343_columnSectionBreak_c15, "tdf135343_column
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Fits on two pages", 2, getPages());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf132149_pgBreak, "tdf132149_pgBreak.odt")
+{
+    xmlDocUniquePtr pDump = parseLayoutDump();
+
+    // No header on pages 1,2,3 (and currently 4).
+    assertXPath(pDump, "//page[2]/header", 0);
+
+    //Page break is not lost. This SHOULD be on page 4, but sadly it is not.
+    //assertXPathContent(pDump, "//page[5]/header", "First Page Style");
+    //CPPUNIT_ASSERT(getXPathContent(pDump, "//page[5]/body/txt").startsWith("Lorem ipsum"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf129452_excessBorder, "tdf129452_excessBorder.docx")
 {
     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index da882d0cd4c6..a1f8965b686e 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2717,24 +2717,9 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
         // if paragraph is split, put the section break between the parts
         if( bNeedParaSplit && *aBreakIt != rNode.GetText().getLength() )
         {
-            SwNodeIndex aNextIndex( rNode, 1 );
-            const SwNode& pNextNode = aNextIndex.GetNode();
-            // if there is a next node, use its attributes to create the new
-            // section
-            if( pNextNode.IsTextNode() )
-            {
-                const SwTextNode& rNextNode = *static_cast<SwTextNode*>(
-                        &aNextIndex.GetNode() );
-                OutputSectionBreaks(rNextNode.GetpSwAttrSet(), rNextNode);
-            }
-            else if (pNextNode.IsEndNode() )
-            {
-                // In this case the same paragraph holds the next page style
-                // too.
                 const SwPageDesc* pNextPageDesc = m_pCurrentPageDesc->GetFollow();
                 assert(pNextPageDesc);
                 PrepareNewPageDesc( rNode.GetpSwAttrSet(), rNode, nullptr , pNextPageDesc);
-            }
         }
         else if (!bNeedParaSplit)
         {


More information about the Libreoffice-commits mailing list