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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 15 07:53:54 UTC 2020


 stoc/source/invocation/invocation.component |    5 +--
 stoc/source/invocation/invocation.cxx       |   43 +++-------------------------
 2 files changed, 9 insertions(+), 39 deletions(-)

New commits:
commit 3e8ca5b50a6eb70118908c7741bbf26d23ae1574
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Jul 13 22:24:37 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 15 09:53:10 2020 +0200

    stoc/invocation: create instances with uno constructors
    
    See tdf#74608 for motivation.
    
    Change-Id: Idf47e3fff2ca0e693834bcdd228159b5725837e7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98700
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/stoc/source/invocation/invocation.component b/stoc/source/invocation/invocation.component
index c5aa8b5a33af..b5027a4d6d65 100644
--- a/stoc/source/invocation/invocation.component
+++ b/stoc/source/invocation/invocation.component
@@ -18,8 +18,9 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="invocation" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.stoc.Invocation">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.comp.stoc.Invocation"
+    constructor="stoc_InvocationService_get_implementation">
     <service name="com.sun.star.script.Invocation"/>
   </implementation>
 </component>
diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx
index c2fb1d0d280f..bffd68ab99de 100644
--- a/stoc/source/invocation/invocation.cxx
+++ b/stoc/source/invocation/invocation.cxx
@@ -21,8 +21,6 @@
 #include <cppuhelper/queryinterface.hxx>
 #include <cppuhelper/exc_hlp.hxx>
 #include <cppuhelper/weak.hxx>
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/implementationentry.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <cppuhelper/implbase.hxx>
 
@@ -49,31 +47,18 @@
 #include <memory>
 #include <vector>
 
-#define SERVICENAME "com.sun.star.script.Invocation"
-#define IMPLNAME     "com.sun.star.comp.stoc.Invocation"
-
 using namespace css::uno;
 using namespace css::lang;
 using namespace css::script;
 using namespace css::reflection;
 using namespace css::beans;
-using namespace css::registry;
 using namespace css::container;
 using namespace cppu;
 using namespace osl;
 
 namespace stoc_inv
 {
-static Sequence< OUString > inv_getSupportedServiceNames()
-{
-    Sequence< OUString > seqNames { SERVICENAME };
-    return seqNames;
-}
 
-static OUString inv_getImplementationName()
-{
-    return IMPLNAME;
-}
 
 // TODO: Implement centrally
 static Reference<XIdlClass> TypeToIdlClass( const Type& rType, const Reference< XIdlReflection > & xRefl )
@@ -1051,7 +1036,7 @@ InvocationService::InvocationService( const Reference<XComponentContext> & xCtx
 // XServiceInfo
 OUString InvocationService::getImplementationName()
 {
-    return inv_getImplementationName();
+    return "com.sun.star.comp.stoc.Invocation";
 }
 
 // XServiceInfo
@@ -1063,7 +1048,7 @@ sal_Bool InvocationService::supportsService(const OUString& ServiceName)
 // XServiceInfo
 Sequence< OUString > InvocationService::getSupportedServiceNames()
 {
-    return inv_getSupportedServiceNames();
+    return { "com.sun.star.script.Invocation" };
 }
 
 
@@ -1099,30 +1084,14 @@ Reference<XInterface> InvocationService::createInstanceWithArguments(
     return Reference<XInterface>();
 }
 
-/// @throws RuntimeException
-static Reference<XInterface> InvocationService_CreateInstance( const Reference<XComponentContext> & xCtx )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+stoc_InvocationService_get_implementation(
+    css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
 {
-    Reference<XInterface> xService( *new InvocationService( xCtx ) );
-    return xService;
+    return cppu::acquire(new InvocationService(context));
 }
 
 }
 
-using namespace stoc_inv;
-const struct ImplementationEntry g_entries[] =
-{
-    {
-        InvocationService_CreateInstance, inv_getImplementationName,
-        inv_getSupportedServiceNames, createSingleComponentFactory,
-        nullptr, 0
-    },
-    { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
-};
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * invocation_component_getFactory(
-    const char * pImplName, void * pServiceManager, void * pRegistryKey )
-{
-    return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
-}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list