summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-07-13 22:24:37 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-15 09:53:10 +0200
commit3e8ca5b50a6eb70118908c7741bbf26d23ae1574 (patch)
tree2bec67d50b2862a760a571e5c139d6d69378ff93 /stoc
parentfd5531534dc1e2f90d33f1d0cf9c0fe2cb9fd6f5 (diff)
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@collabora.co.uk>
Diffstat (limited to 'stoc')
-rw-r--r--stoc/source/invocation/invocation.component5
-rw-r--r--stoc/source/invocation/invocation.cxx43
2 files changed, 9 insertions, 39 deletions
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: */