From 5f9fb51ba84619c60f304afda76a013a8f3dc14c Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Sat, 26 Jun 2021 07:52:14 +0200 Subject: 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 Reviewed-by: Justin Luth --- sw/qa/extras/ww8export/ww8export3.cxx | 4 ++-- sw/source/filter/ww8/ww8par3.cxx | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'sw') 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(xPara, "ListLabelString")); xPara.set(getParagraph(11, "direct formatting - Body listLvl(9)."), uno::UNO_QUERY); - //CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara, "ListLabelString")); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara, "ListLabelString")); xPara.set(getParagraph(12, "direct numId, inherit listLvl."), uno::UNO_QUERY); - //CPPUNIT_ASSERT_EQUAL(OUString("2nd.ii.a.1.I"), getProperty(xPara, "ListLabelString")); + CPPUNIT_ASSERT_EQUAL(OUString("2nd.ii.a.1.I"), getProperty(xPara, "ListLabelString")); CPPUNIT_ASSERT_EQUAL(sal_Int16(4), getProperty(xPara, "NumberingLevel")); // Level 5 xPara.set(getParagraph(13, "Style numId0 cancels inherited numbering."), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(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) -- cgit