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-31 14:45:36 +0200
commit911383c83fcdea23f19895e6857a86521c23f448 (patch)
tree60a19c43ca97efb0344646813f81b67133d1795a /xmloff
parenta3f2312a68f48e3ad07c643b8eba0f10bd2e81fc (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> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116316 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116363 Tested-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 0f5a45dc40da..b549f447eb0c 100644
--- a/xmloff/source/style/xmlnume.cxx
+++ b/xmloff/source/style/xmlnume.cxx
@@ -119,7 +119,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;