xref: /aoo41x/main/vcl/inc/unx/sm.hxx (revision 161f4cd1)
1*161f4cd1SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*161f4cd1SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*161f4cd1SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*161f4cd1SAndrew Rist  * distributed with this work for additional information
6*161f4cd1SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*161f4cd1SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*161f4cd1SAndrew Rist  * "License"); you may not use this file except in compliance
9*161f4cd1SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*161f4cd1SAndrew Rist  *
11*161f4cd1SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*161f4cd1SAndrew Rist  *
13*161f4cd1SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*161f4cd1SAndrew Rist  * software distributed under the License is distributed on an
15*161f4cd1SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*161f4cd1SAndrew Rist  * KIND, either express or implied.  See the License for the
17*161f4cd1SAndrew Rist  * specific language governing permissions and limitations
18*161f4cd1SAndrew Rist  * under the License.
19*161f4cd1SAndrew Rist  *
20*161f4cd1SAndrew Rist  *************************************************************/
21*161f4cd1SAndrew Rist 
22*161f4cd1SAndrew Rist 
23cdf0e10cSrcweir #ifndef _VCL_SM_HXX
24cdf0e10cSrcweir #define _VCL_SM_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "tools/link.hxx"
27cdf0e10cSrcweir #include "unx/salunx.h"
28cdf0e10cSrcweir #include <X11/SM/SMlib.h>
29cdf0e10cSrcweir #include "salsession.hxx"
30cdf0e10cSrcweir #include "vclpluginapi.h"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir class SessionManagerClient
33cdf0e10cSrcweir {
34cdf0e10cSrcweir 	static SmcConn			aSmcConnection;
35cdf0e10cSrcweir 	static ByteString		aClientID;
36cdf0e10cSrcweir     static bool			bDocSaveDone;
37cdf0e10cSrcweir 
38cdf0e10cSrcweir 	static void SaveYourselfProc(		SmcConn connection,
39cdf0e10cSrcweir 										SmPointer client_data,
40cdf0e10cSrcweir 										int save_type,
41cdf0e10cSrcweir 										Bool shutdown,
42cdf0e10cSrcweir 										int interact_style,
43cdf0e10cSrcweir 										Bool fast );
44cdf0e10cSrcweir 	static void DieProc(				SmcConn connection,
45cdf0e10cSrcweir 										SmPointer client_data );
46cdf0e10cSrcweir 	static void SaveCompleteProc(		SmcConn connection,
47cdf0e10cSrcweir 										SmPointer client_data );
48cdf0e10cSrcweir 	static void ShutdownCanceledProc(	SmcConn connection,
49cdf0e10cSrcweir 										SmPointer client_data );
50cdf0e10cSrcweir     static void InteractProc(			SmcConn connection,
51cdf0e10cSrcweir                                         SmPointer clientData );
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 	static const ByteString& getPreviousSessionID();
54cdf0e10cSrcweir 
55cdf0e10cSrcweir     DECL_STATIC_LINK( SessionManagerClient, ShutDownHdl, void* );
56cdf0e10cSrcweir     DECL_STATIC_LINK( SessionManagerClient, ShutDownCancelHdl, void* );
57cdf0e10cSrcweir     DECL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void* );
58cdf0e10cSrcweir     DECL_STATIC_LINK( SessionManagerClient, InteractionHdl, void* );
59cdf0e10cSrcweir public:
60cdf0e10cSrcweir 	static VCLPLUG_GEN_PUBLIC void open(); // needed by other plugins, so export
61cdf0e10cSrcweir 	static void close();
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     static bool checkDocumentsSaved();
64cdf0e10cSrcweir     static bool queryInteraction();
65cdf0e10cSrcweir     static void saveDone();
66cdf0e10cSrcweir     static void interactionDone( bool bCancelShutdown );
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 	static String getExecName();
69cdf0e10cSrcweir 	static VCLPLUG_GEN_PUBLIC const ByteString&  getSessionID();
70cdf0e10cSrcweir };
71cdf0e10cSrcweir 
72cdf0e10cSrcweir class SalFrame;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir class IceSalSession : public SalSession
75cdf0e10cSrcweir {
76cdf0e10cSrcweir public:
77cdf0e10cSrcweir     IceSalSession();
78cdf0e10cSrcweir     virtual ~IceSalSession();
79cdf0e10cSrcweir 
80cdf0e10cSrcweir     virtual void queryInteraction();
81cdf0e10cSrcweir     virtual void interactionDone();
82cdf0e10cSrcweir     virtual void saveDone();
83cdf0e10cSrcweir     virtual bool cancelShutdown();
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     static void handleOldX11SaveYourself( SalFrame* pFrame );
86cdf0e10cSrcweir };
87cdf0e10cSrcweir 
88cdf0e10cSrcweir #endif
89