summaryrefslogtreecommitdiff
path: root/sw/qa/extras/odfexport/odfexport.cxx
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2018-02-20 11:38:24 +0100
committerLászló Németh <nemeth@numbertext.org>2018-05-03 11:42:20 +0200
commitf1579d3d6c5f5f3a651825e035b93bee7a4f43c6 (patch)
tree302e93db63f5029f521a0dba446e2c7b91d08a10 /sw/qa/extras/odfexport/odfexport.cxx
parentf5a56c367fba1c42b4f9719b10ff3e86ad5e2ab1 (diff)
tdf#117171 support localized number name numbering styles
in page number, chapter and outline numbering in ~30 languages by integrating libnumbertext library. - offapi: add linguistic2::NumberText New NumberingType constants: - ordinal indicators (1st, 2nd, 3rd...) - cardinal number names (One, Two, Three...) - ordinal number names (First, Second, Third...) Note: these numberings are parts of OOXML, too. Plain text files of Libnumbertext's language data are installed in share/numbertext (similar to share/fingerprint), allowing further customization. Change-Id: I4034da0a40a8c926f14a3f591749a89a8d807d5a Reviewed-on: https://gerrit.libreoffice.org/53313 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa/extras/odfexport/odfexport.cxx')
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index d1d544ea22e5..c2da82ffcaa3 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -1981,6 +1981,32 @@ DECLARE_ODFEXPORT_TEST(testChapterNumberingNewLine, "chapter-number-new-line.odt
sal_Int16(SvxNumberFormat::NEWLINE), hashMap["LabelFollowedBy"].get<sal_Int16>());
}
+DECLARE_ODFEXPORT_TEST(testSpellOutNumberingTypes, "spellout-numberingtypes.odt")
+{
+ // ordinal indicator, ordinal and cardinal number numbering styles (from LibreOffice 6.1)
+ const char* aFieldTexts[] = { "1st", "First", "One" };
+ // fallback for old platforms without std::codecvt and std::regex supports
+ const char* aFieldTextFallbacks[] = { "Ordinal-number 1", "Ordinal 1", "1" };
+ uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
+ // update text field content
+ uno::Reference<util::XRefreshable>(xTextFieldsSupplier->getTextFields(), uno::UNO_QUERY)->refresh();
+
+ uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
+ uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
+
+ for (sal_uInt32 i = 0; i < SAL_N_ELEMENTS(aFieldTexts); i++)
+ {
+ uno::Any aField = xFields->nextElement();
+ uno::Reference<lang::XServiceInfo> xServiceInfo(aField, uno::UNO_QUERY);
+ if (xServiceInfo->supportsService("com.sun.star.text.textfield.PageNumber"))
+ {
+ uno::Reference<text::XTextContent> xField(aField, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(true, OUString::fromUtf8(aFieldTexts[i]).equals(xField->getAnchor()->getString()) ||
+ OUString::fromUtf8(aFieldTextFallbacks[i]).equals(xField->getAnchor()->getString()));
+ }
+ }
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();