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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Dec 21 09:54:53 UTC 2018


 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx   |    1 +
 sw/source/filter/ww8/docxattributeoutput.cxx |    2 +-
 sw/source/filter/ww8/wrtw8nds.cxx            |    2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 4ce06f8d162a282025cefe14e5684f82e439e01c
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Fri Dec 14 11:28:45 2018 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Dec 21 10:54:26 2018 +0100

    sw ooxmlexport: export non-continuous section breaks
    
    I'm amazed at how poorly DOCX section breaks were exported. This
    is really hard code to understand - jumping around all over, and
    shared between totally different doc/rtf/docx implementations.
    This change only affects docx, since .doc SectionBreaks is empty
    and RTF does nothing in the case of .IsSectionNode().
    
    I THINK that sectionbreaksandframes does this job for DOC
    (which is empty for DOCX) and RTF does things very
    differently, so no possibility to piggy-back on existing code.
    
    In any case, after a section node, there was NOTHING that
    looked at the first text node to see if there was a
    RES_PAGEDESC or a RES_BREAK, so these page breaks
    were being completely ignored. It took a few days to
    figure out this very simple solution.
    
    A followup commit will fix the import when the follow
    page is a different orientation.
    
    Change-Id: I774e3e64cac9e2d26fdbeb1484266ebb44fac114
    Reviewed-on: https://gerrit.libreoffice.org/65155
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index b3d0a219c5cc..726bc3731e36 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -40,6 +40,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121374_sectionHF, "tdf121374_sectionHF.odt")
     CPPUNIT_ASSERT_EQUAL( OUString("footer"), xFooterText->getString() );
 
     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Paragraphs", 6, getParagraphs() );
+    CPPUNIT_ASSERT_MESSAGE("Number of pages", getPages() > 2);
     //CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 6, getPages() );
 }
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1328a07151cb..462af4db6ebc 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -874,7 +874,7 @@ void DocxAttributeOutput::SectionBreaks(const SwNode& rNode)
     // paragraph, and detect the section breaks there.
     SwNodeIndex aNextIndex( rNode, 1 );
 
-    if (rNode.IsTextNode())
+    if (rNode.IsTextNode() || rNode.IsSectionNode())
     {
         if (aNextIndex.GetNode().IsTextNode())
         {
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 393c1d2e8afb..7cde0949f748 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -3037,6 +3037,8 @@ void MSWordExportBase::OutputSectionNode( const SwSectionNode& rSectionNode )
 
         if ( pSet && NoPageBreakSection( pSet ) )
             pSet = nullptr;
+        else
+            AttrOutput().SectionBreaks( rSectionNode );
 
         if ( !pSet )
         {


More information about the Libreoffice-commits mailing list