sw/qa/extras/ww8import/data/fdo36868.doc |binary sw/qa/extras/ww8import/data/list-nolevel.doc |binary sw/qa/extras/ww8import/ww8import.cxx | 19 +++++++++++++++++++ sw/source/filter/ww8/ww8par3.cxx | 11 +++-------- 4 files changed, 22 insertions(+), 8 deletions(-)
New commits: commit baaba90068ef29cc7259ab0f25d2947fa3a56d7d Author: Miklos Vajna <[email protected]> Date: Tue Oct 15 16:29:35 2013 +0200 WW8 import: fix handling of sprmPIlfo when sprmPIlvl is missing Commit 542a0d7260e4767d8aff839eb593e748a82ced48 (#100044# Cleanup for optimization defines->enums, 2002-08-14) added the problematic "else" without mentioning the reason, so I assume it's safe to just revert that part. Change-Id: Id90fbdfb1116be458a76c9653fec0633edc34fac diff --git a/sw/qa/extras/ww8import/data/list-nolevel.doc b/sw/qa/extras/ww8import/data/list-nolevel.doc new file mode 100755 index 0000000..04e3499 Binary files /dev/null and b/sw/qa/extras/ww8import/data/list-nolevel.doc differ diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 921cbb2..d8d5e3e 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -37,6 +37,7 @@ public: void testPageBorder(); void testN823651(); void testFdo36868(); + void testListNolevel(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -65,6 +66,7 @@ void Test::run() {"page-border.doc", &Test::testPageBorder}, {"n823651.doc", &Test::testN823651}, {"fdo36868.doc", &Test::testFdo36868}, + {"list-nolevel.doc", &Test::testListNolevel}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -301,6 +303,14 @@ void Test::testFdo36868() CPPUNIT_ASSERT_EQUAL(OUString("2.1"), aText); } +void Test::testListNolevel() +{ + // Similar to fdo#36868, numbering portions had wrong values. + OUString aText = parseDump("/root/page/body/txt[1]/Special[@nType='POR_NUMBER']", "rText"); + // POR_NUMBER was completely missing. + CPPUNIT_ASSERT_EQUAL(OUString("1."), aText); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 0d5832f..f31e6d7 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -2062,7 +2062,7 @@ void SwWW8ImplReader::Read_LFOPosition(sal_uInt16, const sal_uInt8* pData, { if (WW8ListManager::nMaxLevel == nListLevel) nListLevel = 0; - else if (WW8ListManager::nMaxLevel > nListLevel) + if (WW8ListManager::nMaxLevel > nListLevel) { RegisterNumFmt(nLFOPosition, nListLevel); nLFOPosition = USHRT_MAX; commit 6abcb3c3d6b51e87a5976edc91d5195f7db60104 Author: Miklos Vajna <[email protected]> Date: Tue Oct 15 15:17:09 2013 +0200 fdo#36868 WW8 import: allow outline numbering and list style in the same ... .. paragraph style The original problem (from a user's point of view) was that the second level of the numbering started from 1.1 instead of 2.1 in the bugdoc. This was fixed by using outline numbering for level 2 as well, but this is problematic in many cases: we want to have outline numbering exactly when outline numbering is enabled for the given paragraph style. So revert the change in SwWW8ImplReader::SetStylesList() and fix it differently: SwWW8ImplReader::RegisterNumFmtOnStyle() explicitly ignores list style if outline numbering is available with no good reason. Both the WW8 format and Writer core allows to have outline numbering and a list style at the same time, so set list style even when outline numbering is available. This fixes the original issue, too -- without introducing nasty fake outline numbering usage. Also add a testcase for the original issue. (regression from e3d5c3e0746916c4056389dd8c2daa6c451c8f6e) Change-Id: Id7d2d67a96a858aee3230110cb518fea51d19d38 diff --git a/sw/qa/extras/ww8import/data/fdo36868.doc b/sw/qa/extras/ww8import/data/fdo36868.doc new file mode 100644 index 0000000..382c6b2 Binary files /dev/null and b/sw/qa/extras/ww8import/data/fdo36868.doc differ diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index ef68da6..921cbb2 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -36,6 +36,7 @@ public: void testN816593(); void testPageBorder(); void testN823651(); + void testFdo36868(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -63,6 +64,7 @@ void Test::run() {"n816593.doc", &Test::testN816593}, {"page-border.doc", &Test::testPageBorder}, {"n823651.doc", &Test::testN823651}, + {"fdo36868.doc", &Test::testFdo36868}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -292,6 +294,13 @@ void Test::testN823651() CPPUNIT_ASSERT_EQUAL(7.5f, getProperty<float>(getParagraphOfText(1, xText), "CharHeight")); } +void Test::testFdo36868() +{ + OUString aText = parseDump("/root/page/body/txt[3]/Special[@nType='POR_NUMBER']", "rText"); + // This was 1.1. + CPPUNIT_ASSERT_EQUAL(OUString("2.1"), aText); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 13d0646..0d5832f 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -1738,8 +1738,6 @@ void SwWW8ImplReader::SetStylesList(sal_uInt16 nStyle, sal_uInt16 nActLFO, { rStyleInf.nLFOIndex = nActLFO; rStyleInf.nListLevel = nActLevel; - if (nActLevel > 0) // it must be an outline list - rStyleInf.nOutlineLevel = nActLevel; if ( (USHRT_MAX > nActLFO) && @@ -1788,12 +1786,9 @@ void SwWW8ImplReader::RegisterNumFmtOnStyle(sal_uInt16 nStyle) { if( MAXLEVEL > rStyleInf.nOutlineLevel ) rStyleInf.pOutlineNumrule = pNmRule; - else - { - rStyleInf.pFmt->SetFmtAttr( + rStyleInf.pFmt->SetFmtAttr( SwNumRuleItem( pNmRule->GetName() ) ); - rStyleInf.bHasStyNumRule = true; - } + rStyleInf.bHasStyNumRule = true; } } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
