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 48b3893e0200417640f07eb6fd01b9a5d3b0b623 Author: Justin Luth <justin_l...@sil.org> AuthorDate: Thu Jan 24 16:19:16 2019 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Jan 25 09:19:08 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/66895 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@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 e19218f2574b..899199224705 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 408ac885d246..c6cff7b56f42 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1137,14 +1137,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 ) @@ -5937,7 +5940,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 7e852aa33bec..b09b0bea01ac 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 }; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits