[Libreoffice-commits] core.git: desktop/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sat Jul 11 16:35:55 UTC 2020


 desktop/source/deployment/gui/deploymentgui.component |   11 +-
 desktop/source/deployment/gui/dp_gui_dialog2.cxx      |   17 ++++
 desktop/source/deployment/gui/dp_gui_dialog2.hxx      |    8 +-
 desktop/source/deployment/gui/dp_gui_service.cxx      |   67 ++++++++++--------
 desktop/source/deployment/gui/license_dialog.cxx      |   18 ++++
 desktop/source/deployment/gui/license_dialog.hxx      |    8 +-
 6 files changed, 95 insertions(+), 34 deletions(-)

New commits:
commit 4c12a78b003bf0587be9edd96d538b7f5ee2a3f5
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Thu Jul 9 18:45:54 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jul 11 18:35:31 2020 +0200

    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 at collabora.co.uk>

diff --git a/desktop/source/deployment/gui/deploymentgui.component b/desktop/source/deployment/gui/deploymentgui.component
index abe2c77f5d55..3b56863c13c2 100644
--- a/desktop/source/deployment/gui/deploymentgui.component
+++ b/desktop/source/deployment/gui/deploymentgui.component
@@ -18,14 +18,17 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="deploymentgui" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.deployment.ui.LicenseDialog">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.comp.deployment.ui.LicenseDialog"
+    constructor="desktop_LicenseDialog_get_implementation">
     <service name="com.sun.star.deployment.ui.LicenseDialog"/>
   </implementation>
-  <implementation name="com.sun.star.comp.deployment.ui.PackageManagerDialog">
+  <implementation name="com.sun.star.comp.deployment.ui.PackageManagerDialog"
+    constructor="desktop_ServiceImpl_get_implementation">
     <service name="com.sun.star.deployment.ui.PackageManagerDialog"/>
   </implementation>
-  <implementation name="com.sun.star.comp.deployment.ui.UpdateRequiredDialog">
+  <implementation name="com.sun.star.comp.deployment.ui.UpdateRequiredDialog"
+    constructor="desktop_UpdateRequiredDialogService_get_implementation">
     <service name="com.sun.star.deployment.ui.UpdateRequiredDialog"/>
   </implementation>
 </component>
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index d018edad0109..b6b698d236e9 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -48,6 +48,7 @@
 
 #include <comphelper/anytostring.hxx>
 #include <cppuhelper/exc_hlp.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <comphelper/processfactory.hxx>
 #include <tools/diagnose_ex.h>
@@ -1347,6 +1348,22 @@ UpdateRequiredDialogService::UpdateRequiredDialogService( SAL_UNUSED_PARAMETER u
 {
 }
 
+// XServiceInfo
+OUString UpdateRequiredDialogService::getImplementationName()
+{
+    return "com.sun.star.comp.deployment.ui.UpdateRequiredDialog";
+}
+
+sal_Bool UpdateRequiredDialogService::supportsService( const OUString& ServiceName )
+{
+    return cppu::supportsService(this, ServiceName);
+}
+
+css::uno::Sequence< OUString > UpdateRequiredDialogService::getSupportedServiceNames()
+{
+    return { "com.sun.star.deployment.ui.UpdateRequiredDialog" };
+}
+
 
 // XExecutableDialog
 
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
index b3d348c840f3..9777742e1b4b 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
@@ -35,6 +35,7 @@
 #include <com/sun/star/deployment/XPackage.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
 
 namespace dp_gui {
 
@@ -242,13 +243,18 @@ public:
     virtual ~ShowLicenseDialog() override;
 };
 
-class UpdateRequiredDialogService : public ::cppu::WeakImplHelper< css::ui::dialogs::XExecutableDialog >
+class UpdateRequiredDialogService : public ::cppu::WeakImplHelper< css::ui::dialogs::XExecutableDialog, css::lang::XServiceInfo >
 {
     css::uno::Reference< css::uno::XComponentContext > const m_xComponentContext;
 public:
     UpdateRequiredDialogService( css::uno::Sequence< css::uno::Any > const & args,
                                  css::uno::Reference< css::uno::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;
+
     // XExecutableDialog
     virtual void SAL_CALL         setTitle( OUString const & title ) override;
     virtual sal_Int16 SAL_CALL    execute() override;
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: */
diff --git a/desktop/source/deployment/gui/license_dialog.cxx b/desktop/source/deployment/gui/license_dialog.cxx
index 3e92f8cf626f..ef2b64b91101 100644
--- a/desktop/source/deployment/gui/license_dialog.cxx
+++ b/desktop/source/deployment/gui/license_dialog.cxx
@@ -24,6 +24,7 @@
 #include <vcl/svapp.hxx>
 #include <vcl/threadex.hxx>
 #include <vcl/weld.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 #include "license_dialog.hxx"
 
@@ -200,6 +201,23 @@ LicenseDialog::LicenseDialog( Sequence<Any> const& args,
     comphelper::unwrapArgs( args, m_parent, m_sExtensionName, m_sLicenseText );
 }
 
+// XServiceInfo
+OUString LicenseDialog::getImplementationName()
+{
+    return "com.sun.star.comp.deployment.ui.LicenseDialog";
+}
+
+sal_Bool LicenseDialog::supportsService( const OUString& ServiceName )
+{
+    return cppu::supportsService(this, ServiceName);
+}
+
+css::uno::Sequence< OUString > LicenseDialog::getSupportedServiceNames()
+{
+    return { "com.sun.star.deployment.ui.LicenseDialog" };
+}
+
+
 // XExecutableDialog
 
 void LicenseDialog::setTitle( OUString const & )
diff --git a/desktop/source/deployment/gui/license_dialog.hxx b/desktop/source/deployment/gui/license_dialog.hxx
index 4cb615ef8278..cc9886f24978 100644
--- a/desktop/source/deployment/gui/license_dialog.hxx
+++ b/desktop/source/deployment/gui/license_dialog.hxx
@@ -23,12 +23,13 @@
 #include <com/sun/star/awt/XWindow.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
 
 
 namespace dp_gui {
 
 class LicenseDialog
-    : public ::cppu::WeakImplHelper<css::ui::dialogs::XExecutableDialog>
+    : public ::cppu::WeakImplHelper<css::ui::dialogs::XExecutableDialog, css::lang::XServiceInfo>
 {
     css::uno::Reference<css::awt::XWindow> /* const */ m_parent;
     OUString m_sExtensionName;
@@ -40,6 +41,11 @@ public:
     LicenseDialog( css::uno::Sequence<css::uno::Any> const & args,
                  css::uno::Reference<css::uno::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;
+
     // XExecutableDialog
     virtual void SAL_CALL setTitle( OUString const & title ) override;
     virtual sal_Int16 SAL_CALL execute() override;


More information about the Libreoffice-commits mailing list