[Libreoffice-commits] core.git: sw/qa writerfilter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Aug 16 11:02:47 UTC 2018


 sw/qa/extras/ooxmlexport/data/tdf113608_runAwayNumbering.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx                    |    7 +++++++
 writerfilter/source/dmapper/DomainMapper.cxx                  |    2 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx             |    4 ++--
 writerfilter/source/dmapper/DomainMapper_Impl.hxx             |    2 +-
 5 files changed, 11 insertions(+), 4 deletions(-)

New commits:
commit 4b432a8c77ae4b5e8305ca69953bc202e7614664
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Wed Aug 15 17:00:28 2018 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Thu Aug 16 13:02:23 2018 +0200

    tdf#113608 DOCX import: don't use numbering of removed paragraphs
    
    to avoid direct numbering of the unnumbered paragraphs later
    using numbering of the removed w:r-less paragraph incorrectly.
    
    Test file and clean up by Justin Luth.
    
    Change-Id: I821eed11f96e56e945aa88da03cc84e29322195a
    Reviewed-on: https://gerrit.libreoffice.org/59117
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf113608_runAwayNumbering.docx b/sw/qa/extras/ooxmlexport/data/tdf113608_runAwayNumbering.docx
new file mode 100644
index 000000000000..f31cc8015095
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf113608_runAwayNumbering.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 121c2d798ecb..aba24b3f2d57 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -572,6 +572,13 @@ DECLARE_OOXMLIMPORT_TEST(testTdf104797, "tdf104797.docx")
     CPPUNIT_ASSERT_EQUAL(false,getProperty<bool>(getRun(getParagraph(2), 5), "IsStart"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf113608_runAwayNumbering, "tdf113608_runAwayNumbering.docx")
+{
+    // check that an incorrect numbering style is not applied
+    // after removing a w:r-less paragraph
+    CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getParagraph(2), "NumberingStyleName"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 7df19fb9790f..cfd44ab53dd9 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3360,7 +3360,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
                 xContext->Erase(PROP_NUMBERING_LEVEL);
             }
             m_pImpl->SetParaSectpr(false);
-            m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH));
+            m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH), bRemove);
             if (bRemove)
                 m_pImpl->RemoveLastParagraph();
         }
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 48b43aa52849..5e58dd60f178 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1160,7 +1160,7 @@ static sal_Int32 lcl_getListId(const StyleSheetEntryPtr& rEntry, const StyleShee
     return lcl_getListId(pParent, rStyleTable);
 }
 
-void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap )
+void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, const bool bRemove )
 {
     if (m_bDiscardHeaderFooter)
         return;
@@ -1183,7 +1183,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap )
     const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast<const StyleSheetPropertyMap*>(pEntry ? pEntry->pProperties.get() : nullptr);
     //apply numbering to paragraph if it was set at the style, but only if the paragraph itself
     //does not specify the numbering
-    if ( pStyleSheetProperties && pParaContext && !pParaContext->isSet(PROP_NUMBERING_RULES) )
+    if ( !bRemove && pStyleSheetProperties && pParaContext && !pParaContext->isSet(PROP_NUMBERING_RULES) )
     {
 
         sal_Int32 nListId = pEntry ? lcl_getListId(pEntry, GetStyleSheetTable()) : -1;
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 6b6755c6fbfd..72a9b56da66e 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -626,7 +626,7 @@ public:
     void setParaSdtEndDeferred(bool bParaSdtEndDeferred);
     bool isParaSdtEndDeferred();
 
-    void finishParagraph( const PropertyMapPtr& pPropertyMap );
+    void finishParagraph( const PropertyMapPtr& pPropertyMap, const bool bRemove = false);
     void appendTextPortion( const OUString& rString, const PropertyMapPtr& pPropertyMap );
     void appendTextContent(const css::uno::Reference<css::text::XTextContent>&, const css::uno::Sequence<css::beans::PropertyValue>&);
     void appendOLE( const OUString& rStreamName, const std::shared_ptr<OLEHandler>& pOleHandler );


More information about the Libreoffice-commits mailing list