diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-12-19 08:48:56 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-12-19 08:48:56 +0100 |
commit | ae3a0c8da50b36db395984637f5ad74d3b4887bc (patch) | |
tree | c4936b9fba1f24d412d41474ebef44a5f094dbc8 /stoc | |
parent | Introduce osl::Module::release (diff) | |
download | core-ae3a0c8da50b36db395984637f5ad74d3b4887bc.tar.gz core-ae3a0c8da50b36db395984637f5ad74d3b4887bc.zip |
Add .component <implementation constructor="..." feature
...to directly call constructor functions of ComponentContext-based C++
implementations of (non-single-instance) UNO services. The case where these
calls would need to be bridged across different environments (e.g., from gcc3
to gcc3:affine) is not yet implemented.
bootstrap.component and expwrap.component are adapted accordingly as a proof-of-
concept (which had previously been adapted to use the prefix="direct" feature,
which may become unnecessary again in the end, depending on how to handle
single-instance services/singletons). More to follow.
Change-Id: I18682d75bcd29d3d427e31331b4ce8161dbb846d
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/source/defaultregistry/defaultregistry.cxx | 46 | ||||
-rw-r--r-- | stoc/source/implementationregistration/implreg.cxx | 42 | ||||
-rw-r--r-- | stoc/source/loader/dllcomponentloader.cxx | 51 | ||||
-rw-r--r-- | stoc/source/security/access_controller.cxx | 40 | ||||
-rw-r--r-- | stoc/source/security/file_policy.cxx | 37 | ||||
-rw-r--r-- | stoc/source/servicemanager/servicemanager.cxx | 115 | ||||
-rw-r--r-- | stoc/source/simpleregistry/simpleregistry.cxx | 42 | ||||
-rw-r--r-- | stoc/util/bootstrap.component | 29 |
8 files changed, 127 insertions, 275 deletions
diff --git a/stoc/source/defaultregistry/defaultregistry.cxx b/stoc/source/defaultregistry/defaultregistry.cxx index 7074683c1906..285e379d114e 100644 --- a/stoc/source/defaultregistry/defaultregistry.cxx +++ b/stoc/source/defaultregistry/defaultregistry.cxx @@ -21,7 +21,6 @@ #include <osl/diagnose.h> #include <cppuhelper/queryinterface.hxx> #include <cppuhelper/weak.hxx> -#include <cppuhelper/factory.hxx> #include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase4.hxx> #include <cppuhelper/implbase3.hxx> @@ -44,13 +43,6 @@ using namespace com::sun::star::container; using namespace cppu; using namespace osl; -static Sequence< OUString > NestedRegistryImpl_getSupportedServiceNames() -{ - Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = OUString("com.sun.star.registry.NestedRegistry"); - return seqNames; -} - namespace { class NestedKeyImpl; @@ -1207,7 +1199,9 @@ sal_Bool SAL_CALL NestedRegistryImpl::supportsService( const OUString& ServiceNa Sequence<OUString> SAL_CALL NestedRegistryImpl::getSupportedServiceNames( ) throw(RuntimeException) { - return NestedRegistryImpl_getSupportedServiceNames(); + Sequence< OUString > seqNames(1); + seqNames[0] = "com.sun.star.registry.NestedRegistry"; + return seqNames; } //************************************************************************* @@ -1355,32 +1349,16 @@ void SAL_CALL NestedRegistryImpl::mergeKey( const OUString& aKeyName, const OUSt } // namespace -static Reference<XInterface> NestedRegistry_CreateInstance( - SAL_UNUSED_PARAMETER const Reference<XComponentContext>& ) - throw(Exception) -{ - Reference<XInterface> xRet; - XSimpleRegistry *pRegistry = (XSimpleRegistry*) new NestedRegistryImpl; - - if (pRegistry) - { - xRet = Reference<XInterface>::query(pRegistry); - } - - return xRet; -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL -com_sun_star_comp_stoc_NestedRegistry_component_getFactory( - const char * , void * , void * ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_stoc_NestedRegistry( + SAL_UNUSED_PARAMETER css::uno::XComponentContext *, + uno_Sequence * arguments) { - Reference< XSingleComponentFactory > xFactory; - xFactory = createSingleComponentFactory( - NestedRegistry_CreateInstance, - "com.sun.star.comp.stoc.NestedRegistry", - NestedRegistryImpl_getSupportedServiceNames() ); - xFactory->acquire(); - return xFactory.get(); + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; + css::uno::Reference<css::uno::XInterface> x( + static_cast<cppu::OWeakObject *>(new NestedRegistryImpl)); + x->acquire(); + return x.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx index 4e8e6970fff5..3490320f9aa8 100644 --- a/stoc/source/implementationregistration/implreg.cxx +++ b/stoc/source/implementationregistration/implreg.cxx @@ -22,7 +22,6 @@ #include <list> #include <cppuhelper/queryinterface.hxx> -#include <cppuhelper/factory.hxx> #include <cppuhelper/weak.hxx> #include <cppuhelper/implbase3.hxx> #include <cppuhelper/implementationentry.hxx> @@ -63,9 +62,6 @@ using namespace com::sun::star::registry; using namespace cppu; using namespace osl; -#define IMPLNAME "com.sun.star.comp.stoc.ImplementationRegistration" -#define SERVICENAME "com.sun.star.registry.ImplementationRegistration" - namespace { struct StringPool @@ -113,13 +109,6 @@ const StringPool &spool() return *pPool; } -static Sequence< OUString > ImplementationRegistration_getSupportedServiceNames() -{ - Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = SERVICENAME; - return seqNames; -} - //************************************************************************* // static deleteAllLinkReferences() // @@ -1309,7 +1298,7 @@ ImplementationRegistration::~ImplementationRegistration() {} // XServiceInfo OUString ImplementationRegistration::getImplementationName() throw(RuntimeException) { - return OUString(IMPLNAME); + return OUString("com.sun.star.comp.stoc.ImplementationRegistration"); } // XServiceInfo @@ -1321,7 +1310,9 @@ sal_Bool ImplementationRegistration::supportsService(const OUString& ServiceName // XServiceInfo Sequence< OUString > ImplementationRegistration::getSupportedServiceNames(void) throw(RuntimeException) { - return ImplementationRegistration_getSupportedServiceNames(); + Sequence< OUString > seqNames(1); + seqNames[0] = "com.sun.star.registry.ImplementationRegistration"; + return seqNames; } Reference< XSimpleRegistry > ImplementationRegistration::getRegistryFromServiceManager() @@ -1825,23 +1816,16 @@ Reference< XSimpleRegistry > ImplementationRegistration::createTemporarySimpleRe } -static Reference<XInterface> ImplementationRegistration_CreateInstance( - const Reference<XComponentContext> & xCtx ) // throw(Exception) -{ - return (XImplementationRegistration *)new ImplementationRegistration(xCtx); -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL -com_sun_star_comp_stoc_ImplementationRegistration_component_getFactory( - const char * , void * , void * ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_stoc_ImplementationRegistration( + css::uno::XComponentContext * context, uno_Sequence * arguments) { - Reference< css::lang::XSingleComponentFactory > xFactory; - xFactory = createSingleComponentFactory( - ImplementationRegistration_CreateInstance, - IMPLNAME, - ImplementationRegistration_getSupportedServiceNames() ); - xFactory->acquire(); - return xFactory.get(); + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; + css::uno::Reference<css::uno::XInterface> x( + static_cast<cppu::OWeakObject *>( + new ImplementationRegistration(context))); + x->acquire(); + return x.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/loader/dllcomponentloader.cxx b/stoc/source/loader/dllcomponentloader.cxx index 402ed4a110af..d4ab87f1e05e 100644 --- a/stoc/source/loader/dllcomponentloader.cxx +++ b/stoc/source/loader/dllcomponentloader.cxx @@ -29,7 +29,6 @@ #include <uno/mapping.hxx> #include <cppuhelper/queryinterface.hxx> #include <cppuhelper/weak.hxx> -#include <cppuhelper/factory.hxx> #include <cppuhelper/shlib.hxx> #include <cppuhelper/implbase3.hxx> #include <cppuhelper/implementationentry.hxx> @@ -42,10 +41,6 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/registry/XRegistryKey.hpp> -#define SERVICENAME "com.sun.star.loader.SharedLibrary" -#define IMPLNAME "com.sun.star.comp.stoc.DLLComponentLoader" - - using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::loader; @@ -56,13 +51,6 @@ using namespace osl; namespace { -static Sequence< OUString > DllComponentLoader_getSupportedServiceNames() -{ - Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = OUString(SERVICENAME); - return seqNames; -} - class DllComponentLoader : public WeakImplHelper3< XImplementationLoader, XInitialization, @@ -101,7 +89,7 @@ DllComponentLoader::~DllComponentLoader() {} OUString SAL_CALL DllComponentLoader::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) { - return OUString(IMPLNAME); + return OUString("com.sun.star.comp.stoc.DLLComponentLoader"); } sal_Bool SAL_CALL DllComponentLoader::supportsService( const OUString& ServiceName ) @@ -113,7 +101,9 @@ sal_Bool SAL_CALL DllComponentLoader::supportsService( const OUString& ServiceNa Sequence<OUString> SAL_CALL DllComponentLoader::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) { - return DllComponentLoader_getSupportedServiceNames(); + Sequence< OUString > seqNames(1); + seqNames[0] = "com.sun.star.loader.SharedLibrary"; + return seqNames; } //************************************************************************* @@ -174,32 +164,15 @@ sal_Bool SAL_CALL DllComponentLoader::writeRegistryInfo( } -static Reference<XInterface> DllComponentLoader_CreateInstance( - const Reference<XComponentContext> & xCtx ) throw(Exception) -{ - Reference<XInterface> xRet; - - XImplementationLoader *pXLoader = (XImplementationLoader *)new DllComponentLoader(xCtx); - - if (pXLoader) - { - xRet = Reference<XInterface>::query(pXLoader); - } - - return xRet; -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL -com_sun_star_comp_stoc_DLLComponentLoader_component_getFactory( - const char * , void * , void * ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_stoc_DLLComponentLoader( + css::uno::XComponentContext * context, uno_Sequence * arguments) { - Reference< css::lang::XSingleComponentFactory > xFactory; - xFactory = createSingleComponentFactory( - DllComponentLoader_CreateInstance, - IMPLNAME, - DllComponentLoader_getSupportedServiceNames() ); - xFactory->acquire(); - return xFactory.get(); + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; + css::uno::Reference<css::uno::XInterface> x( + static_cast<cppu::OWeakObject *>(new DllComponentLoader(context))); + x->acquire(); + return x.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx index 6de5cceef057..07e3b58e719c 100644 --- a/stoc/source/security/access_controller.cxx +++ b/stoc/source/security/access_controller.cxx @@ -34,7 +34,6 @@ #include <cppuhelper/implbase1.hxx> #include <cppuhelper/compbase3.hxx> -#include <cppuhelper/factory.hxx> #include <cppuhelper/implementationentry.hxx> #include <cppuhelper/supportsservice.hxx> @@ -52,7 +51,6 @@ #define SERVICE_NAME "com.sun.star.security.AccessController" -#define IMPL_NAME "com.sun.star.security.comp.stoc.AccessController" #define USER_CREDS "access-control.user-credentials" @@ -962,7 +960,7 @@ Reference< security::XAccessControlContext > AccessController::getContext() OUString AccessController::getImplementationName() throw (RuntimeException) { - return OUString(IMPL_NAME); + return OUString("com.sun.star.security.comp.stoc.AccessController"); } //__________________________________________________________________________________________________ sal_Bool AccessController::supportsService( OUString const & serviceName ) @@ -971,39 +969,25 @@ sal_Bool AccessController::supportsService( OUString const & serviceName ) return cppu::supportsService(this, serviceName); } //__________________________________________________________________________________________________ -static Sequence< OUString > AccessController_getSupportedServiceNames() -{ - Sequence< OUString > aSNS( 1 ); - aSNS.getArray()[0] = OUString(SERVICE_NAME); - return aSNS; -} - Sequence< OUString > AccessController::getSupportedServiceNames() throw (RuntimeException) { - return AccessController_getSupportedServiceNames(); + Sequence< OUString > aSNS( 1 ); + aSNS[0] = OUString(SERVICE_NAME); + return aSNS; } } -static Reference< XInterface > SAL_CALL AccessController_create( - Reference< XComponentContext > const & xComponentContext ) - SAL_THROW( (Exception) ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_security_comp_stoc_AccessController( + css::uno::XComponentContext * context, uno_Sequence * arguments) { - return (OWeakObject *)new AccessController( xComponentContext ); -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL -com_sun_star_security_comp_stoc_AccessController_component_getFactory( - const char * , void * , void * ) -{ - Reference< css::lang::XSingleComponentFactory > xFactory; - xFactory = createSingleComponentFactory( - AccessController_create, - IMPL_NAME, - AccessController_getSupportedServiceNames() ); - xFactory->acquire(); - return xFactory.get(); + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; + css::uno::Reference<css::uno::XInterface> x( + static_cast<cppu::OWeakObject *>(new AccessController(context))); + x->acquire(); + return x.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx index 4d51240f6017..7d0ad08e4708 100644 --- a/stoc/source/security/file_policy.cxx +++ b/stoc/source/security/file_policy.cxx @@ -39,7 +39,6 @@ #include <com/sun/star/io/FilePermission.hpp> #include <com/sun/star/connection/SocketPermission.hpp> -#define SERVICE_NAME "com.sun.star.security.Policy" #define IMPL_NAME "com.sun.star.security.comp.stoc.FilePolicy" using namespace ::osl; @@ -532,39 +531,25 @@ sal_Bool FilePolicy::supportsService( OUString const & serviceName ) return cppu::supportsService(this, serviceName); } //__________________________________________________________________________________________________ -static Sequence< OUString > FilePolicy_getSupportedServiceNames() SAL_THROW(()) -{ - Sequence< OUString > aSNS( 1 ); - aSNS.getArray()[0] = OUString(SERVICE_NAME); - return aSNS; -} - Sequence< OUString > FilePolicy::getSupportedServiceNames() throw (RuntimeException) { - return FilePolicy_getSupportedServiceNames(); + Sequence< OUString > aSNS( 1 ); + aSNS[0] = OUString("com.sun.star.security.Policy"); + return aSNS; } } // namespace -static Reference< XInterface > FilePolicy_CreateInstance( - Reference< XComponentContext > const & xComponentContext ) - SAL_THROW( (Exception) ) -{ - return (OWeakObject *)new FilePolicy( xComponentContext ); -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL -com_sun_star_security_comp_stoc_FilePolicy_component_getFactory( - const char * , void * , void * ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_security_comp_stoc_FilePolicy( + css::uno::XComponentContext * context, uno_Sequence * arguments) { - Reference< css::lang::XSingleComponentFactory > xFactory; - xFactory = createSingleComponentFactory( - FilePolicy_CreateInstance, - IMPL_NAME, - FilePolicy_getSupportedServiceNames() ); - xFactory->acquire(); - return xFactory.get(); + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; + css::uno::Reference<css::uno::XInterface> x( + static_cast<cppu::OWeakObject *>(new FilePolicy(context))); + x->acquire(); + return x.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx index 97eda24b564c..9c96a7846fbf 100644 --- a/stoc/source/servicemanager/servicemanager.cxx +++ b/stoc/source/servicemanager/servicemanager.cxx @@ -28,7 +28,6 @@ #include <cppuhelper/queryinterface.hxx> #include <cppuhelper/weakref.hxx> #include <cppuhelper/component.hxx> -#include <cppuhelper/factory.hxx> #include <cppuhelper/implbase1.hxx> #include <cppuhelper/implementationentry.hxx> #include <cppuhelper/component_context.hxx> @@ -67,29 +66,6 @@ using namespace std; namespace { -Sequence< OUString > OServiceManager_getSupportedServiceNames() -{ - Sequence< OUString > seqNames(2); - seqNames.getArray()[0] = "com.sun.star.lang.MultiServiceFactory"; - seqNames.getArray()[1] = "com.sun.star.lang.ServiceManager"; - return seqNames; -} - -Sequence< OUString > ORegistryServiceManager_getSupportedServiceNames() -{ - Sequence< OUString > seqNames(2); - seqNames.getArray()[0] = "com.sun.star.lang.MultiServiceFactory"; - seqNames.getArray()[1] = "com.sun.star.lang.RegistryServiceManager"; - return seqNames; -} - -Sequence< OUString > OServiceManagerWrapper_getSupportedServiceNames() -{ - Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = "com.sun.star.lang.MultiServiceFactory"; - return seqNames; -} - static Sequence< OUString > retrieveAsciiValueList( const Reference< XSimpleRegistry > &xReg, const OUString &keyName ) { @@ -1083,7 +1059,6 @@ void OServiceManager::initialize( Sequence< Any > const & ) OUString OServiceManager::getImplementationName() throw(::com::sun::star::uno::RuntimeException) { - check_undisposed(); return OUString("com.sun.star.comp.stoc.OServiceManager"); } @@ -1098,8 +1073,10 @@ sal_Bool OServiceManager::supportsService(const OUString& ServiceName) Sequence< OUString > OServiceManager::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) { - check_undisposed(); - return OServiceManager_getSupportedServiceNames(); + Sequence< OUString > seqNames(2); + seqNames[0] = "com.sun.star.lang.MultiServiceFactory"; + seqNames[1] = "com.sun.star.lang.ServiceManager"; + return seqNames; } @@ -1601,8 +1578,10 @@ Sequence< OUString > ORegistryServiceManager::getAvailableServiceNames() Sequence< OUString > ORegistryServiceManager::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) { - check_undisposed(); - return ORegistryServiceManager_getSupportedServiceNames(); + Sequence< OUString > seqNames(2); + seqNames[0] = "com.sun.star.lang.MultiServiceFactory"; + seqNames[1] = "com.sun.star.lang.RegistryServiceManager"; + return seqNames; } @@ -1691,67 +1670,37 @@ Any ORegistryServiceManager::getPropertyValue(const OUString& PropertyName) } // namespace -static Reference<XInterface > OServiceManager_CreateInstance( - const Reference< XComponentContext > & xContext ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_stoc_OServiceManager( + css::uno::XComponentContext * context, uno_Sequence * arguments) { - return Reference<XInterface >( - static_cast< XInterface * >( - static_cast< OWeakObject * >( new OServiceManager( xContext ) ) ) ); -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL -com_sun_star_comp_stoc_OServiceManager_component_getFactory( - const char * , void * , void * ) -{ - Reference< css::lang::XSingleComponentFactory > xFactory; - xFactory = createSingleComponentFactory( - OServiceManager_CreateInstance, - "com.sun.star.comp.stoc.OServiceManager", - OServiceManager_getSupportedServiceNames() ); - xFactory->acquire(); - return xFactory.get(); + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; + css::uno::Reference<css::uno::XInterface> x( + static_cast<cppu::OWeakObject *>(new OServiceManager(context))); + x->acquire(); + return x.get(); } -static Reference<XInterface > ORegistryServiceManager_CreateInstance( - const Reference< XComponentContext > & xContext ) - throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_stoc_ORegistryServiceManager( + css::uno::XComponentContext * context, uno_Sequence * arguments) { - return Reference<XInterface >( - static_cast< XInterface * >( - static_cast< OWeakObject * >( new ORegistryServiceManager( xContext ) ) ) ); -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL -com_sun_star_comp_stoc_ORegistryServiceManager_component_getFactory( - const char * , void * , void * ) -{ - Reference< css::lang::XSingleComponentFactory > xFactory; - xFactory = createSingleComponentFactory( - ORegistryServiceManager_CreateInstance, - "com.sun.star.comp.stoc.ORegistryServiceManager", - ORegistryServiceManager_getSupportedServiceNames() ); - xFactory->acquire(); - return xFactory.get(); + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; + css::uno::Reference<css::uno::XInterface> x( + static_cast<cppu::OWeakObject *>(new ORegistryServiceManager(context))); + x->acquire(); + return x.get(); } -static Reference<XInterface > OServiceManagerWrapper_CreateInstance( - const Reference< XComponentContext > & xContext ) - throw (Exception) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_stoc_OServiceManagerWrapper( + css::uno::XComponentContext * context, uno_Sequence * arguments) { - return (OWeakObject *)new OServiceManagerWrapper( xContext ); -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL -com_sun_star_comp_stoc_OServiceManagerWrapper_component_getFactory( - const char * , void * , void * ) -{ - Reference< css::lang::XSingleComponentFactory > xFactory; - xFactory = createSingleComponentFactory( - OServiceManagerWrapper_CreateInstance, - "com.sun.star.comp.stoc.OServiceManagerWrapper", - OServiceManagerWrapper_getSupportedServiceNames() ); - xFactory->acquire(); - return xFactory.get(); + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; + css::uno::Reference<css::uno::XInterface> x( + static_cast<cppu::OWeakObject *>(new OServiceManagerWrapper(context))); + x->acquire(); + return x.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx index 80e30daeab0b..d1a761b46f63 100644 --- a/stoc/source/simpleregistry/simpleregistry.cxx +++ b/stoc/source/simpleregistry/simpleregistry.cxx @@ -34,9 +34,9 @@ #include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/Sequence.hxx" -#include <cppuhelper/factory.hxx> #include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase2.hxx" +#include "cppuhelper/supportsservice.hxx" #include "cppuhelper/weak.hxx" #include "osl/mutex.hxx" #include "registry/registry.hxx" @@ -52,12 +52,6 @@ namespace { -static css::uno::Sequence< OUString > SimpleRegistry_getSupportedServiceNames() { - css::uno::Sequence< OUString > names(1); - names[0] = "com.sun.star.registry.SimpleRegistry"; - return names; -} - class SimpleRegistry: public cppu::WeakImplHelper2< css::registry::XSimpleRegistry, css::lang::XServiceInfo > @@ -105,11 +99,15 @@ private: virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) throw (css::uno::RuntimeException) - { return ServiceName == getSupportedServiceNames()[0]; } + { return cppu::supportsService(this, ServiceName); } virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException) - { return SimpleRegistry_getSupportedServiceNames(); } + { + css::uno::Sequence< OUString > names(1); + names[0] = "com.sun.star.registry.SimpleRegistry"; + return names; + } Registry registry_; }; @@ -1125,24 +1123,16 @@ void SimpleRegistry::mergeKey( } -static css::uno::Reference< css::uno::XInterface > SimpleRegistry_CreateInstance( - SAL_UNUSED_PARAMETER css::uno::Reference< css::uno::XComponentContext > - const &) -{ - return static_cast< cppu::OWeakObject * >(new SimpleRegistry); -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL -com_sun_star_comp_stoc_SimpleRegistry_component_getFactory( - const char * , void * , void * ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_stoc_SimpleRegistry( + SAL_UNUSED_PARAMETER css::uno::XComponentContext *, + uno_Sequence * arguments) { - css::uno::Reference< css::lang::XSingleComponentFactory > xFactory; - xFactory = cppu::createSingleComponentFactory( - SimpleRegistry_CreateInstance, - "com.sun.star.comp.stoc.SimpleRegistry", - SimpleRegistry_getSupportedServiceNames() ); - xFactory->acquire(); - return xFactory.get(); + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; + css::uno::Reference<css::uno::XInterface> x( + static_cast<cppu::OWeakObject *>(new SimpleRegistry)); + x->acquire(); + return x.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/util/bootstrap.component b/stoc/util/bootstrap.component index f06de749e6ac..81f622e2d222 100644 --- a/stoc/util/bootstrap.component +++ b/stoc/util/bootstrap.component @@ -18,30 +18,39 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="direct" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.stoc.DLLComponentLoader"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.stoc.DLLComponentLoader" + constructor="com_sun_star_comp_stoc_DLLComponentLoader"> <service name="com.sun.star.loader.SharedLibrary"/> </implementation> - <implementation name="com.sun.star.comp.stoc.ImplementationRegistration"> + <implementation name="com.sun.star.comp.stoc.ImplementationRegistration" + constructor="com_sun_star_comp_stoc_ImplementationRegistration"> <service name="com.sun.star.registry.ImplementationRegistration"/> </implementation> - <implementation name="com.sun.star.comp.stoc.NestedRegistry"> + <implementation name="com.sun.star.comp.stoc.NestedRegistry" + constructor="com_sun_star_comp_stoc_NestedRegistry"> <service name="com.sun.star.registry.NestedRegistry"/> </implementation> - <implementation name="com.sun.star.comp.stoc.ORegistryServiceManager"> + <implementation name="com.sun.star.comp.stoc.ORegistryServiceManager" + constructor="com_sun_star_comp_stoc_ORegistryServiceManager"> <service name="com.sun.star.lang.RegistryServiceManager"/> </implementation> - <implementation name="com.sun.star.comp.stoc.OServiceManager"> + <implementation name="com.sun.star.comp.stoc.OServiceManager" + constructor="com_sun_star_comp_stoc_OServiceManager"> <service name="com.sun.star.lang.ServiceManager"/> </implementation> - <implementation name="com.sun.star.comp.stoc.OServiceManagerWrapper"/> - <implementation name="com.sun.star.comp.stoc.SimpleRegistry"> + <implementation name="com.sun.star.comp.stoc.OServiceManagerWrapper" + constructor="com_sun_star_comp_stoc_OServiceManagerWrapper"/> + <implementation name="com.sun.star.comp.stoc.SimpleRegistry" + constructor="com_sun_star_comp_stoc_SimpleRegistry"> <service name="com.sun.star.registry.SimpleRegistry"/> </implementation> - <implementation name="com.sun.star.security.comp.stoc.AccessController"> + <implementation name="com.sun.star.security.comp.stoc.AccessController" + constructor="com_sun_star_security_comp_stoc_AccessController"> <service name="com.sun.star.security.AccessController"/> </implementation> - <implementation name="com.sun.star.security.comp.stoc.FilePolicy"> + <implementation name="com.sun.star.security.comp.stoc.FilePolicy" + constructor="com_sun_star_security_comp_stoc_FilePolicy"> <service name="com.sun.star.security.Policy"/> </implementation> </component> |