[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/qa writerfilter/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 20 09:39:47 UTC 2020


 sw/qa/extras/ooxmlexport/data/tdf132185.docx      |binary
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx     |    9 +++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    9 ++++++++-
 3 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit cef38a8363efbd973f566f7595f0b6cfc41fdc2b
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sun Apr 19 19:54:59 2020 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Apr 20 11:39:15 2020 +0200

    tdf#132185: field command does not necessarily end with space
    
    Change-Id: I5a5e54fb42e20855b75af7ab523465a032ab46e1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92504
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    (cherry picked from commit 8c8b3a4f83f67882b284ddc3b3fe10d3fe6dedf4)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92444
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf132185.docx b/sw/qa/extras/ooxmlexport/data/tdf132185.docx
new file mode 100644
index 000000000000..955de5097945
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf132185.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index d20d8a90938f..9d89184cde74 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -736,6 +736,15 @@ DECLARE_OOXMLEXPORT_TEST(testDropDownFieldEntryLimit, "tdf126792.odt" )
         CPPUNIT_ASSERT_EQUAL(sal_Int32(25), vListEntries.getLength());
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf132185, "tdf132185.docx")
+{
+    xmlDocPtr pXmlDoc = parseExport("word/footer1.xml");
+    // Since the default (without xml:space attribute) is to ignore leading and trailing spaces,
+    // " PAGE \\* roman " will get imported as "PAGE \\* roman". This is also valid, and must be
+    // treated accordingly. "roman" was ignored before the fix, exporting only " PAGE ".
+    assertXPathContent(pXmlDoc, "/w:ftr/w:p/w:r[2]/w:instrText", " PAGE \\* roman ");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 13f1ce4ad6a2..a04af3c1c8aa 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2902,7 +2902,14 @@ static sal_Int16 lcl_ParseNumberingType( const OUString& rCommand )
     sal_Int16 nRet = style::NumberingType::PAGE_DESCRIPTOR;
 
     //  The command looks like: " PAGE \* Arabic "
-    OUString sNumber = msfilter::util::findQuotedText(rCommand, "\\* ", ' ');
+    // tdf#132185: but may as well be "PAGE \* Arabic"
+    OUString sNumber;
+    constexpr OUStringLiteral rSeparator("\\* ");
+    if (sal_Int32 nStartIndex = rCommand.indexOf(rSeparator); nStartIndex >= 0)
+    {
+        nStartIndex += rSeparator.getLength();
+        sNumber = rCommand.getToken(0, ' ', nStartIndex);
+    }
 
     if( !sNumber.isEmpty() )
     {


More information about the Libreoffice-commits mailing list