summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-07-13 22:21:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-15 08:48:13 +0200
commit96ada688eaf7454791a5d8f8e0abe68e2c417e26 (patch)
treead02809be832653d8e1f29589e701ba30c3215f0 /stoc
parentd4813c671aa423feec8b457a3a8bea5c7671d118 (diff)
stoc/invocadapt: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: Ie1c953c58688a0dfbbc8a40385e400b8d0314f3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98699 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'stoc')
-rw-r--r--stoc/source/invocation_adapterfactory/iafactory.cxx49
-rw-r--r--stoc/source/invocation_adapterfactory/invocadapt.component5
2 files changed, 14 insertions, 40 deletions
diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx
index cfa05e15e585..65322c3a6234 100644
--- a/stoc/source/invocation_adapterfactory/iafactory.cxx
+++ b/stoc/source/invocation_adapterfactory/iafactory.cxx
@@ -23,6 +23,7 @@
#include <osl/mutex.hxx>
#include <o3tl/sorted_vector.hxx>
#include <sal/log.hxx>
+#include <rtl/ref.hxx>
#include <uno/dispatcher.h>
#include <uno/data.h>
@@ -30,9 +31,7 @@
#include <uno/lbnames.h>
#include <uno/mapping.hxx>
-#include <cppuhelper/factory.hxx>
#include <cppuhelper/implbase.hxx>
-#include <cppuhelper/implementationentry.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/script/XTypeConverter.hpp>
@@ -48,8 +47,6 @@
#include <unordered_set>
#include <vector>
-#define IMPLNAME "com.sun.star.comp.stoc.InvocationAdapterFactory"
-
using namespace ::std;
using namespace ::osl;
using namespace ::com::sun::star;
@@ -58,16 +55,6 @@ using namespace css::uno;
namespace stoc_invadp
{
-static Sequence< OUString > invadp_getSupportedServiceNames()
-{
- Sequence< OUString > seqNames { "com.sun.star.script.InvocationAdapterFactory" };
- return seqNames;
-}
-
-static OUString invadp_getImplementationName()
-{
- return IMPLNAME;
-}
namespace {
@@ -869,7 +856,7 @@ Reference< XInterface > FactoryImpl::createAdapter(
OUString FactoryImpl::getImplementationName()
{
- return invadp_getImplementationName();
+ return "com.sun.star.comp.stoc.InvocationAdapterFactory";
}
sal_Bool FactoryImpl::supportsService( const OUString & rServiceName )
@@ -879,36 +866,22 @@ sal_Bool FactoryImpl::supportsService( const OUString & rServiceName )
Sequence< OUString > FactoryImpl::getSupportedServiceNames()
{
- return invadp_getSupportedServiceNames();
-}
-
-/// @throws Exception
-static Reference< XInterface > FactoryImpl_create(
- const Reference< XComponentContext > & xContext )
-{
- return static_cast<cppu::OWeakObject *>(new FactoryImpl( xContext ));
+ return { "com.sun.star.script.InvocationAdapterFactory" };
}
}
-const struct ::cppu::ImplementationEntry g_entries[] =
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+stoc_invocation_adapter_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
- {
- ::stoc_invadp::FactoryImpl_create,
- ::stoc_invadp::invadp_getImplementationName,
- ::stoc_invadp::invadp_getSupportedServiceNames,
- ::cppu::createOneInstanceComponentFactory,
- nullptr, 0
- },
- { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
-};
+ static rtl::Reference<stoc_invadp::FactoryImpl> g_Instance(new stoc_invadp::FactoryImpl(context));
-extern "C" SAL_DLLPUBLIC_EXPORT void * invocadapt_component_getFactory(
- const char * pImplName, void * pServiceManager, void * pRegistryKey )
-{
- return ::cppu::component_getFactoryHelper(
- pImplName, pServiceManager, pRegistryKey , g_entries );
+ g_Instance->acquire();
+ return static_cast<cppu::OWeakObject*>(g_Instance.get());
}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/invocation_adapterfactory/invocadapt.component b/stoc/source/invocation_adapterfactory/invocadapt.component
index 85f29833808f..9dbf20e48bad 100644
--- a/stoc/source/invocation_adapterfactory/invocadapt.component
+++ b/stoc/source/invocation_adapterfactory/invocadapt.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="invocadapt" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.stoc.InvocationAdapterFactory">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.InvocationAdapterFactory"
+ constructor="stoc_invocation_adapter_get_implementation">
<service name="com.sun.star.script.InvocationAdapterFactory"/>
</implementation>
</component>