sw/qa/extras/ww8export/data/tdf104805.doc |binary sw/qa/extras/ww8export/ww8export2.cxx | 17 +++++++++++++++++ sw/source/filter/ww8/ww8par3.cxx | 14 +++++++++++--- 3 files changed, 28 insertions(+), 3 deletions(-)
New commits: commit 19d08bbf704332d727cfbe8e101e7d14c62326a0 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Dec 20 10:46:51 2016 +0100 tdf#104805 DOC import: fix non-0-starting LVL.xst with none-type prev level Interesting parts of the bugdoc: - it has a numbering definition with two levels - first level's type is none - second level has a numbering string: "\x01." Usually these placeholder bytes in the numbering string start from 0x00, but there it starts at 0x01, which means the layout has to replace it with the numbering from the second level. Mapping from the spec to the code: - nLevelB is an index into rgbxchNums - aOfsNumsXCH is rgbxchNums - sNumString is xst So when the rNotReallyThere added in commit 251ba90d863c2695c9f46ef922e49d72a65da9ea (INTEGRATION: CWS soberfilterteam06 (1.44.26); FILE MERGED, 2003-05-19) wants to clear out indexes from aOfsNumsXCH, it talks about numbering levels. The old code assumed that nLevelB is the same as nPosValue, which is true in many cases (when the levels are like 1, 1.1, 1.1.1), but not in this particular case, where nLevelB is 0, but nPosValue is 1. Change-Id: I590d9b2725a3330c26a04a526ce22d95970a974f Reviewed-on: https://gerrit.libreoffice.org/32220 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Jenkins <c...@libreoffice.org> diff --git a/sw/qa/extras/ww8export/data/tdf104805.doc b/sw/qa/extras/ww8export/data/tdf104805.doc new file mode 100644 index 0000000..a2dd81d Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf104805.doc differ diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index 9e12ee9..f2f5aa7 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -40,6 +40,23 @@ DECLARE_WW8EXPORT_TEST(testTdf89377, "tdf89377_tableWithBreakBeforeParaStyle.doc CPPUNIT_ASSERT_EQUAL( 2, getPages() ); } +DECLARE_WW8EXPORT_TEST(testTdf104805, "tdf104805.doc") +{ + uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WW8Num1"), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Sequence<beans::PropertyValue> aNumberingRule; + xLevels->getByIndex(1) >>= aNumberingRule; // 2nd level + for (const auto& rPair : aNumberingRule) + { + if (rPair.Name == "Prefix") + // This was "." instead of empty, so the second paragraph was + // rendered as ".1" instead of "1.". + CPPUNIT_ASSERT_EQUAL(OUString(), rPair.Value.get<OUString>()); + else if (rPair.Name == "Suffix") + CPPUNIT_ASSERT_EQUAL(OUString("."), rPair.Value.get<OUString>()); + } +} + 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 1c0e9ac..f9468c6 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -798,13 +798,21 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, SfxItemSet*& rpItemSet, for(nLevelB = 0; nLevelB < nMaxLevel; ++nLevelB) aOfsNumsXCH.push_back(aLVL.aOfsNumsXCH[nLevelB]); + // nLevelB is an index in the aOfsNumsXCH array. for(nLevelB = 0; nLevelB <= nLevel; ++nLevelB) { + // nPos is a one-based character offset to a level placeholder in + // sNumString. sal_uInt8 nPos = aOfsNumsXCH[nLevelB]; - if (nPos && nPos < sNumString.getLength() && sNumString[nPos-1] < nMaxLevel) + if (nPos && nPos < sNumString.getLength()) { - if (rNotReallyThere[nLevelB]) - aOfsNumsXCH[nLevelB] = 0; + // nPosValue is the actual numbering level. + sal_Unicode nPosValue = sNumString[nPos-1]; + if (nPosValue < nMaxLevel) + { + if (rNotReallyThere[nPosValue]) + aOfsNumsXCH[nLevelB] = 0; + } } } myIter aIter = std::remove(aOfsNumsXCH.begin(), aOfsNumsXCH.end(), 0); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits