tdf#62032 xmloff: list-level is positiveInteger, impl is 0-based
Thanks for catching this Regina. Change-Id: Iaf6a0c9161378934818e392126a4437e55f5ddf8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126743 Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
This commit is contained in:
committed by
Miklos Vajna
parent
95c003d75e
commit
aed4c2d80c
@@ -191,7 +191,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testParaStyleListLevel)
|
|||||||
uno::Reference<beans::XPropertySet> xStyle(xStyleFamily->getByName("mystyle"), uno::UNO_QUERY);
|
uno::Reference<beans::XPropertySet> xStyle(xStyleFamily->getByName("mystyle"), uno::UNO_QUERY);
|
||||||
sal_Int16 nNumberingLevel{};
|
sal_Int16 nNumberingLevel{};
|
||||||
CPPUNIT_ASSERT(xStyle->getPropertyValue("NumberingLevel") >>= nNumberingLevel);
|
CPPUNIT_ASSERT(xStyle->getPropertyValue("NumberingLevel") >>= nNumberingLevel);
|
||||||
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2), nNumberingLevel);
|
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(1), nNumberingLevel);
|
||||||
|
|
||||||
// Test the export as well:
|
// Test the export as well:
|
||||||
|
|
||||||
|
@@ -147,7 +147,8 @@ void ExportStyleListlevel(const uno::Reference<beans::XPropertySetInfo>& xPropSe
|
|||||||
return;
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -118,9 +118,10 @@ void XMLTextStyleContext::SetAttribute( sal_Int32 nElement,
|
|||||||
case XML_ELEMENT(STYLE, XML_LIST_LEVEL):
|
case XML_ELEMENT(STYLE, XML_LIST_LEVEL):
|
||||||
{
|
{
|
||||||
sal_Int32 nTmp;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user