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