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

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 24 17:22:14 UTC 2021


 sw/qa/extras/ww8export/data/tdf104239_sharedOutlineNumId.doc |binary
 sw/qa/extras/ww8export/ww8export3.cxx                        |    8 ++++++++
 sw/source/filter/ww8/ww8par.cxx                              |    3 ++-
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 8bfa14e831f31f372b98d7283fa4abc73bcb5532
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Wed Jun 23 09:21:32 2021 +0200
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Thu Jun 24 19:21:24 2021 +0200

    tdf#104239 doc import: accept outlineLvl0 == (listLvl = MAXLEVEL)
    
    If listLvl is undefined, it is treated as level 0,
    so when testing that outlineLvl is equal to listLvl,
    then consider MAXLEVEL to be equivalent to zero.
    
    The opposite is not true. An undefined outlineLvl
    is not considered to be level 0.
    
    This doesn't fix bug 104239, but it is one step
    in the right direction.
    
    Two unit tests followed this path,
    (transparent-text.doc and tdf80635_pageLeft.doc)
    but neither one sets a numbering style,
    so they don't make good unit tests.
    
    Change-Id: I62cd7f5500fcd6dc06327900c33f12c129610a04
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117745
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ww8export/data/tdf104239_sharedOutlineNumId.doc b/sw/qa/extras/ww8export/data/tdf104239_sharedOutlineNumId.doc
new file mode 100644
index 000000000000..c5deb4857f9c
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf104239_sharedOutlineNumId.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 2ecde65c6bfb..77c090f1f22d 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -813,6 +813,14 @@ DECLARE_WW8EXPORT_TEST(testTdf106541_inheritOutlineNumbering, "tdf106541_inherit
     CPPUNIT_ASSERT_EQUAL(OUString("1.1"), getProperty<OUString>(xPara, "ListLabelString"));
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf104239_sharedOutlineNumId, "tdf104239_sharedOutlineNumId.doc")
+{
+    // The list should show both level 1 and level 2 digits.  It really ought to be "2.1."
+    uno::Reference<beans::XPropertySet> xPara(getParagraph(5, "Principes"), uno::UNO_QUERY);
+    // This was ".1." previously.
+    CPPUNIT_ASSERT(3 < getProperty<OUString>(xPara, "ListLabelString").getLength());
+}
+
 DECLARE_WW8EXPORT_TEST(testTdf120394, "tdf120394.doc")
 {
     CPPUNIT_ASSERT_EQUAL(1, getPages());
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 9721a3f8cf4d..d4c2ddc62cd6 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -6004,9 +6004,10 @@ void SwWW8ImplReader::SetOutlineStyles()
             continue;
         }
 
+        const sal_uInt8 nLvl = pStyleInf->m_nListLevel == MAXLEVEL ? 0 : pStyleInf->m_nListLevel;
         if (m_pChosenWW8OutlineStyle != nullptr
             && pStyleInf->mnWW8OutlineLevel < WW8ListManager::nMaxLevel
-            && pStyleInf->mnWW8OutlineLevel == pStyleInf->m_nListLevel)
+            && pStyleInf->mnWW8OutlineLevel == nLvl)
         {
             // LibreOffice's Chapter Numbering only works when outlineLevel == listLevel
             const SwNumFormat& rRule


More information about the Libreoffice-commits mailing list