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 28 #ifndef _DDEIMP_HXX 29 #define _DDEIMP_HXX 30 31 #ifdef OS2 32 33 #include "ddemlos2.h" 34 35 #define WORD sal_uInt16 36 #define DWORD sal_uLong 37 #define LPBYTE sal_uInt8* 38 #define LPWORD sal_uInt16* 39 #define LPDWORD sal_uLong* 40 #define LPCTSTR PCSZ 41 42 #else 43 44 #include <tools/prewin.h> 45 #include <ddeml.h> 46 #include <tools/postwin.h> 47 #include "ddewrap.hxx" 48 49 /* 50 extern "C" 51 { 52 #define sal_Bool WIN_BOOL 53 #define sal_uInt8 WIN_BYTE 54 #undef sal_Bool 55 #undef sal_uInt8 56 }; 57 */ 58 59 #endif 60 #include <tools/string.hxx> 61 #include <tools/list.hxx> 62 #include <tools/shl.hxx> 63 64 class DdeService; 65 class DdeTopic; 66 class DdeItem; 67 class DdeTopics; 68 class DdeItems; 69 70 // ---------------- 71 // - Conversation - 72 // ---------------- 73 74 struct Conversation 75 { 76 HCONV hConv; 77 DdeTopic* pTopic; 78 }; 79 80 DECLARE_LIST( ConvList, Conversation* ); 81 82 // --------------- 83 // - DdeInternal - 84 // --------------- 85 86 class DdeInternal 87 { 88 public: 89 #ifdef WNT 90 static HDDEDATA CALLBACK CliCallback 91 ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); 92 static HDDEDATA CALLBACK SvrCallback 93 ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); 94 static HDDEDATA CALLBACK InfCallback 95 ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); 96 #else 97 #if defined ( MTW ) || ( defined ( GCC ) && defined ( OS2 )) || defined( ICC ) 98 static HDDEDATA CALLBACK __EXPORT CliCallback 99 ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); 100 static HDDEDATA CALLBACK __EXPORT SvrCallback 101 ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); 102 static HDDEDATA CALLBACK __EXPORT InfCallback 103 ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); 104 #else 105 static HDDEDATA CALLBACK _export CliCallback 106 ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); 107 static HDDEDATA CALLBACK _export SvrCallback 108 ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); 109 static HDDEDATA CALLBACK _export InfCallback 110 ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); 111 #endif 112 #endif 113 static DdeService* FindService( HSZ ); 114 static DdeTopic* FindTopic( DdeService&, HSZ ); 115 static DdeItem* FindItem( DdeTopic&, HSZ ); 116 }; 117 118 // ------------- 119 // - DdeString - 120 // ------------- 121 122 class DdeString : public String 123 { 124 protected: 125 HSZ hString; 126 DWORD hInst; 127 128 public: 129 DdeString( DWORD, const sal_Unicode* ); 130 DdeString( DWORD, const String& ); 131 ~DdeString(); 132 133 int operator==( HSZ ); 134 operator HSZ(); 135 }; 136 137 // -------------- 138 // - DdeDataImp - 139 // -------------- 140 141 struct DdeDataImp 142 { 143 HDDEDATA hData; 144 LPBYTE pData; 145 long nData; 146 sal_uLong nFmt; 147 }; 148 149 class DdeConnections; 150 class DdeServices; 151 152 struct DdeInstData 153 { 154 sal_uInt16 nRefCount; 155 DdeConnections* pConnections; 156 // Server 157 long hCurConvSvr; 158 sal_uLong hDdeInstSvr; 159 short nInstanceSvr; 160 DdeServices* pServicesSvr; 161 // Client 162 sal_uLong hDdeInstCli; 163 short nInstanceCli; 164 }; 165 166 #ifndef SHL_SVDDE 167 #define SHL_SVDDE SHL_SHL2 168 #endif 169 170 inline DdeInstData* ImpGetInstData() 171 { 172 return (DdeInstData*)(*GetAppData( SHL_SVDDE )); 173 } 174 DdeInstData* ImpInitInstData(); 175 void ImpDeinitInstData(); 176 177 #endif // _DDEIMP_HXX 178