xref: /aoo4110/main/vcl/inc/unx/sm.hxx (revision b1cdbd2c)
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 #ifndef _VCL_SM_HXX
24 #define _VCL_SM_HXX
25 
26 #include "tools/link.hxx"
27 #include "unx/salunx.h"
28 #include <X11/SM/SMlib.h>
29 #include "salsession.hxx"
30 #include "vclpluginapi.h"
31 
32 class SessionManagerClient
33 {
34 	static SmcConn			aSmcConnection;
35 	static ByteString		aClientID;
36     static bool			bDocSaveDone;
37 
38 	static void SaveYourselfProc(		SmcConn connection,
39 										SmPointer client_data,
40 										int save_type,
41 										Bool shutdown,
42 										int interact_style,
43 										Bool fast );
44 	static void DieProc(				SmcConn connection,
45 										SmPointer client_data );
46 	static void SaveCompleteProc(		SmcConn connection,
47 										SmPointer client_data );
48 	static void ShutdownCanceledProc(	SmcConn connection,
49 										SmPointer client_data );
50     static void InteractProc(			SmcConn connection,
51                                         SmPointer clientData );
52 
53 	static const ByteString& getPreviousSessionID();
54 
55     DECL_STATIC_LINK( SessionManagerClient, ShutDownHdl, void* );
56     DECL_STATIC_LINK( SessionManagerClient, ShutDownCancelHdl, void* );
57     DECL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void* );
58     DECL_STATIC_LINK( SessionManagerClient, InteractionHdl, void* );
59 public:
60 	static VCLPLUG_GEN_PUBLIC void open(); // needed by other plugins, so export
61 	static void close();
62 
63     static bool checkDocumentsSaved();
64     static bool queryInteraction();
65     static void saveDone();
66     static void interactionDone( bool bCancelShutdown );
67 
68 	static String getExecName();
69 	static VCLPLUG_GEN_PUBLIC const ByteString&  getSessionID();
70 };
71 
72 class SalFrame;
73 
74 class IceSalSession : public SalSession
75 {
76 public:
77     IceSalSession();
78     virtual ~IceSalSession();
79 
80     virtual void queryInteraction();
81     virtual void interactionDone();
82     virtual void saveDone();
83     virtual bool cancelShutdown();
84 
85     static void handleOldX11SaveYourself( SalFrame* pFrame );
86 };
87 
88 #endif
89