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

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 28 04:49:01 UTC 2021


 sw/qa/extras/ww8export/ww8export3.cxx |    4 ++--
 sw/source/filter/ww8/ww8par3.cxx      |    7 +++++++
 2 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 5f9fb51ba84619c60f304afda76a013a8f3dc14c
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Sat Jun 26 07:52:14 2021 +0200
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Mon Jun 28 06:48:30 2021 +0200

    tdf#104239 doc import: listLevel 9 is body text
    
    MS Word formats only have 9 list levels (0-8),
    and listLevel 9 is used to indicate body-level
    as a way to cancel the inheritance of a listLevel.
    
    LibreOffice however has 10 levels (0-9), so it was treating
    this as 10th level numbering. Nope - it needs to be
    no numbering at all.
    
    Change-Id: I3fd58ba518ba8bc7d15a08cf896fbeed8e6a38c2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117921
    Tested-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 1ca05650da55..abbf414dc01d 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -842,9 +842,9 @@ DECLARE_WW8EXPORT_TEST(testTdf104239_chapterNumberTortureTest, "tdf104239_chapte
     if (!mbExported)
         CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString"));
     xPara.set(getParagraph(11, "direct formatting - Body listLvl(9)."), uno::UNO_QUERY);
-    //CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString"));
+    CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString"));
     xPara.set(getParagraph(12, "direct numId, inherit listLvl."), uno::UNO_QUERY);
-    //CPPUNIT_ASSERT_EQUAL(OUString("2nd.ii.a.1.I"), getProperty<OUString>(xPara, "ListLabelString"));
+    CPPUNIT_ASSERT_EQUAL(OUString("2nd.ii.a.1.I"), getProperty<OUString>(xPara, "ListLabelString"));
     CPPUNIT_ASSERT_EQUAL(sal_Int16(4), getProperty<sal_Int16>(xPara, "NumberingLevel")); // Level 5
     xPara.set(getParagraph(13, "Style numId0 cancels inherited numbering."), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString"));
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index a7a246d4952f..7c33ea08829a 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -1808,6 +1808,13 @@ void SwWW8ImplReader::RegisterNumFormatOnTextNode(sal_uInt16 nCurrentLFO,
     if (!pTextNd)
         return;
 
+    // WW8ListManager::nMaxLevel indicates body text, cancelling an inherited numbering.
+    if (nCurrentLFO < USHRT_MAX && nCurrentLevel == WW8ListManager::nMaxLevel)
+    {
+        pTextNd->SetAttr(SwNumRuleItem(OUString()));
+        return;
+    }
+
     // Undefined listLevel is treated as the first level with valid numbering rule.
     // TODO:This doesn't allow for inheriting from a style(HOW?), but it matches previous behaviour.
     if (nCurrentLFO < USHRT_MAX && nCurrentLevel == MAXLEVEL)


More information about the Libreoffice-commits mailing list