Kaydet (Commit) 028fd03c authored tarafından Jan Holesovsky's avatar Jan Holesovsky

lokdialog: Allow language switching in SfxModule(s).

Change-Id: Icef0b3610c3bfa858cdd61de6ef3f5edc1e3c96b
Reviewed-on: https://gerrit.libreoffice.org/47385Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJan Holesovsky <kendy@collabora.com>
üst f1d1854f
...@@ -29,8 +29,8 @@ namespace basctl ...@@ -29,8 +29,8 @@ namespace basctl
class Module : public SfxModule class Module : public SfxModule
{ {
public: public:
Module(const std::locale& rResLocale, SfxObjectFactory *pObjFact) Module(const OString& rResName, SfxObjectFactory *pObjFact)
: SfxModule(rResLocale, {pObjFact}) : SfxModule(rResName, {pObjFact})
{ {
} }
}; };
......
...@@ -118,9 +118,7 @@ Dll::Dll () : ...@@ -118,9 +118,7 @@ Dll::Dll () :
{ {
SfxObjectFactory& rFactory = DocShell::Factory(); SfxObjectFactory& rFactory = DocShell::Factory();
std::locale loc = Translate::Create("basctl"); auto pModule = o3tl::make_unique<Module>("basctl", &rFactory);
auto pModule = o3tl::make_unique<Module>(loc, &rFactory);
SfxModule* pMod = pModule.get(); SfxModule* pMod = pModule.get();
SfxApplication::SetModule(SfxToolsModule::Basic, std::move(pModule)); SfxApplication::SetModule(SfxToolsModule::Basic, std::move(pModule));
......
...@@ -52,13 +52,11 @@ namespace com { namespace sun { namespace star { namespace frame { ...@@ -52,13 +52,11 @@ namespace com { namespace sun { namespace star { namespace frame {
class SFX2_DLLPUBLIC SfxModule : public SfxShell class SFX2_DLLPUBLIC SfxModule : public SfxShell
{ {
private: private:
std::locale m_aResLocale;
// Warning this cannot be turned into a unique_ptr. // 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 // SfxInterface destruction in the SfxSlotPool refers again to pImpl after deletion of pImpl has commenced. See tdf#100270
SfxModule_Impl* pImpl; SfxModule_Impl* pImpl;
SAL_DLLPRIVATE void Construct_Impl(); SAL_DLLPRIVATE void Construct_Impl(const OString& rResName);
public: public:
SFX_DECL_INTERFACE(SFX_INTERFACE_SFXMODULE) SFX_DECL_INTERFACE(SFX_INTERFACE_SFXMODULE)
...@@ -69,10 +67,10 @@ private: ...@@ -69,10 +67,10 @@ private:
public: public:
SfxModule(const std::locale& rResLocale, std::initializer_list<SfxObjectFactory*> pFactoryList); SfxModule(const OString& rResName, std::initializer_list<SfxObjectFactory*> pFactoryList);
virtual ~SfxModule() override; virtual ~SfxModule() override;
const std::locale& GetResLocale() const { return m_aResLocale; } std::locale GetResLocale() const;
SfxSlotPool* GetSlotPool() const; SfxSlotPool* GetSlotPool() const;
void RegisterToolBoxControl(const SfxTbxCtrlFactory&); void RegisterToolBoxControl(const SfxTbxCtrlFactory&);
......
...@@ -137,7 +137,7 @@ void ScModule::InitInterface_Impl() ...@@ -137,7 +137,7 @@ void ScModule::InitInterface_Impl()
} }
ScModule::ScModule( SfxObjectFactory* pFact ) : ScModule::ScModule( SfxObjectFactory* pFact ) :
SfxModule( Translate::Create("sc"), {pFact} ), SfxModule("sc", {pFact}),
aIdleTimer("sc ScModule IdleTimer"), aIdleTimer("sc ScModule IdleTimer"),
aSpellIdle("sc ScModule SpellIdle"), aSpellIdle("sc ScModule SpellIdle"),
mpDragData(new ScDragData), mpDragData(new ScDragData),
......
...@@ -65,7 +65,7 @@ void SdModule::InitInterface_Impl() ...@@ -65,7 +65,7 @@ void SdModule::InitInterface_Impl()
// Ctor // Ctor
SdModule::SdModule(SfxObjectFactory* pFact1, SfxObjectFactory* pFact2 ) SdModule::SdModule(SfxObjectFactory* pFact1, SfxObjectFactory* pFact2 )
: SfxModule( Translate::Create("sd"), {pFact1, pFact2} ), : SfxModule("sd", {pFact1, pFact2}),
pTransferClip(nullptr), pTransferClip(nullptr),
pTransferDrag(nullptr), pTransferDrag(nullptr),
pTransferSelection(nullptr), pTransferSelection(nullptr),
......
...@@ -48,6 +48,7 @@ public: ...@@ -48,6 +48,7 @@ public:
SfxTbxCtrlFactArr_Impl* pTbxCtrlFac; SfxTbxCtrlFactArr_Impl* pTbxCtrlFac;
SfxStbCtrlFactArr_Impl* pStbCtrlFac; SfxStbCtrlFactArr_Impl* pStbCtrlFac;
SfxChildWinFactArr_Impl* pFactArr; SfxChildWinFactArr_Impl* pFactArr;
OString maResName;
SfxModule_Impl(); SfxModule_Impl();
~SfxModule_Impl(); ~SfxModule_Impl();
...@@ -68,11 +69,10 @@ SfxModule_Impl::~SfxModule_Impl() ...@@ -68,11 +69,10 @@ SfxModule_Impl::~SfxModule_Impl()
SFX_IMPL_SUPERCLASS_INTERFACE(SfxModule, SfxShell) SFX_IMPL_SUPERCLASS_INTERFACE(SfxModule, SfxShell)
SfxModule::SfxModule(const std::locale& rLocale, std::initializer_list<SfxObjectFactory*> pFactoryList) SfxModule::SfxModule(const OString& rResName, std::initializer_list<SfxObjectFactory*> pFactoryList)
: m_aResLocale(rLocale) : pImpl(nullptr)
, pImpl(nullptr)
{ {
Construct_Impl(); Construct_Impl(rResName);
for (auto pFactory : pFactoryList) for (auto pFactory : pFactoryList)
{ {
if (pFactory) if (pFactory)
...@@ -80,7 +80,7 @@ SfxModule::SfxModule(const std::locale& rLocale, std::initializer_list<SfxObject ...@@ -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(); SfxApplication *pApp = SfxApplication::GetOrCreate();
pImpl = new SfxModule_Impl; pImpl = new SfxModule_Impl;
...@@ -89,6 +89,7 @@ void SfxModule::Construct_Impl() ...@@ -89,6 +89,7 @@ void SfxModule::Construct_Impl()
pImpl->pTbxCtrlFac=nullptr; pImpl->pTbxCtrlFac=nullptr;
pImpl->pStbCtrlFac=nullptr; pImpl->pStbCtrlFac=nullptr;
pImpl->pFactArr=nullptr; pImpl->pFactArr=nullptr;
pImpl->maResName = rResName;
SetPool( &pApp->GetPool() ); SetPool( &pApp->GetPool() );
} }
...@@ -102,6 +103,11 @@ SfxModule::~SfxModule() ...@@ -102,6 +103,11 @@ SfxModule::~SfxModule()
} }
} }
std::locale SfxModule::GetResLocale() const
{
return Translate::Create(pImpl->maResName.getStr());
}
SfxSlotPool* SfxModule::GetSlotPool() const SfxSlotPool* SfxModule::GetSlotPool() const
{ {
return pImpl->pSlotPool; return pImpl->pSlotPool;
......
...@@ -119,7 +119,7 @@ void SmModule::InitInterface_Impl() ...@@ -119,7 +119,7 @@ void SmModule::InitInterface_Impl()
} }
SmModule::SmModule(SfxObjectFactory* pObjFact) SmModule::SmModule(SfxObjectFactory* pObjFact)
: SfxModule(Translate::Create("sm"), {pObjFact}) : SfxModule("sm", {pObjFact})
{ {
SetName("StarMath"); SetName("StarMath");
......
...@@ -146,7 +146,7 @@ using namespace ::com::sun::star::uno; ...@@ -146,7 +146,7 @@ using namespace ::com::sun::star::uno;
SwModule::SwModule( SfxObjectFactory* pWebFact, SwModule::SwModule( SfxObjectFactory* pWebFact,
SfxObjectFactory* pFact, SfxObjectFactory* pFact,
SfxObjectFactory* pGlobalFact ) SfxObjectFactory* pGlobalFact )
: SfxModule( Translate::Create("sw"), {pWebFact, pFact, pGlobalFact} ), : SfxModule("sw", {pWebFact, pFact, pGlobalFact}),
m_pModuleConfig(nullptr), m_pModuleConfig(nullptr),
m_pUsrPref(nullptr), m_pUsrPref(nullptr),
m_pWebUsrPref(nullptr), m_pWebUsrPref(nullptr),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment