shell/kf5: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: I45cf95f39f5d3bcab23000422b1348c72782acc1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98880 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -50,17 +50,6 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
OUString getServiceImplementationName()
|
|
||||||
{
|
|
||||||
return "com.sun.star.comp.configuration.backend.KF5Backend";
|
|
||||||
}
|
|
||||||
|
|
||||||
css::uno::Sequence<OUString> getServiceSupportedServiceNames()
|
|
||||||
{
|
|
||||||
OUString name("com.sun.star.configuration.backend.KF5Backend");
|
|
||||||
return css::uno::Sequence<OUString>(&name, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Service : public cppu::WeakImplHelper<css::lang::XServiceInfo, css::beans::XPropertySet>,
|
class Service : public cppu::WeakImplHelper<css::lang::XServiceInfo, css::beans::XPropertySet>,
|
||||||
private boost::noncopyable
|
private boost::noncopyable
|
||||||
{
|
{
|
||||||
@@ -72,7 +61,7 @@ private:
|
|||||||
|
|
||||||
virtual OUString SAL_CALL getImplementationName() override
|
virtual OUString SAL_CALL getImplementationName() override
|
||||||
{
|
{
|
||||||
return getServiceImplementationName();
|
return "com.sun.star.comp.configuration.backend.KF5Backend";
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual sal_Bool SAL_CALL supportsService(OUString const& ServiceName) override
|
virtual sal_Bool SAL_CALL supportsService(OUString const& ServiceName) override
|
||||||
@@ -82,7 +71,7 @@ private:
|
|||||||
|
|
||||||
virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override
|
virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override
|
||||||
{
|
{
|
||||||
return getServiceSupportedServiceNames();
|
return { "com.sun.star.configuration.backend.KF5Backend" };
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override
|
virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override
|
||||||
@@ -252,22 +241,11 @@ css::uno::Any Service::getPropertyValue(OUString const& PropertyName)
|
|||||||
throw css::beans::UnknownPropertyException(PropertyName, static_cast<cppu::OWeakObject*>(this));
|
throw css::beans::UnknownPropertyException(PropertyName, static_cast<cppu::OWeakObject*>(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
css::uno::Reference<css::uno::XInterface>
|
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||||
createInstance(css::uno::Reference<css::uno::XComponentContext> const&)
|
shell_kf5desktop_get_implementation(css::uno::XComponentContext*,
|
||||||
|
css::uno::Sequence<css::uno::Any> const&)
|
||||||
{
|
{
|
||||||
return static_cast<cppu::OWeakObject*>(new Service);
|
return cppu::acquire(new Service());
|
||||||
}
|
}
|
||||||
|
|
||||||
cppu::ImplementationEntry const services[]
|
|
||||||
= { { &createInstance, &getServiceImplementationName, &getServiceSupportedServiceNames,
|
|
||||||
&cppu::createSingleComponentFactory, nullptr, 0 },
|
|
||||||
{ nullptr, nullptr, nullptr, nullptr, nullptr, 0 } };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" SAL_DLLPUBLIC_EXPORT void*
|
|
||||||
kf5be1_component_getFactory(char const* pImplName, void* pServiceManager, void* pRegistryKey)
|
|
||||||
{
|
|
||||||
return cppu::component_getFactoryHelper(pImplName, pServiceManager, pRegistryKey, services);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -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="kf5be1" xmlns="http://openoffice.org/2010/uno-components">
|
xmlns="http://openoffice.org/2010/uno-components">
|
||||||
<implementation name="com.sun.star.comp.configuration.backend.KF5Backend">
|
<implementation name="com.sun.star.comp.configuration.backend.KF5Backend"
|
||||||
|
constructor="shell_kf5desktop_get_implementation">
|
||||||
<service name="com.sun.star.configuration.backend.KF5Backend"/>
|
<service name="com.sun.star.configuration.backend.KF5Backend"/>
|
||||||
</implementation>
|
</implementation>
|
||||||
</component>
|
</component>
|
||||||
|
Reference in New Issue
Block a user