diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-07-31 17:16:27 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-08-01 13:42:21 +0100 |
commit | b1d829e52e826b6ea4ae884a64fdb68b66c74dd7 (patch) | |
tree | d6aa2ee59178ecf5ea78e80917df18149ae9bb66 /extensions/source/inc/componentmodule.cxx | |
parent | tdf#110743: Use page position to insert master page, not id (diff) | |
download | core-b1d829e52e826b6ea4ae884a64fdb68b66c74dd7.tar.gz core-b1d829e52e826b6ea4ae884a64fdb68b66c74dd7.zip |
move resmgr to unotools
and the vast majority of translations is to the ui language so default
ctor with that arg
and now drop OModuleResourceClient
Change-Id: I3b85a560ffdfe5f019c2271ac56a5fe4a361522b
Diffstat (limited to 'extensions/source/inc/componentmodule.cxx')
-rw-r--r-- | extensions/source/inc/componentmodule.cxx | 75 |
1 files changed, 4 insertions, 71 deletions
diff --git a/extensions/source/inc/componentmodule.cxx b/extensions/source/inc/componentmodule.cxx index 619c5472ab6d..40273cf879de 100644 --- a/extensions/source/inc/componentmodule.cxx +++ b/extensions/source/inc/componentmodule.cxx @@ -19,7 +19,7 @@ #include <memory> #include "componentmodule.hxx" -#include <tools/resmgr.hxx> +#include <unotools/resmgr.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <svl/solar.hrc> @@ -27,89 +27,22 @@ #include <tools/debug.hxx> #include <rtl/strbuf.hxx> -#define ENTER_MOD_METHOD() \ - ::osl::MutexGuard aGuard(s_aMutex); \ - ensureImpl() - - namespace compmodule { - - using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::registry; using namespace ::comphelper; using namespace ::cppu; - // implementation for <type>OModule</type>. not threadsafe, has to be guarded by its owner - class OModuleImpl - { - std::locale m_aResLocale; - bool m_bInitialized; - - public: - /// ctor - OModuleImpl(); - - /// get the manager for the resources of the module - const std::locale& getResLocale(); - }; - - - OModuleImpl::OModuleImpl() - : m_bInitialized(false) - { - } - - const std::locale& OModuleImpl::getResLocale() + OUString ModuleRes(const char* pId) { - // note that this method is not threadsafe, which counts for the whole class ! - if (!m_bInitialized) - { - // create a manager with a fixed prefix - m_aResLocale = Translate::Create("pcr", Application::GetSettings().GetUILanguageTag()); - m_bInitialized = true; - } - return m_aResLocale; - } - - ::osl::Mutex OModule::s_aMutex; - sal_Int32 OModule::s_nClients = 0; - OModuleImpl* OModule::s_pImpl = nullptr; - - const std::locale& OModule::getResLocale() - { - ENTER_MOD_METHOD(); - return s_pImpl->getResLocale(); - } - - void OModule::registerClient() - { - ::osl::MutexGuard aGuard(s_aMutex); - ++s_nClients; - } - - void OModule::revokeClient() - { - ::osl::MutexGuard aGuard(s_aMutex); - if (!--s_nClients && s_pImpl) - { - delete s_pImpl; - s_pImpl = nullptr; - } - } - - void OModule::ensureImpl() - { - if (s_pImpl) - return; - s_pImpl = new OModuleImpl(); + static std::locale loc = Translate::Create("pcr"); + return Translate::get(pId, loc); } //- registration helper - std::vector< OUString >* OModule::s_pImplementationNames = nullptr; std::vector< Sequence< OUString > >* OModule::s_pSupportedServices = nullptr; std::vector< ComponentInstantiation >* OModule::s_pCreationFunctionPointers = nullptr; |