editeng/source/items/numitem.cxx |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit 6b4b57286644174351e5d77e8a6ef46e37d5f832
Author:     Vasily Melenchuk <vasily.melenc...@cib.de>
AuthorDate: Thu Nov 11 10:33:08 2021 +0300
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Mon Nov 15 18:24:08 2021 +0100

    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 <vasily.melenc...@cib.de>
    (cherry picked from commit a4485bd8e03ad4487fe47a4480a9aacfbaf61980)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125135
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 5d493df6d878..b875138c9c3b 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -637,6 +637,13 @@ void 
SvxNumberFormat::SetListFormat(std::optional<OUString> 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

Reply via email to