From ae3a0c8da50b36db395984637f5ad74d3b4887bc Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 19 Dec 2013 08:48:56 +0100 Subject: Add .component #include #include -#include #include #include #include @@ -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 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 NestedRegistry_CreateInstance( - SAL_UNUSED_PARAMETER const Reference& ) - throw(Exception) -{ - Reference xRet; - XSimpleRegistry *pRegistry = (XSimpleRegistry*) new NestedRegistryImpl; - - if (pRegistry) - { - xRet = Reference::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 x( + static_cast(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 #include -#include #include #include #include @@ -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 ImplementationRegistration_CreateInstance( - const Reference & 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 x( + static_cast( + 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 #include #include -#include #include #include #include @@ -42,10 +41,6 @@ #include #include -#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 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 DllComponentLoader_CreateInstance( - const Reference & xCtx ) throw(Exception) -{ - Reference xRet; - - XImplementationLoader *pXLoader = (XImplementationLoader *)new DllComponentLoader(xCtx); - - if (pXLoader) - { - xRet = Reference::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 x( + static_cast(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 #include -#include #include #include @@ -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 x( + static_cast(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 #include -#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 x( + static_cast(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 #include #include -#include #include #include #include @@ -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 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( - 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 x( + static_cast(new OServiceManager(context))); + x->acquire(); + return x.get(); } -static Reference 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( - 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 x( + static_cast(new ORegistryServiceManager(context))); + x->acquire(); + return x.get(); } -static Reference 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 x( + static_cast(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 #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 x( + static_cast(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 @@ --> - + xmlns="http://openoffice.org/2010/uno-components"> + - + - + - + - + - - + + - + - + -- cgit