LCOV - code coverage report
Current view: top level - framework/inc/services - desktop.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 4 4 100.0 %
Date: 2014-04-11 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      272283 :         virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
     131      272283 :             { OWeakObject::acquire(); }
     132      272199 :         virtual void SAL_CALL release() throw () SAL_OVERRIDE
     133      272199 :             { 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 isnt 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 ) 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             :     //  private methods
     322             : 
     323             :     private:
     324             : 
     325             :         css::uno::Reference< css::lang::XComponent >            impl_getFrameComponent          ( const css::uno::Reference< css::frame::XFrame >&  xFrame          ) const;
     326             :         static const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor(                                                                   );
     327             : 
     328             :         /** calls queryTermination() on every registered termination listener.
     329             :          *
     330             :          *  Note: Only normal termination listener (registered in list m_aListenerContainer
     331             :          *        will be recognized here. Special listener like quick starter, pipe or others
     332             :          *        has to be handled explicitly !
     333             :          *
     334             :          *  @param  [out] lCalledListener
     335             :          *          every called listener will be returned here.
     336             :          *          Those list will be used to informa all called listener
     337             :          *          about cancel this termination request.
     338             :          *
     339             :          *  @param  [out] bVeto
     340             :          *          will be true if at least one listener throwed a veto exception;
     341             :          *          false otherwise.
     342             :          *
     343             :          *  @see    impl_sendCancelTerminationEvent()
     344             :          */
     345             :         void impl_sendQueryTerminationEvent(TTerminateListenerList& lCalledListener,
     346             :                                             bool&             bVeto          );
     347             : 
     348             :         /** calls cancelTermination() on every termination listener
     349             :          *  where queryTermination() was called before.
     350             :          *
     351             :          *  Note: Only normal termination listener (registered in list m_aListenerContainer
     352             :          *        will be recognized here. Special listener like quick starter, pipe or others
     353             :          *        has to be handled explicitly !
     354             :          *
     355             :          *  @param  [in] lCalledListener
     356             :          *          every listener in this list was called within its method
     357             :          *          queryTermination() before.
     358             :          *
     359             :          *  @see    impl_sendQueryTerminationEvent()
     360             :          */
     361             :         void impl_sendCancelTerminationEvent(const TTerminateListenerList& lCalledListener);
     362             : 
     363             :         /** calls notifyTermination() on every registered termination listener.
     364             :          *
     365             :          *  Note: Only normal termination listener (registered in list m_aListenerContainer
     366             :          *        will be recognized here. Special listener like quick starter, pipe or others
     367             :          *        has to be handled explicitly !
     368             :          */
     369             :         void impl_sendNotifyTerminationEvent();
     370             : 
     371             :         /** try to close all open frames.
     372             :          *
     373             :          *  Iterates over all child frames and try to close them.
     374             :          *  Given parameter bAllowUI enable/disable showing any UI
     375             :          *  (which mostly occur on calling XController->suspend()).
     376             :          *
     377             :          *  This method doesn't stop if one frame could not be closed.
     378             :          *  It will ignore such frames and try all other ones.
     379             :          *  But it returns false in such case - true otherwise.
     380             :          *
     381             :          *  @param  bAllowUI
     382             :          *          enable/disable showing of UI.
     383             :          *
     384             :          *  @return true if all frames could be closed; false otherwise.
     385             :          */
     386             :         bool impl_closeFrames(bool bAllowUI);
     387             : 
     388             :     //  debug methods
     389             :     //  (should be private everytime!)
     390             : 
     391             :     private:
     392             : 
     393             :         static bool implcp_addEventListener         ( const css::uno::Reference< css::lang::XEventListener >&           xListener        );
     394             :         static bool implcp_removeEventListener      ( const css::uno::Reference< css::lang::XEventListener >&           xListener        );
     395             : 
     396             :         bool m_bIsTerminated;  /// check flag to protect us against dispose before terminate!
     397             :                                     /// see dispose() for further information!
     398             : 
     399             :     //  variables
     400             :     //  (should be private everytime!)
     401             : 
     402             :     private:
     403             : 
     404             :         css::uno::Reference< css::uno::XComponentContext >              m_xContext;               /// reference to factory, which has create this instance
     405             :         FrameContainer                                                  m_aChildTaskContainer;    /// array of child tasks (children of desktop are tasks; and tasks are also frames - But pure frames are not accepted!)
     406             :         ::cppu::OMultiTypeInterfaceContainerHelper                      m_aListenerContainer;     /// container for ALL Listener
     407             :         css::uno::Reference< css::frame::XFrames >                      m_xFramesHelper;          /// helper for XFrames, XIndexAccess, XElementAccess and implementation of a childcontainer!
     408             :         css::uno::Reference< css::frame::XDispatchProvider >            m_xDispatchHelper;        /// helper to dispatch something for new tasks, created by "_blank"!
     409             :         ELoadState                                                      m_eLoadState;             /// hold information about state of asynchron loading of component for loadComponentFromURL()!
     410             :         css::uno::Reference< css::frame::XFrame >                       m_xLastFrame;             /// last target of "loadComponentFromURL()"!
     411             :         css::uno::Any                                                   m_aInteractionRequest;
     412             :         bool                                                            m_bSuspendQuickstartVeto; /// don't ask quickstart for a veto
     413             :         SvtCommandOptions                                               m_aCommandOptions;        /// ref counted class to support disabling commands defined by configuration file
     414             :         OUString                                                        m_sName;
     415             :         OUString                                                        m_sTitle;
     416             :         css::uno::Reference< css::frame::XDispatchRecorderSupplier >    m_xDispatchRecorderSupplier;
     417             : 
     418             :         /** special terminate listener to close pipe and block external requests
     419             :           * during/after termination process is/was running
     420             :           */
     421             :         css::uno::Reference< css::frame::XTerminateListener > m_xPipeTerminator;
     422             : 
     423             :         /** special terminate listener shown inside system tray (quick starter)
     424             :           * Will hinder the office on shutdown ... but wish to allow closing
     425             :           * of open documents. And because thats different to a normal terminate listener
     426             :           * it has to be handled special .-)
     427             :           */
     428             :         css::uno::Reference< css::frame::XTerminateListener > m_xQuickLauncher;
     429             : 
     430             :         /** special terminate listener which loads images asynchronous for current open documents.
     431             :           * Because internally it uses blocking system APIs ... it cant be guaranteed that
     432             :           * running jobs can be cancelled successfully if the corressponding document will be closed ...
     433             :           * it will not hinder those documents on closing. Instead it let all jobs running ...
     434             :           * but at least on terminate we have to wait for all those blocked requests.
     435             :           * So these implementation must be a special terminate listener too .-(
     436             :           */
     437             :         css::uno::Reference< css::frame::XTerminateListener > m_xSWThreadManager;
     438             : 
     439             :         /** special terminate listener shuting down the SfxApplication.
     440             :           * Because these desktop instance closes documents and informs listener
     441             :           * only ... it does not really shutdown the whole application.
     442             :           *
     443             :           * Btw: That wouldnt be possible by design ... because Desktop.terminate()
     444             :           * has to return a boolean value about success ... it cant really shutdown the
     445             :           * process .-)
     446             :           *
     447             :           * So we uses a trick: A special listener (exactly these one here) listen for notifyTermination()
     448             :           * and shutdown the process asynchronous. But desktop has to make this special
     449             :           * notification as really last one ... Otherwise it can happen that asynchronous
     450             :           * shutdown will be faster then all other code around Desktop.terminate() .-))
     451             :           */
     452             :         css::uno::Reference< css::frame::XTerminateListener > m_xSfxTerminator;
     453             : 
     454             :         css::uno::Reference< css::frame::XUntitledNumbers > m_xTitleNumberGenerator;
     455             : 
     456             : };      //  class Desktop
     457             : 
     458             : }       //  namespace framework
     459             : 
     460             : #endif // INCLUDED_FRAMEWORK_INC_SERVICES_DESKTOP_HXX
     461             : 
     462             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10