eventattacher: create instances with uno constructors
See tdf#74608 for motivation Change-Id: I61ae7e662c984961b507bf0394fcf8cf25496f0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98218 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -40,6 +40,7 @@
|
|||||||
#include <cppuhelper/factory.hxx>
|
#include <cppuhelper/factory.hxx>
|
||||||
#include <cppuhelper/implbase.hxx>
|
#include <cppuhelper/implbase.hxx>
|
||||||
#include <cppuhelper/supportsservice.hxx>
|
#include <cppuhelper/supportsservice.hxx>
|
||||||
|
#include <rtl/ref.hxx>
|
||||||
|
|
||||||
namespace com::sun::star::lang { class XMultiServiceFactory; }
|
namespace com::sun::star::lang { class XMultiServiceFactory; }
|
||||||
|
|
||||||
@@ -53,9 +54,6 @@ using namespace cppu;
|
|||||||
using namespace osl;
|
using namespace osl;
|
||||||
|
|
||||||
|
|
||||||
#define SERVICENAME "com.sun.star.script.EventAttacher"
|
|
||||||
#define IMPLNAME "com.sun.star.comp.EventAttacher"
|
|
||||||
|
|
||||||
namespace comp_EventAttacher {
|
namespace comp_EventAttacher {
|
||||||
|
|
||||||
|
|
||||||
@@ -213,7 +211,6 @@ public:
|
|||||||
virtual OUString SAL_CALL getImplementationName( ) override;
|
virtual OUString SAL_CALL getImplementationName( ) override;
|
||||||
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
|
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
|
||||||
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
|
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
|
||||||
static Sequence< OUString > getSupportedServiceNames_Static( );
|
|
||||||
|
|
||||||
// XInitialization
|
// XInitialization
|
||||||
virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) override;
|
virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) override;
|
||||||
@@ -282,19 +279,9 @@ EventAttacherImpl::EventAttacherImpl( const Reference< XComponentContext >& rxCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @throws Exception
|
/// @throws Exception
|
||||||
static Reference< XInterface > EventAttacherImpl_CreateInstance( const Reference< XMultiServiceFactory >& rSMgr )
|
|
||||||
{
|
|
||||||
XEventAttacher* pEventAttacher = new EventAttacherImpl(comphelper::getComponentContext(rSMgr));
|
|
||||||
|
|
||||||
Reference< XInterface > xRet(pEventAttacher, UNO_QUERY);
|
|
||||||
|
|
||||||
return xRet;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
OUString SAL_CALL EventAttacherImpl::getImplementationName( )
|
OUString SAL_CALL EventAttacherImpl::getImplementationName( )
|
||||||
{
|
{
|
||||||
return IMPLNAME;
|
return "com.sun.star.comp.EventAttacher";
|
||||||
}
|
}
|
||||||
|
|
||||||
sal_Bool SAL_CALL EventAttacherImpl::supportsService( const OUString& ServiceName )
|
sal_Bool SAL_CALL EventAttacherImpl::supportsService( const OUString& ServiceName )
|
||||||
@@ -304,13 +291,7 @@ sal_Bool SAL_CALL EventAttacherImpl::supportsService( const OUString& ServiceNam
|
|||||||
|
|
||||||
Sequence<OUString> SAL_CALL EventAttacherImpl::getSupportedServiceNames( )
|
Sequence<OUString> SAL_CALL EventAttacherImpl::getSupportedServiceNames( )
|
||||||
{
|
{
|
||||||
return getSupportedServiceNames_Static();
|
return { "com.sun.star.script.EventAttacher" };
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Sequence<OUString> EventAttacherImpl::getSupportedServiceNames_Static( )
|
|
||||||
{
|
|
||||||
return { SERVICENAME };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments)
|
void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments)
|
||||||
@@ -858,30 +839,13 @@ Sequence< Reference<XEventListener> > EventAttacherImpl::attachMultipleEventList
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||||
|
eventattacher_EventAttacher(
|
||||||
|
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
|
||||||
{
|
{
|
||||||
SAL_DLLPUBLIC_EXPORT void * evtatt_component_getFactory(
|
static rtl::Reference<comp_EventAttacher::EventAttacherImpl> instance(new comp_EventAttacher::EventAttacherImpl(context));
|
||||||
const char * pImplName, void * pServiceManager, void * )
|
instance->acquire();
|
||||||
{
|
return static_cast<cppu::OWeakObject*>(instance.get());
|
||||||
void * pRet = nullptr;
|
|
||||||
|
|
||||||
if (pServiceManager && rtl_str_compare( pImplName, IMPLNAME ) == 0)
|
|
||||||
{
|
|
||||||
Reference< XSingleServiceFactory > xFactory( createOneInstanceFactory(
|
|
||||||
static_cast< XMultiServiceFactory * >( pServiceManager ),
|
|
||||||
IMPLNAME,
|
|
||||||
::comp_EventAttacher::EventAttacherImpl_CreateInstance,
|
|
||||||
::comp_EventAttacher::EventAttacherImpl::getSupportedServiceNames_Static() ) );
|
|
||||||
|
|
||||||
if (xFactory.is())
|
|
||||||
{
|
|
||||||
xFactory->acquire();
|
|
||||||
pRet = xFactory.get();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return pRet;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -18,8 +18,9 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
|
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
|
||||||
prefix="evtatt" xmlns="http://openoffice.org/2010/uno-components">
|
xmlns="http://openoffice.org/2010/uno-components">
|
||||||
<implementation name="com.sun.star.comp.EventAttacher">
|
<implementation name="com.sun.star.comp.EventAttacher"
|
||||||
|
constructor="eventattacher_EventAttacher">
|
||||||
<service name="com.sun.star.script.EventAttacher"/>
|
<service name="com.sun.star.script.EventAttacher"/>
|
||||||
</implementation>
|
</implementation>
|
||||||
</component>
|
</component>
|
||||||
|
@@ -151,6 +151,8 @@ core_constructor_list = [
|
|||||||
"drawinglayer_XPrimitive2DRenderer",
|
"drawinglayer_XPrimitive2DRenderer",
|
||||||
# emfio/emfio.component
|
# emfio/emfio.component
|
||||||
"emfio_emfreader_XEmfParser_get_implementation",
|
"emfio_emfreader_XEmfParser_get_implementation",
|
||||||
|
# eventattacher/source/evtatt.component
|
||||||
|
"eventattacher_EventAttacher",
|
||||||
# extensions/source/logging/log.component
|
# extensions/source/logging/log.component
|
||||||
("com_sun_star_comp_extensions_FileHandler", "#ifdef ANDROID"),
|
("com_sun_star_comp_extensions_FileHandler", "#ifdef ANDROID"),
|
||||||
("com_sun_star_comp_extensions_LoggerPool", "#ifdef ANDROID"),
|
("com_sun_star_comp_extensions_LoggerPool", "#ifdef ANDROID"),
|
||||||
|
Reference in New Issue
Block a user