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(IsEqualGUID(&IID_IMarshal
, riid
)) {
142 TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This
, ppvObject
);
143 return E_NOINTERFACE
;
144 }else if(dispex_query_interface(&This
->dispex
, riid
, ppvObject
)) {
145 return *ppvObject
? S_OK
: E_NOINTERFACE
;
149 IHTMLDocument2_AddRef(iface
);
153 FIXME("(%p)->(%s %p) interface not supported\n", This
, debugstr_guid(riid
), ppvObject
);
154 return E_NOINTERFACE
;
157 static ULONG WINAPI
HTMLDocument_AddRef(IHTMLDocument2
*iface
)
159 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
160 ULONG ref
= InterlockedIncrement(&This
->ref
);
161 TRACE("(%p) ref = %u\n", This
, ref
);
165 static ULONG WINAPI
HTMLDocument_Release(IHTMLDocument2
*iface
)
167 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
168 ULONG ref
= InterlockedDecrement(&This
->ref
);
170 TRACE("(%p) ref = %u\n", This
, ref
);
173 remove_doc_tasks(This
);
174 release_script_hosts(This
);
177 IOleObject_SetClientSite(OLEOBJ(This
), NULL
);
178 if(This
->in_place_active
)
179 IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(This
));
181 IOleDocumentView_SetInPlaceSite(DOCVIEW(This
), NULL
);
183 IOleUndoManager_Release(This
->undomgr
);
185 set_document_bscallback(This
, NULL
);
186 set_current_mon(This
, NULL
);
188 if(This
->tooltips_hwnd
)
189 DestroyWindow(This
->tooltips_hwnd
);
191 DestroyWindow(This
->hwnd
);
193 if(This
->option_factory
) {
194 This
->option_factory
->doc
= NULL
;
195 IHTMLOptionElementFactory_Release(HTMLOPTFACTORY(This
->option_factory
));
199 This
->location
->doc
= NULL
;
202 IHTMLWindow2_Release(HTMLWINDOW2(This
->window
));
204 if(This
->event_target
)
205 release_event_target(This
->event_target
);
207 heap_free(This
->mime
);
208 detach_selection(This
);
212 ConnectionPointContainer_Destroy(&This
->cp_container
);
215 nsIDOMHTMLDocument_Release(This
->nsdoc
);
216 if(This
->nscontainer
)
217 NSContainer_Release(This
->nscontainer
);
225 static HRESULT WINAPI
HTMLDocument_GetTypeInfoCount(IHTMLDocument2
*iface
, UINT
*pctinfo
)
227 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
229 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This
), pctinfo
);
232 static HRESULT WINAPI
HTMLDocument_GetTypeInfo(IHTMLDocument2
*iface
, UINT iTInfo
,
233 LCID lcid
, ITypeInfo
**ppTInfo
)
235 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
237 return IDispatchEx_GetTypeInfo(DISPATCHEX(This
), iTInfo
, lcid
, ppTInfo
);
240 static HRESULT WINAPI
HTMLDocument_GetIDsOfNames(IHTMLDocument2
*iface
, REFIID riid
,
241 LPOLESTR
*rgszNames
, UINT cNames
,
242 LCID lcid
, DISPID
*rgDispId
)
244 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
246 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
249 static HRESULT WINAPI
HTMLDocument_Invoke(IHTMLDocument2
*iface
, DISPID dispIdMember
,
250 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
251 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
253 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
255 return IDispatchEx_Invoke(DISPATCHEX(This
), dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
256 pVarResult
, pExcepInfo
, puArgErr
);
259 static HRESULT WINAPI
HTMLDocument_get_Script(IHTMLDocument2
*iface
, IDispatch
**p
)
261 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
263 TRACE("(%p)->(%p)\n", This
, p
);
265 *p
= (IDispatch
*)HTMLWINDOW2(This
->window
);
266 IDispatch_AddRef(*p
);
270 static HRESULT WINAPI
HTMLDocument_get_all(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
272 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
273 nsIDOMElement
*nselem
= NULL
;
276 TRACE("(%p)->(%p)\n", This
, p
);
279 WARN("NULL nsdoc\n");
283 nsres
= nsIDOMHTMLDocument_GetDocumentElement(This
->nsdoc
, &nselem
);
284 if(NS_FAILED(nsres
)) {
285 ERR("GetDocumentElement failed: %08x\n", nsres
);
290 *p
= create_all_collection(get_node(This
, (nsIDOMNode
*)nselem
, TRUE
), TRUE
);
291 nsIDOMElement_Release(nselem
);
299 static HRESULT WINAPI
HTMLDocument_get_body(IHTMLDocument2
*iface
, IHTMLElement
**p
)
301 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
302 nsIDOMHTMLElement
*nsbody
= NULL
;
306 TRACE("(%p)->(%p)\n", This
, p
);
309 WARN("NULL nsdoc\n");
313 nsres
= nsIDOMHTMLDocument_GetBody(This
->nsdoc
, &nsbody
);
314 if(NS_FAILED(nsres
)) {
315 TRACE("Could not get body: %08x\n", nsres
);
320 node
= get_node(This
, (nsIDOMNode
*)nsbody
, TRUE
);
321 nsIDOMHTMLElement_Release(nsbody
);
323 IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node
), &IID_IHTMLElement
, (void**)p
);
328 TRACE("*p = %p\n", *p
);
332 static HRESULT WINAPI
HTMLDocument_get_activeElement(IHTMLDocument2
*iface
, IHTMLElement
**p
)
334 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
335 FIXME("(%p)->(%p)\n", This
, p
);
339 static HRESULT WINAPI
HTMLDocument_get_images(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
341 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
342 nsIDOMHTMLCollection
*nscoll
= NULL
;
345 TRACE("(%p)->(%p)\n", This
, p
);
353 WARN("NULL nsdoc\n");
357 nsres
= nsIDOMHTMLDocument_GetImages(This
->nsdoc
, &nscoll
);
358 if(NS_FAILED(nsres
)) {
359 ERR("GetImages failed: %08x\n", nsres
);
364 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
365 nsIDOMElement_Release(nscoll
);
371 static HRESULT WINAPI
HTMLDocument_get_applets(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
373 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
374 nsIDOMHTMLCollection
*nscoll
= NULL
;
377 TRACE("(%p)->(%p)\n", This
, p
);
385 WARN("NULL nsdoc\n");
389 nsres
= nsIDOMHTMLDocument_GetApplets(This
->nsdoc
, &nscoll
);
390 if(NS_FAILED(nsres
)) {
391 ERR("GetApplets failed: %08x\n", nsres
);
396 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
397 nsIDOMElement_Release(nscoll
);
403 static HRESULT WINAPI
HTMLDocument_get_links(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
405 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
406 nsIDOMHTMLCollection
*nscoll
= NULL
;
409 TRACE("(%p)->(%p)\n", This
, p
);
417 WARN("NULL nsdoc\n");
421 nsres
= nsIDOMHTMLDocument_GetLinks(This
->nsdoc
, &nscoll
);
422 if(NS_FAILED(nsres
)) {
423 ERR("GetLinks failed: %08x\n", nsres
);
428 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
429 nsIDOMElement_Release(nscoll
);
435 static HRESULT WINAPI
HTMLDocument_get_forms(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
437 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
438 nsIDOMHTMLCollection
*nscoll
= NULL
;
441 TRACE("(%p)->(%p)\n", This
, p
);
449 WARN("NULL nsdoc\n");
453 nsres
= nsIDOMHTMLDocument_GetForms(This
->nsdoc
, &nscoll
);
454 if(NS_FAILED(nsres
)) {
455 ERR("GetForms failed: %08x\n", nsres
);
460 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
461 nsIDOMElement_Release(nscoll
);
467 static HRESULT WINAPI
HTMLDocument_get_anchors(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
469 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
470 nsIDOMHTMLCollection
*nscoll
= NULL
;
473 TRACE("(%p)->(%p)\n", This
, p
);
481 WARN("NULL nsdoc\n");
485 nsres
= nsIDOMHTMLDocument_GetAnchors(This
->nsdoc
, &nscoll
);
486 if(NS_FAILED(nsres
)) {
487 ERR("GetAnchors failed: %08x\n", nsres
);
492 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
493 nsIDOMElement_Release(nscoll
);
499 static HRESULT WINAPI
HTMLDocument_put_title(IHTMLDocument2
*iface
, BSTR v
)
501 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
505 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
508 WARN("NULL nsdoc\n");
512 nsAString_Init(&nsstr
, v
);
513 nsres
= nsIDOMHTMLDocument_SetTitle(This
->nsdoc
, &nsstr
);
514 nsAString_Finish(&nsstr
);
516 ERR("SetTitle failed: %08x\n", nsres
);
521 static HRESULT WINAPI
HTMLDocument_get_title(IHTMLDocument2
*iface
, BSTR
*p
)
523 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
524 const PRUnichar
*ret
;
528 TRACE("(%p)->(%p)\n", This
, p
);
531 WARN("NULL nsdoc\n");
536 nsAString_Init(&nsstr
, NULL
);
537 nsres
= nsIDOMHTMLDocument_GetTitle(This
->nsdoc
, &nsstr
);
538 if (NS_SUCCEEDED(nsres
)) {
539 nsAString_GetData(&nsstr
, &ret
);
540 *p
= SysAllocString(ret
);
542 nsAString_Finish(&nsstr
);
544 if(NS_FAILED(nsres
)) {
545 ERR("GetTitle failed: %08x\n", nsres
);
552 static HRESULT WINAPI
HTMLDocument_get_scripts(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
554 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
555 FIXME("(%p)->(%p)\n", This
, p
);
559 static HRESULT WINAPI
HTMLDocument_put_designMode(IHTMLDocument2
*iface
, BSTR v
)
561 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
562 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
566 static HRESULT WINAPI
HTMLDocument_get_designMode(IHTMLDocument2
*iface
, BSTR
*p
)
568 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
569 static WCHAR szOff
[] = {'O','f','f',0};
570 FIXME("(%p)->(%p) always returning Off\n", This
, p
);
575 *p
= SysAllocString(szOff
);
580 static HRESULT WINAPI
HTMLDocument_get_selection(IHTMLDocument2
*iface
, IHTMLSelectionObject
**p
)
582 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
583 nsISelection
*nsselection
= NULL
;
585 TRACE("(%p)->(%p)\n", This
, p
);
587 if(This
->nscontainer
) {
588 nsIDOMWindow
*dom_window
= NULL
;
590 nsIWebBrowser_GetContentDOMWindow(This
->nscontainer
->webbrowser
, &dom_window
);
592 nsIDOMWindow_GetSelection(dom_window
, &nsselection
);
593 nsIDOMWindow_Release(dom_window
);
597 *p
= HTMLSelectionObject_Create(This
, nsselection
);
601 static HRESULT WINAPI
HTMLDocument_get_readyState(IHTMLDocument2
*iface
, BSTR
*p
)
603 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
605 static const WCHAR wszUninitialized
[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
606 static const WCHAR wszLoading
[] = {'l','o','a','d','i','n','g',0};
607 static const WCHAR wszLoaded
[] = {'l','o','a','d','e','d',0};
608 static const WCHAR wszInteractive
[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
609 static const WCHAR wszComplete
[] = {'c','o','m','p','l','e','t','e',0};
611 static const LPCWSTR readystate_str
[] = {
619 TRACE("(%p)->(%p)\n", iface
, p
);
624 *p
= SysAllocString(readystate_str
[This
->readystate
]);
628 static HRESULT WINAPI
HTMLDocument_get_frames(IHTMLDocument2
*iface
, IHTMLFramesCollection2
**p
)
630 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
631 FIXME("(%p)->(%p)\n", This
, p
);
635 static HRESULT WINAPI
HTMLDocument_get_embeds(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
637 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
638 FIXME("(%p)->(%p)\n", This
, p
);
642 static HRESULT WINAPI
HTMLDocument_get_plugins(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
644 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
645 FIXME("(%p)->(%p)\n", This
, p
);
649 static HRESULT WINAPI
HTMLDocument_put_alinkColor(IHTMLDocument2
*iface
, VARIANT v
)
651 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
652 FIXME("(%p)\n", This
);
656 static HRESULT WINAPI
HTMLDocument_get_alinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
658 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
659 FIXME("(%p)->(%p)\n", This
, p
);
663 static HRESULT WINAPI
HTMLDocument_put_bgColor(IHTMLDocument2
*iface
, VARIANT v
)
665 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
666 FIXME("(%p)\n", This
);
670 static HRESULT WINAPI
HTMLDocument_get_bgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
672 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
673 FIXME("(%p)->(%p)\n", This
, p
);
677 static HRESULT WINAPI
HTMLDocument_put_fgColor(IHTMLDocument2
*iface
, VARIANT v
)
679 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
680 FIXME("(%p)\n", This
);
684 static HRESULT WINAPI
HTMLDocument_get_fgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
686 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
687 FIXME("(%p)->(%p)\n", This
, p
);
691 static HRESULT WINAPI
HTMLDocument_put_linkColor(IHTMLDocument2
*iface
, VARIANT v
)
693 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
694 FIXME("(%p)->()\n", This
);
698 static HRESULT WINAPI
HTMLDocument_get_linkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
700 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
701 FIXME("(%p)->(%p)\n", This
, p
);
705 static HRESULT WINAPI
HTMLDocument_put_vlinkColor(IHTMLDocument2
*iface
, VARIANT v
)
707 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
708 FIXME("(%p)\n", This
);
712 static HRESULT WINAPI
HTMLDocument_get_vlinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
714 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
715 FIXME("(%p)->(%p)\n", This
, p
);
719 static HRESULT WINAPI
HTMLDocument_get_referrer(IHTMLDocument2
*iface
, BSTR
*p
)
721 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
722 FIXME("(%p)->(%p)\n", This
, p
);
726 static HRESULT WINAPI
HTMLDocument_get_location(IHTMLDocument2
*iface
, IHTMLLocation
**p
)
728 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
730 TRACE("(%p)->(%p)\n", This
, p
);
733 IHTMLLocation_AddRef(HTMLLOCATION(This
->location
));
735 This
->location
= HTMLLocation_Create(This
);
737 *p
= HTMLLOCATION(This
->location
);
741 static HRESULT WINAPI
HTMLDocument_get_lastModified(IHTMLDocument2
*iface
, BSTR
*p
)
743 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
744 FIXME("(%p)->(%p)\n", This
, p
);
748 static HRESULT WINAPI
HTMLDocument_put_URL(IHTMLDocument2
*iface
, BSTR v
)
750 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
751 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
755 static HRESULT WINAPI
HTMLDocument_get_URL(IHTMLDocument2
*iface
, BSTR
*p
)
757 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
759 static const WCHAR about_blank_url
[] =
760 {'a','b','o','u','t',':','b','l','a','n','k',0};
762 TRACE("(%p)->(%p)\n", iface
, p
);
764 *p
= SysAllocString(This
->url
? This
->url
: about_blank_url
);
768 static HRESULT WINAPI
HTMLDocument_put_domain(IHTMLDocument2
*iface
, BSTR v
)
770 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
771 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
775 static HRESULT WINAPI
HTMLDocument_get_domain(IHTMLDocument2
*iface
, BSTR
*p
)
777 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
778 FIXME("(%p)->(%p)\n", This
, p
);
782 static HRESULT WINAPI
HTMLDocument_put_cookie(IHTMLDocument2
*iface
, BSTR v
)
784 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
785 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
789 static HRESULT WINAPI
HTMLDocument_get_cookie(IHTMLDocument2
*iface
, BSTR
*p
)
791 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
792 FIXME("(%p)->(%p)\n", This
, p
);
796 static HRESULT WINAPI
HTMLDocument_put_expando(IHTMLDocument2
*iface
, VARIANT_BOOL v
)
798 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
799 FIXME("(%p)->(%x)\n", This
, v
);
803 static HRESULT WINAPI
HTMLDocument_get_expando(IHTMLDocument2
*iface
, VARIANT_BOOL
*p
)
805 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
806 FIXME("(%p)->(%p)\n", This
, p
);
810 static HRESULT WINAPI
HTMLDocument_put_charset(IHTMLDocument2
*iface
, BSTR v
)
812 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
813 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
817 static HRESULT WINAPI
HTMLDocument_get_charset(IHTMLDocument2
*iface
, BSTR
*p
)
819 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
820 FIXME("(%p)->(%p)\n", This
, p
);
824 static HRESULT WINAPI
HTMLDocument_put_defaultCharset(IHTMLDocument2
*iface
, BSTR v
)
826 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
827 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
831 static HRESULT WINAPI
HTMLDocument_get_defaultCharset(IHTMLDocument2
*iface
, BSTR
*p
)
833 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
834 FIXME("(%p)->(%p)\n", This
, p
);
838 static HRESULT WINAPI
HTMLDocument_get_mimeType(IHTMLDocument2
*iface
, BSTR
*p
)
840 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
841 FIXME("(%p)->(%p)\n", This
, p
);
845 static HRESULT WINAPI
HTMLDocument_get_fileSize(IHTMLDocument2
*iface
, BSTR
*p
)
847 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
848 FIXME("(%p)->(%p)\n", This
, p
);
852 static HRESULT WINAPI
HTMLDocument_get_fileCreatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
854 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
855 FIXME("(%p)->(%p)\n", This
, p
);
859 static HRESULT WINAPI
HTMLDocument_get_fileModifiedDate(IHTMLDocument2
*iface
, BSTR
*p
)
861 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
862 FIXME("(%p)->(%p)\n", This
, p
);
866 static HRESULT WINAPI
HTMLDocument_get_fileUpdatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
868 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
869 FIXME("(%p)->(%p)\n", This
, p
);
873 static HRESULT WINAPI
HTMLDocument_get_security(IHTMLDocument2
*iface
, BSTR
*p
)
875 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
876 FIXME("(%p)->(%p)\n", This
, p
);
880 static HRESULT WINAPI
HTMLDocument_get_protocol(IHTMLDocument2
*iface
, BSTR
*p
)
882 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
883 FIXME("(%p)->(%p)\n", This
, p
);
887 static HRESULT WINAPI
HTMLDocument_get_nameProp(IHTMLDocument2
*iface
, BSTR
*p
)
889 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
890 FIXME("(%p)->(%p)\n", This
, p
);
894 static HRESULT WINAPI
HTMLDocument_write(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
896 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
903 TRACE("(%p)->(%p)\n", iface
, psarray
);
906 WARN("NULL nsdoc\n");
910 if(psarray
->cDims
!= 1) {
911 FIXME("cDims=%d\n", psarray
->cDims
);
915 hres
= SafeArrayAccessData(psarray
, (void**)&var
);
917 WARN("SafeArrayAccessData failed: %08x\n", hres
);
921 nsAString_Init(&nsstr
, NULL
);
923 for(i
=0; i
< psarray
->rgsabound
[0].cElements
; i
++) {
924 if(V_VT(var
+i
) == VT_BSTR
) {
925 nsAString_SetData(&nsstr
, V_BSTR(var
+i
));
926 nsres
= nsIDOMHTMLDocument_Write(This
->nsdoc
, &nsstr
);
928 ERR("Write failed: %08x\n", nsres
);
930 FIXME("vt=%d\n", V_VT(var
+i
));
934 nsAString_Finish(&nsstr
);
935 SafeArrayUnaccessData(psarray
);
940 static HRESULT WINAPI
HTMLDocument_writeln(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
942 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
943 FIXME("(%p)->(%p)\n", This
, psarray
);
947 static HRESULT WINAPI
HTMLDocument_open(IHTMLDocument2
*iface
, BSTR url
, VARIANT name
,
948 VARIANT features
, VARIANT replace
, IDispatch
**pomWindowResult
)
950 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
953 static const WCHAR text_htmlW
[] = {'t','e','x','t','/','h','t','m','l',0};
955 TRACE("(%p)->(%s %s %s %s %p)\n", This
, debugstr_w(url
), debugstr_variant(&name
),
956 debugstr_variant(&features
), debugstr_variant(&replace
), pomWindowResult
);
963 if(!url
|| strcmpW(url
, text_htmlW
) || V_VT(&name
) != VT_ERROR
964 || V_VT(&features
) != VT_ERROR
|| V_VT(&replace
) != VT_ERROR
)
965 FIXME("unsupported args\n");
967 nsres
= nsIDOMHTMLDocument_Open(This
->nsdoc
);
968 if(NS_FAILED(nsres
)) {
969 ERR("Open failed: %08x\n", nsres
);
973 *pomWindowResult
= (IDispatch
*)HTMLWINDOW2(This
->window
);
974 IHTMLWindow2_AddRef(HTMLWINDOW2(This
->window
));
978 static HRESULT WINAPI
HTMLDocument_close(IHTMLDocument2
*iface
)
980 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
983 TRACE("(%p)\n", This
);
990 nsres
= nsIDOMHTMLDocument_Close(This
->nsdoc
);
991 if(NS_FAILED(nsres
)) {
992 ERR("Close failed: %08x\n", nsres
);
999 static HRESULT WINAPI
HTMLDocument_clear(IHTMLDocument2
*iface
)
1001 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1002 FIXME("(%p)\n", This
);
1006 static HRESULT WINAPI
HTMLDocument_queryCommandSupported(IHTMLDocument2
*iface
, BSTR cmdID
,
1007 VARIANT_BOOL
*pfRet
)
1009 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1010 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1014 static HRESULT WINAPI
HTMLDocument_queryCommandEnabled(IHTMLDocument2
*iface
, BSTR cmdID
,
1015 VARIANT_BOOL
*pfRet
)
1017 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1018 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1022 static HRESULT WINAPI
HTMLDocument_queryCommandState(IHTMLDocument2
*iface
, BSTR cmdID
,
1023 VARIANT_BOOL
*pfRet
)
1025 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1026 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1030 static HRESULT WINAPI
HTMLDocument_queryCommandIndeterm(IHTMLDocument2
*iface
, BSTR cmdID
,
1031 VARIANT_BOOL
*pfRet
)
1033 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1034 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1038 static HRESULT WINAPI
HTMLDocument_queryCommandText(IHTMLDocument2
*iface
, BSTR cmdID
,
1041 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1042 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1046 static HRESULT WINAPI
HTMLDocument_queryCommandValue(IHTMLDocument2
*iface
, BSTR cmdID
,
1049 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1050 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1054 static HRESULT WINAPI
HTMLDocument_execCommand(IHTMLDocument2
*iface
, BSTR cmdID
,
1055 VARIANT_BOOL showUI
, VARIANT value
, VARIANT_BOOL
*pfRet
)
1057 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1058 FIXME("(%p)->(%s %x %p)\n", This
, debugstr_w(cmdID
), showUI
, pfRet
);
1062 static HRESULT WINAPI
HTMLDocument_execCommandShowHelp(IHTMLDocument2
*iface
, BSTR cmdID
,
1063 VARIANT_BOOL
*pfRet
)
1065 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1066 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1070 static HRESULT WINAPI
HTMLDocument_createElement(IHTMLDocument2
*iface
, BSTR eTag
,
1071 IHTMLElement
**newElem
)
1073 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1074 nsIDOMElement
*nselem
;
1079 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eTag
), newElem
);
1082 WARN("NULL nsdoc\n");
1083 return E_UNEXPECTED
;
1086 nsAString_Init(&tag_str
, eTag
);
1087 nsres
= nsIDOMDocument_CreateElement(This
->nsdoc
, &tag_str
, &nselem
);
1088 nsAString_Finish(&tag_str
);
1089 if(NS_FAILED(nsres
)) {
1090 ERR("CreateElement failed: %08x\n", nsres
);
1094 elem
= HTMLElement_Create(This
, (nsIDOMNode
*)nselem
, TRUE
);
1095 nsIDOMElement_Release(nselem
);
1097 *newElem
= HTMLELEM(elem
);
1098 IHTMLElement_AddRef(HTMLELEM(elem
));
1102 static HRESULT WINAPI
HTMLDocument_put_onhelp(IHTMLDocument2
*iface
, VARIANT v
)
1104 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1105 FIXME("(%p)\n", This
);
1109 static HRESULT WINAPI
HTMLDocument_get_onhelp(IHTMLDocument2
*iface
, VARIANT
*p
)
1111 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1112 FIXME("(%p)->(%p)\n", This
, p
);
1116 static HRESULT WINAPI
HTMLDocument_put_onclick(IHTMLDocument2
*iface
, VARIANT v
)
1118 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1119 FIXME("(%p)\n", This
);
1123 static HRESULT WINAPI
HTMLDocument_get_onclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1125 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1126 FIXME("(%p)->(%p)\n", This
, p
);
1130 static HRESULT WINAPI
HTMLDocument_put_ondblclick(IHTMLDocument2
*iface
, VARIANT v
)
1132 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1133 FIXME("(%p)\n", This
);
1137 static HRESULT WINAPI
HTMLDocument_get_ondblclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1139 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1140 FIXME("(%p)->(%p)\n", This
, p
);
1144 static HRESULT WINAPI
HTMLDocument_put_onkeyup(IHTMLDocument2
*iface
, VARIANT v
)
1146 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1148 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1150 return set_doc_event(This
, EVENTID_KEYUP
, &v
);
1153 static HRESULT WINAPI
HTMLDocument_get_onkeyup(IHTMLDocument2
*iface
, VARIANT
*p
)
1155 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1157 TRACE("(%p)->(%p)\n", This
, p
);
1159 return get_doc_event(This
, EVENTID_KEYUP
, p
);
1162 static HRESULT WINAPI
HTMLDocument_put_onkeydown(IHTMLDocument2
*iface
, VARIANT v
)
1164 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1166 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1168 return set_doc_event(This
, EVENTID_KEYDOWN
, &v
);
1171 static HRESULT WINAPI
HTMLDocument_get_onkeydown(IHTMLDocument2
*iface
, VARIANT
*p
)
1173 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1175 TRACE("(%p)->(%p)\n", This
, p
);
1177 return get_doc_event(This
, EVENTID_KEYDOWN
, p
);
1180 static HRESULT WINAPI
HTMLDocument_put_onkeypress(IHTMLDocument2
*iface
, VARIANT v
)
1182 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1183 FIXME("(%p)\n", This
);
1187 static HRESULT WINAPI
HTMLDocument_get_onkeypress(IHTMLDocument2
*iface
, VARIANT
*p
)
1189 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1190 FIXME("(%p)->(%p)\n", This
, p
);
1194 static HRESULT WINAPI
HTMLDocument_put_onmouseup(IHTMLDocument2
*iface
, VARIANT v
)
1196 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1197 FIXME("(%p)\n", This
);
1201 static HRESULT WINAPI
HTMLDocument_get_onmouseup(IHTMLDocument2
*iface
, VARIANT
*p
)
1203 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1204 FIXME("(%p)->(%p)\n", This
, p
);
1208 static HRESULT WINAPI
HTMLDocument_put_onmousedown(IHTMLDocument2
*iface
, VARIANT v
)
1210 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1211 FIXME("(%p)\n", This
);
1215 static HRESULT WINAPI
HTMLDocument_get_onmousedown(IHTMLDocument2
*iface
, VARIANT
*p
)
1217 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1218 FIXME("(%p)->(%p)\n", This
, p
);
1222 static HRESULT WINAPI
HTMLDocument_put_onmousemove(IHTMLDocument2
*iface
, VARIANT v
)
1224 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1225 FIXME("(%p)\n", This
);
1229 static HRESULT WINAPI
HTMLDocument_get_onmousemove(IHTMLDocument2
*iface
, VARIANT
*p
)
1231 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1232 FIXME("(%p)->(%p)\n", This
, p
);
1236 static HRESULT WINAPI
HTMLDocument_put_onmouseout(IHTMLDocument2
*iface
, VARIANT v
)
1238 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1239 FIXME("(%p)\n", This
);
1243 static HRESULT WINAPI
HTMLDocument_get_onmouseout(IHTMLDocument2
*iface
, VARIANT
*p
)
1245 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1246 FIXME("(%p)->(%p)\n", This
, p
);
1250 static HRESULT WINAPI
HTMLDocument_put_onmouseover(IHTMLDocument2
*iface
, VARIANT v
)
1252 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1254 TRACE("(%p)\n", This
);
1256 return set_doc_event(This
, EVENTID_MOUSEOVER
, &v
);
1259 static HRESULT WINAPI
HTMLDocument_get_onmouseover(IHTMLDocument2
*iface
, VARIANT
*p
)
1261 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1263 TRACE("(%p)->(%p)\n", This
, p
);
1265 return get_doc_event(This
, EVENTID_MOUSEOVER
, p
);
1268 static HRESULT WINAPI
HTMLDocument_put_onreadystatechange(IHTMLDocument2
*iface
, VARIANT v
)
1270 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1271 FIXME("(%p)\n", This
);
1275 static HRESULT WINAPI
HTMLDocument_get_onreadystatechange(IHTMLDocument2
*iface
, VARIANT
*p
)
1277 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1278 FIXME("(%p)->(%p)\n", This
, p
);
1282 static HRESULT WINAPI
HTMLDocument_put_onafterupdate(IHTMLDocument2
*iface
, VARIANT v
)
1284 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1285 FIXME("(%p)\n", This
);
1289 static HRESULT WINAPI
HTMLDocument_get_onafterupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1291 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1292 FIXME("(%p)->(%p)\n", This
, p
);
1296 static HRESULT WINAPI
HTMLDocument_put_onrowexit(IHTMLDocument2
*iface
, VARIANT v
)
1298 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1299 FIXME("(%p)\n", This
);
1303 static HRESULT WINAPI
HTMLDocument_get_onrowexit(IHTMLDocument2
*iface
, VARIANT
*p
)
1305 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1306 FIXME("(%p)->(%p)\n", This
, p
);
1310 static HRESULT WINAPI
HTMLDocument_put_onrowenter(IHTMLDocument2
*iface
, VARIANT v
)
1312 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1313 FIXME("(%p)\n", This
);
1317 static HRESULT WINAPI
HTMLDocument_get_onrowenter(IHTMLDocument2
*iface
, VARIANT
*p
)
1319 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1320 FIXME("(%p)->(%p)\n", This
, p
);
1324 static HRESULT WINAPI
HTMLDocument_put_ondragstart(IHTMLDocument2
*iface
, VARIANT v
)
1326 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1328 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1330 return set_doc_event(This
, EVENTID_DRAGSTART
, &v
);
1333 static HRESULT WINAPI
HTMLDocument_get_ondragstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1335 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1337 TRACE("(%p)->(%p)\n", This
, p
);
1339 return get_doc_event(This
, EVENTID_DRAGSTART
, p
);
1342 static HRESULT WINAPI
HTMLDocument_put_onselectstart(IHTMLDocument2
*iface
, VARIANT v
)
1344 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1346 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1348 return set_doc_event(This
, EVENTID_SELECTSTART
, &v
);
1351 static HRESULT WINAPI
HTMLDocument_get_onselectstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1353 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1355 TRACE("(%p)->(%p)\n", This
, p
);
1357 return get_doc_event(This
, EVENTID_SELECTSTART
, p
);
1360 static HRESULT WINAPI
HTMLDocument_elementFromPoint(IHTMLDocument2
*iface
, long x
, long y
,
1361 IHTMLElement
**elementHit
)
1363 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1364 FIXME("(%p)->(%ld %ld %p)\n", This
, x
, y
, elementHit
);
1368 static HRESULT WINAPI
HTMLDocument_get_parentWindow(IHTMLDocument2
*iface
, IHTMLWindow2
**p
)
1370 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1372 TRACE("(%p)->(%p)\n", This
, p
);
1374 *p
= HTMLWINDOW2(This
->window
);
1375 IHTMLWindow2_AddRef(*p
);
1379 static HRESULT WINAPI
HTMLDocument_get_styleSheets(IHTMLDocument2
*iface
,
1380 IHTMLStyleSheetsCollection
**p
)
1382 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1383 nsIDOMStyleSheetList
*nsstylelist
;
1384 nsIDOMDocumentStyle
*nsdocstyle
;
1387 TRACE("(%p)->(%p)\n", This
, p
);
1392 WARN("NULL nsdoc\n");
1393 return E_UNEXPECTED
;
1396 nsIDOMHTMLDocument_QueryInterface(This
->nsdoc
, &IID_nsIDOMDocumentStyle
, (void**)&nsdocstyle
);
1397 nsres
= nsIDOMDocumentStyle_GetStyleSheets(nsdocstyle
, &nsstylelist
);
1398 nsIDOMDocumentStyle_Release(nsdocstyle
);
1399 if(NS_FAILED(nsres
)) {
1400 ERR("GetStyleSheets failed: %08x\n", nsres
);
1404 *p
= HTMLStyleSheetsCollection_Create(nsstylelist
);
1405 nsIDOMDocumentStyle_Release(nsstylelist
);
1410 static HRESULT WINAPI
HTMLDocument_put_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT v
)
1412 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1413 FIXME("(%p)\n", This
);
1417 static HRESULT WINAPI
HTMLDocument_get_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1419 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1420 FIXME("(%p)->(%p)\n", This
, p
);
1424 static HRESULT WINAPI
HTMLDocument_put_onerrorupdate(IHTMLDocument2
*iface
, VARIANT v
)
1426 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1427 FIXME("(%p)\n", This
);
1431 static HRESULT WINAPI
HTMLDocument_get_onerrorupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1433 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1434 FIXME("(%p)->(%p)\n", This
, p
);
1438 static HRESULT WINAPI
HTMLDocument_toString(IHTMLDocument2
*iface
, BSTR
*String
)
1440 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1441 FIXME("(%p)->(%p)\n", This
, String
);
1445 static HRESULT WINAPI
HTMLDocument_createStyleSheet(IHTMLDocument2
*iface
, BSTR bstrHref
,
1446 long lIndex
, IHTMLStyleSheet
**ppnewStyleSheet
)
1448 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1450 FIXME("(%p)->(%s %ld %p) semi-stub\n", This
, debugstr_w(bstrHref
), lIndex
, ppnewStyleSheet
);
1452 *ppnewStyleSheet
= HTMLStyleSheet_Create(NULL
);
1456 static const IHTMLDocument2Vtbl HTMLDocumentVtbl
= {
1457 HTMLDocument_QueryInterface
,
1458 HTMLDocument_AddRef
,
1459 HTMLDocument_Release
,
1460 HTMLDocument_GetTypeInfoCount
,
1461 HTMLDocument_GetTypeInfo
,
1462 HTMLDocument_GetIDsOfNames
,
1463 HTMLDocument_Invoke
,
1464 HTMLDocument_get_Script
,
1465 HTMLDocument_get_all
,
1466 HTMLDocument_get_body
,
1467 HTMLDocument_get_activeElement
,
1468 HTMLDocument_get_images
,
1469 HTMLDocument_get_applets
,
1470 HTMLDocument_get_links
,
1471 HTMLDocument_get_forms
,
1472 HTMLDocument_get_anchors
,
1473 HTMLDocument_put_title
,
1474 HTMLDocument_get_title
,
1475 HTMLDocument_get_scripts
,
1476 HTMLDocument_put_designMode
,
1477 HTMLDocument_get_designMode
,
1478 HTMLDocument_get_selection
,
1479 HTMLDocument_get_readyState
,
1480 HTMLDocument_get_frames
,
1481 HTMLDocument_get_embeds
,
1482 HTMLDocument_get_plugins
,
1483 HTMLDocument_put_alinkColor
,
1484 HTMLDocument_get_alinkColor
,
1485 HTMLDocument_put_bgColor
,
1486 HTMLDocument_get_bgColor
,
1487 HTMLDocument_put_fgColor
,
1488 HTMLDocument_get_fgColor
,
1489 HTMLDocument_put_linkColor
,
1490 HTMLDocument_get_linkColor
,
1491 HTMLDocument_put_vlinkColor
,
1492 HTMLDocument_get_vlinkColor
,
1493 HTMLDocument_get_referrer
,
1494 HTMLDocument_get_location
,
1495 HTMLDocument_get_lastModified
,
1496 HTMLDocument_put_URL
,
1497 HTMLDocument_get_URL
,
1498 HTMLDocument_put_domain
,
1499 HTMLDocument_get_domain
,
1500 HTMLDocument_put_cookie
,
1501 HTMLDocument_get_cookie
,
1502 HTMLDocument_put_expando
,
1503 HTMLDocument_get_expando
,
1504 HTMLDocument_put_charset
,
1505 HTMLDocument_get_charset
,
1506 HTMLDocument_put_defaultCharset
,
1507 HTMLDocument_get_defaultCharset
,
1508 HTMLDocument_get_mimeType
,
1509 HTMLDocument_get_fileSize
,
1510 HTMLDocument_get_fileCreatedDate
,
1511 HTMLDocument_get_fileModifiedDate
,
1512 HTMLDocument_get_fileUpdatedDate
,
1513 HTMLDocument_get_security
,
1514 HTMLDocument_get_protocol
,
1515 HTMLDocument_get_nameProp
,
1517 HTMLDocument_writeln
,
1521 HTMLDocument_queryCommandSupported
,
1522 HTMLDocument_queryCommandEnabled
,
1523 HTMLDocument_queryCommandState
,
1524 HTMLDocument_queryCommandIndeterm
,
1525 HTMLDocument_queryCommandText
,
1526 HTMLDocument_queryCommandValue
,
1527 HTMLDocument_execCommand
,
1528 HTMLDocument_execCommandShowHelp
,
1529 HTMLDocument_createElement
,
1530 HTMLDocument_put_onhelp
,
1531 HTMLDocument_get_onhelp
,
1532 HTMLDocument_put_onclick
,
1533 HTMLDocument_get_onclick
,
1534 HTMLDocument_put_ondblclick
,
1535 HTMLDocument_get_ondblclick
,
1536 HTMLDocument_put_onkeyup
,
1537 HTMLDocument_get_onkeyup
,
1538 HTMLDocument_put_onkeydown
,
1539 HTMLDocument_get_onkeydown
,
1540 HTMLDocument_put_onkeypress
,
1541 HTMLDocument_get_onkeypress
,
1542 HTMLDocument_put_onmouseup
,
1543 HTMLDocument_get_onmouseup
,
1544 HTMLDocument_put_onmousedown
,
1545 HTMLDocument_get_onmousedown
,
1546 HTMLDocument_put_onmousemove
,
1547 HTMLDocument_get_onmousemove
,
1548 HTMLDocument_put_onmouseout
,
1549 HTMLDocument_get_onmouseout
,
1550 HTMLDocument_put_onmouseover
,
1551 HTMLDocument_get_onmouseover
,
1552 HTMLDocument_put_onreadystatechange
,
1553 HTMLDocument_get_onreadystatechange
,
1554 HTMLDocument_put_onafterupdate
,
1555 HTMLDocument_get_onafterupdate
,
1556 HTMLDocument_put_onrowexit
,
1557 HTMLDocument_get_onrowexit
,
1558 HTMLDocument_put_onrowenter
,
1559 HTMLDocument_get_onrowenter
,
1560 HTMLDocument_put_ondragstart
,
1561 HTMLDocument_get_ondragstart
,
1562 HTMLDocument_put_onselectstart
,
1563 HTMLDocument_get_onselectstart
,
1564 HTMLDocument_elementFromPoint
,
1565 HTMLDocument_get_parentWindow
,
1566 HTMLDocument_get_styleSheets
,
1567 HTMLDocument_put_onbeforeupdate
,
1568 HTMLDocument_get_onbeforeupdate
,
1569 HTMLDocument_put_onerrorupdate
,
1570 HTMLDocument_get_onerrorupdate
,
1571 HTMLDocument_toString
,
1572 HTMLDocument_createStyleSheet
1575 #define DISPEX_THIS(iface) DEFINE_THIS(HTMLDocument, IDispatchEx, iface)
1577 static HRESULT WINAPI
DocDispatchEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
1579 HTMLDocument
*This
= DISPEX_THIS(iface
);
1581 return IHTMLDocument2_QueryInterface(HTMLDOC(This
), riid
, ppv
);
1584 static ULONG WINAPI
DocDispatchEx_AddRef(IDispatchEx
*iface
)
1586 HTMLDocument
*This
= DISPEX_THIS(iface
);
1588 return IHTMLDocument2_AddRef(HTMLDOC(This
));
1591 static ULONG WINAPI
DocDispatchEx_Release(IDispatchEx
*iface
)
1593 HTMLDocument
*This
= DISPEX_THIS(iface
);
1595 return IHTMLDocument2_Release(HTMLDOC(This
));
1598 static HRESULT WINAPI
DocDispatchEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
1600 HTMLDocument
*This
= DISPEX_THIS(iface
);
1602 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This
->dispex
), pctinfo
);
1605 static HRESULT WINAPI
DocDispatchEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
1606 LCID lcid
, ITypeInfo
**ppTInfo
)
1608 HTMLDocument
*This
= DISPEX_THIS(iface
);
1610 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This
->dispex
), iTInfo
, lcid
, ppTInfo
);
1613 static HRESULT WINAPI
DocDispatchEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
1614 LPOLESTR
*rgszNames
, UINT cNames
,
1615 LCID lcid
, DISPID
*rgDispId
)
1617 HTMLDocument
*This
= DISPEX_THIS(iface
);
1619 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This
->dispex
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1622 static HRESULT WINAPI
DocDispatchEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
1623 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1624 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1626 HTMLDocument
*This
= DISPEX_THIS(iface
);
1628 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
1629 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1631 switch(dispIdMember
) {
1632 case DISPID_READYSTATE
:
1633 TRACE("DISPID_READYSTATE\n");
1635 if(!(wFlags
& DISPATCH_PROPERTYGET
))
1636 return E_INVALIDARG
;
1638 V_VT(pVarResult
) = VT_I4
;
1639 V_I4(pVarResult
) = This
->readystate
;
1643 return IDispatchEx_Invoke(DISPATCHEX(&This
->dispex
), dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
1644 pVarResult
, pExcepInfo
, puArgErr
);
1647 static HRESULT WINAPI
DocDispatchEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
1649 HTMLDocument
*This
= DISPEX_THIS(iface
);
1651 return IDispatchEx_GetDispID(DISPATCHEX(&This
->dispex
), bstrName
, grfdex
, pid
);
1654 static HRESULT WINAPI
DocDispatchEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
1655 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
1657 HTMLDocument
*This
= DISPEX_THIS(iface
);
1659 return IDispatchEx_InvokeEx(DISPATCHEX(&This
->dispex
), id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
1662 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
1664 HTMLDocument
*This
= DISPEX_THIS(iface
);
1666 return IDispatchEx_DeleteMemberByName(DISPATCHEX(&This
->dispex
), bstrName
, grfdex
);
1669 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
1671 HTMLDocument
*This
= DISPEX_THIS(iface
);
1673 return IDispatchEx_DeleteMemberByDispID(DISPATCHEX(&This
->dispex
), id
);
1676 static HRESULT WINAPI
DocDispatchEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
1678 HTMLDocument
*This
= DISPEX_THIS(iface
);
1680 return IDispatchEx_GetMemberProperties(DISPATCHEX(&This
->dispex
), id
, grfdexFetch
, pgrfdex
);
1683 static HRESULT WINAPI
DocDispatchEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
1685 HTMLDocument
*This
= DISPEX_THIS(iface
);
1687 return IDispatchEx_GetMemberName(DISPATCHEX(&This
->dispex
), id
, pbstrName
);
1690 static HRESULT WINAPI
DocDispatchEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
1692 HTMLDocument
*This
= DISPEX_THIS(iface
);
1694 return IDispatchEx_GetNextDispID(DISPATCHEX(&This
->dispex
), grfdex
, id
, pid
);
1697 static HRESULT WINAPI
DocDispatchEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
1699 HTMLDocument
*This
= DISPEX_THIS(iface
);
1701 return IDispatchEx_GetNameSpaceParent(DISPATCHEX(&This
->dispex
), ppunk
);
1706 static const IDispatchExVtbl DocDispatchExVtbl
= {
1707 DocDispatchEx_QueryInterface
,
1708 DocDispatchEx_AddRef
,
1709 DocDispatchEx_Release
,
1710 DocDispatchEx_GetTypeInfoCount
,
1711 DocDispatchEx_GetTypeInfo
,
1712 DocDispatchEx_GetIDsOfNames
,
1713 DocDispatchEx_Invoke
,
1714 DocDispatchEx_GetDispID
,
1715 DocDispatchEx_InvokeEx
,
1716 DocDispatchEx_DeleteMemberByName
,
1717 DocDispatchEx_DeleteMemberByDispID
,
1718 DocDispatchEx_GetMemberProperties
,
1719 DocDispatchEx_GetMemberName
,
1720 DocDispatchEx_GetNextDispID
,
1721 DocDispatchEx_GetNameSpaceParent
1724 static const tid_t HTMLDocument_iface_tids
[] = {
1731 static dispex_static_data_t HTMLDocument_dispex
= {
1733 DispHTMLDocument_tid
,
1735 HTMLDocument_iface_tids
1738 static HRESULT
alloc_doc(HTMLDocument
**ret
)
1742 doc
= heap_alloc_zero(sizeof(HTMLDocument
));
1743 doc
->lpHTMLDocument2Vtbl
= &HTMLDocumentVtbl
;
1744 doc
->lpIDispatchExVtbl
= &DocDispatchExVtbl
;
1746 doc
->readystate
= READYSTATE_UNINITIALIZED
;
1747 doc
->scriptmode
= SCRIPTMODE_GECKO
;
1749 list_init(&doc
->bindings
);
1750 list_init(&doc
->script_hosts
);
1751 list_init(&doc
->selection_list
);
1752 list_init(&doc
->range_list
);
1754 HTMLDocument_HTMLDocument3_Init(doc
);
1755 HTMLDocument_HTMLDocument5_Init(doc
);
1756 HTMLDocument_Persist_Init(doc
);
1757 HTMLDocument_OleCmd_Init(doc
);
1758 HTMLDocument_OleObj_Init(doc
);
1759 HTMLDocument_View_Init(doc
);
1760 HTMLDocument_Window_Init(doc
);
1761 HTMLDocument_Service_Init(doc
);
1762 HTMLDocument_Hlink_Init(doc
);
1764 ConnectionPointContainer_Init(&doc
->cp_container
, (IUnknown
*)HTMLDOC(doc
));
1765 ConnectionPoint_Init(&doc
->cp_propnotif
, &doc
->cp_container
, &IID_IPropertyNotifySink
);
1766 ConnectionPoint_Init(&doc
->cp_htmldocevents
, &doc
->cp_container
, &DIID_HTMLDocumentEvents
);
1767 ConnectionPoint_Init(&doc
->cp_htmldocevents2
, &doc
->cp_container
, &DIID_HTMLDocumentEvents2
);
1769 init_dispex(&doc
->dispex
, (IUnknown
*)HTMLDOC(doc
), &HTMLDocument_dispex
);
1775 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*nsdoc
, HTMLDocument
**ret
)
1780 hres
= alloc_doc(&doc
);
1784 nsIDOMHTMLDocument_AddRef(nsdoc
);
1787 hres
= HTMLWindow_Create(doc
, NULL
, &doc
->window
);
1789 IHTMLDocument_Release(HTMLDOC(doc
));
1797 HRESULT
HTMLDocument_Create(IUnknown
*pUnkOuter
, REFIID riid
, void** ppvObject
)
1800 nsIDOMWindow
*nswindow
= NULL
;
1803 TRACE("(%p %s %p)\n", pUnkOuter
, debugstr_guid(riid
), ppvObject
);
1805 hres
= alloc_doc(&doc
);
1809 hres
= IHTMLDocument_QueryInterface(HTMLDOC(doc
), riid
, ppvObject
);
1810 IHTMLDocument_Release(HTMLDOC(doc
));
1814 doc
->nscontainer
= NSContainer_Create(doc
, NULL
);
1815 update_nsdocument(doc
);
1817 if(doc
->nscontainer
) {
1820 nsres
= nsIWebBrowser_GetContentDOMWindow(doc
->nscontainer
->webbrowser
, &nswindow
);
1821 if(NS_FAILED(nsres
))
1822 ERR("GetContentDOMWindow failed: %08x\n", nsres
);
1825 hres
= HTMLWindow_Create(doc
, nswindow
, &doc
->window
);
1827 nsIDOMWindow_Release(nswindow
);
1829 IHTMLDocument_Release(HTMLDOC(doc
));