LCOV - code coverage report
Current view: top level - framework/inc/services - desktop.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 4 4 100.0 %
Date: 2015-06-13 12:38:46 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_FRAMEWORK_INC_SERVICES_DESKTOP_HXX
      21             : #define INCLUDED_FRAMEWORK_INC_SERVICES_DESKTOP_HXX
      22             : 
      23             : #include <sal/config.h>
      24             : 
      25             : #include <classes/framecontainer.hxx>
      26             : 
      27             : #include <com/sun/star/frame/XUntitledNumbers.hpp>
      28             : #include <com/sun/star/frame/XController.hpp>
      29             : #include <com/sun/star/frame/XDesktop2.hpp>
      30             : #include <com/sun/star/frame/XTerminateListener.hpp>
      31             : #include <com/sun/star/frame/XTask.hpp>
      32             : #include <com/sun/star/frame/XStorable.hpp>
      33             : #include <com/sun/star/frame/XModel.hpp>
      34             : #include <com/sun/star/frame/XFramesSupplier.hpp>
      35             : #include <com/sun/star/frame/XFrames.hpp>
      36             : #include <com/sun/star/lang/XServiceInfo.hpp>
      37             : #include <com/sun/star/frame/XDispatchProvider.hpp>
      38             : #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
      39             : #include <com/sun/star/frame/XComponentLoader.hpp>
      40             : #include <com/sun/star/frame/FrameAction.hpp>
      41             : #include <com/sun/star/frame/XTasksSupplier.hpp>
      42             : #include <com/sun/star/container/XEnumerationAccess.hpp>
      43             : #include <com/sun/star/lang/Locale.hpp>
      44             : #include <com/sun/star/frame/XDispatchResultListener.hpp>
      45             : #include <com/sun/star/lang/XEventListener.hpp>
      46             : #include <com/sun/star/lang/XComponent.hpp>
      47             : #include <com/sun/star/task/XInteractionHandler.hpp>
      48             : #include <com/sun/star/frame/XDispatchRecorderSupplier.hpp>
      49             : #include <com/sun/star/uno/XComponentContext.hpp>
      50             : 
      51             : #include <comphelper/numberedcollection.hxx>
      52             : #include <cppuhelper/compbase6.hxx>
      53             : #include <cppuhelper/propshlp.hxx>
      54             : #include <unotools/cmdoptions.hxx>
      55             : 
      56             : namespace framework{
      57             : 
      58             : enum ELoadState
      59             : {
      60             :     E_NOTSET      ,
      61             :     E_SUCCESSFUL  ,
      62             :     E_FAILED      ,
      63             :     E_INTERACTION
      64             : };
      65             : 
      66             : /*-************************************************************************************************************
      67             :     @short      implement the topframe of frame tree
      68             :     @descr      This is the root of the frame tree. The desktop has no window, is not visible but he is the logical
      69             :                 "masternode" to build the hierarchy.
      70             : 
      71             :     @implements XInterface
      72             :                 XTypeProvider
      73             :                 XServiceInfo
      74             :                 XDesktop
      75             :                 XComponentLoader
      76             :                 XTasksSupplier
      77             :                 XDispatchProvider
      78             :                 XFramesSupplier
      79             :                 XFrame
      80             :                 XComponent
      81             :                 XPropertySet
      82             :                 XFastPropertySet
      83             :                 XMultiPropertySet
      84             :                 XDispatchResultListener
      85             :                 XEventListener
      86             :                 XInteractionHandler
      87             : 
      88             :     @devstatus  ready to use
      89             :     @threadsafe yes
      90             : *//*-*************************************************************************************************************/
      91             : typedef cppu::WeakComponentImplHelper6<
      92             :            css::lang::XServiceInfo              ,
      93             :            css::frame::XDesktop2                ,
      94             :            css::frame::XTasksSupplier           ,
      95             :            css::frame::XDispatchResultListener  ,   // => XEventListener
      96             :            css::task::XInteractionHandler       ,
      97             :            css::frame::XUntitledNumbers > Desktop_BASE;
      98             : 
      99             : class Desktop : private cppu::BaseMutex,
     100             :                 private TransactionBase,
     101             :                 public Desktop_BASE,
     102             :                 public cppu::OPropertySetHelper
     103             : {
     104             :     // internal used types, const etcpp.
     105             :     private:
     106             : 
     107             :         /** used temporary to know which listener was already called or not. */
     108             :         typedef ::std::vector< css::uno::Reference< css::frame::XTerminateListener > > TTerminateListenerList;
     109             : 
     110             :     // public methods
     111             :     public:
     112             : 
     113             :         //  constructor / destructor
     114             :                  Desktop( const css::uno::Reference< css::uno::XComponentContext >& xContext );
     115             :         virtual ~Desktop(                                                                    );
     116             : 
     117             :         void constructorInit();
     118             : 
     119             :         //  XServiceInfo
     120             :         virtual OUString SAL_CALL getImplementationName()
     121             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     122             : 
     123             :         virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
     124             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     125             : 
     126             :         virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
     127             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     128             : 
     129             :         // XInterface
     130      433614 :         virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
     131      433614 :             { OWeakObject::acquire(); }
     132      433504 :         virtual void SAL_CALL release() throw () SAL_OVERRIDE
     133      433504 :             { OWeakObject::release(); }
     134             :         virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     135             : 
     136             :         // XTypeProvider
     137             :         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     138             : 
     139             :         /**
     140             :             @interface  XDesktop
     141             : 
     142             :             @short      try to shutdown these desktop environment.
     143             : 
     144             :             @descr      Will try to close all frames. If at least one frame could
     145             :                         not be closed successfully termination will be stopped.
     146             : 
     147             :                         Registered termination listener will be taken into account
     148             :                         also. As special feature some of our registered listener
     149             :                         are well known by its UNO implementation name. They are handled
     150             :                         different to all other listener.
     151             : 
     152             :                         Btw: Desktop.terminate() was designed in the past to be used
     153             :                         within an UI based envrionment. So it's allowed e.g. to
     154             :                         call XController.suspend() here. If UI isn't an option ... please
     155             :                         use XCloseable.close() at these desktop implementation.
     156             :                         ... if it will be supported in the future .-))
     157             : 
     158             :             @seealso    XTerminateListener
     159             :             @seealso    XTerminateListener2
     160             : 
     161             :             @return     true if all open frames could be closed and no listener throwed
     162             :                         a veto exception; false otherwise.
     163             : 
     164             :             @onerror    False will be returned.
     165             :             @threadsafe yes
     166             :          */
     167             :         virtual sal_Bool SAL_CALL terminate()
     168             :             throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     169             : 
     170             :         /**
     171             :             @interface  XDesktop
     172             : 
     173             :             @short      add a listener for termination events
     174             : 
     175             :             @descr      Additional to adding normal listener these method was implemented special.
     176             :                         Every listener will be asked for its uno implementation name.
     177             :                         Some of them are well known ... and the corresponding listener wont be added
     178             :                         to the container of "normal listener". Those listener will be set as special
     179             :                         member.
     180             :                         see e.g. member m_xSfxTerminator
     181             : 
     182             :             @seealso    terminate()
     183             : 
     184             :             @param      xListener
     185             :                         the listener for registration.
     186             : 
     187             :             @threadsafe yes
     188             :          */
     189             :         virtual void SAL_CALL addTerminateListener( const css::uno::Reference< css::frame::XTerminateListener >& xListener )
     190             :             throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     191             : 
     192             :         /**
     193             :             @interface  XDesktop
     194             : 
     195             :             @short      remove a listener from this container.
     196             : 
     197             :             @descr      Additional to removing normal listener these method was implemented special.
     198             :                         Every listener will be asked for its uno implementation name.
     199             :                         Some of them are well known ... and the corresponding listener was set as special member.
     200             :                         Now those special member will be reseted also.
     201             :                         see e.g. member m_xSfxTerminator
     202             : 
     203             :             @seealso    terminate()
     204             : 
     205             :             @param      xListener
     206             :                         the listener for deregistration.
     207             : 
     208             :             @threadsafe yes
     209             :          */
     210             :         virtual void SAL_CALL removeTerminateListener( const css::uno::Reference< css::frame::XTerminateListener >& xListener )
     211             :             throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     212             : 
     213             :         virtual css::uno::Reference< css::container::XEnumerationAccess >           SAL_CALL getComponents              (                                                                                 ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     214             :         virtual css::uno::Reference< css::lang::XComponent >                        SAL_CALL getCurrentComponent        (                                                                                 ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     215             :         virtual css::uno::Reference< css::frame::XFrame >                           SAL_CALL getCurrentFrame            (                                                                                 ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     216             : 
     217             :         //  XComponentLoader
     218             :         virtual css::uno::Reference< css::lang::XComponent >                        SAL_CALL loadComponentFromURL       ( const OUString&                                         sURL             ,
     219             :                                                                                                                           const OUString&                                         sTargetFrameName ,
     220             :                                                                                                                                 sal_Int32                                                nSearchFlags     ,
     221             :                                                                                                                           const css::uno::Sequence< css::beans::PropertyValue >&         lArguments       ) throw( css::io::IOException                ,
     222             :                                                                                                                                                                                                                    css::lang::IllegalArgumentException ,
     223             :                                                                                                                                                                                                                    css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     224             : 
     225             :         //  XTasksSupplier
     226             :         virtual css::uno::Reference< css::container::XEnumerationAccess >           SAL_CALL getTasks                   (                                                                                 ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     227             :         virtual css::uno::Reference< css::frame::XTask >                            SAL_CALL getActiveTask              (                                                                                 ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     228             : 
     229             :         //  XDispatchProvider
     230             :         virtual css::uno::Reference< css::frame::XDispatch >                        SAL_CALL queryDispatch              ( const css::util::URL&                                          aURL             ,
     231             :                                                                                                                           const OUString&                                         sTargetFrameName ,
     232             :                                                                                                                                 sal_Int32                                                nSearchFlags     ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     233             :         virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > >  SAL_CALL queryDispatches            ( const css::uno::Sequence< css::frame::DispatchDescriptor >&    lQueries         ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     234             : 
     235             :         // XDispatchProviderInterception
     236             :         virtual void                                                                SAL_CALL registerDispatchProviderInterceptor( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) throw( css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     237             :         virtual void                                                                SAL_CALL releaseDispatchProviderInterceptor ( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) throw( css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     238             : 
     239             :         //  XFramesSupplier
     240             :         virtual css::uno::Reference< css::frame::XFrames >                          SAL_CALL getFrames                  (                                                                                 ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     241             :         virtual css::uno::Reference< css::frame::XFrame >                           SAL_CALL getActiveFrame             (                                                                                 ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     242             :         virtual void                                                                SAL_CALL setActiveFrame             ( const css::uno::Reference< css::frame::XFrame >&               xFrame           ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     243             : 
     244             :         //   XFrame
     245             :         //  Attention: findFrame() is implemented only! Other methods make no sense for our desktop!
     246             :         virtual css::uno::Reference< css::frame::XFrame >                           SAL_CALL findFrame                  ( const OUString&                                         sTargetFrameName ,
     247             :                                                                                                                                 sal_Int32                                                nSearchFlags     ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     248             :         virtual void                                                                SAL_CALL initialize                 ( const css::uno::Reference< css::awt::XWindow >&                xWindow          ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     249             :         virtual css::uno::Reference< css::awt::XWindow >                            SAL_CALL getContainerWindow         (                                                                                 ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     250             :         virtual void                                                                SAL_CALL setCreator                 ( const css::uno::Reference< css::frame::XFramesSupplier >&      xCreator         ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     251             :         virtual css::uno::Reference< css::frame::XFramesSupplier >                  SAL_CALL getCreator                 (                                                                                 ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     252             :         virtual OUString                                                     SAL_CALL getName                    (                                                                                 ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     253             :         virtual void                                                                SAL_CALL setName                    ( const OUString&                                         sName            ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     254             :         virtual sal_Bool                                                            SAL_CALL isTop                      (                                                                                 ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     255             :         virtual void                                                                SAL_CALL activate                   (                                                                                 ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     256             :         virtual void                                                                SAL_CALL deactivate                 (                                                                                 ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     257             :         virtual sal_Bool                                                            SAL_CALL isActive                   (                                                                                 ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     258             :         virtual sal_Bool                                                            SAL_CALL setComponent               ( const css::uno::Reference< css::awt::XWindow >&                xComponentWindow ,
     259             :                                                                                                                           const css::uno::Reference< css::frame::XController >&          xController      ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     260             :         virtual css::uno::Reference< css::awt::XWindow >                            SAL_CALL getComponentWindow         (                                                                                 ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     261             :         virtual css::uno::Reference< css::frame::XController >                      SAL_CALL getController              (                                                                                 ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     262             :         virtual void                                                                SAL_CALL contextChanged             (                                                                                 ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     263             :         virtual void                                                                SAL_CALL addFrameActionListener     ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener        ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     264             :         virtual void                                                                SAL_CALL removeFrameActionListener  ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener        ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     265             : 
     266             :         //   XComponent
     267             :         virtual void SAL_CALL disposing() throw( css::uno::RuntimeException ) SAL_OVERRIDE;
     268             :         virtual void                                                                SAL_CALL addEventListener           ( const css::uno::Reference< css::lang::XEventListener >&        xListener        ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     269             :         virtual void                                                                SAL_CALL removeEventListener        ( const css::uno::Reference< css::lang::XEventListener >&        xListener        ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     270             : 
     271             :         //   XDispatchResultListener
     272             :         virtual void SAL_CALL dispatchFinished      ( const css::frame::DispatchResultEvent&                    aEvent     ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     273             : 
     274             :         //   XEventListener
     275             :         virtual void                                                                SAL_CALL disposing                  ( const css::lang::EventObject&                                  aSource          ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     276             : 
     277             :         //   XInteractionHandler
     278             :         virtual void                                                                SAL_CALL handle                     ( const css::uno::Reference< css::task::XInteractionRequest >&   xRequest         ) throw( css::uno::RuntimeException, std::exception          ) SAL_OVERRIDE;
     279             : 
     280             :         // css.frame.XUntitledNumbers
     281             :         virtual ::sal_Int32 SAL_CALL leaseNumber( const css::uno::Reference< css::uno::XInterface >& xComponent )
     282             :             throw (css::lang::IllegalArgumentException,
     283             :                    css::uno::RuntimeException, std::exception         ) SAL_OVERRIDE;
     284             : 
     285             :         // css.frame.XUntitledNumbers
     286             :         virtual void SAL_CALL releaseNumber( ::sal_Int32 nNumber )
     287             :             throw (css::lang::IllegalArgumentException,
     288             :                    css::uno::RuntimeException, std::exception         ) SAL_OVERRIDE;
     289             : 
     290             :         // css.frame.XUntitledNumbers
     291             :         virtual void SAL_CALL releaseNumberForComponent( const css::uno::Reference< css::uno::XInterface >& xComponent )
     292             :             throw (css::lang::IllegalArgumentException,
     293             :                    css::uno::RuntimeException, std::exception         ) SAL_OVERRIDE;
     294             : 
     295             :         // css.frame.XUntitledNumbers
     296             :         virtual OUString SAL_CALL getUntitledPrefix()
     297             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     298             : 
     299             :         // we need this wrapped terminate()-call to terminate even the QuickStarter
     300             :         // non-virtual and non-UNO for now
     301             :         bool SAL_CALL terminateQuickstarterToo()
     302             :             throw( css::uno::RuntimeException );
     303             : 
     304             :     //  protected methods
     305             : 
     306             :     protected:
     307             : 
     308             :         //  OPropertySetHelper
     309             :         virtual sal_Bool                                            SAL_CALL convertFastPropertyValue        (       css::uno::Any&  aConvertedValue ,
     310             :                                                                                                                      css::uno::Any&  aOldValue       ,
     311             :                                                                                                                      sal_Int32       nHandle         ,
     312             :                                                                                                                const css::uno::Any&  aValue          ) throw( css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     313             :         virtual void                                                SAL_CALL setFastPropertyValue_NoBroadcast(       sal_Int32       nHandle         ,
     314             :                                                                                                                const css::uno::Any&  aValue          ) throw( css::uno::Exception, std::exception                 ) SAL_OVERRIDE;
     315             :         using cppu::OPropertySetHelper::getFastPropertyValue;
     316             :         virtual void                                                SAL_CALL getFastPropertyValue            (       css::uno::Any&  aValue          ,
     317             :                                                                                                                      sal_Int32       nHandle         ) const SAL_OVERRIDE;
     318             :         virtual ::cppu::IPropertyArrayHelper&                       SAL_CALL getInfoHelper                   (                                       ) SAL_OVERRIDE;
     319             :         virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo              (                                       ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     320             : 
     321             : 
     322             :     private:
     323             : 
     324             :         css::uno::Reference< css::lang::XComponent >            impl_getFrameComponent          ( const css::uno::Reference< css::frame::XFrame >&  xFrame          ) const;
     325             :         static const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor(                                                                   );
     326             : 
     327             :         /** calls queryTermination() on every registered termination listener.
     328             :          *
     329             :          *  Note: Only normal termination listener (registered in list m_aListenerContainer
     330             :          *        will be recognized here. Special listener like quick starter, pipe or others
     331             :          *        has to be handled explicitly !
     332             :          *
     333             :          *  @param  [out] lCalledListener
     334             :          *          every called listener will be returned here.
     335             :          *          Those list will be used to informa all called listener
     336             :          *          about cancel this termination request.
     337             :          *
     338             :          *  @param  [out] bVeto
     339             :          *          will be true if at least one listener throwed a veto exception;
     340             :          *          false otherwise.
     341             :          *
     342             :          *  @see    impl_sendCancelTerminationEvent()
     343             :          */
     344             :         void impl_sendQueryTerminationEvent(TTerminateListenerList& lCalledListener,
     345             :                                             bool&             bVeto          );
     346             : 
     347             :         /** calls cancelTermination() on every termination listener
     348             :          *  where queryTermination() was called before.
     349             :          *
     350             :          *  Note: Only normal termination listener (registered in list m_aListenerContainer
     351             :          *        will be recognized here. Special listener like quick starter, pipe or others
     352             :          *        has to be handled explicitly !
     353             :          *
     354             :          *  @param  [in] lCalledListener
     355             :          *          every listener in this list was called within its method
     356             :          *          queryTermination() before.
     357             :          *
     358             :          *  @see    impl_sendQueryTerminationEvent()
     359             :          */
     360             :         void impl_sendCancelTerminationEvent(const TTerminateListenerList& lCalledListener);
     361             : 
     362             :         /** calls notifyTermination() on every registered termination listener.
     363             :          *
     364             :          *  Note: Only normal termination listener (registered in list m_aListenerContainer
     365             :          *        will be recognized here. Special listener like quick starter, pipe or others
     366             :          *        has to be handled explicitly !
     367             :          */
     368             :         void impl_sendNotifyTerminationEvent();
     369             : 
     370             :         /** try to close all open frames.
     371             :          *
     372             :          *  Iterates over all child frames and try to close them.
     373             :          *  Given parameter bAllowUI enable/disable showing any UI
     374             :          *  (which mostly occur on calling XController->suspend()).
     375             :          *
     376             :          *  This method doesn't stop if one frame could not be closed.
     377             :          *  It will ignore such frames and try all other ones.
     378             :          *  But it returns false in such case - true otherwise.
     379             :          *
     380             :          *  @param  bAllowUI
     381             :          *          enable/disable showing of UI.
     382             :          *
     383             :          *  @return true if all frames could be closed; false otherwise.
     384             :          */
     385             :         bool impl_closeFrames(bool bAllowUI);
     386             : 
     387             :     //  debug methods
     388             :     //  (should be private every time!)
     389             : 
     390             :     private:
     391             : 
     392             :         static bool implcp_addEventListener         ( const css::uno::Reference< css::lang::XEventListener >&           xListener        );
     393             :         static bool implcp_removeEventListener      ( const css::uno::Reference< css::lang::XEventListener >&           xListener        );
     394             : 
     395             :         bool m_bIsTerminated;  /// check flag to protect us against dispose before terminate!
     396             :                                     /// see dispose() for further information!
     397             : 
     398             :     //  variables
     399             :     //  (should be private every time!)
     400             : 
     401             :     private:
     402             : 
     403             :         css::uno::Reference< css::uno::XComponentContext >              m_xContext;               /// reference to factory, which has create this instance
     404             :         FrameContainer                                                  m_aChildTaskContainer;    /// array of child tasks (children of desktop are tasks; and tasks are also frames - But pure frames are not accepted!)
     405             :         ::cppu::OMultiTypeInterfaceContainerHelper                      m_aListenerContainer;     /// container for ALL Listener
     406             :         css::uno::Reference< css::frame::XFrames >                      m_xFramesHelper;          /// helper for XFrames, XIndexAccess, XElementAccess and implementation of a childcontainer!
     407             :         css::uno::Reference< css::frame::XDispatchProvider >            m_xDispatchHelper;        /// helper to dispatch something for new tasks, created by "_blank"!
     408             :         ELoadState                                                      m_eLoadState;             /// hold information about state of asynchron loading of component for loadComponentFromURL()!
     409             :         css::uno::Reference< css::frame::XFrame >                       m_xLastFrame;             /// last target of "loadComponentFromURL()"!
     410             :         css::uno::Any                                                   m_aInteractionRequest;
     411             :         bool                                                            m_bSuspendQuickstartVeto; /// don't ask quickstart for a veto
     412             :         SvtCommandOptions                                               m_aCommandOptions;        /// ref counted class to support disabling commands defined by configuration file
     413             :         OUString                                                        m_sName;
     414             :         OUString                                                        m_sTitle;
     415             :         css::uno::Reference< css::frame::XDispatchRecorderSupplier >    m_xDispatchRecorderSupplier;
     416             : 
     417             :         /** special terminate listener to close pipe and block external requests
     418             :           * during/after termination process is/was running
     419             :           */
     420             :         css::uno::Reference< css::frame::XTerminateListener > m_xPipeTerminator;
     421             : 
     422             :         /** special terminate listener shown inside system tray (quick starter)
     423             :           * Will hinder the office on shutdown ... but wish to allow closing
     424             :           * of open documents. And because thats different to a normal terminate listener
     425             :           * it has to be handled special .-)
     426             :           */
     427             :         css::uno::Reference< css::frame::XTerminateListener > m_xQuickLauncher;
     428             : 
     429             :         /** special terminate listener which loads images asynchronous for current open documents.
     430             :           * Because internally it uses blocking system APIs ... it can't be guaranteed that
     431             :           * running jobs can be cancelled successfully if the corressponding document will be closed ...
     432             :           * it will not hinder those documents on closing. Instead it let all jobs running ...
     433             :           * but at least on terminate we have to wait for all those blocked requests.
     434             :           * So these implementation must be a special terminate listener too .-(
     435             :           */
     436             :         css::uno::Reference< css::frame::XTerminateListener > m_xSWThreadManager;
     437             : 
     438             :         /** special terminate listener shuting down the SfxApplication.
     439             :           * Because these desktop instance closes documents and informs listener
     440             :           * only ... it does not really shutdown the whole application.
     441             :           *
     442             :           * Btw: That wouldnt be possible by design ... because Desktop.terminate()
     443             :           * has to return a boolean value about success ... it can't really shutdown the
     444             :           * process .-)
     445             :           *
     446             :           * So we uses a trick: A special listener (exactly these one here) listen for notifyTermination()
     447             :           * and shutdown the process asynchronous. But desktop has to make this special
     448             :           * notification as really last one ... Otherwise it can happen that asynchronous
     449             :           * shutdown will be faster then all other code around Desktop.terminate() .-))
     450             :           */
     451             :         css::uno::Reference< css::frame::XTerminateListener > m_xSfxTerminator;
     452             : 
     453             :         css::uno::Reference< css::frame::XUntitledNumbers > m_xTitleNumberGenerator;
     454             : 
     455             : };      //  class Desktop
     456             : 
     457             : }       //  namespace framework
     458             : 
     459             : #endif // INCLUDED_FRAMEWORK_INC_SERVICES_DESKTOP_HXX
     460             : 
     461             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11