1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sessionlistener.hxx,v $
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 //_______________________________________________
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>
46 //_______________________________________________
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 //_______________________________________________
62 #include <cppuhelper/weak.hxx>
63 #include <cppuhelper/interfacecontainer.h>
65 //_______________________________________________
70 //_______________________________________________
73 //_______________________________________________
74 // exported definitions
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.
88 @docdate 10.03.2003 by as96863
91 <li>implementation of query mode</li>
92 <li>simple restore mechanism of last consistent cache state,
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 //-------------------------------------------
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
;
121 sal_Bool m_bRestored
;
125 //---------------------------------------
126 // XInterface, XTypeProvider, XServiceInfo
128 FWK_DECLARE_XINTERFACE
129 FWK_DECLARE_XTYPEPROVIDER
132 #ifdef ENABLE_AUTODOC_FIX
136 //---------------------------------------
138 /** @short initialize new instance of this class.
141 reference to the global uno service manager, which created this new
142 factory instance. It must be used during runtime to create own
146 SessionListener( const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xSMGR
);
148 virtual ~SessionListener();
150 virtual void SAL_CALL
disposing(const com::sun::star::lang::EventObject
&) throw (css::uno::RuntimeException
);
154 virtual void SAL_CALL
initialize(const css::uno::Sequence
< css::uno::Any
>& args
) throw (css::uno::RuntimeException
);
156 // XSessionManagerListener
157 virtual void SAL_CALL
doSave( sal_Bool bShutdown
, sal_Bool bCancelable
)
158 throw (css::uno::RuntimeException
);
159 virtual void SAL_CALL
approveInteraction( sal_Bool bInteractionGranted
)
160 throw (css::uno::RuntimeException
);
161 virtual void SAL_CALL
shutdownCanceled()
162 throw (css::uno::RuntimeException
);
163 virtual sal_Bool SAL_CALL
doRestore()
164 throw (css::uno::RuntimeException
);
167 virtual void SAL_CALL
statusChanged(const com::sun::star::frame::FeatureStateEvent
& event
)
168 throw (css::uno::RuntimeException
);
170 void doSaveImpl( sal_Bool bShutdown
, sal_Bool bCancelable
) throw (css::uno::RuntimeException
);
173 } // namespace framework
175 #endif // #ifndef __FRAMEWORK_SERVICES_TYPEDETECTION_HXX_