[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa xmloff/source

Vasily Melenchuk (via logerrit) logerrit at kemper.freedesktop.org
Fri May 28 09:56:23 UTC 2021


 sw/qa/extras/odfexport/data/tdf137199.docx |binary
 sw/qa/extras/odfexport/odfexport.cxx       |   11 +++++++++++
 xmloff/source/style/xmlnume.cxx            |   19 ++++++++++++++++++-
 3 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 0e726bb7ec31f0300ac0e56528bb70b0780444cd
Author:     Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Fri May 28 09:10:35 2021 +0300
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri May 28 11:55:50 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>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116316

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/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 54dbddf20825..3099ba0cf42b 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -131,6 +131,17 @@ DECLARE_ODFEXPORT_TEST(testMathObjectFlatExport, "2_MathType3.docx")
     CPPUNIT_ASSERT_EQUAL(OUString(" size 12{2+2=4} {}"), formula2);
 }
 
+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"));
+}
+
 static void testTdf43569_CheckIfFieldParse()
 {
     {
diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx
index 2aac21253218..8c5ac4dc52c9 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