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 b88b681743b1278b4fa44bef4d5bce3e2cb49316 Author: Vasily Melenchuk <vasily.melenc...@cib.de> AuthorDate: Fri Jul 10 14:07:38 2020 +0300 Commit: Vasily Melenchuk <vasily.melenc...@cib.de> CommitDate: Sun Jul 12 21:56:15 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.melenc...@cib.de> 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 5c1892ce5205..ed4c5526e307 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -599,6 +599,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++; } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits