2 * Copyright 2005 Jacek Caban
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.
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.
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
31 #include "wine/debug.h"
33 #include "mshtml_private.h"
34 #include "htmlevent.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
38 #define HTMLDOC_THIS(iface) DEFINE_THIS(HTMLDocument, HTMLDocument2, iface)
40 static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID riid, void **ppvObject)
42 HTMLDocument *This = HTMLDOC_THIS(iface);
45 if(IsEqualGUID(&IID_IUnknown, riid)) {
46 TRACE("(%p)->(IID_IUnknown, %p)\n", This, ppvObject);
47 *ppvObject = HTMLDOC(This);
48 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
49 TRACE("(%p)->(IID_IDispatch, %p)\n", This, ppvObject);
50 *ppvObject = DISPATCHEX(This);
51 }else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
52 TRACE("(%p)->(IID_IDispatchEx, %p)\n", This, ppvObject);
53 *ppvObject = DISPATCHEX(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_IHTMLDocument3, riid)) {
61 TRACE("(%p)->(IID_IHTMLDocument3, %p)\n", This, ppvObject);
62 *ppvObject = HTMLDOC3(This);
63 }else if(IsEqualGUID(&IID_IHTMLDocument4, riid)) {
64 TRACE("(%p)->(IID_IHTMLDocument4, %p)\n", This, ppvObject);
65 *ppvObject = HTMLDOC4(This);
66 }else if(IsEqualGUID(&IID_IHTMLDocument5, riid)) {
67 TRACE("(%p)->(IID_IHTMLDocument5, %p)\n", This, ppvObject);
68 *ppvObject = HTMLDOC5(This);
69 }else if(IsEqualGUID(&IID_IPersist, riid)) {
70 TRACE("(%p)->(IID_IPersist, %p)\n", This, ppvObject);
71 *ppvObject = PERSIST(This);
72 }else if(IsEqualGUID(&IID_IPersistMoniker, riid)) {
73 TRACE("(%p)->(IID_IPersistMoniker, %p)\n", This, ppvObject);
74 *ppvObject = PERSISTMON(This);
75 }else if(IsEqualGUID(&IID_IPersistFile, riid)) {
76 TRACE("(%p)->(IID_IPersistFile, %p)\n", This, ppvObject);
77 *ppvObject = PERSISTFILE(This);
78 }else if(IsEqualGUID(&IID_IMonikerProp, riid)) {
79 TRACE("(%p)->(IID_IMonikerProp, %p)\n", This, ppvObject);
80 *ppvObject = MONPROP(This);
81 }else if(IsEqualGUID(&IID_IOleObject, riid)) {
82 TRACE("(%p)->(IID_IOleObject, %p)\n", This, ppvObject);
83 *ppvObject = OLEOBJ(This);
84 }else if(IsEqualGUID(&IID_IOleDocument, riid)) {
85 TRACE("(%p)->(IID_IOleDocument, %p)\n", This, ppvObject);
86 *ppvObject = OLEDOC(This);
87 }else if(IsEqualGUID(&IID_IOleDocumentView, riid)) {
88 TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This, ppvObject);
89 *ppvObject = DOCVIEW(This);
90 }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
91 TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This, ppvObject);
92 *ppvObject = ACTOBJ(This);
93 }else if(IsEqualGUID(&IID_IViewObject, riid)) {
94 TRACE("(%p)->(IID_IViewObject, %p)\n", This, ppvObject);
95 *ppvObject = VIEWOBJ(This);
96 }else if(IsEqualGUID(&IID_IViewObject2, riid)) {
97 TRACE("(%p)->(IID_IViewObject2, %p)\n", This, ppvObject);
98 *ppvObject = VIEWOBJ2(This);
99 }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
100 TRACE("(%p)->(IID_IOleWindow, %p)\n", This, ppvObject);
101 *ppvObject = OLEWIN(This);
102 }else if(IsEqualGUID(&IID_IOleInPlaceObject, riid)) {
103 TRACE("(%p)->(IID_IOleInPlaceObject, %p)\n", This, ppvObject);
104 *ppvObject = INPLACEOBJ(This);
105 }else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless, riid)) {
106 TRACE("(%p)->(IID_IOleInPlaceObjectWindowless, %p)\n", This, ppvObject);
107 *ppvObject = INPLACEWIN(This);
108 }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
109 TRACE("(%p)->(IID_IServiceProvider, %p)\n", This, ppvObject);
110 *ppvObject = SERVPROV(This);
111 }else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
112 TRACE("(%p)->(IID_IOleCommandTarget, %p)\n", This, ppvObject);
113 *ppvObject = CMDTARGET(This);
114 }else if(IsEqualGUID(&IID_IOleControl, riid)) {
115 TRACE("(%p)->(IID_IOleControl, %p)\n", This, ppvObject);
116 *ppvObject = CONTROL(This);
117 }else if(IsEqualGUID(&IID_IHlinkTarget, riid)) {
118 TRACE("(%p)->(IID_IHlinkTarget, %p)\n", This, ppvObject);
119 *ppvObject = HLNKTARGET(This);
120 }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
121 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppvObject);
122 *ppvObject = CONPTCONT(&This->cp_container);
123 }else if(IsEqualGUID(&IID_IPersistStreamInit, riid)) {
124 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppvObject);
125 *ppvObject = PERSTRINIT(This);
126 }else if(IsEqualGUID(&IID_ICustomDoc, riid)) {
127 TRACE("(%p)->(IID_ICustomDoc %p)\n", This, ppvObject);
128 *ppvObject = CUSTOMDOC(This);
129 }else if(IsEqualGUID(&DIID_DispHTMLDocument, riid)) {
130 TRACE("(%p)->(DIID_DispHTMLDocument %p)\n", This, ppvObject);
131 *ppvObject = HTMLDOC(This);
132 }else if(IsEqualGUID(&CLSID_CMarkup, riid)) {
133 FIXME("(%p)->(CLSID_CMarkup %p)\n", This, ppvObject);
134 return E_NOINTERFACE;
135 }else if(IsEqualGUID(&IID_IRunnableObject, riid)) {
136 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This, ppvObject);
137 return E_NOINTERFACE;
138 }else if(IsEqualGUID(&IID_IPersistPropertyBag, riid)) {
139 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This, ppvObject);
140 return E_NOINTERFACE;
141 }else if(dispex_query_interface(&This->dispex, riid, ppvObject)) {
142 return *ppvObject ? S_OK : E_NOINTERFACE;
146 IHTMLDocument2_AddRef(iface);
150 FIXME("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppvObject);
151 return E_NOINTERFACE;
154 static ULONG WINAPI HTMLDocument_AddRef(IHTMLDocument2 *iface)
156 HTMLDocument *This = HTMLDOC_THIS(iface);
157 ULONG ref = InterlockedIncrement(&This->ref);
158 TRACE("(%p) ref = %u\n", This, ref);
162 static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
164 HTMLDocument *This = HTMLDOC_THIS(iface);
165 ULONG ref = InterlockedDecrement(&This->ref);
167 TRACE("(%p) ref = %u\n", This, ref);
170 remove_doc_tasks(This);
171 release_script_hosts(This);
174 IOleObject_SetClientSite(OLEOBJ(This), NULL);
175 if(This->in_place_active)
176 IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(This));
178 IOleDocumentView_SetInPlaceSite(DOCVIEW(This), NULL);
180 IOleUndoManager_Release(This->undomgr);
182 set_document_bscallback(This, NULL);
183 set_current_mon(This, NULL);
185 if(This->tooltips_hwnd)
186 DestroyWindow(This->tooltips_hwnd);
188 DestroyWindow(This->hwnd);
190 if(This->option_factory) {
191 This->option_factory->doc = NULL;
192 IHTMLOptionElementFactory_Release(HTMLOPTFACTORY(This->option_factory));
196 This->location->doc = NULL;
199 IHTMLWindow2_Release(HTMLWINDOW2(This->window));
201 if(This->event_target)
202 release_event_target(This->event_target);
204 heap_free(This->mime);
205 detach_selection(This);
209 ConnectionPointContainer_Destroy(&This->cp_container);
212 nsIDOMHTMLDocument_Release(This->nsdoc);
213 if(This->nscontainer)
214 NSContainer_Release(This->nscontainer);
224 static HRESULT WINAPI HTMLDocument_GetTypeInfoCount(IHTMLDocument2 *iface, UINT *pctinfo)
226 HTMLDocument *This = HTMLDOC_THIS(iface);
228 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo);
231 static HRESULT WINAPI HTMLDocument_GetTypeInfo(IHTMLDocument2 *iface, UINT iTInfo,
232 LCID lcid, ITypeInfo **ppTInfo)
234 HTMLDocument *This = HTMLDOC_THIS(iface);
236 return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo);
239 static HRESULT WINAPI HTMLDocument_GetIDsOfNames(IHTMLDocument2 *iface, REFIID riid,
240 LPOLESTR *rgszNames, UINT cNames,
241 LCID lcid, DISPID *rgDispId)
243 HTMLDocument *This = HTMLDOC_THIS(iface);
245 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId);
248 static HRESULT WINAPI HTMLDocument_Invoke(IHTMLDocument2 *iface, DISPID dispIdMember,
249 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
250 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
252 HTMLDocument *This = HTMLDOC_THIS(iface);
254 return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams,
255 pVarResult, pExcepInfo, puArgErr);
258 static HRESULT WINAPI HTMLDocument_get_Script(IHTMLDocument2 *iface, IDispatch **p)
260 HTMLDocument *This = HTMLDOC_THIS(iface);
262 TRACE("(%p)->(%p)\n", This, p);
264 *p = (IDispatch*)HTMLWINDOW2(This->window);
265 IDispatch_AddRef(*p);
269 static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCollection **p)
271 HTMLDocument *This = HTMLDOC_THIS(iface);
272 nsIDOMElement *nselem = NULL;
275 TRACE("(%p)->(%p)\n", This, p);
278 WARN("NULL nsdoc\n");
282 nsres = nsIDOMHTMLDocument_GetDocumentElement(This->nsdoc, &nselem);
283 if(NS_FAILED(nsres)) {
284 ERR("GetDocumentElement failed: %08x\n", nsres);
289 *p = create_all_collection(get_node(This, (nsIDOMNode*)nselem, TRUE), TRUE);
290 nsIDOMElement_Release(nselem);
298 static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement **p)
300 HTMLDocument *This = HTMLDOC_THIS(iface);
301 nsIDOMHTMLElement *nsbody = NULL;
305 TRACE("(%p)->(%p)\n", This, p);
308 WARN("NULL nsdoc\n");
312 nsres = nsIDOMHTMLDocument_GetBody(This->nsdoc, &nsbody);
313 if(NS_FAILED(nsres)) {
314 TRACE("Could not get body: %08x\n", nsres);
319 node = get_node(This, (nsIDOMNode*)nsbody, TRUE);
320 nsIDOMHTMLElement_Release(nsbody);
322 IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)p);
327 TRACE("*p = %p\n", *p);
331 static HRESULT WINAPI HTMLDocument_get_activeElement(IHTMLDocument2 *iface, IHTMLElement **p)
333 HTMLDocument *This = HTMLDOC_THIS(iface);
334 FIXME("(%p)->(%p)\n", This, p);
338 static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElementCollection **p)
340 HTMLDocument *This = HTMLDOC_THIS(iface);
341 FIXME("(%p)->(%p)\n", This, p);
345 static HRESULT WINAPI HTMLDocument_get_applets(IHTMLDocument2 *iface, IHTMLElementCollection **p)
347 HTMLDocument *This = HTMLDOC_THIS(iface);
348 FIXME("(%p)->(%p)\n", This, p);
352 static HRESULT WINAPI HTMLDocument_get_links(IHTMLDocument2 *iface, IHTMLElementCollection **p)
354 HTMLDocument *This = HTMLDOC_THIS(iface);
355 FIXME("(%p)->(%p)\n", This, p);
359 static HRESULT WINAPI HTMLDocument_get_forms(IHTMLDocument2 *iface, IHTMLElementCollection **p)
361 HTMLDocument *This = HTMLDOC_THIS(iface);
362 FIXME("(%p)->(%p)\n", This, p);
366 static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLElementCollection **p)
368 HTMLDocument *This = HTMLDOC_THIS(iface);
369 FIXME("(%p)->(%p)\n", This, p);
373 static HRESULT WINAPI HTMLDocument_put_title(IHTMLDocument2 *iface, BSTR v)
375 HTMLDocument *This = HTMLDOC_THIS(iface);
379 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
382 WARN("NULL nsdoc\n");
386 nsAString_Init(&nsstr, v);
387 nsres = nsIDOMHTMLDocument_SetTitle(This->nsdoc, &nsstr);
388 nsAString_Finish(&nsstr);
390 ERR("SetTitle failed: %08x\n", nsres);
395 static HRESULT WINAPI HTMLDocument_get_title(IHTMLDocument2 *iface, BSTR *p)
397 HTMLDocument *This = HTMLDOC_THIS(iface);
398 const PRUnichar *ret;
402 TRACE("(%p)->(%p)\n", This, p);
405 WARN("NULL nsdoc\n");
410 nsAString_Init(&nsstr, NULL);
411 nsres = nsIDOMHTMLDocument_GetTitle(This->nsdoc, &nsstr);
412 if (NS_SUCCEEDED(nsres)) {
413 nsAString_GetData(&nsstr, &ret);
414 *p = SysAllocString(ret);
416 nsAString_Finish(&nsstr);
418 if(NS_FAILED(nsres)) {
419 ERR("GetTitle failed: %08x\n", nsres);
426 static HRESULT WINAPI HTMLDocument_get_scripts(IHTMLDocument2 *iface, IHTMLElementCollection **p)
428 HTMLDocument *This = HTMLDOC_THIS(iface);
429 FIXME("(%p)->(%p)\n", This, p);
433 static HRESULT WINAPI HTMLDocument_put_designMode(IHTMLDocument2 *iface, BSTR v)
435 HTMLDocument *This = HTMLDOC_THIS(iface);
436 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
440 static HRESULT WINAPI HTMLDocument_get_designMode(IHTMLDocument2 *iface, BSTR *p)
442 HTMLDocument *This = HTMLDOC_THIS(iface);
443 FIXME("(%p)->(%p)\n", This, p);
447 static HRESULT WINAPI HTMLDocument_get_selection(IHTMLDocument2 *iface, IHTMLSelectionObject **p)
449 HTMLDocument *This = HTMLDOC_THIS(iface);
450 nsISelection *nsselection = NULL;
452 TRACE("(%p)->(%p)\n", This, p);
454 if(This->nscontainer) {
455 nsIDOMWindow *dom_window = NULL;
457 nsIWebBrowser_GetContentDOMWindow(This->nscontainer->webbrowser, &dom_window);
459 nsIDOMWindow_GetSelection(dom_window, &nsselection);
460 nsIDOMWindow_Release(dom_window);
464 *p = HTMLSelectionObject_Create(This, nsselection);
468 static HRESULT WINAPI HTMLDocument_get_readyState(IHTMLDocument2 *iface, BSTR *p)
470 HTMLDocument *This = HTMLDOC_THIS(iface);
472 static const WCHAR wszUninitialized[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
473 static const WCHAR wszLoading[] = {'l','o','a','d','i','n','g',0};
474 static const WCHAR wszLoaded[] = {'l','o','a','d','e','d',0};
475 static const WCHAR wszInteractive[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
476 static const WCHAR wszComplete[] = {'c','o','m','p','l','e','t','e',0};
478 static const LPCWSTR readystate_str[] = {
486 TRACE("(%p)->(%p)\n", iface, p);
491 *p = SysAllocString(readystate_str[This->readystate]);
495 static HRESULT WINAPI HTMLDocument_get_frames(IHTMLDocument2 *iface, IHTMLFramesCollection2 **p)
497 HTMLDocument *This = HTMLDOC_THIS(iface);
498 FIXME("(%p)->(%p)\n", This, p);
502 static HRESULT WINAPI HTMLDocument_get_embeds(IHTMLDocument2 *iface, IHTMLElementCollection **p)
504 HTMLDocument *This = HTMLDOC_THIS(iface);
505 FIXME("(%p)->(%p)\n", This, p);
509 static HRESULT WINAPI HTMLDocument_get_plugins(IHTMLDocument2 *iface, IHTMLElementCollection **p)
511 HTMLDocument *This = HTMLDOC_THIS(iface);
512 FIXME("(%p)->(%p)\n", This, p);
516 static HRESULT WINAPI HTMLDocument_put_alinkColor(IHTMLDocument2 *iface, VARIANT v)
518 HTMLDocument *This = HTMLDOC_THIS(iface);
519 FIXME("(%p)\n", This);
523 static HRESULT WINAPI HTMLDocument_get_alinkColor(IHTMLDocument2 *iface, VARIANT *p)
525 HTMLDocument *This = HTMLDOC_THIS(iface);
526 FIXME("(%p)->(%p)\n", This, p);
530 static HRESULT WINAPI HTMLDocument_put_bgColor(IHTMLDocument2 *iface, VARIANT v)
532 HTMLDocument *This = HTMLDOC_THIS(iface);
533 FIXME("(%p)\n", This);
537 static HRESULT WINAPI HTMLDocument_get_bgColor(IHTMLDocument2 *iface, VARIANT *p)
539 HTMLDocument *This = HTMLDOC_THIS(iface);
540 FIXME("(%p)->(%p)\n", This, p);
544 static HRESULT WINAPI HTMLDocument_put_fgColor(IHTMLDocument2 *iface, VARIANT v)
546 HTMLDocument *This = HTMLDOC_THIS(iface);
547 FIXME("(%p)\n", This);
551 static HRESULT WINAPI HTMLDocument_get_fgColor(IHTMLDocument2 *iface, VARIANT *p)
553 HTMLDocument *This = HTMLDOC_THIS(iface);
554 FIXME("(%p)->(%p)\n", This, p);
558 static HRESULT WINAPI HTMLDocument_put_linkColor(IHTMLDocument2 *iface, VARIANT v)
560 HTMLDocument *This = HTMLDOC_THIS(iface);
561 FIXME("(%p)->()\n", This);
565 static HRESULT WINAPI HTMLDocument_get_linkColor(IHTMLDocument2 *iface, VARIANT *p)
567 HTMLDocument *This = HTMLDOC_THIS(iface);
568 FIXME("(%p)->(%p)\n", This, p);
572 static HRESULT WINAPI HTMLDocument_put_vlinkColor(IHTMLDocument2 *iface, VARIANT v)
574 HTMLDocument *This = HTMLDOC_THIS(iface);
575 FIXME("(%p)\n", This);
579 static HRESULT WINAPI HTMLDocument_get_vlinkColor(IHTMLDocument2 *iface, VARIANT *p)
581 HTMLDocument *This = HTMLDOC_THIS(iface);
582 FIXME("(%p)->(%p)\n", This, p);
586 static HRESULT WINAPI HTMLDocument_get_referrer(IHTMLDocument2 *iface, BSTR *p)
588 HTMLDocument *This = HTMLDOC_THIS(iface);
589 FIXME("(%p)->(%p)\n", This, p);
593 static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLocation **p)
595 HTMLDocument *This = HTMLDOC_THIS(iface);
597 TRACE("(%p)->(%p)\n", This, p);
600 IHTMLLocation_AddRef(HTMLLOCATION(This->location));
602 This->location = HTMLLocation_Create(This);
604 *p = HTMLLOCATION(This->location);
608 static HRESULT WINAPI HTMLDocument_get_lastModified(IHTMLDocument2 *iface, BSTR *p)
610 HTMLDocument *This = HTMLDOC_THIS(iface);
611 FIXME("(%p)->(%p)\n", This, p);
615 static HRESULT WINAPI HTMLDocument_put_URL(IHTMLDocument2 *iface, BSTR v)
617 HTMLDocument *This = HTMLDOC_THIS(iface);
618 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
622 static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p)
624 HTMLDocument *This = HTMLDOC_THIS(iface);
626 static const WCHAR about_blank_url[] =
627 {'a','b','o','u','t',':','b','l','a','n','k',0};
629 TRACE("(%p)->(%p)\n", iface, p);
631 *p = SysAllocString(This->url ? This->url : about_blank_url);
635 static HRESULT WINAPI HTMLDocument_put_domain(IHTMLDocument2 *iface, BSTR v)
637 HTMLDocument *This = HTMLDOC_THIS(iface);
638 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
642 static HRESULT WINAPI HTMLDocument_get_domain(IHTMLDocument2 *iface, BSTR *p)
644 HTMLDocument *This = HTMLDOC_THIS(iface);
645 FIXME("(%p)->(%p)\n", This, p);
649 static HRESULT WINAPI HTMLDocument_put_cookie(IHTMLDocument2 *iface, BSTR v)
651 HTMLDocument *This = HTMLDOC_THIS(iface);
652 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
656 static HRESULT WINAPI HTMLDocument_get_cookie(IHTMLDocument2 *iface, BSTR *p)
658 HTMLDocument *This = HTMLDOC_THIS(iface);
659 FIXME("(%p)->(%p)\n", This, p);
663 static HRESULT WINAPI HTMLDocument_put_expando(IHTMLDocument2 *iface, VARIANT_BOOL v)
665 HTMLDocument *This = HTMLDOC_THIS(iface);
666 FIXME("(%p)->(%x)\n", This, v);
670 static HRESULT WINAPI HTMLDocument_get_expando(IHTMLDocument2 *iface, VARIANT_BOOL *p)
672 HTMLDocument *This = HTMLDOC_THIS(iface);
673 FIXME("(%p)->(%p)\n", This, p);
677 static HRESULT WINAPI HTMLDocument_put_charset(IHTMLDocument2 *iface, BSTR v)
679 HTMLDocument *This = HTMLDOC_THIS(iface);
680 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
684 static HRESULT WINAPI HTMLDocument_get_charset(IHTMLDocument2 *iface, BSTR *p)
686 HTMLDocument *This = HTMLDOC_THIS(iface);
687 FIXME("(%p)->(%p)\n", This, p);
691 static HRESULT WINAPI HTMLDocument_put_defaultCharset(IHTMLDocument2 *iface, BSTR v)
693 HTMLDocument *This = HTMLDOC_THIS(iface);
694 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
698 static HRESULT WINAPI HTMLDocument_get_defaultCharset(IHTMLDocument2 *iface, BSTR *p)
700 HTMLDocument *This = HTMLDOC_THIS(iface);
701 FIXME("(%p)->(%p)\n", This, p);
705 static HRESULT WINAPI HTMLDocument_get_mimeType(IHTMLDocument2 *iface, BSTR *p)
707 HTMLDocument *This = HTMLDOC_THIS(iface);
708 FIXME("(%p)->(%p)\n", This, p);
712 static HRESULT WINAPI HTMLDocument_get_fileSize(IHTMLDocument2 *iface, BSTR *p)
714 HTMLDocument *This = HTMLDOC_THIS(iface);
715 FIXME("(%p)->(%p)\n", This, p);
719 static HRESULT WINAPI HTMLDocument_get_fileCreatedDate(IHTMLDocument2 *iface, BSTR *p)
721 HTMLDocument *This = HTMLDOC_THIS(iface);
722 FIXME("(%p)->(%p)\n", This, p);
726 static HRESULT WINAPI HTMLDocument_get_fileModifiedDate(IHTMLDocument2 *iface, BSTR *p)
728 HTMLDocument *This = HTMLDOC_THIS(iface);
729 FIXME("(%p)->(%p)\n", This, p);
733 static HRESULT WINAPI HTMLDocument_get_fileUpdatedDate(IHTMLDocument2 *iface, BSTR *p)
735 HTMLDocument *This = HTMLDOC_THIS(iface);
736 FIXME("(%p)->(%p)\n", This, p);
740 static HRESULT WINAPI HTMLDocument_get_security(IHTMLDocument2 *iface, BSTR *p)
742 HTMLDocument *This = HTMLDOC_THIS(iface);
743 FIXME("(%p)->(%p)\n", This, p);
747 static HRESULT WINAPI HTMLDocument_get_protocol(IHTMLDocument2 *iface, BSTR *p)
749 HTMLDocument *This = HTMLDOC_THIS(iface);
750 FIXME("(%p)->(%p)\n", This, p);
754 static HRESULT WINAPI HTMLDocument_get_nameProp(IHTMLDocument2 *iface, BSTR *p)
756 HTMLDocument *This = HTMLDOC_THIS(iface);
757 FIXME("(%p)->(%p)\n", This, p);
761 static HRESULT WINAPI HTMLDocument_write(IHTMLDocument2 *iface, SAFEARRAY *psarray)
763 HTMLDocument *This = HTMLDOC_THIS(iface);
770 TRACE("(%p)->(%p)\n", iface, psarray);
773 WARN("NULL nsdoc\n");
777 if(psarray->cDims != 1) {
778 FIXME("cDims=%d\n", psarray->cDims);
782 hres = SafeArrayAccessData(psarray, (void**)&var);
784 WARN("SafeArrayAccessData failed: %08x\n", hres);
788 nsAString_Init(&nsstr, NULL);
790 for(i=0; i < psarray->rgsabound[0].cElements; i++) {
791 if(V_VT(var+i) == VT_BSTR) {
792 nsAString_SetData(&nsstr, V_BSTR(var+i));
793 nsres = nsIDOMHTMLDocument_Write(This->nsdoc, &nsstr);
795 ERR("Write failed: %08x\n", nsres);
797 FIXME("vt=%d\n", V_VT(var+i));
801 nsAString_Finish(&nsstr);
802 SafeArrayUnaccessData(psarray);
807 static HRESULT WINAPI HTMLDocument_writeln(IHTMLDocument2 *iface, SAFEARRAY *psarray)
809 HTMLDocument *This = HTMLDOC_THIS(iface);
810 FIXME("(%p)->(%p)\n", This, psarray);
814 static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT name,
815 VARIANT features, VARIANT replace, IDispatch **pomWindowResult)
817 HTMLDocument *This = HTMLDOC_THIS(iface);
818 FIXME("(%p)->(%s %p)\n", This, debugstr_w(url), pomWindowResult);
822 static HRESULT WINAPI HTMLDocument_close(IHTMLDocument2 *iface)
824 HTMLDocument *This = HTMLDOC_THIS(iface);
825 FIXME("(%p)\n", This);
829 static HRESULT WINAPI HTMLDocument_clear(IHTMLDocument2 *iface)
831 HTMLDocument *This = HTMLDOC_THIS(iface);
832 FIXME("(%p)\n", This);
836 static HRESULT WINAPI HTMLDocument_queryCommandSupported(IHTMLDocument2 *iface, BSTR cmdID,
839 HTMLDocument *This = HTMLDOC_THIS(iface);
840 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
844 static HRESULT WINAPI HTMLDocument_queryCommandEnabled(IHTMLDocument2 *iface, BSTR cmdID,
847 HTMLDocument *This = HTMLDOC_THIS(iface);
848 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
852 static HRESULT WINAPI HTMLDocument_queryCommandState(IHTMLDocument2 *iface, BSTR cmdID,
855 HTMLDocument *This = HTMLDOC_THIS(iface);
856 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
860 static HRESULT WINAPI HTMLDocument_queryCommandIndeterm(IHTMLDocument2 *iface, BSTR cmdID,
863 HTMLDocument *This = HTMLDOC_THIS(iface);
864 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
868 static HRESULT WINAPI HTMLDocument_queryCommandText(IHTMLDocument2 *iface, BSTR cmdID,
871 HTMLDocument *This = HTMLDOC_THIS(iface);
872 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
876 static HRESULT WINAPI HTMLDocument_queryCommandValue(IHTMLDocument2 *iface, BSTR cmdID,
879 HTMLDocument *This = HTMLDOC_THIS(iface);
880 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
884 static HRESULT WINAPI HTMLDocument_execCommand(IHTMLDocument2 *iface, BSTR cmdID,
885 VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL *pfRet)
887 HTMLDocument *This = HTMLDOC_THIS(iface);
888 FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(cmdID), showUI, pfRet);
892 static HRESULT WINAPI HTMLDocument_execCommandShowHelp(IHTMLDocument2 *iface, BSTR cmdID,
895 HTMLDocument *This = HTMLDOC_THIS(iface);
896 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
900 static HRESULT WINAPI HTMLDocument_createElement(IHTMLDocument2 *iface, BSTR eTag,
901 IHTMLElement **newElem)
903 HTMLDocument *This = HTMLDOC_THIS(iface);
904 nsIDOMElement *nselem;
909 TRACE("(%p)->(%s %p)\n", This, debugstr_w(eTag), newElem);
912 WARN("NULL nsdoc\n");
916 nsAString_Init(&tag_str, eTag);
917 nsres = nsIDOMDocument_CreateElement(This->nsdoc, &tag_str, &nselem);
918 nsAString_Finish(&tag_str);
919 if(NS_FAILED(nsres)) {
920 ERR("CreateElement failed: %08x\n", nsres);
924 elem = HTMLElement_Create(This, (nsIDOMNode*)nselem, TRUE);
925 nsIDOMElement_Release(nselem);
927 *newElem = HTMLELEM(elem);
928 IHTMLElement_AddRef(HTMLELEM(elem));
932 static HRESULT WINAPI HTMLDocument_put_onhelp(IHTMLDocument2 *iface, VARIANT v)
934 HTMLDocument *This = HTMLDOC_THIS(iface);
935 FIXME("(%p)\n", This);
939 static HRESULT WINAPI HTMLDocument_get_onhelp(IHTMLDocument2 *iface, VARIANT *p)
941 HTMLDocument *This = HTMLDOC_THIS(iface);
942 FIXME("(%p)->(%p)\n", This, p);
946 static HRESULT WINAPI HTMLDocument_put_onclick(IHTMLDocument2 *iface, VARIANT v)
948 HTMLDocument *This = HTMLDOC_THIS(iface);
949 FIXME("(%p)\n", This);
953 static HRESULT WINAPI HTMLDocument_get_onclick(IHTMLDocument2 *iface, VARIANT *p)
955 HTMLDocument *This = HTMLDOC_THIS(iface);
956 FIXME("(%p)->(%p)\n", This, p);
960 static HRESULT WINAPI HTMLDocument_put_ondblclick(IHTMLDocument2 *iface, VARIANT v)
962 HTMLDocument *This = HTMLDOC_THIS(iface);
963 FIXME("(%p)\n", This);
967 static HRESULT WINAPI HTMLDocument_get_ondblclick(IHTMLDocument2 *iface, VARIANT *p)
969 HTMLDocument *This = HTMLDOC_THIS(iface);
970 FIXME("(%p)->(%p)\n", This, p);
974 static HRESULT WINAPI HTMLDocument_put_onkeyup(IHTMLDocument2 *iface, VARIANT v)
976 HTMLDocument *This = HTMLDOC_THIS(iface);
977 FIXME("(%p)\n", This);
981 static HRESULT WINAPI HTMLDocument_get_onkeyup(IHTMLDocument2 *iface, VARIANT *p)
983 HTMLDocument *This = HTMLDOC_THIS(iface);
984 FIXME("(%p)->(%p)\n", This, p);
988 static HRESULT WINAPI HTMLDocument_put_onkeydown(IHTMLDocument2 *iface, VARIANT v)
990 HTMLDocument *This = HTMLDOC_THIS(iface);
991 FIXME("(%p)\n", This);
995 static HRESULT WINAPI HTMLDocument_get_onkeydown(IHTMLDocument2 *iface, VARIANT *p)
997 HTMLDocument *This = HTMLDOC_THIS(iface);
998 FIXME("(%p)->(%p)\n", This, p);
1002 static HRESULT WINAPI HTMLDocument_put_onkeypress(IHTMLDocument2 *iface, VARIANT v)
1004 HTMLDocument *This = HTMLDOC_THIS(iface);
1005 FIXME("(%p)\n", This);
1009 static HRESULT WINAPI HTMLDocument_get_onkeypress(IHTMLDocument2 *iface, VARIANT *p)
1011 HTMLDocument *This = HTMLDOC_THIS(iface);
1012 FIXME("(%p)->(%p)\n", This, p);
1016 static HRESULT WINAPI HTMLDocument_put_onmouseup(IHTMLDocument2 *iface, VARIANT v)
1018 HTMLDocument *This = HTMLDOC_THIS(iface);
1019 FIXME("(%p)\n", This);
1023 static HRESULT WINAPI HTMLDocument_get_onmouseup(IHTMLDocument2 *iface, VARIANT *p)
1025 HTMLDocument *This = HTMLDOC_THIS(iface);
1026 FIXME("(%p)->(%p)\n", This, p);
1030 static HRESULT WINAPI HTMLDocument_put_onmousedown(IHTMLDocument2 *iface, VARIANT v)
1032 HTMLDocument *This = HTMLDOC_THIS(iface);
1033 FIXME("(%p)\n", This);
1037 static HRESULT WINAPI HTMLDocument_get_onmousedown(IHTMLDocument2 *iface, VARIANT *p)
1039 HTMLDocument *This = HTMLDOC_THIS(iface);
1040 FIXME("(%p)->(%p)\n", This, p);
1044 static HRESULT WINAPI HTMLDocument_put_onmousemove(IHTMLDocument2 *iface, VARIANT v)
1046 HTMLDocument *This = HTMLDOC_THIS(iface);
1047 FIXME("(%p)\n", This);
1051 static HRESULT WINAPI HTMLDocument_get_onmousemove(IHTMLDocument2 *iface, VARIANT *p)
1053 HTMLDocument *This = HTMLDOC_THIS(iface);
1054 FIXME("(%p)->(%p)\n", This, p);
1058 static HRESULT WINAPI HTMLDocument_put_onmouseout(IHTMLDocument2 *iface, VARIANT v)
1060 HTMLDocument *This = HTMLDOC_THIS(iface);
1061 FIXME("(%p)\n", This);
1065 static HRESULT WINAPI HTMLDocument_get_onmouseout(IHTMLDocument2 *iface, VARIANT *p)
1067 HTMLDocument *This = HTMLDOC_THIS(iface);
1068 FIXME("(%p)->(%p)\n", This, p);
1072 static HRESULT WINAPI HTMLDocument_put_onmouseover(IHTMLDocument2 *iface, VARIANT v)
1074 HTMLDocument *This = HTMLDOC_THIS(iface);
1076 TRACE("(%p)\n", This);
1078 return set_doc_event(This, EVENTID_MOUSEOVER, &v);
1081 static HRESULT WINAPI HTMLDocument_get_onmouseover(IHTMLDocument2 *iface, VARIANT *p)
1083 HTMLDocument *This = HTMLDOC_THIS(iface);
1085 TRACE("(%p)->(%p)\n", This, p);
1087 return get_doc_event(This, EVENTID_MOUSEOVER, p);
1090 static HRESULT WINAPI HTMLDocument_put_onreadystatechange(IHTMLDocument2 *iface, VARIANT v)
1092 HTMLDocument *This = HTMLDOC_THIS(iface);
1093 FIXME("(%p)\n", This);
1097 static HRESULT WINAPI HTMLDocument_get_onreadystatechange(IHTMLDocument2 *iface, VARIANT *p)
1099 HTMLDocument *This = HTMLDOC_THIS(iface);
1100 FIXME("(%p)->(%p)\n", This, p);
1104 static HRESULT WINAPI HTMLDocument_put_onafterupdate(IHTMLDocument2 *iface, VARIANT v)
1106 HTMLDocument *This = HTMLDOC_THIS(iface);
1107 FIXME("(%p)\n", This);
1111 static HRESULT WINAPI HTMLDocument_get_onafterupdate(IHTMLDocument2 *iface, VARIANT *p)
1113 HTMLDocument *This = HTMLDOC_THIS(iface);
1114 FIXME("(%p)->(%p)\n", This, p);
1118 static HRESULT WINAPI HTMLDocument_put_onrowexit(IHTMLDocument2 *iface, VARIANT v)
1120 HTMLDocument *This = HTMLDOC_THIS(iface);
1121 FIXME("(%p)\n", This);
1125 static HRESULT WINAPI HTMLDocument_get_onrowexit(IHTMLDocument2 *iface, VARIANT *p)
1127 HTMLDocument *This = HTMLDOC_THIS(iface);
1128 FIXME("(%p)->(%p)\n", This, p);
1132 static HRESULT WINAPI HTMLDocument_put_onrowenter(IHTMLDocument2 *iface, VARIANT v)
1134 HTMLDocument *This = HTMLDOC_THIS(iface);
1135 FIXME("(%p)\n", This);
1139 static HRESULT WINAPI HTMLDocument_get_onrowenter(IHTMLDocument2 *iface, VARIANT *p)
1141 HTMLDocument *This = HTMLDOC_THIS(iface);
1142 FIXME("(%p)->(%p)\n", This, p);
1146 static HRESULT WINAPI HTMLDocument_put_ondragstart(IHTMLDocument2 *iface, VARIANT v)
1148 HTMLDocument *This = HTMLDOC_THIS(iface);
1149 FIXME("(%p)\n", This);
1153 static HRESULT WINAPI HTMLDocument_get_ondragstart(IHTMLDocument2 *iface, VARIANT *p)
1155 HTMLDocument *This = HTMLDOC_THIS(iface);
1156 FIXME("(%p)->(%p)\n", This, p);
1160 static HRESULT WINAPI HTMLDocument_put_onselectstart(IHTMLDocument2 *iface, VARIANT v)
1162 HTMLDocument *This = HTMLDOC_THIS(iface);
1163 FIXME("(%p)\n", This);
1167 static HRESULT WINAPI HTMLDocument_get_onselectstart(IHTMLDocument2 *iface, VARIANT *p)
1169 HTMLDocument *This = HTMLDOC_THIS(iface);
1170 FIXME("(%p)->(%p)\n", This, p);
1174 static HRESULT WINAPI HTMLDocument_elementFromPoint(IHTMLDocument2 *iface, long x, long y,
1175 IHTMLElement **elementHit)
1177 HTMLDocument *This = HTMLDOC_THIS(iface);
1178 FIXME("(%p)->(%ld %ld %p)\n", This, x, y, elementHit);
1182 static HRESULT WINAPI HTMLDocument_get_parentWindow(IHTMLDocument2 *iface, IHTMLWindow2 **p)
1184 HTMLDocument *This = HTMLDOC_THIS(iface);
1186 TRACE("(%p)->(%p)\n", This, p);
1188 *p = HTMLWINDOW2(This->window);
1189 IHTMLWindow2_AddRef(*p);
1193 static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface,
1194 IHTMLStyleSheetsCollection **p)
1196 HTMLDocument *This = HTMLDOC_THIS(iface);
1197 nsIDOMStyleSheetList *nsstylelist;
1198 nsIDOMDocumentStyle *nsdocstyle;
1201 TRACE("(%p)->(%p)\n", This, p);
1206 WARN("NULL nsdoc\n");
1207 return E_UNEXPECTED;
1210 nsIDOMHTMLDocument_QueryInterface(This->nsdoc, &IID_nsIDOMDocumentStyle, (void**)&nsdocstyle);
1211 nsres = nsIDOMDocumentStyle_GetStyleSheets(nsdocstyle, &nsstylelist);
1212 nsIDOMDocumentStyle_Release(nsdocstyle);
1213 if(NS_FAILED(nsres)) {
1214 ERR("GetStyleSheets failed: %08x\n", nsres);
1218 *p = HTMLStyleSheetsCollection_Create(nsstylelist);
1219 nsIDOMDocumentStyle_Release(nsstylelist);
1224 static HRESULT WINAPI HTMLDocument_put_onbeforeupdate(IHTMLDocument2 *iface, VARIANT v)
1226 HTMLDocument *This = HTMLDOC_THIS(iface);
1227 FIXME("(%p)\n", This);
1231 static HRESULT WINAPI HTMLDocument_get_onbeforeupdate(IHTMLDocument2 *iface, VARIANT *p)
1233 HTMLDocument *This = HTMLDOC_THIS(iface);
1234 FIXME("(%p)->(%p)\n", This, p);
1238 static HRESULT WINAPI HTMLDocument_put_onerrorupdate(IHTMLDocument2 *iface, VARIANT v)
1240 HTMLDocument *This = HTMLDOC_THIS(iface);
1241 FIXME("(%p)\n", This);
1245 static HRESULT WINAPI HTMLDocument_get_onerrorupdate(IHTMLDocument2 *iface, VARIANT *p)
1247 HTMLDocument *This = HTMLDOC_THIS(iface);
1248 FIXME("(%p)->(%p)\n", This, p);
1252 static HRESULT WINAPI HTMLDocument_toString(IHTMLDocument2 *iface, BSTR *String)
1254 HTMLDocument *This = HTMLDOC_THIS(iface);
1255 FIXME("(%p)->(%p)\n", This, String);
1259 static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR bstrHref,
1260 long lIndex, IHTMLStyleSheet **ppnewStyleSheet)
1262 HTMLDocument *This = HTMLDOC_THIS(iface);
1264 FIXME("(%p)->(%s %ld %p) semi-stub\n", This, debugstr_w(bstrHref), lIndex, ppnewStyleSheet);
1266 *ppnewStyleSheet = HTMLStyleSheet_Create(NULL);
1270 static const IHTMLDocument2Vtbl HTMLDocumentVtbl = {
1271 HTMLDocument_QueryInterface,
1272 HTMLDocument_AddRef,
1273 HTMLDocument_Release,
1274 HTMLDocument_GetTypeInfoCount,
1275 HTMLDocument_GetTypeInfo,
1276 HTMLDocument_GetIDsOfNames,
1277 HTMLDocument_Invoke,
1278 HTMLDocument_get_Script,
1279 HTMLDocument_get_all,
1280 HTMLDocument_get_body,
1281 HTMLDocument_get_activeElement,
1282 HTMLDocument_get_images,
1283 HTMLDocument_get_applets,
1284 HTMLDocument_get_links,
1285 HTMLDocument_get_forms,
1286 HTMLDocument_get_anchors,
1287 HTMLDocument_put_title,
1288 HTMLDocument_get_title,
1289 HTMLDocument_get_scripts,
1290 HTMLDocument_put_designMode,
1291 HTMLDocument_get_designMode,
1292 HTMLDocument_get_selection,
1293 HTMLDocument_get_readyState,
1294 HTMLDocument_get_frames,
1295 HTMLDocument_get_embeds,
1296 HTMLDocument_get_plugins,
1297 HTMLDocument_put_alinkColor,
1298 HTMLDocument_get_alinkColor,
1299 HTMLDocument_put_bgColor,
1300 HTMLDocument_get_bgColor,
1301 HTMLDocument_put_fgColor,
1302 HTMLDocument_get_fgColor,
1303 HTMLDocument_put_linkColor,
1304 HTMLDocument_get_linkColor,
1305 HTMLDocument_put_vlinkColor,
1306 HTMLDocument_get_vlinkColor,
1307 HTMLDocument_get_referrer,
1308 HTMLDocument_get_location,
1309 HTMLDocument_get_lastModified,
1310 HTMLDocument_put_URL,
1311 HTMLDocument_get_URL,
1312 HTMLDocument_put_domain,
1313 HTMLDocument_get_domain,
1314 HTMLDocument_put_cookie,
1315 HTMLDocument_get_cookie,
1316 HTMLDocument_put_expando,
1317 HTMLDocument_get_expando,
1318 HTMLDocument_put_charset,
1319 HTMLDocument_get_charset,
1320 HTMLDocument_put_defaultCharset,
1321 HTMLDocument_get_defaultCharset,
1322 HTMLDocument_get_mimeType,
1323 HTMLDocument_get_fileSize,
1324 HTMLDocument_get_fileCreatedDate,
1325 HTMLDocument_get_fileModifiedDate,
1326 HTMLDocument_get_fileUpdatedDate,
1327 HTMLDocument_get_security,
1328 HTMLDocument_get_protocol,
1329 HTMLDocument_get_nameProp,
1331 HTMLDocument_writeln,
1335 HTMLDocument_queryCommandSupported,
1336 HTMLDocument_queryCommandEnabled,
1337 HTMLDocument_queryCommandState,
1338 HTMLDocument_queryCommandIndeterm,
1339 HTMLDocument_queryCommandText,
1340 HTMLDocument_queryCommandValue,
1341 HTMLDocument_execCommand,
1342 HTMLDocument_execCommandShowHelp,
1343 HTMLDocument_createElement,
1344 HTMLDocument_put_onhelp,
1345 HTMLDocument_get_onhelp,
1346 HTMLDocument_put_onclick,
1347 HTMLDocument_get_onclick,
1348 HTMLDocument_put_ondblclick,
1349 HTMLDocument_get_ondblclick,
1350 HTMLDocument_put_onkeyup,
1351 HTMLDocument_get_onkeyup,
1352 HTMLDocument_put_onkeydown,
1353 HTMLDocument_get_onkeydown,
1354 HTMLDocument_put_onkeypress,
1355 HTMLDocument_get_onkeypress,
1356 HTMLDocument_put_onmouseup,
1357 HTMLDocument_get_onmouseup,
1358 HTMLDocument_put_onmousedown,
1359 HTMLDocument_get_onmousedown,
1360 HTMLDocument_put_onmousemove,
1361 HTMLDocument_get_onmousemove,
1362 HTMLDocument_put_onmouseout,
1363 HTMLDocument_get_onmouseout,
1364 HTMLDocument_put_onmouseover,
1365 HTMLDocument_get_onmouseover,
1366 HTMLDocument_put_onreadystatechange,
1367 HTMLDocument_get_onreadystatechange,
1368 HTMLDocument_put_onafterupdate,
1369 HTMLDocument_get_onafterupdate,
1370 HTMLDocument_put_onrowexit,
1371 HTMLDocument_get_onrowexit,
1372 HTMLDocument_put_onrowenter,
1373 HTMLDocument_get_onrowenter,
1374 HTMLDocument_put_ondragstart,
1375 HTMLDocument_get_ondragstart,
1376 HTMLDocument_put_onselectstart,
1377 HTMLDocument_get_onselectstart,
1378 HTMLDocument_elementFromPoint,
1379 HTMLDocument_get_parentWindow,
1380 HTMLDocument_get_styleSheets,
1381 HTMLDocument_put_onbeforeupdate,
1382 HTMLDocument_get_onbeforeupdate,
1383 HTMLDocument_put_onerrorupdate,
1384 HTMLDocument_get_onerrorupdate,
1385 HTMLDocument_toString,
1386 HTMLDocument_createStyleSheet
1389 #define DISPEX_THIS(iface) DEFINE_THIS(HTMLDocument, IDispatchEx, iface)
1391 static HRESULT WINAPI DocDispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
1393 HTMLDocument *This = DISPEX_THIS(iface);
1395 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
1398 static ULONG WINAPI DocDispatchEx_AddRef(IDispatchEx *iface)
1400 HTMLDocument *This = DISPEX_THIS(iface);
1402 return IHTMLDocument2_AddRef(HTMLDOC(This));
1405 static ULONG WINAPI DocDispatchEx_Release(IDispatchEx *iface)
1407 HTMLDocument *This = DISPEX_THIS(iface);
1409 return IHTMLDocument2_Release(HTMLDOC(This));
1412 static HRESULT WINAPI DocDispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
1414 HTMLDocument *This = DISPEX_THIS(iface);
1416 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo);
1419 static HRESULT WINAPI DocDispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
1420 LCID lcid, ITypeInfo **ppTInfo)
1422 HTMLDocument *This = DISPEX_THIS(iface);
1424 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
1427 static HRESULT WINAPI DocDispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
1428 LPOLESTR *rgszNames, UINT cNames,
1429 LCID lcid, DISPID *rgDispId)
1431 HTMLDocument *This = DISPEX_THIS(iface);
1433 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
1436 static HRESULT WINAPI DocDispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
1437 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1438 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1440 HTMLDocument *This = DISPEX_THIS(iface);
1442 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
1443 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1445 switch(dispIdMember) {
1446 case DISPID_READYSTATE:
1447 TRACE("DISPID_READYSTATE\n");
1449 if(!(wFlags & DISPATCH_PROPERTYGET))
1450 return E_INVALIDARG;
1452 V_VT(pVarResult) = VT_I4;
1453 V_I4(pVarResult) = This->readystate;
1457 return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
1458 pVarResult, pExcepInfo, puArgErr);
1461 static HRESULT WINAPI DocDispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
1463 HTMLDocument *This = DISPEX_THIS(iface);
1465 return IDispatchEx_GetDispID(DISPATCHEX(&This->dispex), bstrName, grfdex, pid);
1468 static HRESULT WINAPI DocDispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
1469 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
1471 HTMLDocument *This = DISPEX_THIS(iface);
1473 return IDispatchEx_InvokeEx(DISPATCHEX(&This->dispex), id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
1476 static HRESULT WINAPI DocDispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
1478 HTMLDocument *This = DISPEX_THIS(iface);
1480 return IDispatchEx_DeleteMemberByName(DISPATCHEX(&This->dispex), bstrName, grfdex);
1483 static HRESULT WINAPI DocDispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
1485 HTMLDocument *This = DISPEX_THIS(iface);
1487 return IDispatchEx_DeleteMemberByDispID(DISPATCHEX(&This->dispex), id);
1490 static HRESULT WINAPI DocDispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
1492 HTMLDocument *This = DISPEX_THIS(iface);
1494 return IDispatchEx_GetMemberProperties(DISPATCHEX(&This->dispex), id, grfdexFetch, pgrfdex);
1497 static HRESULT WINAPI DocDispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
1499 HTMLDocument *This = DISPEX_THIS(iface);
1501 return IDispatchEx_GetMemberName(DISPATCHEX(&This->dispex), id, pbstrName);
1504 static HRESULT WINAPI DocDispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
1506 HTMLDocument *This = DISPEX_THIS(iface);
1508 return IDispatchEx_GetNextDispID(DISPATCHEX(&This->dispex), grfdex, id, pid);
1511 static HRESULT WINAPI DocDispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
1513 HTMLDocument *This = DISPEX_THIS(iface);
1515 return IDispatchEx_GetNameSpaceParent(DISPATCHEX(&This->dispex), ppunk);
1520 static const IDispatchExVtbl DocDispatchExVtbl = {
1521 DocDispatchEx_QueryInterface,
1522 DocDispatchEx_AddRef,
1523 DocDispatchEx_Release,
1524 DocDispatchEx_GetTypeInfoCount,
1525 DocDispatchEx_GetTypeInfo,
1526 DocDispatchEx_GetIDsOfNames,
1527 DocDispatchEx_Invoke,
1528 DocDispatchEx_GetDispID,
1529 DocDispatchEx_InvokeEx,
1530 DocDispatchEx_DeleteMemberByName,
1531 DocDispatchEx_DeleteMemberByDispID,
1532 DocDispatchEx_GetMemberProperties,
1533 DocDispatchEx_GetMemberName,
1534 DocDispatchEx_GetNextDispID,
1535 DocDispatchEx_GetNameSpaceParent
1538 static const tid_t HTMLDocument_iface_tids[] = {
1545 static dispex_static_data_t HTMLDocument_dispex = {
1547 DispHTMLDocument_tid,
1549 HTMLDocument_iface_tids
1552 HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
1554 nsIDOMWindow *nswindow;
1558 TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppvObject);
1560 ret = heap_alloc_zero(sizeof(HTMLDocument));
1561 ret->lpHTMLDocument2Vtbl = &HTMLDocumentVtbl;
1562 ret->lpIDispatchExVtbl = &DocDispatchExVtbl;
1564 ret->readystate = READYSTATE_UNINITIALIZED;
1565 ret->scriptmode = SCRIPTMODE_GECKO;
1567 list_init(&ret->bindings);
1568 list_init(&ret->script_hosts);
1569 list_init(&ret->selection_list);
1570 list_init(&ret->range_list);
1572 hres = IHTMLDocument_QueryInterface(HTMLDOC(ret), riid, ppvObject);
1580 HTMLDocument_HTMLDocument3_Init(ret);
1581 HTMLDocument_HTMLDocument5_Init(ret);
1582 HTMLDocument_Persist_Init(ret);
1583 HTMLDocument_OleCmd_Init(ret);
1584 HTMLDocument_OleObj_Init(ret);
1585 HTMLDocument_View_Init(ret);
1586 HTMLDocument_Window_Init(ret);
1587 HTMLDocument_Service_Init(ret);
1588 HTMLDocument_Hlink_Init(ret);
1590 ConnectionPointContainer_Init(&ret->cp_container, (IUnknown*)HTMLDOC(ret));
1591 ConnectionPoint_Init(&ret->cp_propnotif, &ret->cp_container, &IID_IPropertyNotifySink);
1592 ConnectionPoint_Init(&ret->cp_htmldocevents, &ret->cp_container, &DIID_HTMLDocumentEvents);
1593 ConnectionPoint_Init(&ret->cp_htmldocevents2, &ret->cp_container, &DIID_HTMLDocumentEvents2);
1595 init_dispex(&ret->dispex, (IUnknown*)HTMLDOC(ret), &HTMLDocument_dispex);
1597 ret->nscontainer = NSContainer_Create(ret, NULL);
1598 update_nsdocument(ret);
1600 if(ret->nscontainer)
1601 nsIWebBrowser_GetContentDOMWindow(ret->nscontainer->webbrowser, &nswindow);
1603 HTMLWindow_Create(ret, nswindow, &ret->window);
1605 nsIDOMWindow_Release(nswindow);