2 * Copyright 2005-2009 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
34 #include "wine/debug.h"
36 #include "mshtml_private.h"
37 #include "htmlevent.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
41 #define HTMLDOC_THIS(iface) DEFINE_THIS(HTMLDocument, HTMLDocument2, iface)
43 static HRESULT WINAPI
HTMLDocument_QueryInterface(IHTMLDocument2
*iface
, REFIID riid
, void **ppv
)
45 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
47 return htmldoc_query_interface(This
, riid
, ppv
);
50 static ULONG WINAPI
HTMLDocument_AddRef(IHTMLDocument2
*iface
)
52 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
54 return htmldoc_addref(This
);
57 static ULONG WINAPI
HTMLDocument_Release(IHTMLDocument2
*iface
)
59 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
61 return htmldoc_release(This
);
64 static HRESULT WINAPI
HTMLDocument_GetTypeInfoCount(IHTMLDocument2
*iface
, UINT
*pctinfo
)
66 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
68 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This
), pctinfo
);
71 static HRESULT WINAPI
HTMLDocument_GetTypeInfo(IHTMLDocument2
*iface
, UINT iTInfo
,
72 LCID lcid
, ITypeInfo
**ppTInfo
)
74 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
76 return IDispatchEx_GetTypeInfo(DISPATCHEX(This
), iTInfo
, lcid
, ppTInfo
);
79 static HRESULT WINAPI
HTMLDocument_GetIDsOfNames(IHTMLDocument2
*iface
, REFIID riid
,
80 LPOLESTR
*rgszNames
, UINT cNames
,
81 LCID lcid
, DISPID
*rgDispId
)
83 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
85 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
88 static HRESULT WINAPI
HTMLDocument_Invoke(IHTMLDocument2
*iface
, DISPID dispIdMember
,
89 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
90 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
92 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
94 return IDispatchEx_Invoke(DISPATCHEX(This
), dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
95 pVarResult
, pExcepInfo
, puArgErr
);
98 static HRESULT WINAPI
HTMLDocument_get_Script(IHTMLDocument2
*iface
, IDispatch
**p
)
100 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
102 TRACE("(%p)->(%p)\n", This
, p
);
104 *p
= (IDispatch
*)HTMLWINDOW2(This
->window
);
105 IDispatch_AddRef(*p
);
109 static HRESULT WINAPI
HTMLDocument_get_all(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
111 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
112 nsIDOMElement
*nselem
= NULL
;
115 TRACE("(%p)->(%p)\n", This
, p
);
117 if(!This
->doc_node
->nsdoc
) {
118 WARN("NULL nsdoc\n");
122 nsres
= nsIDOMHTMLDocument_GetDocumentElement(This
->doc_node
->nsdoc
, &nselem
);
123 if(NS_FAILED(nsres
)) {
124 ERR("GetDocumentElement failed: %08x\n", nsres
);
129 *p
= create_all_collection(get_node(This
->doc_node
, (nsIDOMNode
*)nselem
, TRUE
), TRUE
);
130 nsIDOMElement_Release(nselem
);
138 static HRESULT WINAPI
HTMLDocument_get_body(IHTMLDocument2
*iface
, IHTMLElement
**p
)
140 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
141 nsIDOMHTMLElement
*nsbody
= NULL
;
145 TRACE("(%p)->(%p)\n", This
, p
);
147 if(!This
->doc_node
->nsdoc
) {
148 WARN("NULL nsdoc\n");
152 nsres
= nsIDOMHTMLDocument_GetBody(This
->doc_node
->nsdoc
, &nsbody
);
153 if(NS_FAILED(nsres
)) {
154 TRACE("Could not get body: %08x\n", nsres
);
159 node
= get_node(This
->doc_node
, (nsIDOMNode
*)nsbody
, TRUE
);
160 nsIDOMHTMLElement_Release(nsbody
);
162 IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node
), &IID_IHTMLElement
, (void**)p
);
167 TRACE("*p = %p\n", *p
);
171 static HRESULT WINAPI
HTMLDocument_get_activeElement(IHTMLDocument2
*iface
, IHTMLElement
**p
)
173 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
174 FIXME("(%p)->(%p)\n", This
, p
);
178 static HRESULT WINAPI
HTMLDocument_get_images(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
180 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
181 nsIDOMHTMLCollection
*nscoll
= NULL
;
184 TRACE("(%p)->(%p)\n", This
, p
);
191 if(!This
->doc_node
->nsdoc
) {
192 WARN("NULL nsdoc\n");
196 nsres
= nsIDOMHTMLDocument_GetImages(This
->doc_node
->nsdoc
, &nscoll
);
197 if(NS_FAILED(nsres
)) {
198 ERR("GetImages failed: %08x\n", nsres
);
203 *p
= create_collection_from_htmlcol(This
->doc_node
, (IUnknown
*)HTMLDOC(This
), nscoll
);
204 nsIDOMElement_Release(nscoll
);
210 static HRESULT WINAPI
HTMLDocument_get_applets(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
212 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
213 nsIDOMHTMLCollection
*nscoll
= NULL
;
216 TRACE("(%p)->(%p)\n", This
, p
);
223 if(!This
->doc_node
->nsdoc
) {
224 WARN("NULL nsdoc\n");
228 nsres
= nsIDOMHTMLDocument_GetApplets(This
->doc_node
->nsdoc
, &nscoll
);
229 if(NS_FAILED(nsres
)) {
230 ERR("GetApplets failed: %08x\n", nsres
);
235 *p
= create_collection_from_htmlcol(This
->doc_node
, (IUnknown
*)HTMLDOC(This
), nscoll
);
236 nsIDOMElement_Release(nscoll
);
242 static HRESULT WINAPI
HTMLDocument_get_links(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
244 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
245 nsIDOMHTMLCollection
*nscoll
= NULL
;
248 TRACE("(%p)->(%p)\n", This
, p
);
255 if(!This
->doc_node
->nsdoc
) {
256 WARN("NULL nsdoc\n");
260 nsres
= nsIDOMHTMLDocument_GetLinks(This
->doc_node
->nsdoc
, &nscoll
);
261 if(NS_FAILED(nsres
)) {
262 ERR("GetLinks failed: %08x\n", nsres
);
267 *p
= create_collection_from_htmlcol(This
->doc_node
, (IUnknown
*)HTMLDOC(This
), nscoll
);
268 nsIDOMElement_Release(nscoll
);
274 static HRESULT WINAPI
HTMLDocument_get_forms(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
276 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
277 nsIDOMHTMLCollection
*nscoll
= NULL
;
280 TRACE("(%p)->(%p)\n", This
, p
);
287 if(!This
->doc_node
->nsdoc
) {
288 WARN("NULL nsdoc\n");
292 nsres
= nsIDOMHTMLDocument_GetForms(This
->doc_node
->nsdoc
, &nscoll
);
293 if(NS_FAILED(nsres
)) {
294 ERR("GetForms failed: %08x\n", nsres
);
299 *p
= create_collection_from_htmlcol(This
->doc_node
, (IUnknown
*)HTMLDOC(This
), nscoll
);
300 nsIDOMElement_Release(nscoll
);
306 static HRESULT WINAPI
HTMLDocument_get_anchors(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
308 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
309 nsIDOMHTMLCollection
*nscoll
= NULL
;
312 TRACE("(%p)->(%p)\n", This
, p
);
319 if(!This
->doc_node
->nsdoc
) {
320 WARN("NULL nsdoc\n");
324 nsres
= nsIDOMHTMLDocument_GetAnchors(This
->doc_node
->nsdoc
, &nscoll
);
325 if(NS_FAILED(nsres
)) {
326 ERR("GetAnchors failed: %08x\n", nsres
);
331 *p
= create_collection_from_htmlcol(This
->doc_node
, (IUnknown
*)HTMLDOC(This
), nscoll
);
332 nsIDOMElement_Release(nscoll
);
338 static HRESULT WINAPI
HTMLDocument_put_title(IHTMLDocument2
*iface
, BSTR v
)
340 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
344 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
346 if(!This
->doc_node
->nsdoc
) {
347 WARN("NULL nsdoc\n");
351 nsAString_Init(&nsstr
, v
);
352 nsres
= nsIDOMHTMLDocument_SetTitle(This
->doc_node
->nsdoc
, &nsstr
);
353 nsAString_Finish(&nsstr
);
355 ERR("SetTitle failed: %08x\n", nsres
);
360 static HRESULT WINAPI
HTMLDocument_get_title(IHTMLDocument2
*iface
, BSTR
*p
)
362 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
363 const PRUnichar
*ret
;
367 TRACE("(%p)->(%p)\n", This
, p
);
369 if(!This
->doc_node
->nsdoc
) {
370 WARN("NULL nsdoc\n");
375 nsAString_Init(&nsstr
, NULL
);
376 nsres
= nsIDOMHTMLDocument_GetTitle(This
->doc_node
->nsdoc
, &nsstr
);
377 if (NS_SUCCEEDED(nsres
)) {
378 nsAString_GetData(&nsstr
, &ret
);
379 *p
= SysAllocString(ret
);
381 nsAString_Finish(&nsstr
);
383 if(NS_FAILED(nsres
)) {
384 ERR("GetTitle failed: %08x\n", nsres
);
391 static HRESULT WINAPI
HTMLDocument_get_scripts(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
393 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
394 FIXME("(%p)->(%p)\n", This
, p
);
398 static HRESULT WINAPI
HTMLDocument_put_designMode(IHTMLDocument2
*iface
, BSTR v
)
400 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
401 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
405 static HRESULT WINAPI
HTMLDocument_get_designMode(IHTMLDocument2
*iface
, BSTR
*p
)
407 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
408 static WCHAR szOff
[] = {'O','f','f',0};
409 FIXME("(%p)->(%p) always returning Off\n", This
, p
);
414 *p
= SysAllocString(szOff
);
419 static HRESULT WINAPI
HTMLDocument_get_selection(IHTMLDocument2
*iface
, IHTMLSelectionObject
**p
)
421 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
422 nsISelection
*nsselection
;
425 TRACE("(%p)->(%p)\n", This
, p
);
427 nsres
= nsIDOMWindow_GetSelection(This
->window
->nswindow
, &nsselection
);
428 if(NS_FAILED(nsres
)) {
429 ERR("GetSelection failed: %08x\n", nsres
);
433 return HTMLSelectionObject_Create(This
->doc_node
, nsselection
, p
);
436 static HRESULT WINAPI
HTMLDocument_get_readyState(IHTMLDocument2
*iface
, BSTR
*p
)
438 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
440 static const WCHAR wszUninitialized
[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
441 static const WCHAR wszLoading
[] = {'l','o','a','d','i','n','g',0};
442 static const WCHAR wszLoaded
[] = {'l','o','a','d','e','d',0};
443 static const WCHAR wszInteractive
[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
444 static const WCHAR wszComplete
[] = {'c','o','m','p','l','e','t','e',0};
446 static const LPCWSTR readystate_str
[] = {
454 TRACE("(%p)->(%p)\n", iface
, p
);
459 *p
= SysAllocString(readystate_str
[This
->window
->readystate
]);
463 static HRESULT WINAPI
HTMLDocument_get_frames(IHTMLDocument2
*iface
, IHTMLFramesCollection2
**p
)
465 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
466 FIXME("(%p)->(%p)\n", This
, p
);
470 static HRESULT WINAPI
HTMLDocument_get_embeds(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
472 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
473 FIXME("(%p)->(%p)\n", This
, p
);
477 static HRESULT WINAPI
HTMLDocument_get_plugins(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
479 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
480 FIXME("(%p)->(%p)\n", This
, p
);
484 static HRESULT WINAPI
HTMLDocument_put_alinkColor(IHTMLDocument2
*iface
, VARIANT v
)
486 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
487 FIXME("(%p)\n", This
);
491 static HRESULT WINAPI
HTMLDocument_get_alinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
493 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
494 FIXME("(%p)->(%p)\n", This
, p
);
498 static HRESULT WINAPI
HTMLDocument_put_bgColor(IHTMLDocument2
*iface
, VARIANT v
)
500 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
501 FIXME("(%p)\n", This
);
505 static HRESULT WINAPI
HTMLDocument_get_bgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
507 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
508 FIXME("(%p)->(%p)\n", This
, p
);
512 static HRESULT WINAPI
HTMLDocument_put_fgColor(IHTMLDocument2
*iface
, VARIANT v
)
514 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
515 FIXME("(%p)\n", This
);
519 static HRESULT WINAPI
HTMLDocument_get_fgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
521 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
522 FIXME("(%p)->(%p)\n", This
, p
);
526 static HRESULT WINAPI
HTMLDocument_put_linkColor(IHTMLDocument2
*iface
, VARIANT v
)
528 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
529 FIXME("(%p)->()\n", This
);
533 static HRESULT WINAPI
HTMLDocument_get_linkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
535 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
536 FIXME("(%p)->(%p)\n", This
, p
);
540 static HRESULT WINAPI
HTMLDocument_put_vlinkColor(IHTMLDocument2
*iface
, VARIANT v
)
542 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
543 FIXME("(%p)\n", This
);
547 static HRESULT WINAPI
HTMLDocument_get_vlinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
549 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
550 FIXME("(%p)->(%p)\n", This
, p
);
554 static HRESULT WINAPI
HTMLDocument_get_referrer(IHTMLDocument2
*iface
, BSTR
*p
)
556 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
557 FIXME("(%p)->(%p)\n", This
, p
);
561 static HRESULT WINAPI
HTMLDocument_get_location(IHTMLDocument2
*iface
, IHTMLLocation
**p
)
563 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
565 TRACE("(%p)->(%p)\n", This
, p
);
567 return IHTMLWindow2_get_location(HTMLWINDOW2(This
->window
), p
);
570 static HRESULT WINAPI
HTMLDocument_get_lastModified(IHTMLDocument2
*iface
, BSTR
*p
)
572 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
573 FIXME("(%p)->(%p)\n", This
, p
);
577 static HRESULT WINAPI
HTMLDocument_put_URL(IHTMLDocument2
*iface
, BSTR v
)
579 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
580 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
584 static HRESULT WINAPI
HTMLDocument_get_URL(IHTMLDocument2
*iface
, BSTR
*p
)
586 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
588 static const WCHAR about_blank_url
[] =
589 {'a','b','o','u','t',':','b','l','a','n','k',0};
591 TRACE("(%p)->(%p)\n", iface
, p
);
593 *p
= SysAllocString(This
->window
->url
? This
->window
->url
: about_blank_url
);
594 return *p
? S_OK
: E_OUTOFMEMORY
;
597 static HRESULT WINAPI
HTMLDocument_put_domain(IHTMLDocument2
*iface
, BSTR v
)
599 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
600 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
604 static HRESULT WINAPI
HTMLDocument_get_domain(IHTMLDocument2
*iface
, BSTR
*p
)
606 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
607 FIXME("(%p)->(%p)\n", This
, p
);
611 static HRESULT WINAPI
HTMLDocument_put_cookie(IHTMLDocument2
*iface
, BSTR v
)
613 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
616 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
618 bret
= InternetSetCookieExW(This
->window
->url
, NULL
, v
, 0, 0);
620 FIXME("InternetSetCookieExW failed: %u\n", GetLastError());
621 return HRESULT_FROM_WIN32(GetLastError());
627 static HRESULT WINAPI
HTMLDocument_get_cookie(IHTMLDocument2
*iface
, BSTR
*p
)
629 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
633 TRACE("(%p)->(%p)\n", This
, p
);
636 bret
= InternetGetCookieExW(This
->window
->url
, NULL
, NULL
, &size
, 0, NULL
);
638 switch(GetLastError()) {
639 case ERROR_INSUFFICIENT_BUFFER
:
641 case ERROR_NO_MORE_ITEMS
:
645 FIXME("InternetGetCookieExW failed: %u\n", GetLastError());
646 return HRESULT_FROM_WIN32(GetLastError());
655 *p
= SysAllocStringLen(NULL
, size
-1);
657 return E_OUTOFMEMORY
;
659 bret
= InternetGetCookieExW(This
->window
->url
, NULL
, *p
, &size
, 0, NULL
);
661 ERR("InternetGetCookieExW failed: %u\n", GetLastError());
668 static HRESULT WINAPI
HTMLDocument_put_expando(IHTMLDocument2
*iface
, VARIANT_BOOL v
)
670 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
671 FIXME("(%p)->(%x)\n", This
, v
);
675 static HRESULT WINAPI
HTMLDocument_get_expando(IHTMLDocument2
*iface
, VARIANT_BOOL
*p
)
677 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
678 FIXME("(%p)->(%p)\n", This
, p
);
682 static HRESULT WINAPI
HTMLDocument_put_charset(IHTMLDocument2
*iface
, BSTR v
)
684 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
685 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
689 static HRESULT WINAPI
HTMLDocument_get_charset(IHTMLDocument2
*iface
, BSTR
*p
)
691 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
692 FIXME("(%p)->(%p)\n", This
, p
);
696 static HRESULT WINAPI
HTMLDocument_put_defaultCharset(IHTMLDocument2
*iface
, BSTR v
)
698 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
699 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
703 static HRESULT WINAPI
HTMLDocument_get_defaultCharset(IHTMLDocument2
*iface
, BSTR
*p
)
705 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
706 FIXME("(%p)->(%p)\n", This
, p
);
710 static HRESULT WINAPI
HTMLDocument_get_mimeType(IHTMLDocument2
*iface
, BSTR
*p
)
712 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
713 FIXME("(%p)->(%p)\n", This
, p
);
717 static HRESULT WINAPI
HTMLDocument_get_fileSize(IHTMLDocument2
*iface
, BSTR
*p
)
719 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
720 FIXME("(%p)->(%p)\n", This
, p
);
724 static HRESULT WINAPI
HTMLDocument_get_fileCreatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
726 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
727 FIXME("(%p)->(%p)\n", This
, p
);
731 static HRESULT WINAPI
HTMLDocument_get_fileModifiedDate(IHTMLDocument2
*iface
, BSTR
*p
)
733 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
734 FIXME("(%p)->(%p)\n", This
, p
);
738 static HRESULT WINAPI
HTMLDocument_get_fileUpdatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
740 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
741 FIXME("(%p)->(%p)\n", This
, p
);
745 static HRESULT WINAPI
HTMLDocument_get_security(IHTMLDocument2
*iface
, BSTR
*p
)
747 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
748 FIXME("(%p)->(%p)\n", This
, p
);
752 static HRESULT WINAPI
HTMLDocument_get_protocol(IHTMLDocument2
*iface
, BSTR
*p
)
754 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
755 FIXME("(%p)->(%p)\n", This
, p
);
759 static HRESULT WINAPI
HTMLDocument_get_nameProp(IHTMLDocument2
*iface
, BSTR
*p
)
761 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
762 FIXME("(%p)->(%p)\n", This
, p
);
766 static HRESULT
document_write(HTMLDocument
*This
, SAFEARRAY
*psarray
, BOOL ln
)
774 if(!This
->doc_node
->nsdoc
) {
775 WARN("NULL nsdoc\n");
779 if(psarray
->cDims
!= 1) {
780 FIXME("cDims=%d\n", psarray
->cDims
);
784 hres
= SafeArrayAccessData(psarray
, (void**)&var
);
786 WARN("SafeArrayAccessData failed: %08x\n", hres
);
790 nsAString_Init(&nsstr
, NULL
);
792 argc
= psarray
->rgsabound
[0].cElements
;
793 for(i
=0; i
< argc
; i
++) {
794 if(V_VT(var
+i
) == VT_BSTR
) {
795 nsAString_SetData(&nsstr
, V_BSTR(var
+i
));
796 if(!ln
|| i
!= argc
-1)
797 nsres
= nsIDOMHTMLDocument_Write(This
->doc_node
->nsdoc
, &nsstr
);
799 nsres
= nsIDOMHTMLDocument_Writeln(This
->doc_node
->nsdoc
, &nsstr
);
801 ERR("Write failed: %08x\n", nsres
);
803 FIXME("vt=%d\n", V_VT(var
+i
));
807 nsAString_Finish(&nsstr
);
808 SafeArrayUnaccessData(psarray
);
813 static HRESULT WINAPI
HTMLDocument_write(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
815 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
817 TRACE("(%p)->(%p)\n", iface
, psarray
);
819 return document_write(This
, psarray
, FALSE
);
822 static HRESULT WINAPI
HTMLDocument_writeln(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
824 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
826 TRACE("(%p)->(%p)\n", This
, psarray
);
828 return document_write(This
, psarray
, TRUE
);
831 static HRESULT WINAPI
HTMLDocument_open(IHTMLDocument2
*iface
, BSTR url
, VARIANT name
,
832 VARIANT features
, VARIANT replace
, IDispatch
**pomWindowResult
)
834 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
837 static const WCHAR text_htmlW
[] = {'t','e','x','t','/','h','t','m','l',0};
839 TRACE("(%p)->(%s %s %s %s %p)\n", This
, debugstr_w(url
), debugstr_variant(&name
),
840 debugstr_variant(&features
), debugstr_variant(&replace
), pomWindowResult
);
842 if(!This
->doc_node
->nsdoc
) {
847 if(!url
|| strcmpW(url
, text_htmlW
) || V_VT(&name
) != VT_ERROR
848 || V_VT(&features
) != VT_ERROR
|| V_VT(&replace
) != VT_ERROR
)
849 FIXME("unsupported args\n");
851 nsres
= nsIDOMHTMLDocument_Open(This
->doc_node
->nsdoc
);
852 if(NS_FAILED(nsres
)) {
853 ERR("Open failed: %08x\n", nsres
);
857 *pomWindowResult
= (IDispatch
*)HTMLWINDOW2(This
->window
);
858 IHTMLWindow2_AddRef(HTMLWINDOW2(This
->window
));
862 static HRESULT WINAPI
HTMLDocument_close(IHTMLDocument2
*iface
)
864 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
867 TRACE("(%p)\n", This
);
869 if(!This
->doc_node
->nsdoc
) {
874 nsres
= nsIDOMHTMLDocument_Close(This
->doc_node
->nsdoc
);
875 if(NS_FAILED(nsres
)) {
876 ERR("Close failed: %08x\n", nsres
);
883 static HRESULT WINAPI
HTMLDocument_clear(IHTMLDocument2
*iface
)
885 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
886 FIXME("(%p)\n", This
);
890 static HRESULT WINAPI
HTMLDocument_queryCommandSupported(IHTMLDocument2
*iface
, BSTR cmdID
,
893 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
894 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
898 static HRESULT WINAPI
HTMLDocument_queryCommandEnabled(IHTMLDocument2
*iface
, BSTR cmdID
,
901 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
902 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
906 static HRESULT WINAPI
HTMLDocument_queryCommandState(IHTMLDocument2
*iface
, BSTR cmdID
,
909 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
910 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
914 static HRESULT WINAPI
HTMLDocument_queryCommandIndeterm(IHTMLDocument2
*iface
, BSTR cmdID
,
917 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
918 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
922 static HRESULT WINAPI
HTMLDocument_queryCommandText(IHTMLDocument2
*iface
, BSTR cmdID
,
925 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
926 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
930 static HRESULT WINAPI
HTMLDocument_queryCommandValue(IHTMLDocument2
*iface
, BSTR cmdID
,
933 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
934 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
938 static HRESULT WINAPI
HTMLDocument_execCommand(IHTMLDocument2
*iface
, BSTR cmdID
,
939 VARIANT_BOOL showUI
, VARIANT value
, VARIANT_BOOL
*pfRet
)
941 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
942 FIXME("(%p)->(%s %x %p)\n", This
, debugstr_w(cmdID
), showUI
, pfRet
);
946 static HRESULT WINAPI
HTMLDocument_execCommandShowHelp(IHTMLDocument2
*iface
, BSTR cmdID
,
949 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
950 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
954 static HRESULT WINAPI
HTMLDocument_createElement(IHTMLDocument2
*iface
, BSTR eTag
,
955 IHTMLElement
**newElem
)
957 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
958 nsIDOMHTMLElement
*nselem
;
962 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eTag
), newElem
);
964 hres
= create_nselem(This
->doc_node
, eTag
, &nselem
);
968 elem
= HTMLElement_Create(This
->doc_node
, (nsIDOMNode
*)nselem
, TRUE
);
969 nsIDOMHTMLElement_Release(nselem
);
971 *newElem
= HTMLELEM(elem
);
972 IHTMLElement_AddRef(HTMLELEM(elem
));
976 static HRESULT WINAPI
HTMLDocument_put_onhelp(IHTMLDocument2
*iface
, VARIANT v
)
978 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
979 FIXME("(%p)\n", This
);
983 static HRESULT WINAPI
HTMLDocument_get_onhelp(IHTMLDocument2
*iface
, VARIANT
*p
)
985 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
986 FIXME("(%p)->(%p)\n", This
, p
);
990 static HRESULT WINAPI
HTMLDocument_put_onclick(IHTMLDocument2
*iface
, VARIANT v
)
992 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
994 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
996 return set_doc_event(This
, EVENTID_CLICK
, &v
);
999 static HRESULT WINAPI
HTMLDocument_get_onclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1001 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1003 TRACE("(%p)->(%p)\n", This
, p
);
1005 return get_doc_event(This
, EVENTID_CLICK
, p
);
1008 static HRESULT WINAPI
HTMLDocument_put_ondblclick(IHTMLDocument2
*iface
, VARIANT v
)
1010 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1011 FIXME("(%p)\n", This
);
1015 static HRESULT WINAPI
HTMLDocument_get_ondblclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1017 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1018 FIXME("(%p)->(%p)\n", This
, p
);
1022 static HRESULT WINAPI
HTMLDocument_put_onkeyup(IHTMLDocument2
*iface
, VARIANT v
)
1024 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1026 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1028 return set_doc_event(This
, EVENTID_KEYUP
, &v
);
1031 static HRESULT WINAPI
HTMLDocument_get_onkeyup(IHTMLDocument2
*iface
, VARIANT
*p
)
1033 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1035 TRACE("(%p)->(%p)\n", This
, p
);
1037 return get_doc_event(This
, EVENTID_KEYUP
, p
);
1040 static HRESULT WINAPI
HTMLDocument_put_onkeydown(IHTMLDocument2
*iface
, VARIANT v
)
1042 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1044 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1046 return set_doc_event(This
, EVENTID_KEYDOWN
, &v
);
1049 static HRESULT WINAPI
HTMLDocument_get_onkeydown(IHTMLDocument2
*iface
, VARIANT
*p
)
1051 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1053 TRACE("(%p)->(%p)\n", This
, p
);
1055 return get_doc_event(This
, EVENTID_KEYDOWN
, p
);
1058 static HRESULT WINAPI
HTMLDocument_put_onkeypress(IHTMLDocument2
*iface
, VARIANT v
)
1060 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1061 FIXME("(%p)\n", This
);
1065 static HRESULT WINAPI
HTMLDocument_get_onkeypress(IHTMLDocument2
*iface
, VARIANT
*p
)
1067 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1068 FIXME("(%p)->(%p)\n", This
, p
);
1072 static HRESULT WINAPI
HTMLDocument_put_onmouseup(IHTMLDocument2
*iface
, VARIANT v
)
1074 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1076 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1078 return set_doc_event(This
, EVENTID_MOUSEUP
, &v
);
1081 static HRESULT WINAPI
HTMLDocument_get_onmouseup(IHTMLDocument2
*iface
, VARIANT
*p
)
1083 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1085 TRACE("(%p)->(%p)\n", This
, p
);
1087 return get_doc_event(This
, EVENTID_MOUSEUP
, p
);
1090 static HRESULT WINAPI
HTMLDocument_put_onmousedown(IHTMLDocument2
*iface
, VARIANT v
)
1092 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1094 TRACE("(%p)->()\n", This
);
1096 return set_doc_event(This
, EVENTID_MOUSEDOWN
, &v
);
1099 static HRESULT WINAPI
HTMLDocument_get_onmousedown(IHTMLDocument2
*iface
, VARIANT
*p
)
1101 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1103 TRACE("(%p)->(%p)\n", This
, p
);
1105 return get_doc_event(This
, EVENTID_MOUSEDOWN
, p
);
1108 static HRESULT WINAPI
HTMLDocument_put_onmousemove(IHTMLDocument2
*iface
, VARIANT v
)
1110 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1111 FIXME("(%p)\n", This
);
1115 static HRESULT WINAPI
HTMLDocument_get_onmousemove(IHTMLDocument2
*iface
, VARIANT
*p
)
1117 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1118 FIXME("(%p)->(%p)\n", This
, p
);
1122 static HRESULT WINAPI
HTMLDocument_put_onmouseout(IHTMLDocument2
*iface
, VARIANT v
)
1124 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1126 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1128 return set_doc_event(This
, EVENTID_MOUSEOUT
, &v
);
1131 static HRESULT WINAPI
HTMLDocument_get_onmouseout(IHTMLDocument2
*iface
, VARIANT
*p
)
1133 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1135 TRACE("(%p)->(%p)\n", This
, p
);
1137 return get_doc_event(This
, EVENTID_MOUSEOUT
, p
);
1140 static HRESULT WINAPI
HTMLDocument_put_onmouseover(IHTMLDocument2
*iface
, VARIANT v
)
1142 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1144 TRACE("(%p)\n", This
);
1146 return set_doc_event(This
, EVENTID_MOUSEOVER
, &v
);
1149 static HRESULT WINAPI
HTMLDocument_get_onmouseover(IHTMLDocument2
*iface
, VARIANT
*p
)
1151 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1153 TRACE("(%p)->(%p)\n", This
, p
);
1155 return get_doc_event(This
, EVENTID_MOUSEOVER
, p
);
1158 static HRESULT WINAPI
HTMLDocument_put_onreadystatechange(IHTMLDocument2
*iface
, VARIANT v
)
1160 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1162 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1164 return set_doc_event(This
, EVENTID_READYSTATECHANGE
, &v
);
1167 static HRESULT WINAPI
HTMLDocument_get_onreadystatechange(IHTMLDocument2
*iface
, VARIANT
*p
)
1169 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1171 TRACE("(%p)->(%p)\n", This
, p
);
1173 return get_doc_event(This
, EVENTID_READYSTATECHANGE
, p
);
1176 static HRESULT WINAPI
HTMLDocument_put_onafterupdate(IHTMLDocument2
*iface
, VARIANT v
)
1178 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1179 FIXME("(%p)\n", This
);
1183 static HRESULT WINAPI
HTMLDocument_get_onafterupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1185 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1186 FIXME("(%p)->(%p)\n", This
, p
);
1190 static HRESULT WINAPI
HTMLDocument_put_onrowexit(IHTMLDocument2
*iface
, VARIANT v
)
1192 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1193 FIXME("(%p)\n", This
);
1197 static HRESULT WINAPI
HTMLDocument_get_onrowexit(IHTMLDocument2
*iface
, VARIANT
*p
)
1199 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1200 FIXME("(%p)->(%p)\n", This
, p
);
1204 static HRESULT WINAPI
HTMLDocument_put_onrowenter(IHTMLDocument2
*iface
, VARIANT v
)
1206 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1207 FIXME("(%p)\n", This
);
1211 static HRESULT WINAPI
HTMLDocument_get_onrowenter(IHTMLDocument2
*iface
, VARIANT
*p
)
1213 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1214 FIXME("(%p)->(%p)\n", This
, p
);
1218 static HRESULT WINAPI
HTMLDocument_put_ondragstart(IHTMLDocument2
*iface
, VARIANT v
)
1220 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1222 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1224 return set_doc_event(This
, EVENTID_DRAGSTART
, &v
);
1227 static HRESULT WINAPI
HTMLDocument_get_ondragstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1229 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1231 TRACE("(%p)->(%p)\n", This
, p
);
1233 return get_doc_event(This
, EVENTID_DRAGSTART
, p
);
1236 static HRESULT WINAPI
HTMLDocument_put_onselectstart(IHTMLDocument2
*iface
, VARIANT v
)
1238 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1240 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1242 return set_doc_event(This
, EVENTID_SELECTSTART
, &v
);
1245 static HRESULT WINAPI
HTMLDocument_get_onselectstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1247 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1249 TRACE("(%p)->(%p)\n", This
, p
);
1251 return get_doc_event(This
, EVENTID_SELECTSTART
, p
);
1254 static HRESULT WINAPI
HTMLDocument_elementFromPoint(IHTMLDocument2
*iface
, LONG x
, LONG y
,
1255 IHTMLElement
**elementHit
)
1257 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1258 FIXME("(%p)->(%d %d %p)\n", This
, x
, y
, elementHit
);
1262 static HRESULT WINAPI
HTMLDocument_get_parentWindow(IHTMLDocument2
*iface
, IHTMLWindow2
**p
)
1264 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1266 TRACE("(%p)->(%p)\n", This
, p
);
1268 *p
= HTMLWINDOW2(This
->window
);
1269 IHTMLWindow2_AddRef(*p
);
1273 static HRESULT WINAPI
HTMLDocument_get_styleSheets(IHTMLDocument2
*iface
,
1274 IHTMLStyleSheetsCollection
**p
)
1276 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1277 nsIDOMStyleSheetList
*nsstylelist
;
1278 nsIDOMDocumentStyle
*nsdocstyle
;
1281 TRACE("(%p)->(%p)\n", This
, p
);
1285 if(!This
->doc_node
->nsdoc
) {
1286 WARN("NULL nsdoc\n");
1287 return E_UNEXPECTED
;
1290 nsIDOMHTMLDocument_QueryInterface(This
->doc_node
->nsdoc
, &IID_nsIDOMDocumentStyle
, (void**)&nsdocstyle
);
1291 nsres
= nsIDOMDocumentStyle_GetStyleSheets(nsdocstyle
, &nsstylelist
);
1292 nsIDOMDocumentStyle_Release(nsdocstyle
);
1293 if(NS_FAILED(nsres
)) {
1294 ERR("GetStyleSheets failed: %08x\n", nsres
);
1298 *p
= HTMLStyleSheetsCollection_Create(nsstylelist
);
1299 nsIDOMDocumentStyle_Release(nsstylelist
);
1304 static HRESULT WINAPI
HTMLDocument_put_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT v
)
1306 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1307 FIXME("(%p)\n", This
);
1311 static HRESULT WINAPI
HTMLDocument_get_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1313 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1314 FIXME("(%p)->(%p)\n", This
, p
);
1318 static HRESULT WINAPI
HTMLDocument_put_onerrorupdate(IHTMLDocument2
*iface
, VARIANT v
)
1320 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1321 FIXME("(%p)\n", This
);
1325 static HRESULT WINAPI
HTMLDocument_get_onerrorupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1327 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1328 FIXME("(%p)->(%p)\n", This
, p
);
1332 static HRESULT WINAPI
HTMLDocument_toString(IHTMLDocument2
*iface
, BSTR
*String
)
1334 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1335 FIXME("(%p)->(%p)\n", This
, String
);
1339 static HRESULT WINAPI
HTMLDocument_createStyleSheet(IHTMLDocument2
*iface
, BSTR bstrHref
,
1340 LONG lIndex
, IHTMLStyleSheet
**ppnewStyleSheet
)
1342 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1344 FIXME("(%p)->(%s %d %p) semi-stub\n", This
, debugstr_w(bstrHref
), lIndex
, ppnewStyleSheet
);
1346 *ppnewStyleSheet
= HTMLStyleSheet_Create(NULL
);
1350 static const IHTMLDocument2Vtbl HTMLDocumentVtbl
= {
1351 HTMLDocument_QueryInterface
,
1352 HTMLDocument_AddRef
,
1353 HTMLDocument_Release
,
1354 HTMLDocument_GetTypeInfoCount
,
1355 HTMLDocument_GetTypeInfo
,
1356 HTMLDocument_GetIDsOfNames
,
1357 HTMLDocument_Invoke
,
1358 HTMLDocument_get_Script
,
1359 HTMLDocument_get_all
,
1360 HTMLDocument_get_body
,
1361 HTMLDocument_get_activeElement
,
1362 HTMLDocument_get_images
,
1363 HTMLDocument_get_applets
,
1364 HTMLDocument_get_links
,
1365 HTMLDocument_get_forms
,
1366 HTMLDocument_get_anchors
,
1367 HTMLDocument_put_title
,
1368 HTMLDocument_get_title
,
1369 HTMLDocument_get_scripts
,
1370 HTMLDocument_put_designMode
,
1371 HTMLDocument_get_designMode
,
1372 HTMLDocument_get_selection
,
1373 HTMLDocument_get_readyState
,
1374 HTMLDocument_get_frames
,
1375 HTMLDocument_get_embeds
,
1376 HTMLDocument_get_plugins
,
1377 HTMLDocument_put_alinkColor
,
1378 HTMLDocument_get_alinkColor
,
1379 HTMLDocument_put_bgColor
,
1380 HTMLDocument_get_bgColor
,
1381 HTMLDocument_put_fgColor
,
1382 HTMLDocument_get_fgColor
,
1383 HTMLDocument_put_linkColor
,
1384 HTMLDocument_get_linkColor
,
1385 HTMLDocument_put_vlinkColor
,
1386 HTMLDocument_get_vlinkColor
,
1387 HTMLDocument_get_referrer
,
1388 HTMLDocument_get_location
,
1389 HTMLDocument_get_lastModified
,
1390 HTMLDocument_put_URL
,
1391 HTMLDocument_get_URL
,
1392 HTMLDocument_put_domain
,
1393 HTMLDocument_get_domain
,
1394 HTMLDocument_put_cookie
,
1395 HTMLDocument_get_cookie
,
1396 HTMLDocument_put_expando
,
1397 HTMLDocument_get_expando
,
1398 HTMLDocument_put_charset
,
1399 HTMLDocument_get_charset
,
1400 HTMLDocument_put_defaultCharset
,
1401 HTMLDocument_get_defaultCharset
,
1402 HTMLDocument_get_mimeType
,
1403 HTMLDocument_get_fileSize
,
1404 HTMLDocument_get_fileCreatedDate
,
1405 HTMLDocument_get_fileModifiedDate
,
1406 HTMLDocument_get_fileUpdatedDate
,
1407 HTMLDocument_get_security
,
1408 HTMLDocument_get_protocol
,
1409 HTMLDocument_get_nameProp
,
1411 HTMLDocument_writeln
,
1415 HTMLDocument_queryCommandSupported
,
1416 HTMLDocument_queryCommandEnabled
,
1417 HTMLDocument_queryCommandState
,
1418 HTMLDocument_queryCommandIndeterm
,
1419 HTMLDocument_queryCommandText
,
1420 HTMLDocument_queryCommandValue
,
1421 HTMLDocument_execCommand
,
1422 HTMLDocument_execCommandShowHelp
,
1423 HTMLDocument_createElement
,
1424 HTMLDocument_put_onhelp
,
1425 HTMLDocument_get_onhelp
,
1426 HTMLDocument_put_onclick
,
1427 HTMLDocument_get_onclick
,
1428 HTMLDocument_put_ondblclick
,
1429 HTMLDocument_get_ondblclick
,
1430 HTMLDocument_put_onkeyup
,
1431 HTMLDocument_get_onkeyup
,
1432 HTMLDocument_put_onkeydown
,
1433 HTMLDocument_get_onkeydown
,
1434 HTMLDocument_put_onkeypress
,
1435 HTMLDocument_get_onkeypress
,
1436 HTMLDocument_put_onmouseup
,
1437 HTMLDocument_get_onmouseup
,
1438 HTMLDocument_put_onmousedown
,
1439 HTMLDocument_get_onmousedown
,
1440 HTMLDocument_put_onmousemove
,
1441 HTMLDocument_get_onmousemove
,
1442 HTMLDocument_put_onmouseout
,
1443 HTMLDocument_get_onmouseout
,
1444 HTMLDocument_put_onmouseover
,
1445 HTMLDocument_get_onmouseover
,
1446 HTMLDocument_put_onreadystatechange
,
1447 HTMLDocument_get_onreadystatechange
,
1448 HTMLDocument_put_onafterupdate
,
1449 HTMLDocument_get_onafterupdate
,
1450 HTMLDocument_put_onrowexit
,
1451 HTMLDocument_get_onrowexit
,
1452 HTMLDocument_put_onrowenter
,
1453 HTMLDocument_get_onrowenter
,
1454 HTMLDocument_put_ondragstart
,
1455 HTMLDocument_get_ondragstart
,
1456 HTMLDocument_put_onselectstart
,
1457 HTMLDocument_get_onselectstart
,
1458 HTMLDocument_elementFromPoint
,
1459 HTMLDocument_get_parentWindow
,
1460 HTMLDocument_get_styleSheets
,
1461 HTMLDocument_put_onbeforeupdate
,
1462 HTMLDocument_get_onbeforeupdate
,
1463 HTMLDocument_put_onerrorupdate
,
1464 HTMLDocument_get_onerrorupdate
,
1465 HTMLDocument_toString
,
1466 HTMLDocument_createStyleSheet
1469 static void HTMLDocument_on_advise(IUnknown
*iface
, cp_static_data_t
*cp
)
1471 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1474 update_cp_events(This
->window
, cp
);
1479 #define SUPPINFO_THIS(iface) DEFINE_THIS(HTMLDocument, SupportErrorInfo, iface)
1481 static HRESULT WINAPI
SupportErrorInfo_QueryInterface(ISupportErrorInfo
*iface
, REFIID riid
, void **ppv
)
1483 HTMLDocument
*This
= SUPPINFO_THIS(iface
);
1484 return IHTMLDocument_QueryInterface(HTMLDOC(This
), riid
, ppv
);
1487 static ULONG WINAPI
SupportErrorInfo_AddRef(ISupportErrorInfo
*iface
)
1489 HTMLDocument
*This
= SUPPINFO_THIS(iface
);
1490 return IHTMLDocument_AddRef(HTMLDOC(This
));
1493 static ULONG WINAPI
SupportErrorInfo_Release(ISupportErrorInfo
*iface
)
1495 HTMLDocument
*This
= SUPPINFO_THIS(iface
);
1496 return IHTMLDocument_Release(HTMLDOC(This
));
1499 static HRESULT WINAPI
SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo
*iface
, REFIID riid
)
1501 FIXME("(%p)->(%s)\n", iface
, debugstr_guid(riid
));
1505 static const ISupportErrorInfoVtbl SupportErrorInfoVtbl
= {
1506 SupportErrorInfo_QueryInterface
,
1507 SupportErrorInfo_AddRef
,
1508 SupportErrorInfo_Release
,
1509 SupportErrorInfo_InterfaceSupportsErrorInfo
1512 #define DISPEX_THIS(iface) DEFINE_THIS(HTMLDocument, IDispatchEx, iface)
1514 static HRESULT WINAPI
DocDispatchEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
1516 HTMLDocument
*This
= DISPEX_THIS(iface
);
1518 return IHTMLDocument2_QueryInterface(HTMLDOC(This
), riid
, ppv
);
1521 static ULONG WINAPI
DocDispatchEx_AddRef(IDispatchEx
*iface
)
1523 HTMLDocument
*This
= DISPEX_THIS(iface
);
1525 return IHTMLDocument2_AddRef(HTMLDOC(This
));
1528 static ULONG WINAPI
DocDispatchEx_Release(IDispatchEx
*iface
)
1530 HTMLDocument
*This
= DISPEX_THIS(iface
);
1532 return IHTMLDocument2_Release(HTMLDOC(This
));
1535 static HRESULT WINAPI
DocDispatchEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
1537 HTMLDocument
*This
= DISPEX_THIS(iface
);
1539 return IDispatchEx_GetTypeInfoCount(This
->dispex
, pctinfo
);
1542 static HRESULT WINAPI
DocDispatchEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
1543 LCID lcid
, ITypeInfo
**ppTInfo
)
1545 HTMLDocument
*This
= DISPEX_THIS(iface
);
1547 return IDispatchEx_GetTypeInfo(This
->dispex
, iTInfo
, lcid
, ppTInfo
);
1550 static HRESULT WINAPI
DocDispatchEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
1551 LPOLESTR
*rgszNames
, UINT cNames
,
1552 LCID lcid
, DISPID
*rgDispId
)
1554 HTMLDocument
*This
= DISPEX_THIS(iface
);
1556 return IDispatchEx_GetIDsOfNames(This
->dispex
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1559 static HRESULT WINAPI
DocDispatchEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
1560 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1561 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1563 HTMLDocument
*This
= DISPEX_THIS(iface
);
1565 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
1566 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1568 switch(dispIdMember
) {
1569 case DISPID_READYSTATE
:
1570 TRACE("DISPID_READYSTATE\n");
1572 if(!(wFlags
& DISPATCH_PROPERTYGET
))
1573 return E_INVALIDARG
;
1575 V_VT(pVarResult
) = VT_I4
;
1576 V_I4(pVarResult
) = This
->window
->readystate
;
1580 return IDispatchEx_Invoke(This
->dispex
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
1581 pVarResult
, pExcepInfo
, puArgErr
);
1584 static HRESULT WINAPI
DocDispatchEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
1586 HTMLDocument
*This
= DISPEX_THIS(iface
);
1588 return IDispatchEx_GetDispID(This
->dispex
, bstrName
, grfdex
, pid
);
1591 static HRESULT WINAPI
DocDispatchEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
1592 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
1594 HTMLDocument
*This
= DISPEX_THIS(iface
);
1596 return IDispatchEx_InvokeEx(This
->dispex
, id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
1599 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
1601 HTMLDocument
*This
= DISPEX_THIS(iface
);
1603 return IDispatchEx_DeleteMemberByName(This
->dispex
, bstrName
, grfdex
);
1606 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
1608 HTMLDocument
*This
= DISPEX_THIS(iface
);
1610 return IDispatchEx_DeleteMemberByDispID(This
->dispex
, id
);
1613 static HRESULT WINAPI
DocDispatchEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
1615 HTMLDocument
*This
= DISPEX_THIS(iface
);
1617 return IDispatchEx_GetMemberProperties(This
->dispex
, id
, grfdexFetch
, pgrfdex
);
1620 static HRESULT WINAPI
DocDispatchEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
1622 HTMLDocument
*This
= DISPEX_THIS(iface
);
1624 return IDispatchEx_GetMemberName(This
->dispex
, id
, pbstrName
);
1627 static HRESULT WINAPI
DocDispatchEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
1629 HTMLDocument
*This
= DISPEX_THIS(iface
);
1631 return IDispatchEx_GetNextDispID(This
->dispex
, grfdex
, id
, pid
);
1634 static HRESULT WINAPI
DocDispatchEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
1636 HTMLDocument
*This
= DISPEX_THIS(iface
);
1638 return IDispatchEx_GetNameSpaceParent(This
->dispex
, ppunk
);
1643 static const IDispatchExVtbl DocDispatchExVtbl
= {
1644 DocDispatchEx_QueryInterface
,
1645 DocDispatchEx_AddRef
,
1646 DocDispatchEx_Release
,
1647 DocDispatchEx_GetTypeInfoCount
,
1648 DocDispatchEx_GetTypeInfo
,
1649 DocDispatchEx_GetIDsOfNames
,
1650 DocDispatchEx_Invoke
,
1651 DocDispatchEx_GetDispID
,
1652 DocDispatchEx_InvokeEx
,
1653 DocDispatchEx_DeleteMemberByName
,
1654 DocDispatchEx_DeleteMemberByDispID
,
1655 DocDispatchEx_GetMemberProperties
,
1656 DocDispatchEx_GetMemberName
,
1657 DocDispatchEx_GetNextDispID
,
1658 DocDispatchEx_GetNameSpaceParent
1661 static BOOL
htmldoc_qi(HTMLDocument
*This
, REFIID riid
, void **ppv
)
1665 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
1666 TRACE("(%p)->(IID_IUnknown, %p)\n", This
, ppv
);
1667 *ppv
= HTMLDOC(This
);
1668 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
1669 TRACE("(%p)->(IID_IDispatch, %p)\n", This
, ppv
);
1670 *ppv
= DISPATCHEX(This
);
1671 }else if(IsEqualGUID(&IID_IDispatchEx
, riid
)) {
1672 TRACE("(%p)->(IID_IDispatchEx, %p)\n", This
, ppv
);
1673 *ppv
= DISPATCHEX(This
);
1674 }else if(IsEqualGUID(&IID_IHTMLDocument
, riid
)) {
1675 TRACE("(%p)->(IID_IHTMLDocument, %p)\n", This
, ppv
);
1676 *ppv
= HTMLDOC(This
);
1677 }else if(IsEqualGUID(&IID_IHTMLDocument2
, riid
)) {
1678 TRACE("(%p)->(IID_IHTMLDocument2, %p)\n", This
, ppv
);
1679 *ppv
= HTMLDOC(This
);
1680 }else if(IsEqualGUID(&IID_IHTMLDocument3
, riid
)) {
1681 TRACE("(%p)->(IID_IHTMLDocument3, %p)\n", This
, ppv
);
1682 *ppv
= HTMLDOC3(This
);
1683 }else if(IsEqualGUID(&IID_IHTMLDocument4
, riid
)) {
1684 TRACE("(%p)->(IID_IHTMLDocument4, %p)\n", This
, ppv
);
1685 *ppv
= HTMLDOC4(This
);
1686 }else if(IsEqualGUID(&IID_IHTMLDocument5
, riid
)) {
1687 TRACE("(%p)->(IID_IHTMLDocument5, %p)\n", This
, ppv
);
1688 *ppv
= HTMLDOC5(This
);
1689 }else if(IsEqualGUID(&IID_IHTMLDocument6
, riid
)) {
1690 TRACE("(%p)->(IID_IHTMLDocument6, %p)\n", This
, ppv
);
1691 *ppv
= HTMLDOC6(This
);
1692 }else if(IsEqualGUID(&IID_IPersist
, riid
)) {
1693 TRACE("(%p)->(IID_IPersist, %p)\n", This
, ppv
);
1694 *ppv
= PERSIST(This
);
1695 }else if(IsEqualGUID(&IID_IPersistMoniker
, riid
)) {
1696 TRACE("(%p)->(IID_IPersistMoniker, %p)\n", This
, ppv
);
1697 *ppv
= PERSISTMON(This
);
1698 }else if(IsEqualGUID(&IID_IPersistFile
, riid
)) {
1699 TRACE("(%p)->(IID_IPersistFile, %p)\n", This
, ppv
);
1700 *ppv
= PERSISTFILE(This
);
1701 }else if(IsEqualGUID(&IID_IMonikerProp
, riid
)) {
1702 TRACE("(%p)->(IID_IMonikerProp, %p)\n", This
, ppv
);
1703 *ppv
= MONPROP(This
);
1704 }else if(IsEqualGUID(&IID_IOleObject
, riid
)) {
1705 TRACE("(%p)->(IID_IOleObject, %p)\n", This
, ppv
);
1706 *ppv
= OLEOBJ(This
);
1707 }else if(IsEqualGUID(&IID_IOleDocument
, riid
)) {
1708 TRACE("(%p)->(IID_IOleDocument, %p)\n", This
, ppv
);
1709 *ppv
= OLEDOC(This
);
1710 }else if(IsEqualGUID(&IID_IOleDocumentView
, riid
)) {
1711 TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This
, ppv
);
1712 *ppv
= DOCVIEW(This
);
1713 }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject
, riid
)) {
1714 TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This
, ppv
);
1715 *ppv
= ACTOBJ(This
);
1716 }else if(IsEqualGUID(&IID_IViewObject
, riid
)) {
1717 TRACE("(%p)->(IID_IViewObject, %p)\n", This
, ppv
);
1718 *ppv
= VIEWOBJ(This
);
1719 }else if(IsEqualGUID(&IID_IViewObject2
, riid
)) {
1720 TRACE("(%p)->(IID_IViewObject2, %p)\n", This
, ppv
);
1721 *ppv
= VIEWOBJ2(This
);
1722 }else if(IsEqualGUID(&IID_IViewObjectEx
, riid
)) {
1723 TRACE("(%p)->(IID_IViewObjectEx, %p)\n", This
, ppv
);
1724 *ppv
= VIEWOBJEX(This
);
1725 }else if(IsEqualGUID(&IID_IOleWindow
, riid
)) {
1726 TRACE("(%p)->(IID_IOleWindow, %p)\n", This
, ppv
);
1727 *ppv
= OLEWIN(This
);
1728 }else if(IsEqualGUID(&IID_IOleInPlaceObject
, riid
)) {
1729 TRACE("(%p)->(IID_IOleInPlaceObject, %p)\n", This
, ppv
);
1730 *ppv
= INPLACEOBJ(This
);
1731 }else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless
, riid
)) {
1732 TRACE("(%p)->(IID_IOleInPlaceObjectWindowless, %p)\n", This
, ppv
);
1733 *ppv
= INPLACEWIN(This
);
1734 }else if(IsEqualGUID(&IID_IServiceProvider
, riid
)) {
1735 TRACE("(%p)->(IID_IServiceProvider, %p)\n", This
, ppv
);
1736 *ppv
= SERVPROV(This
);
1737 }else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
)) {
1738 TRACE("(%p)->(IID_IOleCommandTarget, %p)\n", This
, ppv
);
1739 *ppv
= CMDTARGET(This
);
1740 }else if(IsEqualGUID(&IID_IOleControl
, riid
)) {
1741 TRACE("(%p)->(IID_IOleControl, %p)\n", This
, ppv
);
1742 *ppv
= CONTROL(This
);
1743 }else if(IsEqualGUID(&IID_IHlinkTarget
, riid
)) {
1744 TRACE("(%p)->(IID_IHlinkTarget, %p)\n", This
, ppv
);
1745 *ppv
= HLNKTARGET(This
);
1746 }else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
)) {
1747 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This
, ppv
);
1748 *ppv
= CONPTCONT(&This
->cp_container
);
1749 }else if(IsEqualGUID(&IID_IPersistStreamInit
, riid
)) {
1750 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This
, ppv
);
1751 *ppv
= PERSTRINIT(This
);
1752 }else if(IsEqualGUID(&DIID_DispHTMLDocument
, riid
)) {
1753 TRACE("(%p)->(DIID_DispHTMLDocument %p)\n", This
, ppv
);
1754 *ppv
= HTMLDOC(This
);
1755 }else if(IsEqualGUID(&IID_ISupportErrorInfo
, riid
)) {
1756 TRACE("(%p)->(IID_ISupportErrorInfo %p)\n", This
, ppv
);
1757 *ppv
= SUPPERRINFO(This
);
1758 }else if(IsEqualGUID(&IID_IPersistHistory
, riid
)) {
1759 TRACE("(%p)->(IID_IPersistHistory %p)\n", This
, ppv
);
1760 *ppv
= PERSISTHIST(This
);
1761 }else if(IsEqualGUID(&CLSID_CMarkup
, riid
)) {
1762 FIXME("(%p)->(CLSID_CMarkup %p)\n", This
, ppv
);
1764 }else if(IsEqualGUID(&IID_IRunnableObject
, riid
)) {
1765 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This
, ppv
);
1767 }else if(IsEqualGUID(&IID_IPersistPropertyBag
, riid
)) {
1768 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This
, ppv
);
1770 }else if(IsEqualGUID(&IID_IMarshal
, riid
)) {
1771 TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This
, ppv
);
1773 }else if(IsEqualGUID(&IID_IObjectWithSite
, riid
)) {
1774 TRACE("(%p)->(IID_IObjectWithSite %p)\n", This
, ppv
);
1775 *ppv
= OBJSITE(This
);
1781 IUnknown_AddRef((IUnknown
*)*ppv
);
1785 static cp_static_data_t HTMLDocumentEvents_data
= { HTMLDocumentEvents_tid
, HTMLDocument_on_advise
};
1787 static void init_doc(HTMLDocument
*doc
, IUnknown
*unk_impl
, IDispatchEx
*dispex
)
1789 doc
->lpHTMLDocument2Vtbl
= &HTMLDocumentVtbl
;
1790 doc
->lpIDispatchExVtbl
= &DocDispatchExVtbl
;
1791 doc
->lpSupportErrorInfoVtbl
= &SupportErrorInfoVtbl
;
1793 doc
->unk_impl
= unk_impl
;
1794 doc
->dispex
= dispex
;
1795 doc
->task_magic
= get_task_target_magic();
1797 HTMLDocument_HTMLDocument3_Init(doc
);
1798 HTMLDocument_HTMLDocument5_Init(doc
);
1799 HTMLDocument_Persist_Init(doc
);
1800 HTMLDocument_OleCmd_Init(doc
);
1801 HTMLDocument_OleObj_Init(doc
);
1802 HTMLDocument_View_Init(doc
);
1803 HTMLDocument_Window_Init(doc
);
1804 HTMLDocument_Service_Init(doc
);
1805 HTMLDocument_Hlink_Init(doc
);
1807 ConnectionPointContainer_Init(&doc
->cp_container
, (IUnknown
*)HTMLDOC(doc
));
1808 ConnectionPoint_Init(&doc
->cp_dispatch
, &doc
->cp_container
, &IID_IDispatch
, NULL
);
1809 ConnectionPoint_Init(&doc
->cp_propnotif
, &doc
->cp_container
, &IID_IPropertyNotifySink
, NULL
);
1810 ConnectionPoint_Init(&doc
->cp_htmldocevents
, &doc
->cp_container
, &DIID_HTMLDocumentEvents
, &HTMLDocumentEvents_data
);
1811 ConnectionPoint_Init(&doc
->cp_htmldocevents2
, &doc
->cp_container
, &DIID_HTMLDocumentEvents2
, NULL
);
1814 static void destroy_htmldoc(HTMLDocument
*This
)
1816 remove_target_tasks(This
->task_magic
);
1818 ConnectionPointContainer_Destroy(&This
->cp_container
);
1821 #define HTMLDOCNODE_NODE_THIS(iface) DEFINE_THIS2(HTMLDocumentNode, node, iface)
1823 static HRESULT
HTMLDocumentNode_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
1825 HTMLDocumentNode
*This
= HTMLDOCNODE_NODE_THIS(iface
);
1827 if(htmldoc_qi(&This
->basedoc
, riid
, ppv
))
1828 return *ppv
? S_OK
: E_NOINTERFACE
;
1830 if(IsEqualGUID(&IID_IInternetHostSecurityManager
, riid
)) {
1831 TRACE("(%p)->(IID_IInternetHostSecurityManager %p)\n", This
, ppv
);
1832 *ppv
= HOSTSECMGR(This
);
1834 return HTMLDOMNode_QI(&This
->node
, riid
, ppv
);
1837 IUnknown_AddRef((IUnknown
*)*ppv
);
1841 static void HTMLDocumentNode_destructor(HTMLDOMNode
*iface
)
1843 HTMLDocumentNode
*This
= HTMLDOCNODE_NODE_THIS(iface
);
1845 if(This
->body_event_target
)
1846 release_event_target(This
->body_event_target
);
1847 if(This
->nsevent_listener
)
1848 release_nsevents(This
);
1850 ICatInformation_Release(This
->catmgr
);
1852 IInternetSecurityManager_Release(This
->secmgr
);
1854 detach_selection(This
);
1855 detach_ranges(This
);
1856 release_nodes(This
);
1859 release_mutation(This
);
1860 nsIDOMHTMLDocument_Release(This
->nsdoc
);
1863 heap_free(This
->event_vector
);
1864 destroy_htmldoc(&This
->basedoc
);
1867 #undef HTMLDOCNODE_NODE_THIS
1869 static const NodeImplVtbl HTMLDocumentNodeImplVtbl
= {
1870 HTMLDocumentNode_QI
,
1871 HTMLDocumentNode_destructor
1874 static const tid_t HTMLDocumentNode_iface_tids
[] = {
1884 static dispex_static_data_t HTMLDocumentNode_dispex
= {
1886 DispHTMLDocument_tid
,
1888 HTMLDocumentNode_iface_tids
1891 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*nsdoc
, HTMLDocumentObj
*doc_obj
, HTMLWindow
*window
, HTMLDocumentNode
**ret
)
1893 HTMLDocumentNode
*doc
;
1896 doc
= heap_alloc_zero(sizeof(HTMLDocumentNode
));
1898 return E_OUTOFMEMORY
;
1900 doc
->basedoc
.doc_node
= doc
;
1901 doc
->basedoc
.doc_obj
= doc_obj
;
1903 init_dispex(&doc
->node
.dispex
, (IUnknown
*)HTMLDOMNODE(&doc
->node
), &HTMLDocumentNode_dispex
);
1904 init_doc(&doc
->basedoc
, (IUnknown
*)HTMLDOMNODE(&doc
->node
), DISPATCHEX(&doc
->node
.dispex
));
1905 HTMLDocumentNode_SecMgr_Init(doc
);
1908 doc
->basedoc
.window
= window
;
1909 if(window
== doc_obj
->basedoc
.window
)
1910 doc
->basedoc
.cp_container
.forward_container
= &doc_obj
->basedoc
.cp_container
;
1912 nsIDOMHTMLDocument_AddRef(nsdoc
);
1917 list_init(&doc
->bindings
);
1918 list_init(&doc
->selection_list
);
1919 list_init(&doc
->range_list
);
1921 HTMLDOMNode_Init(doc
, &doc
->node
, (nsIDOMNode
*)nsdoc
);
1922 doc
->node
.vtbl
= &HTMLDocumentNodeImplVtbl
;
1923 doc
->node
.cp_container
= &doc
->basedoc
.cp_container
;
1925 hres
= CoInternetCreateSecurityManager(NULL
, &doc
->secmgr
, 0);
1927 htmldoc_release(&doc
->basedoc
);
1935 /**********************************************************
1936 * ICustomDoc implementation
1939 #define CUSTOMDOC_THIS(iface) DEFINE_THIS(HTMLDocumentObj, CustomDoc, iface)
1941 static HRESULT WINAPI
CustomDoc_QueryInterface(ICustomDoc
*iface
, REFIID riid
, void **ppv
)
1943 HTMLDocumentObj
*This
= CUSTOMDOC_THIS(iface
);
1945 if(htmldoc_qi(&This
->basedoc
, riid
, ppv
))
1946 return *ppv
? S_OK
: E_NOINTERFACE
;
1948 if(IsEqualGUID(&IID_ICustomDoc
, riid
)) {
1949 TRACE("(%p)->(IID_ICustomDoc %p)\n", This
, ppv
);
1950 *ppv
= CUSTOMDOC(This
);
1951 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
1952 return *ppv
? S_OK
: E_NOINTERFACE
;
1954 FIXME("Unimplemented interface %s\n", debugstr_guid(riid
));
1956 return E_NOINTERFACE
;
1959 IUnknown_AddRef((IUnknown
*)*ppv
);
1963 static ULONG WINAPI
CustomDoc_AddRef(ICustomDoc
*iface
)
1965 HTMLDocumentObj
*This
= CUSTOMDOC_THIS(iface
);
1966 ULONG ref
= InterlockedIncrement(&This
->ref
);
1968 TRACE("(%p) ref = %u\n", This
, ref
);
1973 static ULONG WINAPI
CustomDoc_Release(ICustomDoc
*iface
)
1975 HTMLDocumentObj
*This
= CUSTOMDOC_THIS(iface
);
1976 ULONG ref
= InterlockedDecrement(&This
->ref
);
1978 TRACE("(%p) ref = %u\n", This
, ref
);
1981 if(This
->basedoc
.doc_node
) {
1982 This
->basedoc
.doc_node
->basedoc
.doc_obj
= NULL
;
1983 IHTMLDocument2_Release(HTMLDOC(&This
->basedoc
.doc_node
->basedoc
));
1985 if(This
->basedoc
.window
) {
1986 This
->basedoc
.window
->doc_obj
= NULL
;
1987 IHTMLWindow2_Release(HTMLWINDOW2(This
->basedoc
.window
));
1989 if(This
->basedoc
.advise_holder
)
1990 IOleAdviseHolder_Release(This
->basedoc
.advise_holder
);
1993 IOleObject_SetClientSite(OLEOBJ(&This
->basedoc
), NULL
);
1994 if(This
->in_place_active
)
1995 IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(&This
->basedoc
));
1997 IOleDocumentView_SetInPlaceSite(DOCVIEW(&This
->basedoc
), NULL
);
1999 IOleUndoManager_Release(This
->undomgr
);
2000 if(This
->tooltips_hwnd
)
2001 DestroyWindow(This
->tooltips_hwnd
);
2004 DestroyWindow(This
->hwnd
);
2005 heap_free(This
->mime
);
2007 destroy_htmldoc(&This
->basedoc
);
2008 release_dispex(&This
->dispex
);
2010 if(This
->nscontainer
)
2011 NSContainer_Release(This
->nscontainer
);
2018 static HRESULT WINAPI
CustomDoc_SetUIHandler(ICustomDoc
*iface
, IDocHostUIHandler
*pUIHandler
)
2020 HTMLDocumentObj
*This
= CUSTOMDOC_THIS(iface
);
2021 FIXME("(%p)->(%p)\n", This
, pUIHandler
);
2025 #undef CUSTOMDOC_THIS
2027 static const ICustomDocVtbl CustomDocVtbl
= {
2028 CustomDoc_QueryInterface
,
2031 CustomDoc_SetUIHandler
2034 static const tid_t HTMLDocumentObj_iface_tids
[] = {
2041 static dispex_static_data_t HTMLDocumentObj_dispex
= {
2043 DispHTMLDocument_tid
,
2045 HTMLDocumentObj_iface_tids
2048 HRESULT
HTMLDocument_Create(IUnknown
*pUnkOuter
, REFIID riid
, void** ppvObject
)
2050 HTMLDocumentObj
*doc
;
2051 nsIDOMWindow
*nswindow
= NULL
;
2055 TRACE("(%p %s %p)\n", pUnkOuter
, debugstr_guid(riid
), ppvObject
);
2057 doc
= heap_alloc_zero(sizeof(HTMLDocumentObj
));
2059 return E_OUTOFMEMORY
;
2061 init_dispex(&doc
->dispex
, (IUnknown
*)CUSTOMDOC(doc
), &HTMLDocumentObj_dispex
);
2062 init_doc(&doc
->basedoc
, (IUnknown
*)CUSTOMDOC(doc
), DISPATCHEX(&doc
->dispex
));
2064 doc
->lpCustomDocVtbl
= &CustomDocVtbl
;
2066 doc
->basedoc
.doc_obj
= doc
;
2068 doc
->usermode
= UNKNOWN_USERMODE
;
2070 doc
->nscontainer
= NSContainer_Create(doc
, NULL
);
2071 if(!doc
->nscontainer
) {
2072 ERR("Failed to init Gecko, returning CLASS_E_CLASSNOTAVAILABLE\n");
2073 htmldoc_release(&doc
->basedoc
);
2074 return CLASS_E_CLASSNOTAVAILABLE
;
2077 hres
= htmldoc_query_interface(&doc
->basedoc
, riid
, ppvObject
);
2078 htmldoc_release(&doc
->basedoc
);
2083 nsres
= nsIWebBrowser_GetContentDOMWindow(doc
->nscontainer
->webbrowser
, &nswindow
);
2084 if(NS_FAILED(nsres
))
2085 ERR("GetContentDOMWindow failed: %08x\n", nsres
);
2087 hres
= HTMLWindow_Create(doc
, nswindow
, NULL
/* FIXME */, &doc
->basedoc
.window
);
2089 nsIDOMWindow_Release(nswindow
);
2091 IHTMLDocument_Release(HTMLDOC(&doc
->basedoc
));
2095 if(!doc
->basedoc
.doc_node
&& doc
->basedoc
.window
->doc
) {
2096 doc
->basedoc
.doc_node
= doc
->basedoc
.window
->doc
;
2097 htmldoc_addref(&doc
->basedoc
.doc_node
->basedoc
);