From 61fcf830aa5d94e6cc8075d0eaf6af8a6d405bad Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 29 Jun 2020 12:55:12 +0200 Subject: Call framework::Desktop::shutdown directly ...instead of via the XJob hack introduced in a6862a26d6cd17f6b4e4f6577bcd778bf952e65b "tdf#134106: Get rid of XDesktopInternal again" Change-Id: Ic533e8faba1a3da65ead74d78f0ab9c4aab1ca6a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97397 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- framework/Library_fwk.mk | 4 + framework/inc/classes/converter.hxx | 2 +- framework/inc/classes/framecontainer.hxx | 94 ----- framework/inc/classes/protocolhandlercache.hxx | 2 +- framework/inc/fwidllapi.h | 33 -- framework/inc/helper/mischelper.hxx | 2 +- framework/inc/helper/oframes.hxx | 2 +- framework/inc/helper/shareablemutex.hxx | 2 +- framework/inc/jobs/configaccess.hxx | 2 +- framework/inc/jobs/jobconst.hxx | 2 +- framework/inc/pch/precompiled_fwk.hxx | 2 +- framework/inc/services/desktop.hxx | 457 --------------------- framework/inc/threadhelp/gate.hxx | 149 ------- framework/inc/threadhelp/transactionguard.hxx | 2 +- framework/inc/threadhelp/transactionmanager.hxx | 128 ------ framework/inc/uielement/constitemcontainer.hxx | 2 +- framework/inc/uielement/itemcontainer.hxx | 2 +- framework/inc/uielement/rootitemcontainer.hxx | 2 +- framework/source/classes/framecontainer.cxx | 2 +- .../source/fwi/threadhelp/transactionmanager.cxx | 2 +- framework/source/services/desktop.cxx | 23 +- framework/source/services/frame.cxx | 2 +- framework/source/services/sessionlistener.cxx | 2 +- 23 files changed, 29 insertions(+), 891 deletions(-) delete mode 100644 framework/inc/classes/framecontainer.hxx delete mode 100644 framework/inc/fwidllapi.h delete mode 100644 framework/inc/services/desktop.hxx delete mode 100644 framework/inc/threadhelp/gate.hxx delete mode 100644 framework/inc/threadhelp/transactionmanager.hxx (limited to 'framework') diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk index 1fe75ccab4b7..718045b47318 100644 --- a/framework/Library_fwk.mk +++ b/framework/Library_fwk.mk @@ -19,6 +19,10 @@ $(eval $(call gb_Library_Library,fwk)) +$(eval $(call gb_Library_add_defs,fwk,\ + -DLO_DLLIMPLEMENTATION_FWK \ +)) + $(eval $(call gb_Library_set_componentfile,fwk,framework/util/fwk)) $(eval $(call gb_Library_set_include,fwk,\ diff --git a/framework/inc/classes/converter.hxx b/framework/inc/classes/converter.hxx index 15d36a5f0d0d..a9fdfff9f37a 100644 --- a/framework/inc/classes/converter.hxx +++ b/framework/inc/classes/converter.hxx @@ -27,7 +27,7 @@ #include #include #include -#include +#include namespace framework{ diff --git a/framework/inc/classes/framecontainer.hxx b/framework/inc/classes/framecontainer.hxx deleted file mode 100644 index 72a868f66d34..000000000000 --- a/framework/inc/classes/framecontainer.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_FRAMEWORK_INC_CLASSES_FRAMECONTAINER_HXX -#define INCLUDED_FRAMEWORK_INC_CLASSES_FRAMECONTAINER_HXX - -#include - -#include - -#include -#include - -#include - -namespace framework{ - -typedef ::std::vector< css::uno::Reference< css::frame::XFrame > > TFrameContainer; - -/*-************************************************************************************************************ - @short implement a container to hold children of frame, task or desktop - @descr Every object of frame, task or desktop hold reference to its children. These container is used as helper - to do this. Some helper-classes like OFrames or OTasksAccess use it to. They hold a pointer to an instance - of this class, which is a member of a frame, task or desktop! You can append and remove frames. - It's possible to set one of these frames as active or deactivate. You could have full index-access to - container-items. - - @devstatus ready to use - @threadsafe yes -*//*-*************************************************************************************************************/ -class FrameContainer final -{ - - // member - - private: - - /// list to hold all frames - TFrameContainer m_aContainer; - /// one container item can be the current active frame. It's necessary for Desktop or Frame implementation. - css::uno::Reference< css::frame::XFrame > m_xActiveFrame; - - // interface - - public: - - /// constructor / destructor - FrameContainer(); - ~FrameContainer(); - - /// add/remove/mark container items - void append ( const css::uno::Reference< css::frame::XFrame >& xFrame ); - void remove ( const css::uno::Reference< css::frame::XFrame >& xFrame ); - void setActive ( const css::uno::Reference< css::frame::XFrame >& xFrame ); - css::uno::Reference< css::frame::XFrame > getActive ( ) const; - - /// checks and free memory - bool exist ( const css::uno::Reference< css::frame::XFrame >& xFrame ) const; - void clear ( ); - - /// deprecated IndexAccess! - sal_uInt32 getCount ( ) const; - css::uno::Reference< css::frame::XFrame > operator[]( sal_uInt32 nIndex ) const; - - /// replacement for deprecated index access - css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > getAllElements() const; - - /// special helper for Frame::findFrame() - css::uno::Reference< css::frame::XFrame > searchOnAllChildrens ( const OUString& sName ) const; - css::uno::Reference< css::frame::XFrame > searchOnDirectChildrens( const OUString& sName ) const; - -}; // class FrameContainer - -} // namespace framework - -#endif // INCLUDED_FRAMEWORK_INC_CLASSES_FRAMECONTAINER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/classes/protocolhandlercache.hxx b/framework/inc/classes/protocolhandlercache.hxx index fa7907927d13..7632a72bcd1e 100644 --- a/framework/inc/classes/protocolhandlercache.hxx +++ b/framework/inc/classes/protocolhandlercache.hxx @@ -27,7 +27,7 @@ #include #include -#include +#include namespace framework{ diff --git a/framework/inc/fwidllapi.h b/framework/inc/fwidllapi.h deleted file mode 100644 index 290f18721ec0..000000000000 --- a/framework/inc/fwidllapi.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_FRAMEWORK_INC_FWIDLLAPI_H -#define INCLUDED_FRAMEWORK_INC_FWIDLLAPI_H - -#include - -#if defined(FWI_DLLIMPLEMENTATION) -#define FWI_DLLPUBLIC SAL_DLLPUBLIC_EXPORT -#else -#define FWI_DLLPUBLIC SAL_DLLPUBLIC_IMPORT -#endif - -#endif // INCLUDED_FRAMEWORK_INC_FWIDLLAPI_H - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/mischelper.hxx b/framework/inc/helper/mischelper.hxx index 00f8689487e6..5605eff87ebe 100644 --- a/framework/inc/helper/mischelper.hxx +++ b/framework/inc/helper/mischelper.hxx @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include diff --git a/framework/inc/helper/oframes.hxx b/framework/inc/helper/oframes.hxx index 1da482c4e86f..773685876a57 100644 --- a/framework/inc/helper/oframes.hxx +++ b/framework/inc/helper/oframes.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_FRAMEWORK_INC_HELPER_OFRAMES_HXX #define INCLUDED_FRAMEWORK_INC_HELPER_OFRAMES_HXX -#include +#include #include #include diff --git a/framework/inc/helper/shareablemutex.hxx b/framework/inc/helper/shareablemutex.hxx index 9470983fb41d..c05bffb47145 100644 --- a/framework/inc/helper/shareablemutex.hxx +++ b/framework/inc/helper/shareablemutex.hxx @@ -22,7 +22,7 @@ #include #include -#include +#include namespace framework { diff --git a/framework/inc/jobs/configaccess.hxx b/framework/inc/jobs/configaccess.hxx index 1bb8e01103da..c5783ffe975c 100644 --- a/framework/inc/jobs/configaccess.hxx +++ b/framework/inc/jobs/configaccess.hxx @@ -24,7 +24,7 @@ #include #include -#include +#include namespace framework{ diff --git a/framework/inc/jobs/jobconst.hxx b/framework/inc/jobs/jobconst.hxx index 80e78f4d991a..96a60f81af86 100644 --- a/framework/inc/jobs/jobconst.hxx +++ b/framework/inc/jobs/jobconst.hxx @@ -21,7 +21,7 @@ #define INCLUDED_FRAMEWORK_INC_JOBS_JOBCONST_HXX #include -#include +#include namespace framework{ diff --git a/framework/inc/pch/precompiled_fwk.hxx b/framework/inc/pch/precompiled_fwk.hxx index cc7bb0db28d2..d1cea3b5c800 100644 --- a/framework/inc/pch/precompiled_fwk.hxx +++ b/framework/inc/pch/precompiled_fwk.hxx @@ -251,7 +251,7 @@ #if PCH_LEVEL >= 4 #include #include -#include +#include #include #include #endif // PCH_LEVEL >= 4 diff --git a/framework/inc/services/desktop.hxx b/framework/inc/services/desktop.hxx deleted file mode 100644 index 3967650eabde..000000000000 --- a/framework/inc/services/desktop.hxx +++ /dev/null @@ -1,457 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_FRAMEWORK_INC_SERVICES_DESKTOP_HXX -#define INCLUDED_FRAMEWORK_INC_SERVICES_DESKTOP_HXX - -#include - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace framework{ - -enum ELoadState -{ - E_NOTSET , - E_SUCCESSFUL , - E_FAILED , - E_INTERACTION -}; - -/*-************************************************************************************************************ - @short implement the topframe of frame tree - @descr This is the root of the frame tree. The desktop has no window, is not visible but he is the logical - "masternode" to build the hierarchy. - - @implements XInterface - XTypeProvider - XServiceInfo - XDesktop - XComponentLoader - XTasksSupplier - XDispatchProvider - XFramesSupplier - XFrame - XComponent - XPropertySet - XFastPropertySet - XMultiPropertySet - XDispatchResultListener - XEventListener - XInteractionHandler - - @devstatus ready to use - @threadsafe yes -*//*-*************************************************************************************************************/ -typedef cppu::WeakComponentImplHelper< - css::lang::XServiceInfo , - css::frame::XDesktop2 , - css::task::XJob, // for internal "shutdown" command - css::frame::XTasksSupplier , - css::frame::XDispatchResultListener , // => XEventListener - css::task::XInteractionHandler , - css::frame::XUntitledNumbers > Desktop_BASE; - -class Desktop final : private cppu::BaseMutex, - public Desktop_BASE, - public cppu::OPropertySetHelper -{ - // internal used types, const etcpp. - private: - - /** used temporary to know which listener was already called or not. */ - typedef ::std::vector< css::uno::Reference< css::frame::XTerminateListener > > TTerminateListenerList; - - // public methods - public: - - // constructor / destructor - Desktop( const css::uno::Reference< css::uno::XComponentContext >& xContext ); - virtual ~Desktop( ) override; - - void constructorInit(); - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() override; - - virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override; - - virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() override; - - // XInterface - virtual void SAL_CALL acquire() throw () override - { OWeakObject::acquire(); } - virtual void SAL_CALL release() throw () override - { OWeakObject::release(); } - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& type) override; - - // XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - - /** - @interface XDesktop - - @short try to shutdown these desktop environment. - - @descr Will try to close all frames. If at least one frame could - not be closed successfully termination will be stopped. - - Registered termination listener will be taken into account - also. As special feature some of our registered listener - are well known by its UNO implementation name. They are handled - different to all other listener. - - Btw: Desktop.terminate() was designed in the past to be used - within an UI based environment. So it's allowed e.g. to - call XController.suspend() here. If UI isn't an option ... please - use XCloseable.close() at these desktop implementation. - ... if it will be supported in the future .-)) - - @seealso XTerminateListener - @seealso XTerminateListener2 - - @return true if all open frames could be closed and no listener threw - a veto exception; false otherwise. - - @onerror False will be returned. - @threadsafe yes - */ - virtual sal_Bool SAL_CALL terminate() override; - - /** - @interface XDesktop - - @short add a listener for termination events - - @descr Additional to adding normal listener these method was implemented special. - Every listener will be asked for its uno implementation name. - Some of them are well known... and the corresponding listener won't be added - to the container of "normal listener". Those listener will be set as special - member. - see e.g. member m_xSfxTerminator - - @seealso terminate() - - @param xListener - the listener for registration. - - @threadsafe yes - */ - virtual void SAL_CALL addTerminateListener( const css::uno::Reference< css::frame::XTerminateListener >& xListener ) override; - - /** - @interface XDesktop - - @short remove a listener from this container. - - @descr Additional to removing normal listener these method was implemented special. - Every listener will be asked for its uno implementation name. - Some of them are well known... and the corresponding listener was set as special member. - Now those special member will be reset also. - see e.g. member m_xSfxTerminator - - @seealso terminate() - - @param xListener - the listener for deregistration. - - @threadsafe yes - */ - virtual void SAL_CALL removeTerminateListener( const css::uno::Reference< css::frame::XTerminateListener >& xListener ) override; - - virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getComponents ( ) override; - virtual css::uno::Reference< css::lang::XComponent > SAL_CALL getCurrentComponent ( ) override; - virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getCurrentFrame ( ) override; - - // XComponentLoader - virtual css::uno::Reference< css::lang::XComponent > SAL_CALL loadComponentFromURL ( const OUString& sURL , - const OUString& sTargetFrameName , - sal_Int32 nSearchFlags , - const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) override; - - // XTasksSupplier - virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getTasks ( ) override; - virtual css::uno::Reference< css::frame::XTask > SAL_CALL getActiveTask ( ) override; - - // XDispatchProvider - virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL , - const OUString& sTargetFrameName , - sal_Int32 nSearchFlags ) override; - virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches ( const css::uno::Sequence< css::frame::DispatchDescriptor >& lQueries ) override; - - // XDispatchProviderInterception - virtual void SAL_CALL registerDispatchProviderInterceptor( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) override; - virtual void SAL_CALL releaseDispatchProviderInterceptor ( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) override; - - // XFramesSupplier - virtual css::uno::Reference< css::frame::XFrames > SAL_CALL getFrames ( ) override; - virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getActiveFrame ( ) override; - virtual void SAL_CALL setActiveFrame ( const css::uno::Reference< css::frame::XFrame >& xFrame ) override; - - // XFrame - // Attention: findFrame() is implemented only! Other methods make no sense for our desktop! - virtual css::uno::Reference< css::frame::XFrame > SAL_CALL findFrame ( const OUString& sTargetFrameName , - sal_Int32 nSearchFlags ) override; - virtual void SAL_CALL initialize ( const css::uno::Reference< css::awt::XWindow >& xWindow ) override; - virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getContainerWindow ( ) override; - virtual void SAL_CALL setCreator ( const css::uno::Reference< css::frame::XFramesSupplier >& xCreator ) override; - virtual css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL getCreator ( ) override; - virtual OUString SAL_CALL getName ( ) override; - virtual void SAL_CALL setName ( const OUString& sName ) override; - virtual sal_Bool SAL_CALL isTop ( ) override; - virtual void SAL_CALL activate ( ) override; - virtual void SAL_CALL deactivate ( ) override; - virtual sal_Bool SAL_CALL isActive ( ) override; - virtual sal_Bool SAL_CALL setComponent ( const css::uno::Reference< css::awt::XWindow >& xComponentWindow , - const css::uno::Reference< css::frame::XController >& xController ) override; - virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow ( ) override; - virtual css::uno::Reference< css::frame::XController > SAL_CALL getController ( ) override; - virtual void SAL_CALL contextChanged ( ) override; - virtual void SAL_CALL addFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) override; - virtual void SAL_CALL removeFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) override; - - // XComponent - virtual void SAL_CALL disposing() override; - virtual void SAL_CALL addEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; - virtual void SAL_CALL removeEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; - - // XDispatchResultListener - virtual void SAL_CALL dispatchFinished ( const css::frame::DispatchResultEvent& aEvent ) override; - - // XEventListener - virtual void SAL_CALL disposing ( const css::lang::EventObject& aSource ) override; - - // XInteractionHandler - virtual void SAL_CALL handle ( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) override; - - // css.frame.XUntitledNumbers - virtual ::sal_Int32 SAL_CALL leaseNumber( const css::uno::Reference< css::uno::XInterface >& xComponent ) override; - - // css.frame.XUntitledNumbers - virtual void SAL_CALL releaseNumber( ::sal_Int32 nNumber ) override; - - // css.frame.XUntitledNumbers - virtual void SAL_CALL releaseNumberForComponent( const css::uno::Reference< css::uno::XInterface >& xComponent ) override; - - // css.frame.XUntitledNumbers - virtual OUString SAL_CALL getUntitledPrefix() override; - - // we need this wrapped terminate()-call to terminate even the QuickStarter - // non-virtual and non-UNO for now - /// @throws css::uno::RuntimeException - bool terminateQuickstarterToo(); - - css::uno::Any SAL_CALL execute(css::uno::Sequence const & Arguments) - override; - - private: - void shutdown(); - - // OPropertySetHelper - virtual sal_Bool SAL_CALL convertFastPropertyValue ( css::uno::Any& aConvertedValue , - css::uno::Any& aOldValue , - sal_Int32 nHandle , - const css::uno::Any& aValue ) override; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , - const css::uno::Any& aValue ) override; - using cppu::OPropertySetHelper::getFastPropertyValue; - virtual void SAL_CALL getFastPropertyValue ( css::uno::Any& aValue , - sal_Int32 nHandle ) const override; - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper ( ) override; - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo ( ) override; - - css::uno::Reference< css::lang::XComponent > impl_getFrameComponent ( const css::uno::Reference< css::frame::XFrame >& xFrame ) const; - - /** calls queryTermination() on every registered termination listener. - * - * Note: Only normal termination listener (registered in list m_aListenerContainer - * will be recognized here. Special listener like quick starter, pipe or others - * has to be handled explicitly ! - * - * @param [out] lCalledListener - * every called listener will be returned here. - * Those list will be used to inform all called listener - * about cancel this termination request. - * - * @return true if no one vetoed the termination. - * - * @see impl_sendCancelTerminationEvent() - */ - bool impl_sendQueryTerminationEvent(TTerminateListenerList& lCalledListener); - - /** calls cancelTermination() on every termination listener - * where queryTermination() was called before. - * - * Note: Only normal termination listener (registered in list m_aListenerContainer - * will be recognized here. Special listener like quick starter, pipe or others - * has to be handled explicitly ! - * - * @param [in] lCalledListener - * every listener in this list was called within its method - * queryTermination() before. - * - * @see impl_sendQueryTerminationEvent() - */ - void impl_sendCancelTerminationEvent(const TTerminateListenerList& lCalledListener); - - /** calls notifyTermination() on the clipboard listener - * - * The system clipboard may decide that it wants copies - * in several formats of the clipboard content requiring - * nearly all the services - * - */ - void impl_sendTerminateToClipboard(); - - /** calls notifyTermination() on every registered termination listener. - * - * Note: Only normal termination listener (registered in list m_aListenerContainer - * will be recognized here. Special listener like quick starter, pipe or others - * has to be handled explicitly ! - */ - void impl_sendNotifyTerminationEvent(); - - /** try to close all open frames. - * - * Iterates over all child frames and try to close them. - * Given parameter bAllowUI enable/disable showing any UI - * (which mostly occur on calling XController->suspend()). - * - * This method doesn't stop if one frame could not be closed. - * It will ignore such frames and try all other ones. - * But it returns false in such case - true otherwise. - * - * @param bAllowUI - * enable/disable showing of UI. - * - * @return true if all frames could be closed; false otherwise. - */ - bool impl_closeFrames(bool bAllowUI); - - private: - - mutable TransactionManager m_aTransactionManager; - - /** check flag to protect against multiple terminate runs - */ - bool m_bIsTerminated; - - /** check flag to protect us against dispose before terminate! - * see dispose() for further information! - */ - bool m_bIsShutdown; - - /** when true, the call came from session manager - * the method is Desktop::terminateQuickstarterToo() - * this the only one place where set this to true - * In this case, when one frame break, not make - * question for other, the break of shutdown or logout - * can be only once. - * In Desktop::impl_closeFrames would be test and break - * the loop and reset to false - */ - bool m_bSession; - - css::uno::Reference< css::uno::XComponentContext > m_xContext; /// reference to factory, which has create this instance - FrameContainer m_aChildTaskContainer; /// array of child tasks (children of desktop are tasks; and tasks are also frames - But pure frames are not accepted!) - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener - css::uno::Reference< css::frame::XFrames > m_xFramesHelper; /// helper for XFrames, XIndexAccess, XElementAccess and implementation of a childcontainer! - css::uno::Reference< css::frame::XDispatchProvider > m_xDispatchHelper; /// helper to dispatch something for new tasks, created by "_blank"! - ELoadState m_eLoadState; /// hold information about state of asynchron loading of component for loadComponentFromURL()! - bool m_bSuspendQuickstartVeto; /// don't ask quickstart for a veto - std::unique_ptr m_xCommandOptions; /// ref counted class to support disabling commands defined by configuration file - OUString m_sName; - OUString m_sTitle; - css::uno::Reference< css::frame::XDispatchRecorderSupplier > m_xDispatchRecorderSupplier; - - /** special terminate listener to close pipe and block external requests - * during/after termination process is/was running - */ - css::uno::Reference< css::frame::XTerminateListener > m_xPipeTerminator; - - /** special terminate listener shown inside system tray (quick starter) - * Will hinder the office on shutdown ... but wish to allow closing - * of open documents. And because that's different to a normal terminate listener - * it has to be handled special .-) - */ - css::uno::Reference< css::frame::XTerminateListener > m_xQuickLauncher; - - /** special terminate listener which loads images asynchronous for current open documents. - * Because internally it uses blocking system APIs... it can't be guaranteed that - * running jobs can be cancelled successfully if the corresponding document will be closed... - * it will not hinder those documents on closing. Instead it let all jobs running... - * but at least on terminate we have to wait for all those blocked requests. - * So these implementation must be a special terminate listener too .-( - */ - css::uno::Reference< css::frame::XTerminateListener > m_xSWThreadManager; - - /** special terminate listener shutting down the SfxApplication. - * Because these desktop instance closes documents and informs listener - * only... it does not really shutdown the whole application. - * - * Btw: that wouldn't be possible by design... because Desktop.terminate() - * has to return a boolean value about success... it can't really shutdown the - * process .-) - * - * So we uses a trick: a special listener (exactly these one here) listen for notifyTermination() - * and shutdown the process asynchronous. But desktop has to make this special - * notification as really last one ... Otherwise it can happen that asynchronous - * shutdown will be faster then all other code around Desktop.terminate() .-)) - */ - css::uno::Reference< css::frame::XTerminateListener > m_xSfxTerminator; - - css::uno::Reference< css::frame::XUntitledNumbers > m_xTitleNumberGenerator; - - std::vector> m_xComponentDllListeners; - -}; // class Desktop - -} // namespace framework - -#endif // INCLUDED_FRAMEWORK_INC_SERVICES_DESKTOP_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/threadhelp/gate.hxx b/framework/inc/threadhelp/gate.hxx deleted file mode 100644 index 627a3a7cb4fb..000000000000 --- a/framework/inc/threadhelp/gate.hxx +++ /dev/null @@ -1,149 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_FRAMEWORK_INC_THREADHELP_GATE_HXX -#define INCLUDED_FRAMEWORK_INC_THREADHELP_GATE_HXX - -#include -#include - -namespace framework{ - -/*-************************************************************************************************************ - @short implement a gate to block multiple threads at the same time or unblock all - @descr A gate can be used as a negative-condition! You can open a "door" - wait() will not block ... - or you can close it - wait() blocks till open() is called again. - Then all currently waiting threads are running immediately - but new ones are blocked! - - @attention To prevent us against wrong using, the default ctor, copy ctor and the =operator are marked private! - - @devstatus ready to use -*//*-*************************************************************************************************************/ -class Gate -{ - - // public methods - - public: - - /*-**************************************************************************************************** - @short ctor - @descr These initialize the object right as an open gate. - *//*-*****************************************************************************************************/ - Gate() - : m_bClosed ( false ) - { - open(); - } - - /*-**************************************************************************************************** - @short dtor - @descr Is user forget it - we open the gate ... - blocked threads can running ... but I don't know - if it's right - we are destroyed yet!? - *//*-*****************************************************************************************************/ - ~Gate() - { - open(); - } - /*-**************************************************************************************************** - @short copy-ctor - @descr Forbid copy construction - *//*-*****************************************************************************************************/ - Gate(const Gate&) = delete; - /*-**************************************************************************************************** - @short copy-assignment - @descr Forbid copy assigning - *//*-*****************************************************************************************************/ - Gate& operator=(const Gate&) = delete; - - /*-**************************************************************************************************** - @short open the gate - @descr A wait() call will not block then. - - @seealso method close() - *//*-*****************************************************************************************************/ - void open() - { - // We must safe access to our internal member! - ::osl::MutexGuard aLock( m_aAccessLock ); - // Set condition -> wait don't block any longer -> gate is open - m_aPassage.set(); - // Check if operation was successful! - // Check returns false if condition isn't set => m_bClosed will be true then => we must return false; opening failed - m_bClosed = !m_aPassage.check(); - } - - /*-**************************************************************************************************** - @short close the gate - @descr A wait() call will block then. - - @seealso method open() - *//*-*****************************************************************************************************/ - void close() - { - // We must safe access to our internal member! - ::osl::MutexGuard aLock( m_aAccessLock ); - // Reset condition -> wait blocks now -> gate is closed - m_aPassage.reset(); - // Check if operation was successful! - // Check returns false if condition was reset => m_bClosed will be true then => we can return true; closing ok - m_bClosed = !m_aPassage.check(); - } - - /*-**************************************************************************************************** - @short must be called to pass the gate - @descr If gate "open" => wait() will not block. - If gate "closed" => wait() will block till somewhere open it again. - - @seealso method wait() - @seealso method open() - - *//*-*****************************************************************************************************/ - void wait() - { - // We must safe access to our internal member! - ::osl::ClearableMutexGuard aLock( m_aAccessLock ); - // If gate not closed - caller can pass it. - if( m_bClosed ) - { - // Then we must release used access lock - - // because next call will block... - // and if we hold the access lock nobody else can use this object without a deadlock! - aLock.clear(); - // Wait for opening gate... - m_aPassage.wait(); - } - } - - // private member - - private: - - ::osl::Mutex m_aAccessLock; - ::osl::Condition m_aPassage; - bool m_bClosed; - -}; // class Gate - -} // namespace framework - -#endif // INCLUDED_FRAMEWORK_INC_THREADHELP_GATE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/threadhelp/transactionguard.hxx b/framework/inc/threadhelp/transactionguard.hxx index 2c4366cdee23..a030ba56fb56 100644 --- a/framework/inc/threadhelp/transactionguard.hxx +++ b/framework/inc/threadhelp/transactionguard.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_FRAMEWORK_INC_THREADHELP_TRANSACTIONGUARD_HXX #define INCLUDED_FRAMEWORK_INC_THREADHELP_TRANSACTIONGUARD_HXX -#include +#include namespace framework{ diff --git a/framework/inc/threadhelp/transactionmanager.hxx b/framework/inc/threadhelp/transactionmanager.hxx deleted file mode 100644 index 9dbdc3b38e57..000000000000 --- a/framework/inc/threadhelp/transactionmanager.hxx +++ /dev/null @@ -1,128 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_FRAMEWORK_INC_THREADHELP_TRANSACTIONMANAGER_HXX -#define INCLUDED_FRAMEWORK_INC_THREADHELP_TRANSACTIONMANAGER_HXX - -#include -#include - -#include -#include - -namespace framework{ - -/*-************************************************************************************************************ - @descr Describe different states of a feature of following implementation. - During lifetime of an object different working states occur: - initialization - working - closing - closed - If you wish to implement thread safe classes you should use this feature to protect - your code against calls at wrong time. e.g. you are not full initialized but somewhere - call an interface method (initialize phase means startup time from creating object till - calling specified first method e.g. XInitialization::initialize()!) then you should refuse - this call. The same for closing/disposing the object! -*//*-*************************************************************************************************************/ -enum EWorkingMode -{ - E_INIT , // We stand in an init method -> some calls are accepted - some ones are rejected - E_WORK , // Object is ready for working -> all calls are accepted - E_BEFORECLOSE, // We stand in a close method -> some calls are accepted - some ones are rejected - E_CLOSE // Object is dead! -> all calls are rejected! -}; - -/*-************************************************************************************************************ - @descr A transaction object should support throwing exceptions if user used it at wrong working mode. - e.g. We can throw a DisposedException if user try to work and our mode is E_CLOSE! - But sometimes he doesn't need this feature - will handle it by himself. - Then we must differ between some exception-modi: - E_HARDEXCEPTIONS We throw exceptions for all working modes different from E_WORK! - E_SOFTEXCEPTIONS We throw exceptions for all working modes different from E_WORK AND E_INCLOSE! - This mode is useful for impl-methods which should be callable from dispose() method! - - e.g. void dispose() - { - m_aTransactionManager.setWorkingMode( E_BEFORECLOSE ); - ... - impl_setA( 0 ); - ... - m_aTransactionManager.setWorkingMode( E_CLOSE ); - } - - void impl_setA( int nA ) - { - ERejectReason EReason; - TransactionGuard aTransactionGuard( m_aTransactionManager, E_SOFTEXCEPTIONS, eReason ); - - m_nA = nA; - } - - Normally (if E_HARDEXCEPTIONS was used!) creation of guard - will throw an exception ... but using of E_SOFTEXCEPTIONS suppress it - and member "A" can be set. -*//*-*************************************************************************************************************/ -enum EExceptionMode -{ - E_HARDEXCEPTIONS, - E_SOFTEXCEPTIONS -}; - -/*-************************************************************************************************************ - @short implement a transaction manager to support non breakable interface methods - @descr Use it to support non breakable interface methods without using any thread - synchronization like e.g. mutex, rw-lock! - That protect your code against wrong calls at wrong time ... e.g. calls after disposing an object! - Use combination of EExceptionMode and ERejectReason to detect rejected requests - and react for it. You can enable automatically throwing of exceptions too. - - @devstatus draft -*//*-*************************************************************************************************************/ -class UNLESS_MERGELIBS(FWI_DLLPUBLIC) TransactionManager -{ - - // public methods - - public: - - TransactionManager ( ); - ~TransactionManager ( ); - TransactionManager(const TransactionManager&) = delete; - TransactionManager& operator=(const TransactionManager&) = delete; - void setWorkingMode ( EWorkingMode eMode ); - EWorkingMode getWorkingMode ( ) const; - /// @throws css::uno::RuntimeException - /// @throws css::lang::DisposedException - void registerTransaction ( EExceptionMode eMode ); - /// @throws css::uno::RuntimeException - /// @throws css::lang::DisposedException - void unregisterTransaction ( ); - - private: - - mutable ::osl::Mutex m_aAccessLock; /// regulate access on internal member of this instance - Gate m_aBarrier; /// used to block transactions requests during change or work mode - EWorkingMode m_eWorkingMode; /// current working mode of object which use this manager (used to reject calls at wrong time) - sal_Int32 m_nTransactionCount; /// every transaction request is registered by this counter - -}; // class TransactionManager - -} // namespace framework - -#endif // INCLUDED_FRAMEWORK_INC_THREADHELP_TRANSACTIONMANAGER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/constitemcontainer.hxx b/framework/inc/uielement/constitemcontainer.hxx index 43f10597c4a7..063d63280e0d 100644 --- a/framework/inc/uielement/constitemcontainer.hxx +++ b/framework/inc/uielement/constitemcontainer.hxx @@ -32,7 +32,7 @@ #include #include -#include +#include namespace framework { diff --git a/framework/inc/uielement/itemcontainer.hxx b/framework/inc/uielement/itemcontainer.hxx index d22fc9a098c3..6b44578a4f71 100644 --- a/framework/inc/uielement/itemcontainer.hxx +++ b/framework/inc/uielement/itemcontainer.hxx @@ -28,7 +28,7 @@ #include #include -#include +#include namespace framework { diff --git a/framework/inc/uielement/rootitemcontainer.hxx b/framework/inc/uielement/rootitemcontainer.hxx index a71282b993a0..50c46e4a8189 100644 --- a/framework/inc/uielement/rootitemcontainer.hxx +++ b/framework/inc/uielement/rootitemcontainer.hxx @@ -34,7 +34,7 @@ #include #include -#include +#include namespace framework { diff --git a/framework/source/classes/framecontainer.cxx b/framework/source/classes/framecontainer.cxx index f1d7fd1ea018..d07697cbe8ef 100644 --- a/framework/source/classes/framecontainer.cxx +++ b/framework/source/classes/framecontainer.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include #include diff --git a/framework/source/fwi/threadhelp/transactionmanager.cxx b/framework/source/fwi/threadhelp/transactionmanager.cxx index 7b6f930b57e6..21c8fb69bf13 100644 --- a/framework/source/fwi/threadhelp/transactionmanager.cxx +++ b/framework/source/fwi/threadhelp/transactionmanager.cxx @@ -20,7 +20,7 @@ #include #include -#include +#include #include diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index 95dd35546713..d3ebf627b86c 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include #include @@ -323,17 +323,6 @@ sal_Bool SAL_CALL Desktop::terminate() return true; } -css::uno::Any Desktop::execute(css::uno::Sequence 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); @@ -1773,13 +1762,19 @@ rtl::Reference createDesktop( } +rtl::Reference framework::getDesktop( + css::uno::Reference const & context) +{ + static auto const instance = createDesktop(context); + return instance; +} + extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_framework_Desktop_get_implementation( css::uno::XComponentContext *context, css::uno::Sequence const &) { - static auto const instance = createDesktop(context); - return cppu::acquire(instance.get()); + return cppu::acquire(framework::getDesktop(context).get()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 11881c3ebefb..676965b3230c 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -33,7 +34,6 @@ #include #include #include -#include #include #include diff --git a/framework/source/services/sessionlistener.cxx b/framework/source/services/sessionlistener.cxx index b0c7e70eb725..e90cde5c3641 100644 --- a/framework/source/services/sessionlistener.cxx +++ b/framework/source/services/sessionlistener.cxx @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include -- cgit