summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-07-13 22:07:23 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-15 10:05:23 +0200
commit0c688d3491c6f53ed06fbc5946e043e3b7509c63 (patch)
treed261e6eb6df55a21a52e16664f9dfa4af91b9405 /stoc
parent3e8ca5b50a6eb70118908c7741bbf26d23ae1574 (diff)
stoc/proxy: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: Ic55e4779af26378a41cf31465d4cafd429085596 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98696 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'stoc')
-rw-r--r--stoc/source/proxy_factory/proxyfac.component5
-rw-r--r--stoc/source/proxy_factory/proxyfac.cxx46
2 files changed, 11 insertions, 40 deletions
diff --git a/stoc/source/proxy_factory/proxyfac.component b/stoc/source/proxy_factory/proxyfac.component
index 69e573f5e761..eee87014ca98 100644
--- a/stoc/source/proxy_factory/proxyfac.component
+++ b/stoc/source/proxy_factory/proxyfac.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="proxyfac" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.reflection.ProxyFactory">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.reflection.ProxyFactory"
+ constructor="stoc_FactoryImpl_get_implementation">
<service name="com.sun.star.reflection.ProxyFactory"/>
</implementation>
</component>
diff --git a/stoc/source/proxy_factory/proxyfac.cxx b/stoc/source/proxy_factory/proxyfac.cxx
index 9c3afd927d03..cecb6d917b39 100644
--- a/stoc/source/proxy_factory/proxyfac.cxx
+++ b/stoc/source/proxy_factory/proxyfac.cxx
@@ -30,16 +30,12 @@
#include <typelib/typedescription.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase.hxx>
-#include <cppuhelper/implementationentry.hxx>
-#include <cppuhelper/factory.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/weakagg.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/reflection/XProxyFactory.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
-
-#define SERVICE_NAME "com.sun.star.reflection.ProxyFactory"
-#define IMPL_NAME "com.sun.star.comp.reflection.ProxyFactory"
+#include <com/sun/star/uno/XComponentContext.hpp>
using namespace ::com::sun::star;
@@ -49,17 +45,6 @@ using namespace css::uno;
namespace
{
-OUString proxyfac_getImplementationName()
-{
- return IMPL_NAME;
-}
-
-Sequence< OUString > proxyfac_getSupportedServiceNames()
-{
- return { SERVICE_NAME };
-}
-
-
struct FactoryImpl : public ::cppu::WeakImplHelper< lang::XServiceInfo,
reflection::XProxyFactory >
{
@@ -399,7 +384,7 @@ Reference< XAggregation > FactoryImpl::createProxy(
OUString FactoryImpl::getImplementationName()
{
- return proxyfac_getImplementationName();
+ return "com.sun.star.comp.reflection.ProxyFactory";
}
sal_Bool FactoryImpl::supportsService( const OUString & rServiceName )
@@ -409,12 +394,12 @@ sal_Bool FactoryImpl::supportsService( const OUString & rServiceName )
Sequence< OUString > FactoryImpl::getSupportedServiceNames()
{
- return proxyfac_getSupportedServiceNames();
+ return { "com.sun.star.reflection.ProxyFactory" };
}
-/// @throws Exception
-Reference< XInterface > proxyfac_create(
- SAL_UNUSED_PARAMETER Reference< XComponentContext > const & )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+stoc_FactoryImpl_get_implementation(
+ css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
{
Reference< XInterface > xRet;
static osl::Mutex s_mutex;
@@ -429,26 +414,11 @@ Reference< XInterface > proxyfac_create(
xRet = static_cast< ::cppu::OWeakObject * >(new FactoryImpl);
rwInstance = xRet;
}
- return xRet;
+ xRet->acquire();
+ return xRet.get();
}
-const ::cppu::ImplementationEntry g_entries [] =
-{
- {
- proxyfac_create, proxyfac_getImplementationName,
- proxyfac_getSupportedServiceNames, ::cppu::createSingleComponentFactory,
- nullptr, 0
- },
- { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
-};
}
-extern "C" SAL_DLLPUBLIC_EXPORT void * proxyfac_component_getFactory(
- const char * pImplName, void * pServiceManager, void * pRegistryKey )
-{
- return ::cppu::component_getFactoryHelper(
- pImplName, pServiceManager, pRegistryKey, g_entries );
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */