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(&IID_ISupportErrorInfo
, riid
)) {
133 TRACE("(%p)->(IID_ISupportErrorInfo %p)\n", This
, ppvObject
);
134 *ppvObject
= SUPPERRINFO(This
);
135 }else if(IsEqualGUID(&CLSID_CMarkup
, riid
)) {
136 FIXME("(%p)->(CLSID_CMarkup %p)\n", This
, ppvObject
);
137 return E_NOINTERFACE
;
138 }else if(IsEqualGUID(&IID_IRunnableObject
, riid
)) {
139 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This
, ppvObject
);
140 return E_NOINTERFACE
;
141 }else if(IsEqualGUID(&IID_IPersistPropertyBag
, riid
)) {
142 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This
, ppvObject
);
143 return E_NOINTERFACE
;
144 }else if(IsEqualGUID(&IID_IMarshal
, riid
)) {
145 TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This
, ppvObject
);
146 return E_NOINTERFACE
;
147 }else if(dispex_query_interface(&This
->dispex
, riid
, ppvObject
)) {
148 return *ppvObject
? S_OK
: E_NOINTERFACE
;
152 IHTMLDocument2_AddRef(iface
);
156 FIXME("(%p)->(%s %p) interface not supported\n", This
, debugstr_guid(riid
), ppvObject
);
157 return E_NOINTERFACE
;
160 static ULONG WINAPI
HTMLDocument_AddRef(IHTMLDocument2
*iface
)
162 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
163 ULONG ref
= InterlockedIncrement(&This
->ref
);
164 TRACE("(%p) ref = %u\n", This
, ref
);
168 static ULONG WINAPI
HTMLDocument_Release(IHTMLDocument2
*iface
)
170 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
171 ULONG ref
= InterlockedDecrement(&This
->ref
);
173 TRACE("(%p) ref = %u\n", This
, ref
);
176 remove_doc_tasks(This
);
177 release_script_hosts(This
);
180 IOleObject_SetClientSite(OLEOBJ(This
), NULL
);
181 if(This
->in_place_active
)
182 IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(This
));
184 IOleDocumentView_SetInPlaceSite(DOCVIEW(This
), NULL
);
186 IOleUndoManager_Release(This
->undomgr
);
188 set_document_bscallback(This
, NULL
);
189 set_current_mon(This
, NULL
);
191 if(This
->tooltips_hwnd
)
192 DestroyWindow(This
->tooltips_hwnd
);
194 DestroyWindow(This
->hwnd
);
196 if(This
->option_factory
) {
197 This
->option_factory
->doc
= NULL
;
198 IHTMLOptionElementFactory_Release(HTMLOPTFACTORY(This
->option_factory
));
202 This
->location
->doc
= NULL
;
205 IHTMLWindow2_Release(HTMLWINDOW2(This
->window
));
207 if(This
->event_target
)
208 release_event_target(This
->event_target
);
210 heap_free(This
->mime
);
211 detach_selection(This
);
215 ConnectionPointContainer_Destroy(&This
->cp_container
);
218 nsIDOMHTMLDocument_Release(This
->nsdoc
);
219 if(This
->nscontainer
)
220 NSContainer_Release(This
->nscontainer
);
228 static HRESULT WINAPI
HTMLDocument_GetTypeInfoCount(IHTMLDocument2
*iface
, UINT
*pctinfo
)
230 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
232 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This
), pctinfo
);
235 static HRESULT WINAPI
HTMLDocument_GetTypeInfo(IHTMLDocument2
*iface
, UINT iTInfo
,
236 LCID lcid
, ITypeInfo
**ppTInfo
)
238 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
240 return IDispatchEx_GetTypeInfo(DISPATCHEX(This
), iTInfo
, lcid
, ppTInfo
);
243 static HRESULT WINAPI
HTMLDocument_GetIDsOfNames(IHTMLDocument2
*iface
, REFIID riid
,
244 LPOLESTR
*rgszNames
, UINT cNames
,
245 LCID lcid
, DISPID
*rgDispId
)
247 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
249 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
252 static HRESULT WINAPI
HTMLDocument_Invoke(IHTMLDocument2
*iface
, DISPID dispIdMember
,
253 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
254 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
256 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
258 return IDispatchEx_Invoke(DISPATCHEX(This
), dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
259 pVarResult
, pExcepInfo
, puArgErr
);
262 static HRESULT WINAPI
HTMLDocument_get_Script(IHTMLDocument2
*iface
, IDispatch
**p
)
264 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
266 TRACE("(%p)->(%p)\n", This
, p
);
268 *p
= (IDispatch
*)HTMLWINDOW2(This
->window
);
269 IDispatch_AddRef(*p
);
273 static HRESULT WINAPI
HTMLDocument_get_all(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
275 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
276 nsIDOMElement
*nselem
= NULL
;
279 TRACE("(%p)->(%p)\n", This
, p
);
282 WARN("NULL nsdoc\n");
286 nsres
= nsIDOMHTMLDocument_GetDocumentElement(This
->nsdoc
, &nselem
);
287 if(NS_FAILED(nsres
)) {
288 ERR("GetDocumentElement failed: %08x\n", nsres
);
293 *p
= create_all_collection(get_node(This
, (nsIDOMNode
*)nselem
, TRUE
), TRUE
);
294 nsIDOMElement_Release(nselem
);
302 static HRESULT WINAPI
HTMLDocument_get_body(IHTMLDocument2
*iface
, IHTMLElement
**p
)
304 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
305 nsIDOMHTMLElement
*nsbody
= NULL
;
309 TRACE("(%p)->(%p)\n", This
, p
);
312 WARN("NULL nsdoc\n");
316 nsres
= nsIDOMHTMLDocument_GetBody(This
->nsdoc
, &nsbody
);
317 if(NS_FAILED(nsres
)) {
318 TRACE("Could not get body: %08x\n", nsres
);
323 node
= get_node(This
, (nsIDOMNode
*)nsbody
, TRUE
);
324 nsIDOMHTMLElement_Release(nsbody
);
326 IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node
), &IID_IHTMLElement
, (void**)p
);
331 TRACE("*p = %p\n", *p
);
335 static HRESULT WINAPI
HTMLDocument_get_activeElement(IHTMLDocument2
*iface
, IHTMLElement
**p
)
337 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
338 FIXME("(%p)->(%p)\n", This
, p
);
342 static HRESULT WINAPI
HTMLDocument_get_images(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
344 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
345 nsIDOMHTMLCollection
*nscoll
= NULL
;
348 TRACE("(%p)->(%p)\n", This
, p
);
356 WARN("NULL nsdoc\n");
360 nsres
= nsIDOMHTMLDocument_GetImages(This
->nsdoc
, &nscoll
);
361 if(NS_FAILED(nsres
)) {
362 ERR("GetImages failed: %08x\n", nsres
);
367 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
368 nsIDOMElement_Release(nscoll
);
374 static HRESULT WINAPI
HTMLDocument_get_applets(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
376 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
377 nsIDOMHTMLCollection
*nscoll
= NULL
;
380 TRACE("(%p)->(%p)\n", This
, p
);
388 WARN("NULL nsdoc\n");
392 nsres
= nsIDOMHTMLDocument_GetApplets(This
->nsdoc
, &nscoll
);
393 if(NS_FAILED(nsres
)) {
394 ERR("GetApplets failed: %08x\n", nsres
);
399 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
400 nsIDOMElement_Release(nscoll
);
406 static HRESULT WINAPI
HTMLDocument_get_links(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
408 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
409 nsIDOMHTMLCollection
*nscoll
= NULL
;
412 TRACE("(%p)->(%p)\n", This
, p
);
420 WARN("NULL nsdoc\n");
424 nsres
= nsIDOMHTMLDocument_GetLinks(This
->nsdoc
, &nscoll
);
425 if(NS_FAILED(nsres
)) {
426 ERR("GetLinks failed: %08x\n", nsres
);
431 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
432 nsIDOMElement_Release(nscoll
);
438 static HRESULT WINAPI
HTMLDocument_get_forms(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
440 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
441 nsIDOMHTMLCollection
*nscoll
= NULL
;
444 TRACE("(%p)->(%p)\n", This
, p
);
452 WARN("NULL nsdoc\n");
456 nsres
= nsIDOMHTMLDocument_GetForms(This
->nsdoc
, &nscoll
);
457 if(NS_FAILED(nsres
)) {
458 ERR("GetForms failed: %08x\n", nsres
);
463 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
464 nsIDOMElement_Release(nscoll
);
470 static HRESULT WINAPI
HTMLDocument_get_anchors(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
472 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
473 nsIDOMHTMLCollection
*nscoll
= NULL
;
476 TRACE("(%p)->(%p)\n", This
, p
);
484 WARN("NULL nsdoc\n");
488 nsres
= nsIDOMHTMLDocument_GetAnchors(This
->nsdoc
, &nscoll
);
489 if(NS_FAILED(nsres
)) {
490 ERR("GetAnchors failed: %08x\n", nsres
);
495 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
496 nsIDOMElement_Release(nscoll
);
502 static HRESULT WINAPI
HTMLDocument_put_title(IHTMLDocument2
*iface
, BSTR v
)
504 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
508 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
511 WARN("NULL nsdoc\n");
515 nsAString_Init(&nsstr
, v
);
516 nsres
= nsIDOMHTMLDocument_SetTitle(This
->nsdoc
, &nsstr
);
517 nsAString_Finish(&nsstr
);
519 ERR("SetTitle failed: %08x\n", nsres
);
524 static HRESULT WINAPI
HTMLDocument_get_title(IHTMLDocument2
*iface
, BSTR
*p
)
526 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
527 const PRUnichar
*ret
;
531 TRACE("(%p)->(%p)\n", This
, p
);
534 WARN("NULL nsdoc\n");
539 nsAString_Init(&nsstr
, NULL
);
540 nsres
= nsIDOMHTMLDocument_GetTitle(This
->nsdoc
, &nsstr
);
541 if (NS_SUCCEEDED(nsres
)) {
542 nsAString_GetData(&nsstr
, &ret
);
543 *p
= SysAllocString(ret
);
545 nsAString_Finish(&nsstr
);
547 if(NS_FAILED(nsres
)) {
548 ERR("GetTitle failed: %08x\n", nsres
);
555 static HRESULT WINAPI
HTMLDocument_get_scripts(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
557 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
558 FIXME("(%p)->(%p)\n", This
, p
);
562 static HRESULT WINAPI
HTMLDocument_put_designMode(IHTMLDocument2
*iface
, BSTR v
)
564 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
565 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
569 static HRESULT WINAPI
HTMLDocument_get_designMode(IHTMLDocument2
*iface
, BSTR
*p
)
571 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
572 static WCHAR szOff
[] = {'O','f','f',0};
573 FIXME("(%p)->(%p) always returning Off\n", This
, p
);
578 *p
= SysAllocString(szOff
);
583 static HRESULT WINAPI
HTMLDocument_get_selection(IHTMLDocument2
*iface
, IHTMLSelectionObject
**p
)
585 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
586 nsISelection
*nsselection
= NULL
;
588 TRACE("(%p)->(%p)\n", This
, p
);
590 if(This
->nscontainer
) {
591 nsIDOMWindow
*dom_window
= NULL
;
593 nsIWebBrowser_GetContentDOMWindow(This
->nscontainer
->webbrowser
, &dom_window
);
595 nsIDOMWindow_GetSelection(dom_window
, &nsselection
);
596 nsIDOMWindow_Release(dom_window
);
600 *p
= HTMLSelectionObject_Create(This
, nsselection
);
604 static HRESULT WINAPI
HTMLDocument_get_readyState(IHTMLDocument2
*iface
, BSTR
*p
)
606 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
608 static const WCHAR wszUninitialized
[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
609 static const WCHAR wszLoading
[] = {'l','o','a','d','i','n','g',0};
610 static const WCHAR wszLoaded
[] = {'l','o','a','d','e','d',0};
611 static const WCHAR wszInteractive
[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
612 static const WCHAR wszComplete
[] = {'c','o','m','p','l','e','t','e',0};
614 static const LPCWSTR readystate_str
[] = {
622 TRACE("(%p)->(%p)\n", iface
, p
);
627 *p
= SysAllocString(readystate_str
[This
->readystate
]);
631 static HRESULT WINAPI
HTMLDocument_get_frames(IHTMLDocument2
*iface
, IHTMLFramesCollection2
**p
)
633 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
634 FIXME("(%p)->(%p)\n", This
, p
);
638 static HRESULT WINAPI
HTMLDocument_get_embeds(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
640 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
641 FIXME("(%p)->(%p)\n", This
, p
);
645 static HRESULT WINAPI
HTMLDocument_get_plugins(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
647 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
648 FIXME("(%p)->(%p)\n", This
, p
);
652 static HRESULT WINAPI
HTMLDocument_put_alinkColor(IHTMLDocument2
*iface
, VARIANT v
)
654 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
655 FIXME("(%p)\n", This
);
659 static HRESULT WINAPI
HTMLDocument_get_alinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
661 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
662 FIXME("(%p)->(%p)\n", This
, p
);
666 static HRESULT WINAPI
HTMLDocument_put_bgColor(IHTMLDocument2
*iface
, VARIANT v
)
668 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
669 FIXME("(%p)\n", This
);
673 static HRESULT WINAPI
HTMLDocument_get_bgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
675 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
676 FIXME("(%p)->(%p)\n", This
, p
);
680 static HRESULT WINAPI
HTMLDocument_put_fgColor(IHTMLDocument2
*iface
, VARIANT v
)
682 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
683 FIXME("(%p)\n", This
);
687 static HRESULT WINAPI
HTMLDocument_get_fgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
689 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
690 FIXME("(%p)->(%p)\n", This
, p
);
694 static HRESULT WINAPI
HTMLDocument_put_linkColor(IHTMLDocument2
*iface
, VARIANT v
)
696 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
697 FIXME("(%p)->()\n", This
);
701 static HRESULT WINAPI
HTMLDocument_get_linkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
703 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
704 FIXME("(%p)->(%p)\n", This
, p
);
708 static HRESULT WINAPI
HTMLDocument_put_vlinkColor(IHTMLDocument2
*iface
, VARIANT v
)
710 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
711 FIXME("(%p)\n", This
);
715 static HRESULT WINAPI
HTMLDocument_get_vlinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
717 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
718 FIXME("(%p)->(%p)\n", This
, p
);
722 static HRESULT WINAPI
HTMLDocument_get_referrer(IHTMLDocument2
*iface
, BSTR
*p
)
724 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
725 FIXME("(%p)->(%p)\n", This
, p
);
729 static HRESULT WINAPI
HTMLDocument_get_location(IHTMLDocument2
*iface
, IHTMLLocation
**p
)
731 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
733 TRACE("(%p)->(%p)\n", This
, p
);
736 IHTMLLocation_AddRef(HTMLLOCATION(This
->location
));
738 This
->location
= HTMLLocation_Create(This
);
740 *p
= HTMLLOCATION(This
->location
);
744 static HRESULT WINAPI
HTMLDocument_get_lastModified(IHTMLDocument2
*iface
, BSTR
*p
)
746 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
747 FIXME("(%p)->(%p)\n", This
, p
);
751 static HRESULT WINAPI
HTMLDocument_put_URL(IHTMLDocument2
*iface
, BSTR v
)
753 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
754 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
758 static HRESULT WINAPI
HTMLDocument_get_URL(IHTMLDocument2
*iface
, BSTR
*p
)
760 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
762 static const WCHAR about_blank_url
[] =
763 {'a','b','o','u','t',':','b','l','a','n','k',0};
765 TRACE("(%p)->(%p)\n", iface
, p
);
767 *p
= SysAllocString(This
->url
? This
->url
: about_blank_url
);
771 static HRESULT WINAPI
HTMLDocument_put_domain(IHTMLDocument2
*iface
, BSTR v
)
773 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
774 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
778 static HRESULT WINAPI
HTMLDocument_get_domain(IHTMLDocument2
*iface
, BSTR
*p
)
780 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
781 FIXME("(%p)->(%p)\n", This
, p
);
785 static HRESULT WINAPI
HTMLDocument_put_cookie(IHTMLDocument2
*iface
, BSTR v
)
787 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
788 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
792 static HRESULT WINAPI
HTMLDocument_get_cookie(IHTMLDocument2
*iface
, BSTR
*p
)
794 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
795 FIXME("(%p)->(%p)\n", This
, p
);
799 static HRESULT WINAPI
HTMLDocument_put_expando(IHTMLDocument2
*iface
, VARIANT_BOOL v
)
801 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
802 FIXME("(%p)->(%x)\n", This
, v
);
806 static HRESULT WINAPI
HTMLDocument_get_expando(IHTMLDocument2
*iface
, VARIANT_BOOL
*p
)
808 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
809 FIXME("(%p)->(%p)\n", This
, p
);
813 static HRESULT WINAPI
HTMLDocument_put_charset(IHTMLDocument2
*iface
, BSTR v
)
815 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
816 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
820 static HRESULT WINAPI
HTMLDocument_get_charset(IHTMLDocument2
*iface
, BSTR
*p
)
822 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
823 FIXME("(%p)->(%p)\n", This
, p
);
827 static HRESULT WINAPI
HTMLDocument_put_defaultCharset(IHTMLDocument2
*iface
, BSTR v
)
829 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
830 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
834 static HRESULT WINAPI
HTMLDocument_get_defaultCharset(IHTMLDocument2
*iface
, BSTR
*p
)
836 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
837 FIXME("(%p)->(%p)\n", This
, p
);
841 static HRESULT WINAPI
HTMLDocument_get_mimeType(IHTMLDocument2
*iface
, BSTR
*p
)
843 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
844 FIXME("(%p)->(%p)\n", This
, p
);
848 static HRESULT WINAPI
HTMLDocument_get_fileSize(IHTMLDocument2
*iface
, BSTR
*p
)
850 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
851 FIXME("(%p)->(%p)\n", This
, p
);
855 static HRESULT WINAPI
HTMLDocument_get_fileCreatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
857 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
858 FIXME("(%p)->(%p)\n", This
, p
);
862 static HRESULT WINAPI
HTMLDocument_get_fileModifiedDate(IHTMLDocument2
*iface
, BSTR
*p
)
864 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
865 FIXME("(%p)->(%p)\n", This
, p
);
869 static HRESULT WINAPI
HTMLDocument_get_fileUpdatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
871 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
872 FIXME("(%p)->(%p)\n", This
, p
);
876 static HRESULT WINAPI
HTMLDocument_get_security(IHTMLDocument2
*iface
, BSTR
*p
)
878 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
879 FIXME("(%p)->(%p)\n", This
, p
);
883 static HRESULT WINAPI
HTMLDocument_get_protocol(IHTMLDocument2
*iface
, BSTR
*p
)
885 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
886 FIXME("(%p)->(%p)\n", This
, p
);
890 static HRESULT WINAPI
HTMLDocument_get_nameProp(IHTMLDocument2
*iface
, BSTR
*p
)
892 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
893 FIXME("(%p)->(%p)\n", This
, p
);
897 static HRESULT WINAPI
HTMLDocument_write(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
899 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
906 TRACE("(%p)->(%p)\n", iface
, psarray
);
909 WARN("NULL nsdoc\n");
913 if(psarray
->cDims
!= 1) {
914 FIXME("cDims=%d\n", psarray
->cDims
);
918 hres
= SafeArrayAccessData(psarray
, (void**)&var
);
920 WARN("SafeArrayAccessData failed: %08x\n", hres
);
924 nsAString_Init(&nsstr
, NULL
);
926 for(i
=0; i
< psarray
->rgsabound
[0].cElements
; i
++) {
927 if(V_VT(var
+i
) == VT_BSTR
) {
928 nsAString_SetData(&nsstr
, V_BSTR(var
+i
));
929 nsres
= nsIDOMHTMLDocument_Write(This
->nsdoc
, &nsstr
);
931 ERR("Write failed: %08x\n", nsres
);
933 FIXME("vt=%d\n", V_VT(var
+i
));
937 nsAString_Finish(&nsstr
);
938 SafeArrayUnaccessData(psarray
);
943 static HRESULT WINAPI
HTMLDocument_writeln(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
945 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
946 FIXME("(%p)->(%p)\n", This
, psarray
);
950 static HRESULT WINAPI
HTMLDocument_open(IHTMLDocument2
*iface
, BSTR url
, VARIANT name
,
951 VARIANT features
, VARIANT replace
, IDispatch
**pomWindowResult
)
953 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
956 static const WCHAR text_htmlW
[] = {'t','e','x','t','/','h','t','m','l',0};
958 TRACE("(%p)->(%s %s %s %s %p)\n", This
, debugstr_w(url
), debugstr_variant(&name
),
959 debugstr_variant(&features
), debugstr_variant(&replace
), pomWindowResult
);
966 if(!url
|| strcmpW(url
, text_htmlW
) || V_VT(&name
) != VT_ERROR
967 || V_VT(&features
) != VT_ERROR
|| V_VT(&replace
) != VT_ERROR
)
968 FIXME("unsupported args\n");
970 nsres
= nsIDOMHTMLDocument_Open(This
->nsdoc
);
971 if(NS_FAILED(nsres
)) {
972 ERR("Open failed: %08x\n", nsres
);
976 *pomWindowResult
= (IDispatch
*)HTMLWINDOW2(This
->window
);
977 IHTMLWindow2_AddRef(HTMLWINDOW2(This
->window
));
981 static HRESULT WINAPI
HTMLDocument_close(IHTMLDocument2
*iface
)
983 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
986 TRACE("(%p)\n", This
);
993 nsres
= nsIDOMHTMLDocument_Close(This
->nsdoc
);
994 if(NS_FAILED(nsres
)) {
995 ERR("Close failed: %08x\n", nsres
);
1002 static HRESULT WINAPI
HTMLDocument_clear(IHTMLDocument2
*iface
)
1004 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1005 FIXME("(%p)\n", This
);
1009 static HRESULT WINAPI
HTMLDocument_queryCommandSupported(IHTMLDocument2
*iface
, BSTR cmdID
,
1010 VARIANT_BOOL
*pfRet
)
1012 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1013 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1017 static HRESULT WINAPI
HTMLDocument_queryCommandEnabled(IHTMLDocument2
*iface
, BSTR cmdID
,
1018 VARIANT_BOOL
*pfRet
)
1020 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1021 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1025 static HRESULT WINAPI
HTMLDocument_queryCommandState(IHTMLDocument2
*iface
, BSTR cmdID
,
1026 VARIANT_BOOL
*pfRet
)
1028 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1029 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1033 static HRESULT WINAPI
HTMLDocument_queryCommandIndeterm(IHTMLDocument2
*iface
, BSTR cmdID
,
1034 VARIANT_BOOL
*pfRet
)
1036 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1037 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1041 static HRESULT WINAPI
HTMLDocument_queryCommandText(IHTMLDocument2
*iface
, BSTR cmdID
,
1044 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1045 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1049 static HRESULT WINAPI
HTMLDocument_queryCommandValue(IHTMLDocument2
*iface
, BSTR cmdID
,
1052 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1053 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1057 static HRESULT WINAPI
HTMLDocument_execCommand(IHTMLDocument2
*iface
, BSTR cmdID
,
1058 VARIANT_BOOL showUI
, VARIANT value
, VARIANT_BOOL
*pfRet
)
1060 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1061 FIXME("(%p)->(%s %x %p)\n", This
, debugstr_w(cmdID
), showUI
, pfRet
);
1065 static HRESULT WINAPI
HTMLDocument_execCommandShowHelp(IHTMLDocument2
*iface
, BSTR cmdID
,
1066 VARIANT_BOOL
*pfRet
)
1068 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1069 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1073 static HRESULT WINAPI
HTMLDocument_createElement(IHTMLDocument2
*iface
, BSTR eTag
,
1074 IHTMLElement
**newElem
)
1076 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1077 nsIDOMElement
*nselem
;
1082 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eTag
), newElem
);
1085 WARN("NULL nsdoc\n");
1086 return E_UNEXPECTED
;
1089 nsAString_Init(&tag_str
, eTag
);
1090 nsres
= nsIDOMDocument_CreateElement(This
->nsdoc
, &tag_str
, &nselem
);
1091 nsAString_Finish(&tag_str
);
1092 if(NS_FAILED(nsres
)) {
1093 ERR("CreateElement failed: %08x\n", nsres
);
1097 elem
= HTMLElement_Create(This
, (nsIDOMNode
*)nselem
, TRUE
);
1098 nsIDOMElement_Release(nselem
);
1100 *newElem
= HTMLELEM(elem
);
1101 IHTMLElement_AddRef(HTMLELEM(elem
));
1105 static HRESULT WINAPI
HTMLDocument_put_onhelp(IHTMLDocument2
*iface
, VARIANT v
)
1107 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1108 FIXME("(%p)\n", This
);
1112 static HRESULT WINAPI
HTMLDocument_get_onhelp(IHTMLDocument2
*iface
, VARIANT
*p
)
1114 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1115 FIXME("(%p)->(%p)\n", This
, p
);
1119 static HRESULT WINAPI
HTMLDocument_put_onclick(IHTMLDocument2
*iface
, VARIANT v
)
1121 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1122 FIXME("(%p)\n", This
);
1126 static HRESULT WINAPI
HTMLDocument_get_onclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1128 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1129 FIXME("(%p)->(%p)\n", This
, p
);
1133 static HRESULT WINAPI
HTMLDocument_put_ondblclick(IHTMLDocument2
*iface
, VARIANT v
)
1135 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1136 FIXME("(%p)\n", This
);
1140 static HRESULT WINAPI
HTMLDocument_get_ondblclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1142 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1143 FIXME("(%p)->(%p)\n", This
, p
);
1147 static HRESULT WINAPI
HTMLDocument_put_onkeyup(IHTMLDocument2
*iface
, VARIANT v
)
1149 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1151 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1153 return set_doc_event(This
, EVENTID_KEYUP
, &v
);
1156 static HRESULT WINAPI
HTMLDocument_get_onkeyup(IHTMLDocument2
*iface
, VARIANT
*p
)
1158 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1160 TRACE("(%p)->(%p)\n", This
, p
);
1162 return get_doc_event(This
, EVENTID_KEYUP
, p
);
1165 static HRESULT WINAPI
HTMLDocument_put_onkeydown(IHTMLDocument2
*iface
, VARIANT v
)
1167 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1169 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1171 return set_doc_event(This
, EVENTID_KEYDOWN
, &v
);
1174 static HRESULT WINAPI
HTMLDocument_get_onkeydown(IHTMLDocument2
*iface
, VARIANT
*p
)
1176 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1178 TRACE("(%p)->(%p)\n", This
, p
);
1180 return get_doc_event(This
, EVENTID_KEYDOWN
, p
);
1183 static HRESULT WINAPI
HTMLDocument_put_onkeypress(IHTMLDocument2
*iface
, VARIANT v
)
1185 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1186 FIXME("(%p)\n", This
);
1190 static HRESULT WINAPI
HTMLDocument_get_onkeypress(IHTMLDocument2
*iface
, VARIANT
*p
)
1192 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1193 FIXME("(%p)->(%p)\n", This
, p
);
1197 static HRESULT WINAPI
HTMLDocument_put_onmouseup(IHTMLDocument2
*iface
, VARIANT v
)
1199 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1200 FIXME("(%p)\n", This
);
1204 static HRESULT WINAPI
HTMLDocument_get_onmouseup(IHTMLDocument2
*iface
, VARIANT
*p
)
1206 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1207 FIXME("(%p)->(%p)\n", This
, p
);
1211 static HRESULT WINAPI
HTMLDocument_put_onmousedown(IHTMLDocument2
*iface
, VARIANT v
)
1213 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1214 FIXME("(%p)\n", This
);
1218 static HRESULT WINAPI
HTMLDocument_get_onmousedown(IHTMLDocument2
*iface
, VARIANT
*p
)
1220 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1221 FIXME("(%p)->(%p)\n", This
, p
);
1225 static HRESULT WINAPI
HTMLDocument_put_onmousemove(IHTMLDocument2
*iface
, VARIANT v
)
1227 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1228 FIXME("(%p)\n", This
);
1232 static HRESULT WINAPI
HTMLDocument_get_onmousemove(IHTMLDocument2
*iface
, VARIANT
*p
)
1234 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1235 FIXME("(%p)->(%p)\n", This
, p
);
1239 static HRESULT WINAPI
HTMLDocument_put_onmouseout(IHTMLDocument2
*iface
, VARIANT v
)
1241 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1242 FIXME("(%p)\n", This
);
1246 static HRESULT WINAPI
HTMLDocument_get_onmouseout(IHTMLDocument2
*iface
, VARIANT
*p
)
1248 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1249 FIXME("(%p)->(%p)\n", This
, p
);
1253 static HRESULT WINAPI
HTMLDocument_put_onmouseover(IHTMLDocument2
*iface
, VARIANT v
)
1255 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1257 TRACE("(%p)\n", This
);
1259 return set_doc_event(This
, EVENTID_MOUSEOVER
, &v
);
1262 static HRESULT WINAPI
HTMLDocument_get_onmouseover(IHTMLDocument2
*iface
, VARIANT
*p
)
1264 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1266 TRACE("(%p)->(%p)\n", This
, p
);
1268 return get_doc_event(This
, EVENTID_MOUSEOVER
, p
);
1271 static HRESULT WINAPI
HTMLDocument_put_onreadystatechange(IHTMLDocument2
*iface
, VARIANT v
)
1273 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1274 FIXME("(%p)\n", This
);
1278 static HRESULT WINAPI
HTMLDocument_get_onreadystatechange(IHTMLDocument2
*iface
, VARIANT
*p
)
1280 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1281 FIXME("(%p)->(%p)\n", This
, p
);
1285 static HRESULT WINAPI
HTMLDocument_put_onafterupdate(IHTMLDocument2
*iface
, VARIANT v
)
1287 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1288 FIXME("(%p)\n", This
);
1292 static HRESULT WINAPI
HTMLDocument_get_onafterupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1294 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1295 FIXME("(%p)->(%p)\n", This
, p
);
1299 static HRESULT WINAPI
HTMLDocument_put_onrowexit(IHTMLDocument2
*iface
, VARIANT v
)
1301 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1302 FIXME("(%p)\n", This
);
1306 static HRESULT WINAPI
HTMLDocument_get_onrowexit(IHTMLDocument2
*iface
, VARIANT
*p
)
1308 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1309 FIXME("(%p)->(%p)\n", This
, p
);
1313 static HRESULT WINAPI
HTMLDocument_put_onrowenter(IHTMLDocument2
*iface
, VARIANT v
)
1315 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1316 FIXME("(%p)\n", This
);
1320 static HRESULT WINAPI
HTMLDocument_get_onrowenter(IHTMLDocument2
*iface
, VARIANT
*p
)
1322 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1323 FIXME("(%p)->(%p)\n", This
, p
);
1327 static HRESULT WINAPI
HTMLDocument_put_ondragstart(IHTMLDocument2
*iface
, VARIANT v
)
1329 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1331 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1333 return set_doc_event(This
, EVENTID_DRAGSTART
, &v
);
1336 static HRESULT WINAPI
HTMLDocument_get_ondragstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1338 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1340 TRACE("(%p)->(%p)\n", This
, p
);
1342 return get_doc_event(This
, EVENTID_DRAGSTART
, p
);
1345 static HRESULT WINAPI
HTMLDocument_put_onselectstart(IHTMLDocument2
*iface
, VARIANT v
)
1347 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1349 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1351 return set_doc_event(This
, EVENTID_SELECTSTART
, &v
);
1354 static HRESULT WINAPI
HTMLDocument_get_onselectstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1356 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1358 TRACE("(%p)->(%p)\n", This
, p
);
1360 return get_doc_event(This
, EVENTID_SELECTSTART
, p
);
1363 static HRESULT WINAPI
HTMLDocument_elementFromPoint(IHTMLDocument2
*iface
, long x
, long y
,
1364 IHTMLElement
**elementHit
)
1366 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1367 FIXME("(%p)->(%ld %ld %p)\n", This
, x
, y
, elementHit
);
1371 static HRESULT WINAPI
HTMLDocument_get_parentWindow(IHTMLDocument2
*iface
, IHTMLWindow2
**p
)
1373 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1375 TRACE("(%p)->(%p)\n", This
, p
);
1377 *p
= HTMLWINDOW2(This
->window
);
1378 IHTMLWindow2_AddRef(*p
);
1382 static HRESULT WINAPI
HTMLDocument_get_styleSheets(IHTMLDocument2
*iface
,
1383 IHTMLStyleSheetsCollection
**p
)
1385 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1386 nsIDOMStyleSheetList
*nsstylelist
;
1387 nsIDOMDocumentStyle
*nsdocstyle
;
1390 TRACE("(%p)->(%p)\n", This
, p
);
1395 WARN("NULL nsdoc\n");
1396 return E_UNEXPECTED
;
1399 nsIDOMHTMLDocument_QueryInterface(This
->nsdoc
, &IID_nsIDOMDocumentStyle
, (void**)&nsdocstyle
);
1400 nsres
= nsIDOMDocumentStyle_GetStyleSheets(nsdocstyle
, &nsstylelist
);
1401 nsIDOMDocumentStyle_Release(nsdocstyle
);
1402 if(NS_FAILED(nsres
)) {
1403 ERR("GetStyleSheets failed: %08x\n", nsres
);
1407 *p
= HTMLStyleSheetsCollection_Create(nsstylelist
);
1408 nsIDOMDocumentStyle_Release(nsstylelist
);
1413 static HRESULT WINAPI
HTMLDocument_put_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT v
)
1415 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1416 FIXME("(%p)\n", This
);
1420 static HRESULT WINAPI
HTMLDocument_get_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1422 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1423 FIXME("(%p)->(%p)\n", This
, p
);
1427 static HRESULT WINAPI
HTMLDocument_put_onerrorupdate(IHTMLDocument2
*iface
, VARIANT v
)
1429 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1430 FIXME("(%p)\n", This
);
1434 static HRESULT WINAPI
HTMLDocument_get_onerrorupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1436 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1437 FIXME("(%p)->(%p)\n", This
, p
);
1441 static HRESULT WINAPI
HTMLDocument_toString(IHTMLDocument2
*iface
, BSTR
*String
)
1443 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1444 FIXME("(%p)->(%p)\n", This
, String
);
1448 static HRESULT WINAPI
HTMLDocument_createStyleSheet(IHTMLDocument2
*iface
, BSTR bstrHref
,
1449 long lIndex
, IHTMLStyleSheet
**ppnewStyleSheet
)
1451 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1453 FIXME("(%p)->(%s %ld %p) semi-stub\n", This
, debugstr_w(bstrHref
), lIndex
, ppnewStyleSheet
);
1455 *ppnewStyleSheet
= HTMLStyleSheet_Create(NULL
);
1459 static const IHTMLDocument2Vtbl HTMLDocumentVtbl
= {
1460 HTMLDocument_QueryInterface
,
1461 HTMLDocument_AddRef
,
1462 HTMLDocument_Release
,
1463 HTMLDocument_GetTypeInfoCount
,
1464 HTMLDocument_GetTypeInfo
,
1465 HTMLDocument_GetIDsOfNames
,
1466 HTMLDocument_Invoke
,
1467 HTMLDocument_get_Script
,
1468 HTMLDocument_get_all
,
1469 HTMLDocument_get_body
,
1470 HTMLDocument_get_activeElement
,
1471 HTMLDocument_get_images
,
1472 HTMLDocument_get_applets
,
1473 HTMLDocument_get_links
,
1474 HTMLDocument_get_forms
,
1475 HTMLDocument_get_anchors
,
1476 HTMLDocument_put_title
,
1477 HTMLDocument_get_title
,
1478 HTMLDocument_get_scripts
,
1479 HTMLDocument_put_designMode
,
1480 HTMLDocument_get_designMode
,
1481 HTMLDocument_get_selection
,
1482 HTMLDocument_get_readyState
,
1483 HTMLDocument_get_frames
,
1484 HTMLDocument_get_embeds
,
1485 HTMLDocument_get_plugins
,
1486 HTMLDocument_put_alinkColor
,
1487 HTMLDocument_get_alinkColor
,
1488 HTMLDocument_put_bgColor
,
1489 HTMLDocument_get_bgColor
,
1490 HTMLDocument_put_fgColor
,
1491 HTMLDocument_get_fgColor
,
1492 HTMLDocument_put_linkColor
,
1493 HTMLDocument_get_linkColor
,
1494 HTMLDocument_put_vlinkColor
,
1495 HTMLDocument_get_vlinkColor
,
1496 HTMLDocument_get_referrer
,
1497 HTMLDocument_get_location
,
1498 HTMLDocument_get_lastModified
,
1499 HTMLDocument_put_URL
,
1500 HTMLDocument_get_URL
,
1501 HTMLDocument_put_domain
,
1502 HTMLDocument_get_domain
,
1503 HTMLDocument_put_cookie
,
1504 HTMLDocument_get_cookie
,
1505 HTMLDocument_put_expando
,
1506 HTMLDocument_get_expando
,
1507 HTMLDocument_put_charset
,
1508 HTMLDocument_get_charset
,
1509 HTMLDocument_put_defaultCharset
,
1510 HTMLDocument_get_defaultCharset
,
1511 HTMLDocument_get_mimeType
,
1512 HTMLDocument_get_fileSize
,
1513 HTMLDocument_get_fileCreatedDate
,
1514 HTMLDocument_get_fileModifiedDate
,
1515 HTMLDocument_get_fileUpdatedDate
,
1516 HTMLDocument_get_security
,
1517 HTMLDocument_get_protocol
,
1518 HTMLDocument_get_nameProp
,
1520 HTMLDocument_writeln
,
1524 HTMLDocument_queryCommandSupported
,
1525 HTMLDocument_queryCommandEnabled
,
1526 HTMLDocument_queryCommandState
,
1527 HTMLDocument_queryCommandIndeterm
,
1528 HTMLDocument_queryCommandText
,
1529 HTMLDocument_queryCommandValue
,
1530 HTMLDocument_execCommand
,
1531 HTMLDocument_execCommandShowHelp
,
1532 HTMLDocument_createElement
,
1533 HTMLDocument_put_onhelp
,
1534 HTMLDocument_get_onhelp
,
1535 HTMLDocument_put_onclick
,
1536 HTMLDocument_get_onclick
,
1537 HTMLDocument_put_ondblclick
,
1538 HTMLDocument_get_ondblclick
,
1539 HTMLDocument_put_onkeyup
,
1540 HTMLDocument_get_onkeyup
,
1541 HTMLDocument_put_onkeydown
,
1542 HTMLDocument_get_onkeydown
,
1543 HTMLDocument_put_onkeypress
,
1544 HTMLDocument_get_onkeypress
,
1545 HTMLDocument_put_onmouseup
,
1546 HTMLDocument_get_onmouseup
,
1547 HTMLDocument_put_onmousedown
,
1548 HTMLDocument_get_onmousedown
,
1549 HTMLDocument_put_onmousemove
,
1550 HTMLDocument_get_onmousemove
,
1551 HTMLDocument_put_onmouseout
,
1552 HTMLDocument_get_onmouseout
,
1553 HTMLDocument_put_onmouseover
,
1554 HTMLDocument_get_onmouseover
,
1555 HTMLDocument_put_onreadystatechange
,
1556 HTMLDocument_get_onreadystatechange
,
1557 HTMLDocument_put_onafterupdate
,
1558 HTMLDocument_get_onafterupdate
,
1559 HTMLDocument_put_onrowexit
,
1560 HTMLDocument_get_onrowexit
,
1561 HTMLDocument_put_onrowenter
,
1562 HTMLDocument_get_onrowenter
,
1563 HTMLDocument_put_ondragstart
,
1564 HTMLDocument_get_ondragstart
,
1565 HTMLDocument_put_onselectstart
,
1566 HTMLDocument_get_onselectstart
,
1567 HTMLDocument_elementFromPoint
,
1568 HTMLDocument_get_parentWindow
,
1569 HTMLDocument_get_styleSheets
,
1570 HTMLDocument_put_onbeforeupdate
,
1571 HTMLDocument_get_onbeforeupdate
,
1572 HTMLDocument_put_onerrorupdate
,
1573 HTMLDocument_get_onerrorupdate
,
1574 HTMLDocument_toString
,
1575 HTMLDocument_createStyleSheet
1578 #define SUPPINFO_THIS(iface) DEFINE_THIS(HTMLDocument, SupportErrorInfo, iface)
1580 static HRESULT WINAPI
SupportErrorInfo_QueryInterface(ISupportErrorInfo
*iface
, REFIID riid
, void **ppv
)
1582 HTMLDocument
*This
= SUPPINFO_THIS(iface
);
1583 return IHTMLDocument_QueryInterface(HTMLDOC(This
), riid
, ppv
);
1586 static ULONG WINAPI
SupportErrorInfo_AddRef(ISupportErrorInfo
*iface
)
1588 HTMLDocument
*This
= SUPPINFO_THIS(iface
);
1589 return IHTMLDocument_AddRef(HTMLDOC(This
));
1592 static ULONG WINAPI
SupportErrorInfo_Release(ISupportErrorInfo
*iface
)
1594 HTMLDocument
*This
= SUPPINFO_THIS(iface
);
1595 return IHTMLDocument_Release(HTMLDOC(This
));
1598 static HRESULT WINAPI
SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo
*iface
, REFIID riid
)
1600 FIXME("(%p)->(%s)\n", iface
, debugstr_guid(riid
));
1604 static const ISupportErrorInfoVtbl SupportErrorInfoVtbl
= {
1605 SupportErrorInfo_QueryInterface
,
1606 SupportErrorInfo_AddRef
,
1607 SupportErrorInfo_Release
,
1608 SupportErrorInfo_InterfaceSupportsErrorInfo
1611 #define DISPEX_THIS(iface) DEFINE_THIS(HTMLDocument, IDispatchEx, iface)
1613 static HRESULT WINAPI
DocDispatchEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
1615 HTMLDocument
*This
= DISPEX_THIS(iface
);
1617 return IHTMLDocument2_QueryInterface(HTMLDOC(This
), riid
, ppv
);
1620 static ULONG WINAPI
DocDispatchEx_AddRef(IDispatchEx
*iface
)
1622 HTMLDocument
*This
= DISPEX_THIS(iface
);
1624 return IHTMLDocument2_AddRef(HTMLDOC(This
));
1627 static ULONG WINAPI
DocDispatchEx_Release(IDispatchEx
*iface
)
1629 HTMLDocument
*This
= DISPEX_THIS(iface
);
1631 return IHTMLDocument2_Release(HTMLDOC(This
));
1634 static HRESULT WINAPI
DocDispatchEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
1636 HTMLDocument
*This
= DISPEX_THIS(iface
);
1638 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This
->dispex
), pctinfo
);
1641 static HRESULT WINAPI
DocDispatchEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
1642 LCID lcid
, ITypeInfo
**ppTInfo
)
1644 HTMLDocument
*This
= DISPEX_THIS(iface
);
1646 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This
->dispex
), iTInfo
, lcid
, ppTInfo
);
1649 static HRESULT WINAPI
DocDispatchEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
1650 LPOLESTR
*rgszNames
, UINT cNames
,
1651 LCID lcid
, DISPID
*rgDispId
)
1653 HTMLDocument
*This
= DISPEX_THIS(iface
);
1655 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This
->dispex
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1658 static HRESULT WINAPI
DocDispatchEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
1659 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1660 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1662 HTMLDocument
*This
= DISPEX_THIS(iface
);
1664 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
1665 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1667 switch(dispIdMember
) {
1668 case DISPID_READYSTATE
:
1669 TRACE("DISPID_READYSTATE\n");
1671 if(!(wFlags
& DISPATCH_PROPERTYGET
))
1672 return E_INVALIDARG
;
1674 V_VT(pVarResult
) = VT_I4
;
1675 V_I4(pVarResult
) = This
->readystate
;
1679 return IDispatchEx_Invoke(DISPATCHEX(&This
->dispex
), dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
1680 pVarResult
, pExcepInfo
, puArgErr
);
1683 static HRESULT WINAPI
DocDispatchEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
1685 HTMLDocument
*This
= DISPEX_THIS(iface
);
1687 return IDispatchEx_GetDispID(DISPATCHEX(&This
->dispex
), bstrName
, grfdex
, pid
);
1690 static HRESULT WINAPI
DocDispatchEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
1691 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
1693 HTMLDocument
*This
= DISPEX_THIS(iface
);
1695 return IDispatchEx_InvokeEx(DISPATCHEX(&This
->dispex
), id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
1698 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
1700 HTMLDocument
*This
= DISPEX_THIS(iface
);
1702 return IDispatchEx_DeleteMemberByName(DISPATCHEX(&This
->dispex
), bstrName
, grfdex
);
1705 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
1707 HTMLDocument
*This
= DISPEX_THIS(iface
);
1709 return IDispatchEx_DeleteMemberByDispID(DISPATCHEX(&This
->dispex
), id
);
1712 static HRESULT WINAPI
DocDispatchEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
1714 HTMLDocument
*This
= DISPEX_THIS(iface
);
1716 return IDispatchEx_GetMemberProperties(DISPATCHEX(&This
->dispex
), id
, grfdexFetch
, pgrfdex
);
1719 static HRESULT WINAPI
DocDispatchEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
1721 HTMLDocument
*This
= DISPEX_THIS(iface
);
1723 return IDispatchEx_GetMemberName(DISPATCHEX(&This
->dispex
), id
, pbstrName
);
1726 static HRESULT WINAPI
DocDispatchEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
1728 HTMLDocument
*This
= DISPEX_THIS(iface
);
1730 return IDispatchEx_GetNextDispID(DISPATCHEX(&This
->dispex
), grfdex
, id
, pid
);
1733 static HRESULT WINAPI
DocDispatchEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
1735 HTMLDocument
*This
= DISPEX_THIS(iface
);
1737 return IDispatchEx_GetNameSpaceParent(DISPATCHEX(&This
->dispex
), ppunk
);
1742 static const IDispatchExVtbl DocDispatchExVtbl
= {
1743 DocDispatchEx_QueryInterface
,
1744 DocDispatchEx_AddRef
,
1745 DocDispatchEx_Release
,
1746 DocDispatchEx_GetTypeInfoCount
,
1747 DocDispatchEx_GetTypeInfo
,
1748 DocDispatchEx_GetIDsOfNames
,
1749 DocDispatchEx_Invoke
,
1750 DocDispatchEx_GetDispID
,
1751 DocDispatchEx_InvokeEx
,
1752 DocDispatchEx_DeleteMemberByName
,
1753 DocDispatchEx_DeleteMemberByDispID
,
1754 DocDispatchEx_GetMemberProperties
,
1755 DocDispatchEx_GetMemberName
,
1756 DocDispatchEx_GetNextDispID
,
1757 DocDispatchEx_GetNameSpaceParent
1760 static const tid_t HTMLDocument_iface_tids
[] = {
1767 static dispex_static_data_t HTMLDocument_dispex
= {
1769 DispHTMLDocument_tid
,
1771 HTMLDocument_iface_tids
1774 static HRESULT
alloc_doc(HTMLDocument
**ret
)
1778 doc
= heap_alloc_zero(sizeof(HTMLDocument
));
1779 doc
->lpHTMLDocument2Vtbl
= &HTMLDocumentVtbl
;
1780 doc
->lpIDispatchExVtbl
= &DocDispatchExVtbl
;
1781 doc
->lpSupportErrorInfoVtbl
= &SupportErrorInfoVtbl
;
1783 doc
->readystate
= READYSTATE_UNINITIALIZED
;
1784 doc
->scriptmode
= SCRIPTMODE_GECKO
;
1786 list_init(&doc
->bindings
);
1787 list_init(&doc
->script_hosts
);
1788 list_init(&doc
->selection_list
);
1789 list_init(&doc
->range_list
);
1791 HTMLDocument_HTMLDocument3_Init(doc
);
1792 HTMLDocument_HTMLDocument5_Init(doc
);
1793 HTMLDocument_Persist_Init(doc
);
1794 HTMLDocument_OleCmd_Init(doc
);
1795 HTMLDocument_OleObj_Init(doc
);
1796 HTMLDocument_View_Init(doc
);
1797 HTMLDocument_Window_Init(doc
);
1798 HTMLDocument_Service_Init(doc
);
1799 HTMLDocument_Hlink_Init(doc
);
1801 ConnectionPointContainer_Init(&doc
->cp_container
, (IUnknown
*)HTMLDOC(doc
));
1802 ConnectionPoint_Init(&doc
->cp_propnotif
, &doc
->cp_container
, &IID_IPropertyNotifySink
);
1803 ConnectionPoint_Init(&doc
->cp_htmldocevents
, &doc
->cp_container
, &DIID_HTMLDocumentEvents
);
1804 ConnectionPoint_Init(&doc
->cp_htmldocevents2
, &doc
->cp_container
, &DIID_HTMLDocumentEvents2
);
1806 init_dispex(&doc
->dispex
, (IUnknown
*)HTMLDOC(doc
), &HTMLDocument_dispex
);
1812 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*nsdoc
, HTMLDocument
**ret
)
1817 hres
= alloc_doc(&doc
);
1821 nsIDOMHTMLDocument_AddRef(nsdoc
);
1824 hres
= HTMLWindow_Create(doc
, NULL
, &doc
->window
);
1826 IHTMLDocument_Release(HTMLDOC(doc
));
1834 HRESULT
HTMLDocument_Create(IUnknown
*pUnkOuter
, REFIID riid
, void** ppvObject
)
1837 nsIDOMWindow
*nswindow
= NULL
;
1840 TRACE("(%p %s %p)\n", pUnkOuter
, debugstr_guid(riid
), ppvObject
);
1842 hres
= alloc_doc(&doc
);
1846 hres
= IHTMLDocument_QueryInterface(HTMLDOC(doc
), riid
, ppvObject
);
1847 IHTMLDocument_Release(HTMLDOC(doc
));
1851 doc
->nscontainer
= NSContainer_Create(doc
, NULL
);
1852 update_nsdocument(doc
);
1854 if(doc
->nscontainer
) {
1857 nsres
= nsIWebBrowser_GetContentDOMWindow(doc
->nscontainer
->webbrowser
, &nswindow
);
1858 if(NS_FAILED(nsres
))
1859 ERR("GetContentDOMWindow failed: %08x\n", nsres
);
1862 hres
= HTMLWindow_Create(doc
, nswindow
, &doc
->window
);
1864 nsIDOMWindow_Release(nswindow
);
1866 IHTMLDocument_Release(HTMLDOC(doc
));