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 = &node->IHTMLDOMNode_iface;
137 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface);
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(&node->IHTMLDOMNode_iface, &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(&node->IHTMLDOMNode_iface, &IID_IHTMLElement,
556 static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface, BSTR v,
557 IHTMLElementCollection **pelColl)
559 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
560 nsIDOMNodeList *nslist;
561 nsAString id_str, ns_str;
563 static const WCHAR str[] = {'*',0};
565 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
567 if(!This->doc_node->nsdoc) {
568 WARN("NULL nsdoc\n");
572 nsAString_InitDepend(&id_str, v);
573 nsAString_InitDepend(&ns_str, str);
574 nsres = nsIDOMHTMLDocument_GetElementsByTagNameNS(This->doc_node->nsdoc, &ns_str, &id_str, &nslist);
575 nsAString_Finish(&id_str);
576 nsAString_Finish(&ns_str);
578 ERR("GetElementByName failed: %08x\n", nsres);
582 *pelColl = create_collection_from_nodelist(This->doc_node,
583 (IUnknown*)&This->IHTMLDocument3_iface, nslist);
584 nsIDOMNodeList_Release(nslist);
589 static const IHTMLDocument3Vtbl HTMLDocument3Vtbl = {
590 HTMLDocument3_QueryInterface,
591 HTMLDocument3_AddRef,
592 HTMLDocument3_Release,
593 HTMLDocument3_GetTypeInfoCount,
594 HTMLDocument3_GetTypeInfo,
595 HTMLDocument3_GetIDsOfNames,
596 HTMLDocument3_Invoke,
597 HTMLDocument3_releaseCapture,
598 HTMLDocument3_recalc,
599 HTMLDocument3_createTextNode,
600 HTMLDocument3_get_documentElement,
601 HTMLDocument3_uniqueID,
602 HTMLDocument3_attachEvent,
603 HTMLDocument3_detachEvent,
604 HTMLDocument3_put_onrowsdelete,
605 HTMLDocument3_get_onrowsdelete,
606 HTMLDocument3_put_onrowsinserted,
607 HTMLDocument3_get_onrowsinserted,
608 HTMLDocument3_put_oncellchange,
609 HTMLDocument3_get_oncellchange,
610 HTMLDocument3_put_ondatasetchanged,
611 HTMLDocument3_get_ondatasetchanged,
612 HTMLDocument3_put_ondataavailable,
613 HTMLDocument3_get_ondataavailable,
614 HTMLDocument3_put_ondatasetcomplete,
615 HTMLDocument3_get_ondatasetcomplete,
616 HTMLDocument3_put_onpropertychange,
617 HTMLDocument3_get_onpropertychange,
618 HTMLDocument3_put_dir,
619 HTMLDocument3_get_dir,
620 HTMLDocument3_put_oncontextmenu,
621 HTMLDocument3_get_oncontextmenu,
622 HTMLDocument3_put_onstop,
623 HTMLDocument3_get_onstop,
624 HTMLDocument3_createDocumentFragment,
625 HTMLDocument3_get_parentDocument,
626 HTMLDocument3_put_enableDownload,
627 HTMLDocument3_get_enableDownload,
628 HTMLDocument3_put_baseUrl,
629 HTMLDocument3_get_baseUrl,
630 HTMLDocument3_get_childNodes,
631 HTMLDocument3_put_inheritStyleSheets,
632 HTMLDocument3_get_inheritStyleSheets,
633 HTMLDocument3_put_onbeforeeditfocus,
634 HTMLDocument3_get_onbeforeeditfocus,
635 HTMLDocument3_getElementsByName,
636 HTMLDocument3_getElementById,
637 HTMLDocument3_getElementsByTagName
640 static inline HTMLDocument *impl_from_IHTMLDocument4(IHTMLDocument4 *iface)
642 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument4_iface);
645 static HRESULT WINAPI HTMLDocument4_QueryInterface(IHTMLDocument4 *iface,
646 REFIID riid, void **ppv)
648 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
649 return htmldoc_query_interface(This, riid, ppv);
652 static ULONG WINAPI HTMLDocument4_AddRef(IHTMLDocument4 *iface)
654 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
655 return htmldoc_addref(This);
658 static ULONG WINAPI HTMLDocument4_Release(IHTMLDocument4 *iface)
660 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
661 return htmldoc_release(This);
664 static HRESULT WINAPI HTMLDocument4_GetTypeInfoCount(IHTMLDocument4 *iface, UINT *pctinfo)
666 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
667 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo);
670 static HRESULT WINAPI HTMLDocument4_GetTypeInfo(IHTMLDocument4 *iface, UINT iTInfo,
671 LCID lcid, ITypeInfo **ppTInfo)
673 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
674 return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo);
677 static HRESULT WINAPI HTMLDocument4_GetIDsOfNames(IHTMLDocument4 *iface, REFIID riid,
678 LPOLESTR *rgszNames, UINT cNames,
679 LCID lcid, DISPID *rgDispId)
681 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
682 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId);
685 static HRESULT WINAPI HTMLDocument4_Invoke(IHTMLDocument4 *iface, DISPID dispIdMember,
686 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
687 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
689 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
690 return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams,
691 pVarResult, pExcepInfo, puArgErr);
694 static HRESULT WINAPI HTMLDocument4_focus(IHTMLDocument4 *iface)
696 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
697 nsIDOMNSHTMLElement *nselem;
698 nsIDOMHTMLElement *nsbody;
701 TRACE("(%p)->()\n", This);
703 nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody);
704 if(NS_FAILED(nsres) || !nsbody) {
705 ERR("GetBody failed: %08x\n", nsres);
709 nsres = nsIDOMHTMLElement_QueryInterface(nsbody, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
710 nsIDOMHTMLElement_Release(nsbody);
711 if(NS_FAILED(nsres)) {
712 ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
716 nsres = nsIDOMNSHTMLElement_Focus(nselem);
717 nsIDOMNSHTMLElement_Release(nselem);
718 if(NS_FAILED(nsres)) {
719 ERR("Focus failed: %08x\n", nsres);
726 static HRESULT WINAPI HTMLDocument4_hasFocus(IHTMLDocument4 *iface, VARIANT_BOOL *pfFocus)
728 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
729 FIXME("(%p)->(%p)\n", This, pfFocus);
733 static HRESULT WINAPI HTMLDocument4_put_onselectionchange(IHTMLDocument4 *iface, VARIANT v)
735 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
736 FIXME("(%p)->(v)\n", This);
740 static HRESULT WINAPI HTMLDocument4_get_onselectionchange(IHTMLDocument4 *iface, VARIANT *p)
742 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
743 FIXME("(%p)->(%p)\n", This, p);
747 static HRESULT WINAPI HTMLDocument4_get_namespace(IHTMLDocument4 *iface, IDispatch **p)
749 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
750 FIXME("(%p)->(%p)\n", This, p);
754 static HRESULT WINAPI HTMLDocument4_createDocumentFromUrl(IHTMLDocument4 *iface, BSTR bstrUrl,
755 BSTR bstrOptions, IHTMLDocument2 **newDoc)
757 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
758 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(bstrUrl), debugstr_w(bstrOptions), newDoc);
762 static HRESULT WINAPI HTMLDocument4_put_media(IHTMLDocument4 *iface, BSTR v)
764 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
765 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
769 static HRESULT WINAPI HTMLDocument4_get_media(IHTMLDocument4 *iface, BSTR *p)
771 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
772 FIXME("(%p)->(%p)\n", This, p);
776 static HRESULT WINAPI HTMLDocument4_createEventObject(IHTMLDocument4 *iface,
777 VARIANT *pvarEventObject, IHTMLEventObj **ppEventObj)
779 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
780 FIXME("(%p)->(%p %p)\n", This, pvarEventObject, ppEventObj);
784 static HRESULT WINAPI HTMLDocument4_fireEvent(IHTMLDocument4 *iface, BSTR bstrEventName,
785 VARIANT *pvarEventObject, VARIANT_BOOL *pfCanceled)
787 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
788 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(bstrEventName), pvarEventObject, pfCanceled);
792 static HRESULT WINAPI HTMLDocument4_createRenderStyle(IHTMLDocument4 *iface, BSTR v,
793 IHTMLRenderStyle **ppIHTMLRenderStyle)
795 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
796 FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), ppIHTMLRenderStyle);
800 static HRESULT WINAPI HTMLDocument4_put_oncontrolselect(IHTMLDocument4 *iface, VARIANT v)
802 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
803 FIXME("(%p)->(v)\n", This);
807 static HRESULT WINAPI HTMLDocument4_get_oncontrolselect(IHTMLDocument4 *iface, VARIANT *p)
809 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
810 FIXME("(%p)->(%p)\n", This, p);
814 static HRESULT WINAPI HTMLDocument4_get_URLEncoded(IHTMLDocument4 *iface, BSTR *p)
816 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
817 FIXME("(%p)->(%p)\n", This, p);
821 static const IHTMLDocument4Vtbl HTMLDocument4Vtbl = {
822 HTMLDocument4_QueryInterface,
823 HTMLDocument4_AddRef,
824 HTMLDocument4_Release,
825 HTMLDocument4_GetTypeInfoCount,
826 HTMLDocument4_GetTypeInfo,
827 HTMLDocument4_GetIDsOfNames,
828 HTMLDocument4_Invoke,
830 HTMLDocument4_hasFocus,
831 HTMLDocument4_put_onselectionchange,
832 HTMLDocument4_get_onselectionchange,
833 HTMLDocument4_get_namespace,
834 HTMLDocument4_createDocumentFromUrl,
835 HTMLDocument4_put_media,
836 HTMLDocument4_get_media,
837 HTMLDocument4_createEventObject,
838 HTMLDocument4_fireEvent,
839 HTMLDocument4_createRenderStyle,
840 HTMLDocument4_put_oncontrolselect,
841 HTMLDocument4_get_oncontrolselect,
842 HTMLDocument4_get_URLEncoded
845 void HTMLDocument_HTMLDocument3_Init(HTMLDocument *This)
847 This->IHTMLDocument3_iface.lpVtbl = &HTMLDocument3Vtbl;
848 This->IHTMLDocument4_iface.lpVtbl = &HTMLDocument4Vtbl;