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@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 0000000..e9173a9
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf121665_back2backColumnBreaks.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 2b0ee41..ac701f8 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 6743037..4959e61 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 62e9e18..052dff8 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
};