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