diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-03-06 16:16:56 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-04-03 09:20:22 +0200 |
commit | 140f286303118d0436efd51806e63415454424cc (patch) | |
tree | 0ca407a466abb4a52156c657da083f2a98af0f77 /sw/qa/extras | |
parent | 2fc6d0bcc5d7b34a91ae7b2006d9a1571523b723 (diff) |
sw chicago numbering: add RTF footnote export
Chicago numbering is not supported for paragraph numbering (same as
DOC), so focus on footnote/endnote export only.
There is markup in RTF to store doc-global footnote/endnote numbering
type and the same for per-section. DOC writes both, then Writer only
reads the global setting and Word only reads the per-section setting.
This means only export is needed here, import already handled the
doc-global markup, and that's enough.
(cherry picked from commit 4ba09be7e260ce2a79a23465db7b2837422cde30)
Conflicts:
sw/qa/extras/rtfexport/rtfexport5.cxx
Change-Id: I3590560ca913e04078988fe4784e50fa5cbf17bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91590
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport3.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx index 40f7c9e25c81..4d2c808e3756 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -18,6 +18,7 @@ #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/text/XTextColumns.hpp> #include <com/sun/star/text/TextContentAnchorType.hpp> +#include <com/sun/star/text/XTextContentAppend.hpp> class Test : public SwModelTestBase { @@ -290,6 +291,37 @@ DECLARE_RTFEXPORT_TEST(testBtlrFrame, "btlr-frame.odt") CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, 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("Rich Text Format", ""); + 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); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |