[Libreoffice-commits] core.git: stoc/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 14 16:31:41 UTC 2020


 stoc/source/namingservice/namingservice.component |    5 +-
 stoc/source/namingservice/namingservice.cxx       |   42 +++-------------------
 2 files changed, 10 insertions(+), 37 deletions(-)

New commits:
commit 17363342935e38f463cf879682009534aab9fa7e
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Jul 13 22:10:54 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 14 18:30:58 2020 +0200

    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 at collabora.co.uk>

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: */


More information about the Libreoffice-commits mailing list