1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _VCL_SM_HXX 28 #define _VCL_SM_HXX 29 30 #include "tools/link.hxx" 31 #include "unx/salunx.h" 32 #include <X11/SM/SMlib.h> 33 #include "salsession.hxx" 34 #include "vclpluginapi.h" 35 36 class SessionManagerClient 37 { 38 static SmcConn aSmcConnection; 39 static ByteString aClientID; 40 static bool bDocSaveDone; 41 42 static void SaveYourselfProc( SmcConn connection, 43 SmPointer client_data, 44 int save_type, 45 Bool shutdown, 46 int interact_style, 47 Bool fast ); 48 static void DieProc( SmcConn connection, 49 SmPointer client_data ); 50 static void SaveCompleteProc( SmcConn connection, 51 SmPointer client_data ); 52 static void ShutdownCanceledProc( SmcConn connection, 53 SmPointer client_data ); 54 static void InteractProc( SmcConn connection, 55 SmPointer clientData ); 56 57 static const ByteString& getPreviousSessionID(); 58 59 DECL_STATIC_LINK( SessionManagerClient, ShutDownHdl, void* ); 60 DECL_STATIC_LINK( SessionManagerClient, ShutDownCancelHdl, void* ); 61 DECL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void* ); 62 DECL_STATIC_LINK( SessionManagerClient, InteractionHdl, void* ); 63 public: 64 static VCLPLUG_GEN_PUBLIC void open(); // needed by other plugins, so export 65 static void close(); 66 67 static bool checkDocumentsSaved(); 68 static bool queryInteraction(); 69 static void saveDone(); 70 static void interactionDone( bool bCancelShutdown ); 71 72 static String getExecName(); 73 static VCLPLUG_GEN_PUBLIC const ByteString& getSessionID(); 74 }; 75 76 class SalFrame; 77 78 class IceSalSession : public SalSession 79 { 80 public: 81 IceSalSession(); 82 virtual ~IceSalSession(); 83 84 virtual void queryInteraction(); 85 virtual void interactionDone(); 86 virtual void saveDone(); 87 virtual bool cancelShutdown(); 88 89 static void handleOldX11SaveYourself( SalFrame* pFrame ); 90 }; 91 92 #endif 93