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