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 static inline HTMLDocument *impl_from_IHTMLDocument3(IHTMLDocument3 *iface)
40 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument3_iface);
43 static HRESULT WINAPI HTMLDocument3_QueryInterface(IHTMLDocument3 *iface,
44 REFIID riid, void **ppv)
46 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
47 return htmldoc_query_interface(This, riid, ppv);
50 static ULONG WINAPI HTMLDocument3_AddRef(IHTMLDocument3 *iface)
52 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
53 return htmldoc_addref(This);
56 static ULONG WINAPI HTMLDocument3_Release(IHTMLDocument3 *iface)
58 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
59 return htmldoc_release(This);
62 static HRESULT WINAPI HTMLDocument3_GetTypeInfoCount(IHTMLDocument3 *iface, UINT *pctinfo)
64 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
65 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo);
68 static HRESULT WINAPI HTMLDocument3_GetTypeInfo(IHTMLDocument3 *iface, UINT iTInfo,
69 LCID lcid, ITypeInfo **ppTInfo)
71 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
72 return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo);
75 static HRESULT WINAPI HTMLDocument3_GetIDsOfNames(IHTMLDocument3 *iface, REFIID riid,
76 LPOLESTR *rgszNames, UINT cNames,
77 LCID lcid, DISPID *rgDispId)
79 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
80 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId);
83 static HRESULT WINAPI HTMLDocument3_Invoke(IHTMLDocument3 *iface, DISPID dispIdMember,
84 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
85 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
87 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
88 return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams,
89 pVarResult, pExcepInfo, puArgErr);
92 static HRESULT WINAPI HTMLDocument3_releaseCapture(IHTMLDocument3 *iface)
94 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
95 FIXME("(%p)\n", This);
99 static HRESULT WINAPI HTMLDocument3_recalc(IHTMLDocument3 *iface, VARIANT_BOOL fForce)
101 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
102 FIXME("(%p)->(%x)\n", This, fForce);
106 static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR text,
107 IHTMLDOMNode **newTextNode)
109 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
116 TRACE("(%p)->(%s %p)\n", This, debugstr_w(text), newTextNode);
118 if(!This->doc_node->nsdoc) {
119 WARN("NULL nsdoc\n");
123 nsAString_InitDepend(&text_str, text);
124 nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc_node->nsdoc, &text_str, &nstext);
125 nsAString_Finish(&text_str);
126 if(NS_FAILED(nsres)) {
127 ERR("CreateTextNode failed: %08x\n", nsres);
131 hres = HTMLDOMTextNode_Create(This->doc_node, (nsIDOMNode*)nstext, &node);
132 nsIDOMElement_Release(nstext);
136 *newTextNode = HTMLDOMNODE(node);
137 IHTMLDOMNode_AddRef(HTMLDOMNODE(node));
141 static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, IHTMLElement **p)
143 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
144 nsIDOMElement *nselem = NULL;
149 TRACE("(%p)->(%p)\n", This, p);
151 if(This->window->readystate == READYSTATE_UNINITIALIZED) {
156 if(!This->doc_node->nsdoc) {
157 WARN("NULL nsdoc\n");
161 nsres = nsIDOMHTMLDocument_GetDocumentElement(This->doc_node->nsdoc, &nselem);
162 if(NS_FAILED(nsres)) {
163 ERR("GetDocumentElement failed: %08x\n", nsres);
172 hres = get_node(This->doc_node, (nsIDOMNode *)nselem, TRUE, &node);
173 nsIDOMElement_Release(nselem);
177 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)p);
180 static HRESULT WINAPI HTMLDocument3_uniqueID(IHTMLDocument3 *iface, BSTR *p)
182 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
183 FIXME("(%p)->(%p)\n", This, p);
187 static HRESULT WINAPI HTMLDocument3_attachEvent(IHTMLDocument3 *iface, BSTR event,
188 IDispatch* pDisp, VARIANT_BOOL *pfResult)
190 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
192 TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
194 return attach_event(&This->doc_node->node.event_target, This->doc_node->node.nsnode, This, event, pDisp, pfResult);
197 static HRESULT WINAPI HTMLDocument3_detachEvent(IHTMLDocument3 *iface, BSTR event,
200 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
202 TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp);
204 return detach_event(This->doc_node->node.event_target, This, event, pDisp);
207 static HRESULT WINAPI HTMLDocument3_put_onrowsdelete(IHTMLDocument3 *iface, VARIANT v)
209 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
210 FIXME("(%p)->()\n", This);
214 static HRESULT WINAPI HTMLDocument3_get_onrowsdelete(IHTMLDocument3 *iface, VARIANT *p)
216 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
217 FIXME("(%p)->(%p)\n", This, p);
221 static HRESULT WINAPI HTMLDocument3_put_onrowsinserted(IHTMLDocument3 *iface, VARIANT v)
223 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
224 FIXME("(%p)->()\n", This);
228 static HRESULT WINAPI HTMLDocument3_get_onrowsinserted(IHTMLDocument3 *iface, VARIANT *p)
230 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
231 FIXME("(%p)->(%p)\n", This, p);
235 static HRESULT WINAPI HTMLDocument3_put_oncellchange(IHTMLDocument3 *iface, VARIANT v)
237 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
238 FIXME("(%p)->()\n", This);
242 static HRESULT WINAPI HTMLDocument3_get_oncellchange(IHTMLDocument3 *iface, VARIANT *p)
244 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
245 FIXME("(%p)->(%p)\n", This, p);
249 static HRESULT WINAPI HTMLDocument3_put_ondatasetchanged(IHTMLDocument3 *iface, VARIANT v)
251 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
252 FIXME("(%p)->()\n", This);
256 static HRESULT WINAPI HTMLDocument3_get_ondatasetchanged(IHTMLDocument3 *iface, VARIANT *p)
258 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
259 FIXME("(%p)->(%p)\n", This, p);
263 static HRESULT WINAPI HTMLDocument3_put_ondataavailable(IHTMLDocument3 *iface, VARIANT v)
265 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
266 FIXME("(%p)->()\n", This);
270 static HRESULT WINAPI HTMLDocument3_get_ondataavailable(IHTMLDocument3 *iface, VARIANT *p)
272 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
273 FIXME("(%p)->(%p)\n", This, p);
277 static HRESULT WINAPI HTMLDocument3_put_ondatasetcomplete(IHTMLDocument3 *iface, VARIANT v)
279 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
280 FIXME("(%p)->()\n", This);
284 static HRESULT WINAPI HTMLDocument3_get_ondatasetcomplete(IHTMLDocument3 *iface, VARIANT *p)
286 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
287 FIXME("(%p)->(%p)\n", This, p);
291 static HRESULT WINAPI HTMLDocument3_put_onpropertychange(IHTMLDocument3 *iface, VARIANT v)
293 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
294 FIXME("(%p)->()\n", This);
298 static HRESULT WINAPI HTMLDocument3_get_onpropertychange(IHTMLDocument3 *iface, VARIANT *p)
300 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
301 FIXME("(%p)->(%p)\n", This, p);
305 static HRESULT WINAPI HTMLDocument3_put_dir(IHTMLDocument3 *iface, BSTR v)
307 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
308 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
312 static HRESULT WINAPI HTMLDocument3_get_dir(IHTMLDocument3 *iface, BSTR *p)
314 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
315 FIXME("(%p)->(%p)\n", This, p);
319 static HRESULT WINAPI HTMLDocument3_put_oncontextmenu(IHTMLDocument3 *iface, VARIANT v)
321 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
323 TRACE("(%p)->()\n", This);
325 return set_doc_event(This, EVENTID_CONTEXTMENU, &v);
328 static HRESULT WINAPI HTMLDocument3_get_oncontextmenu(IHTMLDocument3 *iface, VARIANT *p)
330 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
332 TRACE("(%p)->(%p)\n", This, p);
334 return get_doc_event(This, EVENTID_CONTEXTMENU, p);
337 static HRESULT WINAPI HTMLDocument3_put_onstop(IHTMLDocument3 *iface, VARIANT v)
339 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
340 FIXME("(%p)->()\n", This);
344 static HRESULT WINAPI HTMLDocument3_get_onstop(IHTMLDocument3 *iface, VARIANT *p)
346 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
347 FIXME("(%p)->(%p)\n", This, p);
351 static HRESULT WINAPI HTMLDocument3_createDocumentFragment(IHTMLDocument3 *iface,
352 IHTMLDocument2 **ppNewDoc)
354 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
355 nsIDOMDocumentFragment *doc_frag;
356 HTMLDocumentNode *docnode;
360 TRACE("(%p)->(%p)\n", This, ppNewDoc);
362 if(!This->doc_node->nsdoc) {
363 FIXME("NULL nsdoc\n");
367 nsres = nsIDOMHTMLDocument_CreateDocumentFragment(This->doc_node->nsdoc, &doc_frag);
368 if(NS_FAILED(nsres)) {
369 ERR("CreateDocumentFragment failed: %08x\n", nsres);
373 hres = create_document_fragment((nsIDOMNode*)doc_frag, This->doc_node, &docnode);
374 nsIDOMDocumentFragment_Release(doc_frag);
378 *ppNewDoc = &docnode->basedoc.IHTMLDocument2_iface;
382 static HRESULT WINAPI HTMLDocument3_get_parentDocument(IHTMLDocument3 *iface,
385 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
386 FIXME("(%p)->(%p)\n", This, p);
390 static HRESULT WINAPI HTMLDocument3_put_enableDownload(IHTMLDocument3 *iface,
393 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
394 FIXME("(%p)->(%x)\n", This, v);
398 static HRESULT WINAPI HTMLDocument3_get_enableDownload(IHTMLDocument3 *iface,
401 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
402 FIXME("(%p)->(%p)\n", This, p);
406 static HRESULT WINAPI HTMLDocument3_put_baseUrl(IHTMLDocument3 *iface, BSTR v)
408 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
409 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
413 static HRESULT WINAPI HTMLDocument3_get_baseUrl(IHTMLDocument3 *iface, BSTR *p)
415 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
416 FIXME("(%p)->(%p)\n", This, p);
420 static HRESULT WINAPI HTMLDocument3_get_childNodes(IHTMLDocument3 *iface, IDispatch **p)
422 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
423 FIXME("(%p)->(%p)\n", This, p);
427 static HRESULT WINAPI HTMLDocument3_put_inheritStyleSheets(IHTMLDocument3 *iface,
430 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
431 FIXME("(%p)->()\n", This);
435 static HRESULT WINAPI HTMLDocument3_get_inheritStyleSheets(IHTMLDocument3 *iface,
438 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
439 FIXME("(%p)->(%p)\n", This, p);
443 static HRESULT WINAPI HTMLDocument3_put_onbeforeeditfocus(IHTMLDocument3 *iface, VARIANT v)
445 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
446 FIXME("(%p)->()\n", This);
450 static HRESULT WINAPI HTMLDocument3_get_onbeforeeditfocus(IHTMLDocument3 *iface, VARIANT *p)
452 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
453 FIXME("(%p)->(%p)\n", This, p);
457 static HRESULT WINAPI HTMLDocument3_getElementsByName(IHTMLDocument3 *iface, BSTR v,
458 IHTMLElementCollection **ppelColl)
460 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
461 FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), ppelColl);
466 static HRESULT WINAPI HTMLDocument3_getElementById(IHTMLDocument3 *iface, BSTR v,
469 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
470 nsIDOMElement *nselem;
472 nsIDOMNode *nsnode, *nsnode_by_id, *nsnode_by_name;
473 nsIDOMNodeList *nsnode_list;
478 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
480 if(!This->doc_node->nsdoc) {
481 WARN("NULL nsdoc\n");
485 nsAString_InitDepend(&id_str, v);
486 /* get element by id attribute */
487 nsres = nsIDOMHTMLDocument_GetElementById(This->doc_node->nsdoc, &id_str, &nselem);
489 ERR("GetElementById failed: %08x\n", nsres);
490 nsAString_Finish(&id_str);
493 nsnode_by_id = (nsIDOMNode*)nselem;
495 /* get first element by name attribute */
496 nsres = nsIDOMHTMLDocument_GetElementsByName(This->doc_node->nsdoc, &id_str, &nsnode_list);
497 nsAString_Finish(&id_str);
499 ERR("getElementsByName failed: %08x\n", nsres);
501 nsIDOMNode_Release(nsnode_by_id);
504 nsIDOMNodeList_Item(nsnode_list, 0, &nsnode_by_name);
505 nsIDOMNodeList_Release(nsnode_list);
508 if(nsnode_by_name && nsnode_by_id) {
512 nsres = nsIDOMNode_QueryInterface(nsnode_by_name, &IID_nsIDOM3Node, (void**)&node3);
513 if(NS_FAILED(nsres)) {
514 FIXME("failed to get nsIDOM3Node interface: 0x%08x\n", nsres);
515 nsIDOMNode_Release(nsnode_by_name);
516 nsIDOMNode_Release(nsnode_by_id);
520 nsres = nsIDOM3Node_CompareDocumentPosition(node3, nsnode_by_id, &pos);
521 nsIDOM3Node_Release(node3);
522 if(NS_FAILED(nsres)) {
523 FIXME("nsIDOM3Node_CompareDocumentPosition failed: 0x%08x\n", nsres);
524 nsIDOMNode_Release(nsnode_by_name);
525 nsIDOMNode_Release(nsnode_by_id);
529 TRACE("CompareDocumentPosition gave: 0x%x\n", pos);
530 if(pos & PRECEDING || pos & CONTAINS) {
531 nsnode = nsnode_by_id;
532 nsIDOMNode_Release(nsnode_by_name);
534 nsnode = nsnode_by_name;
535 nsIDOMNode_Release(nsnode_by_id);
538 nsnode = nsnode_by_name ? nsnode_by_name : nsnode_by_id;
541 hres = get_node(This->doc_node, nsnode, TRUE, &node);
542 nsIDOMNode_Release(nsnode);
545 hres = IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)pel);
555 static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface, BSTR v,
556 IHTMLElementCollection **pelColl)
558 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
559 nsIDOMNodeList *nslist;
560 nsAString id_str, ns_str;
562 static const WCHAR str[] = {'*',0};
564 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
566 if(!This->doc_node->nsdoc) {
567 WARN("NULL nsdoc\n");
571 nsAString_InitDepend(&id_str, v);
572 nsAString_InitDepend(&ns_str, str);
573 nsres = nsIDOMHTMLDocument_GetElementsByTagNameNS(This->doc_node->nsdoc, &ns_str, &id_str, &nslist);
574 nsAString_Finish(&id_str);
575 nsAString_Finish(&ns_str);
577 ERR("GetElementByName failed: %08x\n", nsres);
581 *pelColl = create_collection_from_nodelist(This->doc_node,
582 (IUnknown*)&This->IHTMLDocument3_iface, nslist);
583 nsIDOMNodeList_Release(nslist);
588 static const IHTMLDocument3Vtbl HTMLDocument3Vtbl = {
589 HTMLDocument3_QueryInterface,
590 HTMLDocument3_AddRef,
591 HTMLDocument3_Release,
592 HTMLDocument3_GetTypeInfoCount,
593 HTMLDocument3_GetTypeInfo,
594 HTMLDocument3_GetIDsOfNames,
595 HTMLDocument3_Invoke,
596 HTMLDocument3_releaseCapture,
597 HTMLDocument3_recalc,
598 HTMLDocument3_createTextNode,
599 HTMLDocument3_get_documentElement,
600 HTMLDocument3_uniqueID,
601 HTMLDocument3_attachEvent,
602 HTMLDocument3_detachEvent,
603 HTMLDocument3_put_onrowsdelete,
604 HTMLDocument3_get_onrowsdelete,
605 HTMLDocument3_put_onrowsinserted,
606 HTMLDocument3_get_onrowsinserted,
607 HTMLDocument3_put_oncellchange,
608 HTMLDocument3_get_oncellchange,
609 HTMLDocument3_put_ondatasetchanged,
610 HTMLDocument3_get_ondatasetchanged,
611 HTMLDocument3_put_ondataavailable,
612 HTMLDocument3_get_ondataavailable,
613 HTMLDocument3_put_ondatasetcomplete,
614 HTMLDocument3_get_ondatasetcomplete,
615 HTMLDocument3_put_onpropertychange,
616 HTMLDocument3_get_onpropertychange,
617 HTMLDocument3_put_dir,
618 HTMLDocument3_get_dir,
619 HTMLDocument3_put_oncontextmenu,
620 HTMLDocument3_get_oncontextmenu,
621 HTMLDocument3_put_onstop,
622 HTMLDocument3_get_onstop,
623 HTMLDocument3_createDocumentFragment,
624 HTMLDocument3_get_parentDocument,
625 HTMLDocument3_put_enableDownload,
626 HTMLDocument3_get_enableDownload,
627 HTMLDocument3_put_baseUrl,
628 HTMLDocument3_get_baseUrl,
629 HTMLDocument3_get_childNodes,
630 HTMLDocument3_put_inheritStyleSheets,
631 HTMLDocument3_get_inheritStyleSheets,
632 HTMLDocument3_put_onbeforeeditfocus,
633 HTMLDocument3_get_onbeforeeditfocus,
634 HTMLDocument3_getElementsByName,
635 HTMLDocument3_getElementById,
636 HTMLDocument3_getElementsByTagName
639 static inline HTMLDocument *impl_from_IHTMLDocument4(IHTMLDocument4 *iface)
641 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument4_iface);
644 static HRESULT WINAPI HTMLDocument4_QueryInterface(IHTMLDocument4 *iface,
645 REFIID riid, void **ppv)
647 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
648 return htmldoc_query_interface(This, riid, ppv);
651 static ULONG WINAPI HTMLDocument4_AddRef(IHTMLDocument4 *iface)
653 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
654 return htmldoc_addref(This);
657 static ULONG WINAPI HTMLDocument4_Release(IHTMLDocument4 *iface)
659 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
660 return htmldoc_release(This);
663 static HRESULT WINAPI HTMLDocument4_GetTypeInfoCount(IHTMLDocument4 *iface, UINT *pctinfo)
665 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
666 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo);
669 static HRESULT WINAPI HTMLDocument4_GetTypeInfo(IHTMLDocument4 *iface, UINT iTInfo,
670 LCID lcid, ITypeInfo **ppTInfo)
672 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
673 return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo);
676 static HRESULT WINAPI HTMLDocument4_GetIDsOfNames(IHTMLDocument4 *iface, REFIID riid,
677 LPOLESTR *rgszNames, UINT cNames,
678 LCID lcid, DISPID *rgDispId)
680 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
681 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId);
684 static HRESULT WINAPI HTMLDocument4_Invoke(IHTMLDocument4 *iface, DISPID dispIdMember,
685 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
686 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
688 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
689 return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams,
690 pVarResult, pExcepInfo, puArgErr);
693 static HRESULT WINAPI HTMLDocument4_focus(IHTMLDocument4 *iface)
695 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
696 nsIDOMNSHTMLElement *nselem;
697 nsIDOMHTMLElement *nsbody;
700 TRACE("(%p)->()\n", This);
702 nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody);
703 if(NS_FAILED(nsres) || !nsbody) {
704 ERR("GetBody failed: %08x\n", nsres);
708 nsres = nsIDOMHTMLElement_QueryInterface(nsbody, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
709 nsIDOMHTMLElement_Release(nsbody);
710 if(NS_FAILED(nsres)) {
711 ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
715 nsres = nsIDOMNSHTMLElement_Focus(nselem);
716 nsIDOMNSHTMLElement_Release(nselem);
717 if(NS_FAILED(nsres)) {
718 ERR("Focus failed: %08x\n", nsres);
725 static HRESULT WINAPI HTMLDocument4_hasFocus(IHTMLDocument4 *iface, VARIANT_BOOL *pfFocus)
727 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
728 FIXME("(%p)->(%p)\n", This, pfFocus);
732 static HRESULT WINAPI HTMLDocument4_put_onselectionchange(IHTMLDocument4 *iface, VARIANT v)
734 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
735 FIXME("(%p)->(v)\n", This);
739 static HRESULT WINAPI HTMLDocument4_get_onselectionchange(IHTMLDocument4 *iface, VARIANT *p)
741 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
742 FIXME("(%p)->(%p)\n", This, p);
746 static HRESULT WINAPI HTMLDocument4_get_namespace(IHTMLDocument4 *iface, IDispatch **p)
748 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
749 FIXME("(%p)->(%p)\n", This, p);
753 static HRESULT WINAPI HTMLDocument4_createDocumentFromUrl(IHTMLDocument4 *iface, BSTR bstrUrl,
754 BSTR bstrOptions, IHTMLDocument2 **newDoc)
756 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
757 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(bstrUrl), debugstr_w(bstrOptions), newDoc);
761 static HRESULT WINAPI HTMLDocument4_put_media(IHTMLDocument4 *iface, BSTR v)
763 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
764 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
768 static HRESULT WINAPI HTMLDocument4_get_media(IHTMLDocument4 *iface, BSTR *p)
770 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
771 FIXME("(%p)->(%p)\n", This, p);
775 static HRESULT WINAPI HTMLDocument4_createEventObject(IHTMLDocument4 *iface,
776 VARIANT *pvarEventObject, IHTMLEventObj **ppEventObj)
778 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
779 FIXME("(%p)->(%p %p)\n", This, pvarEventObject, ppEventObj);
783 static HRESULT WINAPI HTMLDocument4_fireEvent(IHTMLDocument4 *iface, BSTR bstrEventName,
784 VARIANT *pvarEventObject, VARIANT_BOOL *pfCanceled)
786 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
787 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(bstrEventName), pvarEventObject, pfCanceled);
791 static HRESULT WINAPI HTMLDocument4_createRenderStyle(IHTMLDocument4 *iface, BSTR v,
792 IHTMLRenderStyle **ppIHTMLRenderStyle)
794 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
795 FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), ppIHTMLRenderStyle);
799 static HRESULT WINAPI HTMLDocument4_put_oncontrolselect(IHTMLDocument4 *iface, VARIANT v)
801 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
802 FIXME("(%p)->(v)\n", This);
806 static HRESULT WINAPI HTMLDocument4_get_oncontrolselect(IHTMLDocument4 *iface, VARIANT *p)
808 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
809 FIXME("(%p)->(%p)\n", This, p);
813 static HRESULT WINAPI HTMLDocument4_get_URLEncoded(IHTMLDocument4 *iface, BSTR *p)
815 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
816 FIXME("(%p)->(%p)\n", This, p);
820 static const IHTMLDocument4Vtbl HTMLDocument4Vtbl = {
821 HTMLDocument4_QueryInterface,
822 HTMLDocument4_AddRef,
823 HTMLDocument4_Release,
824 HTMLDocument4_GetTypeInfoCount,
825 HTMLDocument4_GetTypeInfo,
826 HTMLDocument4_GetIDsOfNames,
827 HTMLDocument4_Invoke,
829 HTMLDocument4_hasFocus,
830 HTMLDocument4_put_onselectionchange,
831 HTMLDocument4_get_onselectionchange,
832 HTMLDocument4_get_namespace,
833 HTMLDocument4_createDocumentFromUrl,
834 HTMLDocument4_put_media,
835 HTMLDocument4_get_media,
836 HTMLDocument4_createEventObject,
837 HTMLDocument4_fireEvent,
838 HTMLDocument4_createRenderStyle,
839 HTMLDocument4_put_oncontrolselect,
840 HTMLDocument4_get_oncontrolselect,
841 HTMLDocument4_get_URLEncoded
844 void HTMLDocument_HTMLDocument3_Init(HTMLDocument *This)
846 This->IHTMLDocument3_iface.lpVtbl = &HTMLDocument3Vtbl;
847 This->IHTMLDocument4_iface.lpVtbl = &HTMLDocument4Vtbl;