[Libreoffice-commits] core.git: include/svl svl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Aug 22 10:46:50 UTC 2018


 include/svl/zformat.hxx        |    2 ++
 svl/source/numbers/zformat.cxx |   21 ++++++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 5f7d8f68886065a316cb0b88b8364a789bc5c0bf
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Tue Aug 21 14:28:23 2018 +0200
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Wed Aug 22 12:46:28 2018 +0200

    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 at redhat.com>

diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx
index 092895645cc6..b1f941656078 100644
--- a/include/svl/zformat.hxx
+++ b/include/svl/zformat.hxx
@@ -161,6 +161,8 @@ class SVL_DLLPUBLIC SvNumberformat
 
         LocaleType();
         LocaleType(sal_uInt32 nRawCode);
+
+        bool isPlainLocale() const;
     };
 
 public:
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 )
 {


More information about the Libreoffice-commits mailing list