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