summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-02-24 08:07:12 +0100
committerMichael Meeks <michael.meeks@collabora.com>2020-05-28 09:19:17 +0100
commit1d0bee586523cb90fcf4546cc4b3960019888a69 (patch)
treeb8c48015900219a02281fb5fa25e229be5c4d359 /include
parentde308f52d7288da667d6b8e5fac357c468cdff3f (diff)
Fix currency symbol selection in Calc on mobile
In LOK we use one language identifier for both - UI language and the locale used. This is a problem when we determine that we a language for UI is not available and fall-back to the default "en-US" langauge, which also changes the locale. This introduces a separate variable that stores the language tag for the locale independently to the language. Another problem is that in some cases we don't reset the staticly initialized data, when the new document is loaded, which is on the other hand used to define which currency symbol is used as SYSTEM locale. That can in some cases select the wrong currency symbol even when we changed the locale to something else. This fix introduces a reset function, which is triggered on every document load. Change-Id: I55c7f467600a832895f94346f8bf11a6ef6a1e49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89320 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89343 Tested-by: Jenkins
Diffstat (limited to 'include')
-rw-r--r--include/comphelper/lok.hxx7
-rw-r--r--include/sfx2/lokhelper.hxx6
-rw-r--r--include/sfx2/viewsh.hxx6
-rw-r--r--include/svl/zforlist.hxx2
4 files changed, 19 insertions, 2 deletions
diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx
index 9a01ea2888ad..09d4f682341e 100644
--- a/include/comphelper/lok.hxx
+++ b/include/comphelper/lok.hxx
@@ -104,8 +104,11 @@ COMPHELPER_DLLPUBLIC bool isViewIdForVisCursorInvalidation();
/// Set whether clients want viewId in visible cursor invalidation payload.
COMPHELPER_DLLPUBLIC void setViewIdForVisCursorInvalidation(bool bViewIdForVisCursorInvalidation);
-/// Update the current LOK's language.
-COMPHELPER_DLLPUBLIC void setLanguageTag(const OUString& lang, bool bCanonicalize = false);
+/// Update the current LOK's locale.
+COMPHELPER_DLLPUBLIC void setLocale(const LanguageTag& languageTag);
+/// Get the current LOK's locale.
+COMPHELPER_DLLPUBLIC const LanguageTag& getLocale();
+
/// Update the current LOK's language.
COMPHELPER_DLLPUBLIC void setLanguageTag(const LanguageTag& languageTag);
/// Get the current LOK's language.
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index eb18a7e5f461..01eebfe9e8b1 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -54,8 +54,14 @@ public:
static std::size_t getViewsCount();
/// Get viewIds of all existing views.
static bool getViewIds(int* pArray, size_t nSize);
+ /// Get the default language that should be used for views
+ static LanguageTag getDefaultLanguage();
/// Set language of the given view.
static void setViewLanguage(int nId, const OUString& rBcp47LanguageTag);
+ /// Set the default language for views.
+ static void setDefaultLanguage(const OUString& rBcp47LanguageTag);
+ /// Set the locale for the given view.
+ static void setViewLocale(int nId, const OUString& rBcp47LanguageTag);
/// Iterate over any view shell, except pThisViewShell, passing it to the f function.
template<typename ViewShellType, typename FunctionType>
static void forEachOtherView(ViewShellType* pThisViewShell, FunctionType f);
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index d65fae656b16..e81d2db11b7b 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -151,6 +151,7 @@ friend class SfxPrinterController;
bool bNoNewWindow;
bool mbPrinterSettingsModified;
LanguageTag maLOKLanguageTag;
+ LanguageTag maLOKLocale;
protected:
virtual void Activate(bool IsMDIActivate) override;
@@ -346,6 +347,11 @@ public:
void SetLOKLanguageTag(const OUString& rBcp47LanguageTag);
/// Get the LibreOfficeKit language of this view.
const LanguageTag& GetLOKLanguageTag() const { return maLOKLanguageTag; }
+
+ /// Set the LibreOfficeKit locale of this view.
+ void SetLOKLocale(const OUString& rBcp47LanguageTag);
+ /// Get the LibreOfficeKit locale of this view.
+ const LanguageTag& GetLOKLocale() const { return maLOKLocale; }
};
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
index adbde81c9315..5839c7faa636 100644
--- a/include/svl/zforlist.hxx
+++ b/include/svl/zforlist.hxx
@@ -722,6 +722,8 @@ public:
/// Return the decimal separator matching the given locale / LanguageType.
OUString GetLangDecimalSep( LanguageType nLang ) const;
+ static void resetTheCurrencyTable();
+
/// Return a NfCurrencyTable with pointers to <type>NfCurrencyEntry</type> entries
static const NfCurrencyTable& GetTheCurrencyTable();