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
class Module : public SfxModule
{
public:
Module(const std::locale& rResLocale, SfxObjectFactory *pObjFact)
: SfxModule(rResLocale, {pObjFact})
Module(const OString& rResName, SfxObjectFactory *pObjFact)
: SfxModule(rResName, {pObjFact})
{
}
};
......
......@@ -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));
......
......@@ -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&);
......
......@@ -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),
......
......@@ -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),
......
......@@ -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;
......
......@@ -119,7 +119,7 @@ void SmModule::InitInterface_Impl()
}
SmModule::SmModule(SfxObjectFactory* pObjFact)
: SfxModule(Translate::Create("sm"), {pObjFact})
: SfxModule("sm", {pObjFact})
{
SetName("StarMath");
......
......@@ -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),
......
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