diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-07-13 22:10:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-14 18:30:58 +0200 |
commit | 17363342935e38f463cf879682009534aab9fa7e (patch) | |
tree | bb94520058f9089561a38e2b34f907c31a2a072a | |
parent | b9b638f2cfdfe8c82363e13ad1b1b606316a45e5 (diff) |
stoc/naming: create instances with uno constructors
See tdf#74608 for motivation.
Change-Id: Iaa8805141e480e05badd92c61a455e46bd411e87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98697
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | stoc/source/namingservice/namingservice.component | 5 | ||||
-rw-r--r-- | stoc/source/namingservice/namingservice.cxx | 42 |
2 files changed, 10 insertions, 37 deletions
diff --git a/stoc/source/namingservice/namingservice.component b/stoc/source/namingservice/namingservice.component index 523c0037363b..3ba192e866e1 100644 --- a/stoc/source/namingservice/namingservice.component +++ b/stoc/source/namingservice/namingservice.component @@ -18,8 +18,9 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="namingservice" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.stoc.NamingService"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.stoc.NamingService" + constructor="stoc_NamingService_Impl_get_implementation"> <service name="com.sun.star.uno.NamingService"/> </implementation> </component> diff --git a/stoc/source/namingservice/namingservice.cxx b/stoc/source/namingservice/namingservice.cxx index cfecc0a7c795..29142064d537 100644 --- a/stoc/source/namingservice/namingservice.cxx +++ b/stoc/source/namingservice/namingservice.cxx @@ -38,23 +38,9 @@ using namespace css::lang; using namespace css::registry; -#define SERVICENAME "com.sun.star.uno.NamingService" -#define IMPLNAME "com.sun.star.comp.stoc.NamingService" - namespace stoc_namingservice { -static Sequence< OUString > ns_getSupportedServiceNames() -{ - Sequence< OUString > seqNames { SERVICENAME }; - return seqNames; -} - -static OUString ns_getImplementationName() -{ - return IMPLNAME; -} - typedef std::unordered_map< OUString, Reference<XInterface > > HashMap_OWString_Interface; namespace { @@ -79,11 +65,6 @@ public: } -static Reference<XInterface> NamingService_Impl_create( - SAL_UNUSED_PARAMETER const Reference<XComponentContext> & ) -{ - return *new NamingService_Impl(); -} NamingService_Impl::NamingService_Impl() {} @@ -91,7 +72,7 @@ NamingService_Impl::NamingService_Impl() {} // XServiceInfo OUString NamingService_Impl::getImplementationName() { - return ns_getImplementationName(); + return "com.sun.star.comp.stoc.NamingService"; } // XServiceInfo @@ -103,7 +84,7 @@ sal_Bool NamingService_Impl::supportsService( const OUString & rServiceName ) // XServiceInfo Sequence< OUString > NamingService_Impl::getSupportedServiceNames() { - return ns_getSupportedServiceNames(); + return { "com.sun.star.uno.NamingService" }; } // XServiceInfo @@ -133,21 +114,12 @@ void NamingService_Impl::revokeObject( const OUString& Name ) } -using namespace stoc_namingservice; -const struct ImplementationEntry g_entries[] = -{ - { - NamingService_Impl_create, ns_getImplementationName, - ns_getSupportedServiceNames, createSingleComponentFactory, - nullptr, 0 - }, - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } -}; - -extern "C" SAL_DLLPUBLIC_EXPORT void * namingservice_component_getFactory( - const char * pImplName, void * pServiceManager, void * pRegistryKey ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +stoc_NamingService_Impl_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries ); + return cppu::acquire(new stoc_namingservice::NamingService_Impl()); } + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |