[Libreoffice-commits] core.git: basctl/source include/sfx2 sc/source sd/source sfx2/source starmath/source sw/source

Jan Holesovsky kendy at collabora.com
Fri Jan 5 08:51:50 UTC 2018


 basctl/source/basicide/basicmod.hxx |    4 ++--
 basctl/source/basicide/iderdll.cxx  |    4 +---
 include/sfx2/module.hxx             |    8 +++-----
 sc/source/ui/app/scmod.cxx          |    2 +-
 sd/source/ui/app/sdmod.cxx          |    2 +-
 sfx2/source/appl/module.cxx         |   16 +++++++++++-----
 starmath/source/smmod.cxx           |    2 +-
 sw/source/uibase/app/swmodule.cxx   |    2 +-
 8 files changed, 21 insertions(+), 19 deletions(-)

New commits:
commit 028fd03cdf4d3d8072289a5c4d476435c18f90d0
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Jan 3 14:08:55 2018 +0100

    lokdialog: Allow language switching in SfxModule(s).
    
    Change-Id: Icef0b3610c3bfa858cdd61de6ef3f5edc1e3c96b
    Reviewed-on: https://gerrit.libreoffice.org/47385
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/basctl/source/basicide/basicmod.hxx b/basctl/source/basicide/basicmod.hxx
index 7dcee5a16420..d94a2198d440 100644
--- a/basctl/source/basicide/basicmod.hxx
+++ b/basctl/source/basicide/basicmod.hxx
@@ -29,8 +29,8 @@ namespace basctl
 class Module : public SfxModule
 {
 public:
-    Module(const std::locale& rResLocale, SfxObjectFactory *pObjFact)
-        : SfxModule(rResLocale, {pObjFact})
+    Module(const OString& rResName, SfxObjectFactory *pObjFact)
+        : SfxModule(rResName, {pObjFact})
     {
     }
 };
diff --git a/basctl/source/basicide/iderdll.cxx b/basctl/source/basicide/iderdll.cxx
index 19d21c32eedb..b80ce1f38970 100644
--- a/basctl/source/basicide/iderdll.cxx
+++ b/basctl/source/basicide/iderdll.cxx
@@ -118,9 +118,7 @@ Dll::Dll () :
 {
     SfxObjectFactory& rFactory = DocShell::Factory();
 
-    std::locale loc = Translate::Create("basctl");
-
-    auto pModule = o3tl::make_unique<Module>(loc, &rFactory);
+    auto pModule = o3tl::make_unique<Module>("basctl", &rFactory);
     SfxModule* pMod = pModule.get();
     SfxApplication::SetModule(SfxToolsModule::Basic, std::move(pModule));
 
diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx
index de487dafaa3f..352d1e46ba6f 100644
--- a/include/sfx2/module.hxx
+++ b/include/sfx2/module.hxx
@@ -52,13 +52,11 @@ namespace com { namespace sun { namespace star { namespace frame {
 class SFX2_DLLPUBLIC SfxModule : public SfxShell
 {
 private:
-    std::locale                 m_aResLocale;
-
     // Warning this cannot be turned into a unique_ptr.
     // SfxInterface destruction in the SfxSlotPool refers again to pImpl after deletion of pImpl has commenced. See tdf#100270
     SfxModule_Impl*             pImpl;
 
-    SAL_DLLPRIVATE void Construct_Impl();
+    SAL_DLLPRIVATE void Construct_Impl(const OString& rResName);
 
 public:
                                 SFX_DECL_INTERFACE(SFX_INTERFACE_SFXMODULE)
@@ -69,10 +67,10 @@ private:
 
 public:
 
-    SfxModule(const std::locale& rResLocale, std::initializer_list<SfxObjectFactory*> pFactoryList);
+    SfxModule(const OString& rResName, std::initializer_list<SfxObjectFactory*> pFactoryList);
     virtual ~SfxModule() override;
 
-    const std::locale&          GetResLocale() const { return m_aResLocale; }
+    std::locale                 GetResLocale() const;
     SfxSlotPool*                GetSlotPool() const;
 
     void                        RegisterToolBoxControl(const SfxTbxCtrlFactory&);
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 9812e37ce12f..acb719f787de 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -137,7 +137,7 @@ void ScModule::InitInterface_Impl()
 }
 
 ScModule::ScModule( SfxObjectFactory* pFact ) :
-    SfxModule( Translate::Create("sc"), {pFact} ),
+    SfxModule("sc", {pFact}),
     aIdleTimer("sc ScModule IdleTimer"),
     aSpellIdle("sc ScModule SpellIdle"),
     mpDragData(new ScDragData),
diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx
index 61dd5e6b10a4..9d9eaa53aecb 100644
--- a/sd/source/ui/app/sdmod.cxx
+++ b/sd/source/ui/app/sdmod.cxx
@@ -65,7 +65,7 @@ void SdModule::InitInterface_Impl()
 
 // Ctor
 SdModule::SdModule(SfxObjectFactory* pFact1, SfxObjectFactory* pFact2 )
-:   SfxModule( Translate::Create("sd"), {pFact1, pFact2} ),
+:   SfxModule("sd", {pFact1, pFact2}),
     pTransferClip(nullptr),
     pTransferDrag(nullptr),
     pTransferSelection(nullptr),
diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx
index ef37f8e41ada..3fb4376cc7a1 100644
--- a/sfx2/source/appl/module.cxx
+++ b/sfx2/source/appl/module.cxx
@@ -48,6 +48,7 @@ public:
     SfxTbxCtrlFactArr_Impl*     pTbxCtrlFac;
     SfxStbCtrlFactArr_Impl*     pStbCtrlFac;
     SfxChildWinFactArr_Impl*    pFactArr;
+    OString                     maResName;
 
                                 SfxModule_Impl();
                                 ~SfxModule_Impl();
@@ -68,11 +69,10 @@ SfxModule_Impl::~SfxModule_Impl()
 
 SFX_IMPL_SUPERCLASS_INTERFACE(SfxModule, SfxShell)
 
-SfxModule::SfxModule(const std::locale& rLocale, std::initializer_list<SfxObjectFactory*> pFactoryList)
-    : m_aResLocale(rLocale)
-    , pImpl(nullptr)
+SfxModule::SfxModule(const OString& rResName, std::initializer_list<SfxObjectFactory*> pFactoryList)
+    : pImpl(nullptr)
 {
-    Construct_Impl();
+    Construct_Impl(rResName);
     for (auto pFactory : pFactoryList)
     {
         if (pFactory)
@@ -80,7 +80,7 @@ SfxModule::SfxModule(const std::locale& rLocale, std::initializer_list<SfxObject
     }
 }
 
-void SfxModule::Construct_Impl()
+void SfxModule::Construct_Impl(const OString& rResName)
 {
     SfxApplication *pApp = SfxApplication::GetOrCreate();
     pImpl = new SfxModule_Impl;
@@ -89,6 +89,7 @@ void SfxModule::Construct_Impl()
     pImpl->pTbxCtrlFac=nullptr;
     pImpl->pStbCtrlFac=nullptr;
     pImpl->pFactArr=nullptr;
+    pImpl->maResName = rResName;
 
     SetPool( &pApp->GetPool() );
 }
@@ -102,6 +103,11 @@ SfxModule::~SfxModule()
     }
 }
 
+std::locale SfxModule::GetResLocale() const
+{
+    return Translate::Create(pImpl->maResName.getStr());
+}
+
 SfxSlotPool* SfxModule::GetSlotPool() const
 {
     return pImpl->pSlotPool;
diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx
index 08bec54144cf..02a8fec7a572 100644
--- a/starmath/source/smmod.cxx
+++ b/starmath/source/smmod.cxx
@@ -119,7 +119,7 @@ void SmModule::InitInterface_Impl()
 }
 
 SmModule::SmModule(SfxObjectFactory* pObjFact)
-    : SfxModule(Translate::Create("sm"), {pObjFact})
+    : SfxModule("sm", {pObjFact})
 {
     SetName("StarMath");
 
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index 71264ffd5bea..b4c271d66852 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -146,7 +146,7 @@ using namespace ::com::sun::star::uno;
 SwModule::SwModule( SfxObjectFactory* pWebFact,
                     SfxObjectFactory* pFact,
                     SfxObjectFactory* pGlobalFact )
-    : SfxModule( Translate::Create("sw"), {pWebFact, pFact, pGlobalFact} ),
+    : SfxModule("sw", {pWebFact, pFact, pGlobalFact}),
     m_pModuleConfig(nullptr),
     m_pUsrPref(nullptr),
     m_pWebUsrPref(nullptr),


More information about the Libreoffice-commits mailing list