summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2018-05-30 17:28:17 +0200
committerLászló Németh <nemeth@numbertext.org>2018-06-08 18:00:20 +0200
commit32f1c56d8ff5e6f87dbcf086fd3743d6d36182bc (patch)
tree47d51358300a5f425fa0bd4b504af0866ab3b0eb /svl
parent4328d181b670356c9dbd69f1ec1dedb473b59e8e (diff)
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>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/numbers/zformat.cxx15
1 files changed, 13 insertions, 2 deletions
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
{