summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2018-01-03 14:08:55 +0100
committerJan Holesovsky <kendy@collabora.com>2018-01-04 11:24:27 +0100
commitb37e7aa35a1c927a7154f87c7f1ce75ce5a6a229 (patch)
tree9809a93d53565bef478a206d8ada58f4d79b81d0 /sfx2
parented16e39ac696c58985a1eab2cefb880126e06428 (diff)
lokdialog: Allow language switching in SfxModule(s).
Change-Id: Icef0b3610c3bfa858cdd61de6ef3f5edc1e3c96b Reviewed-on: https://gerrit.libreoffice.org/47333 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/module.cxx23
1 files changed, 15 insertions, 8 deletions
diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx
index 830f7eb7696a..ca784f88c735 100644
--- a/sfx2/source/appl/module.cxx
+++ b/sfx2/source/appl/module.cxx
@@ -53,6 +53,8 @@ public:
SfxChildWinFactArr_Impl* pFactArr;
ImageList* pImgListSmall;
ImageList* pImgListBig;
+ OString maResName;
+ std::unique_ptr<ResMgr> mpResMgr;
SfxModule_Impl();
~SfxModule_Impl();
@@ -94,18 +96,23 @@ ImageList* SfxModule_Impl::GetImageList( ResMgr* pResMgr, bool bBig )
return rpList;
}
-
SFX_IMPL_SUPERCLASS_INTERFACE(SfxModule, SfxShell)
ResMgr* SfxModule::GetResMgr()
{
- return pResMgr;
+ assert(pImpl);
+
+ const LanguageTag& rLocale = Application::GetSettings().GetUILanguageTag();
+
+ if (!pImpl->mpResMgr || pImpl->mpResMgr->GetLocale() != rLocale)
+ pImpl->mpResMgr.reset(ResMgr::CreateResMgr(pImpl->maResName.getStr(), rLocale));
+ return pImpl->mpResMgr.get();
}
-SfxModule::SfxModule( ResMgr* pMgrP, std::initializer_list<SfxObjectFactory*> pFactoryList )
- : pResMgr( pMgrP ), 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)
@@ -113,7 +120,7 @@ SfxModule::SfxModule( ResMgr* pMgrP, std::initializer_list<SfxObjectFactory*> pF
}
}
-void SfxModule::Construct_Impl()
+void SfxModule::Construct_Impl(const OString& rResName)
{
SfxApplication *pApp = SfxApplication::GetOrCreate();
pImpl = new SfxModule_Impl;
@@ -124,6 +131,7 @@ void SfxModule::Construct_Impl()
pImpl->pFactArr=nullptr;
pImpl->pImgListSmall=nullptr;
pImpl->pImgListBig=nullptr;
+ pImpl->maResName = rResName;
SetPool( &pApp->GetPool() );
}
@@ -132,7 +140,6 @@ void SfxModule::Construct_Impl()
SfxModule::~SfxModule()
{
delete pImpl;
- delete pResMgr;
}
@@ -223,7 +230,7 @@ SfxChildWinFactArr_Impl* SfxModule::GetChildWinFactories_Impl() const
ImageList* SfxModule::GetImageList_Impl( bool bBig )
{
- return pImpl->GetImageList( pResMgr, bBig );
+ return pImpl->GetImageList(GetResMgr(), bBig);
}
VclPtr<SfxTabPage> SfxModule::CreateTabPage( sal_uInt16, vcl::Window*, const SfxItemSet& )