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