summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-07-31 17:16:27 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-08-01 13:42:21 +0100
commitb1d829e52e826b6ea4ae884a64fdb68b66c74dd7 (patch)
treed6aa2ee59178ecf5ea78e80917df18149ae9bb66 /extensions
parentf4e5940abbbaa3c2747108b0954e8912d164f3e5 (diff)
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')
-rw-r--r--extensions/CppunitTest_extensions_test_update.mk2
-rw-r--r--extensions/Library_updatecheckui.mk1
-rw-r--r--extensions/Library_updchk.mk2
-rw-r--r--extensions/source/abpilot/unodialogabp.hxx7
-rw-r--r--extensions/source/bibliography/bibmod.cxx4
-rw-r--r--extensions/source/dbpilots/unoautopilot.hxx1
-rw-r--r--extensions/source/inc/componentmodule.cxx75
-rw-r--r--extensions/source/inc/componentmodule.hxx37
-rw-r--r--extensions/source/propctrlr/modulepcr.cxx6
-rw-r--r--extensions/source/propctrlr/modulepcr.hxx6
-rw-r--r--extensions/source/scanner/sanedlg.cxx4
-rw-r--r--extensions/source/update/check/updatehdl.cxx4
-rw-r--r--extensions/source/update/ui/updatecheckui.cxx4
13 files changed, 26 insertions, 127 deletions
diff --git a/extensions/CppunitTest_extensions_test_update.mk b/extensions/CppunitTest_extensions_test_update.mk
index 18d312a0d019..e2cdaf58c315 100644
--- a/extensions/CppunitTest_extensions_test_update.mk
+++ b/extensions/CppunitTest_extensions_test_update.mk
@@ -23,7 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,extensions_test_update, \
sal \
salhelper \
test \
- tl \
+ utl \
unotest \
vcl \
))
diff --git a/extensions/Library_updatecheckui.mk b/extensions/Library_updatecheckui.mk
index a98cf964645b..86c59b608389 100644
--- a/extensions/Library_updatecheckui.mk
+++ b/extensions/Library_updatecheckui.mk
@@ -23,6 +23,7 @@ $(eval $(call gb_Library_use_sdk_api,updatecheckui))
$(eval $(call gb_Library_use_libraries,updatecheckui,\
vcl \
tl \
+ utl \
comphelper \
cppuhelper \
cppu \
diff --git a/extensions/Library_updchk.mk b/extensions/Library_updchk.mk
index 27928d1c94e2..269a0d4dd36b 100644
--- a/extensions/Library_updchk.mk
+++ b/extensions/Library_updchk.mk
@@ -23,7 +23,7 @@ $(eval $(call gb_Library_use_libraries,updchk,\
cppu \
sal \
salhelper \
- tl \
+ utl \
vcl \
))
diff --git a/extensions/source/abpilot/unodialogabp.hxx b/extensions/source/abpilot/unodialogabp.hxx
index b5532179b3ff..a2ab837a0bb4 100644
--- a/extensions/source/abpilot/unodialogabp.hxx
+++ b/extensions/source/abpilot/unodialogabp.hxx
@@ -33,10 +33,9 @@ namespace abp
typedef ::comphelper::OPropertyArrayUsageHelper< OABSPilotUno > OABSPilotUno_PBase;
/// the UNO wrapper for the address book source pilot
class OABSPilotUno
- :public compmodule::OModuleResourceClient
- ,public svt::OGenericUnoDialog
- ,public OABSPilotUno_JBase
- ,public OABSPilotUno_PBase
+ : public svt::OGenericUnoDialog
+ , public OABSPilotUno_JBase
+ , public OABSPilotUno_PBase
{
OUString m_sDataSourceName;
diff --git a/extensions/source/bibliography/bibmod.cxx b/extensions/source/bibliography/bibmod.cxx
index c40b83b2ac68..661a10f9f5e9 100644
--- a/extensions/source/bibliography/bibmod.cxx
+++ b/extensions/source/bibliography/bibmod.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <tools/resmgr.hxx>
+#include <unotools/resmgr.hxx>
#include <svl/urihelper.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
@@ -70,7 +70,7 @@ OUString BibResId(const char* pId)
BibConfig* BibModul::pBibConfig = nullptr;
BibModul::BibModul()
- : m_aResLocale(Translate::Create("pcr", Application::GetSettings().GetUILanguageTag()))
+ : m_aResLocale(Translate::Create("pcr"))
{
}
diff --git a/extensions/source/dbpilots/unoautopilot.hxx b/extensions/source/dbpilots/unoautopilot.hxx
index 5b148ffdcaa7..68180d2bb486 100644
--- a/extensions/source/dbpilots/unoautopilot.hxx
+++ b/extensions/source/dbpilots/unoautopilot.hxx
@@ -36,7 +36,6 @@ namespace dbp
class OUnoAutoPilot
:public OUnoAutoPilot_Base
,public ::comphelper::OPropertyArrayUsageHelper< OUnoAutoPilot< TYPE, SERVICEINFO > >
- ,public compmodule::OModuleResourceClient
{
explicit OUnoAutoPilot(const css::uno::Reference< css::uno::XComponentContext >& _rxORB)
: OUnoAutoPilot_Base(_rxORB)
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;
diff --git a/extensions/source/inc/componentmodule.hxx b/extensions/source/inc/componentmodule.hxx
index 163b394f7f15..92bb52d1de5a 100644
--- a/extensions/source/inc/componentmodule.hxx
+++ b/extensions/source/inc/componentmodule.hxx
@@ -26,7 +26,7 @@
*/
#include <osl/mutex.hxx>
-#include <tools/resmgr.hxx>
+#include <unotools/resmgr.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/uno/Sequence.hxx>
@@ -47,20 +47,12 @@ typedef css::uno::Reference< css::lang::XSingleServiceFactory > (SAL_CALL *Facto
rtl_ModuleCount*
);
- class OModuleImpl;
class OModule
{
- friend class OModuleResourceClient;
-
private:
OModule() = delete; //TODO: get rid of this class
protected:
- // resource administration
- static ::osl::Mutex s_aMutex; /// access safety
- static sal_Int32 s_nClients; /// number of registered clients
- static OModuleImpl* s_pImpl; /// impl class. lives as long as at least one client for the module is registered
-
// auto registration administration
static std::vector< OUString >*
s_pImplementationNames;
@@ -112,35 +104,10 @@ typedef css::uno::Reference< css::lang::XSingleServiceFactory > (SAL_CALL *Facto
const OUString& _rImplementationName,
const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxServiceManager
);
-
- protected:
- /// register a client for the module
- static void registerClient();
- /// revoke a client for the module
- static void revokeClient();
-
- private:
- /** ensure that the impl class exists
- @precond m_aMutex is guarded when this method gets called
- */
- static void ensureImpl();
};
-
- // base class for objects which uses any global module-specific resources
- class OModuleResourceClient
- {
- public:
- OModuleResourceClient() { OModule::registerClient(); }
- ~OModuleResourceClient() { OModule::revokeClient(); }
- };
-
-
// specialized ResId, using the resource locale provided by the global module
- static inline OUString ModuleRes(const char* pId)
- {
- return Translate::get(pId, OModule::getResLocale());
- }
+ OUString ModuleRes(const char* pId);
template <class TYPE>
class OMultiInstanceAutoRegistration
diff --git a/extensions/source/propctrlr/modulepcr.cxx b/extensions/source/propctrlr/modulepcr.cxx
index 56931b21bc14..8fedf6499ad0 100644
--- a/extensions/source/propctrlr/modulepcr.cxx
+++ b/extensions/source/propctrlr/modulepcr.cxx
@@ -21,7 +21,7 @@
#include <rtl/instance.hxx>
#include <osl/getglobalmutex.hxx>
-#include <tools/resmgr.hxx>
+#include <unotools/resmgr.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
@@ -44,7 +44,6 @@ namespace pcr
};
PcrModule::PcrModule()
- :BaseClass( OString( "pcr" ), Application::GetSettings().GetUILanguageTag() )
{
}
@@ -56,7 +55,8 @@ namespace pcr
OUString PcrRes(const char* pId)
{
- return Translate::get(pId, PcrModule::getInstance().getResLocale());
+ static std::locale loc = Translate::Create("pcr");
+ return Translate::get(pId, loc);
}
} // namespace pcr
diff --git a/extensions/source/propctrlr/modulepcr.hxx b/extensions/source/propctrlr/modulepcr.hxx
index 652ff0b93f8a..6fcbfef5100f 100644
--- a/extensions/source/propctrlr/modulepcr.hxx
+++ b/extensions/source/propctrlr/modulepcr.hxx
@@ -20,15 +20,15 @@
#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_MODULEPCR_HXX
#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_MODULEPCR_HXX
-#include <unotools/componentresmodule.hxx>
+#include <comphelper/componentmodule.hxx>
namespace pcr
{
/* -------------------------------------------------------------------- */
- class PcrModule : public ::utl::OComponentResourceModule
+ class PcrModule : public ::comphelper::OModule
{
friend struct CreateModuleClass;
- typedef ::utl::OComponentResourceModule BaseClass;
+ typedef ::comphelper::OModule BaseClass;
public:
static PcrModule& getInstance();
private:
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index 5294357a30c2..8bf4fb01fdab 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <tools/config.hxx>
-#include <tools/resmgr.hxx>
+#include <unotools/resmgr.hxx>
#include <vcl/dibtools.hxx>
#include <vcl/layout.hxx>
#include <vcl/settings.hxx>
@@ -321,7 +321,7 @@ namespace {
OUString SaneResId(const char *pID)
{
- static std::locale loc = Translate::Create("pcr", Application::GetSettings().GetUILanguageTag());
+ static std::locale loc = Translate::Create("pcr");
return Translate::get(pID, loc);
}
diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx
index 4c4eca89b045..81bdee096fa2 100644
--- a/extensions/source/update/check/updatehdl.cxx
+++ b/extensions/source/update/check/updatehdl.cxx
@@ -61,7 +61,7 @@
#include "com/sun/star/task/InteractionRequestStringResolver.hpp"
#include "strings.hrc"
-#include <tools/resmgr.hxx>
+#include <unotools/resmgr.hxx>
#include <tools/urlobj.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
@@ -614,7 +614,7 @@ void UpdateHandler::loadStrings()
else
mbStringsLoaded = true;
- std::locale loc = Translate::Create("pcr", Application::GetSettings().GetUILanguageTag());
+ std::locale loc = Translate::Create("pcr");
msChecking = loadString( loc, RID_UPDATE_STR_CHECKING );
msCheckingError = loadString( loc, RID_UPDATE_STR_CHECKING_ERR );
diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx
index b271c8f4eea2..2e334fc2c361 100644
--- a/extensions/source/update/ui/updatecheckui.cxx
+++ b/extensions/source/update/ui/updatecheckui.cxx
@@ -33,7 +33,7 @@
#include <com/sun/star/graphic/XGraphicProvider.hpp>
#include <com/sun/star/task/XJob.hpp>
#include <comphelper/processfactory.hxx>
-#include <tools/resmgr.hxx>
+#include <unotools/resmgr.hxx>
#include <vcl/window.hxx>
#include <vcl/floatwin.hxx>
#include <vcl/timer.hxx>
@@ -196,7 +196,7 @@ UpdateCheckUI::UpdateCheckUI(const uno::Reference<uno::XComponentContext>& xCont
, mbBubbleChanged( false )
, mnIconID( 0 )
{
- maSfxLocale = Translate::Create("sfx", Application::GetSettings().GetUILanguageTag());
+ maSfxLocale = Translate::Create("sfx");
maBubbleImage = GetBubbleImage( maBubbleImageURL );