[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

Justin Luth justin_luth at sil.org
Sat Dec 3 04:06:18 UTC 2016


 sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakD.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx                   |    7 +++++++
 writerfilter/source/dmapper/DomainMapper.cxx               |    5 +++--
 3 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 5e74df1c3a09bd00caa4f9b8d3d0cd5539d1acff
Author: Justin Luth <justin_luth at sil.org>
Date:   Tue Nov 29 08:15:40 2016 +0300

    tdf#103975 docx import: don't lose column break #2
    
    Change-Id: I871e10d675d9009c163dd2b0fc74d29206934e34
    Reviewed-on: https://gerrit.libreoffice.org/31342
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    (cherry picked from commit 4307a850a310c0371bee1f79a8eb41fa8ff7fed2)
    Reviewed-on: https://gerrit.libreoffice.org/31396

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 0000000..37c7524
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakD.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 78845fd..4fd658d 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 aa279d6..439ecf2 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()


More information about the Libreoffice-commits mailing list