[Libreoffice-commits] core.git: desktop/source framework/inc framework/source offapi/com offapi/UnoApi_offapi.mk

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 26 16:53:22 UTC 2020


 desktop/source/app/app.cxx                     |    6 ++---
 framework/inc/services/desktop.hxx             |    8 ++++---
 framework/source/services/desktop.cxx          |   11 +++++++++
 offapi/UnoApi_offapi.mk                        |    1 
 offapi/com/sun/star/frame/XDesktopInternal.idl |   28 -------------------------
 5 files changed, 19 insertions(+), 35 deletions(-)

New commits:
commit a6862a26d6cd17f6b4e4f6577bcd778bf952e65b
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Jun 26 17:33:17 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Jun 26 18:52:36 2020 +0200

    tdf#134106: Get rid of XDesktopInternal again
    
    For internal functionality that is not meant to be called by client code, I
    think it is appropriate to hide it either via XUnoTunnel (but which would have
    been a tad incovenient, as it would have meant to make framework::Desktop in
    framework/inc/services/desktop.hxx available to the code in
    desktop/source/app/app.cxx), or via reuse of some existing, sufficently fitting
    interface (as is done here with css.task.XJob).  This nicely avoids the
    backwards compatibilty issue with remote Python scripts, as discussed in
    tdf#134106 "Binary URP bridge disposed during call to
    ServiceManager.createInstanceWithContext".
    
    Change-Id: Ic9db9401ddf0f6b696344dd1d5c6ad279ea5a832
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97241
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    Tested-by: Jenkins

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 0342be980292..e5ed6e491edb 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -71,12 +71,12 @@
 #include <com/sun/star/configuration/backend/BackendAccessException.hpp>
 #include <com/sun/star/task/theJobExecutor.hpp>
 #include <com/sun/star/task/OfficeRestartManager.hpp>
+#include <com/sun/star/task/XJob.hpp>
 #include <com/sun/star/task/XRestartManager.hpp>
 #include <com/sun/star/document/XDocumentEventListener.hpp>
 #include <com/sun/star/office/Quickstart.hpp>
 #include <com/sun/star/system/XSystemShellExecute.hpp>
 #include <com/sun/star/system/SystemShellExecute.hpp>
-#include <com/sun/star/frame/XDesktopInternal.hpp>
 
 #include <desktop/exithelper.h>
 #include <sal/log.hxx>
@@ -611,8 +611,8 @@ bool Desktop::QueryExit()
 void Desktop::Shutdown()
 {
     Reference<XDesktop2> xDesktop = css::frame::Desktop::create(::comphelper::getProcessComponentContext());
-    Reference<XDesktopInternal> xDesktopInternal(xDesktop, UNO_QUERY_THROW);
-    xDesktopInternal->shutdown();
+    Reference<XJob> xDesktopInternal(xDesktop, UNO_QUERY_THROW);
+    xDesktopInternal->execute({{"shutdown", {}}});
 }
 
 void Desktop::HandleBootstrapPathErrors( ::utl::Bootstrap::Status aBootstrapStatus, const OUString& aDiagnosticMessage )
diff --git a/framework/inc/services/desktop.hxx b/framework/inc/services/desktop.hxx
index 0cf9cb355fe4..3967650eabde 100644
--- a/framework/inc/services/desktop.hxx
+++ b/framework/inc/services/desktop.hxx
@@ -30,7 +30,6 @@
 #include <com/sun/star/frame/XUntitledNumbers.hpp>
 #include <com/sun/star/frame/XController.hpp>
 #include <com/sun/star/frame/XDesktop2.hpp>
-#include <com/sun/star/frame/XDesktopInternal.hpp>
 #include <com/sun/star/frame/XTerminateListener.hpp>
 #include <com/sun/star/frame/XTask.hpp>
 #include <com/sun/star/frame/XFramesSupplier.hpp>
@@ -43,6 +42,7 @@
 #include <com/sun/star/lang/XEventListener.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
 #include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/task/XJob.hpp>
 #include <com/sun/star/frame/XDispatchRecorderSupplier.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
 
@@ -90,7 +90,7 @@ enum ELoadState
 typedef cppu::WeakComponentImplHelper<
            css::lang::XServiceInfo              ,
            css::frame::XDesktop2                ,
-           css::frame::XDesktopInternal,
+           css::task::XJob, // for internal "shutdown" command
            css::frame::XTasksSupplier           ,
            css::frame::XDispatchResultListener  ,   // => XEventListener
            css::task::XInteractionHandler       ,
@@ -285,9 +285,11 @@ class Desktop final : private cppu::BaseMutex,
         /// @throws css::uno::RuntimeException
         bool terminateQuickstarterToo();
 
-        virtual void SAL_CALL shutdown() override;
+        css::uno::Any SAL_CALL execute(css::uno::Sequence<css::beans::NamedValue> const & Arguments)
+            override;
 
     private:
+        void shutdown();
 
         //  OPropertySetHelper
         virtual sal_Bool                                            SAL_CALL convertFastPropertyValue        (       css::uno::Any&  aConvertedValue ,
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index 28f5015203e3..95dd35546713 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -323,6 +323,17 @@ sal_Bool SAL_CALL Desktop::terminate()
     return true;
 }
 
+css::uno::Any Desktop::execute(css::uno::Sequence<css::beans::NamedValue> const & Arguments)
+{
+    if (Arguments.getLength() == 1 && Arguments[0].Name == "shutdown"
+        && !Arguments[0].Value.hasValue())
+    {
+        shutdown();
+        return {};
+    }
+    throw css::lang::IllegalArgumentException("unsupported job request", {}, 0);
+}
+
 void Desktop::shutdown()
 {
     TransactionGuard aTransaction(m_aTransactionManager, E_HARDEXCEPTIONS);
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 68a493cfa6ac..2003e4eaaa2a 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -2602,7 +2602,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/frame,\
 	XControllerBorder \
 	XDesktop \
 	XDesktop2 \
-	XDesktopInternal \
 	XDesktopTask \
 	XDispatch \
 	XDispatchHelper \
diff --git a/offapi/com/sun/star/frame/XDesktopInternal.idl b/offapi/com/sun/star/frame/XDesktopInternal.idl
deleted file mode 100644
index 85dcad92dd3c..000000000000
--- a/offapi/com/sun/star/frame/XDesktopInternal.idl
+++ /dev/null
@@ -1,28 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-#ifndef __com_sun_star_frame_XDesktopInternal_idl__
-#define __com_sun_star_frame_XDesktopInternal_idl__
-
-module com {  module sun {  module star {  module frame {
-
-/**
- * @internal
- */
-interface XDesktopInternal
-{
-    /** clean up XDesktop instances after termination, when quit from Application::Execute
-     */
-    void shutdown();
-};
-
-}; }; }; };
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */


More information about the Libreoffice-commits mailing list