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"
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
37 #define HTMLDOC_THIS(iface) DEFINE_THIS(HTMLDocument, HTMLDocument2, iface)
39 static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID riid, void **ppvObject)
41 HTMLDocument *This = HTMLDOC_THIS(iface);
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 = DISPATCHEX(This);
50 }else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
51 TRACE("(%p)->(IID_IDispatchEx, %p)\n", This, ppvObject);
52 *ppvObject = DISPATCHEX(This);
53 }else if(IsEqualGUID(&IID_IHTMLDocument, riid)) {
54 TRACE("(%p)->(IID_IHTMLDocument, %p)\n", This, ppvObject);
55 *ppvObject = HTMLDOC(This);
56 }else if(IsEqualGUID(&IID_IHTMLDocument2, riid)) {
57 TRACE("(%p)->(IID_IHTMLDocument2, %p)\n", This, ppvObject);
58 *ppvObject = HTMLDOC(This);
59 }else if(IsEqualGUID(&IID_IHTMLDocument3, riid)) {
60 TRACE("(%p)->(IID_IHTMLDocument3, %p)\n", This, ppvObject);
61 *ppvObject = HTMLDOC3(This);
62 }else if(IsEqualGUID(&IID_IHTMLDocument4, riid)) {
63 TRACE("(%p)->(IID_IHTMLDocument4, %p)\n", This, ppvObject);
64 *ppvObject = HTMLDOC4(This);
65 }else if(IsEqualGUID(&IID_IHTMLDocument5, riid)) {
66 TRACE("(%p)->(IID_IHTMLDocument5, %p)\n", This, ppvObject);
67 *ppvObject = HTMLDOC5(This);
68 }else if(IsEqualGUID(&IID_IPersist, riid)) {
69 TRACE("(%p)->(IID_IPersist, %p)\n", This, ppvObject);
70 *ppvObject = PERSIST(This);
71 }else if(IsEqualGUID(&IID_IPersistMoniker, riid)) {
72 TRACE("(%p)->(IID_IPersistMoniker, %p)\n", This, ppvObject);
73 *ppvObject = PERSISTMON(This);
74 }else if(IsEqualGUID(&IID_IPersistFile, riid)) {
75 TRACE("(%p)->(IID_IPersistFile, %p)\n", This, ppvObject);
76 *ppvObject = PERSISTFILE(This);
77 }else if(IsEqualGUID(&IID_IMonikerProp, riid)) {
78 TRACE("(%p)->(IID_IMonikerProp, %p)\n", This, ppvObject);
79 *ppvObject = MONPROP(This);
80 }else if(IsEqualGUID(&IID_IOleObject, riid)) {
81 TRACE("(%p)->(IID_IOleObject, %p)\n", This, ppvObject);
82 *ppvObject = OLEOBJ(This);
83 }else if(IsEqualGUID(&IID_IOleDocument, riid)) {
84 TRACE("(%p)->(IID_IOleDocument, %p)\n", This, ppvObject);
85 *ppvObject = OLEDOC(This);
86 }else if(IsEqualGUID(&IID_IOleDocumentView, riid)) {
87 TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This, ppvObject);
88 *ppvObject = DOCVIEW(This);
89 }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
90 TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This, ppvObject);
91 *ppvObject = ACTOBJ(This);
92 }else if(IsEqualGUID(&IID_IViewObject, riid)) {
93 TRACE("(%p)->(IID_IViewObject, %p)\n", This, ppvObject);
94 *ppvObject = VIEWOBJ(This);
95 }else if(IsEqualGUID(&IID_IViewObject2, riid)) {
96 TRACE("(%p)->(IID_IViewObject2, %p)\n", This, ppvObject);
97 *ppvObject = VIEWOBJ2(This);
98 }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
99 TRACE("(%p)->(IID_IOleWindow, %p)\n", This, ppvObject);
100 *ppvObject = OLEWIN(This);
101 }else if(IsEqualGUID(&IID_IOleInPlaceObject, riid)) {
102 TRACE("(%p)->(IID_IOleInPlaceObject, %p)\n", This, ppvObject);
103 *ppvObject = INPLACEOBJ(This);
104 }else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless, riid)) {
105 TRACE("(%p)->(IID_IOleInPlaceObjectWindowless, %p)\n", This, ppvObject);
106 *ppvObject = INPLACEWIN(This);
107 }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
108 TRACE("(%p)->(IID_IServiceProvider, %p)\n", This, ppvObject);
109 *ppvObject = SERVPROV(This);
110 }else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
111 TRACE("(%p)->(IID_IOleCommandTarget, %p)\n", This, ppvObject);
112 *ppvObject = CMDTARGET(This);
113 }else if(IsEqualGUID(&IID_IOleControl, riid)) {
114 TRACE("(%p)->(IID_IOleControl, %p)\n", This, ppvObject);
115 *ppvObject = CONTROL(This);
116 }else if(IsEqualGUID(&IID_IHlinkTarget, riid)) {
117 TRACE("(%p)->(IID_IHlinkTarget, %p)\n", This, ppvObject);
118 *ppvObject = HLNKTARGET(This);
119 }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
120 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppvObject);
121 *ppvObject = CONPTCONT(&This->cp_container);
122 }else if(IsEqualGUID(&IID_IPersistStreamInit, riid)) {
123 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppvObject);
124 *ppvObject = PERSTRINIT(This);
125 }else if(IsEqualGUID(&IID_ICustomDoc, riid)) {
126 TRACE("(%p)->(IID_ICustomDoc %p)\n", This, ppvObject);
127 *ppvObject = CUSTOMDOC(This);
128 }else if(IsEqualGUID(&DIID_DispHTMLDocument, riid)) {
129 TRACE("(%p)->(DIID_DispHTMLDocument %p)\n", This, ppvObject);
130 *ppvObject = HTMLDOC(This);
131 }else if(IsEqualGUID(&CLSID_CMarkup, riid)) {
132 FIXME("(%p)->(CLSID_CMarkup %p)\n", This, ppvObject);
133 return E_NOINTERFACE;
134 }else if(IsEqualGUID(&IID_IRunnableObject, riid)) {
135 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This, ppvObject);
136 return E_NOINTERFACE;
137 }else if(IsEqualGUID(&IID_IPersistPropertyBag, riid)) {
138 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This, ppvObject);
139 return E_NOINTERFACE;
140 }else if(dispex_query_interface(&This->dispex, riid, ppvObject)) {
141 return *ppvObject ? S_OK : E_NOINTERFACE;
145 IHTMLDocument2_AddRef(iface);
149 FIXME("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppvObject);
150 return E_NOINTERFACE;
153 static ULONG WINAPI HTMLDocument_AddRef(IHTMLDocument2 *iface)
155 HTMLDocument *This = HTMLDOC_THIS(iface);
156 ULONG ref = InterlockedIncrement(&This->ref);
157 TRACE("(%p) ref = %u\n", This, ref);
161 static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
163 HTMLDocument *This = HTMLDOC_THIS(iface);
164 ULONG ref = InterlockedDecrement(&This->ref);
166 TRACE("(%p) ref = %u\n", This, ref);
169 remove_doc_tasks(This);
170 release_script_hosts(This);
173 IOleObject_SetClientSite(OLEOBJ(This), NULL);
174 if(This->in_place_active)
175 IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(This));
177 IOleDocumentView_SetInPlaceSite(DOCVIEW(This), NULL);
179 IOleUndoManager_Release(This->undomgr);
181 set_document_bscallback(This, NULL);
182 set_current_mon(This, NULL);
184 if(This->tooltips_hwnd)
185 DestroyWindow(This->tooltips_hwnd);
187 DestroyWindow(This->hwnd);
189 if(This->option_factory) {
190 This->option_factory->doc = NULL;
191 IHTMLOptionElementFactory_Release(HTMLOPTFACTORY(This->option_factory));
195 This->location->doc = NULL;
198 IHTMLWindow2_Release(HTMLWINDOW2(This->window));
200 heap_free(This->mime);
201 detach_selection(This);
205 ConnectionPointContainer_Destroy(&This->cp_container);
207 if(This->nscontainer)
208 NSContainer_Release(This->nscontainer);
218 static HRESULT WINAPI HTMLDocument_GetTypeInfoCount(IHTMLDocument2 *iface, UINT *pctinfo)
220 HTMLDocument *This = HTMLDOC_THIS(iface);
222 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo);
225 static HRESULT WINAPI HTMLDocument_GetTypeInfo(IHTMLDocument2 *iface, UINT iTInfo,
226 LCID lcid, ITypeInfo **ppTInfo)
228 HTMLDocument *This = HTMLDOC_THIS(iface);
230 return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo);
233 static HRESULT WINAPI HTMLDocument_GetIDsOfNames(IHTMLDocument2 *iface, REFIID riid,
234 LPOLESTR *rgszNames, UINT cNames,
235 LCID lcid, DISPID *rgDispId)
237 HTMLDocument *This = HTMLDOC_THIS(iface);
239 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId);
242 static HRESULT WINAPI HTMLDocument_Invoke(IHTMLDocument2 *iface, DISPID dispIdMember,
243 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
244 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
246 HTMLDocument *This = HTMLDOC_THIS(iface);
248 return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams,
249 pVarResult, pExcepInfo, puArgErr);
252 static HRESULT WINAPI HTMLDocument_get_Script(IHTMLDocument2 *iface, IDispatch **p)
254 HTMLDocument *This = HTMLDOC_THIS(iface);
256 TRACE("(%p)->(%p)\n", This, p);
258 *p = (IDispatch*)HTMLWINDOW2(This->window);
259 IDispatch_AddRef(*p);
263 static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCollection **p)
265 HTMLDocument *This = HTMLDOC_THIS(iface);
266 nsIDOMDocument *nsdoc = NULL;
267 nsIDOMElement *nselem = NULL;
270 TRACE("(%p)->(%p)\n", This, p);
272 if(!This->nscontainer) {
277 nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
279 ERR("GetDocument failed: %08x\n", nsres);
282 nsres = nsIDOMHTMLDocument_GetDocumentElement(nsdoc, &nselem);
284 ERR("GetDocumentElement failed: %08x\n", nsres);
292 *p = create_all_collection(get_node(This, (nsIDOMNode*)nselem, TRUE));
294 nsIDOMElement_Release(nselem);
298 static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement **p)
300 HTMLDocument *This = HTMLDOC_THIS(iface);
301 nsIDOMDocument *nsdoc;
302 nsIDOMHTMLDocument *nshtmldoc;
303 nsIDOMHTMLElement *nsbody = NULL;
307 TRACE("(%p)->(%p)\n", This, p);
311 if(!This->nscontainer)
314 nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
315 if(NS_FAILED(nsres)) {
316 ERR("GetDocument failed: %08x\n", nsres);
320 if(NS_FAILED(nsres) || !nsdoc)
323 nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&nshtmldoc);
324 nsIDOMDocument_Release(nsdoc);
326 nsres = nsIDOMHTMLDocument_GetBody(nshtmldoc, &nsbody);
327 nsIDOMHTMLDocument_Release(nshtmldoc);
329 if(NS_FAILED(nsres) || !nsbody) {
330 TRACE("Could not get body: %08x\n", nsres);
334 node = get_node(This, (nsIDOMNode*)nsbody, TRUE);
335 nsIDOMHTMLElement_Release(nsbody);
337 IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)p);
339 TRACE("*p = %p\n", *p);
343 static HRESULT WINAPI HTMLDocument_get_activeElement(IHTMLDocument2 *iface, IHTMLElement **p)
345 HTMLDocument *This = HTMLDOC_THIS(iface);
346 FIXME("(%p)->(%p)\n", This, p);
350 static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElementCollection **p)
352 HTMLDocument *This = HTMLDOC_THIS(iface);
353 FIXME("(%p)->(%p)\n", This, p);
357 static HRESULT WINAPI HTMLDocument_get_applets(IHTMLDocument2 *iface, IHTMLElementCollection **p)
359 HTMLDocument *This = HTMLDOC_THIS(iface);
360 FIXME("(%p)->(%p)\n", This, p);
364 static HRESULT WINAPI HTMLDocument_get_links(IHTMLDocument2 *iface, IHTMLElementCollection **p)
366 HTMLDocument *This = HTMLDOC_THIS(iface);
367 FIXME("(%p)->(%p)\n", This, p);
371 static HRESULT WINAPI HTMLDocument_get_forms(IHTMLDocument2 *iface, IHTMLElementCollection **p)
373 HTMLDocument *This = HTMLDOC_THIS(iface);
374 FIXME("(%p)->(%p)\n", This, p);
378 static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLElementCollection **p)
380 HTMLDocument *This = HTMLDOC_THIS(iface);
381 FIXME("(%p)->(%p)\n", This, p);
385 static HRESULT WINAPI HTMLDocument_put_title(IHTMLDocument2 *iface, BSTR v)
387 HTMLDocument *This = HTMLDOC_THIS(iface);
388 nsIDOMHTMLDocument *nshtmldoc;
389 nsIDOMDocument *nsdoc;
393 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
395 if(!This->nscontainer)
398 nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
399 if(NS_FAILED(nsres) || !nsdoc) {
400 ERR("GetDocument failed: %08x\n", nsres);
404 nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&nshtmldoc);
405 nsIDOMDocument_Release(nsdoc);
407 nsAString_Init(&nsstr, v);
408 nsres = nsIDOMHTMLDocument_SetTitle(nshtmldoc, &nsstr);
409 nsIDOMHTMLDocument_Release(nshtmldoc);
410 nsAString_Finish(&nsstr);
412 ERR("SetTitle failed: %08x\n", nsres);
417 static HRESULT WINAPI HTMLDocument_get_title(IHTMLDocument2 *iface, BSTR *p)
419 HTMLDocument *This = HTMLDOC_THIS(iface);
420 nsIDOMHTMLDocument *nshtmldoc;
421 nsIDOMDocument *nsdoc;
422 const PRUnichar *ret;
426 TRACE("(%p)->(%p)\n", This, p);
428 if(!This->nscontainer)
431 nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
432 if(NS_FAILED(nsres) || !nsdoc) {
433 ERR("GetDocument failed: %08x\n", nsres);
437 nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&nshtmldoc);
438 nsIDOMDocument_Release(nsdoc);
440 nsAString_Init(&nsstr, NULL);
442 nsres = nsIDOMHTMLDocument_GetTitle(nshtmldoc, &nsstr);
443 nsIDOMHTMLDocument_Release(nshtmldoc);
444 if (NS_FAILED(nsres))
445 ERR("GetTitle failed: %08x\n", nsres);
447 nsAString_GetData(&nsstr, &ret);
448 *p = SysAllocString(ret);
449 nsAString_Finish(&nsstr);
454 static HRESULT WINAPI HTMLDocument_get_scripts(IHTMLDocument2 *iface, IHTMLElementCollection **p)
456 HTMLDocument *This = HTMLDOC_THIS(iface);
457 FIXME("(%p)->(%p)\n", This, p);
461 static HRESULT WINAPI HTMLDocument_put_designMode(IHTMLDocument2 *iface, BSTR v)
463 HTMLDocument *This = HTMLDOC_THIS(iface);
464 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
468 static HRESULT WINAPI HTMLDocument_get_designMode(IHTMLDocument2 *iface, BSTR *p)
470 HTMLDocument *This = HTMLDOC_THIS(iface);
471 FIXME("(%p)->(%p)\n", This, p);
475 static HRESULT WINAPI HTMLDocument_get_selection(IHTMLDocument2 *iface, IHTMLSelectionObject **p)
477 HTMLDocument *This = HTMLDOC_THIS(iface);
478 nsISelection *nsselection = NULL;
480 TRACE("(%p)->(%p)\n", This, p);
482 if(This->nscontainer) {
483 nsIDOMWindow *dom_window = NULL;
485 nsIWebBrowser_GetContentDOMWindow(This->nscontainer->webbrowser, &dom_window);
487 nsIDOMWindow_GetSelection(dom_window, &nsselection);
488 nsIDOMWindow_Release(dom_window);
492 *p = HTMLSelectionObject_Create(This, nsselection);
496 static HRESULT WINAPI HTMLDocument_get_readyState(IHTMLDocument2 *iface, BSTR *p)
498 HTMLDocument *This = HTMLDOC_THIS(iface);
500 static const WCHAR wszUninitialized[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
501 static const WCHAR wszLoading[] = {'l','o','a','d','i','n','g',0};
502 static const WCHAR wszLoaded[] = {'l','o','a','d','e','d',0};
503 static const WCHAR wszInteractive[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
504 static const WCHAR wszComplete[] = {'c','o','m','p','l','e','t','e',0};
506 static const LPCWSTR readystate_str[] = {
514 TRACE("(%p)->(%p)\n", iface, p);
519 *p = SysAllocString(readystate_str[This->readystate]);
523 static HRESULT WINAPI HTMLDocument_get_frames(IHTMLDocument2 *iface, IHTMLFramesCollection2 **p)
525 HTMLDocument *This = HTMLDOC_THIS(iface);
526 FIXME("(%p)->(%p)\n", This, p);
530 static HRESULT WINAPI HTMLDocument_get_embeds(IHTMLDocument2 *iface, IHTMLElementCollection **p)
532 HTMLDocument *This = HTMLDOC_THIS(iface);
533 FIXME("(%p)->(%p)\n", This, p);
537 static HRESULT WINAPI HTMLDocument_get_plugins(IHTMLDocument2 *iface, IHTMLElementCollection **p)
539 HTMLDocument *This = HTMLDOC_THIS(iface);
540 FIXME("(%p)->(%p)\n", This, p);
544 static HRESULT WINAPI HTMLDocument_put_alinkColor(IHTMLDocument2 *iface, VARIANT v)
546 HTMLDocument *This = HTMLDOC_THIS(iface);
547 FIXME("(%p)\n", This);
551 static HRESULT WINAPI HTMLDocument_get_alinkColor(IHTMLDocument2 *iface, VARIANT *p)
553 HTMLDocument *This = HTMLDOC_THIS(iface);
554 FIXME("(%p)->(%p)\n", This, p);
558 static HRESULT WINAPI HTMLDocument_put_bgColor(IHTMLDocument2 *iface, VARIANT v)
560 HTMLDocument *This = HTMLDOC_THIS(iface);
561 FIXME("(%p)\n", This);
565 static HRESULT WINAPI HTMLDocument_get_bgColor(IHTMLDocument2 *iface, VARIANT *p)
567 HTMLDocument *This = HTMLDOC_THIS(iface);
568 FIXME("(%p)->(%p)\n", This, p);
572 static HRESULT WINAPI HTMLDocument_put_fgColor(IHTMLDocument2 *iface, VARIANT v)
574 HTMLDocument *This = HTMLDOC_THIS(iface);
575 FIXME("(%p)\n", This);
579 static HRESULT WINAPI HTMLDocument_get_fgColor(IHTMLDocument2 *iface, VARIANT *p)
581 HTMLDocument *This = HTMLDOC_THIS(iface);
582 FIXME("(%p)->(%p)\n", This, p);
586 static HRESULT WINAPI HTMLDocument_put_linkColor(IHTMLDocument2 *iface, VARIANT v)
588 HTMLDocument *This = HTMLDOC_THIS(iface);
589 FIXME("(%p)->()\n", This);
593 static HRESULT WINAPI HTMLDocument_get_linkColor(IHTMLDocument2 *iface, VARIANT *p)
595 HTMLDocument *This = HTMLDOC_THIS(iface);
596 FIXME("(%p)->(%p)\n", This, p);
600 static HRESULT WINAPI HTMLDocument_put_vlinkColor(IHTMLDocument2 *iface, VARIANT v)
602 HTMLDocument *This = HTMLDOC_THIS(iface);
603 FIXME("(%p)\n", This);
607 static HRESULT WINAPI HTMLDocument_get_vlinkColor(IHTMLDocument2 *iface, VARIANT *p)
609 HTMLDocument *This = HTMLDOC_THIS(iface);
610 FIXME("(%p)->(%p)\n", This, p);
614 static HRESULT WINAPI HTMLDocument_get_referrer(IHTMLDocument2 *iface, BSTR *p)
616 HTMLDocument *This = HTMLDOC_THIS(iface);
617 FIXME("(%p)->(%p)\n", This, p);
621 static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLocation **p)
623 HTMLDocument *This = HTMLDOC_THIS(iface);
625 TRACE("(%p)->(%p)\n", This, p);
628 IHTMLLocation_AddRef(HTMLLOCATION(This->location));
630 This->location = HTMLLocation_Create(This);
632 *p = HTMLLOCATION(This->location);
636 static HRESULT WINAPI HTMLDocument_get_lastModified(IHTMLDocument2 *iface, BSTR *p)
638 HTMLDocument *This = HTMLDOC_THIS(iface);
639 FIXME("(%p)->(%p)\n", This, p);
643 static HRESULT WINAPI HTMLDocument_put_URL(IHTMLDocument2 *iface, BSTR v)
645 HTMLDocument *This = HTMLDOC_THIS(iface);
646 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
650 static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p)
652 HTMLDocument *This = HTMLDOC_THIS(iface);
654 static const WCHAR about_blank_url[] =
655 {'a','b','o','u','t',':','b','l','a','n','k',0};
657 TRACE("(%p)->(%p)\n", iface, p);
659 *p = SysAllocString(This->url ? This->url : about_blank_url);
663 static HRESULT WINAPI HTMLDocument_put_domain(IHTMLDocument2 *iface, BSTR v)
665 HTMLDocument *This = HTMLDOC_THIS(iface);
666 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
670 static HRESULT WINAPI HTMLDocument_get_domain(IHTMLDocument2 *iface, BSTR *p)
672 HTMLDocument *This = HTMLDOC_THIS(iface);
673 FIXME("(%p)->(%p)\n", This, p);
677 static HRESULT WINAPI HTMLDocument_put_cookie(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_cookie(IHTMLDocument2 *iface, BSTR *p)
686 HTMLDocument *This = HTMLDOC_THIS(iface);
687 FIXME("(%p)->(%p)\n", This, p);
691 static HRESULT WINAPI HTMLDocument_put_expando(IHTMLDocument2 *iface, VARIANT_BOOL v)
693 HTMLDocument *This = HTMLDOC_THIS(iface);
694 FIXME("(%p)->(%x)\n", This, v);
698 static HRESULT WINAPI HTMLDocument_get_expando(IHTMLDocument2 *iface, VARIANT_BOOL *p)
700 HTMLDocument *This = HTMLDOC_THIS(iface);
701 FIXME("(%p)->(%p)\n", This, p);
705 static HRESULT WINAPI HTMLDocument_put_charset(IHTMLDocument2 *iface, BSTR v)
707 HTMLDocument *This = HTMLDOC_THIS(iface);
708 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
712 static HRESULT WINAPI HTMLDocument_get_charset(IHTMLDocument2 *iface, BSTR *p)
714 HTMLDocument *This = HTMLDOC_THIS(iface);
715 FIXME("(%p)->(%p)\n", This, p);
719 static HRESULT WINAPI HTMLDocument_put_defaultCharset(IHTMLDocument2 *iface, BSTR v)
721 HTMLDocument *This = HTMLDOC_THIS(iface);
722 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
726 static HRESULT WINAPI HTMLDocument_get_defaultCharset(IHTMLDocument2 *iface, BSTR *p)
728 HTMLDocument *This = HTMLDOC_THIS(iface);
729 FIXME("(%p)->(%p)\n", This, p);
733 static HRESULT WINAPI HTMLDocument_get_mimeType(IHTMLDocument2 *iface, BSTR *p)
735 HTMLDocument *This = HTMLDOC_THIS(iface);
736 FIXME("(%p)->(%p)\n", This, p);
740 static HRESULT WINAPI HTMLDocument_get_fileSize(IHTMLDocument2 *iface, BSTR *p)
742 HTMLDocument *This = HTMLDOC_THIS(iface);
743 FIXME("(%p)->(%p)\n", This, p);
747 static HRESULT WINAPI HTMLDocument_get_fileCreatedDate(IHTMLDocument2 *iface, BSTR *p)
749 HTMLDocument *This = HTMLDOC_THIS(iface);
750 FIXME("(%p)->(%p)\n", This, p);
754 static HRESULT WINAPI HTMLDocument_get_fileModifiedDate(IHTMLDocument2 *iface, BSTR *p)
756 HTMLDocument *This = HTMLDOC_THIS(iface);
757 FIXME("(%p)->(%p)\n", This, p);
761 static HRESULT WINAPI HTMLDocument_get_fileUpdatedDate(IHTMLDocument2 *iface, BSTR *p)
763 HTMLDocument *This = HTMLDOC_THIS(iface);
764 FIXME("(%p)->(%p)\n", This, p);
768 static HRESULT WINAPI HTMLDocument_get_security(IHTMLDocument2 *iface, BSTR *p)
770 HTMLDocument *This = HTMLDOC_THIS(iface);
771 FIXME("(%p)->(%p)\n", This, p);
775 static HRESULT WINAPI HTMLDocument_get_protocol(IHTMLDocument2 *iface, BSTR *p)
777 HTMLDocument *This = HTMLDOC_THIS(iface);
778 FIXME("(%p)->(%p)\n", This, p);
782 static HRESULT WINAPI HTMLDocument_get_nameProp(IHTMLDocument2 *iface, BSTR *p)
784 HTMLDocument *This = HTMLDOC_THIS(iface);
785 FIXME("(%p)->(%p)\n", This, p);
789 static HRESULT WINAPI HTMLDocument_write(IHTMLDocument2 *iface, SAFEARRAY *psarray)
791 HTMLDocument *This = HTMLDOC_THIS(iface);
792 nsIDOMDocument *domdoc;
793 nsIDOMHTMLDocument *nsdoc;
800 TRACE("(%p)->(%p)\n", iface, psarray);
802 if(psarray->cDims != 1) {
803 FIXME("cDims=%d\n", psarray->cDims);
807 if(!This->nscontainer)
810 nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &domdoc);
811 if(NS_FAILED(nsres)) {
812 ERR("GetDocument failed: %08x\n", nsres);
816 nsres = nsIDOMDocument_QueryInterface(domdoc, &IID_nsIDOMHTMLDocument, (void**)&nsdoc);
817 nsIDOMDocument_Release(domdoc);
821 hres = SafeArrayAccessData(psarray, (void**)&var);
823 WARN("SafeArrayAccessData failed: %08x\n", hres);
824 nsIDOMHTMLDocument_Release(nsdoc);
828 nsAString_Init(&nsstr, NULL);
830 for(i=0; i < psarray->rgsabound[0].cElements; i++) {
831 if(V_VT(var+i) == VT_BSTR) {
832 nsAString_SetData(&nsstr, V_BSTR(var+i));
833 nsres = nsIDOMHTMLDocument_Write(nsdoc, &nsstr);
835 ERR("Write failed: %08x\n", nsres);
837 FIXME("vt=%d\n", V_VT(var+i));
841 nsAString_Finish(&nsstr);
842 SafeArrayUnaccessData(psarray);
843 nsIDOMHTMLDocument_Release(nsdoc);
848 static HRESULT WINAPI HTMLDocument_writeln(IHTMLDocument2 *iface, SAFEARRAY *psarray)
850 HTMLDocument *This = HTMLDOC_THIS(iface);
851 FIXME("(%p)->(%p)\n", This, psarray);
855 static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT name,
856 VARIANT features, VARIANT replace, IDispatch **pomWindowResult)
858 HTMLDocument *This = HTMLDOC_THIS(iface);
859 FIXME("(%p)->(%s %p)\n", This, debugstr_w(url), pomWindowResult);
863 static HRESULT WINAPI HTMLDocument_close(IHTMLDocument2 *iface)
865 HTMLDocument *This = HTMLDOC_THIS(iface);
866 FIXME("(%p)\n", This);
870 static HRESULT WINAPI HTMLDocument_clear(IHTMLDocument2 *iface)
872 HTMLDocument *This = HTMLDOC_THIS(iface);
873 FIXME("(%p)\n", This);
877 static HRESULT WINAPI HTMLDocument_queryCommandSupported(IHTMLDocument2 *iface, BSTR cmdID,
880 HTMLDocument *This = HTMLDOC_THIS(iface);
881 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
885 static HRESULT WINAPI HTMLDocument_queryCommandEnabled(IHTMLDocument2 *iface, BSTR cmdID,
888 HTMLDocument *This = HTMLDOC_THIS(iface);
889 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
893 static HRESULT WINAPI HTMLDocument_queryCommandState(IHTMLDocument2 *iface, BSTR cmdID,
896 HTMLDocument *This = HTMLDOC_THIS(iface);
897 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
901 static HRESULT WINAPI HTMLDocument_queryCommandIndeterm(IHTMLDocument2 *iface, BSTR cmdID,
904 HTMLDocument *This = HTMLDOC_THIS(iface);
905 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
909 static HRESULT WINAPI HTMLDocument_queryCommandText(IHTMLDocument2 *iface, BSTR cmdID,
912 HTMLDocument *This = HTMLDOC_THIS(iface);
913 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
917 static HRESULT WINAPI HTMLDocument_queryCommandValue(IHTMLDocument2 *iface, BSTR cmdID,
920 HTMLDocument *This = HTMLDOC_THIS(iface);
921 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
925 static HRESULT WINAPI HTMLDocument_execCommand(IHTMLDocument2 *iface, BSTR cmdID,
926 VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL *pfRet)
928 HTMLDocument *This = HTMLDOC_THIS(iface);
929 FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(cmdID), showUI, pfRet);
933 static HRESULT WINAPI HTMLDocument_execCommandShowHelp(IHTMLDocument2 *iface, BSTR cmdID,
936 HTMLDocument *This = HTMLDOC_THIS(iface);
937 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
941 static HRESULT WINAPI HTMLDocument_createElement(IHTMLDocument2 *iface, BSTR eTag,
942 IHTMLElement **newElem)
944 HTMLDocument *This = HTMLDOC_THIS(iface);
945 nsIDOMDocument *nsdoc;
946 nsIDOMElement *nselem;
951 TRACE("(%p)->(%s %p)\n", This, debugstr_w(eTag), newElem);
953 nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
955 nsAString_Init(&tag_str, eTag);
956 nsres = nsIDOMDocument_CreateElement(nsdoc, &tag_str, &nselem);
957 nsAString_Finish(&tag_str);
958 nsIDOMDocument_Release(nsdoc);
959 if(NS_FAILED(nsres)) {
960 ERR("CreateElement failed: %08x\n", nsres);
964 elem = HTMLElement_Create(This, (nsIDOMNode*)nselem, TRUE);
965 nsIDOMElement_Release(nselem);
967 *newElem = HTMLELEM(elem);
968 IHTMLElement_AddRef(HTMLELEM(elem));
972 static HRESULT WINAPI HTMLDocument_put_onhelp(IHTMLDocument2 *iface, VARIANT v)
974 HTMLDocument *This = HTMLDOC_THIS(iface);
975 FIXME("(%p)\n", This);
979 static HRESULT WINAPI HTMLDocument_get_onhelp(IHTMLDocument2 *iface, VARIANT *p)
981 HTMLDocument *This = HTMLDOC_THIS(iface);
982 FIXME("(%p)->(%p)\n", This, p);
986 static HRESULT WINAPI HTMLDocument_put_onclick(IHTMLDocument2 *iface, VARIANT v)
988 HTMLDocument *This = HTMLDOC_THIS(iface);
989 FIXME("(%p)\n", This);
993 static HRESULT WINAPI HTMLDocument_get_onclick(IHTMLDocument2 *iface, VARIANT *p)
995 HTMLDocument *This = HTMLDOC_THIS(iface);
996 FIXME("(%p)->(%p)\n", This, p);
1000 static HRESULT WINAPI HTMLDocument_put_ondblclick(IHTMLDocument2 *iface, VARIANT v)
1002 HTMLDocument *This = HTMLDOC_THIS(iface);
1003 FIXME("(%p)\n", This);
1007 static HRESULT WINAPI HTMLDocument_get_ondblclick(IHTMLDocument2 *iface, VARIANT *p)
1009 HTMLDocument *This = HTMLDOC_THIS(iface);
1010 FIXME("(%p)->(%p)\n", This, p);
1014 static HRESULT WINAPI HTMLDocument_put_onkeyup(IHTMLDocument2 *iface, VARIANT v)
1016 HTMLDocument *This = HTMLDOC_THIS(iface);
1017 FIXME("(%p)\n", This);
1021 static HRESULT WINAPI HTMLDocument_get_onkeyup(IHTMLDocument2 *iface, VARIANT *p)
1023 HTMLDocument *This = HTMLDOC_THIS(iface);
1024 FIXME("(%p)->(%p)\n", This, p);
1028 static HRESULT WINAPI HTMLDocument_put_onkeydown(IHTMLDocument2 *iface, VARIANT v)
1030 HTMLDocument *This = HTMLDOC_THIS(iface);
1031 FIXME("(%p)\n", This);
1035 static HRESULT WINAPI HTMLDocument_get_onkeydown(IHTMLDocument2 *iface, VARIANT *p)
1037 HTMLDocument *This = HTMLDOC_THIS(iface);
1038 FIXME("(%p)->(%p)\n", This, p);
1042 static HRESULT WINAPI HTMLDocument_put_onkeypress(IHTMLDocument2 *iface, VARIANT v)
1044 HTMLDocument *This = HTMLDOC_THIS(iface);
1045 FIXME("(%p)\n", This);
1049 static HRESULT WINAPI HTMLDocument_get_onkeypress(IHTMLDocument2 *iface, VARIANT *p)
1051 HTMLDocument *This = HTMLDOC_THIS(iface);
1052 FIXME("(%p)->(%p)\n", This, p);
1056 static HRESULT WINAPI HTMLDocument_put_onmouseup(IHTMLDocument2 *iface, VARIANT v)
1058 HTMLDocument *This = HTMLDOC_THIS(iface);
1059 FIXME("(%p)\n", This);
1063 static HRESULT WINAPI HTMLDocument_get_onmouseup(IHTMLDocument2 *iface, VARIANT *p)
1065 HTMLDocument *This = HTMLDOC_THIS(iface);
1066 FIXME("(%p)->(%p)\n", This, p);
1070 static HRESULT WINAPI HTMLDocument_put_onmousedown(IHTMLDocument2 *iface, VARIANT v)
1072 HTMLDocument *This = HTMLDOC_THIS(iface);
1073 FIXME("(%p)\n", This);
1077 static HRESULT WINAPI HTMLDocument_get_onmousedown(IHTMLDocument2 *iface, VARIANT *p)
1079 HTMLDocument *This = HTMLDOC_THIS(iface);
1080 FIXME("(%p)->(%p)\n", This, p);
1084 static HRESULT WINAPI HTMLDocument_put_onmousemove(IHTMLDocument2 *iface, VARIANT v)
1086 HTMLDocument *This = HTMLDOC_THIS(iface);
1087 FIXME("(%p)\n", This);
1091 static HRESULT WINAPI HTMLDocument_get_onmousemove(IHTMLDocument2 *iface, VARIANT *p)
1093 HTMLDocument *This = HTMLDOC_THIS(iface);
1094 FIXME("(%p)->(%p)\n", This, p);
1098 static HRESULT WINAPI HTMLDocument_put_onmouseout(IHTMLDocument2 *iface, VARIANT v)
1100 HTMLDocument *This = HTMLDOC_THIS(iface);
1101 FIXME("(%p)\n", This);
1105 static HRESULT WINAPI HTMLDocument_get_onmouseout(IHTMLDocument2 *iface, VARIANT *p)
1107 HTMLDocument *This = HTMLDOC_THIS(iface);
1108 FIXME("(%p)->(%p)\n", This, p);
1112 static HRESULT WINAPI HTMLDocument_put_onmouseover(IHTMLDocument2 *iface, VARIANT v)
1114 HTMLDocument *This = HTMLDOC_THIS(iface);
1115 FIXME("(%p)\n", This);
1119 static HRESULT WINAPI HTMLDocument_get_onmouseover(IHTMLDocument2 *iface, VARIANT *p)
1121 HTMLDocument *This = HTMLDOC_THIS(iface);
1122 FIXME("(%p)->(%p)\n", This, p);
1126 static HRESULT WINAPI HTMLDocument_put_onreadystatechange(IHTMLDocument2 *iface, VARIANT v)
1128 HTMLDocument *This = HTMLDOC_THIS(iface);
1129 FIXME("(%p)\n", This);
1133 static HRESULT WINAPI HTMLDocument_get_onreadystatechange(IHTMLDocument2 *iface, VARIANT *p)
1135 HTMLDocument *This = HTMLDOC_THIS(iface);
1136 FIXME("(%p)->(%p)\n", This, p);
1140 static HRESULT WINAPI HTMLDocument_put_onafterupdate(IHTMLDocument2 *iface, VARIANT v)
1142 HTMLDocument *This = HTMLDOC_THIS(iface);
1143 FIXME("(%p)\n", This);
1147 static HRESULT WINAPI HTMLDocument_get_onafterupdate(IHTMLDocument2 *iface, VARIANT *p)
1149 HTMLDocument *This = HTMLDOC_THIS(iface);
1150 FIXME("(%p)->(%p)\n", This, p);
1154 static HRESULT WINAPI HTMLDocument_put_onrowexit(IHTMLDocument2 *iface, VARIANT v)
1156 HTMLDocument *This = HTMLDOC_THIS(iface);
1157 FIXME("(%p)\n", This);
1161 static HRESULT WINAPI HTMLDocument_get_onrowexit(IHTMLDocument2 *iface, VARIANT *p)
1163 HTMLDocument *This = HTMLDOC_THIS(iface);
1164 FIXME("(%p)->(%p)\n", This, p);
1168 static HRESULT WINAPI HTMLDocument_put_onrowenter(IHTMLDocument2 *iface, VARIANT v)
1170 HTMLDocument *This = HTMLDOC_THIS(iface);
1171 FIXME("(%p)\n", This);
1175 static HRESULT WINAPI HTMLDocument_get_onrowenter(IHTMLDocument2 *iface, VARIANT *p)
1177 HTMLDocument *This = HTMLDOC_THIS(iface);
1178 FIXME("(%p)->(%p)\n", This, p);
1182 static HRESULT WINAPI HTMLDocument_put_ondragstart(IHTMLDocument2 *iface, VARIANT v)
1184 HTMLDocument *This = HTMLDOC_THIS(iface);
1185 FIXME("(%p)\n", This);
1189 static HRESULT WINAPI HTMLDocument_get_ondragstart(IHTMLDocument2 *iface, VARIANT *p)
1191 HTMLDocument *This = HTMLDOC_THIS(iface);
1192 FIXME("(%p)->(%p)\n", This, p);
1196 static HRESULT WINAPI HTMLDocument_put_onselectstart(IHTMLDocument2 *iface, VARIANT v)
1198 HTMLDocument *This = HTMLDOC_THIS(iface);
1199 FIXME("(%p)\n", This);
1203 static HRESULT WINAPI HTMLDocument_get_onselectstart(IHTMLDocument2 *iface, VARIANT *p)
1205 HTMLDocument *This = HTMLDOC_THIS(iface);
1206 FIXME("(%p)->(%p)\n", This, p);
1210 static HRESULT WINAPI HTMLDocument_elementFromPoint(IHTMLDocument2 *iface, long x, long y,
1211 IHTMLElement **elementHit)
1213 HTMLDocument *This = HTMLDOC_THIS(iface);
1214 FIXME("(%p)->(%ld %ld %p)\n", This, x, y, elementHit);
1218 static HRESULT WINAPI HTMLDocument_get_parentWindow(IHTMLDocument2 *iface, IHTMLWindow2 **p)
1220 HTMLDocument *This = HTMLDOC_THIS(iface);
1222 TRACE("(%p)->(%p)\n", This, p);
1224 *p = HTMLWINDOW2(This->window);
1225 IHTMLWindow2_AddRef(*p);
1229 static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface,
1230 IHTMLStyleSheetsCollection **p)
1232 HTMLDocument *This = HTMLDOC_THIS(iface);
1233 nsIDOMStyleSheetList *nsstylelist;
1234 nsIDOMDocumentStyle *nsdocstyle;
1235 nsIDOMDocument *nsdoc;
1238 TRACE("(%p)->(%p)\n", This, p);
1242 if(!This->nscontainer)
1245 nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
1246 if(NS_FAILED(nsres)) {
1247 ERR("GetDocument failed: %08x\n", nsres);
1251 if(NS_FAILED(nsres) || !nsdoc)
1254 nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMDocumentStyle, (void**)&nsdocstyle);
1255 nsIDOMDocument_Release(nsdoc);
1257 nsIDOMDocumentStyle_GetStyleSheets(nsdocstyle, &nsstylelist);
1258 nsIDOMDocumentStyle_Release(nsdocstyle);
1260 *p = HTMLStyleSheetsCollection_Create(nsstylelist);
1261 nsIDOMDocumentStyle_Release(nsstylelist);
1266 static HRESULT WINAPI HTMLDocument_put_onbeforeupdate(IHTMLDocument2 *iface, VARIANT v)
1268 HTMLDocument *This = HTMLDOC_THIS(iface);
1269 FIXME("(%p)\n", This);
1273 static HRESULT WINAPI HTMLDocument_get_onbeforeupdate(IHTMLDocument2 *iface, VARIANT *p)
1275 HTMLDocument *This = HTMLDOC_THIS(iface);
1276 FIXME("(%p)->(%p)\n", This, p);
1280 static HRESULT WINAPI HTMLDocument_put_onerrorupdate(IHTMLDocument2 *iface, VARIANT v)
1282 HTMLDocument *This = HTMLDOC_THIS(iface);
1283 FIXME("(%p)\n", This);
1287 static HRESULT WINAPI HTMLDocument_get_onerrorupdate(IHTMLDocument2 *iface, VARIANT *p)
1289 HTMLDocument *This = HTMLDOC_THIS(iface);
1290 FIXME("(%p)->(%p)\n", This, p);
1294 static HRESULT WINAPI HTMLDocument_toString(IHTMLDocument2 *iface, BSTR *String)
1296 HTMLDocument *This = HTMLDOC_THIS(iface);
1297 FIXME("(%p)->(%p)\n", This, String);
1301 static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR bstrHref,
1302 long lIndex, IHTMLStyleSheet **ppnewStyleSheet)
1304 HTMLDocument *This = HTMLDOC_THIS(iface);
1306 FIXME("(%p)->(%s %ld %p) semi-stub\n", This, debugstr_w(bstrHref), lIndex, ppnewStyleSheet);
1308 *ppnewStyleSheet = HTMLStyleSheet_Create(NULL);
1312 static const IHTMLDocument2Vtbl HTMLDocumentVtbl = {
1313 HTMLDocument_QueryInterface,
1314 HTMLDocument_AddRef,
1315 HTMLDocument_Release,
1316 HTMLDocument_GetTypeInfoCount,
1317 HTMLDocument_GetTypeInfo,
1318 HTMLDocument_GetIDsOfNames,
1319 HTMLDocument_Invoke,
1320 HTMLDocument_get_Script,
1321 HTMLDocument_get_all,
1322 HTMLDocument_get_body,
1323 HTMLDocument_get_activeElement,
1324 HTMLDocument_get_images,
1325 HTMLDocument_get_applets,
1326 HTMLDocument_get_links,
1327 HTMLDocument_get_forms,
1328 HTMLDocument_get_anchors,
1329 HTMLDocument_put_title,
1330 HTMLDocument_get_title,
1331 HTMLDocument_get_scripts,
1332 HTMLDocument_put_designMode,
1333 HTMLDocument_get_designMode,
1334 HTMLDocument_get_selection,
1335 HTMLDocument_get_readyState,
1336 HTMLDocument_get_frames,
1337 HTMLDocument_get_embeds,
1338 HTMLDocument_get_plugins,
1339 HTMLDocument_put_alinkColor,
1340 HTMLDocument_get_alinkColor,
1341 HTMLDocument_put_bgColor,
1342 HTMLDocument_get_bgColor,
1343 HTMLDocument_put_fgColor,
1344 HTMLDocument_get_fgColor,
1345 HTMLDocument_put_linkColor,
1346 HTMLDocument_get_linkColor,
1347 HTMLDocument_put_vlinkColor,
1348 HTMLDocument_get_vlinkColor,
1349 HTMLDocument_get_referrer,
1350 HTMLDocument_get_location,
1351 HTMLDocument_get_lastModified,
1352 HTMLDocument_put_URL,
1353 HTMLDocument_get_URL,
1354 HTMLDocument_put_domain,
1355 HTMLDocument_get_domain,
1356 HTMLDocument_put_cookie,
1357 HTMLDocument_get_cookie,
1358 HTMLDocument_put_expando,
1359 HTMLDocument_get_expando,
1360 HTMLDocument_put_charset,
1361 HTMLDocument_get_charset,
1362 HTMLDocument_put_defaultCharset,
1363 HTMLDocument_get_defaultCharset,
1364 HTMLDocument_get_mimeType,
1365 HTMLDocument_get_fileSize,
1366 HTMLDocument_get_fileCreatedDate,
1367 HTMLDocument_get_fileModifiedDate,
1368 HTMLDocument_get_fileUpdatedDate,
1369 HTMLDocument_get_security,
1370 HTMLDocument_get_protocol,
1371 HTMLDocument_get_nameProp,
1373 HTMLDocument_writeln,
1377 HTMLDocument_queryCommandSupported,
1378 HTMLDocument_queryCommandEnabled,
1379 HTMLDocument_queryCommandState,
1380 HTMLDocument_queryCommandIndeterm,
1381 HTMLDocument_queryCommandText,
1382 HTMLDocument_queryCommandValue,
1383 HTMLDocument_execCommand,
1384 HTMLDocument_execCommandShowHelp,
1385 HTMLDocument_createElement,
1386 HTMLDocument_put_onhelp,
1387 HTMLDocument_get_onhelp,
1388 HTMLDocument_put_onclick,
1389 HTMLDocument_get_onclick,
1390 HTMLDocument_put_ondblclick,
1391 HTMLDocument_get_ondblclick,
1392 HTMLDocument_put_onkeyup,
1393 HTMLDocument_get_onkeyup,
1394 HTMLDocument_put_onkeydown,
1395 HTMLDocument_get_onkeydown,
1396 HTMLDocument_put_onkeypress,
1397 HTMLDocument_get_onkeypress,
1398 HTMLDocument_put_onmouseup,
1399 HTMLDocument_get_onmouseup,
1400 HTMLDocument_put_onmousedown,
1401 HTMLDocument_get_onmousedown,
1402 HTMLDocument_put_onmousemove,
1403 HTMLDocument_get_onmousemove,
1404 HTMLDocument_put_onmouseout,
1405 HTMLDocument_get_onmouseout,
1406 HTMLDocument_put_onmouseover,
1407 HTMLDocument_get_onmouseover,
1408 HTMLDocument_put_onreadystatechange,
1409 HTMLDocument_get_onreadystatechange,
1410 HTMLDocument_put_onafterupdate,
1411 HTMLDocument_get_onafterupdate,
1412 HTMLDocument_put_onrowexit,
1413 HTMLDocument_get_onrowexit,
1414 HTMLDocument_put_onrowenter,
1415 HTMLDocument_get_onrowenter,
1416 HTMLDocument_put_ondragstart,
1417 HTMLDocument_get_ondragstart,
1418 HTMLDocument_put_onselectstart,
1419 HTMLDocument_get_onselectstart,
1420 HTMLDocument_elementFromPoint,
1421 HTMLDocument_get_parentWindow,
1422 HTMLDocument_get_styleSheets,
1423 HTMLDocument_put_onbeforeupdate,
1424 HTMLDocument_get_onbeforeupdate,
1425 HTMLDocument_put_onerrorupdate,
1426 HTMLDocument_get_onerrorupdate,
1427 HTMLDocument_toString,
1428 HTMLDocument_createStyleSheet
1431 #define DISPEX_THIS(iface) DEFINE_THIS(HTMLDocument, IDispatchEx, iface)
1433 static HRESULT WINAPI DocDispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
1435 HTMLDocument *This = DISPEX_THIS(iface);
1437 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
1440 static ULONG WINAPI DocDispatchEx_AddRef(IDispatchEx *iface)
1442 HTMLDocument *This = DISPEX_THIS(iface);
1444 return IHTMLDocument2_AddRef(HTMLDOC(This));
1447 static ULONG WINAPI DocDispatchEx_Release(IDispatchEx *iface)
1449 HTMLDocument *This = DISPEX_THIS(iface);
1451 return IHTMLDocument2_Release(HTMLDOC(This));
1454 static HRESULT WINAPI DocDispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
1456 HTMLDocument *This = DISPEX_THIS(iface);
1458 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo);
1461 static HRESULT WINAPI DocDispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
1462 LCID lcid, ITypeInfo **ppTInfo)
1464 HTMLDocument *This = DISPEX_THIS(iface);
1466 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
1469 static HRESULT WINAPI DocDispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
1470 LPOLESTR *rgszNames, UINT cNames,
1471 LCID lcid, DISPID *rgDispId)
1473 HTMLDocument *This = DISPEX_THIS(iface);
1475 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
1478 static HRESULT WINAPI DocDispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
1479 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1480 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1482 HTMLDocument *This = DISPEX_THIS(iface);
1484 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
1485 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1487 switch(dispIdMember) {
1488 case DISPID_READYSTATE:
1489 TRACE("DISPID_READYSTATE\n");
1491 if(!(wFlags & DISPATCH_PROPERTYGET))
1492 return E_INVALIDARG;
1494 V_VT(pVarResult) = VT_I4;
1495 V_I4(pVarResult) = This->readystate;
1499 return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
1500 pVarResult, pExcepInfo, puArgErr);
1503 static HRESULT WINAPI DocDispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
1505 HTMLDocument *This = DISPEX_THIS(iface);
1507 return IDispatchEx_GetDispID(DISPATCHEX(&This->dispex), bstrName, grfdex, pid);
1510 static HRESULT WINAPI DocDispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
1511 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
1513 HTMLDocument *This = DISPEX_THIS(iface);
1515 return IDispatchEx_InvokeEx(DISPATCHEX(&This->dispex), id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
1518 static HRESULT WINAPI DocDispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
1520 HTMLDocument *This = DISPEX_THIS(iface);
1522 return IDispatchEx_DeleteMemberByName(DISPATCHEX(&This->dispex), bstrName, grfdex);
1525 static HRESULT WINAPI DocDispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
1527 HTMLDocument *This = DISPEX_THIS(iface);
1529 return IDispatchEx_DeleteMemberByDispID(DISPATCHEX(&This->dispex), id);
1532 static HRESULT WINAPI DocDispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
1534 HTMLDocument *This = DISPEX_THIS(iface);
1536 return IDispatchEx_GetMemberProperties(DISPATCHEX(&This->dispex), id, grfdexFetch, pgrfdex);
1539 static HRESULT WINAPI DocDispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
1541 HTMLDocument *This = DISPEX_THIS(iface);
1543 return IDispatchEx_GetMemberName(DISPATCHEX(&This->dispex), id, pbstrName);
1546 static HRESULT WINAPI DocDispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
1548 HTMLDocument *This = DISPEX_THIS(iface);
1550 return IDispatchEx_GetNextDispID(DISPATCHEX(&This->dispex), grfdex, id, pid);
1553 static HRESULT WINAPI DocDispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
1555 HTMLDocument *This = DISPEX_THIS(iface);
1557 return IDispatchEx_GetNameSpaceParent(DISPATCHEX(&This->dispex), ppunk);
1562 static const IDispatchExVtbl DocDispatchExVtbl = {
1563 DocDispatchEx_QueryInterface,
1564 DocDispatchEx_AddRef,
1565 DocDispatchEx_Release,
1566 DocDispatchEx_GetTypeInfoCount,
1567 DocDispatchEx_GetTypeInfo,
1568 DocDispatchEx_GetIDsOfNames,
1569 DocDispatchEx_Invoke,
1570 DocDispatchEx_GetDispID,
1571 DocDispatchEx_InvokeEx,
1572 DocDispatchEx_DeleteMemberByName,
1573 DocDispatchEx_DeleteMemberByDispID,
1574 DocDispatchEx_GetMemberProperties,
1575 DocDispatchEx_GetMemberName,
1576 DocDispatchEx_GetNextDispID,
1577 DocDispatchEx_GetNameSpaceParent
1580 static const tid_t HTMLDocument_iface_tids[] = {
1587 static dispex_static_data_t HTMLDocument_dispex = {
1589 DispHTMLDocument_tid,
1591 HTMLDocument_iface_tids
1594 HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
1599 TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppvObject);
1601 ret = heap_alloc_zero(sizeof(HTMLDocument));
1602 ret->lpHTMLDocument2Vtbl = &HTMLDocumentVtbl;
1603 ret->lpIDispatchExVtbl = &DocDispatchExVtbl;
1605 ret->readystate = READYSTATE_UNINITIALIZED;
1607 list_init(&ret->bindings);
1608 list_init(&ret->script_hosts);
1609 list_init(&ret->selection_list);
1610 list_init(&ret->range_list);
1612 hres = IHTMLDocument_QueryInterface(HTMLDOC(ret), riid, ppvObject);
1620 HTMLDocument_HTMLDocument3_Init(ret);
1621 HTMLDocument_HTMLDocument5_Init(ret);
1622 HTMLDocument_Persist_Init(ret);
1623 HTMLDocument_OleCmd_Init(ret);
1624 HTMLDocument_OleObj_Init(ret);
1625 HTMLDocument_View_Init(ret);
1626 HTMLDocument_Window_Init(ret);
1627 HTMLDocument_Service_Init(ret);
1628 HTMLDocument_Hlink_Init(ret);
1630 ConnectionPointContainer_Init(&ret->cp_container, (IUnknown*)HTMLDOC(ret));
1631 ConnectionPoint_Init(&ret->cp_propnotif, &ret->cp_container, &IID_IPropertyNotifySink);
1632 ConnectionPoint_Init(&ret->cp_htmldocevents, &ret->cp_container, &DIID_HTMLDocumentEvents);
1633 ConnectionPoint_Init(&ret->cp_htmldocevents2, &ret->cp_container, &DIID_HTMLDocumentEvents2);
1635 init_dispex(&ret->dispex, (IUnknown*)HTMLDOC(ret), &HTMLDocument_dispex);
1637 ret->nscontainer = NSContainer_Create(ret, NULL);
1638 ret->window = HTMLWindow_Create(ret);