summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-07-23 16:11:33 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-23 19:58:31 +0200
commitd122dbd0600d1511c94a2764e0ae63015dc946e3 (patch)
treed1b2a68ae6e167406c0efe9bdcfcfdd246beb2c0
parentdc1ba0e22be772724e8a1922fbdcdc58f4fc3472 (diff)
extensions/updateui: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: I3380e987be8bf24005676705e26f3135c83d2b2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99324 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--extensions/source/update/check/updatecheckconfig.cxx26
-rw-r--r--extensions/source/update/check/updatecheckconfig.hxx3
-rw-r--r--extensions/source/update/check/updatecheckjob.cxx71
-rw-r--r--extensions/source/update/check/updchk.uno.component8
-rw-r--r--extensions/source/update/ui/updatecheckui.cxx45
-rw-r--r--extensions/source/update/ui/updchk.component5
6 files changed, 33 insertions, 125 deletions
diff --git a/extensions/source/update/check/updatecheckconfig.cxx b/extensions/source/update/check/updatecheckconfig.cxx
index f3622f34914d..b76284ff759b 100644
--- a/extensions/source/update/check/updatecheckconfig.cxx
+++ b/extensions/source/update/check/updatecheckconfig.cxx
@@ -18,6 +18,7 @@
*/
#include "updatecheckconfig.hxx"
+#include "updatecheck.hxx"
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
@@ -428,19 +429,6 @@ UpdateCheckConfig::clearUpdateFound()
commitChanges();
}
-uno::Sequence< OUString >
-UpdateCheckConfig::getServiceNames()
-{
- uno::Sequence< OUString > aServiceList { "com.sun.star.setup.UpdateCheckConfig" };
- return aServiceList;
-}
-
-OUString
-UpdateCheckConfig::getImplName()
-{
- return "vnd.sun.UpdateCheckConfig";
-}
-
uno::Type SAL_CALL
UpdateCheckConfig::getElementType()
{
@@ -651,7 +639,7 @@ bool UpdateCheckConfig::isVersionGreater( const OUString& rVersion1,
OUString SAL_CALL
UpdateCheckConfig::getImplementationName()
{
- return getImplName();
+ return "vnd.sun.UpdateCheckConfig";
}
sal_Bool SAL_CALL
@@ -663,7 +651,15 @@ UpdateCheckConfig::supportsService(OUString const & serviceName)
uno::Sequence< OUString > SAL_CALL
UpdateCheckConfig::getSupportedServiceNames()
{
- return getServiceNames();
+ return { "com.sun.star.setup.UpdateCheckConfig" };
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+extensions_update_UpdateCheckConfig_get_implementation(
+ css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
+{
+ return cppu::acquire(UpdateCheckConfig::get(context, *UpdateCheck::get()).get());
}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/update/check/updatecheckconfig.hxx b/extensions/source/update/check/updatecheckconfig.hxx
index 6215161d0b0b..3c6232ea8a93 100644
--- a/extensions/source/update/check/updatecheckconfig.hxx
+++ b/extensions/source/update/check/updatecheckconfig.hxx
@@ -90,9 +90,6 @@ class UpdateCheckConfig : public ::cppu::WeakImplHelper<
public:
- static css::uno::Sequence< OUString > getServiceNames();
- static OUString getImplName();
-
static ::rtl::Reference< UpdateCheckConfig > get(
const css::uno::Reference< css::uno::XComponentContext >& xContext,
const ::rtl::Reference< UpdateCheckConfigListener >& rListener = ::rtl::Reference< UpdateCheckConfigListener >());
diff --git a/extensions/source/update/check/updatecheckjob.cxx b/extensions/source/update/check/updatecheckjob.cxx
index 72015e75fd72..d457269e9ca6 100644
--- a/extensions/source/update/check/updatecheckjob.cxx
+++ b/extensions/source/update/check/updatecheckjob.cxx
@@ -75,9 +75,6 @@ public:
m_xContext(context), m_xDesktop(desktop)
{}
- static uno::Sequence< OUString > getServiceNames();
- static OUString getImplName();
-
// XJob
virtual uno::Any SAL_CALL execute(const uno::Sequence<beans::NamedValue>&) override;
@@ -147,21 +144,6 @@ UpdateCheckJob::~UpdateCheckJob()
{
}
-uno::Sequence< OUString >
-UpdateCheckJob::getServiceNames()
-{
- uno::Sequence< OUString > aServiceList { "com.sun.star.setup.UpdateCheck" };
- return aServiceList;
-};
-
-
-OUString
-UpdateCheckJob::getImplName()
-{
- return "vnd.sun.UpdateCheck";
-}
-
-
uno::Any
UpdateCheckJob::execute(const uno::Sequence<beans::NamedValue>& namedValues)
{
@@ -245,14 +227,14 @@ void UpdateCheckJob::handleExtensionUpdates( const uno::Sequence< beans::NamedVa
OUString SAL_CALL
UpdateCheckJob::getImplementationName()
{
- return getImplName();
+ return "vnd.sun.UpdateCheck";
}
uno::Sequence< OUString > SAL_CALL
UpdateCheckJob::getSupportedServiceNames()
{
- return getServiceNames();
+ return { "com.sun.star.setup.UpdateCheck" };
}
sal_Bool SAL_CALL
@@ -298,53 +280,16 @@ void SAL_CALL UpdateCheckJob::notifyTermination( lang::EventObject const & )
} // anonymous namespace
-static uno::Reference<uno::XInterface>
-createJobInstance(const uno::Reference<uno::XComponentContext>& xContext)
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+extensions_update_UpdateCheckJob_get_implementation(
+ css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
{
css::uno::Reference<css::frame::XDesktop2> desktop(
- css::frame::Desktop::create(xContext));
- rtl::Reference<UpdateCheckJob> job(new UpdateCheckJob(xContext, desktop));
+ css::frame::Desktop::create(context));
+ rtl::Reference<UpdateCheckJob> job(new UpdateCheckJob(context, desktop));
desktop->addTerminateListener(job.get());
- return static_cast<cppu::OWeakObject *>(job.get());
+ return cppu::acquire(job.get());
}
-static uno::Reference<uno::XInterface>
-createConfigInstance(const uno::Reference<uno::XComponentContext>& xContext)
-{
- return *UpdateCheckConfig::get(xContext, *UpdateCheck::get());
-}
-
-
-const cppu::ImplementationEntry kImplementations_entries[] =
-{
- {
- createJobInstance,
- UpdateCheckJob::getImplName,
- UpdateCheckJob::getServiceNames,
- cppu::createSingleComponentFactory,
- nullptr,
- 0
- },
- {
- createConfigInstance,
- UpdateCheckConfig::getImplName,
- UpdateCheckConfig::getServiceNames,
- cppu::createSingleComponentFactory,
- nullptr,
- 0
- },
- { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
-} ;
-
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * updchk_component_getFactory(const char *pszImplementationName, void *pServiceManager, void *pRegistryKey)
-{
- return cppu::component_getFactoryHelper(
- pszImplementationName,
- pServiceManager,
- pRegistryKey,
- kImplementations_entries) ;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/update/check/updchk.uno.component b/extensions/source/update/check/updchk.uno.component
index 3f41b1211f9d..f147e3065d98 100644
--- a/extensions/source/update/check/updchk.uno.component
+++ b/extensions/source/update/check/updchk.uno.component
@@ -18,11 +18,13 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="updchk" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="vnd.sun.UpdateCheck">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="vnd.sun.UpdateCheck"
+ constructor="extensions_update_UpdateCheckJob_get_implementation">
<service name="com.sun.star.setup.UpdateCheck"/>
</implementation>
- <implementation name="vnd.sun.UpdateCheckConfig">
+ <implementation name="vnd.sun.UpdateCheckConfig"
+ constructor="extensions_update_UpdateCheckConfig_get_implementation">
<service name="com.sun.star.setup.UpdateCheckConfig"/>
</implementation>
</component>
diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx
index 85a888523841..c2aad90abf59 100644
--- a/extensions/source/update/ui/updatecheckui.cxx
+++ b/extensions/source/update/ui/updatecheckui.cxx
@@ -56,19 +56,6 @@
using namespace ::com::sun::star;
-static uno::Sequence< OUString > getServiceNames()
-{
- uno::Sequence< OUString > aServiceList { "com.sun.star.setup.UpdateCheckUI" };
- return aServiceList;
-}
-
-
-static OUString getImplementationName()
-{
- return "vnd.sun.UpdateCheckUI";
-}
-
-
namespace
{
@@ -218,13 +205,13 @@ UpdateCheckUI::~UpdateCheckUI()
OUString SAL_CALL
UpdateCheckUI::getImplementationName()
{
- return ::getImplementationName();
+ return "vnd.sun.UpdateCheckUI";
}
uno::Sequence< OUString > SAL_CALL
UpdateCheckUI::getSupportedServiceNames()
{
- return ::getServiceNames();
+ return { "com.sun.star.setup.UpdateCheckUI" };
}
sal_Bool SAL_CALL
@@ -891,35 +878,15 @@ void BubbleWindow::RecalcTextRects()
} // anonymous namespace
-static uno::Reference<uno::XInterface>
-createInstance(const uno::Reference<uno::XComponentContext>& xContext)
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+extensions_update_UpdateCheckUI_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
SolarMutexGuard aGuard;
- return *new UpdateCheckUI(xContext);
+ return cppu::acquire(new UpdateCheckUI(context));
}
-const cppu::ImplementationEntry kImplementations_entries[] =
-{
- {
- createInstance,
- getImplementationName,
- getServiceNames,
- cppu::createSingleComponentFactory,
- nullptr,
- 0
- },
- { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
-} ;
-extern "C" SAL_DLLPUBLIC_EXPORT void * updchkui_component_getFactory(const char *pszImplementationName, void *pServiceManager, void *pRegistryKey)
-{
- return cppu::component_getFactoryHelper(
- pszImplementationName,
- pServiceManager,
- pRegistryKey,
- kImplementations_entries) ;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/update/ui/updchk.component b/extensions/source/update/ui/updchk.component
index 5b80c68310dd..19c7dd86e69d 100644
--- a/extensions/source/update/ui/updchk.component
+++ b/extensions/source/update/ui/updchk.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="updchkui" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="vnd.sun.UpdateCheckUI">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="vnd.sun.UpdateCheckUI"
+ constructor="extensions_update_UpdateCheckUI_get_implementation">
<service name="com.sun.star.setup.UpdateCheckUI"/>
</implementation>
</component>