From 807d4382cb021d2ac3ea99d6757a7b368a32941d Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Fri, 8 Jun 2018 23:44:13 +0200 Subject: Derive NativeNumberXmlAttributes2 from NativeNumberXmlAttributes, tdf#115007 follow-up Also ensure that transliteration-spellout and (transliteration-format,transliteration-style) are mutually exclusive and transliteration-spellout is only written if ODF version is >1.2, namespace 'loext' for 1.2 with extensions and namespace 'number' in anticipation of ODF 1.3 (may need to be adapted). Change-Id: I371dee8883ecb0d4638510c92b4bf59acd09f636 Reviewed-on: https://gerrit.libreoffice.org/55491 Tested-by: Jenkins Reviewed-by: Eike Rathke --- svl/source/numbers/zformat.cxx | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'svl') diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index df789e59ab37..1bc63e4ecfec 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -5392,8 +5392,7 @@ void SvNumberformat::impTransliterateImpl(OUStringBuffer& rStr, rStr.append(sTemp); } -void SvNumberformat::GetNatNumXml( css::i18n::NativeNumberXmlAttributes& rAttr, - css::i18n::NativeNumberXmlAttributes2& rAttr2, +void SvNumberformat::GetNatNumXml( css::i18n::NativeNumberXmlAttributes2& rAttr, sal_uInt16 nNumFor ) const { if ( nNumFor <= 3 ) @@ -5404,23 +5403,37 @@ void SvNumberformat::GetNatNumXml( css::i18n::NativeNumberXmlAttributes& rAttr, css::lang::Locale aLocale( LanguageTag( rNum.GetLang() ).getLocale() ); + /* TODO: a new XNativeNumberSupplier2::convertToXmlAttributes() + * should rather return NativeNumberXmlAttributes2 and places + * adapted, and whether to fill Spellout or something different + * should be internal there. */ + css::i18n::NativeNumberXmlAttributes aTmp( + GetFormatter().GetNatNum()->convertToXmlAttributes( + aLocale, rNum.GetNatNum())); + rAttr.Locale = aTmp.Locale; + rAttr.Format = aTmp.Format; + rAttr.Style = aTmp.Style; 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() ); + rAttr.Spellout = rNum.GetParams(); + // Mutually exclusive. + rAttr.Format.clear(); + rAttr.Style.clear(); + } + else + { + rAttr.Spellout.clear(); } } else { - rAttr = css::i18n::NativeNumberXmlAttributes(); + rAttr = css::i18n::NativeNumberXmlAttributes2(); } } else { - rAttr = css::i18n::NativeNumberXmlAttributes(); + rAttr = css::i18n::NativeNumberXmlAttributes2(); } } -- cgit