summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2016-11-29 08:15:40 +0300
committerJustin Luth <justin_luth@sil.org>2016-12-03 04:05:51 +0000
commit5e74df1c3a09bd00caa4f9b8d3d0cd5539d1acff (patch)
treef355da5c321dc1915916c4b43c9f5f3412e95b4d
parent7837860ff99577467fecb287cb0e3b111729b70a (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> (cherry picked from commit 4307a850a310c0371bee1f79a8eb41fa8ff7fed2) Reviewed-on: https://gerrit.libreoffice.org/31396
-rwxr-xr-xsw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakD.docxbin0 -> 21482 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx7
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx5
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
new file mode 100755
index 000000000000..37c752499f08
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakD.docx
Binary files differ
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()