summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2021-05-28 09:10:35 +0300
committerThorsten Behrens <thorsten.behrens@allotropia.de>2021-05-28 09:39:34 +0200
commit726d0a2d54da3e97de242c2c10be3afd2aedf943 (patch)
treee23e5a625fa0337c80c990b969f3625654d662f0 /xmloff
parent9864fbc9d5f532d9aa4742968886b3f94bc44dbc (diff)
tdf#137199: sw: convert list format string to prefix/suffix for ODF
Since internally LO is able right now to use list level format strings and prefixes/suffixes only for backward compatibility, there is a need for conversion from format string (like "%1.") to prefix ("") and suffix (".") still used by ODT. Change-Id: If4b459e1b25b7f0ce511e6ac2de0824bb2c43d05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116288 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/style/xmlnume.cxx19
1 files changed, 18 insertions, 1 deletions
diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx
index 027bef033031..132e3f701a2e 100644
--- a/xmloff/source/style/xmlnume.cxx
+++ b/xmloff/source/style/xmlnume.cxx
@@ -121,7 +121,24 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel,
{
rProp.Value >>= sSuffix;
}
- else if( rProp.Name == "BulletChar" )
+ else if (rProp.Name == "ListFormat")
+ {
+ OUString sListFormat;
+ rProp.Value >>= sListFormat;
+
+ // Since we have no support for entire format string it should be converted
+ // to prefix and suffix. Of course, it is not so flexible as format string,
+ // but it is the only option
+ sal_Int32 nFirstReplacement = sListFormat.indexOf('%');
+ sal_Int32 nLastReplacement = sListFormat.lastIndexOf('%') + 1;
+ if (nFirstReplacement > 0)
+ // Everything before first '%' will be prefix
+ sPrefix = sListFormat.copy(0, nFirstReplacement);
+ if (nLastReplacement >= 0 && nLastReplacement < sListFormat.getLength() -1 )
+ // Everything beyond last '%' (+1 for follow up id) is a suffix
+ sSuffix = sListFormat.copy(nLastReplacement + 1);
+ }
+ else if (rProp.Name == "BulletChar")
{
OUString sValue;
rProp.Value >>= sValue;