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