Get rid of ole.h.
[wine] / dlls / olecli / olecli_main.c
1 /*
2  *      OLECLI library
3  *
4  *      Copyright 1995  Martin von Loewis
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 /*      At the moment, these are only empty stubs.
22  */
23
24 #include "config.h"
25
26 #include "windef.h"
27 #include "wine/windef16.h"
28 #include "winbase.h"
29 #include "wingdi.h"
30 #include "wownt32.h"
31 #include "objbase.h"
32 #include "wine/debug.h"
33
34 WINE_DEFAULT_DEBUG_CHANNEL(ole);
35
36 typedef enum
37 {
38     OLE_OK,
39     OLE_WAIT_FOR_RELEASE,
40     OLE_BUSY,
41     OLE_ERROR_PROTECT_ONLY,
42     OLE_ERROR_MEMORY,
43     OLE_ERROR_STREAM,
44     OLE_ERROR_STATIC,
45     OLE_ERROR_BLANK,
46     OLE_ERROR_DRAW,
47     OLE_ERROR_METAFILE,
48     OLE_ERROR_ABORT,
49     OLE_ERROR_CLIPBOARD,
50     OLE_ERROR_FORMAT,
51     OLE_ERROR_OBJECT,
52     OLE_ERROR_OPTION,
53     OLE_ERROR_PROTOCOL,
54     OLE_ERROR_ADDRESS,
55     OLE_ERROR_NOT_EQUAL,
56     OLE_ERROR_HANDLE,
57     OLE_ERROR_GENERIC,
58     OLE_ERROR_CLASS,
59     OLE_ERROR_SYNTAX,
60     OLE_ERROR_DATATYPE,
61     OLE_ERROR_PALETTE,
62     OLE_ERROR_NOT_LINK,
63     OLE_ERROR_NOT_EMPTY,
64     OLE_ERROR_SIZE,
65     OLE_ERROR_DRIVE,
66     OLE_ERROR_NETWORK,
67     OLE_ERROR_NAME,
68     OLE_ERROR_TEMPLATE,
69     OLE_ERROR_NEW,
70     OLE_ERROR_EDIT,
71     OLE_ERROR_OPEN,
72     OLE_ERROR_NOT_OPEN,
73     OLE_ERROR_LAUNCH,
74     OLE_ERROR_COMM,
75     OLE_ERROR_TERMINATE,
76     OLE_ERROR_COMMAND,
77     OLE_ERROR_SHOW,
78     OLE_ERROR_DOVERB,
79     OLE_ERROR_ADVISE_NATIVE,
80     OLE_ERROR_ADVISE_PICT,
81     OLE_ERROR_ADVISE_RENAME,
82     OLE_ERROR_POKE_NATIVE,
83     OLE_ERROR_REQUEST_NATIVE,
84     OLE_ERROR_REQUEST_PICT,
85     OLE_ERROR_SERVER_BLOCKED,
86     OLE_ERROR_REGISTRATION,
87     OLE_ERROR_ALREADY_REGISTERED,
88     OLE_ERROR_TASK,
89     OLE_ERROR_OUTOFDATE,
90     OLE_ERROR_CANT_UPDATE_CLIENT,
91     OLE_ERROR_UPDATE,
92     OLE_ERROR_SETDATA_FORMAT,
93     OLE_ERROR_STATIC_FROM_OTHER_OS,
94     OLE_WARN_DELETE_DATA = 1000
95 } OLESTATUS;
96
97 typedef enum
98 {
99     olerender_none,
100     olerender_draw,
101     olerender_format
102 } OLEOPT_RENDER;
103
104 typedef enum
105 {
106     oleupdate_always,
107     oleupdate_onsave,
108     oleupdate_oncall,
109     oleupdate_onclose
110 } OLEOPT_UPDATE;
111
112 typedef enum {
113     OLE_NONE,     /* none */
114     OLE_DELETE,   /* delete object */
115     OLE_LNKPASTE, /* link paste */
116     OLE_EMBPASTE, /* paste(and update) */
117     OLE_SHOW,
118     OLE_RUN,
119     OLE_ACTIVATE,
120     OLE_UPDATE,
121     OLE_CLOSE,
122     OLE_RECONNECT,
123     OLE_SETUPDATEOPTIONS,
124     OLE_SERVERRUNLAUNCH, /* unlaunch (terminate?) server */
125     OLE_LOADFROMSTREAM,  /* (auto reconnect) */
126     OLE_SETDATA,         /* OleSetData */
127     OLE_REQUESTDATA,     /* OleRequestData */
128     OLE_OTHER,
129     OLE_CREATE,
130     OLE_CREATEFROMTEMPLATE,
131     OLE_CREATELINKFROMFILE,
132     OLE_COPYFROMLNK,
133     OLE_CREATREFROMFILE,
134     OLE_CREATEINVISIBLE
135 } OLE_RELEASE_METHOD;
136
137 typedef LONG LHCLIENTDOC;
138 typedef struct _OLEOBJECT *LPOLEOBJECT;
139 typedef struct _OLECLIENT *LPOLECLIENT;
140 typedef LONG OLECLIPFORMAT;/* dunno about this type, please change/add */
141 typedef OLEOPT_UPDATE *LPOLEOPT_UPDATE;
142
143 struct _OLESTREAM;
144
145 typedef struct _OLEOBJECTVTBL {
146     void CALLBACK *(*QueryProtocol)(LPOLEOBJECT,LPCOLESTR16);
147     OLESTATUS      (CALLBACK *Release)(LPOLEOBJECT);
148     OLESTATUS      (CALLBACK *Show)(LPOLEOBJECT,BOOL16);
149     OLESTATUS      (CALLBACK *DoVerb)(LPOLEOBJECT,UINT16,BOOL16,BOOL16);
150     OLESTATUS      (CALLBACK *GetData)(LPOLEOBJECT,OLECLIPFORMAT,HANDLE16 *);
151     OLESTATUS      (CALLBACK *SetData)(LPOLEOBJECT,OLECLIPFORMAT,HANDLE16);
152     OLESTATUS      (CALLBACK *SetTargetDevice)(LPOLEOBJECT,HGLOBAL16);
153     OLESTATUS      (CALLBACK *SetBounds)(LPOLEOBJECT,LPRECT16);
154     OLESTATUS      (CALLBACK *EnumFormats)(LPOLEOBJECT,OLECLIPFORMAT);
155     OLESTATUS      (CALLBACK *SetColorScheme)(LPOLEOBJECT,struct tagLOGPALETTE*);
156     OLESTATUS      (CALLBACK *Delete)(LPOLEOBJECT);
157     OLESTATUS      (CALLBACK *SetHostNames)(LPOLEOBJECT,LPCOLESTR16,LPCOLESTR16);
158     OLESTATUS      (CALLBACK *SaveToStream)(LPOLEOBJECT,struct _OLESTREAM*);
159     OLESTATUS      (CALLBACK *Clone)(LPOLEOBJECT,LPOLECLIENT,LHCLIENTDOC,LPCOLESTR16,LPOLEOBJECT *);
160     OLESTATUS      (CALLBACK *CopyFromLink)(LPOLEOBJECT,LPOLECLIENT,LHCLIENTDOC,LPCOLESTR16,LPOLEOBJECT *);
161     OLESTATUS      (CALLBACK *Equal)(LPOLEOBJECT,LPOLEOBJECT);
162     OLESTATUS      (CALLBACK *CopyToClipBoard)(LPOLEOBJECT);
163     OLESTATUS      (CALLBACK *Draw)(LPOLEOBJECT,HDC16,LPRECT16,LPRECT16,HDC16);
164     OLESTATUS      (CALLBACK *Activate)(LPOLEOBJECT,UINT16,BOOL16,BOOL16,HWND16,LPRECT16);
165     OLESTATUS      (CALLBACK *Execute)(LPOLEOBJECT,HGLOBAL16,UINT16);
166     OLESTATUS      (CALLBACK *Close)(LPOLEOBJECT);
167     OLESTATUS      (CALLBACK *Update)(LPOLEOBJECT);
168     OLESTATUS      (CALLBACK *Reconnect)(LPOLEOBJECT);
169     OLESTATUS      (CALLBACK *ObjectConvert)(LPOLEOBJECT,LPCOLESTR16,LPOLECLIENT,LHCLIENTDOC,LPCOLESTR16,LPOLEOBJECT*);
170     OLESTATUS      (CALLBACK *GetLinkUpdateOptions)(LPOLEOBJECT,LPOLEOPT_UPDATE);
171     OLESTATUS      (CALLBACK *SetLinkUpdateOptions)(LPOLEOBJECT,OLEOPT_UPDATE);
172     OLESTATUS      (CALLBACK *Rename)(LPOLEOBJECT,LPCOLESTR16);
173     OLESTATUS      (CALLBACK *QueryName)(LPOLEOBJECT,LPSTR,LPUINT16);
174     OLESTATUS      (CALLBACK *QueryType)(LPOLEOBJECT,LPLONG);
175     OLESTATUS      (CALLBACK *QueryBounds)(LPOLEOBJECT,LPRECT16);
176     OLESTATUS      (CALLBACK *QuerySize)(LPOLEOBJECT,LPDWORD);
177     OLESTATUS      (CALLBACK *QueryOpen)(LPOLEOBJECT);
178     OLESTATUS      (CALLBACK *QueryOutOfDate)(LPOLEOBJECT);
179     OLESTATUS      (CALLBACK *QueryReleaseStatus)(LPOLEOBJECT);
180     OLESTATUS      (CALLBACK *QueryReleaseError)(LPOLEOBJECT);
181     OLE_RELEASE_METHOD (CALLBACK *QueryReleaseMethod)(LPOLEOBJECT);
182     OLESTATUS      (CALLBACK *RequestData)(LPOLEOBJECT,OLECLIPFORMAT);
183     OLESTATUS      (CALLBACK *ObjectLong)(LPOLEOBJECT,UINT16,LPLONG);
184 } OLEOBJECTVTBL;
185 typedef OLEOBJECTVTBL *LPOLEOBJECTVTBL;
186
187 typedef struct _OLEOBJECT
188 {
189     LPOLEOBJECTVTBL lpvtbl;
190 } OLEOBJECT;
191
192 static LONG OLE_current_handle;
193
194 /******************************************************************************
195  *              OleSavedClientDoc       [OLECLI32.45]
196  */
197 OLESTATUS WINAPI OleSavedClientDoc(LHCLIENTDOC hDoc)
198 {
199     FIXME("(%ld: stub\n", hDoc);
200     return OLE_OK;
201 }
202
203 /******************************************************************************
204  *              OleSavedClientDoc       [OLECLI.45]
205  */
206 OLESTATUS WINAPI OleSavedClientDoc16(LHCLIENTDOC hDoc)
207 {
208     FIXME("(%ld: stub\n", hDoc);
209     return OLE_OK;
210 }
211
212 /******************************************************************************
213  *              OleRegisterClientDoc    [OLECLI.41]
214  */
215 OLESTATUS WINAPI OleRegisterClientDoc16(LPCSTR classname, LPCSTR docname,
216                                         LONG reserved, LHCLIENTDOC *hRet )
217 {
218     FIXME("(%s,%s,...): stub\n",classname,docname);
219     *hRet=++OLE_current_handle;
220     return OLE_OK;
221 }
222
223 /******************************************************************************
224  *              OleRegisterClientDoc    [OLECLI32.41]
225  */
226 OLESTATUS WINAPI OleRegisterClientDoc(LPCSTR classname, LPCSTR docname,
227                                         LONG reserved, LHCLIENTDOC *hRet )
228 {
229     FIXME("(%s,%s,...): stub\n",classname,docname);
230     *hRet=++OLE_current_handle;
231     return OLE_OK;
232 }
233
234 /******************************************************************************
235  *              OleRenameClientDoc      [OLECLI.43]
236  */
237 OLESTATUS WINAPI OleRenameClientDoc16(LHCLIENTDOC hDoc, LPCSTR newName)
238 {
239     FIXME("(%ld,%s,...): stub\n",hDoc, newName);
240     return OLE_OK;
241 }
242
243 /******************************************************************************
244  *              OleRenameClientDoc      [OLECLI32.43]
245  */
246 OLESTATUS WINAPI OleRenameClientDoc(LHCLIENTDOC hDoc, LPCSTR newName)
247 {
248     FIXME("(%ld,%s,...): stub\n",hDoc, newName);
249     return OLE_OK;
250 }
251
252 /******************************************************************************
253  *              OleRevokeClientDoc      [OLECLI.42]
254  */
255 OLESTATUS WINAPI OleRevokeClientDoc16(LHCLIENTDOC hServerDoc)
256 {
257     FIXME("(%ld): stub\n",hServerDoc);
258     return OLE_OK;
259 }
260
261 /******************************************************************************
262  *              OleRevokeClientDoc      [OLECLI32.42]
263  */
264 OLESTATUS WINAPI OleRevokeClientDoc(LHCLIENTDOC hServerDoc)
265 {
266     FIXME("(%ld): stub\n",hServerDoc);
267     return OLE_OK;
268 }
269
270 /******************************************************************************
271  *              OleRevertClientDoc      [OLECLI.44]
272  */
273 OLESTATUS WINAPI OleRevertClientDoc16(LHCLIENTDOC hServerDoc)
274 {
275     FIXME("(%ld): stub\n", hServerDoc);
276     return OLE_OK;
277 }
278
279 /******************************************************************************
280  *              OleEnumObjects  [OLECLI.47]
281  */
282 OLESTATUS WINAPI OleEnumObjects16(LHCLIENTDOC hServerDoc, SEGPTR data)
283 {
284     FIXME("(%ld, %04x:%04x): stub\n", hServerDoc, HIWORD(data),
285         LOWORD(data));
286     return OLE_OK;
287 }
288
289 /******************************************************************************
290  *           OleCreateLinkFromClip      [OLECLI.11]
291  */
292 OLESTATUS WINAPI OleCreateLinkFromClip16( LPCSTR name, SEGPTR olecli, LHCLIENTDOC hclientdoc,
293                                           LPCSTR xname, SEGPTR lpoleob, UINT16 render,
294                                           UINT16 clipformat )
295 {
296         FIXME("(%s, %04x:%04x, %ld, %s, %04x:%04x, %d, %d): stub!\n",
297               name, HIWORD(olecli), LOWORD(olecli), hclientdoc, xname, HIWORD(lpoleob),
298               LOWORD(lpoleob), render, clipformat);
299         return OLE_OK;
300 }
301
302 /******************************************************************************
303  *           OleCreateLinkFromClip      [OLECLI32.11]
304  */
305 OLESTATUS WINAPI OleCreateLinkFromClip(
306         LPCSTR name,LPOLECLIENT olecli,LHCLIENTDOC hclientdoc,LPCSTR xname,
307         LPOLEOBJECT *lpoleob,OLEOPT_RENDER render,OLECLIPFORMAT clipformat
308 ) {
309         FIXME("(%s,%p,%08lx,%s,%p,%d,%ld): stub!\n",
310               name,olecli,hclientdoc,xname,lpoleob,render,clipformat);
311         return OLE_OK;
312 }
313
314 /******************************************************************************
315  *           OleQueryLinkFromClip       [OLECLI.9]
316  */
317 OLESTATUS WINAPI OleQueryLinkFromClip16(LPCSTR name, UINT16 render, UINT16 clipformat)
318 {
319         FIXME("(%s, %d, %d): stub!\n", name, render, clipformat);
320         return OLE_OK;
321 }
322
323 /******************************************************************************
324  *           OleQueryLinkFromClip       [OLECLI32.9]
325  */
326 OLESTATUS WINAPI OleQueryLinkFromClip(LPCSTR name,OLEOPT_RENDER render,OLECLIPFORMAT clipformat) {
327         FIXME("(%s,%d,%ld): stub!\n",name,render,clipformat);
328         return OLE_OK;
329 }
330
331 /******************************************************************************
332  *           OleQueryCreateFromClip     [OLECLI.10]
333  */
334 OLESTATUS WINAPI OleQueryCreateFromClip16(LPCSTR name, UINT16 render, UINT16 clipformat)
335 {
336         FIXME("(%s, %d, %d): stub!\n", name, render, clipformat);
337         return OLE_OK;
338 }
339
340 /******************************************************************************
341  *           OleQueryCreateFromClip     [OLECLI32.10]
342  */
343 OLESTATUS WINAPI OleQueryCreateFromClip(LPCSTR name,OLEOPT_RENDER render,OLECLIPFORMAT clipformat) {
344         FIXME("(%s,%d,%ld): stub!\n",name,render,clipformat);
345         return OLE_OK;
346 }
347
348 /******************************************************************************
349  *              OleIsDcMeta     [OLECLI32.60]
350  */
351 BOOL WINAPI OleIsDcMeta(HDC hdc)
352 {
353     TRACE("(%p)\n",hdc);
354     return GetObjectType( hdc ) == OBJ_METADC;
355 }
356
357
358 /******************************************************************************
359  *              OleIsDcMeta     [OLECLI.60]
360  */
361 BOOL16 WINAPI OleIsDcMeta16(HDC16 hdc)
362 {
363     return OleIsDcMeta( HDC_32(hdc) );
364 }
365
366
367 /******************************************************************************
368  *              OleSetHostNames [OLECLI32.15]
369  */
370 OLESTATUS WINAPI OleSetHostNames(LPOLEOBJECT oleob,LPCSTR name1,LPCSTR name2) {
371         FIXME("(%p,%s,%s): stub\n",oleob,name1,name2);
372         return OLE_OK;
373 }
374
375 /******************************************************************************
376  *              OleQueryType    [OLECLI.14]
377  */
378 OLESTATUS WINAPI OleQueryType16(LPOLEOBJECT oleob,  SEGPTR xlong) {
379         FIXME("(%p, %p): stub!\n", oleob, MapSL(xlong));
380         return OLE_OK;
381 }
382
383 /******************************************************************************
384  *              OleQueryType    [OLECLI32.14]
385  */
386 OLESTATUS WINAPI OleQueryType(LPOLEOBJECT oleob,LONG*xlong) {
387         FIXME("(%p,%p): stub!\n",oleob,xlong);
388         if (!oleob)
389                 return 0x10;
390         TRACE("Calling OLEOBJECT.QueryType (%p) (%p,%p)\n",
391               oleob->lpvtbl->QueryType,oleob,xlong);
392         return oleob->lpvtbl->QueryType(oleob,xlong);
393 }
394
395 /******************************************************************************
396  *              OleCreateFromClip       [OLECLI.12]
397  */
398 OLESTATUS WINAPI OleCreateFromClip16( LPCSTR name, SEGPTR olecli, LHCLIENTDOC hclientdoc,
399                                       LPCSTR xname, SEGPTR lpoleob,
400                                       UINT16 render, UINT16 clipformat )
401 {
402         FIXME("(%s, %04x:%04x, %ld, %s, %04x:%04x, %d, %d): stub!\n",
403               name, HIWORD(olecli), LOWORD(olecli), hclientdoc, xname, HIWORD(lpoleob),
404               LOWORD(lpoleob), render, clipformat);
405         return OLE_OK;
406 }
407
408 /******************************************************************************
409  *              OleCreateFromClip       [OLECLI32.12]
410  */
411 OLESTATUS WINAPI OleCreateFromClip(
412         LPCSTR name,LPOLECLIENT olecli,LHCLIENTDOC hclientdoc,LPCSTR xname,
413         LPOLEOBJECT *lpoleob,OLEOPT_RENDER render, OLECLIPFORMAT clipformat
414 ) {
415         FIXME("(%s,%p,%08lx,%s,%p,%d,%ld): stub!\n",
416               name,olecli,hclientdoc,xname,lpoleob,render,clipformat);
417         /* clipb type, object kreieren entsprechend etc. */
418         return OLE_OK;
419 }