2 * Copyright 2005 Jacek Caban for CodeWeavers
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 HTMLDOC3_THIS(iface) DEFINE_THIS(HTMLDocument, HTMLDocument3, iface)
40 static HRESULT WINAPI HTMLDocument3_QueryInterface(IHTMLDocument3 *iface,
41 REFIID riid, void **ppv)
43 HTMLDocument *This = HTMLDOC3_THIS(iface);
44 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
47 static ULONG WINAPI HTMLDocument3_AddRef(IHTMLDocument3 *iface)
49 HTMLDocument *This = HTMLDOC3_THIS(iface);
50 return IHTMLDocument2_AddRef(HTMLDOC(This));
53 static ULONG WINAPI HTMLDocument3_Release(IHTMLDocument3 *iface)
55 HTMLDocument *This = HTMLDOC3_THIS(iface);
56 return IHTMLDocument2_Release(HTMLDOC(This));
59 static HRESULT WINAPI HTMLDocument3_GetTypeInfoCount(IHTMLDocument3 *iface, UINT *pctinfo)
61 HTMLDocument *This = HTMLDOC3_THIS(iface);
62 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo);
65 static HRESULT WINAPI HTMLDocument3_GetTypeInfo(IHTMLDocument3 *iface, UINT iTInfo,
66 LCID lcid, ITypeInfo **ppTInfo)
68 HTMLDocument *This = HTMLDOC3_THIS(iface);
69 return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo);
72 static HRESULT WINAPI HTMLDocument3_GetIDsOfNames(IHTMLDocument3 *iface, REFIID riid,
73 LPOLESTR *rgszNames, UINT cNames,
74 LCID lcid, DISPID *rgDispId)
76 HTMLDocument *This = HTMLDOC3_THIS(iface);
77 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId);
80 static HRESULT WINAPI HTMLDocument3_Invoke(IHTMLDocument3 *iface, DISPID dispIdMember,
81 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
82 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
84 HTMLDocument *This = HTMLDOC3_THIS(iface);
85 return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams,
86 pVarResult, pExcepInfo, puArgErr);
89 static HRESULT WINAPI HTMLDocument3_releaseCapture(IHTMLDocument3 *iface)
91 HTMLDocument *This = HTMLDOC3_THIS(iface);
92 FIXME("(%p)\n", This);
96 static HRESULT WINAPI HTMLDocument3_recalc(IHTMLDocument3 *iface, VARIANT_BOOL fForce)
98 HTMLDocument *This = HTMLDOC3_THIS(iface);
99 FIXME("(%p)->(%x)\n", This, fForce);
103 static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR text,
104 IHTMLDOMNode **newTextNode)
106 HTMLDocument *This = HTMLDOC3_THIS(iface);
112 TRACE("(%p)->(%s %p)\n", This, debugstr_w(text), newTextNode);
114 if(!This->doc_node->nsdoc) {
115 WARN("NULL nsdoc\n");
119 nsAString_InitDepend(&text_str, text);
120 nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc_node->nsdoc, &text_str, &nstext);
121 nsAString_Finish(&text_str);
122 if(NS_FAILED(nsres)) {
123 ERR("CreateTextNode failed: %08x\n", nsres);
127 node = HTMLDOMTextNode_Create(This->doc_node, (nsIDOMNode*)nstext);
128 nsIDOMElement_Release(nstext);
130 *newTextNode = HTMLDOMNODE(node);
131 IHTMLDOMNode_AddRef(HTMLDOMNODE(node));
135 static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, IHTMLElement **p)
137 HTMLDocument *This = HTMLDOC3_THIS(iface);
138 nsIDOMElement *nselem = NULL;
143 TRACE("(%p)->(%p)\n", This, p);
145 if(This->window->readystate == READYSTATE_UNINITIALIZED) {
150 if(!This->doc_node->nsdoc) {
151 WARN("NULL nsdoc\n");
155 nsres = nsIDOMHTMLDocument_GetDocumentElement(This->doc_node->nsdoc, &nselem);
156 if(NS_FAILED(nsres)) {
157 ERR("GetDocumentElement failed: %08x\n", nsres);
166 hres = get_node(This->doc_node, (nsIDOMNode *)nselem, TRUE, &node);
167 nsIDOMElement_Release(nselem);
171 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)p);
174 static HRESULT WINAPI HTMLDocument3_uniqueID(IHTMLDocument3 *iface, BSTR *p)
176 HTMLDocument *This = HTMLDOC3_THIS(iface);
177 FIXME("(%p)->(%p)\n", This, p);
181 static HRESULT WINAPI HTMLDocument3_attachEvent(IHTMLDocument3 *iface, BSTR event,
182 IDispatch* pDisp, VARIANT_BOOL *pfResult)
184 HTMLDocument *This = HTMLDOC3_THIS(iface);
186 TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
188 return attach_event(&This->doc_node->node.event_target, This->doc_node->node.nsnode, This, event, pDisp, pfResult);
191 static HRESULT WINAPI HTMLDocument3_detachEvent(IHTMLDocument3 *iface, BSTR event,
194 HTMLDocument *This = HTMLDOC3_THIS(iface);
196 TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp);
198 return detach_event(This->doc_node->node.event_target, This, event, pDisp);
201 static HRESULT WINAPI HTMLDocument3_put_onrowsdelete(IHTMLDocument3 *iface, VARIANT v)
203 HTMLDocument *This = HTMLDOC3_THIS(iface);
204 FIXME("(%p)->()\n", This);
208 static HRESULT WINAPI HTMLDocument3_get_onrowsdelete(IHTMLDocument3 *iface, VARIANT *p)
210 HTMLDocument *This = HTMLDOC3_THIS(iface);
211 FIXME("(%p)->(%p)\n", This, p);
215 static HRESULT WINAPI HTMLDocument3_put_onrowsinserted(IHTMLDocument3 *iface, VARIANT v)
217 HTMLDocument *This = HTMLDOC3_THIS(iface);
218 FIXME("(%p)->()\n", This);
222 static HRESULT WINAPI HTMLDocument3_get_onrowsinserted(IHTMLDocument3 *iface, VARIANT *p)
224 HTMLDocument *This = HTMLDOC3_THIS(iface);
225 FIXME("(%p)->(%p)\n", This, p);
229 static HRESULT WINAPI HTMLDocument3_put_oncellchange(IHTMLDocument3 *iface, VARIANT v)
231 HTMLDocument *This = HTMLDOC3_THIS(iface);
232 FIXME("(%p)->()\n", This);
236 static HRESULT WINAPI HTMLDocument3_get_oncellchange(IHTMLDocument3 *iface, VARIANT *p)
238 HTMLDocument *This = HTMLDOC3_THIS(iface);
239 FIXME("(%p)->(%p)\n", This, p);
243 static HRESULT WINAPI HTMLDocument3_put_ondatasetchanged(IHTMLDocument3 *iface, VARIANT v)
245 HTMLDocument *This = HTMLDOC3_THIS(iface);
246 FIXME("(%p)->()\n", This);
250 static HRESULT WINAPI HTMLDocument3_get_ondatasetchanged(IHTMLDocument3 *iface, VARIANT *p)
252 HTMLDocument *This = HTMLDOC3_THIS(iface);
253 FIXME("(%p)->(%p)\n", This, p);
257 static HRESULT WINAPI HTMLDocument3_put_ondataavailable(IHTMLDocument3 *iface, VARIANT v)
259 HTMLDocument *This = HTMLDOC3_THIS(iface);
260 FIXME("(%p)->()\n", This);
264 static HRESULT WINAPI HTMLDocument3_get_ondataavailable(IHTMLDocument3 *iface, VARIANT *p)
266 HTMLDocument *This = HTMLDOC3_THIS(iface);
267 FIXME("(%p)->(%p)\n", This, p);
271 static HRESULT WINAPI HTMLDocument3_put_ondatasetcomplete(IHTMLDocument3 *iface, VARIANT v)
273 HTMLDocument *This = HTMLDOC3_THIS(iface);
274 FIXME("(%p)->()\n", This);
278 static HRESULT WINAPI HTMLDocument3_get_ondatasetcomplete(IHTMLDocument3 *iface, VARIANT *p)
280 HTMLDocument *This = HTMLDOC3_THIS(iface);
281 FIXME("(%p)->(%p)\n", This, p);
285 static HRESULT WINAPI HTMLDocument3_put_onpropertychange(IHTMLDocument3 *iface, VARIANT v)
287 HTMLDocument *This = HTMLDOC3_THIS(iface);
288 FIXME("(%p)->()\n", This);
292 static HRESULT WINAPI HTMLDocument3_get_onpropertychange(IHTMLDocument3 *iface, VARIANT *p)
294 HTMLDocument *This = HTMLDOC3_THIS(iface);
295 FIXME("(%p)->(%p)\n", This, p);
299 static HRESULT WINAPI HTMLDocument3_put_dir(IHTMLDocument3 *iface, BSTR v)
301 HTMLDocument *This = HTMLDOC3_THIS(iface);
302 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
306 static HRESULT WINAPI HTMLDocument3_get_dir(IHTMLDocument3 *iface, BSTR *p)
308 HTMLDocument *This = HTMLDOC3_THIS(iface);
309 FIXME("(%p)->(%p)\n", This, p);
313 static HRESULT WINAPI HTMLDocument3_put_oncontextmenu(IHTMLDocument3 *iface, VARIANT v)
315 HTMLDocument *This = HTMLDOC3_THIS(iface);
317 TRACE("(%p)->()\n", This);
319 return set_doc_event(This, EVENTID_CONTEXTMENU, &v);
322 static HRESULT WINAPI HTMLDocument3_get_oncontextmenu(IHTMLDocument3 *iface, VARIANT *p)
324 HTMLDocument *This = HTMLDOC3_THIS(iface);
326 TRACE("(%p)->(%p)\n", This, p);
328 return get_doc_event(This, EVENTID_CONTEXTMENU, p);
331 static HRESULT WINAPI HTMLDocument3_put_onstop(IHTMLDocument3 *iface, VARIANT v)
333 HTMLDocument *This = HTMLDOC3_THIS(iface);
334 FIXME("(%p)->()\n", This);
338 static HRESULT WINAPI HTMLDocument3_get_onstop(IHTMLDocument3 *iface, VARIANT *p)
340 HTMLDocument *This = HTMLDOC3_THIS(iface);
341 FIXME("(%p)->(%p)\n", This, p);
345 static HRESULT WINAPI HTMLDocument3_createDocumentFragment(IHTMLDocument3 *iface,
346 IHTMLDocument2 **ppNewDoc)
348 HTMLDocument *This = HTMLDOC3_THIS(iface);
349 nsIDOMDocumentFragment *doc_frag;
350 HTMLDocumentNode *docnode;
354 TRACE("(%p)->(%p)\n", This, ppNewDoc);
356 if(!This->doc_node->nsdoc) {
357 FIXME("NULL nsdoc\n");
361 nsres = nsIDOMHTMLDocument_CreateDocumentFragment(This->doc_node->nsdoc, &doc_frag);
362 if(NS_FAILED(nsres)) {
363 ERR("CreateDocumentFragment failed: %08x\n", nsres);
367 hres = create_document_fragment((nsIDOMNode*)doc_frag, This->doc_node, &docnode);
368 nsIDOMDocumentFragment_Release(doc_frag);
372 *ppNewDoc = HTMLDOC(&docnode->basedoc);
376 static HRESULT WINAPI HTMLDocument3_get_parentDocument(IHTMLDocument3 *iface,
379 HTMLDocument *This = HTMLDOC3_THIS(iface);
380 FIXME("(%p)->(%p)\n", This, p);
384 static HRESULT WINAPI HTMLDocument3_put_enableDownload(IHTMLDocument3 *iface,
387 HTMLDocument *This = HTMLDOC3_THIS(iface);
388 FIXME("(%p)->(%x)\n", This, v);
392 static HRESULT WINAPI HTMLDocument3_get_enableDownload(IHTMLDocument3 *iface,
395 HTMLDocument *This = HTMLDOC3_THIS(iface);
396 FIXME("(%p)->(%p)\n", This, p);
400 static HRESULT WINAPI HTMLDocument3_put_baseUrl(IHTMLDocument3 *iface, BSTR v)
402 HTMLDocument *This = HTMLDOC3_THIS(iface);
403 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
407 static HRESULT WINAPI HTMLDocument3_get_baseUrl(IHTMLDocument3 *iface, BSTR *p)
409 HTMLDocument *This = HTMLDOC3_THIS(iface);
410 FIXME("(%p)->(%p)\n", This, p);
414 static HRESULT WINAPI HTMLDocument3_get_childNodes(IHTMLDocument3 *iface, IDispatch **p)
416 HTMLDocument *This = HTMLDOC3_THIS(iface);
417 FIXME("(%p)->(%p)\n", This, p);
421 static HRESULT WINAPI HTMLDocument3_put_inheritStyleSheets(IHTMLDocument3 *iface,
424 HTMLDocument *This = HTMLDOC3_THIS(iface);
425 FIXME("(%p)->()\n", This);
429 static HRESULT WINAPI HTMLDocument3_get_inheritStyleSheets(IHTMLDocument3 *iface,
432 HTMLDocument *This = HTMLDOC3_THIS(iface);
433 FIXME("(%p)->(%p)\n", This, p);
437 static HRESULT WINAPI HTMLDocument3_put_onbeforeeditfocus(IHTMLDocument3 *iface, VARIANT v)
439 HTMLDocument *This = HTMLDOC3_THIS(iface);
440 FIXME("(%p)->()\n", This);
444 static HRESULT WINAPI HTMLDocument3_get_onbeforeeditfocus(IHTMLDocument3 *iface, VARIANT *p)
446 HTMLDocument *This = HTMLDOC3_THIS(iface);
447 FIXME("(%p)->(%p)\n", This, p);
451 static HRESULT WINAPI HTMLDocument3_getElementsByName(IHTMLDocument3 *iface, BSTR v,
452 IHTMLElementCollection **ppelColl)
454 HTMLDocument *This = HTMLDOC3_THIS(iface);
455 FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), ppelColl);
460 static HRESULT WINAPI HTMLDocument3_getElementById(IHTMLDocument3 *iface, BSTR v,
463 HTMLDocument *This = HTMLDOC3_THIS(iface);
464 nsIDOMElement *nselem;
466 nsIDOMNode *nsnode, *nsnode_by_id, *nsnode_by_name;
467 nsIDOMNodeList *nsnode_list;
472 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
474 if(!This->doc_node->nsdoc) {
475 WARN("NULL nsdoc\n");
479 nsAString_InitDepend(&id_str, v);
480 /* get element by id attribute */
481 nsres = nsIDOMHTMLDocument_GetElementById(This->doc_node->nsdoc, &id_str, &nselem);
483 ERR("GetElementById failed: %08x\n", nsres);
484 nsAString_Finish(&id_str);
487 nsnode_by_id = (nsIDOMNode*)nselem;
489 /* get first element by name attribute */
490 nsres = nsIDOMHTMLDocument_GetElementsByName(This->doc_node->nsdoc, &id_str, &nsnode_list);
491 nsAString_Finish(&id_str);
493 ERR("getElementsByName failed: %08x\n", nsres);
495 nsIDOMNode_Release(nsnode_by_id);
498 nsIDOMNodeList_Item(nsnode_list, 0, &nsnode_by_name);
499 nsIDOMNodeList_Release(nsnode_list);
502 if(nsnode_by_name && nsnode_by_id) {
506 nsres = nsIDOMNode_QueryInterface(nsnode_by_name, &IID_nsIDOM3Node, (void**)&node3);
507 if(NS_FAILED(nsres)) {
508 FIXME("failed to get nsIDOM3Node interface: 0x%08x\n", nsres);
509 nsIDOMNode_Release(nsnode_by_name);
510 nsIDOMNode_Release(nsnode_by_id);
514 nsres = nsIDOM3Node_CompareDocumentPosition(node3, nsnode_by_id, &pos);
515 nsIDOM3Node_Release(node3);
516 if(NS_FAILED(nsres)) {
517 FIXME("nsIDOM3Node_CompareDocumentPosition failed: 0x%08x\n", nsres);
518 nsIDOMNode_Release(nsnode_by_name);
519 nsIDOMNode_Release(nsnode_by_id);
523 TRACE("CompareDocumentPosition gave: 0x%x\n", pos);
524 if(pos & PRECEDING || pos & CONTAINS) {
525 nsnode = nsnode_by_id;
526 nsIDOMNode_Release(nsnode_by_name);
528 nsnode = nsnode_by_name;
529 nsIDOMNode_Release(nsnode_by_id);
532 nsnode = nsnode_by_name ? nsnode_by_name : nsnode_by_id;
535 hres = get_node(This->doc_node, nsnode, TRUE, &node);
536 nsIDOMNode_Release(nsnode);
539 hres = IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)pel);
549 static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface, BSTR v,
550 IHTMLElementCollection **pelColl)
552 HTMLDocument *This = HTMLDOC3_THIS(iface);
553 nsIDOMNodeList *nslist;
554 nsAString id_str, ns_str;
556 static const WCHAR str[] = {'*',0};
558 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
560 if(!This->doc_node->nsdoc) {
561 WARN("NULL nsdoc\n");
565 nsAString_InitDepend(&id_str, v);
566 nsAString_InitDepend(&ns_str, str);
567 nsres = nsIDOMHTMLDocument_GetElementsByTagNameNS(This->doc_node->nsdoc, &ns_str, &id_str, &nslist);
568 nsAString_Finish(&id_str);
569 nsAString_Finish(&ns_str);
571 ERR("GetElementByName failed: %08x\n", nsres);
575 *pelColl = (IHTMLElementCollection*)create_collection_from_nodelist(This->doc_node, (IUnknown*)HTMLDOC3(This), nslist);
576 nsIDOMNodeList_Release(nslist);
583 static const IHTMLDocument3Vtbl HTMLDocument3Vtbl = {
584 HTMLDocument3_QueryInterface,
585 HTMLDocument3_AddRef,
586 HTMLDocument3_Release,
587 HTMLDocument3_GetTypeInfoCount,
588 HTMLDocument3_GetTypeInfo,
589 HTMLDocument3_GetIDsOfNames,
590 HTMLDocument3_Invoke,
591 HTMLDocument3_releaseCapture,
592 HTMLDocument3_recalc,
593 HTMLDocument3_createTextNode,
594 HTMLDocument3_get_documentElement,
595 HTMLDocument3_uniqueID,
596 HTMLDocument3_attachEvent,
597 HTMLDocument3_detachEvent,
598 HTMLDocument3_put_onrowsdelete,
599 HTMLDocument3_get_onrowsdelete,
600 HTMLDocument3_put_onrowsinserted,
601 HTMLDocument3_get_onrowsinserted,
602 HTMLDocument3_put_oncellchange,
603 HTMLDocument3_get_oncellchange,
604 HTMLDocument3_put_ondatasetchanged,
605 HTMLDocument3_get_ondatasetchanged,
606 HTMLDocument3_put_ondataavailable,
607 HTMLDocument3_get_ondataavailable,
608 HTMLDocument3_put_ondatasetcomplete,
609 HTMLDocument3_get_ondatasetcomplete,
610 HTMLDocument3_put_onpropertychange,
611 HTMLDocument3_get_onpropertychange,
612 HTMLDocument3_put_dir,
613 HTMLDocument3_get_dir,
614 HTMLDocument3_put_oncontextmenu,
615 HTMLDocument3_get_oncontextmenu,
616 HTMLDocument3_put_onstop,
617 HTMLDocument3_get_onstop,
618 HTMLDocument3_createDocumentFragment,
619 HTMLDocument3_get_parentDocument,
620 HTMLDocument3_put_enableDownload,
621 HTMLDocument3_get_enableDownload,
622 HTMLDocument3_put_baseUrl,
623 HTMLDocument3_get_baseUrl,
624 HTMLDocument3_get_childNodes,
625 HTMLDocument3_put_inheritStyleSheets,
626 HTMLDocument3_get_inheritStyleSheets,
627 HTMLDocument3_put_onbeforeeditfocus,
628 HTMLDocument3_get_onbeforeeditfocus,
629 HTMLDocument3_getElementsByName,
630 HTMLDocument3_getElementById,
631 HTMLDocument3_getElementsByTagName
634 #define HTMLDOC4_THIS(iface) DEFINE_THIS(HTMLDocument, HTMLDocument4, iface)
636 static HRESULT WINAPI HTMLDocument4_QueryInterface(IHTMLDocument4 *iface,
637 REFIID riid, void **ppv)
639 HTMLDocument *This = HTMLDOC4_THIS(iface);
640 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
643 static ULONG WINAPI HTMLDocument4_AddRef(IHTMLDocument4 *iface)
645 HTMLDocument *This = HTMLDOC4_THIS(iface);
646 return IHTMLDocument2_AddRef(HTMLDOC(This));
649 static ULONG WINAPI HTMLDocument4_Release(IHTMLDocument4 *iface)
651 HTMLDocument *This = HTMLDOC4_THIS(iface);
652 return IHTMLDocument2_Release(HTMLDOC(This));
655 static HRESULT WINAPI HTMLDocument4_GetTypeInfoCount(IHTMLDocument4 *iface, UINT *pctinfo)
657 HTMLDocument *This = HTMLDOC4_THIS(iface);
658 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo);
661 static HRESULT WINAPI HTMLDocument4_GetTypeInfo(IHTMLDocument4 *iface, UINT iTInfo,
662 LCID lcid, ITypeInfo **ppTInfo)
664 HTMLDocument *This = HTMLDOC4_THIS(iface);
665 return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo);
668 static HRESULT WINAPI HTMLDocument4_GetIDsOfNames(IHTMLDocument4 *iface, REFIID riid,
669 LPOLESTR *rgszNames, UINT cNames,
670 LCID lcid, DISPID *rgDispId)
672 HTMLDocument *This = HTMLDOC4_THIS(iface);
673 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId);
676 static HRESULT WINAPI HTMLDocument4_Invoke(IHTMLDocument4 *iface, DISPID dispIdMember,
677 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
678 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
680 HTMLDocument *This = HTMLDOC4_THIS(iface);
681 return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams,
682 pVarResult, pExcepInfo, puArgErr);
685 static HRESULT WINAPI HTMLDocument4_focus(IHTMLDocument4 *iface)
687 HTMLDocument *This = HTMLDOC4_THIS(iface);
688 nsIDOMNSHTMLElement *nselem;
689 nsIDOMHTMLElement *nsbody;
692 TRACE("(%p)->()\n", This);
694 nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody);
695 if(NS_FAILED(nsres) || !nsbody) {
696 ERR("GetBody failed: %08x\n", nsres);
700 nsres = nsIDOMHTMLElement_QueryInterface(nsbody, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
701 nsIDOMHTMLElement_Release(nsbody);
702 if(NS_FAILED(nsres)) {
703 ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
707 nsres = nsIDOMNSHTMLElement_Focus(nselem);
708 nsIDOMNSHTMLElement_Release(nselem);
709 if(NS_FAILED(nsres)) {
710 ERR("Focus failed: %08x\n", nsres);
717 static HRESULT WINAPI HTMLDocument4_hasFocus(IHTMLDocument4 *iface, VARIANT_BOOL *pfFocus)
719 HTMLDocument *This = HTMLDOC4_THIS(iface);
720 FIXME("(%p)->(%p)\n", This, pfFocus);
724 static HRESULT WINAPI HTMLDocument4_put_onselectionchange(IHTMLDocument4 *iface, VARIANT v)
726 HTMLDocument *This = HTMLDOC4_THIS(iface);
727 FIXME("(%p)->(v)\n", This);
731 static HRESULT WINAPI HTMLDocument4_get_onselectionchange(IHTMLDocument4 *iface, VARIANT *p)
733 HTMLDocument *This = HTMLDOC4_THIS(iface);
734 FIXME("(%p)->(%p)\n", This, p);
738 static HRESULT WINAPI HTMLDocument4_get_namespace(IHTMLDocument4 *iface, IDispatch **p)
740 HTMLDocument *This = HTMLDOC4_THIS(iface);
741 FIXME("(%p)->(%p)\n", This, p);
745 static HRESULT WINAPI HTMLDocument4_createDocumentFromUrl(IHTMLDocument4 *iface, BSTR bstrUrl,
746 BSTR bstrOptions, IHTMLDocument2 **newDoc)
748 HTMLDocument *This = HTMLDOC4_THIS(iface);
749 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(bstrUrl), debugstr_w(bstrOptions), newDoc);
753 static HRESULT WINAPI HTMLDocument4_put_media(IHTMLDocument4 *iface, BSTR v)
755 HTMLDocument *This = HTMLDOC4_THIS(iface);
756 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
760 static HRESULT WINAPI HTMLDocument4_get_media(IHTMLDocument4 *iface, BSTR *p)
762 HTMLDocument *This = HTMLDOC4_THIS(iface);
763 FIXME("(%p)->(%p)\n", This, p);
767 static HRESULT WINAPI HTMLDocument4_createEventObject(IHTMLDocument4 *iface,
768 VARIANT *pvarEventObject, IHTMLEventObj **ppEventObj)
770 HTMLDocument *This = HTMLDOC4_THIS(iface);
771 FIXME("(%p)->(%p %p)\n", This, pvarEventObject, ppEventObj);
775 static HRESULT WINAPI HTMLDocument4_fireEvent(IHTMLDocument4 *iface, BSTR bstrEventName,
776 VARIANT *pvarEventObject, VARIANT_BOOL *pfCanceled)
778 HTMLDocument *This = HTMLDOC4_THIS(iface);
779 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(bstrEventName), pvarEventObject, pfCanceled);
783 static HRESULT WINAPI HTMLDocument4_createRenderStyle(IHTMLDocument4 *iface, BSTR v,
784 IHTMLRenderStyle **ppIHTMLRenderStyle)
786 HTMLDocument *This = HTMLDOC4_THIS(iface);
787 FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), ppIHTMLRenderStyle);
791 static HRESULT WINAPI HTMLDocument4_put_oncontrolselect(IHTMLDocument4 *iface, VARIANT v)
793 HTMLDocument *This = HTMLDOC4_THIS(iface);
794 FIXME("(%p)->(v)\n", This);
798 static HRESULT WINAPI HTMLDocument4_get_oncontrolselect(IHTMLDocument4 *iface, VARIANT *p)
800 HTMLDocument *This = HTMLDOC4_THIS(iface);
801 FIXME("(%p)->(%p)\n", This, p);
805 static HRESULT WINAPI HTMLDocument4_get_URLEncoded(IHTMLDocument4 *iface, BSTR *p)
807 HTMLDocument *This = HTMLDOC4_THIS(iface);
808 FIXME("(%p)->(%p)\n", This, p);
814 static const IHTMLDocument4Vtbl HTMLDocument4Vtbl = {
815 HTMLDocument4_QueryInterface,
816 HTMLDocument4_AddRef,
817 HTMLDocument4_Release,
818 HTMLDocument4_GetTypeInfoCount,
819 HTMLDocument4_GetTypeInfo,
820 HTMLDocument4_GetIDsOfNames,
821 HTMLDocument4_Invoke,
823 HTMLDocument4_hasFocus,
824 HTMLDocument4_put_onselectionchange,
825 HTMLDocument4_get_onselectionchange,
826 HTMLDocument4_get_namespace,
827 HTMLDocument4_createDocumentFromUrl,
828 HTMLDocument4_put_media,
829 HTMLDocument4_get_media,
830 HTMLDocument4_createEventObject,
831 HTMLDocument4_fireEvent,
832 HTMLDocument4_createRenderStyle,
833 HTMLDocument4_put_oncontrolselect,
834 HTMLDocument4_get_oncontrolselect,
835 HTMLDocument4_get_URLEncoded
838 void HTMLDocument_HTMLDocument3_Init(HTMLDocument *This)
840 This->lpHTMLDocument3Vtbl = &HTMLDocument3Vtbl;
841 This->lpHTMLDocument4Vtbl = &HTMLDocument4Vtbl;