summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-08-21 14:28:23 +0200
committerEike Rathke <erack@redhat.com>2018-08-22 12:46:28 +0200
commit5f7d8f68886065a316cb0b88b8364a789bc5c0bf (patch)
treeedb6640174fc31d6b0f4cd171aa91d4d55ad943c /svl
parentdc96b95f4a2c732f678af002bf53765ba3a0a21e (diff)
Related: tdf#73063 strip a plain locale identifier if locale data is available
Change-Id: Ie34f6c34fe4415489026203fe7d7b1f32a2bb5dc Reviewed-on: https://gerrit.libreoffice.org/59398 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/numbers/zformat.cxx21
1 files changed, 20 insertions, 1 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 6a2d351692a8..1d591f6e5dff 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -1028,8 +1028,22 @@ SvNumberformat::SvNumberformat(OUString& rString,
* context is used, which is most likely
* the case.
* */
+
+ // Strip a plain locale identifier if locale
+ // data is available to avoid duplicated
+ // formats with and without LCID for the same
+ // locale. Besides it looks ugly and confusing
+ // and is unnecessary as the format will be
+ // listed for the resulting locale.
+ if (aTmpLocale.isPlainLocale())
+ sStr.clear();
+ else
+ sStr = "$-" + aTmpLocale.generateCode();
+ }
+ else
+ {
+ sStr = "$-" + aTmpLocale.generateCode();
}
- sStr = "$-" + aTmpLocale.generateCode();
NumFor[nIndex].SetNatNumLang( MsLangId::getRealLanguage( aTmpLocale.meLanguage));
// "$-NNCCLLLL" Numerals and Calendar
@@ -1544,6 +1558,11 @@ SvNumberformat::LocaleType::LocaleType(sal_uInt32 nRawNum)
mnNumeralShape = static_cast<sal_uInt8>(nRawNum & 0xFF);
}
+bool SvNumberformat::LocaleType::isPlainLocale() const
+{
+ return meSubstitute == Substitute::NONE && !mnCalendarType && !mnNumeralShape;
+}
+
// static
SvNumberformat::LocaleType SvNumberformat::ImpGetLocaleType(const OUString& rString, sal_Int32& nPos )
{