Use proper symbols instead of magic number 23 for HTML resource type.
[wine] / dlls / mshtml / htmldoc.c
1 /*
2  * Copyright 2005 Jacek Caban
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #include "config.h"
20
21 #include <stdarg.h>
22 #include <stdio.h>
23
24 #define COBJMACROS
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "ole2.h"
30 #include "docobj.h"
31
32 #include "mshtml.h"
33 #include "mshtmdid.h"
34
35 #include "wine/debug.h"
36
37 #include "mshtml_private.h"
38
39 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
40
41 static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID riid, void **ppvObject)
42 {
43     HTMLDocument *This = (HTMLDocument*)iface;
44
45     *ppvObject = NULL;
46     if(IsEqualGUID(&IID_IUnknown, riid)) {
47         TRACE("(%p)->(IID_IUnknown, %p)\n", This, ppvObject);
48         *ppvObject = HTMLDOC(This);
49     }else if(IsEqualGUID(&IID_IDispatch, riid)) {
50         TRACE("(%p)->(IID_IDispatch, %p)\n", This, ppvObject);
51         *ppvObject = HTMLDOC(This);
52     }else if(IsEqualGUID(&IID_IHTMLDocument, riid)) {
53         TRACE("(%p)->(IID_IHTMLDocument, %p)\n", This, ppvObject);
54         *ppvObject = HTMLDOC(This);
55     }else if(IsEqualGUID(&IID_IHTMLDocument2, riid)) {
56         TRACE("(%p)->(IID_IHTMLDocument2, %p)\n", This, ppvObject);
57         *ppvObject = HTMLDOC(This);
58     }else if(IsEqualGUID(&IID_IPersist, riid)) {
59         TRACE("(%p)->(IID_IPersist, %p)\n", This, ppvObject);
60         *ppvObject = PERSIST(This);
61     }else if(IsEqualGUID(&IID_IPersistMoniker, riid)) {
62         TRACE("(%p)->(IID_IPersistMoniker, %p)\n", This, ppvObject);
63         *ppvObject = PERSISTMON(This);
64     }else if(IsEqualGUID(&IID_IPersistFile, riid)) {
65         TRACE("(%p)->(IID_IPersistFile, %p)\n", This, ppvObject);
66         *ppvObject = PERSISTFILE(This);
67     }else if(IsEqualGUID(&IID_IMonikerProp, riid)) {
68         TRACE("(%p)->(IID_IMonikerProp, %p)\n", This, ppvObject);
69         *ppvObject = MONPROP(This);
70     }else if(IsEqualGUID(&IID_IOleObject, riid)) {
71         TRACE("(%p)->(IID_IOleObject, %p)\n", This, ppvObject);
72         *ppvObject = OLEOBJ(This);
73     }else if(IsEqualGUID(&IID_IOleDocument, riid)) {
74         TRACE("(%p)->(IID_IOleDocument, %p)\n", This, ppvObject);
75         *ppvObject = OLEDOC(This);
76     }else if(IsEqualGUID(&IID_IOleDocumentView, riid)) {
77         TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This, ppvObject);
78         *ppvObject = DOCVIEW(This);
79     }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
80         TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This, ppvObject);
81         *ppvObject = ACTOBJ(This);
82     }else if(IsEqualGUID(&IID_IViewObject, riid)) {
83         TRACE("(%p)->(IID_IViewObject, %p)\n", This, ppvObject);
84         *ppvObject = VIEWOBJ(This);
85     }else if(IsEqualGUID(&IID_IViewObject2, riid)) {
86         TRACE("(%p)->(IID_IViewObject2, %p)\n", This, ppvObject);
87         *ppvObject = VIEWOBJ2(This);
88     }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
89         TRACE("(%p)->(IID_IOleWindow, %p)\n", This, ppvObject);
90         *ppvObject = OLEWIN(This);
91     }else if(IsEqualGUID(&IID_IOleInPlaceObject, riid)) {
92         TRACE("(%p)->(IID_IOleInPlaceObject, %p)\n", This, ppvObject);
93         *ppvObject = INPLACEOBJ(This);
94     }else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless, riid)) {
95         TRACE("(%p)->(IID_IOleInPlaceObjectWindowless, %p)\n", This, ppvObject);
96         *ppvObject = INPLACEWIN(This);
97     }
98
99     if(*ppvObject) {
100         IHTMLDocument2_AddRef(iface);
101         return S_OK;
102     }
103
104     FIXME("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppvObject);
105     return E_NOINTERFACE;
106 }
107
108 static ULONG WINAPI HTMLDocument_AddRef(IHTMLDocument2 *iface)
109 {
110     HTMLDocument *This = (HTMLDocument*)iface;
111     ULONG ref = InterlockedIncrement(&This->ref);
112     TRACE("(%p) ref = %lu\n", This, ref);
113     return ref;
114 }
115
116 static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
117 {
118     HTMLDocument *This = (HTMLDocument*)iface;
119     ULONG ref = InterlockedDecrement(&This->ref);
120
121     TRACE("(%p) ref = %lu\n", This, ref);
122
123     if(!ref) {
124         if(This->client)
125             IOleClientSite_Release(This->client);
126         if(This->ipsite)
127             IOleInPlaceSite_Release(This->ipsite);
128         if(This->frame)
129             IOleInPlaceFrame_Release(This->frame);
130         HeapFree(GetProcessHeap(), 0, This);
131     }
132
133     return ref;
134 }
135
136 static HRESULT WINAPI HTMLDocument_GetTypeInfoCount(IHTMLDocument2 *iface, UINT *pctinfo)
137 {
138     FIXME("(%p)->(%p)\n", iface, pctinfo);
139     return E_NOTIMPL;
140 }
141
142 static HRESULT WINAPI HTMLDocument_GetTypeInfo(IHTMLDocument2 *iface, UINT iTInfo,
143                                                 LCID lcid, ITypeInfo **ppTInfo)
144 {
145     FIXME("(%p)->(%u %lu %p)\n", iface, iTInfo, lcid, ppTInfo);
146     return E_NOTIMPL;
147 }
148
149 static HRESULT WINAPI HTMLDocument_GetIDsOfNames(IHTMLDocument2 *iface, REFIID riid,
150                                                 LPOLESTR *rgszNames, UINT cNames,
151                                                 LCID lcid, DISPID *rgDispId)
152 {
153     FIXME("(%p)->(%s %p %u %lu %p)\n", iface, debugstr_guid(riid), rgszNames, cNames,
154                                         lcid, rgDispId);
155     return E_NOTIMPL;
156 }
157
158 static HRESULT WINAPI HTMLDocument_Invoke(IHTMLDocument2 *iface, DISPID dispIdMember,
159                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
160                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
161 {
162     FIXME("(%p)->(%ld %s %ld %d %p %p %p %p)\n", iface, dispIdMember, debugstr_guid(riid),
163                                   lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
164     return E_NOTIMPL;
165 }
166
167 static HRESULT WINAPI HTMLDocument_get_Script(IHTMLDocument2 *iface, IDispatch **p)
168 {
169     FIXME("(%p)->(%p)\n", iface, p);
170     return E_NOTIMPL;
171 }
172
173 static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCollection **p)
174 {
175     FIXME("(%p)->(%p)\n", iface, p);
176     return E_NOTIMPL;
177 }
178
179 static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement **p)
180 {
181     FIXME("(%p)->(%p)\n", iface, p);
182     return E_NOTIMPL;
183 }
184
185 static HRESULT WINAPI HTMLDocument_get_activeElement(IHTMLDocument2 *iface, IHTMLElement **p)
186 {
187     FIXME("(%p)->(%p)\n", iface, p);
188     return E_NOTIMPL;
189 }
190
191 static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElementCollection **p)
192 {
193     FIXME("(%p)->(%p)\n", iface, p);
194     return E_NOTIMPL;
195 }
196
197 static HRESULT WINAPI HTMLDocument_get_applets(IHTMLDocument2 *iface, IHTMLElementCollection **p)
198 {
199     FIXME("(%p)->(%p)\n", iface, p);
200     return E_NOTIMPL;
201 }
202
203 static HRESULT WINAPI HTMLDocument_get_links(IHTMLDocument2 *iface, IHTMLElementCollection **p)
204 {
205     FIXME("(%p)->(%p)\n", iface, p);
206     return E_NOTIMPL;
207 }
208
209 static HRESULT WINAPI HTMLDocument_get_forms(IHTMLDocument2 *iface, IHTMLElementCollection **p)
210 {
211     FIXME("(%p)->(%p)\n", iface, p);
212     return E_NOTIMPL;
213 }
214
215 static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLElementCollection **p)
216 {
217     FIXME("(%p)->(%p)\n", iface, p);
218     return E_NOTIMPL;
219 }
220
221 static HRESULT WINAPI HTMLDocument_put_title(IHTMLDocument2 *iface, BSTR v)
222 {
223     FIXME("(%p)->(%s)\n", iface, debugstr_w(v));
224     return E_NOTIMPL;
225 }
226
227 static HRESULT WINAPI HTMLDocument_get_title(IHTMLDocument2 *iface, BSTR *p)
228 {
229     FIXME("(%p)->(%p)\n", iface, p);
230     return E_NOTIMPL;
231 }
232
233 static HRESULT WINAPI HTMLDocument_get_scripts(IHTMLDocument2 *iface, IHTMLElementCollection **p)
234 {
235     FIXME("(%p)->(%p)\n", iface, p);
236     return E_NOTIMPL;
237 }
238
239 static HRESULT WINAPI HTMLDocument_put_designMode(IHTMLDocument2 *iface, BSTR v)
240 {
241     FIXME("(%p)->(%s)\n", iface, debugstr_w(v));
242     return E_NOTIMPL;
243 }
244
245 static HRESULT WINAPI HTMLDocument_get_designMode(IHTMLDocument2 *iface, BSTR *p)
246 {
247     FIXME("(%p)->(%p)\n", iface, p);
248     return E_NOTIMPL;
249 }
250
251 static HRESULT WINAPI HTMLDocument_get_selection(IHTMLDocument2 *iface, IHTMLSelectionObject **p)
252 {
253     FIXME("(%p)->(%p)\n", iface, p);
254     return E_NOTIMPL;
255 }
256
257 static HRESULT WINAPI HTMLDocument_get_readyState(IHTMLDocument2 *iface, BSTR *p)
258 {
259     FIXME("(%p)->(%p)\n", iface, p);
260     return E_NOTIMPL;
261 }
262
263 static HRESULT WINAPI HTMLDocument_get_frames(IHTMLDocument2 *iface, IHTMLFramesCollection2 **p)
264 {
265     FIXME("(%p)->(%p)\n", iface, p);
266     return E_NOTIMPL;
267 }
268
269 static HRESULT WINAPI HTMLDocument_get_embeds(IHTMLDocument2 *iface, IHTMLElementCollection **p)
270 {
271     FIXME("(%p)->(%p)\n", iface, p);
272     return E_NOTIMPL;
273 }
274
275 static HRESULT WINAPI HTMLDocument_get_plugins(IHTMLDocument2 *iface, IHTMLElementCollection **p)
276 {
277     FIXME("(%p)->(%p)\n", iface, p);
278     return E_NOTIMPL;
279 }
280
281 static HRESULT WINAPI HTMLDocument_put_alinkColor(IHTMLDocument2 *iface, VARIANT v)
282 {
283     FIXME("(%p)\n", iface);
284     return E_NOTIMPL;
285 }
286
287 static HRESULT WINAPI HTMLDocument_get_alinkColor(IHTMLDocument2 *iface, VARIANT *p)
288 {
289     FIXME("(%p)->(%p)\n", iface, p);
290     return E_NOTIMPL;
291 }
292
293 static HRESULT WINAPI HTMLDocument_put_bgColor(IHTMLDocument2 *iface, VARIANT v)
294 {
295     FIXME("(%p)\n", iface);
296     return E_NOTIMPL;
297 }
298
299 static HRESULT WINAPI HTMLDocument_get_bgColor(IHTMLDocument2 *iface, VARIANT *p)
300 {
301     FIXME("(%p)->(%p)\n", iface, p);
302     return E_NOTIMPL;
303 }
304
305 static HRESULT WINAPI HTMLDocument_put_fgColor(IHTMLDocument2 *iface, VARIANT v)
306 {
307     FIXME("(%p)\n", iface);
308     return E_NOTIMPL;
309 }
310
311 static HRESULT WINAPI HTMLDocument_get_fgColor(IHTMLDocument2 *iface, VARIANT *p)
312 {
313     FIXME("(%p)->(%p)\n", iface, p);
314     return E_NOTIMPL;
315 }
316
317 static HRESULT WINAPI HTMLDocument_put_linkColor(IHTMLDocument2 *iface, VARIANT v)
318 {
319     FIXME("(%p)->()\n", iface);
320     return E_NOTIMPL;
321 }
322
323 static HRESULT WINAPI HTMLDocument_get_linkColor(IHTMLDocument2 *iface, VARIANT *p)
324 {
325     FIXME("(%p)->(%p)\n", iface, p);
326     return E_NOTIMPL;
327 }
328
329 static HRESULT WINAPI HTMLDocument_put_vlinkColor(IHTMLDocument2 *iface, VARIANT v)
330 {
331     FIXME("(%p)\n", iface);
332     return E_NOTIMPL;
333 }
334
335 static HRESULT WINAPI HTMLDocument_get_vlinkColor(IHTMLDocument2 *iface, VARIANT *p)
336 {
337     FIXME("(%p)->(%p)\n", iface, p);
338     return E_NOTIMPL;
339 }
340
341 static HRESULT WINAPI HTMLDocument_get_referrer(IHTMLDocument2 *iface, BSTR *p)
342 {
343     FIXME("(%p)->(%p)\n", iface, p);
344     return E_NOTIMPL;
345 }
346
347 static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLocation **p)
348 {
349     FIXME("(%p)->(%p)\n", iface, p);
350     return E_NOTIMPL;
351 }
352
353 static HRESULT WINAPI HTMLDocument_get_lastModified(IHTMLDocument2 *iface, BSTR *p)
354 {
355     FIXME("(%p)->(%p)\n", iface, p);
356     return E_NOTIMPL;
357 }
358
359 static HRESULT WINAPI HTMLDocument_put_URL(IHTMLDocument2 *iface, BSTR v)
360 {
361     FIXME("(%p)->(%s)\n", iface, debugstr_w(v));
362     return E_NOTIMPL;
363 }
364
365 static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p)
366 {
367     FIXME("(%p)->(%p)\n", iface, p);
368     return E_NOTIMPL;
369 }
370
371 static HRESULT WINAPI HTMLDocument_put_domain(IHTMLDocument2 *iface, BSTR v)
372 {
373     FIXME("(%p)->(%s)\n", iface, debugstr_w(v));
374     return E_NOTIMPL;
375 }
376
377 static HRESULT WINAPI HTMLDocument_get_domain(IHTMLDocument2 *iface, BSTR *p)
378 {
379     FIXME("(%p)->(%p)\n", iface, p);
380     return E_NOTIMPL;
381 }
382
383 static HRESULT WINAPI HTMLDocument_put_cookie(IHTMLDocument2 *iface, BSTR v)
384 {
385     FIXME("(%p)->(%s)\n", iface, debugstr_w(v));
386     return E_NOTIMPL;
387 }
388
389 static HRESULT WINAPI HTMLDocument_get_cookie(IHTMLDocument2 *iface, BSTR *p)
390 {
391     FIXME("(%p)->(%p)\n", iface, p);
392     return E_NOTIMPL;
393 }
394
395 static HRESULT WINAPI HTMLDocument_put_expando(IHTMLDocument2 *iface, VARIANT_BOOL v)
396 {
397     FIXME("(%p)->(%x)\n", iface, v);
398     return E_NOTIMPL;
399 }
400
401 static HRESULT WINAPI HTMLDocument_get_expando(IHTMLDocument2 *iface, VARIANT_BOOL *p)
402 {
403     FIXME("(%p)->(%p)\n", iface, p);
404     return E_NOTIMPL;
405 }
406
407 static HRESULT WINAPI HTMLDocument_put_charset(IHTMLDocument2 *iface, BSTR v)
408 {
409     FIXME("(%p)->(%s)\n", iface, debugstr_w(v));
410     return E_NOTIMPL;
411 }
412
413 static HRESULT WINAPI HTMLDocument_get_charset(IHTMLDocument2 *iface, BSTR *p)
414 {
415     FIXME("(%p)->(%p)\n", iface, p);
416     return E_NOTIMPL;
417 }
418
419 static HRESULT WINAPI HTMLDocument_put_defaultCharset(IHTMLDocument2 *iface, BSTR v)
420 {
421     FIXME("(%p)->(%s)\n", iface, debugstr_w(v));
422     return E_NOTIMPL;
423 }
424
425 static HRESULT WINAPI HTMLDocument_get_defaultCharset(IHTMLDocument2 *iface, BSTR *p)
426 {
427     FIXME("(%p)->(%p)\n", iface, p);
428     return E_NOTIMPL;
429 }
430
431 static HRESULT WINAPI HTMLDocument_get_mimeType(IHTMLDocument2 *iface, BSTR *p)
432 {
433     FIXME("(%p)->(%p)\n", iface, p);
434     return E_NOTIMPL;
435 }
436
437 static HRESULT WINAPI HTMLDocument_get_fileSize(IHTMLDocument2 *iface, BSTR *p)
438 {
439     FIXME("(%p)->(%p)\n", iface, p);
440     return E_NOTIMPL;
441 }
442
443 static HRESULT WINAPI HTMLDocument_get_fileCreatedDate(IHTMLDocument2 *iface, BSTR *p)
444 {
445     FIXME("(%p)->(%p)\n", iface, p);
446     return E_NOTIMPL;
447 }
448
449 static HRESULT WINAPI HTMLDocument_get_fileModifiedDate(IHTMLDocument2 *iface, BSTR *p)
450 {
451     FIXME("(%p)->(%p)\n", iface, p);
452     return E_NOTIMPL;
453 }
454
455 static HRESULT WINAPI HTMLDocument_get_fileUpdatedDate(IHTMLDocument2 *iface, BSTR *p)
456 {
457     FIXME("(%p)->(%p)\n", iface, p);
458     return E_NOTIMPL;
459 }
460
461 static HRESULT WINAPI HTMLDocument_get_security(IHTMLDocument2 *iface, BSTR *p)
462 {
463     FIXME("(%p)->(%p)\n", iface, p);
464     return E_NOTIMPL;
465 }
466
467 static HRESULT WINAPI HTMLDocument_get_protocol(IHTMLDocument2 *iface, BSTR *p)
468 {
469     FIXME("(%p)->(%p)\n", iface, p);
470     return E_NOTIMPL;
471 }
472
473 static HRESULT WINAPI HTMLDocument_get_nameProp(IHTMLDocument2 *iface, BSTR *p)
474 {
475     FIXME("(%p)->(%p)\n", iface, p);
476     return E_NOTIMPL;
477 }
478
479 static HRESULT WINAPI HTMLDocument_write(IHTMLDocument2 *iface, SAFEARRAY *psarray)
480 {
481     FIXME("(%p)->(%p)\n", iface, psarray);
482     return E_NOTIMPL;
483 }
484
485 static HRESULT WINAPI HTMLDocument_writeln(IHTMLDocument2 *iface, SAFEARRAY *psarray)
486 {
487     FIXME("(%p)->(%p)\n", iface, psarray);
488     return E_NOTIMPL;
489 }
490
491 static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT name,
492                         VARIANT features, VARIANT replace, IDispatch **pomWindowResult)
493 {
494     FIXME("(%p)->(%s %p)\n", iface, debugstr_w(url), pomWindowResult);
495     return E_NOTIMPL;
496 }
497
498 static HRESULT WINAPI HTMLDocument_close(IHTMLDocument2 *iface)
499 {
500     FIXME("(%p)\n", iface);
501     return E_NOTIMPL;
502 }
503
504 static HRESULT WINAPI HTMLDocument_clear(IHTMLDocument2 *iface)
505 {
506     FIXME("(%p)\n", iface);
507     return E_NOTIMPL;
508 }
509
510 static HRESULT WINAPI HTMLDocument_queryCommandSupported(IHTMLDocument2 *iface, BSTR cmdID,
511                                                         VARIANT_BOOL *pfRet)
512 {
513     FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet);
514     return E_NOTIMPL;
515 }
516
517 static HRESULT WINAPI HTMLDocument_queryCommandEnabled(IHTMLDocument2 *iface, BSTR cmdID,
518                                                         VARIANT_BOOL *pfRet)
519 {
520     FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet);
521     return E_NOTIMPL;
522 }
523
524 static HRESULT WINAPI HTMLDocument_queryCommandState(IHTMLDocument2 *iface, BSTR cmdID,
525                                                         VARIANT_BOOL *pfRet)
526 {
527     FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet);
528     return E_NOTIMPL;
529 }
530
531 static HRESULT WINAPI HTMLDocument_queryCommandIndeterm(IHTMLDocument2 *iface, BSTR cmdID,
532                                                         VARIANT_BOOL *pfRet)
533 {
534     FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet);
535     return E_NOTIMPL;
536 }
537
538 static HRESULT WINAPI HTMLDocument_queryCommandText(IHTMLDocument2 *iface, BSTR cmdID,
539                                                         BSTR *pfRet)
540 {
541     FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet);
542     return E_NOTIMPL;
543 }
544
545 static HRESULT WINAPI HTMLDocument_queryCommandValue(IHTMLDocument2 *iface, BSTR cmdID,
546                                                         VARIANT *pfRet)
547 {
548     FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet);
549     return E_NOTIMPL;
550 }
551
552 static HRESULT WINAPI HTMLDocument_execCommand(IHTMLDocument2 *iface, BSTR cmdID,
553                                 VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL *pfRet)
554 {
555     FIXME("(%p)->(%s %x %p)\n", iface, debugstr_w(cmdID), showUI, pfRet);
556     return E_NOTIMPL;
557 }
558
559 static HRESULT WINAPI HTMLDocument_execCommandShowHelp(IHTMLDocument2 *iface, BSTR cmdID,
560                                                         VARIANT_BOOL *pfRet)
561 {
562     FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet);
563     return E_NOTIMPL;
564 }
565
566 static HRESULT WINAPI HTMLDocument_createElement(IHTMLDocument2 *iface, BSTR eTag,
567                                                     IHTMLElement **newElem)
568 {
569     FIXME("(%p)->(%s %p)\n", iface, debugstr_w(eTag), newElem);
570     return E_NOTIMPL;
571 }
572
573 static HRESULT WINAPI HTMLDocument_put_onhelp(IHTMLDocument2 *iface, VARIANT v)
574 {
575     FIXME("(%p)\n", iface);
576     return E_NOTIMPL;
577 }
578
579 static HRESULT WINAPI HTMLDocument_get_onhelp(IHTMLDocument2 *iface, VARIANT *p)
580 {
581     FIXME("(%p)->(%p)\n", iface, p);
582     return E_NOTIMPL;
583 }
584
585 static HRESULT WINAPI HTMLDocument_put_onclick(IHTMLDocument2 *iface, VARIANT v)
586 {
587     FIXME("(%p)\n", iface);
588     return E_NOTIMPL;
589 }
590
591 static HRESULT WINAPI HTMLDocument_get_onclick(IHTMLDocument2 *iface, VARIANT *p)
592 {
593     FIXME("(%p)->(%p)\n", iface, p);
594     return E_NOTIMPL;
595 }
596
597 static HRESULT WINAPI HTMLDocument_put_ondblclick(IHTMLDocument2 *iface, VARIANT v)
598 {
599     FIXME("(%p)\n", iface);
600     return E_NOTIMPL;
601 }
602
603 static HRESULT WINAPI HTMLDocument_get_ondblclick(IHTMLDocument2 *iface, VARIANT *p)
604 {
605     FIXME("(%p)->(%p)\n", iface, p);
606     return E_NOTIMPL;
607 }
608
609 static HRESULT WINAPI HTMLDocument_put_onkeyup(IHTMLDocument2 *iface, VARIANT v)
610 {
611     FIXME("(%p)\n", iface);
612     return E_NOTIMPL;
613 }
614
615 static HRESULT WINAPI HTMLDocument_get_onkeyup(IHTMLDocument2 *iface, VARIANT *p)
616 {
617     FIXME("(%p)->(%p)\n", iface, p);
618     return E_NOTIMPL;
619 }
620
621 static HRESULT WINAPI HTMLDocument_put_onkeydown(IHTMLDocument2 *iface, VARIANT v)
622 {
623     FIXME("(%p)\n", iface);
624     return E_NOTIMPL;
625 }
626
627 static HRESULT WINAPI HTMLDocument_get_onkeydown(IHTMLDocument2 *iface, VARIANT *p)
628 {
629     FIXME("(%p)->(%p)\n", iface, p);
630     return E_NOTIMPL;
631 }
632
633 static HRESULT WINAPI HTMLDocument_put_onkeypress(IHTMLDocument2 *iface, VARIANT v)
634 {
635     FIXME("(%p)\n", iface);
636     return E_NOTIMPL;
637 }
638
639 static HRESULT WINAPI HTMLDocument_get_onkeypress(IHTMLDocument2 *iface, VARIANT *p)
640 {
641     FIXME("(%p)->(%p)\n", iface, p);
642     return E_NOTIMPL;
643 }
644
645 static HRESULT WINAPI HTMLDocument_put_onmouseup(IHTMLDocument2 *iface, VARIANT v)
646 {
647     FIXME("(%p)\n", iface);
648     return E_NOTIMPL;
649 }
650
651 static HRESULT WINAPI HTMLDocument_get_onmouseup(IHTMLDocument2 *iface, VARIANT *p)
652 {
653     FIXME("(%p)->(%p)\n", iface, p);
654     return E_NOTIMPL;
655 }
656
657 static HRESULT WINAPI HTMLDocument_put_onmousedown(IHTMLDocument2 *iface, VARIANT v)
658 {
659     FIXME("(%p)\n", iface);
660     return E_NOTIMPL;
661 }
662
663 static HRESULT WINAPI HTMLDocument_get_onmousedown(IHTMLDocument2 *iface, VARIANT *p)
664 {
665     FIXME("(%p)->(%p)\n", iface, p);
666     return E_NOTIMPL;
667 }
668
669 static HRESULT WINAPI HTMLDocument_put_onmousemove(IHTMLDocument2 *iface, VARIANT v)
670 {
671     FIXME("(%p)\n", iface);
672     return E_NOTIMPL;
673 }
674
675 static HRESULT WINAPI HTMLDocument_get_onmousemove(IHTMLDocument2 *iface, VARIANT *p)
676 {
677     FIXME("(%p)->(%p)\n", iface, p);
678     return E_NOTIMPL;
679 }
680
681 static HRESULT WINAPI HTMLDocument_put_onmouseout(IHTMLDocument2 *iface, VARIANT v)
682 {
683     FIXME("(%p)\n", iface);
684     return E_NOTIMPL;
685 }
686
687 static HRESULT WINAPI HTMLDocument_get_onmouseout(IHTMLDocument2 *iface, VARIANT *p)
688 {
689     FIXME("(%p)->(%p)\n", iface, p);
690     return E_NOTIMPL;
691 }
692
693 static HRESULT WINAPI HTMLDocument_put_onmouseover(IHTMLDocument2 *iface, VARIANT v)
694 {
695     FIXME("(%p)\n", iface);
696     return E_NOTIMPL;
697 }
698
699 static HRESULT WINAPI HTMLDocument_get_onmouseover(IHTMLDocument2 *iface, VARIANT *p)
700 {
701     FIXME("(%p)->(%p)\n", iface, p);
702     return E_NOTIMPL;
703 }
704
705 static HRESULT WINAPI HTMLDocument_put_onreadystatechange(IHTMLDocument2 *iface, VARIANT v)
706 {
707     FIXME("(%p)\n", iface);
708     return E_NOTIMPL;
709 }
710
711 static HRESULT WINAPI HTMLDocument_get_onreadystatechange(IHTMLDocument2 *iface, VARIANT *p)
712 {
713     FIXME("(%p)->(%p)\n", iface, p);
714     return E_NOTIMPL;
715 }
716
717 static HRESULT WINAPI HTMLDocument_put_onafterupdate(IHTMLDocument2 *iface, VARIANT v)
718 {
719     FIXME("(%p)\n", iface);
720     return E_NOTIMPL;
721 }
722
723 static HRESULT WINAPI HTMLDocument_get_onafterupdate(IHTMLDocument2 *iface, VARIANT *p)
724 {
725     FIXME("(%p)->(%p)\n", iface, p);
726     return E_NOTIMPL;
727 }
728
729 static HRESULT WINAPI HTMLDocument_put_onrowexit(IHTMLDocument2 *iface, VARIANT v)
730 {
731     FIXME("(%p)\n", iface);
732     return E_NOTIMPL;
733 }
734
735 static HRESULT WINAPI HTMLDocument_get_onrowexit(IHTMLDocument2 *iface, VARIANT *p)
736 {
737     FIXME("(%p)->(%p)\n", iface, p);
738     return E_NOTIMPL;
739 }
740
741 static HRESULT WINAPI HTMLDocument_put_onrowenter(IHTMLDocument2 *iface, VARIANT v)
742 {
743     FIXME("(%p)\n", iface);
744     return E_NOTIMPL;
745 }
746
747 static HRESULT WINAPI HTMLDocument_get_onrowenter(IHTMLDocument2 *iface, VARIANT *p)
748 {
749     FIXME("(%p)->(%p)\n", iface, p);
750     return E_NOTIMPL;
751 }
752
753 static HRESULT WINAPI HTMLDocument_put_ondragstart(IHTMLDocument2 *iface, VARIANT v)
754 {
755     FIXME("(%p)\n", iface);
756     return E_NOTIMPL;
757 }
758
759 static HRESULT WINAPI HTMLDocument_get_ondragstart(IHTMLDocument2 *iface, VARIANT *p)
760 {
761     FIXME("(%p)->(%p)\n", iface, p);
762     return E_NOTIMPL;
763 }
764
765 static HRESULT WINAPI HTMLDocument_put_onselectstart(IHTMLDocument2 *iface, VARIANT v)
766 {
767     FIXME("(%p)\n", iface);
768     return E_NOTIMPL;
769 }
770
771 static HRESULT WINAPI HTMLDocument_get_onselectstart(IHTMLDocument2 *iface, VARIANT *p)
772 {
773     FIXME("(%p)->(%p)\n", iface, p);
774     return E_NOTIMPL;
775 }
776
777 static HRESULT WINAPI HTMLDocument_elementFromPoint(IHTMLDocument2 *iface, long x, long y,
778                                                         IHTMLElement **elementHit)
779 {
780     FIXME("(%p)->(%ld %ld %p)\n", iface, x, y, elementHit);
781     return E_NOTIMPL;
782 }
783
784 static HRESULT WINAPI HTMLDocument_get_parentWindow(IHTMLDocument2 *iface, IHTMLWindow2 **p)
785 {
786     FIXME("(%p)->(%p)\n", iface, p);
787     return E_NOTIMPL;
788 }
789
790 static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface,
791                                                     IHTMLStyleSheetsCollection **p)
792 {
793     FIXME("(%p)->(%p)\n", iface, p);
794     return E_NOTIMPL;
795 }
796
797 static HRESULT WINAPI HTMLDocument_put_onbeforeupdate(IHTMLDocument2 *iface, VARIANT v)
798 {
799     FIXME("(%p)\n", iface);
800     return E_NOTIMPL;
801 }
802
803 static HRESULT WINAPI HTMLDocument_get_onbeforeupdate(IHTMLDocument2 *iface, VARIANT *p)
804 {
805     FIXME("(%p)->(%p)\n", iface, p);
806     return E_NOTIMPL;
807 }
808
809 static HRESULT WINAPI HTMLDocument_put_onerrorupdate(IHTMLDocument2 *iface, VARIANT v)
810 {
811     FIXME("(%p)\n", iface);
812     return E_NOTIMPL;
813 }
814
815 static HRESULT WINAPI HTMLDocument_get_onerrorupdate(IHTMLDocument2 *iface, VARIANT *p)
816 {
817     FIXME("(%p)->(%p)\n", iface, p);
818     return E_NOTIMPL;
819 }
820
821 static HRESULT WINAPI HTMLDocument_toString(IHTMLDocument2 *iface, BSTR *String)
822 {
823     FIXME("(%p)->(%p)\n", iface, String);
824     return E_NOTIMPL;
825 }
826
827 static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR bstrHref,
828                                             long lIndex, IHTMLStyleSheet **ppnewStyleSheet)
829 {
830     FIXME("(%p)->(%s %ld %p)\n", iface, debugstr_w(bstrHref), lIndex, ppnewStyleSheet);
831     return E_NOTIMPL;
832 }
833
834 static const IHTMLDocument2Vtbl HTMLDocumentVtbl = {
835     HTMLDocument_QueryInterface,
836     HTMLDocument_AddRef,
837     HTMLDocument_Release,
838     HTMLDocument_GetTypeInfoCount,
839     HTMLDocument_GetTypeInfo,
840     HTMLDocument_GetIDsOfNames,
841     HTMLDocument_Invoke,
842     HTMLDocument_get_Script,
843     HTMLDocument_get_all,
844     HTMLDocument_get_body,
845     HTMLDocument_get_activeElement,
846     HTMLDocument_get_images,
847     HTMLDocument_get_applets,
848     HTMLDocument_get_links,
849     HTMLDocument_get_forms,
850     HTMLDocument_get_anchors,
851     HTMLDocument_put_title,
852     HTMLDocument_get_title,
853     HTMLDocument_get_scripts,
854     HTMLDocument_put_designMode,
855     HTMLDocument_get_designMode,
856     HTMLDocument_get_selection,
857     HTMLDocument_get_readyState,
858     HTMLDocument_get_frames,
859     HTMLDocument_get_embeds,
860     HTMLDocument_get_plugins,
861     HTMLDocument_put_alinkColor,
862     HTMLDocument_get_alinkColor,
863     HTMLDocument_put_bgColor,
864     HTMLDocument_get_bgColor,
865     HTMLDocument_put_fgColor,
866     HTMLDocument_get_fgColor,
867     HTMLDocument_put_linkColor,
868     HTMLDocument_get_linkColor,
869     HTMLDocument_put_vlinkColor,
870     HTMLDocument_get_vlinkColor,
871     HTMLDocument_get_referrer,
872     HTMLDocument_get_location,
873     HTMLDocument_get_lastModified,
874     HTMLDocument_put_URL,
875     HTMLDocument_get_URL,
876     HTMLDocument_put_domain,
877     HTMLDocument_get_domain,
878     HTMLDocument_put_cookie,
879     HTMLDocument_get_cookie,
880     HTMLDocument_put_expando,
881     HTMLDocument_get_expando,
882     HTMLDocument_put_charset,
883     HTMLDocument_get_charset,
884     HTMLDocument_put_defaultCharset,
885     HTMLDocument_get_defaultCharset,
886     HTMLDocument_get_mimeType,
887     HTMLDocument_get_fileSize,
888     HTMLDocument_get_fileCreatedDate,
889     HTMLDocument_get_fileModifiedDate,
890     HTMLDocument_get_fileUpdatedDate,
891     HTMLDocument_get_security,
892     HTMLDocument_get_protocol,
893     HTMLDocument_get_nameProp,
894     HTMLDocument_write,
895     HTMLDocument_writeln,
896     HTMLDocument_open,
897     HTMLDocument_close,
898     HTMLDocument_clear,
899     HTMLDocument_queryCommandSupported,
900     HTMLDocument_queryCommandEnabled,
901     HTMLDocument_queryCommandState,
902     HTMLDocument_queryCommandIndeterm,
903     HTMLDocument_queryCommandText,
904     HTMLDocument_queryCommandValue,
905     HTMLDocument_execCommand,
906     HTMLDocument_execCommandShowHelp,
907     HTMLDocument_createElement,
908     HTMLDocument_put_onhelp,
909     HTMLDocument_get_onhelp,
910     HTMLDocument_put_onclick,
911     HTMLDocument_get_onclick,
912     HTMLDocument_put_ondblclick,
913     HTMLDocument_get_ondblclick,
914     HTMLDocument_put_onkeyup,
915     HTMLDocument_get_onkeyup,
916     HTMLDocument_put_onkeydown,
917     HTMLDocument_get_onkeydown,
918     HTMLDocument_put_onkeypress,
919     HTMLDocument_get_onkeypress,
920     HTMLDocument_put_onmouseup,
921     HTMLDocument_get_onmouseup,
922     HTMLDocument_put_onmousedown,
923     HTMLDocument_get_onmousedown,
924     HTMLDocument_put_onmousemove,
925     HTMLDocument_get_onmousemove,
926     HTMLDocument_put_onmouseout,
927     HTMLDocument_get_onmouseout,
928     HTMLDocument_put_onmouseover,
929     HTMLDocument_get_onmouseover,
930     HTMLDocument_put_onreadystatechange,
931     HTMLDocument_get_onreadystatechange,
932     HTMLDocument_put_onafterupdate,
933     HTMLDocument_get_onafterupdate,
934     HTMLDocument_put_onrowexit,
935     HTMLDocument_get_onrowexit,
936     HTMLDocument_put_onrowenter,
937     HTMLDocument_get_onrowenter,
938     HTMLDocument_put_ondragstart,
939     HTMLDocument_get_ondragstart,
940     HTMLDocument_put_onselectstart,
941     HTMLDocument_get_onselectstart,
942     HTMLDocument_elementFromPoint,
943     HTMLDocument_get_parentWindow,
944     HTMLDocument_get_styleSheets,
945     HTMLDocument_put_onbeforeupdate,
946     HTMLDocument_get_onbeforeupdate,
947     HTMLDocument_put_onerrorupdate,
948     HTMLDocument_get_onerrorupdate,
949     HTMLDocument_toString,
950     HTMLDocument_createStyleSheet
951 };
952
953 HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
954 {
955     HTMLDocument *ret;
956     HRESULT hres;
957
958     TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppvObject);
959
960     ret = HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLDocument));
961     ret->lpHTMLDocument2Vtbl = &HTMLDocumentVtbl;
962     ret->ref = 0;
963
964     hres = IHTMLDocument_QueryInterface(HTMLDOC(ret), riid, ppvObject);
965     if(FAILED(hres))
966         HeapFree(GetProcessHeap(), 0, ret);
967
968     HTMLDocument_Persist_Init(ret);
969     HTMLDocument_OleObj_Init(ret);
970     HTMLDocument_View_Init(ret);
971     HTMLDocument_Window_Init(ret);
972
973     return hres;
974 }