diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-03-06 10:44:19 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-05-18 17:39:10 +0200 |
commit | 68fc9688f36f420e16f87de4da3b3ce75288b76c (patch) | |
tree | 9f439218a906f0813138812a9939e1e69d61b289 | |
parent | 2d327742d99799c543ad579fc0a570231e870595 (diff) |
sw chicago numbering: add DOC footnote export
Note that chicago numbering can't be used for paragraph numbering. It
would be possible technically, but the spec && bffvalidator && Word
agrees on forbidding that.
Change-Id: Ic3de51f9724d399542f4fe6ac48e70e94c6ea4ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90080
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
(cherry picked from commit 9a1dd2e242794b4f26d207efc80a2f5bc088ab7c)
-rw-r--r-- | sw/qa/extras/ww8export/ww8export3.cxx | 30 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8num.cxx | 1 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par3.cxx | 4 |
4 files changed, 39 insertions, 0 deletions
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 84677fb3403c..38e79fed25e5 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -95,6 +95,36 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testArabicZeroNumberingFootnote) CPPUNIT_ASSERT_EQUAL(nExpected, nActual); } +CPPUNIT_TEST_FIXTURE(SwModelTestBase, testChicagoNumberingFootnote) +{ + // Create a document, set footnote numbering type to SYMBOL_CHICAGO. + loadURL("private:factory/swriter", nullptr); + uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xFootnoteSettings + = xFootnotesSupplier->getFootnoteSettings(); + sal_uInt16 nNumberingType = style::NumberingType::SYMBOL_CHICAGO; + xFootnoteSettings->setPropertyValue("NumberingType", uno::makeAny(nNumberingType)); + + // Insert a footnote. + uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextContent> xFootnote( + xFactory->createInstance("com.sun.star.text.Footnote"), uno::UNO_QUERY); + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextContentAppend> xTextContentAppend(xTextDocument->getText(), + uno::UNO_QUERY); + xTextContentAppend->appendTextContent(xFootnote, {}); + + reload("MS Word 97", ""); + xFootnotesSupplier.set(mxComponent, uno::UNO_QUERY); + sal_uInt16 nExpected = style::NumberingType::SYMBOL_CHICAGO; + auto nActual = getProperty<sal_uInt16>(xFootnotesSupplier->getFootnoteSettings(), "NumberingType"); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 63 + // - Actual : 4 + // i.e. the numbering type was ARABIC, not SYMBOL_CHICAGO. + CPPUNIT_ASSERT_EQUAL(nExpected, nActual); +} + DECLARE_WW8EXPORT_TEST(testTdf122429_header, "tdf122429_header.doc") { uno::Reference<container::XNameAccess> pageStyles = getStyles("PageStyles"); diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index 59f69e506686..b89d40445e50 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -288,6 +288,7 @@ static sal_uInt8 GetLevelNFC( sal_uInt16 eNumType, const SfxItemSet *pOutSet) case style::NumberingType::NUMBER_HANGUL_KO: nRet = 41; break; case style::NumberingType::NUMBER_UPPER_KO: nRet = 44; break; case SVX_NUM_NUMBER_NONE: nRet = 0xff; break; + // No SVX_NUM_SYMBOL_CHICAGO here: LVLF can't contain 0x09, msonfcChiManSty. case SVX_NUM_ARABIC_ZERO: // 0x16, msonfcArabicLZ nRet = 22; diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 18a9da4e8d50..2f487133997d 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -740,6 +740,10 @@ sal_uInt8 WW8Export::GetNumId( sal_uInt16 eNumType ) // nothing, WW does the same (undocumented) case SVX_NUM_NUMBER_NONE: nRet = 0xff; break; + case SVX_NUM_SYMBOL_CHICAGO: + // 0x09, msonfcChiManSty + nRet = 9; + break; case SVX_NUM_ARABIC_ZERO: // 0x16, msonfcArabicLZ nRet = 22; diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 966fb66fb121..0158c950db31 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -540,6 +540,10 @@ SvxNumType WW8ListManager::GetSvxNumTypeFromMSONFC(sal_uInt16 nNFC) // actually: ORDINAL nType = SVX_NUM_ARABIC; break; + case 9: + // 0x09, msonfcChiManSty + nType = SVX_NUM_SYMBOL_CHICAGO; + break; case 22: // 0x16, msonfcArabicLZ nType = SVX_NUM_ARABIC_ZERO; |