tdf#103975 docx import: don't remove sectPr with BreakItem

If an empty sectPr paragraph contains Page/Column break
information, do not discard it.

Change-Id: If817debccb924eb9cf0ffdc374c960d25908370f
Reviewed-on: https://gerrit.libreoffice.org/31227
Reviewed-by: Justin Luth <justin_luth@sil.org>
Tested-by: Justin Luth <justin_luth@sil.org>
(cherry picked from commit 7b250d56981f78e77454a2a3fd670731b2358e75)
Reviewed-on: https://gerrit.libreoffice.org/31233
Tested-by: Jenkins <ci@libreoffice.org>
diff --git a/sw/qa/extras/ooxmlimport/data/rhbz988516.docx b/sw/qa/extras/ooxmlexport/data/rhbz988516.docx
similarity index 100%
rename from sw/qa/extras/ooxmlimport/data/rhbz988516.docx
rename to sw/qa/extras/ooxmlexport/data/rhbz988516.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 2182cbc1..8d117e6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -61,6 +61,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf41542_borderlessPadding, "tdf41542_borderlessPad
    CPPUNIT_ASSERT_EQUAL( 3, getPages() );
}

DECLARE_OOXMLEXPORT_TEST(testRhbz988516, "rhbz988516.docx")
{
    // The problem was that the list properties of the footer leaked into body
    CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getParagraph(1), "NumberingStyleName"));
    CPPUNIT_ASSERT_EQUAL(OUString("Enclosure 3"), getParagraph(3)->getString());
    CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getParagraph(2), "NumberingStyleName"));
    CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getParagraph(3), "NumberingStyleName"));
    CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getParagraph(4), "NumberingStyleName"));

    // tdf#103975 The problem was that an empty paragraph with page break info was removed.
    CPPUNIT_ASSERT_EQUAL( 3, getPages() );
}

DECLARE_OOXMLEXPORT_TEST(testTdf103389, "tdf103389.docx")
{
    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 1e9a5e6..05a4904 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -175,18 +175,6 @@ DECLARE_OOXMLIMPORT_TEST(testN751017, "n751017.docx")
    CPPUNIT_ASSERT(bFoundGet);
}

DECLARE_OOXMLIMPORT_TEST(testRhbz988516, "rhbz988516.docx")
{
    // The problem was that the list properties of the footer leaked into body
    CPPUNIT_ASSERT_EQUAL(OUString(),
            getProperty<OUString>(getParagraph(1), "NumberingStyleName"));
    CPPUNIT_ASSERT_EQUAL(OUString("Enclosure 3"), getParagraph(2)->getString());
    CPPUNIT_ASSERT_EQUAL(OUString(),
            getProperty<OUString>(getParagraph(2), "NumberingStyleName"));
    CPPUNIT_ASSERT_EQUAL(OUString(),
            getProperty<OUString>(getParagraph(3), "NumberingStyleName"));
}

DECLARE_OOXMLIMPORT_TEST(testN751077, "n751077.docx")
{
/*
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 18c991b..26168b8 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3267,6 +3267,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
            // 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()
                           && !bSingleParagraph
                           && !( pContext && pContext->isSet(PROP_BREAK_TYPE) )
                           && !m_pImpl->GetIsDummyParaAddedForTableInSection()
                           && !m_pImpl->GetIsLastParagraphFramed();
            PropertyMapPtr xContext = bRemove ? m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) : PropertyMapPtr();