1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #include "unotools/unotoolsdllapi.h"
24 
25 #ifndef UNOTOOLS_INC_UNOTOOLS_DESKTOPTERMINATIONOBSERVER_HXX
26 #define UNOTOOLS_INC_UNOTOOLS_DESKTOPTERMINATIONOBSERVER_HXX
27 
28 /** === begin UNO includes === **/
29 /** === end UNO includes === **/
30 
31 //........................................................................
32 namespace utl
33 {
34 //........................................................................
35 
36 	//====================================================================
37 	//= ITerminationListener
38 	//====================================================================
39     /** non-UNO version of the <type scope="com.sun.star.frame">XTerminateListener</type>
40     */
41 	class ITerminationListener
42 	{
43     public:
44         virtual bool    queryTermination() const = 0;
45         virtual void    notifyTermination() = 0;
46 	};
47 
48 	//====================================================================
49 	//= DesktopTerminationObserver
50 	//====================================================================
51     /** a class which allows non-UNO components to observe the desktop (aka application)
52         for it's shutdown
53     */
54     class UNOTOOLS_DLLPUBLIC DesktopTerminationObserver
55     {
56     public:
57         /** registers a listener which should be notified when the desktop terminates
58             (which means the application is shutting down)
59         */
60         static void    registerTerminationListener( ITerminationListener* _pListener );
61 
62         /** revokes a termination listener
63         */
64         static void    revokeTerminationListener( ITerminationListener* _pListener );
65 
66     private:
67         DesktopTerminationObserver();   // never implemented, only static methods
68     };
69 
70 //........................................................................
71 } // namespace utl
72 //........................................................................
73 
74 #endif // UNOTOOLS_INC_UNOTOOLS_DESKTOPTERMINATIONOBSERVER_HXX
75 
76