diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2019-01-28 20:39:17 -0500 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-25 11:24:37 +0200 |
commit | 3fa4f52ad52a1db53c2336eac8053502b03681e3 (patch) | |
tree | 458d8332c002923d03005bea10b6d030701af190 /sd | |
parent | a59b4a2dcec4ad2131350a9999185ebcd07c5fc8 (diff) |
sd: LOK: support localization of slide transition presets
Reviewed-on: https://gerrit.libreoffice.org/68264
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit 312346531dde33cd000a1d3c95c7b7829b656438)
Change-Id: Ic3ea57e537e118e10d155203921574967154c234
Reviewed-on: https://gerrit.libreoffice.org/76283
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/inc/TransitionPreset.hxx | 4 | ||||
-rw-r--r-- | sd/source/core/TransitionPreset.cxx | 44 |
2 files changed, 22 insertions, 26 deletions
diff --git a/sd/inc/TransitionPreset.hxx b/sd/inc/TransitionPreset.hxx index 14518e51b661..c8b266338631 100644 --- a/sd/inc/TransitionPreset.hxx +++ b/sd/inc/TransitionPreset.hxx @@ -42,7 +42,6 @@ class TransitionPreset { public: static const TransitionPresetList& getTransitionPresetList(); - static bool importTransitionPresetList( TransitionPresetList& rList ); sal_Int16 getTransition() const { return mnTransition; } sal_Int16 getSubtype() const { return mnSubtype; } @@ -57,6 +56,9 @@ public: private: TransitionPreset( const css::uno::Reference< css::animations::XAnimationNode >& xNode ); + static bool importTransitionPresetList(TransitionPresetList& rList); + static std::map<OUString, TransitionPresetList> mPresetsMap; + sal_Int16 mnTransition; sal_Int16 mnSubtype; bool mbDirection; diff --git a/sd/source/core/TransitionPreset.cxx b/sd/source/core/TransitionPreset.cxx index 4dc21cd8afcf..a654072132a4 100644 --- a/sd/source/core/TransitionPreset.cxx +++ b/sd/source/core/TransitionPreset.cxx @@ -27,11 +27,15 @@ #include <comphelper/getexpandeduri.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/lok.hxx> +#include <unotools/pathoptions.hxx> +#include <unotools/syslocaleoptions.hxx> #include <officecfg/Office/UI/Effects.hxx> #include <rtl/instance.hxx> #include <sal/log.hxx> #include <osl/diagnose.h> +#include <vcl/svapp.hxx> #include <CustomAnimationPreset.hxx> #include <TransitionPreset.hxx> @@ -227,34 +231,24 @@ bool TransitionPreset::importTransitionPresetList( TransitionPresetList& rList ) return bRet; } -namespace -{ - class ImportedTransitionPresetList - { - private: - sd::TransitionPresetList m_aTransitionPresetList; - public: - ImportedTransitionPresetList() - { - sd::TransitionPreset::importTransitionPresetList( - m_aTransitionPresetList); - } - const sd::TransitionPresetList& getList() const - { - return m_aTransitionPresetList; - } - }; - - class theTransitionPresetList : - public rtl::Static<ImportedTransitionPresetList, - theTransitionPresetList> - { - }; -} +std::map<OUString, TransitionPresetList> sd::TransitionPreset::mPresetsMap; const TransitionPresetList& TransitionPreset::getTransitionPresetList() { - return theTransitionPresetList::get().getList(); + // Support localization per-view. Currently not useful for Desktop + // but very much critical for LOK. The cache now is per-language. + const OUString aLang = comphelper::LibreOfficeKit::isActive() + ? comphelper::LibreOfficeKit::getLanguageTag().getLanguage() + : SvtSysLocaleOptions().GetLanguageTag().getLanguage(); + + SolarMutexGuard aGuard; + const auto it = mPresetsMap.find(aLang); + if (it != mPresetsMap.end()) + return it->second; + + TransitionPresetList& rList = mPresetsMap[aLang]; + sd::TransitionPreset::importTransitionPresetList(rList); + return rList; } } |