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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Jan 25 08:09:51 UTC 2019


 sw/qa/extras/ooxmlexport/data/tdf121665_back2backColumnBreaks.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx                         |    7 +++++
 sw/source/filter/ww8/docxattributeoutput.cxx                       |   12 +++++++---
 sw/source/filter/ww8/docxattributeoutput.hxx                       |    1 
 4 files changed, 17 insertions(+), 3 deletions(-)

New commits:
commit 128369d6c853b5541abe08b240ece0abe7c28a4c
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Thu Jan 24 16:19:16 2019 +0300
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Fri Jan 25 09:09:22 2019 +0100

    tdf#121665 ooxmlexport: allow each para to have a column break
    
    The previous logic didn't allow adjacent paragraphs to each have
    a column break. For example, if this paragraph has a column break,
    then it would ignore writing the postponed paragraph break from
    the previous paragraph. In other words, only the last sequential
    paragraph would get the column break, and the earlier column breaks
    would just be lost.
    
    Introduced a new option, so that this paragraph can write its
    postponed break, and also pass on a postponed break to the following
    paragraph.
    
    Change-Id: I8afba3470804394f4e0926695e0c11c8e83dff11
    Reviewed-on: https://gerrit.libreoffice.org/66878
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf121665_back2backColumnBreaks.docx b/sw/qa/extras/ooxmlexport/data/tdf121665_back2backColumnBreaks.docx
new file mode 100644
index 000000000000..e9173a9acf57
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf121665_back2backColumnBreaks.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 2b0ee4166152..ac701f8bbd75 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -11,6 +11,7 @@
 
 #include <com/sun/star/awt/Size.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/style/BreakType.hpp>
 #include <com/sun/star/style/ParagraphAdjust.hpp>
 #include <com/sun/star/table/BorderLine.hpp>
 #include <com/sun/star/text/XDependentTextField.hpp>
@@ -101,6 +102,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf116436_rowFill, "tdf116436_rowFill.odt")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0xF8DF7C), getProperty<sal_Int32>(xCell, "BackColor"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf121665_back2backColumnBreaks, "tdf121665_back2backColumnBreaks.docx")
+{
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Column break type",
+        style::BreakType_COLUMN_BEFORE, getProperty<style::BreakType>(getParagraph(2), "BreakType"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf46938_clearTabStop, "tdf46938_clearTabStop.docx")
 {
     // Number of tabstops should be zero, overriding the one in the style
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 67430375fb55..4959e61e5a00 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1232,14 +1232,17 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar
         m_pSerializer->endElementNS(XML_w, XML_smartTag);
     }
 
-    if ( m_nColBreakStatus == COLBRK_WRITE )
+    if ( m_nColBreakStatus == COLBRK_WRITE || m_nColBreakStatus == COLBRK_WRITEANDPOSTPONE )
     {
         m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
         m_pSerializer->singleElementNS( XML_w, XML_br,
                 FSNS( XML_w, XML_type ), "column", FSEND );
         m_pSerializer->endElementNS( XML_w, XML_r );
 
-        m_nColBreakStatus = COLBRK_NONE;
+        if ( m_nColBreakStatus == COLBRK_WRITEANDPOSTPONE )
+            m_nColBreakStatus = COLBRK_POSTPONE;
+        else
+            m_nColBreakStatus = COLBRK_NONE;
     }
 
     if ( m_bPostponedPageBreak && !m_bWritingHeaderFooter )
@@ -6038,7 +6041,10 @@ void DocxAttributeOutput::SectionBreak( sal_uInt8 nC, const WW8_SepInfo* pSectio
     {
         case msword::ColumnBreak:
             // The column break should be output in the next paragraph...
-            m_nColBreakStatus = COLBRK_POSTPONE;
+            if ( m_nColBreakStatus == COLBRK_WRITE )
+                m_nColBreakStatus = COLBRK_WRITEANDPOSTPONE;
+            else
+                m_nColBreakStatus = COLBRK_POSTPONE;
             break;
         case msword::PageBreak:
             if ( pSectionInfo )
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 62e9e1822f1e..052dff8fb01c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -66,6 +66,7 @@ enum DocxColBreakStatus
 {
     COLBRK_NONE,
     COLBRK_POSTPONE,
+    COLBRK_WRITEANDPOSTPONE,
     COLBRK_WRITE
 };
 


More information about the Libreoffice-commits mailing list