From a4485bd8e03ad4487fe47a4480a9aacfbaf61980 Mon Sep 17 00:00:00 2001 From: Vasily Melenchuk Date: Thu, 11 Nov 2021 10:33:08 +0300 Subject: [PATCH] tdf#145610: lists should not have includeUpperLevels < 1 Unlike its name, this variable stores *total* amount of levels to includes, so during conversion even empty list format to prefix/suffix/includeupperlevels we should keep last one above zero so list even in future will not have issues with levels to display. Change-Id: I4992c1ac0194f381df9f7b965ecdb2d688892b30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125022 Tested-by: Jenkins Reviewed-by: Vasily Melenchuk --- editeng/source/items/numitem.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index ca454d92f894..b862b866c50f 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -640,6 +640,13 @@ void SvxNumberFormat::SetListFormat(std::optional oSet) nPercents++; } nInclUpperLevels = nPercents/2; + if (nInclUpperLevels < 1) + { + // There should be always at least one level. This will be not required + // in future (when we get rid of prefix/suffix), but nowadays there + // are too many conversions "list format" <-> "prefix/suffix/inclUpperLevel" + nInclUpperLevels = 1; + } } OUString SvxNumberFormat::GetListFormat(bool bIncludePrefixSuffix /*= true*/) const