/* -*- 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 .
*/
/*-************************************************************************************************************ @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.
class FWK_DLLPUBLIC 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;
@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 .-))
@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
@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
// we need this wrapped terminate()-call to terminate even the QuickStarter // non-virtual and non-UNO for now /// @throws css::uno::RuntimeException bool terminateQuickstarterToo();
/** 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!)
comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener
rtl::Reference< OFrames > m_xFramesHelper; /// helper for XFrames, XIndexAccess, XElementAccess and implementation of a childcontainer!
rtl::Reference< InterceptionHelper > 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<SvtCommandOptions> 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;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.