[Libreoffice-commits] core.git: sw/qa xmloff/source
Vasily Melenchuk (via logerrit)
logerrit at kemper.freedesktop.org
Fri May 28 07:40:17 UTC 2021
sw/qa/extras/odfexport/data/tdf137199.docx |binary
sw/qa/extras/odfexport/odfexport2.cxx | 11 +++++++++++
xmloff/source/style/xmlnume.cxx | 19 ++++++++++++++++++-
3 files changed, 29 insertions(+), 1 deletion(-)
New commits:
commit 726d0a2d54da3e97de242c2c10be3afd2aedf943
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Fri May 28 09:10:35 2021 +0300
Commit: Thorsten Behrens <thorsten.behrens at allotropia.de>
CommitDate: Fri May 28 09:39:34 2021 +0200
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 at allotropia.de>
diff --git a/sw/qa/extras/odfexport/data/tdf137199.docx b/sw/qa/extras/odfexport/data/tdf137199.docx
new file mode 100644
index 000000000000..25b52977beca
Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf137199.docx differ
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx
index 21455b9d343d..b58e9e9a1d1a 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -39,6 +39,17 @@ DECLARE_ODFEXPORT_TEST(testTdf52065_centerTabs, "testTdf52065_centerTabs.odt")
CPPUNIT_ASSERT_EQUAL(OUString(u"Pečiatka zamestnávateľa"), parseDump("//body/txt[4]/Text[4]", "Portion"));
}
+DECLARE_ODFEXPORT_TEST(testTdf137199, "tdf137199.docx")
+{
+ CPPUNIT_ASSERT_EQUAL(OUString(">1<"), getProperty<OUString>(getParagraph(1), "ListLabelString"));
+
+ CPPUNIT_ASSERT_EQUAL(OUString("1)"), getProperty<OUString>(getParagraph(2), "ListLabelString"));
+
+ CPPUNIT_ASSERT_EQUAL(OUString("HELLO1WORLD!"), getProperty<OUString>(getParagraph(3), "ListLabelString"));
+
+ CPPUNIT_ASSERT_EQUAL(OUString("HELLO2WORLD!"), getProperty<OUString>(getParagraph(4), "ListLabelString"));
+}
+
// This test started in LO 7.2. Use the odfexport.cxx if you intend to backport to 7.1.
CPPUNIT_PLUGIN_IMPLEMENT();
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;
More information about the Libreoffice-commits
mailing list