2 * Copyright 2005 Jacek Caban
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "wine/debug.h"
33 #include "mshtml_private.h"
34 #include "htmlevent.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
38 #define HTMLDOC_THIS(iface) DEFINE_THIS(HTMLDocument, HTMLDocument2, iface)
40 static HRESULT WINAPI
HTMLDocument_QueryInterface(IHTMLDocument2
*iface
, REFIID riid
, void **ppvObject
)
42 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
45 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
46 TRACE("(%p)->(IID_IUnknown, %p)\n", This
, ppvObject
);
47 *ppvObject
= HTMLDOC(This
);
48 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
49 TRACE("(%p)->(IID_IDispatch, %p)\n", This
, ppvObject
);
50 *ppvObject
= DISPATCHEX(This
);
51 }else if(IsEqualGUID(&IID_IDispatchEx
, riid
)) {
52 TRACE("(%p)->(IID_IDispatchEx, %p)\n", This
, ppvObject
);
53 *ppvObject
= DISPATCHEX(This
);
54 }else if(IsEqualGUID(&IID_IHTMLDocument
, riid
)) {
55 TRACE("(%p)->(IID_IHTMLDocument, %p)\n", This
, ppvObject
);
56 *ppvObject
= HTMLDOC(This
);
57 }else if(IsEqualGUID(&IID_IHTMLDocument2
, riid
)) {
58 TRACE("(%p)->(IID_IHTMLDocument2, %p)\n", This
, ppvObject
);
59 *ppvObject
= HTMLDOC(This
);
60 }else if(IsEqualGUID(&IID_IHTMLDocument3
, riid
)) {
61 TRACE("(%p)->(IID_IHTMLDocument3, %p)\n", This
, ppvObject
);
62 *ppvObject
= HTMLDOC3(This
);
63 }else if(IsEqualGUID(&IID_IHTMLDocument4
, riid
)) {
64 TRACE("(%p)->(IID_IHTMLDocument4, %p)\n", This
, ppvObject
);
65 *ppvObject
= HTMLDOC4(This
);
66 }else if(IsEqualGUID(&IID_IHTMLDocument5
, riid
)) {
67 TRACE("(%p)->(IID_IHTMLDocument5, %p)\n", This
, ppvObject
);
68 *ppvObject
= HTMLDOC5(This
);
69 }else if(IsEqualGUID(&IID_IPersist
, riid
)) {
70 TRACE("(%p)->(IID_IPersist, %p)\n", This
, ppvObject
);
71 *ppvObject
= PERSIST(This
);
72 }else if(IsEqualGUID(&IID_IPersistMoniker
, riid
)) {
73 TRACE("(%p)->(IID_IPersistMoniker, %p)\n", This
, ppvObject
);
74 *ppvObject
= PERSISTMON(This
);
75 }else if(IsEqualGUID(&IID_IPersistFile
, riid
)) {
76 TRACE("(%p)->(IID_IPersistFile, %p)\n", This
, ppvObject
);
77 *ppvObject
= PERSISTFILE(This
);
78 }else if(IsEqualGUID(&IID_IMonikerProp
, riid
)) {
79 TRACE("(%p)->(IID_IMonikerProp, %p)\n", This
, ppvObject
);
80 *ppvObject
= MONPROP(This
);
81 }else if(IsEqualGUID(&IID_IOleObject
, riid
)) {
82 TRACE("(%p)->(IID_IOleObject, %p)\n", This
, ppvObject
);
83 *ppvObject
= OLEOBJ(This
);
84 }else if(IsEqualGUID(&IID_IOleDocument
, riid
)) {
85 TRACE("(%p)->(IID_IOleDocument, %p)\n", This
, ppvObject
);
86 *ppvObject
= OLEDOC(This
);
87 }else if(IsEqualGUID(&IID_IOleDocumentView
, riid
)) {
88 TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This
, ppvObject
);
89 *ppvObject
= DOCVIEW(This
);
90 }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject
, riid
)) {
91 TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This
, ppvObject
);
92 *ppvObject
= ACTOBJ(This
);
93 }else if(IsEqualGUID(&IID_IViewObject
, riid
)) {
94 TRACE("(%p)->(IID_IViewObject, %p)\n", This
, ppvObject
);
95 *ppvObject
= VIEWOBJ(This
);
96 }else if(IsEqualGUID(&IID_IViewObject2
, riid
)) {
97 TRACE("(%p)->(IID_IViewObject2, %p)\n", This
, ppvObject
);
98 *ppvObject
= VIEWOBJ2(This
);
99 }else if(IsEqualGUID(&IID_IOleWindow
, riid
)) {
100 TRACE("(%p)->(IID_IOleWindow, %p)\n", This
, ppvObject
);
101 *ppvObject
= OLEWIN(This
);
102 }else if(IsEqualGUID(&IID_IOleInPlaceObject
, riid
)) {
103 TRACE("(%p)->(IID_IOleInPlaceObject, %p)\n", This
, ppvObject
);
104 *ppvObject
= INPLACEOBJ(This
);
105 }else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless
, riid
)) {
106 TRACE("(%p)->(IID_IOleInPlaceObjectWindowless, %p)\n", This
, ppvObject
);
107 *ppvObject
= INPLACEWIN(This
);
108 }else if(IsEqualGUID(&IID_IServiceProvider
, riid
)) {
109 TRACE("(%p)->(IID_IServiceProvider, %p)\n", This
, ppvObject
);
110 *ppvObject
= SERVPROV(This
);
111 }else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
)) {
112 TRACE("(%p)->(IID_IOleCommandTarget, %p)\n", This
, ppvObject
);
113 *ppvObject
= CMDTARGET(This
);
114 }else if(IsEqualGUID(&IID_IOleControl
, riid
)) {
115 TRACE("(%p)->(IID_IOleControl, %p)\n", This
, ppvObject
);
116 *ppvObject
= CONTROL(This
);
117 }else if(IsEqualGUID(&IID_IHlinkTarget
, riid
)) {
118 TRACE("(%p)->(IID_IHlinkTarget, %p)\n", This
, ppvObject
);
119 *ppvObject
= HLNKTARGET(This
);
120 }else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
)) {
121 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This
, ppvObject
);
122 *ppvObject
= CONPTCONT(&This
->cp_container
);
123 }else if(IsEqualGUID(&IID_IPersistStreamInit
, riid
)) {
124 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This
, ppvObject
);
125 *ppvObject
= PERSTRINIT(This
);
126 }else if(IsEqualGUID(&IID_ICustomDoc
, riid
)) {
127 TRACE("(%p)->(IID_ICustomDoc %p)\n", This
, ppvObject
);
128 *ppvObject
= CUSTOMDOC(This
);
129 }else if(IsEqualGUID(&DIID_DispHTMLDocument
, riid
)) {
130 TRACE("(%p)->(DIID_DispHTMLDocument %p)\n", This
, ppvObject
);
131 *ppvObject
= HTMLDOC(This
);
132 }else if(IsEqualGUID(&CLSID_CMarkup
, riid
)) {
133 FIXME("(%p)->(CLSID_CMarkup %p)\n", This
, ppvObject
);
134 return E_NOINTERFACE
;
135 }else if(IsEqualGUID(&IID_IRunnableObject
, riid
)) {
136 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This
, ppvObject
);
137 return E_NOINTERFACE
;
138 }else if(IsEqualGUID(&IID_IPersistPropertyBag
, riid
)) {
139 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This
, ppvObject
);
140 return E_NOINTERFACE
;
141 }else if(dispex_query_interface(&This
->dispex
, riid
, ppvObject
)) {
142 return *ppvObject
? S_OK
: E_NOINTERFACE
;
146 IHTMLDocument2_AddRef(iface
);
150 FIXME("(%p)->(%s %p) interface not supported\n", This
, debugstr_guid(riid
), ppvObject
);
151 return E_NOINTERFACE
;
154 static ULONG WINAPI
HTMLDocument_AddRef(IHTMLDocument2
*iface
)
156 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
157 ULONG ref
= InterlockedIncrement(&This
->ref
);
158 TRACE("(%p) ref = %u\n", This
, ref
);
162 static ULONG WINAPI
HTMLDocument_Release(IHTMLDocument2
*iface
)
164 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
165 ULONG ref
= InterlockedDecrement(&This
->ref
);
167 TRACE("(%p) ref = %u\n", This
, ref
);
170 remove_doc_tasks(This
);
171 release_script_hosts(This
);
174 IOleObject_SetClientSite(OLEOBJ(This
), NULL
);
175 if(This
->in_place_active
)
176 IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(This
));
178 IOleDocumentView_SetInPlaceSite(DOCVIEW(This
), NULL
);
180 IOleUndoManager_Release(This
->undomgr
);
182 set_document_bscallback(This
, NULL
);
183 set_current_mon(This
, NULL
);
185 if(This
->tooltips_hwnd
)
186 DestroyWindow(This
->tooltips_hwnd
);
188 DestroyWindow(This
->hwnd
);
190 if(This
->option_factory
) {
191 This
->option_factory
->doc
= NULL
;
192 IHTMLOptionElementFactory_Release(HTMLOPTFACTORY(This
->option_factory
));
196 This
->location
->doc
= NULL
;
199 IHTMLWindow2_Release(HTMLWINDOW2(This
->window
));
201 if(This
->event_target
)
202 release_event_target(This
->event_target
);
204 heap_free(This
->mime
);
205 detach_selection(This
);
209 ConnectionPointContainer_Destroy(&This
->cp_container
);
212 nsIDOMHTMLDocument_Release(This
->nsdoc
);
213 if(This
->nscontainer
)
214 NSContainer_Release(This
->nscontainer
);
222 static HRESULT WINAPI
HTMLDocument_GetTypeInfoCount(IHTMLDocument2
*iface
, UINT
*pctinfo
)
224 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
226 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This
), pctinfo
);
229 static HRESULT WINAPI
HTMLDocument_GetTypeInfo(IHTMLDocument2
*iface
, UINT iTInfo
,
230 LCID lcid
, ITypeInfo
**ppTInfo
)
232 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
234 return IDispatchEx_GetTypeInfo(DISPATCHEX(This
), iTInfo
, lcid
, ppTInfo
);
237 static HRESULT WINAPI
HTMLDocument_GetIDsOfNames(IHTMLDocument2
*iface
, REFIID riid
,
238 LPOLESTR
*rgszNames
, UINT cNames
,
239 LCID lcid
, DISPID
*rgDispId
)
241 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
243 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
246 static HRESULT WINAPI
HTMLDocument_Invoke(IHTMLDocument2
*iface
, DISPID dispIdMember
,
247 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
248 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
250 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
252 return IDispatchEx_Invoke(DISPATCHEX(This
), dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
253 pVarResult
, pExcepInfo
, puArgErr
);
256 static HRESULT WINAPI
HTMLDocument_get_Script(IHTMLDocument2
*iface
, IDispatch
**p
)
258 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
260 TRACE("(%p)->(%p)\n", This
, p
);
262 *p
= (IDispatch
*)HTMLWINDOW2(This
->window
);
263 IDispatch_AddRef(*p
);
267 static HRESULT WINAPI
HTMLDocument_get_all(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
269 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
270 nsIDOMElement
*nselem
= NULL
;
273 TRACE("(%p)->(%p)\n", This
, p
);
276 WARN("NULL nsdoc\n");
280 nsres
= nsIDOMHTMLDocument_GetDocumentElement(This
->nsdoc
, &nselem
);
281 if(NS_FAILED(nsres
)) {
282 ERR("GetDocumentElement failed: %08x\n", nsres
);
287 *p
= create_all_collection(get_node(This
, (nsIDOMNode
*)nselem
, TRUE
), TRUE
);
288 nsIDOMElement_Release(nselem
);
296 static HRESULT WINAPI
HTMLDocument_get_body(IHTMLDocument2
*iface
, IHTMLElement
**p
)
298 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
299 nsIDOMHTMLElement
*nsbody
= NULL
;
303 TRACE("(%p)->(%p)\n", This
, p
);
306 WARN("NULL nsdoc\n");
310 nsres
= nsIDOMHTMLDocument_GetBody(This
->nsdoc
, &nsbody
);
311 if(NS_FAILED(nsres
)) {
312 TRACE("Could not get body: %08x\n", nsres
);
317 node
= get_node(This
, (nsIDOMNode
*)nsbody
, TRUE
);
318 nsIDOMHTMLElement_Release(nsbody
);
320 IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node
), &IID_IHTMLElement
, (void**)p
);
325 TRACE("*p = %p\n", *p
);
329 static HRESULT WINAPI
HTMLDocument_get_activeElement(IHTMLDocument2
*iface
, IHTMLElement
**p
)
331 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
332 FIXME("(%p)->(%p)\n", This
, p
);
336 static HRESULT WINAPI
HTMLDocument_get_images(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
338 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
339 nsIDOMHTMLCollection
*nscoll
= NULL
;
342 TRACE("(%p)->(%p)\n", This
, p
);
350 WARN("NULL nsdoc\n");
354 nsres
= nsIDOMHTMLDocument_GetImages(This
->nsdoc
, &nscoll
);
355 if(NS_FAILED(nsres
)) {
356 ERR("GetImages failed: %08x\n", nsres
);
361 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
362 nsIDOMElement_Release(nscoll
);
368 static HRESULT WINAPI
HTMLDocument_get_applets(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
370 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
371 nsIDOMHTMLCollection
*nscoll
= NULL
;
374 TRACE("(%p)->(%p)\n", This
, p
);
382 WARN("NULL nsdoc\n");
386 nsres
= nsIDOMHTMLDocument_GetApplets(This
->nsdoc
, &nscoll
);
387 if(NS_FAILED(nsres
)) {
388 ERR("GetApplets failed: %08x\n", nsres
);
393 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
394 nsIDOMElement_Release(nscoll
);
400 static HRESULT WINAPI
HTMLDocument_get_links(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
402 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
403 nsIDOMHTMLCollection
*nscoll
= NULL
;
406 TRACE("(%p)->(%p)\n", This
, p
);
414 WARN("NULL nsdoc\n");
418 nsres
= nsIDOMHTMLDocument_GetLinks(This
->nsdoc
, &nscoll
);
419 if(NS_FAILED(nsres
)) {
420 ERR("GetLinks failed: %08x\n", nsres
);
425 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
426 nsIDOMElement_Release(nscoll
);
432 static HRESULT WINAPI
HTMLDocument_get_forms(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
434 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
435 nsIDOMHTMLCollection
*nscoll
= NULL
;
438 TRACE("(%p)->(%p)\n", This
, p
);
446 WARN("NULL nsdoc\n");
450 nsres
= nsIDOMHTMLDocument_GetForms(This
->nsdoc
, &nscoll
);
451 if(NS_FAILED(nsres
)) {
452 ERR("GetForms failed: %08x\n", nsres
);
457 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
458 nsIDOMElement_Release(nscoll
);
464 static HRESULT WINAPI
HTMLDocument_get_anchors(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
466 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
467 nsIDOMHTMLCollection
*nscoll
= NULL
;
470 TRACE("(%p)->(%p)\n", This
, p
);
478 WARN("NULL nsdoc\n");
482 nsres
= nsIDOMHTMLDocument_GetAnchors(This
->nsdoc
, &nscoll
);
483 if(NS_FAILED(nsres
)) {
484 ERR("GetAnchors failed: %08x\n", nsres
);
489 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
490 nsIDOMElement_Release(nscoll
);
496 static HRESULT WINAPI
HTMLDocument_put_title(IHTMLDocument2
*iface
, BSTR v
)
498 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
502 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
505 WARN("NULL nsdoc\n");
509 nsAString_Init(&nsstr
, v
);
510 nsres
= nsIDOMHTMLDocument_SetTitle(This
->nsdoc
, &nsstr
);
511 nsAString_Finish(&nsstr
);
513 ERR("SetTitle failed: %08x\n", nsres
);
518 static HRESULT WINAPI
HTMLDocument_get_title(IHTMLDocument2
*iface
, BSTR
*p
)
520 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
521 const PRUnichar
*ret
;
525 TRACE("(%p)->(%p)\n", This
, p
);
528 WARN("NULL nsdoc\n");
533 nsAString_Init(&nsstr
, NULL
);
534 nsres
= nsIDOMHTMLDocument_GetTitle(This
->nsdoc
, &nsstr
);
535 if (NS_SUCCEEDED(nsres
)) {
536 nsAString_GetData(&nsstr
, &ret
);
537 *p
= SysAllocString(ret
);
539 nsAString_Finish(&nsstr
);
541 if(NS_FAILED(nsres
)) {
542 ERR("GetTitle failed: %08x\n", nsres
);
549 static HRESULT WINAPI
HTMLDocument_get_scripts(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
551 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
552 FIXME("(%p)->(%p)\n", This
, p
);
556 static HRESULT WINAPI
HTMLDocument_put_designMode(IHTMLDocument2
*iface
, BSTR v
)
558 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
559 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
563 static HRESULT WINAPI
HTMLDocument_get_designMode(IHTMLDocument2
*iface
, BSTR
*p
)
565 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
566 static WCHAR szOff
[] = {'O','f','f',0};
567 FIXME("(%p)->(%p) always returning Off\n", This
, p
);
572 *p
= SysAllocString(szOff
);
577 static HRESULT WINAPI
HTMLDocument_get_selection(IHTMLDocument2
*iface
, IHTMLSelectionObject
**p
)
579 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
580 nsISelection
*nsselection
= NULL
;
582 TRACE("(%p)->(%p)\n", This
, p
);
584 if(This
->nscontainer
) {
585 nsIDOMWindow
*dom_window
= NULL
;
587 nsIWebBrowser_GetContentDOMWindow(This
->nscontainer
->webbrowser
, &dom_window
);
589 nsIDOMWindow_GetSelection(dom_window
, &nsselection
);
590 nsIDOMWindow_Release(dom_window
);
594 *p
= HTMLSelectionObject_Create(This
, nsselection
);
598 static HRESULT WINAPI
HTMLDocument_get_readyState(IHTMLDocument2
*iface
, BSTR
*p
)
600 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
602 static const WCHAR wszUninitialized
[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
603 static const WCHAR wszLoading
[] = {'l','o','a','d','i','n','g',0};
604 static const WCHAR wszLoaded
[] = {'l','o','a','d','e','d',0};
605 static const WCHAR wszInteractive
[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
606 static const WCHAR wszComplete
[] = {'c','o','m','p','l','e','t','e',0};
608 static const LPCWSTR readystate_str
[] = {
616 TRACE("(%p)->(%p)\n", iface
, p
);
621 *p
= SysAllocString(readystate_str
[This
->readystate
]);
625 static HRESULT WINAPI
HTMLDocument_get_frames(IHTMLDocument2
*iface
, IHTMLFramesCollection2
**p
)
627 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
628 FIXME("(%p)->(%p)\n", This
, p
);
632 static HRESULT WINAPI
HTMLDocument_get_embeds(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
634 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
635 FIXME("(%p)->(%p)\n", This
, p
);
639 static HRESULT WINAPI
HTMLDocument_get_plugins(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
641 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
642 FIXME("(%p)->(%p)\n", This
, p
);
646 static HRESULT WINAPI
HTMLDocument_put_alinkColor(IHTMLDocument2
*iface
, VARIANT v
)
648 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
649 FIXME("(%p)\n", This
);
653 static HRESULT WINAPI
HTMLDocument_get_alinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
655 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
656 FIXME("(%p)->(%p)\n", This
, p
);
660 static HRESULT WINAPI
HTMLDocument_put_bgColor(IHTMLDocument2
*iface
, VARIANT v
)
662 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
663 FIXME("(%p)\n", This
);
667 static HRESULT WINAPI
HTMLDocument_get_bgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
669 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
670 FIXME("(%p)->(%p)\n", This
, p
);
674 static HRESULT WINAPI
HTMLDocument_put_fgColor(IHTMLDocument2
*iface
, VARIANT v
)
676 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
677 FIXME("(%p)\n", This
);
681 static HRESULT WINAPI
HTMLDocument_get_fgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
683 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
684 FIXME("(%p)->(%p)\n", This
, p
);
688 static HRESULT WINAPI
HTMLDocument_put_linkColor(IHTMLDocument2
*iface
, VARIANT v
)
690 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
691 FIXME("(%p)->()\n", This
);
695 static HRESULT WINAPI
HTMLDocument_get_linkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
697 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
698 FIXME("(%p)->(%p)\n", This
, p
);
702 static HRESULT WINAPI
HTMLDocument_put_vlinkColor(IHTMLDocument2
*iface
, VARIANT v
)
704 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
705 FIXME("(%p)\n", This
);
709 static HRESULT WINAPI
HTMLDocument_get_vlinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
711 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
712 FIXME("(%p)->(%p)\n", This
, p
);
716 static HRESULT WINAPI
HTMLDocument_get_referrer(IHTMLDocument2
*iface
, BSTR
*p
)
718 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
719 FIXME("(%p)->(%p)\n", This
, p
);
723 static HRESULT WINAPI
HTMLDocument_get_location(IHTMLDocument2
*iface
, IHTMLLocation
**p
)
725 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
727 TRACE("(%p)->(%p)\n", This
, p
);
730 IHTMLLocation_AddRef(HTMLLOCATION(This
->location
));
732 This
->location
= HTMLLocation_Create(This
);
734 *p
= HTMLLOCATION(This
->location
);
738 static HRESULT WINAPI
HTMLDocument_get_lastModified(IHTMLDocument2
*iface
, BSTR
*p
)
740 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
741 FIXME("(%p)->(%p)\n", This
, p
);
745 static HRESULT WINAPI
HTMLDocument_put_URL(IHTMLDocument2
*iface
, BSTR v
)
747 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
748 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
752 static HRESULT WINAPI
HTMLDocument_get_URL(IHTMLDocument2
*iface
, BSTR
*p
)
754 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
756 static const WCHAR about_blank_url
[] =
757 {'a','b','o','u','t',':','b','l','a','n','k',0};
759 TRACE("(%p)->(%p)\n", iface
, p
);
761 *p
= SysAllocString(This
->url
? This
->url
: about_blank_url
);
765 static HRESULT WINAPI
HTMLDocument_put_domain(IHTMLDocument2
*iface
, BSTR v
)
767 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
768 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
772 static HRESULT WINAPI
HTMLDocument_get_domain(IHTMLDocument2
*iface
, BSTR
*p
)
774 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
775 FIXME("(%p)->(%p)\n", This
, p
);
779 static HRESULT WINAPI
HTMLDocument_put_cookie(IHTMLDocument2
*iface
, BSTR v
)
781 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
782 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
786 static HRESULT WINAPI
HTMLDocument_get_cookie(IHTMLDocument2
*iface
, BSTR
*p
)
788 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
789 FIXME("(%p)->(%p)\n", This
, p
);
793 static HRESULT WINAPI
HTMLDocument_put_expando(IHTMLDocument2
*iface
, VARIANT_BOOL v
)
795 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
796 FIXME("(%p)->(%x)\n", This
, v
);
800 static HRESULT WINAPI
HTMLDocument_get_expando(IHTMLDocument2
*iface
, VARIANT_BOOL
*p
)
802 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
803 FIXME("(%p)->(%p)\n", This
, p
);
807 static HRESULT WINAPI
HTMLDocument_put_charset(IHTMLDocument2
*iface
, BSTR v
)
809 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
810 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
814 static HRESULT WINAPI
HTMLDocument_get_charset(IHTMLDocument2
*iface
, BSTR
*p
)
816 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
817 FIXME("(%p)->(%p)\n", This
, p
);
821 static HRESULT WINAPI
HTMLDocument_put_defaultCharset(IHTMLDocument2
*iface
, BSTR v
)
823 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
824 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
828 static HRESULT WINAPI
HTMLDocument_get_defaultCharset(IHTMLDocument2
*iface
, BSTR
*p
)
830 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
831 FIXME("(%p)->(%p)\n", This
, p
);
835 static HRESULT WINAPI
HTMLDocument_get_mimeType(IHTMLDocument2
*iface
, BSTR
*p
)
837 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
838 FIXME("(%p)->(%p)\n", This
, p
);
842 static HRESULT WINAPI
HTMLDocument_get_fileSize(IHTMLDocument2
*iface
, BSTR
*p
)
844 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
845 FIXME("(%p)->(%p)\n", This
, p
);
849 static HRESULT WINAPI
HTMLDocument_get_fileCreatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
851 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
852 FIXME("(%p)->(%p)\n", This
, p
);
856 static HRESULT WINAPI
HTMLDocument_get_fileModifiedDate(IHTMLDocument2
*iface
, BSTR
*p
)
858 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
859 FIXME("(%p)->(%p)\n", This
, p
);
863 static HRESULT WINAPI
HTMLDocument_get_fileUpdatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
865 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
866 FIXME("(%p)->(%p)\n", This
, p
);
870 static HRESULT WINAPI
HTMLDocument_get_security(IHTMLDocument2
*iface
, BSTR
*p
)
872 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
873 FIXME("(%p)->(%p)\n", This
, p
);
877 static HRESULT WINAPI
HTMLDocument_get_protocol(IHTMLDocument2
*iface
, BSTR
*p
)
879 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
880 FIXME("(%p)->(%p)\n", This
, p
);
884 static HRESULT WINAPI
HTMLDocument_get_nameProp(IHTMLDocument2
*iface
, BSTR
*p
)
886 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
887 FIXME("(%p)->(%p)\n", This
, p
);
891 static HRESULT WINAPI
HTMLDocument_write(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
893 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
900 TRACE("(%p)->(%p)\n", iface
, psarray
);
903 WARN("NULL nsdoc\n");
907 if(psarray
->cDims
!= 1) {
908 FIXME("cDims=%d\n", psarray
->cDims
);
912 hres
= SafeArrayAccessData(psarray
, (void**)&var
);
914 WARN("SafeArrayAccessData failed: %08x\n", hres
);
918 nsAString_Init(&nsstr
, NULL
);
920 for(i
=0; i
< psarray
->rgsabound
[0].cElements
; i
++) {
921 if(V_VT(var
+i
) == VT_BSTR
) {
922 nsAString_SetData(&nsstr
, V_BSTR(var
+i
));
923 nsres
= nsIDOMHTMLDocument_Write(This
->nsdoc
, &nsstr
);
925 ERR("Write failed: %08x\n", nsres
);
927 FIXME("vt=%d\n", V_VT(var
+i
));
931 nsAString_Finish(&nsstr
);
932 SafeArrayUnaccessData(psarray
);
937 static HRESULT WINAPI
HTMLDocument_writeln(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
939 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
940 FIXME("(%p)->(%p)\n", This
, psarray
);
944 static HRESULT WINAPI
HTMLDocument_open(IHTMLDocument2
*iface
, BSTR url
, VARIANT name
,
945 VARIANT features
, VARIANT replace
, IDispatch
**pomWindowResult
)
947 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
950 static const WCHAR text_htmlW
[] = {'t','e','x','t','/','h','t','m','l',0};
952 TRACE("(%p)->(%s %s %s %s %p)\n", This
, debugstr_w(url
), debugstr_variant(&name
),
953 debugstr_variant(&features
), debugstr_variant(&replace
), pomWindowResult
);
960 if(!url
|| strcmpW(url
, text_htmlW
) || V_VT(&name
) != VT_ERROR
961 || V_VT(&features
) != VT_ERROR
|| V_VT(&replace
) != VT_ERROR
)
962 FIXME("unsupported args\n");
964 nsres
= nsIDOMHTMLDocument_Open(This
->nsdoc
);
965 if(NS_FAILED(nsres
)) {
966 ERR("Open failed: %08x\n", nsres
);
970 *pomWindowResult
= (IDispatch
*)HTMLWINDOW2(This
->window
);
971 IHTMLWindow2_AddRef(HTMLWINDOW2(This
->window
));
975 static HRESULT WINAPI
HTMLDocument_close(IHTMLDocument2
*iface
)
977 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
980 TRACE("(%p)\n", This
);
987 nsres
= nsIDOMHTMLDocument_Close(This
->nsdoc
);
988 if(NS_FAILED(nsres
)) {
989 ERR("Close failed: %08x\n", nsres
);
996 static HRESULT WINAPI
HTMLDocument_clear(IHTMLDocument2
*iface
)
998 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
999 FIXME("(%p)\n", This
);
1003 static HRESULT WINAPI
HTMLDocument_queryCommandSupported(IHTMLDocument2
*iface
, BSTR cmdID
,
1004 VARIANT_BOOL
*pfRet
)
1006 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1007 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1011 static HRESULT WINAPI
HTMLDocument_queryCommandEnabled(IHTMLDocument2
*iface
, BSTR cmdID
,
1012 VARIANT_BOOL
*pfRet
)
1014 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1015 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1019 static HRESULT WINAPI
HTMLDocument_queryCommandState(IHTMLDocument2
*iface
, BSTR cmdID
,
1020 VARIANT_BOOL
*pfRet
)
1022 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1023 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1027 static HRESULT WINAPI
HTMLDocument_queryCommandIndeterm(IHTMLDocument2
*iface
, BSTR cmdID
,
1028 VARIANT_BOOL
*pfRet
)
1030 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1031 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1035 static HRESULT WINAPI
HTMLDocument_queryCommandText(IHTMLDocument2
*iface
, BSTR cmdID
,
1038 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1039 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1043 static HRESULT WINAPI
HTMLDocument_queryCommandValue(IHTMLDocument2
*iface
, BSTR cmdID
,
1046 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1047 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1051 static HRESULT WINAPI
HTMLDocument_execCommand(IHTMLDocument2
*iface
, BSTR cmdID
,
1052 VARIANT_BOOL showUI
, VARIANT value
, VARIANT_BOOL
*pfRet
)
1054 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1055 FIXME("(%p)->(%s %x %p)\n", This
, debugstr_w(cmdID
), showUI
, pfRet
);
1059 static HRESULT WINAPI
HTMLDocument_execCommandShowHelp(IHTMLDocument2
*iface
, BSTR cmdID
,
1060 VARIANT_BOOL
*pfRet
)
1062 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1063 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1067 static HRESULT WINAPI
HTMLDocument_createElement(IHTMLDocument2
*iface
, BSTR eTag
,
1068 IHTMLElement
**newElem
)
1070 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1071 nsIDOMElement
*nselem
;
1076 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eTag
), newElem
);
1079 WARN("NULL nsdoc\n");
1080 return E_UNEXPECTED
;
1083 nsAString_Init(&tag_str
, eTag
);
1084 nsres
= nsIDOMDocument_CreateElement(This
->nsdoc
, &tag_str
, &nselem
);
1085 nsAString_Finish(&tag_str
);
1086 if(NS_FAILED(nsres
)) {
1087 ERR("CreateElement failed: %08x\n", nsres
);
1091 elem
= HTMLElement_Create(This
, (nsIDOMNode
*)nselem
, TRUE
);
1092 nsIDOMElement_Release(nselem
);
1094 *newElem
= HTMLELEM(elem
);
1095 IHTMLElement_AddRef(HTMLELEM(elem
));
1099 static HRESULT WINAPI
HTMLDocument_put_onhelp(IHTMLDocument2
*iface
, VARIANT v
)
1101 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1102 FIXME("(%p)\n", This
);
1106 static HRESULT WINAPI
HTMLDocument_get_onhelp(IHTMLDocument2
*iface
, VARIANT
*p
)
1108 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1109 FIXME("(%p)->(%p)\n", This
, p
);
1113 static HRESULT WINAPI
HTMLDocument_put_onclick(IHTMLDocument2
*iface
, VARIANT v
)
1115 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1116 FIXME("(%p)\n", This
);
1120 static HRESULT WINAPI
HTMLDocument_get_onclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1122 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1123 FIXME("(%p)->(%p)\n", This
, p
);
1127 static HRESULT WINAPI
HTMLDocument_put_ondblclick(IHTMLDocument2
*iface
, VARIANT v
)
1129 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1130 FIXME("(%p)\n", This
);
1134 static HRESULT WINAPI
HTMLDocument_get_ondblclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1136 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1137 FIXME("(%p)->(%p)\n", This
, p
);
1141 static HRESULT WINAPI
HTMLDocument_put_onkeyup(IHTMLDocument2
*iface
, VARIANT v
)
1143 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1145 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1147 return set_doc_event(This
, EVENTID_KEYUP
, &v
);
1150 static HRESULT WINAPI
HTMLDocument_get_onkeyup(IHTMLDocument2
*iface
, VARIANT
*p
)
1152 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1154 TRACE("(%p)->(%p)\n", This
, p
);
1156 return get_doc_event(This
, EVENTID_KEYUP
, p
);
1159 static HRESULT WINAPI
HTMLDocument_put_onkeydown(IHTMLDocument2
*iface
, VARIANT v
)
1161 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1163 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1165 return set_doc_event(This
, EVENTID_KEYDOWN
, &v
);
1168 static HRESULT WINAPI
HTMLDocument_get_onkeydown(IHTMLDocument2
*iface
, VARIANT
*p
)
1170 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1172 TRACE("(%p)->(%p)\n", This
, p
);
1174 return get_doc_event(This
, EVENTID_KEYDOWN
, p
);
1177 static HRESULT WINAPI
HTMLDocument_put_onkeypress(IHTMLDocument2
*iface
, VARIANT v
)
1179 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1180 FIXME("(%p)\n", This
);
1184 static HRESULT WINAPI
HTMLDocument_get_onkeypress(IHTMLDocument2
*iface
, VARIANT
*p
)
1186 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1187 FIXME("(%p)->(%p)\n", This
, p
);
1191 static HRESULT WINAPI
HTMLDocument_put_onmouseup(IHTMLDocument2
*iface
, VARIANT v
)
1193 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1194 FIXME("(%p)\n", This
);
1198 static HRESULT WINAPI
HTMLDocument_get_onmouseup(IHTMLDocument2
*iface
, VARIANT
*p
)
1200 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1201 FIXME("(%p)->(%p)\n", This
, p
);
1205 static HRESULT WINAPI
HTMLDocument_put_onmousedown(IHTMLDocument2
*iface
, VARIANT v
)
1207 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1208 FIXME("(%p)\n", This
);
1212 static HRESULT WINAPI
HTMLDocument_get_onmousedown(IHTMLDocument2
*iface
, VARIANT
*p
)
1214 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1215 FIXME("(%p)->(%p)\n", This
, p
);
1219 static HRESULT WINAPI
HTMLDocument_put_onmousemove(IHTMLDocument2
*iface
, VARIANT v
)
1221 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1222 FIXME("(%p)\n", This
);
1226 static HRESULT WINAPI
HTMLDocument_get_onmousemove(IHTMLDocument2
*iface
, VARIANT
*p
)
1228 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1229 FIXME("(%p)->(%p)\n", This
, p
);
1233 static HRESULT WINAPI
HTMLDocument_put_onmouseout(IHTMLDocument2
*iface
, VARIANT v
)
1235 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1236 FIXME("(%p)\n", This
);
1240 static HRESULT WINAPI
HTMLDocument_get_onmouseout(IHTMLDocument2
*iface
, VARIANT
*p
)
1242 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1243 FIXME("(%p)->(%p)\n", This
, p
);
1247 static HRESULT WINAPI
HTMLDocument_put_onmouseover(IHTMLDocument2
*iface
, VARIANT v
)
1249 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1251 TRACE("(%p)\n", This
);
1253 return set_doc_event(This
, EVENTID_MOUSEOVER
, &v
);
1256 static HRESULT WINAPI
HTMLDocument_get_onmouseover(IHTMLDocument2
*iface
, VARIANT
*p
)
1258 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1260 TRACE("(%p)->(%p)\n", This
, p
);
1262 return get_doc_event(This
, EVENTID_MOUSEOVER
, p
);
1265 static HRESULT WINAPI
HTMLDocument_put_onreadystatechange(IHTMLDocument2
*iface
, VARIANT v
)
1267 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1268 FIXME("(%p)\n", This
);
1272 static HRESULT WINAPI
HTMLDocument_get_onreadystatechange(IHTMLDocument2
*iface
, VARIANT
*p
)
1274 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1275 FIXME("(%p)->(%p)\n", This
, p
);
1279 static HRESULT WINAPI
HTMLDocument_put_onafterupdate(IHTMLDocument2
*iface
, VARIANT v
)
1281 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1282 FIXME("(%p)\n", This
);
1286 static HRESULT WINAPI
HTMLDocument_get_onafterupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1288 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1289 FIXME("(%p)->(%p)\n", This
, p
);
1293 static HRESULT WINAPI
HTMLDocument_put_onrowexit(IHTMLDocument2
*iface
, VARIANT v
)
1295 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1296 FIXME("(%p)\n", This
);
1300 static HRESULT WINAPI
HTMLDocument_get_onrowexit(IHTMLDocument2
*iface
, VARIANT
*p
)
1302 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1303 FIXME("(%p)->(%p)\n", This
, p
);
1307 static HRESULT WINAPI
HTMLDocument_put_onrowenter(IHTMLDocument2
*iface
, VARIANT v
)
1309 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1310 FIXME("(%p)\n", This
);
1314 static HRESULT WINAPI
HTMLDocument_get_onrowenter(IHTMLDocument2
*iface
, VARIANT
*p
)
1316 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1317 FIXME("(%p)->(%p)\n", This
, p
);
1321 static HRESULT WINAPI
HTMLDocument_put_ondragstart(IHTMLDocument2
*iface
, VARIANT v
)
1323 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1325 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1327 return set_doc_event(This
, EVENTID_DRAGSTART
, &v
);
1330 static HRESULT WINAPI
HTMLDocument_get_ondragstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1332 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1334 TRACE("(%p)->(%p)\n", This
, p
);
1336 return get_doc_event(This
, EVENTID_DRAGSTART
, p
);
1339 static HRESULT WINAPI
HTMLDocument_put_onselectstart(IHTMLDocument2
*iface
, VARIANT v
)
1341 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1343 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1345 return set_doc_event(This
, EVENTID_SELECTSTART
, &v
);
1348 static HRESULT WINAPI
HTMLDocument_get_onselectstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1350 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1352 TRACE("(%p)->(%p)\n", This
, p
);
1354 return get_doc_event(This
, EVENTID_SELECTSTART
, p
);
1357 static HRESULT WINAPI
HTMLDocument_elementFromPoint(IHTMLDocument2
*iface
, long x
, long y
,
1358 IHTMLElement
**elementHit
)
1360 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1361 FIXME("(%p)->(%ld %ld %p)\n", This
, x
, y
, elementHit
);
1365 static HRESULT WINAPI
HTMLDocument_get_parentWindow(IHTMLDocument2
*iface
, IHTMLWindow2
**p
)
1367 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1369 TRACE("(%p)->(%p)\n", This
, p
);
1371 *p
= HTMLWINDOW2(This
->window
);
1372 IHTMLWindow2_AddRef(*p
);
1376 static HRESULT WINAPI
HTMLDocument_get_styleSheets(IHTMLDocument2
*iface
,
1377 IHTMLStyleSheetsCollection
**p
)
1379 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1380 nsIDOMStyleSheetList
*nsstylelist
;
1381 nsIDOMDocumentStyle
*nsdocstyle
;
1384 TRACE("(%p)->(%p)\n", This
, p
);
1389 WARN("NULL nsdoc\n");
1390 return E_UNEXPECTED
;
1393 nsIDOMHTMLDocument_QueryInterface(This
->nsdoc
, &IID_nsIDOMDocumentStyle
, (void**)&nsdocstyle
);
1394 nsres
= nsIDOMDocumentStyle_GetStyleSheets(nsdocstyle
, &nsstylelist
);
1395 nsIDOMDocumentStyle_Release(nsdocstyle
);
1396 if(NS_FAILED(nsres
)) {
1397 ERR("GetStyleSheets failed: %08x\n", nsres
);
1401 *p
= HTMLStyleSheetsCollection_Create(nsstylelist
);
1402 nsIDOMDocumentStyle_Release(nsstylelist
);
1407 static HRESULT WINAPI
HTMLDocument_put_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT v
)
1409 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1410 FIXME("(%p)\n", This
);
1414 static HRESULT WINAPI
HTMLDocument_get_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1416 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1417 FIXME("(%p)->(%p)\n", This
, p
);
1421 static HRESULT WINAPI
HTMLDocument_put_onerrorupdate(IHTMLDocument2
*iface
, VARIANT v
)
1423 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1424 FIXME("(%p)\n", This
);
1428 static HRESULT WINAPI
HTMLDocument_get_onerrorupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1430 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1431 FIXME("(%p)->(%p)\n", This
, p
);
1435 static HRESULT WINAPI
HTMLDocument_toString(IHTMLDocument2
*iface
, BSTR
*String
)
1437 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1438 FIXME("(%p)->(%p)\n", This
, String
);
1442 static HRESULT WINAPI
HTMLDocument_createStyleSheet(IHTMLDocument2
*iface
, BSTR bstrHref
,
1443 long lIndex
, IHTMLStyleSheet
**ppnewStyleSheet
)
1445 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1447 FIXME("(%p)->(%s %ld %p) semi-stub\n", This
, debugstr_w(bstrHref
), lIndex
, ppnewStyleSheet
);
1449 *ppnewStyleSheet
= HTMLStyleSheet_Create(NULL
);
1453 static const IHTMLDocument2Vtbl HTMLDocumentVtbl
= {
1454 HTMLDocument_QueryInterface
,
1455 HTMLDocument_AddRef
,
1456 HTMLDocument_Release
,
1457 HTMLDocument_GetTypeInfoCount
,
1458 HTMLDocument_GetTypeInfo
,
1459 HTMLDocument_GetIDsOfNames
,
1460 HTMLDocument_Invoke
,
1461 HTMLDocument_get_Script
,
1462 HTMLDocument_get_all
,
1463 HTMLDocument_get_body
,
1464 HTMLDocument_get_activeElement
,
1465 HTMLDocument_get_images
,
1466 HTMLDocument_get_applets
,
1467 HTMLDocument_get_links
,
1468 HTMLDocument_get_forms
,
1469 HTMLDocument_get_anchors
,
1470 HTMLDocument_put_title
,
1471 HTMLDocument_get_title
,
1472 HTMLDocument_get_scripts
,
1473 HTMLDocument_put_designMode
,
1474 HTMLDocument_get_designMode
,
1475 HTMLDocument_get_selection
,
1476 HTMLDocument_get_readyState
,
1477 HTMLDocument_get_frames
,
1478 HTMLDocument_get_embeds
,
1479 HTMLDocument_get_plugins
,
1480 HTMLDocument_put_alinkColor
,
1481 HTMLDocument_get_alinkColor
,
1482 HTMLDocument_put_bgColor
,
1483 HTMLDocument_get_bgColor
,
1484 HTMLDocument_put_fgColor
,
1485 HTMLDocument_get_fgColor
,
1486 HTMLDocument_put_linkColor
,
1487 HTMLDocument_get_linkColor
,
1488 HTMLDocument_put_vlinkColor
,
1489 HTMLDocument_get_vlinkColor
,
1490 HTMLDocument_get_referrer
,
1491 HTMLDocument_get_location
,
1492 HTMLDocument_get_lastModified
,
1493 HTMLDocument_put_URL
,
1494 HTMLDocument_get_URL
,
1495 HTMLDocument_put_domain
,
1496 HTMLDocument_get_domain
,
1497 HTMLDocument_put_cookie
,
1498 HTMLDocument_get_cookie
,
1499 HTMLDocument_put_expando
,
1500 HTMLDocument_get_expando
,
1501 HTMLDocument_put_charset
,
1502 HTMLDocument_get_charset
,
1503 HTMLDocument_put_defaultCharset
,
1504 HTMLDocument_get_defaultCharset
,
1505 HTMLDocument_get_mimeType
,
1506 HTMLDocument_get_fileSize
,
1507 HTMLDocument_get_fileCreatedDate
,
1508 HTMLDocument_get_fileModifiedDate
,
1509 HTMLDocument_get_fileUpdatedDate
,
1510 HTMLDocument_get_security
,
1511 HTMLDocument_get_protocol
,
1512 HTMLDocument_get_nameProp
,
1514 HTMLDocument_writeln
,
1518 HTMLDocument_queryCommandSupported
,
1519 HTMLDocument_queryCommandEnabled
,
1520 HTMLDocument_queryCommandState
,
1521 HTMLDocument_queryCommandIndeterm
,
1522 HTMLDocument_queryCommandText
,
1523 HTMLDocument_queryCommandValue
,
1524 HTMLDocument_execCommand
,
1525 HTMLDocument_execCommandShowHelp
,
1526 HTMLDocument_createElement
,
1527 HTMLDocument_put_onhelp
,
1528 HTMLDocument_get_onhelp
,
1529 HTMLDocument_put_onclick
,
1530 HTMLDocument_get_onclick
,
1531 HTMLDocument_put_ondblclick
,
1532 HTMLDocument_get_ondblclick
,
1533 HTMLDocument_put_onkeyup
,
1534 HTMLDocument_get_onkeyup
,
1535 HTMLDocument_put_onkeydown
,
1536 HTMLDocument_get_onkeydown
,
1537 HTMLDocument_put_onkeypress
,
1538 HTMLDocument_get_onkeypress
,
1539 HTMLDocument_put_onmouseup
,
1540 HTMLDocument_get_onmouseup
,
1541 HTMLDocument_put_onmousedown
,
1542 HTMLDocument_get_onmousedown
,
1543 HTMLDocument_put_onmousemove
,
1544 HTMLDocument_get_onmousemove
,
1545 HTMLDocument_put_onmouseout
,
1546 HTMLDocument_get_onmouseout
,
1547 HTMLDocument_put_onmouseover
,
1548 HTMLDocument_get_onmouseover
,
1549 HTMLDocument_put_onreadystatechange
,
1550 HTMLDocument_get_onreadystatechange
,
1551 HTMLDocument_put_onafterupdate
,
1552 HTMLDocument_get_onafterupdate
,
1553 HTMLDocument_put_onrowexit
,
1554 HTMLDocument_get_onrowexit
,
1555 HTMLDocument_put_onrowenter
,
1556 HTMLDocument_get_onrowenter
,
1557 HTMLDocument_put_ondragstart
,
1558 HTMLDocument_get_ondragstart
,
1559 HTMLDocument_put_onselectstart
,
1560 HTMLDocument_get_onselectstart
,
1561 HTMLDocument_elementFromPoint
,
1562 HTMLDocument_get_parentWindow
,
1563 HTMLDocument_get_styleSheets
,
1564 HTMLDocument_put_onbeforeupdate
,
1565 HTMLDocument_get_onbeforeupdate
,
1566 HTMLDocument_put_onerrorupdate
,
1567 HTMLDocument_get_onerrorupdate
,
1568 HTMLDocument_toString
,
1569 HTMLDocument_createStyleSheet
1572 #define DISPEX_THIS(iface) DEFINE_THIS(HTMLDocument, IDispatchEx, iface)
1574 static HRESULT WINAPI
DocDispatchEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
1576 HTMLDocument
*This
= DISPEX_THIS(iface
);
1578 return IHTMLDocument2_QueryInterface(HTMLDOC(This
), riid
, ppv
);
1581 static ULONG WINAPI
DocDispatchEx_AddRef(IDispatchEx
*iface
)
1583 HTMLDocument
*This
= DISPEX_THIS(iface
);
1585 return IHTMLDocument2_AddRef(HTMLDOC(This
));
1588 static ULONG WINAPI
DocDispatchEx_Release(IDispatchEx
*iface
)
1590 HTMLDocument
*This
= DISPEX_THIS(iface
);
1592 return IHTMLDocument2_Release(HTMLDOC(This
));
1595 static HRESULT WINAPI
DocDispatchEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
1597 HTMLDocument
*This
= DISPEX_THIS(iface
);
1599 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This
->dispex
), pctinfo
);
1602 static HRESULT WINAPI
DocDispatchEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
1603 LCID lcid
, ITypeInfo
**ppTInfo
)
1605 HTMLDocument
*This
= DISPEX_THIS(iface
);
1607 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This
->dispex
), iTInfo
, lcid
, ppTInfo
);
1610 static HRESULT WINAPI
DocDispatchEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
1611 LPOLESTR
*rgszNames
, UINT cNames
,
1612 LCID lcid
, DISPID
*rgDispId
)
1614 HTMLDocument
*This
= DISPEX_THIS(iface
);
1616 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This
->dispex
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1619 static HRESULT WINAPI
DocDispatchEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
1620 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1621 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1623 HTMLDocument
*This
= DISPEX_THIS(iface
);
1625 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
1626 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1628 switch(dispIdMember
) {
1629 case DISPID_READYSTATE
:
1630 TRACE("DISPID_READYSTATE\n");
1632 if(!(wFlags
& DISPATCH_PROPERTYGET
))
1633 return E_INVALIDARG
;
1635 V_VT(pVarResult
) = VT_I4
;
1636 V_I4(pVarResult
) = This
->readystate
;
1640 return IDispatchEx_Invoke(DISPATCHEX(&This
->dispex
), dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
1641 pVarResult
, pExcepInfo
, puArgErr
);
1644 static HRESULT WINAPI
DocDispatchEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
1646 HTMLDocument
*This
= DISPEX_THIS(iface
);
1648 return IDispatchEx_GetDispID(DISPATCHEX(&This
->dispex
), bstrName
, grfdex
, pid
);
1651 static HRESULT WINAPI
DocDispatchEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
1652 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
1654 HTMLDocument
*This
= DISPEX_THIS(iface
);
1656 return IDispatchEx_InvokeEx(DISPATCHEX(&This
->dispex
), id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
1659 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
1661 HTMLDocument
*This
= DISPEX_THIS(iface
);
1663 return IDispatchEx_DeleteMemberByName(DISPATCHEX(&This
->dispex
), bstrName
, grfdex
);
1666 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
1668 HTMLDocument
*This
= DISPEX_THIS(iface
);
1670 return IDispatchEx_DeleteMemberByDispID(DISPATCHEX(&This
->dispex
), id
);
1673 static HRESULT WINAPI
DocDispatchEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
1675 HTMLDocument
*This
= DISPEX_THIS(iface
);
1677 return IDispatchEx_GetMemberProperties(DISPATCHEX(&This
->dispex
), id
, grfdexFetch
, pgrfdex
);
1680 static HRESULT WINAPI
DocDispatchEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
1682 HTMLDocument
*This
= DISPEX_THIS(iface
);
1684 return IDispatchEx_GetMemberName(DISPATCHEX(&This
->dispex
), id
, pbstrName
);
1687 static HRESULT WINAPI
DocDispatchEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
1689 HTMLDocument
*This
= DISPEX_THIS(iface
);
1691 return IDispatchEx_GetNextDispID(DISPATCHEX(&This
->dispex
), grfdex
, id
, pid
);
1694 static HRESULT WINAPI
DocDispatchEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
1696 HTMLDocument
*This
= DISPEX_THIS(iface
);
1698 return IDispatchEx_GetNameSpaceParent(DISPATCHEX(&This
->dispex
), ppunk
);
1703 static const IDispatchExVtbl DocDispatchExVtbl
= {
1704 DocDispatchEx_QueryInterface
,
1705 DocDispatchEx_AddRef
,
1706 DocDispatchEx_Release
,
1707 DocDispatchEx_GetTypeInfoCount
,
1708 DocDispatchEx_GetTypeInfo
,
1709 DocDispatchEx_GetIDsOfNames
,
1710 DocDispatchEx_Invoke
,
1711 DocDispatchEx_GetDispID
,
1712 DocDispatchEx_InvokeEx
,
1713 DocDispatchEx_DeleteMemberByName
,
1714 DocDispatchEx_DeleteMemberByDispID
,
1715 DocDispatchEx_GetMemberProperties
,
1716 DocDispatchEx_GetMemberName
,
1717 DocDispatchEx_GetNextDispID
,
1718 DocDispatchEx_GetNameSpaceParent
1721 static const tid_t HTMLDocument_iface_tids
[] = {
1728 static dispex_static_data_t HTMLDocument_dispex
= {
1730 DispHTMLDocument_tid
,
1732 HTMLDocument_iface_tids
1735 static HRESULT
alloc_doc(HTMLDocument
**ret
)
1739 doc
= heap_alloc_zero(sizeof(HTMLDocument
));
1740 doc
->lpHTMLDocument2Vtbl
= &HTMLDocumentVtbl
;
1741 doc
->lpIDispatchExVtbl
= &DocDispatchExVtbl
;
1743 doc
->readystate
= READYSTATE_UNINITIALIZED
;
1744 doc
->scriptmode
= SCRIPTMODE_GECKO
;
1746 list_init(&doc
->bindings
);
1747 list_init(&doc
->script_hosts
);
1748 list_init(&doc
->selection_list
);
1749 list_init(&doc
->range_list
);
1751 HTMLDocument_HTMLDocument3_Init(doc
);
1752 HTMLDocument_HTMLDocument5_Init(doc
);
1753 HTMLDocument_Persist_Init(doc
);
1754 HTMLDocument_OleCmd_Init(doc
);
1755 HTMLDocument_OleObj_Init(doc
);
1756 HTMLDocument_View_Init(doc
);
1757 HTMLDocument_Window_Init(doc
);
1758 HTMLDocument_Service_Init(doc
);
1759 HTMLDocument_Hlink_Init(doc
);
1761 ConnectionPointContainer_Init(&doc
->cp_container
, (IUnknown
*)HTMLDOC(doc
));
1762 ConnectionPoint_Init(&doc
->cp_propnotif
, &doc
->cp_container
, &IID_IPropertyNotifySink
);
1763 ConnectionPoint_Init(&doc
->cp_htmldocevents
, &doc
->cp_container
, &DIID_HTMLDocumentEvents
);
1764 ConnectionPoint_Init(&doc
->cp_htmldocevents2
, &doc
->cp_container
, &DIID_HTMLDocumentEvents2
);
1766 init_dispex(&doc
->dispex
, (IUnknown
*)HTMLDOC(doc
), &HTMLDocument_dispex
);
1772 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*nsdoc
, HTMLDocument
**ret
)
1777 hres
= alloc_doc(&doc
);
1781 nsIDOMHTMLDocument_AddRef(nsdoc
);
1784 hres
= HTMLWindow_Create(doc
, NULL
, &doc
->window
);
1786 IHTMLDocument_Release(HTMLDOC(doc
));
1794 HRESULT
HTMLDocument_Create(IUnknown
*pUnkOuter
, REFIID riid
, void** ppvObject
)
1797 nsIDOMWindow
*nswindow
= NULL
;
1800 TRACE("(%p %s %p)\n", pUnkOuter
, debugstr_guid(riid
), ppvObject
);
1802 hres
= alloc_doc(&doc
);
1806 hres
= IHTMLDocument_QueryInterface(HTMLDOC(doc
), riid
, ppvObject
);
1807 IHTMLDocument_Release(HTMLDOC(doc
));
1811 doc
->nscontainer
= NSContainer_Create(doc
, NULL
);
1812 update_nsdocument(doc
);
1814 if(doc
->nscontainer
) {
1817 nsres
= nsIWebBrowser_GetContentDOMWindow(doc
->nscontainer
->webbrowser
, &nswindow
);
1818 if(NS_FAILED(nsres
))
1819 ERR("GetContentDOMWindow failed: %08x\n", nsres
);
1822 hres
= HTMLWindow_Create(doc
, nswindow
, &doc
->window
);
1824 nsIDOMWindow_Release(nswindow
);
1826 IHTMLDocument_Release(HTMLDOC(doc
));