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

Miklos Vajna vmiklos at collabora.co.uk
Tue Dec 19 22:44:03 UTC 2017


 sw/qa/extras/ooxmlexport/data/tdf113547.docx     |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx       |   11 +++++++++++
 writerfilter/source/dmapper/NumberingManager.cxx |   10 ++++++++--
 writerfilter/source/dmapper/NumberingManager.hxx |    3 +++
 4 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit feb043331207ae66e1ac6cce613ff052f96d4f02
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Dec 18 22:29:04 2017 +0100

    tdf#113547 DOCX import: fix handling of stub numbering overrides
    
    Regression from commit c72a1a74b5b1064fc9cdf9994b11fce26d866e26
    (Related: tdf#112211 DOCX import: fix handling of missing first ind in
    <w:lvl>, 2017-09-19), now that a numbering level can have default
    properties, we need to differentiate between the case when the level has
    real properties or it has only default properties.
    
    Merging of properties is not necessary when the abstract numbering has
    properties, but the "override" has default properties only.
    
    (cherry picked from commit a0bf35f7c0eedbe04783285a4a7071e68baeb7fe)
    
    Change-Id: Idbcbd0f66932514612e11fe82377f2b68ac9e403
    Reviewed-on: https://gerrit.libreoffice.org/46777
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf113547.docx b/sw/qa/extras/ooxmlexport/data/tdf113547.docx
new file mode 100644
index 000000000000..7b35ad72ba44
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf113547.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 6aca7e81b2cd..e2af3250cb07 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -109,6 +109,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf113183, "tdf113183.docx")
                                                 "HoriOrientPosition"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf113547, "tdf113547.docx")
+{
+    uno::Reference<beans::XPropertySet> xPropertySet(
+        getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xLevels(
+        xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
+    comphelper::SequenceAsHashMap aProps(xLevels->getByIndex(0)); // 1st level
+    // This was 0, first-line left margin of the numbering was lost.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-635), aProps["FirstLineIndent"].get<sal_Int32>());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 8754b489a9ec..809717e62659 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -119,6 +119,12 @@ void ListLevel::SetValue( Id nId, sal_Int32 nValue )
         default:
             OSL_FAIL( "this line should never be reached");
     }
+    m_bHasValues = true;
+}
+
+bool ListLevel::HasValues() const
+{
+    return m_bHasValues;
 }
 
 void ListLevel::SetParaStyle( const std::shared_ptr< StyleSheetEntry >& pStyle )
@@ -467,9 +473,9 @@ uno::Sequence< uno::Sequence< beans::PropertyValue > > ListDef::GetPropertyValue
     for ( sal_Int32 i = 0; i < nThisCount && i < nAbstractCount; i++ )
     {
         uno::Sequence< beans::PropertyValue > level = aThis[i];
-        if ( level.hasElements() )
+        if (level.hasElements() && GetLevel(i)->HasValues())
         {
-            // If the element contains something, merge it
+            // If the element contains something, merge it, but ignore stub overrides.
             lcl_mergeProperties( level, aAbstract[i] );
         }
     }
diff --git a/writerfilter/source/dmapper/NumberingManager.hxx b/writerfilter/source/dmapper/NumberingManager.hxx
index 026164122e85..eabf4a0276c6 100644
--- a/writerfilter/source/dmapper/NumberingManager.hxx
+++ b/writerfilter/source/dmapper/NumberingManager.hxx
@@ -52,6 +52,7 @@ class ListLevel : public PropertyMap
     sal_Int32                                     m_nTabstop;
     std::shared_ptr< StyleSheetEntry >          m_pParaStyle;
     bool                                          m_outline;
+    bool m_bHasValues = false;
 
 public:
 
@@ -80,6 +81,8 @@ public:
     const OUString& GetBulletChar( ) { return m_sBulletChar; };
     const std::shared_ptr< StyleSheetEntry >& GetParaStyle( ) { return m_pParaStyle; };
     bool isOutlineNumbering() const { return m_outline; }
+    /// Determines if SetValue() was called at least once.
+    bool HasValues() const;
 
     // UNO mapping functions
 


More information about the Libreoffice-commits mailing list