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

Michael Stahl mstahl at redhat.com
Tue Feb 2 12:06:54 UTC 2016


 sw/qa/extras/ooxmlimport/data/section_break_numbering.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx                   |   12 ++++++++++++
 writerfilter/source/dmapper/DomainMapper.cxx               |   13 +++++++++++--
 3 files changed, 23 insertions(+), 2 deletions(-)

New commits:
commit 71a8cac070a2c33bf6b66766d84b08c258a6aaf9
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Feb 1 11:07:30 2016 +0100

    writerfilter: tdf#97417: don't insert numbering on end-of-section
    
    ... paragraph, it will be copied to every following paragraph.
    
    (Before commit 2b78f2cd7b9e4bab0f3b3b9119238f36a1bbc7b2 the properties
    of the end-of-section paragraph would be overwritten by the properties
    inside the header)
    
    Change-Id: Ibe095cf873a09ef9e12f898d09b5fd6f61c914c9
    (cherry picked from commit 57def64bec0853de7d6f4243e31e8e9650491914)
    Reviewed-on: https://gerrit.libreoffice.org/22000
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/extras/ooxmlimport/data/section_break_numbering.docx b/sw/qa/extras/ooxmlimport/data/section_break_numbering.docx
new file mode 100644
index 0000000..8b5378a
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/section_break_numbering.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 5c18000..0a4e593 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2967,6 +2967,18 @@ DECLARE_OOXMLIMPORT_TEST(testTdf60351, "tdf60351.docx")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0),   aPolygon[5].Y);
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf97417, "section_break_numbering.docx")
+{
+    // paragraph with numbering and section break was removed by writerfilter
+    // but its numbering was copied to all following paragraphs
+    CPPUNIT_ASSERT_MESSAGE("first paragraph missing numbering",
+        getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(1), "NumberingRules").is());
+    uno::Reference<beans::XPropertySet> const xProps(getParagraph(2), uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_MESSAGE("second paragraph erroneous numbering",
+        !xProps->getPropertyValue("NumberingRules").hasValue());
+
+}
+
 DECLARE_OOXMLIMPORT_TEST(testTdf95970, "tdf95970.docx")
 {
     // First shape: the rotation should be -12.94 deg, it should be mirrored.
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index bd5f65e..bcf0a44 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3159,10 +3159,19 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
             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() && !bSingleParagraph;
+            bool bRemove = !m_pImpl->GetParaChanged() && m_pImpl->GetParaSectpr() && !bSingleParagraph && !m_pImpl->GetIsDummyParaAddedForTableInSection();
+            if (bRemove)
+            {
+                // tdf#97417 delete numbering of the paragraph
+                // it will be deleted anyway, and the numbering would be copied
+                // to the next paragraph in sw SplitNode and then be applied to
+                // every following paragraph
+                m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH)->Erase(PROP_NUMBERING_RULES);
+                m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH)->Erase(PROP_NUMBERING_LEVEL);
+            }
             m_pImpl->SetParaSectpr(false);
             m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH));
-            if (bRemove && !m_pImpl->GetIsDummyParaAddedForTableInSection())
+            if (bRemove)
                 m_pImpl->RemoveLastParagraph();
         }
         else


More information about the Libreoffice-commits mailing list