update dev300-m58
[ooovba.git] / framework / inc / services / sessionlistener.hxx
blobf9784f3aa632994df718509d79d078f670712c99
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sessionlistener.hxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __FRAMEWORK_SERVICES_SESSIONLISTENER_HXX_
32 #define __FRAMEWORK_SERVICES_SESSIONLISTENER_HXX_
34 //_______________________________________________
35 // my own includes
37 #include <classes/filtercache.hxx>
38 #include <threadhelp/threadhelpbase.hxx>
39 #include <macros/generic.hxx>
40 #include <macros/debug.hxx>
41 #include <macros/xinterface.hxx>
42 #include <macros/xtypeprovider.hxx>
43 #include <macros/xserviceinfo.hxx>
44 #include <general.h>
46 //_______________________________________________
47 // interface includes
48 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
49 #include <com/sun/star/lang/XInitialization.hpp>
52 #include <com/sun/star/frame/XSessionManagerListener.hpp>
53 #include <com/sun/star/frame/XSessionManagerClient.hpp>
54 #include <com/sun/star/frame/XStatusListener.hpp>
55 #include <com/sun/star/frame/FeatureStateEvent.hpp>
56 #include <com/sun/star/lang/EventObject.hpp>
57 #include <com/sun/star/uno/Sequence.hxx>
58 #include <com/sun/star/uno/Any.hxx>
60 //_______________________________________________
61 // other includes
62 #include <cppuhelper/weak.hxx>
63 #include <cppuhelper/interfacecontainer.h>
65 //_______________________________________________
66 // namespace
68 namespace framework{
70 //_______________________________________________
71 // exported const
73 //_______________________________________________
74 // exported definitions
76 /// @HTML
77 /** @short implements flat/deep detection of file/stream formats and provides
78 further read/write access to the global office type configuration.
80 @descr Using of this class makes it possible to get information about the
81 format type of a given URL or stream. The returned internal type name
82 can be used to get more informations about this format. Further this
83 class provides full access to the configuration data and following
84 implementations will support some special query modes.
86 @author as96863
88 @docdate 10.03.2003 by as96863
90 @todo <ul>
91 <li>implementation of query mode</li>
92 <li>simple restore mechanism of last consistent cache state,
93 if flush failed</li>
94 </ul>
96 /// @NOHTML
98 class SessionListener : // interfaces
99 public css::lang::XTypeProvider,
100 public css::lang::XInitialization,
101 public css::frame::XSessionManagerListener,
102 public css::frame::XStatusListener,
103 public css::lang::XServiceInfo,
104 // baseclasses (order important for initialization!)
105 // Struct for right initalization of mutex member! Must be the first one of baseclasses!
106 private ThreadHelpBase,
107 public ::cppu::OWeakObject
109 //-------------------------------------------
110 // member
112 private:
114 /** reference to the uno service manager, which created this service.
115 It can be used to create own needed helper services. */
116 css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
118 css::uno::Reference< css::frame::XSessionManagerClient > m_rSessionManager;
120 void _requestInteraction();
121 void _finishInteraction( sal_Bool bCancelShutdown );
122 void _saveAutorecovery( sal_Bool bSessionSave );
124 // restore handling
125 sal_Bool m_bRestored;
127 public:
129 //---------------------------------------
130 // XInterface, XTypeProvider, XServiceInfo
132 FWK_DECLARE_XINTERFACE
133 FWK_DECLARE_XTYPEPROVIDER
134 DECLARE_XSERVICEINFO
136 #ifdef ENABLE_AUTODOC_FIX
138 #endif
140 //---------------------------------------
142 /** @short initialize new instance of this class.
144 @param xSMGR
145 reference to the global uno service manager, which created this new
146 factory instance. It must be used during runtime to create own
147 needed services.
150 SessionListener( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR );
152 virtual ~SessionListener();
154 virtual void SAL_CALL disposing(const com::sun::star::lang::EventObject&) throw (css::uno::RuntimeException);
157 // XInitialization
158 virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& args) throw (css::uno::RuntimeException);
160 // XSessionManagerListener
161 virtual void SAL_CALL doSave( sal_Bool bShutdown, sal_Bool bCancelable )
162 throw (css::uno::RuntimeException);
163 virtual void SAL_CALL approveInteraction( sal_Bool bInteractionGranted )
164 throw (css::uno::RuntimeException);
165 virtual void SAL_CALL shutdownCanceled()
166 throw (css::uno::RuntimeException);
167 virtual sal_Bool SAL_CALL doRestore()
168 throw (css::uno::RuntimeException);
170 // XStatusListener
171 virtual void SAL_CALL statusChanged(const com::sun::star::frame::FeatureStateEvent& event)
172 throw (css::uno::RuntimeException);
174 void doSaveImpl( sal_Bool bShutdown, sal_Bool bCancelable ) throw (css::uno::RuntimeException);
177 } // namespace framework
179 #endif // #ifndef __FRAMEWORK_SERVICES_TYPEDETECTION_HXX_