From b1d829e52e826b6ea4ae884a64fdb68b66c74dd7 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 31 Jul 2017 17:16:27 +0100 Subject: 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 --- extensions/source/inc/componentmodule.cxx | 75 ++----------------------------- 1 file changed, 4 insertions(+), 71 deletions(-) (limited to 'extensions/source/inc/componentmodule.cxx') 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 #include "componentmodule.hxx" -#include +#include #include #include #include @@ -27,89 +27,22 @@ #include #include -#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 OModule. 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; -- cgit