From ddbad5612e4322665bc70f4a026e5b052bcaf344 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 6 Mar 2020 09:05:07 +0100 Subject: sw chicago numbering: add DOCX footnote export Only this was missing, paragraph numbering import/export and footnote numbering import was already working. Change-Id: Ia5966cc7f1308ba81bebc1bf628d8efb17acb713 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90075 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 28 ++++++++++++++++++++++++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 3 +++ 2 files changed, 31 insertions(+) (limited to 'sw') diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 16aa8fdc4bab..9d2ab9444f00 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -178,6 +178,34 @@ CPPUNIT_TEST_FIXTURE(Test, testArabicZeroNumberingFootnote) assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:footnotePr/w:numFmt", "val", "decimalZero"); } +CPPUNIT_TEST_FIXTURE(Test, testChicagoNumberingFootnote) +{ + // Create a document, set footnote numbering type to SYMBOL_CHICAGO. + loadURL("private:factory/swriter", nullptr); + uno::Reference xFootnotesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xFootnoteSettings + = xFootnotesSupplier->getFootnoteSettings(); + sal_uInt16 nNumberingType = style::NumberingType::SYMBOL_CHICAGO; + xFootnoteSettings->setPropertyValue("NumberingType", uno::makeAny(nNumberingType)); + + // Insert a footnote. + uno::Reference xFactory(mxComponent, uno::UNO_QUERY); + uno::Reference xFootnote( + xFactory->createInstance("com.sun.star.text.Footnote"), uno::UNO_QUERY); + uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference xTextContentAppend(xTextDocument->getText(), + uno::UNO_QUERY); + xTextContentAppend->appendTextContent(xFootnote, {}); + + reload("Office Open XML Text", ""); + + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + // Without the accompanying fix in place, this test would have failed with: + // XPath '/w:document/w:body/w:sectPr/w:footnotePr/w:numFmt' number of nodes is incorrect + // because the exporter had no idea what markup to use for SYMBOL_CHICAGO. + assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:footnotePr/w:numFmt", "val", "chicago"); +} + DECLARE_OOXMLEXPORT_TEST(testTdf87569d, "tdf87569_drawingml.docx") { //if the original tdf87569 sample is upgraded it will have drawingml shapes... diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 6f512b85352c..3686dba83df7 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7734,6 +7734,9 @@ void DocxAttributeOutput::WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr case SVX_NUM_CHAR_SPECIAL: fmt = "bullet"; break; + case SVX_NUM_SYMBOL_CHICAGO: + fmt = "chicago"; + break; case SVX_NUM_ARABIC_ZERO: fmt = "decimalZero"; break; -- cgit