[Libreoffice-commits] core.git: sd/inc sd/source
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 25 09:25:19 UTC 2019
sd/inc/TransitionPreset.hxx | 4 ++-
sd/source/core/TransitionPreset.cxx | 44 +++++++++++++++---------------------
2 files changed, 22 insertions(+), 26 deletions(-)
New commits:
commit 3fa4f52ad52a1db53c2336eac8053502b03681e3
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Mon Jan 28 20:39:17 2019 -0500
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 25 11:24:37 2019 +0200
sd: LOK: support localization of slide transition presets
Reviewed-on: https://gerrit.libreoffice.org/68264
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at 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 at collabora.co.uk>
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;
}
}
More information about the Libreoffice-commits
mailing list