diff options
author | Justin Luth <justin_luth@sil.org> | 2016-11-29 08:15:40 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2016-11-30 04:22:23 +0000 |
commit | 4307a850a310c0371bee1f79a8eb41fa8ff7fed2 (patch) | |
tree | b8fa4173572b97cc84f814a68b971c5b5ec09699 | |
parent | d53262282aed31819aa1ce9f608d5edba658dae4 (diff) |
tdf#103975 docx import: don't lose column break #2
Change-Id: I871e10d675d9009c163dd2b0fc74d29206934e34
Reviewed-on: https://gerrit.libreoffice.org/31342
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
-rwxr-xr-x | sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakD.docx | bin | 0 -> 21482 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 7 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 5 |
3 files changed, 10 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakD.docx b/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakD.docx Binary files differnew file mode 100755 index 000000000000..37c752499f08 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakD.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 78845fd6d62f..4fd658d98ba5 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -130,6 +130,13 @@ DECLARE_SW_IMPORT_TEST(testMathMalformedXml, "math-malformed_xml.docx", FailTest CPPUNIT_ASSERT(!mxComponent.is()); } +DECLARE_OOXMLIMPORT_TEST(testTdf103975_notPageBreakD, "tdf103975_notPageBreakD.docx") +{ + // The problem was that the column break was moving outside of the columns, making a page break. + CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, getProperty<style::BreakType>(getParagraph(2), "BreakType")); + CPPUNIT_ASSERT_EQUAL( 1, getPages() ); +} + DECLARE_OOXMLIMPORT_TEST(testTdf103975_notPageBreakE, "tdf103975_notPageBreakE.docx") { // The problem was that the column break was getting lost. diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index aa279d6d4ac1..439ecf2abb14 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3252,8 +3252,10 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) m_pImpl->m_bIgnoreNextPara = false; return; } + + const bool bSingleParagraph = m_pImpl->GetIsFirstParagraphInSection() && m_pImpl->GetIsLastParagraphInSection(); PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH); - if (pContext && m_pImpl->GetSettingsTable()->GetSplitPgBreakAndParaMark()) + if (pContext && (m_pImpl->GetSettingsTable()->GetSplitPgBreakAndParaMark() || bSingleParagraph)) { if (m_pImpl->isBreakDeferred(PAGE_BREAK)) pContext->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_PAGE_BEFORE)); @@ -3271,7 +3273,6 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) m_pImpl->clearDeferredBreaks(); } - bool bSingleParagraph = m_pImpl->GetIsFirstParagraphInSection() && m_pImpl->GetIsLastParagraphInSection(); // If the paragraph contains only the section properties and it has // no runs, we should not create a paragraph for it in Writer, unless that would remove the whole section. bool bRemove = !m_pImpl->GetParaChanged() && m_pImpl->GetParaSectpr() |