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