[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Fri Mar 6 10:30:36 UTC 2020
sw/qa/extras/ww8export/ww8export3.cxx | 30 ++++++++++++++++++++++++++++++
sw/source/filter/ww8/wrtw8num.cxx | 1 +
sw/source/filter/ww8/ww8atr.cxx | 4 ++++
sw/source/filter/ww8/ww8par3.cxx | 4 ++++
4 files changed, 39 insertions(+)
New commits:
commit 9a1dd2e242794b4f26d207efc80a2f5bc088ab7c
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Mar 6 10:44:19 2020 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Mar 6 11:30:04 2020 +0100
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 at collabora.com>
Tested-by: Jenkins
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 5f9b8e2eefc6..c077dfcb040d 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -96,6 +96,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 17ba17f35888..4e986197faff 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -295,6 +295,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 f0e14722cffe..61080c928881 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -730,6 +730,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 1e1a5341b67a..d35adc6ca42e 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -552,6 +552,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;
More information about the Libreoffice-commits
mailing list