diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-08-28 09:58:56 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-05 14:56:18 +0200 |
commit | 55aa40bcd6ae3116c63a0eac18056bcfd011f43a (patch) | |
tree | 847c45045ae4d1829f38046d9bd31c08971312ec /framework/inc | |
parent | 24f691867d02e853153a53e49276c2a8c30ea1fe (diff) |
Quick and dirty adaption of ModuleManager to WeakImplHelper
...to better be able to change its set of implemented interfaces later on.
Some potential for further clean up:
* a generic helper for supportsService;
* remove need for impl_createFactory;
* base impl_createInstance on XComponentContext instead of XMultiServiceFactory;
* replace ThreadHelpBase with a plain osl::Mutex.
Change-Id: Ia2cbd14872a609c2ed57d9ce58b546f087c2fdfb
Diffstat (limited to 'framework/inc')
-rw-r--r-- | framework/inc/services/modulemanager.hxx | 65 |
1 files changed, 43 insertions, 22 deletions
diff --git a/framework/inc/services/modulemanager.hxx b/framework/inc/services/modulemanager.hxx index 7d5950abf501..d50b0da116df 100644 --- a/framework/inc/services/modulemanager.hxx +++ b/framework/inc/services/modulemanager.hxx @@ -20,23 +20,23 @@ #ifndef __FRAMEWORK_SERVICES_MODULEMANAGER_HXX_ #define __FRAMEWORK_SERVICES_MODULEMANAGER_HXX_ +#include "sal/config.h" + #include <threadhelp/threadhelpbase.hxx> -#include <macros/xinterface.hxx> -#include <macros/xtypeprovider.hxx> -#include <macros/xserviceinfo.hxx> -#include <general.h> -#include <general.h> -#include <stdtypes.h> - -#include <com/sun/star/uno/XInterface.hpp> -#include <com/sun/star/lang/XTypeProvider.hpp> + +#include <boost/noncopyable.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/frame/XModuleManager.hpp> #include <com/sun/star/container/XNameReplace.hpp> #include <com/sun/star/container/XContainerQuery.hpp> +#include <cppuhelper/implbase4.hxx> + +namespace com { namespace sun { namespace star { namespace lang { + class XSingleServiceFactory; +} } } } -#include <cppuhelper/weak.hxx> +namespace css = com::sun::star; //_______________________________________________ // definition @@ -48,14 +48,11 @@ namespace framework /** implements the service com.sun.star.frame.ModuleManager */ -class ModuleManager : public css::lang::XTypeProvider - , public css::lang::XServiceInfo - , public css::frame::XModuleManager - , public css::container::XNameReplace // => XNameAccess, XElementAccess - , public css::container::XContainerQuery - // attention! Must be the first base class to guarentee right initialize lock ... - , private ThreadHelpBase - , public ::cppu::OWeakObject +class ModuleManager: + public cppu::WeakImplHelper4< + css::lang::XServiceInfo, css::frame::XModuleManager, + css::container::XNameReplace, css::container::XContainerQuery >, + private ThreadHelpBase, private boost::noncopyable { //___________________________________________ // member @@ -80,13 +77,37 @@ class ModuleManager : public css::lang::XTypeProvider public: + static rtl::OUString SAL_CALL impl_getStaticImplementationName(); + + static css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL + impl_createFactory( + css::uno::Reference< css::lang::XMultiServiceFactory > const & + manager); + + private: + + static css::uno::Sequence< rtl::OUString > + impl_getSupportedServiceNames(); + + static css::uno::Reference< css::uno::XInterface > SAL_CALL + impl_createInstance( + css::uno::Reference< css::lang::XMultiServiceFactory > const & + manager); + ModuleManager(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + virtual ~ModuleManager( ); - // XInterface, XTypeProvider, XServiceInfo - FWK_DECLARE_XINTERFACE - FWK_DECLARE_XTYPEPROVIDER - DECLARE_XSERVICEINFO + // XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL supportsService( + rtl::OUString const & ServiceName) + throw (css::uno::RuntimeException); + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (css::uno::RuntimeException); // XModuleManager virtual ::rtl::OUString SAL_CALL identify(const css::uno::Reference< css::uno::XInterface >& xModule) |