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"
38 #include "pluginhost.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
42 static inline HTMLDocument
*impl_from_IHTMLDocument2(IHTMLDocument2
*iface
)
44 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument2_iface
);
47 static HRESULT WINAPI
HTMLDocument_QueryInterface(IHTMLDocument2
*iface
, REFIID riid
, void **ppv
)
49 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
51 return htmldoc_query_interface(This
, riid
, ppv
);
54 static ULONG WINAPI
HTMLDocument_AddRef(IHTMLDocument2
*iface
)
56 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
58 return htmldoc_addref(This
);
61 static ULONG WINAPI
HTMLDocument_Release(IHTMLDocument2
*iface
)
63 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
65 return htmldoc_release(This
);
68 static HRESULT WINAPI
HTMLDocument_GetTypeInfoCount(IHTMLDocument2
*iface
, UINT
*pctinfo
)
70 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
72 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
75 static HRESULT WINAPI
HTMLDocument_GetTypeInfo(IHTMLDocument2
*iface
, UINT iTInfo
,
76 LCID lcid
, ITypeInfo
**ppTInfo
)
78 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
80 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
83 static HRESULT WINAPI
HTMLDocument_GetIDsOfNames(IHTMLDocument2
*iface
, REFIID riid
,
84 LPOLESTR
*rgszNames
, UINT cNames
,
85 LCID lcid
, DISPID
*rgDispId
)
87 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
89 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
93 static HRESULT WINAPI
HTMLDocument_Invoke(IHTMLDocument2
*iface
, DISPID dispIdMember
,
94 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
95 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
97 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
99 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
100 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
103 static HRESULT WINAPI
HTMLDocument_get_Script(IHTMLDocument2
*iface
, IDispatch
**p
)
105 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
107 TRACE("(%p)->(%p)\n", This
, p
);
109 *p
= (IDispatch
*)&This
->window
->IHTMLWindow2_iface
;
110 IDispatch_AddRef(*p
);
114 static HRESULT WINAPI
HTMLDocument_get_all(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
116 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
117 nsIDOMElement
*nselem
= NULL
;
122 TRACE("(%p)->(%p)\n", This
, p
);
124 if(!This
->doc_node
->nsdoc
) {
125 WARN("NULL nsdoc\n");
129 nsres
= nsIDOMHTMLDocument_GetDocumentElement(This
->doc_node
->nsdoc
, &nselem
);
130 if(NS_FAILED(nsres
)) {
131 ERR("GetDocumentElement failed: %08x\n", nsres
);
140 hres
= get_node(This
->doc_node
, (nsIDOMNode
*)nselem
, TRUE
, &node
);
142 *p
= create_all_collection(node
, TRUE
);
143 nsIDOMElement_Release(nselem
);
147 static HRESULT WINAPI
HTMLDocument_get_body(IHTMLDocument2
*iface
, IHTMLElement
**p
)
149 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
150 nsIDOMHTMLElement
*nsbody
= NULL
;
154 TRACE("(%p)->(%p)\n", This
, p
);
156 if(This
->doc_node
->nsdoc
) {
159 nsres
= nsIDOMHTMLDocument_GetBody(This
->doc_node
->nsdoc
, &nsbody
);
160 if(NS_FAILED(nsres
)) {
161 TRACE("Could not get body: %08x\n", nsres
);
171 hres
= get_node(This
->doc_node
, (nsIDOMNode
*)nsbody
, TRUE
, &node
);
172 nsIDOMHTMLElement_Release(nsbody
);
176 return IHTMLDOMNode_QueryInterface(&node
->IHTMLDOMNode_iface
, &IID_IHTMLElement
, (void**)p
);
179 static HRESULT WINAPI
HTMLDocument_get_activeElement(IHTMLDocument2
*iface
, IHTMLElement
**p
)
181 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
182 FIXME("(%p)->(%p)\n", This
, p
);
186 static HRESULT WINAPI
HTMLDocument_get_images(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
188 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
189 nsIDOMHTMLCollection
*nscoll
= NULL
;
192 TRACE("(%p)->(%p)\n", This
, p
);
199 if(!This
->doc_node
->nsdoc
) {
200 WARN("NULL nsdoc\n");
204 nsres
= nsIDOMHTMLDocument_GetImages(This
->doc_node
->nsdoc
, &nscoll
);
205 if(NS_FAILED(nsres
)) {
206 ERR("GetImages failed: %08x\n", nsres
);
211 *p
= create_collection_from_htmlcol(This
->doc_node
, (IUnknown
*)&This
->IHTMLDocument2_iface
, nscoll
);
212 nsIDOMElement_Release(nscoll
);
218 static HRESULT WINAPI
HTMLDocument_get_applets(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
220 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
221 nsIDOMHTMLCollection
*nscoll
= NULL
;
224 TRACE("(%p)->(%p)\n", This
, p
);
231 if(!This
->doc_node
->nsdoc
) {
232 WARN("NULL nsdoc\n");
236 nsres
= nsIDOMHTMLDocument_GetApplets(This
->doc_node
->nsdoc
, &nscoll
);
237 if(NS_FAILED(nsres
)) {
238 ERR("GetApplets failed: %08x\n", nsres
);
243 *p
= create_collection_from_htmlcol(This
->doc_node
, (IUnknown
*)&This
->IHTMLDocument2_iface
, nscoll
);
244 nsIDOMElement_Release(nscoll
);
250 static HRESULT WINAPI
HTMLDocument_get_links(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
252 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
253 nsIDOMHTMLCollection
*nscoll
= NULL
;
256 TRACE("(%p)->(%p)\n", This
, p
);
263 if(!This
->doc_node
->nsdoc
) {
264 WARN("NULL nsdoc\n");
268 nsres
= nsIDOMHTMLDocument_GetLinks(This
->doc_node
->nsdoc
, &nscoll
);
269 if(NS_FAILED(nsres
)) {
270 ERR("GetLinks failed: %08x\n", nsres
);
275 *p
= create_collection_from_htmlcol(This
->doc_node
, (IUnknown
*)&This
->IHTMLDocument2_iface
, nscoll
);
276 nsIDOMElement_Release(nscoll
);
282 static HRESULT WINAPI
HTMLDocument_get_forms(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
284 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
285 nsIDOMHTMLCollection
*nscoll
= NULL
;
288 TRACE("(%p)->(%p)\n", This
, p
);
295 if(!This
->doc_node
->nsdoc
) {
296 WARN("NULL nsdoc\n");
300 nsres
= nsIDOMHTMLDocument_GetForms(This
->doc_node
->nsdoc
, &nscoll
);
301 if(NS_FAILED(nsres
)) {
302 ERR("GetForms failed: %08x\n", nsres
);
307 *p
= create_collection_from_htmlcol(This
->doc_node
, (IUnknown
*)&This
->IHTMLDocument2_iface
, nscoll
);
308 nsIDOMElement_Release(nscoll
);
314 static HRESULT WINAPI
HTMLDocument_get_anchors(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
316 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
317 nsIDOMHTMLCollection
*nscoll
= NULL
;
320 TRACE("(%p)->(%p)\n", This
, p
);
327 if(!This
->doc_node
->nsdoc
) {
328 WARN("NULL nsdoc\n");
332 nsres
= nsIDOMHTMLDocument_GetAnchors(This
->doc_node
->nsdoc
, &nscoll
);
333 if(NS_FAILED(nsres
)) {
334 ERR("GetAnchors failed: %08x\n", nsres
);
339 *p
= create_collection_from_htmlcol(This
->doc_node
, (IUnknown
*)&This
->IHTMLDocument2_iface
, nscoll
);
340 nsIDOMElement_Release(nscoll
);
346 static HRESULT WINAPI
HTMLDocument_put_title(IHTMLDocument2
*iface
, BSTR v
)
348 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
352 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
354 if(!This
->doc_node
->nsdoc
) {
355 WARN("NULL nsdoc\n");
359 nsAString_InitDepend(&nsstr
, v
);
360 nsres
= nsIDOMHTMLDocument_SetTitle(This
->doc_node
->nsdoc
, &nsstr
);
361 nsAString_Finish(&nsstr
);
363 ERR("SetTitle failed: %08x\n", nsres
);
368 static HRESULT WINAPI
HTMLDocument_get_title(IHTMLDocument2
*iface
, BSTR
*p
)
370 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
371 const PRUnichar
*ret
;
375 TRACE("(%p)->(%p)\n", This
, p
);
377 if(!This
->doc_node
->nsdoc
) {
378 WARN("NULL nsdoc\n");
383 nsAString_Init(&nsstr
, NULL
);
384 nsres
= nsIDOMHTMLDocument_GetTitle(This
->doc_node
->nsdoc
, &nsstr
);
385 if (NS_SUCCEEDED(nsres
)) {
386 nsAString_GetData(&nsstr
, &ret
);
387 *p
= SysAllocString(ret
);
389 nsAString_Finish(&nsstr
);
391 if(NS_FAILED(nsres
)) {
392 ERR("GetTitle failed: %08x\n", nsres
);
399 static HRESULT WINAPI
HTMLDocument_get_scripts(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
401 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
402 FIXME("(%p)->(%p)\n", This
, p
);
406 static HRESULT WINAPI
HTMLDocument_put_designMode(IHTMLDocument2
*iface
, BSTR v
)
408 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
409 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
413 static HRESULT WINAPI
HTMLDocument_get_designMode(IHTMLDocument2
*iface
, BSTR
*p
)
415 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
416 static WCHAR szOff
[] = {'O','f','f',0};
417 FIXME("(%p)->(%p) always returning Off\n", This
, p
);
422 *p
= SysAllocString(szOff
);
427 static HRESULT WINAPI
HTMLDocument_get_selection(IHTMLDocument2
*iface
, IHTMLSelectionObject
**p
)
429 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
430 nsISelection
*nsselection
;
433 TRACE("(%p)->(%p)\n", This
, p
);
435 nsres
= nsIDOMWindow_GetSelection(This
->window
->nswindow
, &nsselection
);
436 if(NS_FAILED(nsres
)) {
437 ERR("GetSelection failed: %08x\n", nsres
);
441 return HTMLSelectionObject_Create(This
->doc_node
, nsselection
, p
);
444 static HRESULT WINAPI
HTMLDocument_get_readyState(IHTMLDocument2
*iface
, BSTR
*p
)
446 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
448 static const WCHAR wszUninitialized
[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
449 static const WCHAR wszLoading
[] = {'l','o','a','d','i','n','g',0};
450 static const WCHAR wszLoaded
[] = {'l','o','a','d','e','d',0};
451 static const WCHAR wszInteractive
[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
452 static const WCHAR wszComplete
[] = {'c','o','m','p','l','e','t','e',0};
454 static const LPCWSTR readystate_str
[] = {
462 TRACE("(%p)->(%p)\n", iface
, p
);
467 *p
= SysAllocString(readystate_str
[This
->window
->readystate
]);
471 static HRESULT WINAPI
HTMLDocument_get_frames(IHTMLDocument2
*iface
, IHTMLFramesCollection2
**p
)
473 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
474 FIXME("(%p)->(%p)\n", This
, p
);
478 static HRESULT WINAPI
HTMLDocument_get_embeds(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
480 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
481 FIXME("(%p)->(%p)\n", This
, p
);
485 static HRESULT WINAPI
HTMLDocument_get_plugins(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
487 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
488 FIXME("(%p)->(%p)\n", This
, p
);
492 static HRESULT WINAPI
HTMLDocument_put_alinkColor(IHTMLDocument2
*iface
, VARIANT v
)
494 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
495 FIXME("(%p)\n", This
);
499 static HRESULT WINAPI
HTMLDocument_get_alinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
501 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
502 FIXME("(%p)->(%p)\n", This
, p
);
506 static HRESULT WINAPI
HTMLDocument_put_bgColor(IHTMLDocument2
*iface
, VARIANT v
)
508 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
509 FIXME("(%p)\n", This
);
513 static HRESULT WINAPI
HTMLDocument_get_bgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
515 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
516 FIXME("(%p)->(%p)\n", This
, p
);
520 static HRESULT WINAPI
HTMLDocument_put_fgColor(IHTMLDocument2
*iface
, VARIANT v
)
522 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
523 FIXME("(%p)\n", This
);
527 static HRESULT WINAPI
HTMLDocument_get_fgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
529 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
530 FIXME("(%p)->(%p)\n", This
, p
);
534 static HRESULT WINAPI
HTMLDocument_put_linkColor(IHTMLDocument2
*iface
, VARIANT v
)
536 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
537 FIXME("(%p)->()\n", This
);
541 static HRESULT WINAPI
HTMLDocument_get_linkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
543 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
544 FIXME("(%p)->(%p)\n", This
, p
);
548 static HRESULT WINAPI
HTMLDocument_put_vlinkColor(IHTMLDocument2
*iface
, VARIANT v
)
550 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
551 FIXME("(%p)\n", This
);
555 static HRESULT WINAPI
HTMLDocument_get_vlinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
557 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
558 FIXME("(%p)->(%p)\n", This
, p
);
562 static HRESULT WINAPI
HTMLDocument_get_referrer(IHTMLDocument2
*iface
, BSTR
*p
)
564 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
566 FIXME("(%p)->(%p)\n", This
, p
);
572 static HRESULT WINAPI
HTMLDocument_get_location(IHTMLDocument2
*iface
, IHTMLLocation
**p
)
574 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
576 TRACE("(%p)->(%p)\n", This
, p
);
578 if(!This
->doc_node
->nsdoc
) {
579 WARN("NULL nsdoc\n");
583 return IHTMLWindow2_get_location(&This
->window
->IHTMLWindow2_iface
, p
);
586 static HRESULT WINAPI
HTMLDocument_get_lastModified(IHTMLDocument2
*iface
, BSTR
*p
)
588 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
589 FIXME("(%p)->(%p)\n", This
, p
);
593 static HRESULT WINAPI
HTMLDocument_put_URL(IHTMLDocument2
*iface
, BSTR v
)
595 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
596 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
600 static HRESULT WINAPI
HTMLDocument_get_URL(IHTMLDocument2
*iface
, BSTR
*p
)
602 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
604 static const WCHAR about_blank_url
[] =
605 {'a','b','o','u','t',':','b','l','a','n','k',0};
607 TRACE("(%p)->(%p)\n", iface
, p
);
609 *p
= SysAllocString(This
->window
->url
? This
->window
->url
: about_blank_url
);
610 return *p
? S_OK
: E_OUTOFMEMORY
;
613 static HRESULT WINAPI
HTMLDocument_put_domain(IHTMLDocument2
*iface
, BSTR v
)
615 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
616 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
620 static HRESULT WINAPI
HTMLDocument_get_domain(IHTMLDocument2
*iface
, BSTR
*p
)
622 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
623 FIXME("(%p)->(%p)\n", This
, p
);
627 static HRESULT WINAPI
HTMLDocument_put_cookie(IHTMLDocument2
*iface
, BSTR v
)
629 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
632 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
634 bret
= InternetSetCookieExW(This
->window
->url
, NULL
, v
, 0, 0);
636 FIXME("InternetSetCookieExW failed: %u\n", GetLastError());
637 return HRESULT_FROM_WIN32(GetLastError());
643 static HRESULT WINAPI
HTMLDocument_get_cookie(IHTMLDocument2
*iface
, BSTR
*p
)
645 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
649 TRACE("(%p)->(%p)\n", This
, p
);
652 bret
= InternetGetCookieExW(This
->window
->url
, NULL
, NULL
, &size
, 0, NULL
);
654 switch(GetLastError()) {
655 case ERROR_INSUFFICIENT_BUFFER
:
657 case ERROR_NO_MORE_ITEMS
:
661 FIXME("InternetGetCookieExW failed: %u\n", GetLastError());
662 return HRESULT_FROM_WIN32(GetLastError());
671 *p
= SysAllocStringLen(NULL
, size
-1);
673 return E_OUTOFMEMORY
;
675 bret
= InternetGetCookieExW(This
->window
->url
, NULL
, *p
, &size
, 0, NULL
);
677 ERR("InternetGetCookieExW failed: %u\n", GetLastError());
684 static HRESULT WINAPI
HTMLDocument_put_expando(IHTMLDocument2
*iface
, VARIANT_BOOL v
)
686 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
687 FIXME("(%p)->(%x)\n", This
, v
);
691 static HRESULT WINAPI
HTMLDocument_get_expando(IHTMLDocument2
*iface
, VARIANT_BOOL
*p
)
693 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
694 FIXME("(%p)->(%p)\n", This
, p
);
698 static HRESULT WINAPI
HTMLDocument_put_charset(IHTMLDocument2
*iface
, BSTR v
)
700 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
701 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
705 static HRESULT WINAPI
HTMLDocument_get_charset(IHTMLDocument2
*iface
, BSTR
*p
)
707 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
708 FIXME("(%p)->(%p)\n", This
, p
);
712 static HRESULT WINAPI
HTMLDocument_put_defaultCharset(IHTMLDocument2
*iface
, BSTR v
)
714 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
715 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
719 static HRESULT WINAPI
HTMLDocument_get_defaultCharset(IHTMLDocument2
*iface
, BSTR
*p
)
721 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
722 FIXME("(%p)->(%p)\n", This
, p
);
726 static HRESULT WINAPI
HTMLDocument_get_mimeType(IHTMLDocument2
*iface
, BSTR
*p
)
728 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
729 FIXME("(%p)->(%p)\n", This
, p
);
733 static HRESULT WINAPI
HTMLDocument_get_fileSize(IHTMLDocument2
*iface
, BSTR
*p
)
735 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
736 FIXME("(%p)->(%p)\n", This
, p
);
740 static HRESULT WINAPI
HTMLDocument_get_fileCreatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
742 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
743 FIXME("(%p)->(%p)\n", This
, p
);
747 static HRESULT WINAPI
HTMLDocument_get_fileModifiedDate(IHTMLDocument2
*iface
, BSTR
*p
)
749 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
750 FIXME("(%p)->(%p)\n", This
, p
);
754 static HRESULT WINAPI
HTMLDocument_get_fileUpdatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
756 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
757 FIXME("(%p)->(%p)\n", This
, p
);
761 static HRESULT WINAPI
HTMLDocument_get_security(IHTMLDocument2
*iface
, BSTR
*p
)
763 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
764 FIXME("(%p)->(%p)\n", This
, p
);
768 static HRESULT WINAPI
HTMLDocument_get_protocol(IHTMLDocument2
*iface
, BSTR
*p
)
770 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
771 FIXME("(%p)->(%p)\n", This
, p
);
775 static HRESULT WINAPI
HTMLDocument_get_nameProp(IHTMLDocument2
*iface
, BSTR
*p
)
777 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
778 FIXME("(%p)->(%p)\n", This
, p
);
782 static HRESULT
document_write(HTMLDocument
*This
, SAFEARRAY
*psarray
, BOOL ln
)
790 if(!This
->doc_node
->nsdoc
) {
791 WARN("NULL nsdoc\n");
798 if(psarray
->cDims
!= 1) {
799 FIXME("cDims=%d\n", psarray
->cDims
);
803 hres
= SafeArrayAccessData(psarray
, (void**)&var
);
805 WARN("SafeArrayAccessData failed: %08x\n", hres
);
809 nsAString_Init(&nsstr
, NULL
);
811 argc
= psarray
->rgsabound
[0].cElements
;
812 for(i
=0; i
< argc
; i
++) {
813 if(V_VT(var
+i
) == VT_BSTR
) {
814 nsAString_SetData(&nsstr
, V_BSTR(var
+i
));
815 if(!ln
|| i
!= argc
-1)
816 nsres
= nsIDOMHTMLDocument_Write(This
->doc_node
->nsdoc
, &nsstr
);
818 nsres
= nsIDOMHTMLDocument_Writeln(This
->doc_node
->nsdoc
, &nsstr
);
820 ERR("Write failed: %08x\n", nsres
);
822 FIXME("vt=%d\n", V_VT(var
+i
));
826 nsAString_Finish(&nsstr
);
827 SafeArrayUnaccessData(psarray
);
832 static HRESULT WINAPI
HTMLDocument_write(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
834 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
836 TRACE("(%p)->(%p)\n", iface
, psarray
);
838 return document_write(This
, psarray
, FALSE
);
841 static HRESULT WINAPI
HTMLDocument_writeln(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
843 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
845 TRACE("(%p)->(%p)\n", This
, psarray
);
847 return document_write(This
, psarray
, TRUE
);
850 static HRESULT WINAPI
HTMLDocument_open(IHTMLDocument2
*iface
, BSTR url
, VARIANT name
,
851 VARIANT features
, VARIANT replace
, IDispatch
**pomWindowResult
)
853 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
856 static const WCHAR text_htmlW
[] = {'t','e','x','t','/','h','t','m','l',0};
858 TRACE("(%p)->(%s %s %s %s %p)\n", This
, debugstr_w(url
), debugstr_variant(&name
),
859 debugstr_variant(&features
), debugstr_variant(&replace
), pomWindowResult
);
861 if(!This
->doc_node
->nsdoc
) {
866 if(!url
|| strcmpW(url
, text_htmlW
) || V_VT(&name
) != VT_ERROR
867 || V_VT(&features
) != VT_ERROR
|| V_VT(&replace
) != VT_ERROR
)
868 FIXME("unsupported args\n");
870 nsres
= nsIDOMHTMLDocument_Open(This
->doc_node
->nsdoc
);
871 if(NS_FAILED(nsres
)) {
872 ERR("Open failed: %08x\n", nsres
);
876 *pomWindowResult
= (IDispatch
*)&This
->window
->IHTMLWindow2_iface
;
877 IHTMLWindow2_AddRef(&This
->window
->IHTMLWindow2_iface
);
881 static HRESULT WINAPI
HTMLDocument_close(IHTMLDocument2
*iface
)
883 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
886 TRACE("(%p)\n", This
);
888 if(!This
->doc_node
->nsdoc
) {
893 nsres
= nsIDOMHTMLDocument_Close(This
->doc_node
->nsdoc
);
894 if(NS_FAILED(nsres
)) {
895 ERR("Close failed: %08x\n", nsres
);
902 static HRESULT WINAPI
HTMLDocument_clear(IHTMLDocument2
*iface
)
904 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
905 nsIDOMNSHTMLDocument
*nsdoc
;
908 TRACE("(%p)\n", This
);
910 nsres
= nsIDOMHTMLDocument_QueryInterface(This
->doc_node
->nsdoc
, &IID_nsIDOMNSHTMLDocument
, (void**)&nsdoc
);
911 if(NS_FAILED(nsres
)) {
912 ERR("Could not get nsIDOMNSHTMLDocument iface: %08x\n", nsres
);
916 nsres
= nsIDOMNSHTMLDocument_Clear(nsdoc
);
917 nsIDOMNSHTMLDocument_Release(nsdoc
);
918 if(NS_FAILED(nsres
)) {
919 ERR("Clear failed: %08x\n", nsres
);
926 static HRESULT WINAPI
HTMLDocument_queryCommandSupported(IHTMLDocument2
*iface
, BSTR cmdID
,
929 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
930 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
934 static HRESULT WINAPI
HTMLDocument_queryCommandEnabled(IHTMLDocument2
*iface
, BSTR cmdID
,
937 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
938 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
942 static HRESULT WINAPI
HTMLDocument_queryCommandState(IHTMLDocument2
*iface
, BSTR cmdID
,
945 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
946 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
950 static HRESULT WINAPI
HTMLDocument_queryCommandIndeterm(IHTMLDocument2
*iface
, BSTR cmdID
,
953 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
954 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
958 static HRESULT WINAPI
HTMLDocument_queryCommandText(IHTMLDocument2
*iface
, BSTR cmdID
,
961 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
962 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
966 static HRESULT WINAPI
HTMLDocument_queryCommandValue(IHTMLDocument2
*iface
, BSTR cmdID
,
969 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
970 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
974 static HRESULT WINAPI
HTMLDocument_execCommand(IHTMLDocument2
*iface
, BSTR cmdID
,
975 VARIANT_BOOL showUI
, VARIANT value
, VARIANT_BOOL
*pfRet
)
977 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
978 FIXME("(%p)->(%s %x %p)\n", This
, debugstr_w(cmdID
), showUI
, pfRet
);
982 static HRESULT WINAPI
HTMLDocument_execCommandShowHelp(IHTMLDocument2
*iface
, BSTR cmdID
,
985 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
986 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
990 static HRESULT WINAPI
HTMLDocument_createElement(IHTMLDocument2
*iface
, BSTR eTag
,
991 IHTMLElement
**newElem
)
993 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
994 nsIDOMHTMLElement
*nselem
;
998 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eTag
), newElem
);
1000 hres
= create_nselem(This
->doc_node
, eTag
, &nselem
);
1004 hres
= HTMLElement_Create(This
->doc_node
, (nsIDOMNode
*)nselem
, TRUE
, &elem
);
1005 nsIDOMHTMLElement_Release(nselem
);
1009 *newElem
= &elem
->IHTMLElement_iface
;
1010 IHTMLElement_AddRef(&elem
->IHTMLElement_iface
);
1014 static HRESULT WINAPI
HTMLDocument_put_onhelp(IHTMLDocument2
*iface
, VARIANT v
)
1016 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1017 FIXME("(%p)\n", This
);
1021 static HRESULT WINAPI
HTMLDocument_get_onhelp(IHTMLDocument2
*iface
, VARIANT
*p
)
1023 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1024 FIXME("(%p)->(%p)\n", This
, p
);
1028 static HRESULT WINAPI
HTMLDocument_put_onclick(IHTMLDocument2
*iface
, VARIANT v
)
1030 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1032 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1034 return set_doc_event(This
, EVENTID_CLICK
, &v
);
1037 static HRESULT WINAPI
HTMLDocument_get_onclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1039 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1041 TRACE("(%p)->(%p)\n", This
, p
);
1043 return get_doc_event(This
, EVENTID_CLICK
, p
);
1046 static HRESULT WINAPI
HTMLDocument_put_ondblclick(IHTMLDocument2
*iface
, VARIANT v
)
1048 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1049 FIXME("(%p)\n", This
);
1053 static HRESULT WINAPI
HTMLDocument_get_ondblclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1055 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1056 FIXME("(%p)->(%p)\n", This
, p
);
1060 static HRESULT WINAPI
HTMLDocument_put_onkeyup(IHTMLDocument2
*iface
, VARIANT v
)
1062 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1064 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1066 return set_doc_event(This
, EVENTID_KEYUP
, &v
);
1069 static HRESULT WINAPI
HTMLDocument_get_onkeyup(IHTMLDocument2
*iface
, VARIANT
*p
)
1071 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1073 TRACE("(%p)->(%p)\n", This
, p
);
1075 return get_doc_event(This
, EVENTID_KEYUP
, p
);
1078 static HRESULT WINAPI
HTMLDocument_put_onkeydown(IHTMLDocument2
*iface
, VARIANT v
)
1080 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1082 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1084 return set_doc_event(This
, EVENTID_KEYDOWN
, &v
);
1087 static HRESULT WINAPI
HTMLDocument_get_onkeydown(IHTMLDocument2
*iface
, VARIANT
*p
)
1089 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1091 TRACE("(%p)->(%p)\n", This
, p
);
1093 return get_doc_event(This
, EVENTID_KEYDOWN
, p
);
1096 static HRESULT WINAPI
HTMLDocument_put_onkeypress(IHTMLDocument2
*iface
, VARIANT v
)
1098 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1099 FIXME("(%p)\n", This
);
1103 static HRESULT WINAPI
HTMLDocument_get_onkeypress(IHTMLDocument2
*iface
, VARIANT
*p
)
1105 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1106 FIXME("(%p)->(%p)\n", This
, p
);
1110 static HRESULT WINAPI
HTMLDocument_put_onmouseup(IHTMLDocument2
*iface
, VARIANT v
)
1112 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1114 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1116 return set_doc_event(This
, EVENTID_MOUSEUP
, &v
);
1119 static HRESULT WINAPI
HTMLDocument_get_onmouseup(IHTMLDocument2
*iface
, VARIANT
*p
)
1121 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1123 TRACE("(%p)->(%p)\n", This
, p
);
1125 return get_doc_event(This
, EVENTID_MOUSEUP
, p
);
1128 static HRESULT WINAPI
HTMLDocument_put_onmousedown(IHTMLDocument2
*iface
, VARIANT v
)
1130 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1132 TRACE("(%p)->()\n", This
);
1134 return set_doc_event(This
, EVENTID_MOUSEDOWN
, &v
);
1137 static HRESULT WINAPI
HTMLDocument_get_onmousedown(IHTMLDocument2
*iface
, VARIANT
*p
)
1139 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1141 TRACE("(%p)->(%p)\n", This
, p
);
1143 return get_doc_event(This
, EVENTID_MOUSEDOWN
, p
);
1146 static HRESULT WINAPI
HTMLDocument_put_onmousemove(IHTMLDocument2
*iface
, VARIANT v
)
1148 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1150 TRACE("(%p)->()\n", This
);
1152 return set_doc_event(This
, EVENTID_MOUSEMOVE
, &v
);
1155 static HRESULT WINAPI
HTMLDocument_get_onmousemove(IHTMLDocument2
*iface
, VARIANT
*p
)
1157 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1159 TRACE("(%p)->(%p)\n", This
, p
);
1161 return get_doc_event(This
, EVENTID_MOUSEMOVE
, p
);
1164 static HRESULT WINAPI
HTMLDocument_put_onmouseout(IHTMLDocument2
*iface
, VARIANT v
)
1166 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1168 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1170 return set_doc_event(This
, EVENTID_MOUSEOUT
, &v
);
1173 static HRESULT WINAPI
HTMLDocument_get_onmouseout(IHTMLDocument2
*iface
, VARIANT
*p
)
1175 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1177 TRACE("(%p)->(%p)\n", This
, p
);
1179 return get_doc_event(This
, EVENTID_MOUSEOUT
, p
);
1182 static HRESULT WINAPI
HTMLDocument_put_onmouseover(IHTMLDocument2
*iface
, VARIANT v
)
1184 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1186 TRACE("(%p)\n", This
);
1188 return set_doc_event(This
, EVENTID_MOUSEOVER
, &v
);
1191 static HRESULT WINAPI
HTMLDocument_get_onmouseover(IHTMLDocument2
*iface
, VARIANT
*p
)
1193 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1195 TRACE("(%p)->(%p)\n", This
, p
);
1197 return get_doc_event(This
, EVENTID_MOUSEOVER
, p
);
1200 static HRESULT WINAPI
HTMLDocument_put_onreadystatechange(IHTMLDocument2
*iface
, VARIANT v
)
1202 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1204 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1206 return set_doc_event(This
, EVENTID_READYSTATECHANGE
, &v
);
1209 static HRESULT WINAPI
HTMLDocument_get_onreadystatechange(IHTMLDocument2
*iface
, VARIANT
*p
)
1211 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1213 TRACE("(%p)->(%p)\n", This
, p
);
1215 return get_doc_event(This
, EVENTID_READYSTATECHANGE
, p
);
1218 static HRESULT WINAPI
HTMLDocument_put_onafterupdate(IHTMLDocument2
*iface
, VARIANT v
)
1220 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1221 FIXME("(%p)\n", This
);
1225 static HRESULT WINAPI
HTMLDocument_get_onafterupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1227 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1228 FIXME("(%p)->(%p)\n", This
, p
);
1232 static HRESULT WINAPI
HTMLDocument_put_onrowexit(IHTMLDocument2
*iface
, VARIANT v
)
1234 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1235 FIXME("(%p)\n", This
);
1239 static HRESULT WINAPI
HTMLDocument_get_onrowexit(IHTMLDocument2
*iface
, VARIANT
*p
)
1241 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1242 FIXME("(%p)->(%p)\n", This
, p
);
1246 static HRESULT WINAPI
HTMLDocument_put_onrowenter(IHTMLDocument2
*iface
, VARIANT v
)
1248 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1249 FIXME("(%p)\n", This
);
1253 static HRESULT WINAPI
HTMLDocument_get_onrowenter(IHTMLDocument2
*iface
, VARIANT
*p
)
1255 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1256 FIXME("(%p)->(%p)\n", This
, p
);
1260 static HRESULT WINAPI
HTMLDocument_put_ondragstart(IHTMLDocument2
*iface
, VARIANT v
)
1262 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1264 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1266 return set_doc_event(This
, EVENTID_DRAGSTART
, &v
);
1269 static HRESULT WINAPI
HTMLDocument_get_ondragstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1271 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1273 TRACE("(%p)->(%p)\n", This
, p
);
1275 return get_doc_event(This
, EVENTID_DRAGSTART
, p
);
1278 static HRESULT WINAPI
HTMLDocument_put_onselectstart(IHTMLDocument2
*iface
, VARIANT v
)
1280 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1282 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1284 return set_doc_event(This
, EVENTID_SELECTSTART
, &v
);
1287 static HRESULT WINAPI
HTMLDocument_get_onselectstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1289 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1291 TRACE("(%p)->(%p)\n", This
, p
);
1293 return get_doc_event(This
, EVENTID_SELECTSTART
, p
);
1296 static HRESULT WINAPI
HTMLDocument_elementFromPoint(IHTMLDocument2
*iface
, LONG x
, LONG y
,
1297 IHTMLElement
**elementHit
)
1299 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1300 FIXME("(%p)->(%d %d %p)\n", This
, x
, y
, elementHit
);
1304 static HRESULT WINAPI
HTMLDocument_get_parentWindow(IHTMLDocument2
*iface
, IHTMLWindow2
**p
)
1306 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1308 TRACE("(%p)->(%p)\n", This
, p
);
1310 *p
= &This
->window
->IHTMLWindow2_iface
;
1311 IHTMLWindow2_AddRef(*p
);
1315 static HRESULT WINAPI
HTMLDocument_get_styleSheets(IHTMLDocument2
*iface
,
1316 IHTMLStyleSheetsCollection
**p
)
1318 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1319 nsIDOMStyleSheetList
*nsstylelist
;
1320 nsIDOMDocumentStyle
*nsdocstyle
;
1323 TRACE("(%p)->(%p)\n", This
, p
);
1327 if(!This
->doc_node
->nsdoc
) {
1328 WARN("NULL nsdoc\n");
1329 return E_UNEXPECTED
;
1332 nsIDOMHTMLDocument_QueryInterface(This
->doc_node
->nsdoc
, &IID_nsIDOMDocumentStyle
, (void**)&nsdocstyle
);
1333 nsres
= nsIDOMDocumentStyle_GetStyleSheets(nsdocstyle
, &nsstylelist
);
1334 nsIDOMDocumentStyle_Release(nsdocstyle
);
1335 if(NS_FAILED(nsres
)) {
1336 ERR("GetStyleSheets failed: %08x\n", nsres
);
1340 *p
= HTMLStyleSheetsCollection_Create(nsstylelist
);
1341 nsIDOMDocumentStyle_Release(nsstylelist
);
1346 static HRESULT WINAPI
HTMLDocument_put_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT v
)
1348 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1349 FIXME("(%p)\n", This
);
1353 static HRESULT WINAPI
HTMLDocument_get_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1355 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1356 FIXME("(%p)->(%p)\n", This
, p
);
1360 static HRESULT WINAPI
HTMLDocument_put_onerrorupdate(IHTMLDocument2
*iface
, VARIANT v
)
1362 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1363 FIXME("(%p)\n", This
);
1367 static HRESULT WINAPI
HTMLDocument_get_onerrorupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1369 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1370 FIXME("(%p)->(%p)\n", This
, p
);
1374 static HRESULT WINAPI
HTMLDocument_toString(IHTMLDocument2
*iface
, BSTR
*String
)
1376 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1377 FIXME("(%p)->(%p)\n", This
, String
);
1381 static HRESULT WINAPI
HTMLDocument_createStyleSheet(IHTMLDocument2
*iface
, BSTR bstrHref
,
1382 LONG lIndex
, IHTMLStyleSheet
**ppnewStyleSheet
)
1384 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1386 FIXME("(%p)->(%s %d %p) semi-stub\n", This
, debugstr_w(bstrHref
), lIndex
, ppnewStyleSheet
);
1388 *ppnewStyleSheet
= HTMLStyleSheet_Create(NULL
);
1392 static const IHTMLDocument2Vtbl HTMLDocumentVtbl
= {
1393 HTMLDocument_QueryInterface
,
1394 HTMLDocument_AddRef
,
1395 HTMLDocument_Release
,
1396 HTMLDocument_GetTypeInfoCount
,
1397 HTMLDocument_GetTypeInfo
,
1398 HTMLDocument_GetIDsOfNames
,
1399 HTMLDocument_Invoke
,
1400 HTMLDocument_get_Script
,
1401 HTMLDocument_get_all
,
1402 HTMLDocument_get_body
,
1403 HTMLDocument_get_activeElement
,
1404 HTMLDocument_get_images
,
1405 HTMLDocument_get_applets
,
1406 HTMLDocument_get_links
,
1407 HTMLDocument_get_forms
,
1408 HTMLDocument_get_anchors
,
1409 HTMLDocument_put_title
,
1410 HTMLDocument_get_title
,
1411 HTMLDocument_get_scripts
,
1412 HTMLDocument_put_designMode
,
1413 HTMLDocument_get_designMode
,
1414 HTMLDocument_get_selection
,
1415 HTMLDocument_get_readyState
,
1416 HTMLDocument_get_frames
,
1417 HTMLDocument_get_embeds
,
1418 HTMLDocument_get_plugins
,
1419 HTMLDocument_put_alinkColor
,
1420 HTMLDocument_get_alinkColor
,
1421 HTMLDocument_put_bgColor
,
1422 HTMLDocument_get_bgColor
,
1423 HTMLDocument_put_fgColor
,
1424 HTMLDocument_get_fgColor
,
1425 HTMLDocument_put_linkColor
,
1426 HTMLDocument_get_linkColor
,
1427 HTMLDocument_put_vlinkColor
,
1428 HTMLDocument_get_vlinkColor
,
1429 HTMLDocument_get_referrer
,
1430 HTMLDocument_get_location
,
1431 HTMLDocument_get_lastModified
,
1432 HTMLDocument_put_URL
,
1433 HTMLDocument_get_URL
,
1434 HTMLDocument_put_domain
,
1435 HTMLDocument_get_domain
,
1436 HTMLDocument_put_cookie
,
1437 HTMLDocument_get_cookie
,
1438 HTMLDocument_put_expando
,
1439 HTMLDocument_get_expando
,
1440 HTMLDocument_put_charset
,
1441 HTMLDocument_get_charset
,
1442 HTMLDocument_put_defaultCharset
,
1443 HTMLDocument_get_defaultCharset
,
1444 HTMLDocument_get_mimeType
,
1445 HTMLDocument_get_fileSize
,
1446 HTMLDocument_get_fileCreatedDate
,
1447 HTMLDocument_get_fileModifiedDate
,
1448 HTMLDocument_get_fileUpdatedDate
,
1449 HTMLDocument_get_security
,
1450 HTMLDocument_get_protocol
,
1451 HTMLDocument_get_nameProp
,
1453 HTMLDocument_writeln
,
1457 HTMLDocument_queryCommandSupported
,
1458 HTMLDocument_queryCommandEnabled
,
1459 HTMLDocument_queryCommandState
,
1460 HTMLDocument_queryCommandIndeterm
,
1461 HTMLDocument_queryCommandText
,
1462 HTMLDocument_queryCommandValue
,
1463 HTMLDocument_execCommand
,
1464 HTMLDocument_execCommandShowHelp
,
1465 HTMLDocument_createElement
,
1466 HTMLDocument_put_onhelp
,
1467 HTMLDocument_get_onhelp
,
1468 HTMLDocument_put_onclick
,
1469 HTMLDocument_get_onclick
,
1470 HTMLDocument_put_ondblclick
,
1471 HTMLDocument_get_ondblclick
,
1472 HTMLDocument_put_onkeyup
,
1473 HTMLDocument_get_onkeyup
,
1474 HTMLDocument_put_onkeydown
,
1475 HTMLDocument_get_onkeydown
,
1476 HTMLDocument_put_onkeypress
,
1477 HTMLDocument_get_onkeypress
,
1478 HTMLDocument_put_onmouseup
,
1479 HTMLDocument_get_onmouseup
,
1480 HTMLDocument_put_onmousedown
,
1481 HTMLDocument_get_onmousedown
,
1482 HTMLDocument_put_onmousemove
,
1483 HTMLDocument_get_onmousemove
,
1484 HTMLDocument_put_onmouseout
,
1485 HTMLDocument_get_onmouseout
,
1486 HTMLDocument_put_onmouseover
,
1487 HTMLDocument_get_onmouseover
,
1488 HTMLDocument_put_onreadystatechange
,
1489 HTMLDocument_get_onreadystatechange
,
1490 HTMLDocument_put_onafterupdate
,
1491 HTMLDocument_get_onafterupdate
,
1492 HTMLDocument_put_onrowexit
,
1493 HTMLDocument_get_onrowexit
,
1494 HTMLDocument_put_onrowenter
,
1495 HTMLDocument_get_onrowenter
,
1496 HTMLDocument_put_ondragstart
,
1497 HTMLDocument_get_ondragstart
,
1498 HTMLDocument_put_onselectstart
,
1499 HTMLDocument_get_onselectstart
,
1500 HTMLDocument_elementFromPoint
,
1501 HTMLDocument_get_parentWindow
,
1502 HTMLDocument_get_styleSheets
,
1503 HTMLDocument_put_onbeforeupdate
,
1504 HTMLDocument_get_onbeforeupdate
,
1505 HTMLDocument_put_onerrorupdate
,
1506 HTMLDocument_get_onerrorupdate
,
1507 HTMLDocument_toString
,
1508 HTMLDocument_createStyleSheet
1511 static void HTMLDocument_on_advise(IUnknown
*iface
, cp_static_data_t
*cp
)
1513 HTMLDocument
*This
= impl_from_IHTMLDocument2((IHTMLDocument2
*)iface
);
1516 update_cp_events(This
->window
, &This
->doc_node
->node
.event_target
, cp
, This
->doc_node
->node
.nsnode
);
1519 static inline HTMLDocument
*impl_from_ISupportErrorInfo(ISupportErrorInfo
*iface
)
1521 return CONTAINING_RECORD(iface
, HTMLDocument
, ISupportErrorInfo_iface
);
1524 static HRESULT WINAPI
SupportErrorInfo_QueryInterface(ISupportErrorInfo
*iface
, REFIID riid
, void **ppv
)
1526 HTMLDocument
*This
= impl_from_ISupportErrorInfo(iface
);
1527 return htmldoc_query_interface(This
, riid
, ppv
);
1530 static ULONG WINAPI
SupportErrorInfo_AddRef(ISupportErrorInfo
*iface
)
1532 HTMLDocument
*This
= impl_from_ISupportErrorInfo(iface
);
1533 return htmldoc_addref(This
);
1536 static ULONG WINAPI
SupportErrorInfo_Release(ISupportErrorInfo
*iface
)
1538 HTMLDocument
*This
= impl_from_ISupportErrorInfo(iface
);
1539 return htmldoc_release(This
);
1542 static HRESULT WINAPI
SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo
*iface
, REFIID riid
)
1544 FIXME("(%p)->(%s)\n", iface
, debugstr_guid(riid
));
1548 static const ISupportErrorInfoVtbl SupportErrorInfoVtbl
= {
1549 SupportErrorInfo_QueryInterface
,
1550 SupportErrorInfo_AddRef
,
1551 SupportErrorInfo_Release
,
1552 SupportErrorInfo_InterfaceSupportsErrorInfo
1555 static inline HTMLDocument
*impl_from_IDispatchEx(IDispatchEx
*iface
)
1557 return CONTAINING_RECORD(iface
, HTMLDocument
, IDispatchEx_iface
);
1560 static HRESULT WINAPI
DocDispatchEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
1562 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
1564 return htmldoc_query_interface(This
, riid
, ppv
);
1567 static ULONG WINAPI
DocDispatchEx_AddRef(IDispatchEx
*iface
)
1569 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
1571 return htmldoc_addref(This
);
1574 static ULONG WINAPI
DocDispatchEx_Release(IDispatchEx
*iface
)
1576 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
1578 return htmldoc_release(This
);
1581 static HRESULT WINAPI
DocDispatchEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
1583 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
1585 return IDispatchEx_GetTypeInfoCount(This
->dispex
, pctinfo
);
1588 static HRESULT WINAPI
DocDispatchEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
1589 LCID lcid
, ITypeInfo
**ppTInfo
)
1591 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
1593 return IDispatchEx_GetTypeInfo(This
->dispex
, iTInfo
, lcid
, ppTInfo
);
1596 static HRESULT WINAPI
DocDispatchEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
1597 LPOLESTR
*rgszNames
, UINT cNames
,
1598 LCID lcid
, DISPID
*rgDispId
)
1600 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
1602 return IDispatchEx_GetIDsOfNames(This
->dispex
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1605 static HRESULT WINAPI
DocDispatchEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
1606 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1607 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1609 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
1611 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
1612 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1614 switch(dispIdMember
) {
1615 case DISPID_READYSTATE
:
1616 TRACE("DISPID_READYSTATE\n");
1618 if(!(wFlags
& DISPATCH_PROPERTYGET
))
1619 return E_INVALIDARG
;
1621 V_VT(pVarResult
) = VT_I4
;
1622 V_I4(pVarResult
) = This
->window
->readystate
;
1626 return IDispatchEx_Invoke(This
->dispex
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
1627 pVarResult
, pExcepInfo
, puArgErr
);
1630 static HRESULT WINAPI
DocDispatchEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
1632 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
1634 return IDispatchEx_GetDispID(This
->dispex
, bstrName
, grfdex
, pid
);
1637 static HRESULT WINAPI
DocDispatchEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
1638 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
1640 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
1642 if(This
->window
&& id
== DISPID_IHTMLDOCUMENT2_LOCATION
&& (wFlags
& DISPATCH_PROPERTYPUT
))
1643 return IDispatchEx_InvokeEx(&This
->window
->IDispatchEx_iface
, DISPID_IHTMLWINDOW2_LOCATION
,
1644 lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
1647 return IDispatchEx_InvokeEx(This
->dispex
, id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
1650 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
1652 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
1654 return IDispatchEx_DeleteMemberByName(This
->dispex
, bstrName
, grfdex
);
1657 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
1659 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
1661 return IDispatchEx_DeleteMemberByDispID(This
->dispex
, id
);
1664 static HRESULT WINAPI
DocDispatchEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
1666 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
1668 return IDispatchEx_GetMemberProperties(This
->dispex
, id
, grfdexFetch
, pgrfdex
);
1671 static HRESULT WINAPI
DocDispatchEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
1673 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
1675 return IDispatchEx_GetMemberName(This
->dispex
, id
, pbstrName
);
1678 static HRESULT WINAPI
DocDispatchEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
1680 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
1682 return IDispatchEx_GetNextDispID(This
->dispex
, grfdex
, id
, pid
);
1685 static HRESULT WINAPI
DocDispatchEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
1687 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
1689 return IDispatchEx_GetNameSpaceParent(This
->dispex
, ppunk
);
1692 static const IDispatchExVtbl DocDispatchExVtbl
= {
1693 DocDispatchEx_QueryInterface
,
1694 DocDispatchEx_AddRef
,
1695 DocDispatchEx_Release
,
1696 DocDispatchEx_GetTypeInfoCount
,
1697 DocDispatchEx_GetTypeInfo
,
1698 DocDispatchEx_GetIDsOfNames
,
1699 DocDispatchEx_Invoke
,
1700 DocDispatchEx_GetDispID
,
1701 DocDispatchEx_InvokeEx
,
1702 DocDispatchEx_DeleteMemberByName
,
1703 DocDispatchEx_DeleteMemberByDispID
,
1704 DocDispatchEx_GetMemberProperties
,
1705 DocDispatchEx_GetMemberName
,
1706 DocDispatchEx_GetNextDispID
,
1707 DocDispatchEx_GetNameSpaceParent
1710 static BOOL
htmldoc_qi(HTMLDocument
*This
, REFIID riid
, void **ppv
)
1714 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
1715 TRACE("(%p)->(IID_IUnknown, %p)\n", This
, ppv
);
1716 *ppv
= &This
->IHTMLDocument2_iface
;
1717 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
1718 TRACE("(%p)->(IID_IDispatch, %p)\n", This
, ppv
);
1719 *ppv
= &This
->IDispatchEx_iface
;
1720 }else if(IsEqualGUID(&IID_IDispatchEx
, riid
)) {
1721 TRACE("(%p)->(IID_IDispatchEx, %p)\n", This
, ppv
);
1722 *ppv
= &This
->IDispatchEx_iface
;
1723 }else if(IsEqualGUID(&IID_IHTMLDocument
, riid
)) {
1724 TRACE("(%p)->(IID_IHTMLDocument, %p)\n", This
, ppv
);
1725 *ppv
= &This
->IHTMLDocument2_iface
;
1726 }else if(IsEqualGUID(&IID_IHTMLDocument2
, riid
)) {
1727 TRACE("(%p)->(IID_IHTMLDocument2, %p)\n", This
, ppv
);
1728 *ppv
= &This
->IHTMLDocument2_iface
;
1729 }else if(IsEqualGUID(&IID_IHTMLDocument3
, riid
)) {
1730 TRACE("(%p)->(IID_IHTMLDocument3, %p)\n", This
, ppv
);
1731 *ppv
= &This
->IHTMLDocument3_iface
;
1732 }else if(IsEqualGUID(&IID_IHTMLDocument4
, riid
)) {
1733 TRACE("(%p)->(IID_IHTMLDocument4, %p)\n", This
, ppv
);
1734 *ppv
= &This
->IHTMLDocument4_iface
;
1735 }else if(IsEqualGUID(&IID_IHTMLDocument5
, riid
)) {
1736 TRACE("(%p)->(IID_IHTMLDocument5, %p)\n", This
, ppv
);
1737 *ppv
= &This
->IHTMLDocument5_iface
;
1738 }else if(IsEqualGUID(&IID_IHTMLDocument6
, riid
)) {
1739 TRACE("(%p)->(IID_IHTMLDocument6, %p)\n", This
, ppv
);
1740 *ppv
= &This
->IHTMLDocument6_iface
;
1741 }else if(IsEqualGUID(&IID_IPersist
, riid
)) {
1742 TRACE("(%p)->(IID_IPersist, %p)\n", This
, ppv
);
1743 *ppv
= &This
->IPersistFile_iface
;
1744 }else if(IsEqualGUID(&IID_IPersistMoniker
, riid
)) {
1745 TRACE("(%p)->(IID_IPersistMoniker, %p)\n", This
, ppv
);
1746 *ppv
= &This
->IPersistMoniker_iface
;
1747 }else if(IsEqualGUID(&IID_IPersistFile
, riid
)) {
1748 TRACE("(%p)->(IID_IPersistFile, %p)\n", This
, ppv
);
1749 *ppv
= &This
->IPersistFile_iface
;
1750 }else if(IsEqualGUID(&IID_IMonikerProp
, riid
)) {
1751 TRACE("(%p)->(IID_IMonikerProp, %p)\n", This
, ppv
);
1752 *ppv
= &This
->IMonikerProp_iface
;
1753 }else if(IsEqualGUID(&IID_IOleObject
, riid
)) {
1754 TRACE("(%p)->(IID_IOleObject, %p)\n", This
, ppv
);
1755 *ppv
= &This
->IOleObject_iface
;
1756 }else if(IsEqualGUID(&IID_IOleDocument
, riid
)) {
1757 TRACE("(%p)->(IID_IOleDocument, %p)\n", This
, ppv
);
1758 *ppv
= &This
->IOleDocument_iface
;
1759 }else if(IsEqualGUID(&IID_IOleDocumentView
, riid
)) {
1760 TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This
, ppv
);
1761 *ppv
= &This
->IOleDocumentView_iface
;
1762 }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject
, riid
)) {
1763 TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This
, ppv
);
1764 *ppv
= &This
->IOleInPlaceActiveObject_iface
;
1765 }else if(IsEqualGUID(&IID_IViewObject
, riid
)) {
1766 TRACE("(%p)->(IID_IViewObject, %p)\n", This
, ppv
);
1767 *ppv
= &This
->IViewObjectEx_iface
;
1768 }else if(IsEqualGUID(&IID_IViewObject2
, riid
)) {
1769 TRACE("(%p)->(IID_IViewObject2, %p)\n", This
, ppv
);
1770 *ppv
= &This
->IViewObjectEx_iface
;
1771 }else if(IsEqualGUID(&IID_IViewObjectEx
, riid
)) {
1772 TRACE("(%p)->(IID_IViewObjectEx, %p)\n", This
, ppv
);
1773 *ppv
= &This
->IViewObjectEx_iface
;
1774 }else if(IsEqualGUID(&IID_IOleWindow
, riid
)) {
1775 TRACE("(%p)->(IID_IOleWindow, %p)\n", This
, ppv
);
1776 *ppv
= &This
->IOleInPlaceActiveObject_iface
;
1777 }else if(IsEqualGUID(&IID_IOleInPlaceObject
, riid
)) {
1778 TRACE("(%p)->(IID_IOleInPlaceObject, %p)\n", This
, ppv
);
1779 *ppv
= &This
->IOleInPlaceObjectWindowless_iface
;
1780 }else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless
, riid
)) {
1781 TRACE("(%p)->(IID_IOleInPlaceObjectWindowless, %p)\n", This
, ppv
);
1782 *ppv
= &This
->IOleInPlaceObjectWindowless_iface
;
1783 }else if(IsEqualGUID(&IID_IServiceProvider
, riid
)) {
1784 TRACE("(%p)->(IID_IServiceProvider, %p)\n", This
, ppv
);
1785 *ppv
= &This
->IServiceProvider_iface
;
1786 }else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
)) {
1787 TRACE("(%p)->(IID_IOleCommandTarget, %p)\n", This
, ppv
);
1788 *ppv
= &This
->IOleCommandTarget_iface
;
1789 }else if(IsEqualGUID(&IID_IOleControl
, riid
)) {
1790 TRACE("(%p)->(IID_IOleControl, %p)\n", This
, ppv
);
1791 *ppv
= &This
->IOleControl_iface
;
1792 }else if(IsEqualGUID(&IID_IHlinkTarget
, riid
)) {
1793 TRACE("(%p)->(IID_IHlinkTarget, %p)\n", This
, ppv
);
1794 *ppv
= &This
->IHlinkTarget_iface
;
1795 }else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
)) {
1796 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This
, ppv
);
1797 *ppv
= &This
->cp_container
.IConnectionPointContainer_iface
;
1798 }else if(IsEqualGUID(&IID_IPersistStreamInit
, riid
)) {
1799 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This
, ppv
);
1800 *ppv
= &This
->IPersistStreamInit_iface
;
1801 }else if(IsEqualGUID(&DIID_DispHTMLDocument
, riid
)) {
1802 TRACE("(%p)->(DIID_DispHTMLDocument %p)\n", This
, ppv
);
1803 *ppv
= &This
->IHTMLDocument2_iface
;
1804 }else if(IsEqualGUID(&IID_ISupportErrorInfo
, riid
)) {
1805 TRACE("(%p)->(IID_ISupportErrorInfo %p)\n", This
, ppv
);
1806 *ppv
= &This
->ISupportErrorInfo_iface
;
1807 }else if(IsEqualGUID(&IID_IPersistHistory
, riid
)) {
1808 TRACE("(%p)->(IID_IPersistHistory %p)\n", This
, ppv
);
1809 *ppv
= &This
->IPersistHistory_iface
;
1810 }else if(IsEqualGUID(&CLSID_CMarkup
, riid
)) {
1811 FIXME("(%p)->(CLSID_CMarkup %p)\n", This
, ppv
);
1813 }else if(IsEqualGUID(&IID_IRunnableObject
, riid
)) {
1814 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This
, ppv
);
1816 }else if(IsEqualGUID(&IID_IPersistPropertyBag
, riid
)) {
1817 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This
, ppv
);
1819 }else if(IsEqualGUID(&IID_IMarshal
, riid
)) {
1820 TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This
, ppv
);
1822 }else if(IsEqualGUID(&IID_IExternalConnection
, riid
)) {
1823 TRACE("(%p)->(IID_IExternalConnection %p) returning NULL\n", This
, ppv
);
1825 }else if(IsEqualGUID(&IID_IStdMarshalInfo
, riid
)) {
1826 TRACE("(%p)->(IID_IStdMarshalInfo %p) returning NULL\n", This
, ppv
);
1828 }else if(IsEqualGUID(&IID_IObjectWithSite
, riid
)) {
1829 TRACE("(%p)->(IID_IObjectWithSite %p)\n", This
, ppv
);
1830 *ppv
= &This
->IObjectWithSite_iface
;
1831 }else if(IsEqualGUID(&IID_IOleContainer
, riid
)) {
1832 TRACE("(%p)->(IID_IOleContainer %p)\n", This
, ppv
);
1833 *ppv
= &This
->IOleContainer_iface
;
1834 }else if(IsEqualGUID(&IID_IObjectSafety
, riid
)) {
1835 TRACE("(%p)->(IID_IObjectSafety %p)\n", This
, ppv
);
1836 *ppv
= &This
->IObjectSafety_iface
;
1842 IUnknown_AddRef((IUnknown
*)*ppv
);
1846 static cp_static_data_t HTMLDocumentEvents_data
= { HTMLDocumentEvents_tid
, HTMLDocument_on_advise
};
1848 static void init_doc(HTMLDocument
*doc
, IUnknown
*unk_impl
, IDispatchEx
*dispex
)
1850 doc
->IHTMLDocument2_iface
.lpVtbl
= &HTMLDocumentVtbl
;
1851 doc
->IDispatchEx_iface
.lpVtbl
= &DocDispatchExVtbl
;
1852 doc
->ISupportErrorInfo_iface
.lpVtbl
= &SupportErrorInfoVtbl
;
1854 doc
->unk_impl
= unk_impl
;
1855 doc
->dispex
= dispex
;
1856 doc
->task_magic
= get_task_target_magic();
1858 HTMLDocument_HTMLDocument3_Init(doc
);
1859 HTMLDocument_HTMLDocument5_Init(doc
);
1860 HTMLDocument_Persist_Init(doc
);
1861 HTMLDocument_OleCmd_Init(doc
);
1862 HTMLDocument_OleObj_Init(doc
);
1863 HTMLDocument_View_Init(doc
);
1864 HTMLDocument_Window_Init(doc
);
1865 HTMLDocument_Service_Init(doc
);
1866 HTMLDocument_Hlink_Init(doc
);
1868 ConnectionPointContainer_Init(&doc
->cp_container
, (IUnknown
*)&doc
->IHTMLDocument2_iface
);
1869 ConnectionPoint_Init(&doc
->cp_dispatch
, &doc
->cp_container
, &IID_IDispatch
, NULL
);
1870 ConnectionPoint_Init(&doc
->cp_propnotif
, &doc
->cp_container
, &IID_IPropertyNotifySink
, NULL
);
1871 ConnectionPoint_Init(&doc
->cp_htmldocevents
, &doc
->cp_container
, &DIID_HTMLDocumentEvents
, &HTMLDocumentEvents_data
);
1872 ConnectionPoint_Init(&doc
->cp_htmldocevents2
, &doc
->cp_container
, &DIID_HTMLDocumentEvents2
, NULL
);
1875 static void destroy_htmldoc(HTMLDocument
*This
)
1877 remove_target_tasks(This
->task_magic
);
1879 ConnectionPointContainer_Destroy(&This
->cp_container
);
1882 static inline HTMLDocumentNode
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
1884 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, node
);
1887 static HRESULT
HTMLDocumentNode_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
1889 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
1891 if(htmldoc_qi(&This
->basedoc
, riid
, ppv
))
1892 return *ppv
? S_OK
: E_NOINTERFACE
;
1894 if(IsEqualGUID(&IID_IInternetHostSecurityManager
, riid
)) {
1895 TRACE("(%p)->(IID_IInternetHostSecurityManager %p)\n", This
, ppv
);
1896 *ppv
= &This
->IInternetHostSecurityManager_iface
;
1898 return HTMLDOMNode_QI(&This
->node
, riid
, ppv
);
1901 IUnknown_AddRef((IUnknown
*)*ppv
);
1905 static void HTMLDocumentNode_destructor(HTMLDOMNode
*iface
)
1907 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
1909 if(This
->body_event_target
)
1910 release_event_target(This
->body_event_target
);
1911 if(This
->nsevent_listener
)
1912 release_nsevents(This
);
1914 ICatInformation_Release(This
->catmgr
);
1916 IInternetSecurityManager_Release(This
->secmgr
);
1918 detach_selection(This
);
1919 detach_ranges(This
);
1920 release_nodes(This
);
1922 while(!list_empty(&This
->plugin_hosts
))
1923 detach_plugin_host(LIST_ENTRY(list_head(&This
->plugin_hosts
), PluginHost
, entry
));
1926 release_mutation(This
);
1927 nsIDOMHTMLDocument_Release(This
->nsdoc
);
1930 heap_free(This
->event_vector
);
1931 destroy_htmldoc(&This
->basedoc
);
1934 static HRESULT
HTMLDocumentNode_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
1936 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
1937 FIXME("%p\n", This
);
1941 static const NodeImplVtbl HTMLDocumentNodeImplVtbl
= {
1942 HTMLDocumentNode_QI
,
1943 HTMLDocumentNode_destructor
,
1944 HTMLDocumentNode_clone
1947 static HRESULT
HTMLDocumentFragment_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
1949 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
1950 HTMLDocumentNode
*new_node
;
1953 hres
= create_document_fragment(nsnode
, This
->node
.doc
, &new_node
);
1957 *ret
= &new_node
->node
;
1961 static const NodeImplVtbl HTMLDocumentFragmentImplVtbl
= {
1962 HTMLDocumentNode_QI
,
1963 HTMLDocumentNode_destructor
,
1964 HTMLDocumentFragment_clone
1967 static const tid_t HTMLDocumentNode_iface_tids
[] = {
1977 static dispex_static_data_t HTMLDocumentNode_dispex
= {
1979 DispHTMLDocument_tid
,
1981 HTMLDocumentNode_iface_tids
1984 static HTMLDocumentNode
*alloc_doc_node(HTMLDocumentObj
*doc_obj
, HTMLWindow
*window
)
1986 HTMLDocumentNode
*doc
;
1988 doc
= heap_alloc_zero(sizeof(HTMLDocumentNode
));
1993 doc
->basedoc
.doc_node
= doc
;
1994 doc
->basedoc
.doc_obj
= doc_obj
;
1995 doc
->basedoc
.window
= window
;
1997 init_dispex(&doc
->node
.dispex
, (IUnknown
*)&doc
->node
.IHTMLDOMNode_iface
,
1998 &HTMLDocumentNode_dispex
);
1999 init_doc(&doc
->basedoc
, (IUnknown
*)&doc
->node
.IHTMLDOMNode_iface
,
2000 &doc
->node
.dispex
.IDispatchEx_iface
);
2001 HTMLDocumentNode_SecMgr_Init(doc
);
2005 list_init(&doc
->bindings
);
2006 list_init(&doc
->selection_list
);
2007 list_init(&doc
->range_list
);
2008 list_init(&doc
->plugin_hosts
);
2013 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*nsdoc
, HTMLDocumentObj
*doc_obj
, HTMLWindow
*window
, HTMLDocumentNode
**ret
)
2015 HTMLDocumentNode
*doc
;
2018 doc
= alloc_doc_node(doc_obj
, window
);
2020 return E_OUTOFMEMORY
;
2022 if(window
== doc_obj
->basedoc
.window
)
2023 doc
->basedoc
.cp_container
.forward_container
= &doc_obj
->basedoc
.cp_container
;
2025 nsIDOMHTMLDocument_AddRef(nsdoc
);
2029 HTMLDOMNode_Init(doc
, &doc
->node
, (nsIDOMNode
*)nsdoc
);
2030 doc
->node
.vtbl
= &HTMLDocumentNodeImplVtbl
;
2031 doc
->node
.cp_container
= &doc
->basedoc
.cp_container
;
2033 hres
= CoInternetCreateSecurityManager(NULL
, &doc
->secmgr
, 0);
2035 htmldoc_release(&doc
->basedoc
);
2043 HRESULT
create_document_fragment(nsIDOMNode
*nsnode
, HTMLDocumentNode
*doc_node
, HTMLDocumentNode
**ret
)
2045 HTMLDocumentNode
*doc_frag
;
2047 doc_frag
= alloc_doc_node(doc_node
->basedoc
.doc_obj
, doc_node
->basedoc
.window
);
2049 return E_OUTOFMEMORY
;
2051 HTMLDOMNode_Init(doc_node
, &doc_frag
->node
, nsnode
);
2052 doc_frag
->node
.vtbl
= &HTMLDocumentFragmentImplVtbl
;
2053 doc_frag
->node
.cp_container
= &doc_frag
->basedoc
.cp_container
;
2055 htmldoc_addref(&doc_frag
->basedoc
);
2060 /**********************************************************
2061 * ICustomDoc implementation
2064 static inline HTMLDocumentObj
*impl_from_ICustomDoc(ICustomDoc
*iface
)
2066 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, ICustomDoc_iface
);
2069 static HRESULT WINAPI
CustomDoc_QueryInterface(ICustomDoc
*iface
, REFIID riid
, void **ppv
)
2071 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
2073 if(htmldoc_qi(&This
->basedoc
, riid
, ppv
))
2074 return *ppv
? S_OK
: E_NOINTERFACE
;
2076 if(IsEqualGUID(&IID_ICustomDoc
, riid
)) {
2077 TRACE("(%p)->(IID_ICustomDoc %p)\n", This
, ppv
);
2078 *ppv
= &This
->ICustomDoc_iface
;
2079 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
2080 return *ppv
? S_OK
: E_NOINTERFACE
;
2082 FIXME("Unimplemented interface %s\n", debugstr_guid(riid
));
2084 return E_NOINTERFACE
;
2087 IUnknown_AddRef((IUnknown
*)*ppv
);
2091 static ULONG WINAPI
CustomDoc_AddRef(ICustomDoc
*iface
)
2093 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
2094 ULONG ref
= InterlockedIncrement(&This
->ref
);
2096 TRACE("(%p) ref = %u\n", This
, ref
);
2101 static ULONG WINAPI
CustomDoc_Release(ICustomDoc
*iface
)
2103 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
2104 ULONG ref
= InterlockedDecrement(&This
->ref
);
2106 TRACE("(%p) ref = %u\n", This
, ref
);
2109 if(This
->basedoc
.doc_node
) {
2110 This
->basedoc
.doc_node
->basedoc
.doc_obj
= NULL
;
2111 htmldoc_release(&This
->basedoc
.doc_node
->basedoc
);
2113 if(This
->basedoc
.window
) {
2114 This
->basedoc
.window
->doc_obj
= NULL
;
2115 IHTMLWindow2_Release(&This
->basedoc
.window
->IHTMLWindow2_iface
);
2117 if(This
->basedoc
.advise_holder
)
2118 IOleAdviseHolder_Release(This
->basedoc
.advise_holder
);
2121 IAdviseSink_Release(This
->view_sink
);
2123 IOleObject_SetClientSite(&This
->basedoc
.IOleObject_iface
, NULL
);
2125 ICustomDoc_SetUIHandler(&This
->ICustomDoc_iface
, NULL
);
2126 if(This
->in_place_active
)
2127 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This
->basedoc
.IOleInPlaceObjectWindowless_iface
);
2129 IOleDocumentView_SetInPlaceSite(&This
->basedoc
.IOleDocumentView_iface
, NULL
);
2131 IOleUndoManager_Release(This
->undomgr
);
2132 if(This
->tooltips_hwnd
)
2133 DestroyWindow(This
->tooltips_hwnd
);
2136 DestroyWindow(This
->hwnd
);
2137 heap_free(This
->mime
);
2139 destroy_htmldoc(&This
->basedoc
);
2140 release_dispex(&This
->dispex
);
2142 if(This
->nscontainer
)
2143 NSContainer_Release(This
->nscontainer
);
2150 static HRESULT WINAPI
CustomDoc_SetUIHandler(ICustomDoc
*iface
, IDocHostUIHandler
*pUIHandler
)
2152 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
2153 IOleCommandTarget
*cmdtrg
;
2156 TRACE("(%p)->(%p)\n", This
, pUIHandler
);
2158 if(This
->custom_hostui
&& This
->hostui
== pUIHandler
)
2161 This
->custom_hostui
= TRUE
;
2164 IDocHostUIHandler_Release(This
->hostui
);
2166 IDocHostUIHandler_AddRef(pUIHandler
);
2167 This
->hostui
= pUIHandler
;
2171 hres
= IDocHostUIHandler_QueryInterface(pUIHandler
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
2172 if(SUCCEEDED(hres
)) {
2173 FIXME("custom UI handler supports IOleCommandTarget\n");
2174 IOleCommandTarget_Release(cmdtrg
);
2180 static const ICustomDocVtbl CustomDocVtbl
= {
2181 CustomDoc_QueryInterface
,
2184 CustomDoc_SetUIHandler
2187 static const tid_t HTMLDocumentObj_iface_tids
[] = {
2194 static dispex_static_data_t HTMLDocumentObj_dispex
= {
2196 DispHTMLDocument_tid
,
2198 HTMLDocumentObj_iface_tids
2201 HRESULT
HTMLDocument_Create(IUnknown
*pUnkOuter
, REFIID riid
, void** ppvObject
)
2203 HTMLDocumentObj
*doc
;
2204 nsIDOMWindow
*nswindow
= NULL
;
2208 TRACE("(%p %s %p)\n", pUnkOuter
, debugstr_guid(riid
), ppvObject
);
2210 doc
= heap_alloc_zero(sizeof(HTMLDocumentObj
));
2212 return E_OUTOFMEMORY
;
2214 init_dispex(&doc
->dispex
, (IUnknown
*)&doc
->ICustomDoc_iface
, &HTMLDocumentObj_dispex
);
2215 init_doc(&doc
->basedoc
, (IUnknown
*)&doc
->ICustomDoc_iface
, &doc
->dispex
.IDispatchEx_iface
);
2217 doc
->ICustomDoc_iface
.lpVtbl
= &CustomDocVtbl
;
2219 doc
->basedoc
.doc_obj
= doc
;
2221 doc
->usermode
= UNKNOWN_USERMODE
;
2223 doc
->nscontainer
= NSContainer_Create(doc
, NULL
);
2224 if(!doc
->nscontainer
) {
2225 ERR("Failed to init Gecko, returning CLASS_E_CLASSNOTAVAILABLE\n");
2226 htmldoc_release(&doc
->basedoc
);
2227 return CLASS_E_CLASSNOTAVAILABLE
;
2230 hres
= htmldoc_query_interface(&doc
->basedoc
, riid
, ppvObject
);
2231 htmldoc_release(&doc
->basedoc
);
2236 nsres
= nsIWebBrowser_GetContentDOMWindow(doc
->nscontainer
->webbrowser
, &nswindow
);
2237 if(NS_FAILED(nsres
))
2238 ERR("GetContentDOMWindow failed: %08x\n", nsres
);
2240 hres
= HTMLWindow_Create(doc
, nswindow
, NULL
/* FIXME */, &doc
->basedoc
.window
);
2242 nsIDOMWindow_Release(nswindow
);
2244 htmldoc_release(&doc
->basedoc
);
2248 if(!doc
->basedoc
.doc_node
&& doc
->basedoc
.window
->doc
) {
2249 doc
->basedoc
.doc_node
= doc
->basedoc
.window
->doc
;
2250 htmldoc_addref(&doc
->basedoc
.doc_node
->basedoc
);