1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ddemlos2.h,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
36 #include <tools/svpm.h>
37 #include <tools/solar.h>
38 #include <tools/debug.hxx>
39 #include <tools/stream.hxx>
48 typedef ULONG HCONVLIST
;
51 typedef DDESTRUCT
* HDDEDATA
;
55 USHORT nSize
; // sizeof(CONVINFO)
56 ULONG nUser
; // Userhandle
57 HCONV hConvPartner
; //
58 HSZ hszPartner
; // Name der Partnerapp
59 HSZ hszServiceReq
; // Name des angeforderten Services
60 HSZ hszTopic
; // -- " -- Topics
61 HSZ hszItem
; // -- " -- Items
62 USHORT nFormat
; // Datenformat der akt. Transaktion
63 USHORT nType
; // Typ der akt. Transaktion (XTYP_*)
64 USHORT nStatus
; // ST_* der Konversation
65 USHORT nConvst
; // XST_* der akt. Transaktion
66 USHORT nLastError
; // letzter Fehler der Transaktion
67 HCONVLIST hConvList
; // ConvListId , wenn in ConvList
68 CONVCONTEXT aConvCtxt
; // conversation context
71 /* the following structure is for use with XTYP_WILDCONNECT processing. */
78 typedef HSZPAIR
*PHSZPAIR
;
80 /***** conversation states (usState) *****/
82 #define XST_NULL 0 /* quiescent states */
83 #define XST_INCOMPLETE 1
84 #define XST_CONNECTED 2
85 #define XST_INIT1 3 /* mid-initiation states */
87 #define XST_REQSENT 5 /* active conversation states */
88 #define XST_DATARCVD 6
89 #define XST_POKESENT 7
90 #define XST_POKEACKRCVD 8
91 #define XST_EXECSENT 9
92 #define XST_EXECACKRCVD 10
93 #define XST_ADVSENT 11
94 #define XST_UNADVSENT 12
95 #define XST_ADVACKRCVD 13
96 #define XST_UNADVACKRCVD 14
97 #define XST_ADVDATASENT 15
98 #define XST_ADVDATAACKRCVD 16
100 /* used in LOWORD(dwData1) of XTYP_ADVREQ callbacks... */
101 #define CADV_LATEACK 0xFFFF
103 /***** conversation status bits (fsStatus) *****/
105 #define ST_CONNECTED 0x0001
106 #define ST_ADVISE 0x0002
107 #define ST_ISLOCAL 0x0004
108 #define ST_BLOCKED 0x0008
109 #define ST_CLIENT 0x0010
110 #define ST_TERMINATED 0x0020
111 #define ST_INLIST 0x0040
112 #define ST_BLOCKNEXT 0x0080
113 #define ST_ISSELF 0x0100
116 /* DDE constants for wStatus field */
118 //#define DDE_FACK 0x8000
119 //#define DDE_FBUSY 0x4000
120 //#define DDE_FDEFERUPD 0x4000
121 //#define DDE_FACKREQ 0x8000
122 //#define DDE_FRELEASE 0x2000
123 //#define DDE_FREQUESTED 0x1000
124 //#define DDE_FACKRESERVED 0x3ff0
125 //#define DDE_FADVRESERVED 0x3fff
126 //#define DDE_FDATRESERVED 0x4fff
127 //#define DDE_FPOKRESERVED 0xdfff
128 //#define DDE_FAPPSTATUS 0x00ff
129 #define DDE_FNOTPROCESSED 0x0000
131 /***** message filter hook types *****/
133 #define MSGF_DDEMGR 0x8001
135 /***** codepage constants ****/
137 #define CP_WINANSI 1004 /* default codepage for windows & old DDE convs. */
139 /***** transaction types *****/
141 #define XTYPF_NOBLOCK 0x0002 /* CBR_BLOCK will not work */
142 #define XTYPF_NODATA 0x0004 /* DDE_FDEFERUPD */
143 #define XTYPF_ACKREQ 0x0008 /* DDE_FACKREQ */
145 #define XCLASS_MASK 0xFC00
146 #define XCLASS_BOOL 0x1000
147 #define XCLASS_DATA 0x2000
148 #define XCLASS_FLAGS 0x4000
149 #define XCLASS_NOTIFICATION 0x8000
151 #define XTYP_ERROR (0x0000 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
152 #define XTYP_ADVDATA (0x0010 | XCLASS_FLAGS )
153 #define XTYP_ADVREQ (0x0020 | XCLASS_DATA | XTYPF_NOBLOCK )
154 #define XTYP_ADVSTART (0x0030 | XCLASS_BOOL )
155 #define XTYP_ADVSTOP (0x0040 | XCLASS_NOTIFICATION)
156 #define XTYP_EXECUTE (0x0050 | XCLASS_FLAGS )
157 #define XTYP_CONNECT (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK)
158 #define XTYP_CONNECT_CONFIRM (0x0070 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
159 #define XTYP_XACT_COMPLETE (0x0080 | XCLASS_NOTIFICATION )
160 #define XTYP_POKE (0x0090 | XCLASS_FLAGS )
161 #define XTYP_REGISTER (0x00A0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
162 #define XTYP_REQUEST (0x00B0 | XCLASS_DATA )
163 #define XTYP_DISCONNECT (0x00C0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
164 #define XTYP_UNREGISTER (0x00D0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
165 #define XTYP_WILDCONNECT (0x00E0 | XCLASS_DATA | XTYPF_NOBLOCK)
167 #define XTYP_MASK 0x00F0
168 #define XTYP_SHIFT 4 /* shift to turn XTYP_ into an index */
170 /***** Timeout constants *****/
172 #define TIMEOUT_ASYNC -1L
174 /***** Transaction ID constants *****/
178 /****** public strings used in DDE ******/
180 #define SZDDESYS_TOPIC "System"
181 #define SZDDESYS_ITEM_TOPICS "Topics"
182 #define SZDDESYS_ITEM_SYSITEMS "SysItems"
183 #define SZDDESYS_ITEM_RTNMSG "ReturnMessage"
184 #define SZDDESYS_ITEM_STATUS "Status"
185 #define SZDDESYS_ITEM_FORMATS "Formats"
186 #define SZDDESYS_ITEM_HELP "Help"
187 #define SZDDE_ITEM_ITEMLIST "TopicItemList"
190 /****** API entry points ******/
192 typedef HDDEDATA CALLBACK
FNCALLBACK(USHORT wType
, USHORT wFmt
, HCONV hConv
,
193 HSZ hsz1
, HSZ hsz2
, HDDEDATA hData
, ULONG dwData1
, ULONG dwData2
);
194 typedef FNCALLBACK
* PFNCALLBACK
;
196 #define CBR_BLOCK 0xffffffffL
198 /* DLL registration functions */
200 USHORT
DdeInitialize(ULONG
* pidInst
, PFNCALLBACK pfnCallback
,
201 ULONG afCmd
, ULONG ulRes
);
204 * Callback filter flags for use with standard apps.
207 #define CBF_FAIL_SELFCONNECTIONS 0x00001000
208 #define CBF_FAIL_CONNECTIONS 0x00002000
209 #define CBF_FAIL_ADVISES 0x00004000
210 #define CBF_FAIL_EXECUTES 0x00008000
211 #define CBF_FAIL_POKES 0x00010000
212 #define CBF_FAIL_REQUESTS 0x00020000
213 #define CBF_FAIL_ALLSVRXACTIONS 0x0003f000
215 #define CBF_SKIP_CONNECT_CONFIRMS 0x00040000
216 #define CBF_SKIP_REGISTRATIONS 0x00080000
217 #define CBF_SKIP_UNREGISTRATIONS 0x00100000
218 #define CBF_SKIP_DISCONNECTS 0x00200000
219 #define CBF_SKIP_ALLNOTIFICATIONS 0x003c0000
222 * Application command flags
224 #define APPCMD_CLIENTONLY 0x00000010L
225 #define APPCMD_FILTERINITS 0x00000020L
226 #define APPCMD_MASK 0x00000FF0L
229 * Application classification flags
231 #define APPCLASS_STANDARD 0x00000000L
232 #define APPCLASS_MASK 0x0000000FL
235 BOOL
DdeUninitialize(ULONG idInst
);
237 /* conversation enumeration functions */
239 HCONVLIST
DdeConnectList(ULONG idInst
, HSZ hszService
, HSZ hszTopic
,
240 HCONVLIST hConvList
, CONVCONTEXT
* pCC
);
241 HCONV
DdeQueryNextServer(HCONVLIST hConvList
, HCONV hConvPrev
);
242 BOOL
DdeDisconnectList(HCONVLIST hConvList
);
244 /* conversation control functions */
246 HCONV
DdeConnect(ULONG idInst
, HSZ hszService
, HSZ hszTopic
,
248 BOOL
DdeDisconnect(HCONV hConv
);
249 HCONV
DdeReconnect(HCONV hConv
);
251 USHORT
DdeQueryConvInfo(HCONV hConv
, ULONG idTransaction
, CONVINFO
* pConvInfo
);
252 BOOL
DdeSetUserHandle(HCONV hConv
, ULONG id
, ULONG hUser
);
254 BOOL
DdeAbandonTransaction(ULONG idInst
, HCONV hConv
, ULONG idTransaction
);
257 /* app server interface functions */
259 BOOL
DdePostAdvise(ULONG idInst
, HSZ hszTopic
, HSZ hszItem
);
260 BOOL
DdeEnableCallback(ULONG idInst
, HCONV hConv
, USHORT wCmd
);
262 #define EC_ENABLEALL 0
263 #define EC_ENABLEONE ST_BLOCKNEXT
264 #define EC_DISABLE ST_BLOCKED
265 #define EC_QUERYWAITING 2
267 HDDEDATA
DdeNameService(ULONG idInst
, HSZ hsz1
, HSZ hsz2
, USHORT afCmd
);
269 #define DNS_REGISTER 0x0001
270 #define DNS_UNREGISTER 0x0002
271 #define DNS_FILTERON 0x0004
272 #define DNS_FILTEROFF 0x0008
274 /* app client interface functions */
276 HDDEDATA
DdeClientTransaction(void* pData
, ULONG cbData
,
277 HCONV hConv
, HSZ hszItem
, USHORT wFmt
, USHORT wType
,
278 ULONG dwTimeout
, ULONG
* pdwResult
);
280 /* data transfer functions */
282 HDDEDATA
DdeCreateDataHandle(ULONG idInst
, void* pSrc
, ULONG cb
,
283 ULONG cbOff
, HSZ hszItem
, USHORT wFmt
, USHORT afCmd
);
284 // HDDEDATA DdeAddData(HDDEDATA hData, void* pSrc, ULONG cb, ULONG cbOff);
285 ULONG
DdeGetData(HDDEDATA hData
, void* pDst
, ULONG cbMax
, ULONG cbOff
);
286 BYTE
* DdeAccessData(HDDEDATA hData
, ULONG
* pcbDataSize
);
287 BOOL
DdeUnaccessData(HDDEDATA hData
);
288 BOOL
DdeFreeDataHandle(HDDEDATA hData
);
290 #define HDATA_APPOWNED 0x0001
292 USHORT
DdeGetLastError(ULONG idInst
);
294 #define DMLERR_NO_ERROR 0 /* must be 0 */
296 #define DMLERR_FIRST 0x4000
298 #define DMLERR_ADVACKTIMEOUT 0x4000
299 #define DMLERR_BUSY 0x4001
300 #define DMLERR_DATAACKTIMEOUT 0x4002
301 #define DMLERR_DLL_NOT_INITIALIZED 0x4003
302 #define DMLERR_DLL_USAGE 0x4004
303 #define DMLERR_EXECACKTIMEOUT 0x4005
304 #define DMLERR_INVALIDPARAMETER 0x4006
305 #define DMLERR_LOW_MEMORY 0x4007
306 #define DMLERR_MEMORY_ERROR 0x4008
307 #define DMLERR_NOTPROCESSED 0x4009
308 #define DMLERR_NO_CONV_ESTABLISHED 0x400a
309 #define DMLERR_POKEACKTIMEOUT 0x400b
310 #define DMLERR_POSTMSG_FAILED 0x400c
311 #define DMLERR_REENTRANCY 0x400d
312 #define DMLERR_SERVER_DIED 0x400e
313 #define DMLERR_SYS_ERROR 0x400f
314 #define DMLERR_UNADVACKTIMEOUT 0x4010
315 #define DMLERR_UNFOUND_QUEUE_ID 0x4011
317 #define DMLERR_LAST 0x4011
319 HSZ
DdeCreateStringHandle(ULONG idInst
, PSZ pStr
, int iCodePage
);
320 ULONG
DdeQueryString(ULONG idInst
, HSZ hsz
, PSZ pStr
, ULONG cchMax
,
322 BOOL
DdeFreeStringHandle(ULONG idInst
, HSZ hsz
);
323 BOOL
DdeKeepStringHandle(ULONG idInst
, HSZ hsz
);
324 int DdeCmpStringHandles(HSZ hsz1
, HSZ hsz2
);
328 /* von OS/2 nicht unterstuetzte Win3.1 Clipboard-Formate */
330 #define CF_NOTSUPPORTED_BASE 0xff00
333 #define CF_DIB CF_NOTSUPPORTED_BASE+1
337 #define CF_DIF CF_NOTSUPPORTED_BASE+2
340 #ifndef CF_DSPMETAFILEPICT
341 #define CF_DSPMETAFILEPICT CF_NOTSUPPORTED_BASE+3
344 #ifndef CF_METAFILEPICT
345 #define CF_METAFILEPICT CF_NOTSUPPORTED_BASE+4
349 #define CF_OEMTEXT CF_NOTSUPPORTED_BASE+5
352 #ifndef CF_OWNERDISPLAY
353 #define CF_OWNERDISPLAY CF_NOTSUPPORTED_BASE+6
357 #define CF_PENDATA CF_NOTSUPPORTED_BASE+7
361 #define CF_RIFF CF_NOTSUPPORTED_BASE+8
365 #define CF_SYLK CF_NOTSUPPORTED_BASE+9
369 #define CF_TIFF CF_NOTSUPPORTED_BASE+10
373 #define CF_WAVE CF_NOTSUPPORTED_BASE+11
377 #endif /* _DDEML_HXX */