summaryrefslogtreecommitdiffstats
path: root/editeng/source
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2021-09-27 13:40:41 +0300
committerVasily Melenchuk <vasily.melenchuk@cib.de>2021-10-04 15:29:45 +0200
commite6bf21d2d5efb231c877eb985997b28033198600 (patch)
treea5d9391cc4f31535f4e36e860ea0f3d5df626fec /editeng/source
parenttdf#144609: numbering "None" should still show prefix/suffix (diff)
downloadcore-e6bf21d2d5efb231c877eb985997b28033198600.tar.gz
core-e6bf21d2d5efb231c877eb985997b28033198600.zip
tdf#144578: numbering: generate include upper levels for UI
In spite of used list format in ODF for UI we still need to show prefix/suffix (already was there) and included upper levels (done in this patch) for correct visualization of level properties. Moved initialization of ListLevel to later steps to avoid overriding of generated values for prefix, suffix and IncludeUpperLevel by some invalid values. Change-Id: I5d132426c06021ed526d16fb09276523105aa7b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122686 Tested-by: Jenkins Reviewed-by: Vasily Melenchuk <vasily.melenchuk@cib.de>
Diffstat (limited to 'editeng/source')
-rw-r--r--editeng/source/items/numitem.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 7348eb16df4d..ca454d92f894 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -621,7 +621,9 @@ void SvxNumberFormat::SetListFormat(std::optional<OUString> oSet)
sListFormat = oSet;
- // For backward compatibility and UI we should create prefix/suffix also
+ // For backward compatibility and UI we should create something looking like
+ // a prefix, suffix and included levels also. This is not possible in general case
+ // since level format string is much more flexible. But for most cases is okay
sal_Int32 nFirstReplacement = sListFormat->indexOf('%');
sal_Int32 nLastReplacement = sListFormat->lastIndexOf('%') + 1;
if (nFirstReplacement > 0)
@@ -630,6 +632,14 @@ void SvxNumberFormat::SetListFormat(std::optional<OUString> oSet)
if (nLastReplacement >= 0 && nLastReplacement < sListFormat->getLength())
// Everything beyond last '%' is a suffix
sSuffix = sListFormat->copy(nLastReplacement);
+
+ sal_uInt8 nPercents = 0;
+ for (sal_Int32 i = 0; i < sListFormat->getLength(); i++)
+ {
+ if ((*sListFormat)[i] == '%')
+ nPercents++;
+ }
+ nInclUpperLevels = nPercents/2;
}
OUString SvxNumberFormat::GetListFormat(bool bIncludePrefixSuffix /*= true*/) const