diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx index 78ebaf75e1bc..9ac9ac93dbc4 100644 --- a/xmloff/qa/unit/text.cxx +++ b/xmloff/qa/unit/text.cxx @@ -191,7 +191,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testParaStyleListLevel) uno::Reference xStyle(xStyleFamily->getByName("mystyle"), uno::UNO_QUERY); sal_Int16 nNumberingLevel{}; CPPUNIT_ASSERT(xStyle->getPropertyValue("NumberingLevel") >>= nNumberingLevel); - CPPUNIT_ASSERT_EQUAL(static_cast(2), nNumberingLevel); + CPPUNIT_ASSERT_EQUAL(static_cast(1), nNumberingLevel); // Test the export as well: diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx index 1a3a81f10c95..10ae6a22dcfa 100644 --- a/xmloff/source/style/styleexp.cxx +++ b/xmloff/source/style/styleexp.cxx @@ -147,7 +147,8 @@ void ExportStyleListlevel(const uno::Reference& xPropSe return; } - rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_LIST_LEVEL, OUString::number(nNumberingLevel)); + // The spec is positiveInteger (1-based), but the implementation is 0-based. + rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_LIST_LEVEL, OUString::number(++nNumberingLevel)); } } diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx index bcd55b140868..85db00df1901 100644 --- a/xmloff/source/text/txtstyli.cxx +++ b/xmloff/source/text/txtstyli.cxx @@ -118,9 +118,10 @@ void XMLTextStyleContext::SetAttribute( sal_Int32 nElement, case XML_ELEMENT(STYLE, XML_LIST_LEVEL): { sal_Int32 nTmp; - if (sax::Converter::convertNumber(nTmp, rValue) && nTmp >= 0 && nTmp <= 10) + // The spec is positiveInteger (1-based), but the implementation is 0-based. + if (sax::Converter::convertNumber(nTmp, rValue) && nTmp > 0 && nTmp <= 10) { - m_aListLevel.emplace(nTmp); + m_aListLevel.emplace(--nTmp); } break; }