diff options
author | László Németh <nemeth@numbertext.org> | 2018-05-30 17:28:17 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-06-11 22:59:23 +0200 |
commit | ecad621f6889e8af23baa4faee62d10f580ec074 (patch) | |
tree | adcc0b02a45ebb26c5a2351566acc67e26018c55 /svl | |
parent | tdf#115007: Use [NatNum12 params...] syntax (diff) | |
download | core-ecad621f6889e8af23baa4faee62d10f580ec074.tar.gz core-ecad621f6889e8af23baa4faee62d10f580ec074.zip |
tdf#115007: add import/export to NatNum12 (spell out numbers,
dates and money amounts, supporting all the
XNumberText/libnumbertext formatting codes, for example
"ordinal", "ordinal-number", "ordinal-feminine", etc., and
ISO 4217 currency codes, also their possible combinations.
NatNum12 formatting codes are stored by using the newly
introduced (yet, loext:)transliteration-spellout attribute.
creator-initials also added to token list
Change-Id: I20f93c9d16778f142067a56d53b336d0acbe2d92
Reviewed-on: https://gerrit.libreoffice.org/54673
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit 32f1c56d8ff5e6f87dbcf086fd3743d6d36182bc)
Reviewed-on: https://gerrit.libreoffice.org/55625
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/numbers/zformat.cxx | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index c9bcf82a88c6..02ac08c7dfc5 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -952,8 +952,11 @@ SvNumberformat::SvNumberformat(OUString& rString, } sStr = "NatNum" + OUString::number(nNum); NumFor[nIndex].SetNatNumNum( nNum, false ); - if (!sParams.isEmpty()) + // NatNum12 supports arguments + if (nNum == 12) { + if (sParams.isEmpty()) + sParams = "cardinal"; // default NatNum12 format is "cardinal" NumFor[nIndex].SetNatNumParams(sParams); sStr += " " + sParams; } @@ -5390,6 +5393,7 @@ void SvNumberformat::impTransliterateImpl(OUStringBuffer& rStr, } void SvNumberformat::GetNatNumXml( css::i18n::NativeNumberXmlAttributes& rAttr, + css::i18n::NativeNumberXmlAttributes2& rAttr2, sal_uInt16 nNumFor ) const { if ( nNumFor <= 3 ) @@ -5399,8 +5403,15 @@ void SvNumberformat::GetNatNumXml( css::i18n::NativeNumberXmlAttributes& rAttr, { css::lang::Locale aLocale( LanguageTag( rNum.GetLang() ).getLocale() ); - rAttr = GetFormatter().GetNatNum()->convertToXmlAttributes( + + if ( NatNumTakesParameters(rNum.GetNatNum()) ) + { + // NatNum12 spell out numbers, dates and money amounts + rAttr2 = css::i18n::NativeNumberXmlAttributes2(aLocale, rNum.GetParams()); + } else { + rAttr = GetFormatter().GetNatNum()->convertToXmlAttributes( aLocale, rNum.GetNatNum() ); + } } else { |