diff options
author | László Németh <nemeth@numbertext.org> | 2018-02-20 11:38:24 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2018-05-03 11:42:20 +0200 |
commit | f1579d3d6c5f5f3a651825e035b93bee7a4f43c6 (patch) | |
tree | 302e93db63f5029f521a0dba446e2c7b91d08a10 /offapi | |
parent | f5a56c367fba1c42b4f9719b10ff3e86ad5e2ab1 (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 'offapi')
-rw-r--r-- | offapi/UnoApi_offapi.mk | 2 | ||||
-rw-r--r-- | offapi/com/sun/star/linguistic2/NumberText.idl | 46 | ||||
-rw-r--r-- | offapi/com/sun/star/linguistic2/XNumberText.idl | 123 | ||||
-rw-r--r-- | offapi/com/sun/star/style/NumberingType.idl | 23 |
4 files changed, 194 insertions, 0 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 2f544b327a6e..e25fc4495805 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -245,6 +245,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/linguistic2,\ LinguServiceManager \ Proofreader \ ProofreadingIterator \ + NumberText \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/logging,\ ConsoleHandler \ @@ -2850,6 +2851,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/linguistic2,\ XLinguServiceManager \ XLinguServiceManager2 \ XMeaning \ + XNumberText \ XPossibleHyphens \ XProofreader \ XProofreadingIterator \ diff --git a/offapi/com/sun/star/linguistic2/NumberText.idl b/offapi/com/sun/star/linguistic2/NumberText.idl new file mode 100644 index 000000000000..67c77ceeba20 --- /dev/null +++ b/offapi/com/sun/star/linguistic2/NumberText.idl @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef __com_sun_star_linguistic2_NumberText_idl__ +#define __com_sun_star_linguistic2_NumberText_idl__ + +#include <com/sun/star/linguistic2/XNumberText.idl> + +module com { module sun { module star { module linguistic2 { + +/** provides converter to spell out numbers and money amounts + + <p>An implementation of this service will receive text and has to spell + out as cardinal, ordinal, ordinal indicator or money amounts.</p> + + <p>An implementation of this service is not limited to number to number + conversion at all. It might also support other linguistic functions of + a given language, for example, spelling out years, gender and formal + variants or complex affixation of number names, or article selection.</p> + + @since LibreOffice 6.1 + */ + + service NumberText:XNumberText; + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/linguistic2/XNumberText.idl b/offapi/com/sun/star/linguistic2/XNumberText.idl new file mode 100644 index 000000000000..4d0311323b1f --- /dev/null +++ b/offapi/com/sun/star/linguistic2/XNumberText.idl @@ -0,0 +1,123 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef __com_sun_star_linguistic2_XNumberText_idl__ +#define __com_sun_star_linguistic2_XNumberText_idl__ + +#include <com/sun/star/uno/XInterface.idl> +#include <com/sun/star/lang/Locale.idl> +#include <com/sun/star/lang/IllegalArgumentException.idl> + +module com { module sun { module star { module linguistic2 { + +/** This interface allows to spell out numbers and money amounts + + <p> The current set of supported languages is: + <ul> + <li>af : Afrikaans</li> + <li>ca : Catalan</li> + <li>cs : Czech</li> + <li>da : Danish</li> + <li>de : German</li> + <li>de-CH : Swiss Standard German</li> + <li>de-LI : Swiss Standard German</li> + <li>el : Greek</li> + <li>en : English</li> + <li>en-AU : Australian English</li> + <li>en-GB : British English</li> + <li>en-IE : Irish English</li> + <li>en-NZ : New Zealand English</li> + <li>eo : Esperanto</li> + <li>es : Spanish</li> + <li>fi : Finnish</li> + <li>fr : French</li> + <li>fr-BE : Belgian French</li> + <li>fr-CH : Swiss French</li> + <li>he : Hebrew</li> + <li>hr : Croatian</li> + <li>hu : Hungarian</li> + <li>Hung : Old Hungarian</li> + <li>id : Indonesian</li> + <li>it : Italian</li> + <li>ja : Japanese</li> + <li>ko-KP : North-Korean</li> + <li>ko-KR : South-Korean</li> + <li>lb : Luxembourgish</li> + <li>lt : Lithuanian</li> + <li>lv : Latvian</li> + <li>ms : Malay</li> + <li>nl : Dutch</li> + <li>pl : Polish</li> + <li>pt-BR : Portuguese (Brasilian)</li> + <li>pt-PT : Portuguese (Portugal)</li> + <li>ro : Romanian</li> + <li>Roman : Roman numbers</li> + <li>ru : Russian</li> + <li>sh : Serbian (written with latin characters)</li> + <li>sl : Slovenian</li> + <li>sr : Serbian (written with cyrillic characters) (added with OOo 3.4)</li> + <li>Suzhou : Suzhou numerals</li> + <li>sv : Swedish</li> + <li>th : Thai</li> + <li>tr : Turkish</li> + <li>vi : Vietnamese</li> + <li>zh : Chinese</li> + </ul> + + </p> + + @since LibreOffice 6.1 + */ +interface XNumberText +{ + /** spell out numbers and money amounts + + <p>Please note that text argument can contain prefixes separated by space, + for example "ordinal" for ordinal numbers, "ordinal-number" for ordinal + indicators and ISO 4217 currency codes. + + Language modules list the supported prefixes by the input text "help".</p> + + @returns + the result of the number name conversion. + + @param aText + all the text including the part that should converted. + + @param aLocale + the locale for the target language of the number name conversion. + + @see com::sun::star::lang::Locale + */ + string getNumberText( + [in] string aText, + [in] com::sun::star::lang::Locale aLocale ) + raises( com::sun::star::lang::IllegalArgumentException ); + + /** returns a list of all supported languages. + */ + sequence< com::sun::star::lang::Locale > getAvailableLanguages(); + +}; + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/style/NumberingType.idl b/offapi/com/sun/star/style/NumberingType.idl index be4bb6bc2758..6bcb43f6e77a 100644 --- a/offapi/com/sun/star/style/NumberingType.idl +++ b/offapi/com/sun/star/style/NumberingType.idl @@ -458,6 +458,29 @@ published constants NumberingType */ const short NUMBER_INDIC_DEVANAGARI = 59; + /** Numbering in ordinal numbers of the language + of the text node + for example, 1st, 2nd, 3rd... in English + + @since LibreOffice 6.1 + */ + const short TEXT_NUMBER = 60; + + /** Numbering in cardinal numbers of the language + of the text node + for example, One, Two, Three... in English + + @since LibreOffice 6.1 + */ + const short TEXT_CARDINAL = 61; + + /** Numbering in ordinal numbers of the language + of the text node + for example, First, Second, Third... in English + + @since LibreOffice 6.1 + */ + const short TEXT_ORDINAL = 62; }; |