diff options
author | Justin Luth <justin_luth@sil.org> | 2016-11-28 21:59:22 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2016-11-30 05:50:13 +0000 |
commit | 3de0128ec4e0fce998c84043a7f8f173f1f8ac96 (patch) | |
tree | 682868997eb3dae756f571d2e2c403588c63ebf6 | |
parent | cb751b75b6ca7dccb65c6455bbda1b5908c92877 (diff) |
tdf#103975 docx import: don't lose column break
This round-trips terribly, but that was equally true before these patches.
Change-Id: I4ed191c77e7f519d4c013fc83ef8b866b53d0c70
Reviewed-on: https://gerrit.libreoffice.org/31326
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
(cherry picked from commit bbc7ed9c379019f31dc7ac234cf83ea151601465)
Reviewed-on: https://gerrit.libreoffice.org/31341
-rwxr-xr-x | sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakE.docx | bin | 0 -> 14047 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 7 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 9 |
3 files changed, 16 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakE.docx b/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakE.docx Binary files differnew file mode 100755 index 000000000000..ac3eb9f7c7ff --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakE.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 05a490497af2..78845fd6d62f 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/document/XEmbeddedObjectSupplier2.hpp> #include <com/sun/star/drawing/PointSequenceSequence.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/style/BreakType.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/text/HoriOrientation.hpp> #include <com/sun/star/text/RelOrientation.hpp> @@ -129,6 +130,12 @@ DECLARE_SW_IMPORT_TEST(testMathMalformedXml, "math-malformed_xml.docx", FailTest CPPUNIT_ASSERT(!mxComponent.is()); } +DECLARE_OOXMLIMPORT_TEST(testTdf103975_notPageBreakE, "tdf103975_notPageBreakE.docx") +{ + // The problem was that the column break was getting lost. + CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, getProperty<style::BreakType>(getParagraph(2), "BreakType")); +} + DECLARE_OOXMLIMPORT_TEST(testN751017, "n751017.docx") { uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 26168b8c191f..aa279d6d4ac1 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3258,7 +3258,16 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) if (m_pImpl->isBreakDeferred(PAGE_BREAK)) pContext->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_PAGE_BEFORE)); else if (m_pImpl->isBreakDeferred(COLUMN_BREAK)) + { + if ( m_pImpl->GetIsFirstParagraphInSection() || !m_pImpl->IsFirstRun() ) + { + mbIsSplitPara = true; + m_pImpl->finishParagraph( m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) ); + lcl_startParagraphGroup(); + } + pContext->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_COLUMN_BEFORE)); + } m_pImpl->clearDeferredBreaks(); } |