diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-07-09 18:45:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-11 18:35:31 +0200 |
commit | 4c12a78b003bf0587be9edd96d538b7f5ee2a3f5 (patch) | |
tree | 1a64644f755cd41a69611050301ee77d93baf692 /desktop/source/deployment/gui/dp_gui_service.cxx | |
parent | 92cccb9a7ead4a7f106db8c79e142013dd214441 (diff) |
desktop/deployment: create instances with uno constructors
See tdf#74608 for motivation
Change-Id: I11fe446e07e9a807c1267c4037922877d987003c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98472
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop/source/deployment/gui/dp_gui_service.cxx')
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_service.cxx | 67 |
1 files changed, 39 insertions, 28 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx index 8acfdc5a32f1..0d0315f0daaa 100644 --- a/desktop/source/deployment/gui/dp_gui_service.cxx +++ b/desktop/source/deployment/gui/dp_gui_service.cxx @@ -22,9 +22,9 @@ #include "dp_gui_theextmgr.hxx" #include <osl/diagnose.h> #include <cppuhelper/implbase.hxx> +#include <cppuhelper/supportsservice.hxx> #include <unotools/configmgr.hxx> #include <comphelper/processfactory.hxx> -#include <comphelper/servicedecl.hxx> #include <comphelper/unwrapargs.hxx> #include <unotools/resmgr.hxx> #include <vcl/weld.hxx> @@ -42,8 +42,6 @@ using namespace ::dp_misc; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -namespace sdecl = comphelper::service_decl; - namespace dp_gui { namespace { @@ -108,7 +106,7 @@ namespace { class ServiceImpl : public ::cppu::WeakImplHelper<ui::dialogs::XAsynchronousExecutableDialog, - task::XJobExecutor> + task::XJobExecutor, css::lang::XServiceInfo> { Reference<XComponentContext> const m_xComponentContext; std::optional< Reference<awt::XWindow> > /* const */ m_parent; @@ -120,6 +118,11 @@ public: ServiceImpl( Sequence<Any> const & args, Reference<XComponentContext> const & xComponentContext ); + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + // XAsynchronousExecutableDialog virtual void SAL_CALL setDialogTitle( OUString const & aTitle ) override; virtual void SAL_CALL startExecuteModal( @@ -154,6 +157,22 @@ ServiceImpl::ServiceImpl( Sequence<Any> const& args, Translate::SetReadStringHook(ReplaceProductNameHookProc); } +// XServiceInfo +OUString ServiceImpl::getImplementationName() +{ + return "com.sun.star.comp.deployment.ui.PackageManagerDialog"; +} + +sal_Bool ServiceImpl::supportsService( const OUString& ServiceName ) +{ + return cppu::supportsService(this, ServiceName); +} + +css::uno::Sequence< OUString > ServiceImpl::getSupportedServiceNames() +{ + return { "com.sun.star.deployment.ui.PackageManagerDialog" }; +} + // XAsynchronousExecutableDialog void ServiceImpl::setDialogTitle( OUString const & title ) @@ -270,35 +289,27 @@ void ServiceImpl::trigger( OUString const &rEvent ) startExecuteModal( Reference< ui::dialogs::XDialogClosedListener >() ); } -sdecl::class_<ServiceImpl, sdecl::with_args<true> > const serviceSI; -sdecl::ServiceDecl const serviceDecl( - serviceSI, - "com.sun.star.comp.deployment.ui.PackageManagerDialog", - "com.sun.star.deployment.ui.PackageManagerDialog" ); - -sdecl::class_<LicenseDialog, sdecl::with_args<true> > const licenseSI; -sdecl::ServiceDecl const licenseDecl( - licenseSI, - "com.sun.star.comp.deployment.ui.LicenseDialog", - "com.sun.star.deployment.ui.LicenseDialog" ); - -sdecl::class_<UpdateRequiredDialogService, sdecl::with_args<true> > const updateSI; -sdecl::ServiceDecl const updateDecl( - updateSI, - "com.sun.star.comp.deployment.ui.UpdateRequiredDialog", - "com.sun.star.deployment.ui.UpdateRequiredDialog" ); } // namespace dp_gui -extern "C" { +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +desktop_LicenseDialog_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args) +{ + return cppu::acquire(new dp_gui::LicenseDialog(args, context)); +} -SAL_DLLPUBLIC_EXPORT void * deploymentgui_component_getFactory( - char const * pImplName, void *, void *) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +desktop_ServiceImpl_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args) { - return sdecl::component_getFactoryHelper( - pImplName, - {&dp_gui::serviceDecl, &dp_gui::licenseDecl, &dp_gui::updateDecl}); + return cppu::acquire(new dp_gui::ServiceImpl(args, context)); } -} // extern "C" +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +desktop_UpdateRequiredDialogService_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args) +{ + return cppu::acquire(new dp_gui::UpdateRequiredDialogService(args, context)); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |