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 10*f8e07b45SAndrew Rist * 11*f8e07b45SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*f8e07b45SAndrew Rist * 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. 19*f8e07b45SAndrew Rist * 20*f8e07b45SAndrew Rist *************************************************************/ 21*f8e07b45SAndrew Rist 22*f8e07b45SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef __FRAMEWORK_SERVICES_SESSIONLISTENER_HXX_ 25cdf0e10cSrcweir #define __FRAMEWORK_SERVICES_SESSIONLISTENER_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir //_______________________________________________ 28cdf0e10cSrcweir // my own includes 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <classes/filtercache.hxx> 31cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx> 32cdf0e10cSrcweir #include <macros/generic.hxx> 33cdf0e10cSrcweir #include <macros/debug.hxx> 34cdf0e10cSrcweir #include <macros/xinterface.hxx> 35cdf0e10cSrcweir #include <macros/xtypeprovider.hxx> 36cdf0e10cSrcweir #include <macros/xserviceinfo.hxx> 37cdf0e10cSrcweir #include <general.h> 38cdf0e10cSrcweir 39cdf0e10cSrcweir //_______________________________________________ 40cdf0e10cSrcweir // interface includes 41cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 42cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 43cdf0e10cSrcweir 44cdf0e10cSrcweir 45cdf0e10cSrcweir #include <com/sun/star/frame/XSessionManagerListener2.hpp> 46cdf0e10cSrcweir #include <com/sun/star/frame/XSessionManagerClient.hpp> 47cdf0e10cSrcweir #include <com/sun/star/frame/XStatusListener.hpp> 48cdf0e10cSrcweir #include <com/sun/star/frame/FeatureStateEvent.hpp> 49cdf0e10cSrcweir #include <com/sun/star/lang/EventObject.hpp> 50cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 51cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx> 52cdf0e10cSrcweir 53cdf0e10cSrcweir //_______________________________________________ 54cdf0e10cSrcweir // other includes 55cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 56cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h> 57cdf0e10cSrcweir 58cdf0e10cSrcweir //_______________________________________________ 59cdf0e10cSrcweir // namespace 60cdf0e10cSrcweir 61cdf0e10cSrcweir namespace framework{ 62cdf0e10cSrcweir 63cdf0e10cSrcweir //_______________________________________________ 64cdf0e10cSrcweir // exported const 65cdf0e10cSrcweir 66cdf0e10cSrcweir //_______________________________________________ 67cdf0e10cSrcweir // exported definitions 68cdf0e10cSrcweir 69cdf0e10cSrcweir /// @HTML 70cdf0e10cSrcweir /** @short implements flat/deep detection of file/stream formats and provides 71cdf0e10cSrcweir further read/write access to the global office type configuration. 72cdf0e10cSrcweir 73cdf0e10cSrcweir @descr Using of this class makes it possible to get information about the 74cdf0e10cSrcweir format type of a given URL or stream. The returned internal type name 75cdf0e10cSrcweir can be used to get more informations about this format. Further this 76cdf0e10cSrcweir class provides full access to the configuration data and following 77cdf0e10cSrcweir implementations will support some special query modes. 78cdf0e10cSrcweir 79cdf0e10cSrcweir @author as96863 80cdf0e10cSrcweir 81cdf0e10cSrcweir @docdate 10.03.2003 by as96863 82cdf0e10cSrcweir 83cdf0e10cSrcweir @todo <ul> 84cdf0e10cSrcweir <li>implementation of query mode</li> 85cdf0e10cSrcweir <li>simple restore mechanism of last consistent cache state, 86cdf0e10cSrcweir if flush failed</li> 87cdf0e10cSrcweir </ul> 88cdf0e10cSrcweir */ 89cdf0e10cSrcweir /// @NOHTML 90cdf0e10cSrcweir 91cdf0e10cSrcweir class SessionListener : // interfaces 92cdf0e10cSrcweir public css::lang::XTypeProvider, 93cdf0e10cSrcweir public css::lang::XInitialization, 94cdf0e10cSrcweir public css::frame::XSessionManagerListener2, 95cdf0e10cSrcweir public css::frame::XStatusListener, 96cdf0e10cSrcweir public css::lang::XServiceInfo, 97cdf0e10cSrcweir // baseclasses (order important for initialization!) 98cdf0e10cSrcweir // Struct for right initalization of mutex member! Must be the first one of baseclasses! 99cdf0e10cSrcweir private ThreadHelpBase, 100cdf0e10cSrcweir public ::cppu::OWeakObject 101cdf0e10cSrcweir { 102cdf0e10cSrcweir //------------------------------------------- 103cdf0e10cSrcweir // member 104cdf0e10cSrcweir 105cdf0e10cSrcweir private: 106cdf0e10cSrcweir 107cdf0e10cSrcweir /** reference to the uno service manager, which created this service. 108cdf0e10cSrcweir It can be used to create own needed helper services. */ 109cdf0e10cSrcweir css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; 110cdf0e10cSrcweir 111cdf0e10cSrcweir css::uno::Reference< css::frame::XSessionManagerClient > m_rSessionManager; 112cdf0e10cSrcweir 113cdf0e10cSrcweir // restore handling 114cdf0e10cSrcweir sal_Bool m_bRestored; 115cdf0e10cSrcweir 116cdf0e10cSrcweir sal_Bool m_bSessionStoreRequested; 117cdf0e10cSrcweir 118cdf0e10cSrcweir sal_Bool m_bAllowUserInteractionOnQuit; 119cdf0e10cSrcweir sal_Bool m_bTerminated; 120cdf0e10cSrcweir 121cdf0e10cSrcweir 122cdf0e10cSrcweir // in case of synchronous call the caller should do saveDone() call himself! 123cdf0e10cSrcweir void StoreSession( sal_Bool bAsync ); 124cdf0e10cSrcweir 125cdf0e10cSrcweir // let session quietly close the documents, remove lock files, store configuration and etc. 126cdf0e10cSrcweir void QuitSessionQuietly(); 127cdf0e10cSrcweir 128cdf0e10cSrcweir public: 129cdf0e10cSrcweir 130cdf0e10cSrcweir //--------------------------------------- 131cdf0e10cSrcweir // XInterface, XTypeProvider, XServiceInfo 132cdf0e10cSrcweir 133cdf0e10cSrcweir FWK_DECLARE_XINTERFACE 134cdf0e10cSrcweir FWK_DECLARE_XTYPEPROVIDER 135cdf0e10cSrcweir DECLARE_XSERVICEINFO 136cdf0e10cSrcweir 137cdf0e10cSrcweir #ifdef ENABLE_AUTODOC_FIX 138cdf0e10cSrcweir ; 139cdf0e10cSrcweir #endif 140cdf0e10cSrcweir 141cdf0e10cSrcweir //--------------------------------------- 142cdf0e10cSrcweir 143cdf0e10cSrcweir /** @short initialize new instance of this class. 144cdf0e10cSrcweir 145cdf0e10cSrcweir @param xSMGR 146cdf0e10cSrcweir reference to the global uno service manager, which created this new 147cdf0e10cSrcweir factory instance. It must be used during runtime to create own 148cdf0e10cSrcweir needed services. 149cdf0e10cSrcweir */ 150cdf0e10cSrcweir 151cdf0e10cSrcweir SessionListener( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); 152cdf0e10cSrcweir 153cdf0e10cSrcweir virtual ~SessionListener(); 154cdf0e10cSrcweir 155cdf0e10cSrcweir virtual void SAL_CALL disposing(const com::sun::star::lang::EventObject&) throw (css::uno::RuntimeException); 156cdf0e10cSrcweir 157cdf0e10cSrcweir 158cdf0e10cSrcweir // XInitialization 159cdf0e10cSrcweir virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& args) throw (css::uno::RuntimeException); 160cdf0e10cSrcweir 161cdf0e10cSrcweir // XSessionManagerListener 162cdf0e10cSrcweir virtual void SAL_CALL doSave( sal_Bool bShutdown, sal_Bool bCancelable ) 163cdf0e10cSrcweir throw (css::uno::RuntimeException); 164cdf0e10cSrcweir virtual void SAL_CALL approveInteraction( sal_Bool bInteractionGranted ) 165cdf0e10cSrcweir throw (css::uno::RuntimeException); 166cdf0e10cSrcweir virtual void SAL_CALL shutdownCanceled() 167cdf0e10cSrcweir throw (css::uno::RuntimeException); 168cdf0e10cSrcweir virtual sal_Bool SAL_CALL doRestore() 169cdf0e10cSrcweir throw (css::uno::RuntimeException); 170cdf0e10cSrcweir 171cdf0e10cSrcweir // XSessionManagerListener2 172cdf0e10cSrcweir virtual void SAL_CALL doQuit() 173cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 174cdf0e10cSrcweir 175cdf0e10cSrcweir // XStatusListener 176cdf0e10cSrcweir virtual void SAL_CALL statusChanged(const com::sun::star::frame::FeatureStateEvent& event) 177cdf0e10cSrcweir throw (css::uno::RuntimeException); 178cdf0e10cSrcweir 179cdf0e10cSrcweir void doSaveImpl( sal_Bool bShutdown, sal_Bool bCancelable ) throw (css::uno::RuntimeException); 180cdf0e10cSrcweir }; 181cdf0e10cSrcweir 182cdf0e10cSrcweir } // namespace framework 183cdf0e10cSrcweir 184cdf0e10cSrcweir #endif // #ifndef __FRAMEWORK_SERVICES_TYPEDETECTION_HXX_ 185