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

Vasily Melenchuk (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 13 11:26:48 UTC 2020


 sw/qa/extras/ww8export/data/tdf134570.doc |binary
 sw/qa/extras/ww8export/ww8export3.cxx     |   10 ++++++++++
 sw/source/filter/ww8/ww8par3.cxx          |   21 ++++++++++++++-------
 3 files changed, 24 insertions(+), 7 deletions(-)

New commits:
commit da5782a8348816adafe7894126cbe20295dd5d8e
Author:     Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Fri Jul 10 14:07:38 2020 +0300
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Jul 13 13:26:16 2020 +0200

    tdf#134570: doc import: list level format string fixed
    
    List level placeholder is defined from char at defined
    position, not only from position array.
    
    Change-Id: I008e6711312435571f0d04544f6bfa42c1309f31
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98500
    Tested-by: Jenkins
    Reviewed-by: Vasily Melenchuk <vasily.melenchuk at cib.de>
    (cherry picked from commit b88b681743b1278b4fa44bef4d5bce3e2cb49316)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98634
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/qa/extras/ww8export/data/tdf134570.doc b/sw/qa/extras/ww8export/data/tdf134570.doc
new file mode 100644
index 000000000000..17f7842d703f
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf134570.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index f998ffe1d85a..49a887781859 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -591,6 +591,16 @@ DECLARE_WW8EXPORT_TEST(testTdf120394, "tdf120394.doc")
     }
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf134570, "tdf134570.doc")
+{
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+    {
+        uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY);
+        CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(1), getProperty<sal_Int16>(xPara, "NumberingLevel"));
+        CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty<OUString>(xPara, "ListLabelString"));
+    }
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 02c02ecc459d..395a1bf2e9db 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -890,18 +890,25 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, std::unique_ptr<SfxItemSet
         if (sListFormat.getLength())
         {
             sal_uInt32 nExtraOffset = 0;
-            for (sal_uInt8 nLevelB = 0; nLevelB < nMaxLevel; ++nLevelB)
+            sal_uInt8 nLevelB = 0;
+            while (aLVL.aOfsNumsXCH[nLevelB] && nLevelB < nMaxLevel)
             {
-                OUString sReplacement("%" + OUString::number(nLevelB + 1));
-                if (aLVL.aOfsNumsXCH[nLevelB])
+                // Replacement symbol is read from source string from position taken from aOfsNumsXCH array
+                sal_uInt8 nOffset = aLVL.aOfsNumsXCH[nLevelB] + nExtraOffset - 1;
+                if (nOffset >= sListFormat.getLength())
                 {
-                    if (aLVL.aOfsNumsXCH[nLevelB] <= sNumString.getLength())
-                        sListFormat = sListFormat.replaceAt(aLVL.aOfsNumsXCH[nLevelB] + nExtraOffset - 1, 1, sReplacement);
-                    else
-                        SAL_WARN("sw.ww8", "List level reference is beyond the border. Ignored.");
+                    SAL_WARN("sw.ww8", "List level reference is beyond the border. Ignored.");
+                    nLevelB++;
+                    continue;
                 }
+                sal_uInt8 nReplacement = sListFormat[nOffset] + 1;
+
+                OUString sReplacement("%" + OUString::number(nReplacement));
+                sListFormat = sListFormat.replaceAt(nOffset, 1, sReplacement);
+
                 // We need also update an offset, since we are replacing one symbol by at least two
                 nExtraOffset += sReplacement.getLength() - 1;
+                nLevelB++;
             }
         }
 


More information about the Libreoffice-commits mailing list