From 32f1c56d8ff5e6f87dbcf086fd3743d6d36182bc Mon Sep 17 00:00:00 2001 From: László Németh Date: Wed, 30 May 2018 17:28:17 +0200 Subject: tdf#115007: add import/export to NatNum12 (spell out numbers, MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: László Németh --- svl/source/numbers/zformat.cxx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'svl') diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index eb2f6c7aece2..df789e59ab37 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 { -- cgit