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