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
32 #include "wine/debug.h"
34 #include "mshtml_private.h"
35 #include "htmlevent.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
39 #define HTMLDOC_THIS(iface) DEFINE_THIS(HTMLDocument, HTMLDocument2, iface)
41 static HRESULT WINAPI
HTMLDocument_QueryInterface(IHTMLDocument2
*iface
, REFIID riid
, void **ppvObject
)
43 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
46 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
47 TRACE("(%p)->(IID_IUnknown, %p)\n", This
, ppvObject
);
48 *ppvObject
= HTMLDOC(This
);
49 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
50 TRACE("(%p)->(IID_IDispatch, %p)\n", This
, ppvObject
);
51 *ppvObject
= DISPATCHEX(This
);
52 }else if(IsEqualGUID(&IID_IDispatchEx
, riid
)) {
53 TRACE("(%p)->(IID_IDispatchEx, %p)\n", This
, ppvObject
);
54 *ppvObject
= DISPATCHEX(This
);
55 }else if(IsEqualGUID(&IID_IHTMLDocument
, riid
)) {
56 TRACE("(%p)->(IID_IHTMLDocument, %p)\n", This
, ppvObject
);
57 *ppvObject
= HTMLDOC(This
);
58 }else if(IsEqualGUID(&IID_IHTMLDocument2
, riid
)) {
59 TRACE("(%p)->(IID_IHTMLDocument2, %p)\n", This
, ppvObject
);
60 *ppvObject
= HTMLDOC(This
);
61 }else if(IsEqualGUID(&IID_IHTMLDocument3
, riid
)) {
62 TRACE("(%p)->(IID_IHTMLDocument3, %p)\n", This
, ppvObject
);
63 *ppvObject
= HTMLDOC3(This
);
64 }else if(IsEqualGUID(&IID_IHTMLDocument4
, riid
)) {
65 TRACE("(%p)->(IID_IHTMLDocument4, %p)\n", This
, ppvObject
);
66 *ppvObject
= HTMLDOC4(This
);
67 }else if(IsEqualGUID(&IID_IHTMLDocument5
, riid
)) {
68 TRACE("(%p)->(IID_IHTMLDocument5, %p)\n", This
, ppvObject
);
69 *ppvObject
= HTMLDOC5(This
);
70 }else if(IsEqualGUID(&IID_IPersist
, riid
)) {
71 TRACE("(%p)->(IID_IPersist, %p)\n", This
, ppvObject
);
72 *ppvObject
= PERSIST(This
);
73 }else if(IsEqualGUID(&IID_IPersistMoniker
, riid
)) {
74 TRACE("(%p)->(IID_IPersistMoniker, %p)\n", This
, ppvObject
);
75 *ppvObject
= PERSISTMON(This
);
76 }else if(IsEqualGUID(&IID_IPersistFile
, riid
)) {
77 TRACE("(%p)->(IID_IPersistFile, %p)\n", This
, ppvObject
);
78 *ppvObject
= PERSISTFILE(This
);
79 }else if(IsEqualGUID(&IID_IMonikerProp
, riid
)) {
80 TRACE("(%p)->(IID_IMonikerProp, %p)\n", This
, ppvObject
);
81 *ppvObject
= MONPROP(This
);
82 }else if(IsEqualGUID(&IID_IOleObject
, riid
)) {
83 TRACE("(%p)->(IID_IOleObject, %p)\n", This
, ppvObject
);
84 *ppvObject
= OLEOBJ(This
);
85 }else if(IsEqualGUID(&IID_IOleDocument
, riid
)) {
86 TRACE("(%p)->(IID_IOleDocument, %p)\n", This
, ppvObject
);
87 *ppvObject
= OLEDOC(This
);
88 }else if(IsEqualGUID(&IID_IOleDocumentView
, riid
)) {
89 TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This
, ppvObject
);
90 *ppvObject
= DOCVIEW(This
);
91 }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject
, riid
)) {
92 TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This
, ppvObject
);
93 *ppvObject
= ACTOBJ(This
);
94 }else if(IsEqualGUID(&IID_IViewObject
, riid
)) {
95 TRACE("(%p)->(IID_IViewObject, %p)\n", This
, ppvObject
);
96 *ppvObject
= VIEWOBJ(This
);
97 }else if(IsEqualGUID(&IID_IViewObject2
, riid
)) {
98 TRACE("(%p)->(IID_IViewObject2, %p)\n", This
, ppvObject
);
99 *ppvObject
= VIEWOBJ2(This
);
100 }else if(IsEqualGUID(&IID_IOleWindow
, riid
)) {
101 TRACE("(%p)->(IID_IOleWindow, %p)\n", This
, ppvObject
);
102 *ppvObject
= OLEWIN(This
);
103 }else if(IsEqualGUID(&IID_IOleInPlaceObject
, riid
)) {
104 TRACE("(%p)->(IID_IOleInPlaceObject, %p)\n", This
, ppvObject
);
105 *ppvObject
= INPLACEOBJ(This
);
106 }else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless
, riid
)) {
107 TRACE("(%p)->(IID_IOleInPlaceObjectWindowless, %p)\n", This
, ppvObject
);
108 *ppvObject
= INPLACEWIN(This
);
109 }else if(IsEqualGUID(&IID_IServiceProvider
, riid
)) {
110 TRACE("(%p)->(IID_IServiceProvider, %p)\n", This
, ppvObject
);
111 *ppvObject
= SERVPROV(This
);
112 }else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
)) {
113 TRACE("(%p)->(IID_IOleCommandTarget, %p)\n", This
, ppvObject
);
114 *ppvObject
= CMDTARGET(This
);
115 }else if(IsEqualGUID(&IID_IOleControl
, riid
)) {
116 TRACE("(%p)->(IID_IOleControl, %p)\n", This
, ppvObject
);
117 *ppvObject
= CONTROL(This
);
118 }else if(IsEqualGUID(&IID_IHlinkTarget
, riid
)) {
119 TRACE("(%p)->(IID_IHlinkTarget, %p)\n", This
, ppvObject
);
120 *ppvObject
= HLNKTARGET(This
);
121 }else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
)) {
122 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This
, ppvObject
);
123 *ppvObject
= CONPTCONT(&This
->cp_container
);
124 }else if(IsEqualGUID(&IID_IPersistStreamInit
, riid
)) {
125 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This
, ppvObject
);
126 *ppvObject
= PERSTRINIT(This
);
127 }else if(IsEqualGUID(&IID_ICustomDoc
, riid
)) {
128 TRACE("(%p)->(IID_ICustomDoc %p)\n", This
, ppvObject
);
129 *ppvObject
= CUSTOMDOC(This
);
130 }else if(IsEqualGUID(&DIID_DispHTMLDocument
, riid
)) {
131 TRACE("(%p)->(DIID_DispHTMLDocument %p)\n", This
, ppvObject
);
132 *ppvObject
= HTMLDOC(This
);
133 }else if(IsEqualGUID(&IID_ISupportErrorInfo
, riid
)) {
134 TRACE("(%p)->(IID_ISupportErrorInfo %p)\n", This
, ppvObject
);
135 *ppvObject
= SUPPERRINFO(This
);
136 }else if(IsEqualGUID(&IID_IPersistHistory
, riid
)) {
137 TRACE("(%p)->(IID_IPersistHistory %p)\n", This
, ppvObject
);
138 *ppvObject
= PERSISTHIST(This
);
139 }else if(IsEqualGUID(&CLSID_CMarkup
, riid
)) {
140 FIXME("(%p)->(CLSID_CMarkup %p)\n", This
, ppvObject
);
141 return E_NOINTERFACE
;
142 }else if(IsEqualGUID(&IID_IRunnableObject
, riid
)) {
143 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This
, ppvObject
);
144 return E_NOINTERFACE
;
145 }else if(IsEqualGUID(&IID_IPersistPropertyBag
, riid
)) {
146 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This
, ppvObject
);
147 return E_NOINTERFACE
;
148 }else if(IsEqualGUID(&IID_IMarshal
, riid
)) {
149 TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This
, ppvObject
);
150 return E_NOINTERFACE
;
151 }else if(dispex_query_interface(&This
->dispex
, riid
, ppvObject
)) {
152 return *ppvObject
? S_OK
: E_NOINTERFACE
;
156 IHTMLDocument2_AddRef(iface
);
160 FIXME("(%p)->(%s %p) interface not supported\n", This
, debugstr_guid(riid
), ppvObject
);
161 return E_NOINTERFACE
;
164 static ULONG WINAPI
HTMLDocument_AddRef(IHTMLDocument2
*iface
)
166 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
167 ULONG ref
= InterlockedIncrement(&This
->ref
);
168 TRACE("(%p) ref = %u\n", This
, ref
);
172 static ULONG WINAPI
HTMLDocument_Release(IHTMLDocument2
*iface
)
174 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
175 ULONG ref
= InterlockedDecrement(&This
->ref
);
177 TRACE("(%p) ref = %u\n", This
, ref
);
180 remove_doc_tasks(This
);
181 release_script_hosts(This
);
184 IOleObject_SetClientSite(OLEOBJ(This
), NULL
);
185 if(This
->in_place_active
)
186 IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(This
));
188 IOleDocumentView_SetInPlaceSite(DOCVIEW(This
), NULL
);
190 IOleUndoManager_Release(This
->undomgr
);
192 set_document_bscallback(This
, NULL
);
193 set_current_mon(This
, NULL
);
195 if(This
->tooltips_hwnd
)
196 DestroyWindow(This
->tooltips_hwnd
);
198 DestroyWindow(This
->hwnd
);
200 if(This
->option_factory
) {
201 This
->option_factory
->doc
= NULL
;
202 IHTMLOptionElementFactory_Release(HTMLOPTFACTORY(This
->option_factory
));
206 This
->location
->doc
= NULL
;
209 IHTMLWindow2_Release(HTMLWINDOW2(This
->window
));
211 if(This
->event_target
)
212 release_event_target(This
->event_target
);
214 heap_free(This
->mime
);
215 detach_selection(This
);
219 ConnectionPointContainer_Destroy(&This
->cp_container
);
222 remove_mutation_observer(This
->nscontainer
, This
->nsdoc
);
223 nsIDOMHTMLDocument_Release(This
->nsdoc
);
225 if(This
->nscontainer
)
226 NSContainer_Release(This
->nscontainer
);
234 static HRESULT WINAPI
HTMLDocument_GetTypeInfoCount(IHTMLDocument2
*iface
, UINT
*pctinfo
)
236 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
238 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This
), pctinfo
);
241 static HRESULT WINAPI
HTMLDocument_GetTypeInfo(IHTMLDocument2
*iface
, UINT iTInfo
,
242 LCID lcid
, ITypeInfo
**ppTInfo
)
244 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
246 return IDispatchEx_GetTypeInfo(DISPATCHEX(This
), iTInfo
, lcid
, ppTInfo
);
249 static HRESULT WINAPI
HTMLDocument_GetIDsOfNames(IHTMLDocument2
*iface
, REFIID riid
,
250 LPOLESTR
*rgszNames
, UINT cNames
,
251 LCID lcid
, DISPID
*rgDispId
)
253 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
255 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
258 static HRESULT WINAPI
HTMLDocument_Invoke(IHTMLDocument2
*iface
, DISPID dispIdMember
,
259 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
260 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
262 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
264 return IDispatchEx_Invoke(DISPATCHEX(This
), dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
265 pVarResult
, pExcepInfo
, puArgErr
);
268 static HRESULT WINAPI
HTMLDocument_get_Script(IHTMLDocument2
*iface
, IDispatch
**p
)
270 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
272 TRACE("(%p)->(%p)\n", This
, p
);
274 *p
= (IDispatch
*)HTMLWINDOW2(This
->window
);
275 IDispatch_AddRef(*p
);
279 static HRESULT WINAPI
HTMLDocument_get_all(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
281 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
282 nsIDOMElement
*nselem
= NULL
;
285 TRACE("(%p)->(%p)\n", This
, p
);
288 WARN("NULL nsdoc\n");
292 nsres
= nsIDOMHTMLDocument_GetDocumentElement(This
->nsdoc
, &nselem
);
293 if(NS_FAILED(nsres
)) {
294 ERR("GetDocumentElement failed: %08x\n", nsres
);
299 *p
= create_all_collection(get_node(This
, (nsIDOMNode
*)nselem
, TRUE
), TRUE
);
300 nsIDOMElement_Release(nselem
);
308 static HRESULT WINAPI
HTMLDocument_get_body(IHTMLDocument2
*iface
, IHTMLElement
**p
)
310 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
311 nsIDOMHTMLElement
*nsbody
= NULL
;
315 TRACE("(%p)->(%p)\n", This
, p
);
318 WARN("NULL nsdoc\n");
322 nsres
= nsIDOMHTMLDocument_GetBody(This
->nsdoc
, &nsbody
);
323 if(NS_FAILED(nsres
)) {
324 TRACE("Could not get body: %08x\n", nsres
);
329 node
= get_node(This
, (nsIDOMNode
*)nsbody
, TRUE
);
330 nsIDOMHTMLElement_Release(nsbody
);
332 IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node
), &IID_IHTMLElement
, (void**)p
);
337 TRACE("*p = %p\n", *p
);
341 static HRESULT WINAPI
HTMLDocument_get_activeElement(IHTMLDocument2
*iface
, IHTMLElement
**p
)
343 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
344 FIXME("(%p)->(%p)\n", This
, p
);
348 static HRESULT WINAPI
HTMLDocument_get_images(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
350 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
351 nsIDOMHTMLCollection
*nscoll
= NULL
;
354 TRACE("(%p)->(%p)\n", This
, p
);
362 WARN("NULL nsdoc\n");
366 nsres
= nsIDOMHTMLDocument_GetImages(This
->nsdoc
, &nscoll
);
367 if(NS_FAILED(nsres
)) {
368 ERR("GetImages failed: %08x\n", nsres
);
373 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
374 nsIDOMElement_Release(nscoll
);
380 static HRESULT WINAPI
HTMLDocument_get_applets(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
382 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
383 nsIDOMHTMLCollection
*nscoll
= NULL
;
386 TRACE("(%p)->(%p)\n", This
, p
);
394 WARN("NULL nsdoc\n");
398 nsres
= nsIDOMHTMLDocument_GetApplets(This
->nsdoc
, &nscoll
);
399 if(NS_FAILED(nsres
)) {
400 ERR("GetApplets failed: %08x\n", nsres
);
405 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
406 nsIDOMElement_Release(nscoll
);
412 static HRESULT WINAPI
HTMLDocument_get_links(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
414 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
415 nsIDOMHTMLCollection
*nscoll
= NULL
;
418 TRACE("(%p)->(%p)\n", This
, p
);
426 WARN("NULL nsdoc\n");
430 nsres
= nsIDOMHTMLDocument_GetLinks(This
->nsdoc
, &nscoll
);
431 if(NS_FAILED(nsres
)) {
432 ERR("GetLinks failed: %08x\n", nsres
);
437 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
438 nsIDOMElement_Release(nscoll
);
444 static HRESULT WINAPI
HTMLDocument_get_forms(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
446 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
447 nsIDOMHTMLCollection
*nscoll
= NULL
;
450 TRACE("(%p)->(%p)\n", This
, p
);
458 WARN("NULL nsdoc\n");
462 nsres
= nsIDOMHTMLDocument_GetForms(This
->nsdoc
, &nscoll
);
463 if(NS_FAILED(nsres
)) {
464 ERR("GetForms failed: %08x\n", nsres
);
469 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
470 nsIDOMElement_Release(nscoll
);
476 static HRESULT WINAPI
HTMLDocument_get_anchors(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
478 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
479 nsIDOMHTMLCollection
*nscoll
= NULL
;
482 TRACE("(%p)->(%p)\n", This
, p
);
490 WARN("NULL nsdoc\n");
494 nsres
= nsIDOMHTMLDocument_GetAnchors(This
->nsdoc
, &nscoll
);
495 if(NS_FAILED(nsres
)) {
496 ERR("GetAnchors failed: %08x\n", nsres
);
501 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
502 nsIDOMElement_Release(nscoll
);
508 static HRESULT WINAPI
HTMLDocument_put_title(IHTMLDocument2
*iface
, BSTR v
)
510 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
514 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
517 WARN("NULL nsdoc\n");
521 nsAString_Init(&nsstr
, v
);
522 nsres
= nsIDOMHTMLDocument_SetTitle(This
->nsdoc
, &nsstr
);
523 nsAString_Finish(&nsstr
);
525 ERR("SetTitle failed: %08x\n", nsres
);
530 static HRESULT WINAPI
HTMLDocument_get_title(IHTMLDocument2
*iface
, BSTR
*p
)
532 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
533 const PRUnichar
*ret
;
537 TRACE("(%p)->(%p)\n", This
, p
);
540 WARN("NULL nsdoc\n");
545 nsAString_Init(&nsstr
, NULL
);
546 nsres
= nsIDOMHTMLDocument_GetTitle(This
->nsdoc
, &nsstr
);
547 if (NS_SUCCEEDED(nsres
)) {
548 nsAString_GetData(&nsstr
, &ret
);
549 *p
= SysAllocString(ret
);
551 nsAString_Finish(&nsstr
);
553 if(NS_FAILED(nsres
)) {
554 ERR("GetTitle failed: %08x\n", nsres
);
561 static HRESULT WINAPI
HTMLDocument_get_scripts(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
563 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
564 FIXME("(%p)->(%p)\n", This
, p
);
568 static HRESULT WINAPI
HTMLDocument_put_designMode(IHTMLDocument2
*iface
, BSTR v
)
570 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
571 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
575 static HRESULT WINAPI
HTMLDocument_get_designMode(IHTMLDocument2
*iface
, BSTR
*p
)
577 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
578 static WCHAR szOff
[] = {'O','f','f',0};
579 FIXME("(%p)->(%p) always returning Off\n", This
, p
);
584 *p
= SysAllocString(szOff
);
589 static HRESULT WINAPI
HTMLDocument_get_selection(IHTMLDocument2
*iface
, IHTMLSelectionObject
**p
)
591 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
592 nsISelection
*nsselection
= NULL
;
594 TRACE("(%p)->(%p)\n", This
, p
);
596 if(This
->nscontainer
) {
597 nsIDOMWindow
*dom_window
= NULL
;
599 nsIWebBrowser_GetContentDOMWindow(This
->nscontainer
->webbrowser
, &dom_window
);
601 nsIDOMWindow_GetSelection(dom_window
, &nsselection
);
602 nsIDOMWindow_Release(dom_window
);
606 *p
= HTMLSelectionObject_Create(This
, nsselection
);
610 static HRESULT WINAPI
HTMLDocument_get_readyState(IHTMLDocument2
*iface
, BSTR
*p
)
612 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
614 static const WCHAR wszUninitialized
[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
615 static const WCHAR wszLoading
[] = {'l','o','a','d','i','n','g',0};
616 static const WCHAR wszLoaded
[] = {'l','o','a','d','e','d',0};
617 static const WCHAR wszInteractive
[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
618 static const WCHAR wszComplete
[] = {'c','o','m','p','l','e','t','e',0};
620 static const LPCWSTR readystate_str
[] = {
628 TRACE("(%p)->(%p)\n", iface
, p
);
633 *p
= SysAllocString(readystate_str
[This
->readystate
]);
637 static HRESULT WINAPI
HTMLDocument_get_frames(IHTMLDocument2
*iface
, IHTMLFramesCollection2
**p
)
639 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
640 FIXME("(%p)->(%p)\n", This
, p
);
644 static HRESULT WINAPI
HTMLDocument_get_embeds(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
646 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
647 FIXME("(%p)->(%p)\n", This
, p
);
651 static HRESULT WINAPI
HTMLDocument_get_plugins(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
653 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
654 FIXME("(%p)->(%p)\n", This
, p
);
658 static HRESULT WINAPI
HTMLDocument_put_alinkColor(IHTMLDocument2
*iface
, VARIANT v
)
660 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
661 FIXME("(%p)\n", This
);
665 static HRESULT WINAPI
HTMLDocument_get_alinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
667 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
668 FIXME("(%p)->(%p)\n", This
, p
);
672 static HRESULT WINAPI
HTMLDocument_put_bgColor(IHTMLDocument2
*iface
, VARIANT v
)
674 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
675 FIXME("(%p)\n", This
);
679 static HRESULT WINAPI
HTMLDocument_get_bgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
681 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
682 FIXME("(%p)->(%p)\n", This
, p
);
686 static HRESULT WINAPI
HTMLDocument_put_fgColor(IHTMLDocument2
*iface
, VARIANT v
)
688 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
689 FIXME("(%p)\n", This
);
693 static HRESULT WINAPI
HTMLDocument_get_fgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
695 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
696 FIXME("(%p)->(%p)\n", This
, p
);
700 static HRESULT WINAPI
HTMLDocument_put_linkColor(IHTMLDocument2
*iface
, VARIANT v
)
702 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
703 FIXME("(%p)->()\n", This
);
707 static HRESULT WINAPI
HTMLDocument_get_linkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
709 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
710 FIXME("(%p)->(%p)\n", This
, p
);
714 static HRESULT WINAPI
HTMLDocument_put_vlinkColor(IHTMLDocument2
*iface
, VARIANT v
)
716 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
717 FIXME("(%p)\n", This
);
721 static HRESULT WINAPI
HTMLDocument_get_vlinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
723 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
724 FIXME("(%p)->(%p)\n", This
, p
);
728 static HRESULT WINAPI
HTMLDocument_get_referrer(IHTMLDocument2
*iface
, BSTR
*p
)
730 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
731 FIXME("(%p)->(%p)\n", This
, p
);
735 static HRESULT WINAPI
HTMLDocument_get_location(IHTMLDocument2
*iface
, IHTMLLocation
**p
)
737 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
739 TRACE("(%p)->(%p)\n", This
, p
);
742 IHTMLLocation_AddRef(HTMLLOCATION(This
->location
));
744 This
->location
= HTMLLocation_Create(This
);
746 *p
= HTMLLOCATION(This
->location
);
750 static HRESULT WINAPI
HTMLDocument_get_lastModified(IHTMLDocument2
*iface
, BSTR
*p
)
752 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
753 FIXME("(%p)->(%p)\n", This
, p
);
757 static HRESULT WINAPI
HTMLDocument_put_URL(IHTMLDocument2
*iface
, BSTR v
)
759 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
760 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
764 static HRESULT WINAPI
HTMLDocument_get_URL(IHTMLDocument2
*iface
, BSTR
*p
)
766 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
768 static const WCHAR about_blank_url
[] =
769 {'a','b','o','u','t',':','b','l','a','n','k',0};
771 TRACE("(%p)->(%p)\n", iface
, p
);
773 *p
= SysAllocString(This
->url
? This
->url
: about_blank_url
);
777 static HRESULT WINAPI
HTMLDocument_put_domain(IHTMLDocument2
*iface
, BSTR v
)
779 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
780 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
784 static HRESULT WINAPI
HTMLDocument_get_domain(IHTMLDocument2
*iface
, BSTR
*p
)
786 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
787 FIXME("(%p)->(%p)\n", This
, p
);
791 static HRESULT WINAPI
HTMLDocument_put_cookie(IHTMLDocument2
*iface
, BSTR v
)
793 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
794 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
798 static HRESULT WINAPI
HTMLDocument_get_cookie(IHTMLDocument2
*iface
, BSTR
*p
)
800 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
801 FIXME("(%p)->(%p)\n", This
, p
);
805 static HRESULT WINAPI
HTMLDocument_put_expando(IHTMLDocument2
*iface
, VARIANT_BOOL v
)
807 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
808 FIXME("(%p)->(%x)\n", This
, v
);
812 static HRESULT WINAPI
HTMLDocument_get_expando(IHTMLDocument2
*iface
, VARIANT_BOOL
*p
)
814 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
815 FIXME("(%p)->(%p)\n", This
, p
);
819 static HRESULT WINAPI
HTMLDocument_put_charset(IHTMLDocument2
*iface
, BSTR v
)
821 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
822 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
826 static HRESULT WINAPI
HTMLDocument_get_charset(IHTMLDocument2
*iface
, BSTR
*p
)
828 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
829 FIXME("(%p)->(%p)\n", This
, p
);
833 static HRESULT WINAPI
HTMLDocument_put_defaultCharset(IHTMLDocument2
*iface
, BSTR v
)
835 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
836 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
840 static HRESULT WINAPI
HTMLDocument_get_defaultCharset(IHTMLDocument2
*iface
, BSTR
*p
)
842 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
843 FIXME("(%p)->(%p)\n", This
, p
);
847 static HRESULT WINAPI
HTMLDocument_get_mimeType(IHTMLDocument2
*iface
, BSTR
*p
)
849 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
850 FIXME("(%p)->(%p)\n", This
, p
);
854 static HRESULT WINAPI
HTMLDocument_get_fileSize(IHTMLDocument2
*iface
, BSTR
*p
)
856 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
857 FIXME("(%p)->(%p)\n", This
, p
);
861 static HRESULT WINAPI
HTMLDocument_get_fileCreatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
863 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
864 FIXME("(%p)->(%p)\n", This
, p
);
868 static HRESULT WINAPI
HTMLDocument_get_fileModifiedDate(IHTMLDocument2
*iface
, BSTR
*p
)
870 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
871 FIXME("(%p)->(%p)\n", This
, p
);
875 static HRESULT WINAPI
HTMLDocument_get_fileUpdatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
877 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
878 FIXME("(%p)->(%p)\n", This
, p
);
882 static HRESULT WINAPI
HTMLDocument_get_security(IHTMLDocument2
*iface
, BSTR
*p
)
884 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
885 FIXME("(%p)->(%p)\n", This
, p
);
889 static HRESULT WINAPI
HTMLDocument_get_protocol(IHTMLDocument2
*iface
, BSTR
*p
)
891 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
892 FIXME("(%p)->(%p)\n", This
, p
);
896 static HRESULT WINAPI
HTMLDocument_get_nameProp(IHTMLDocument2
*iface
, BSTR
*p
)
898 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
899 FIXME("(%p)->(%p)\n", This
, p
);
903 static HRESULT WINAPI
HTMLDocument_write(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
905 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
912 TRACE("(%p)->(%p)\n", iface
, psarray
);
915 WARN("NULL nsdoc\n");
919 if(psarray
->cDims
!= 1) {
920 FIXME("cDims=%d\n", psarray
->cDims
);
924 hres
= SafeArrayAccessData(psarray
, (void**)&var
);
926 WARN("SafeArrayAccessData failed: %08x\n", hres
);
930 nsAString_Init(&nsstr
, NULL
);
932 for(i
=0; i
< psarray
->rgsabound
[0].cElements
; i
++) {
933 if(V_VT(var
+i
) == VT_BSTR
) {
934 nsAString_SetData(&nsstr
, V_BSTR(var
+i
));
935 nsres
= nsIDOMHTMLDocument_Write(This
->nsdoc
, &nsstr
);
937 ERR("Write failed: %08x\n", nsres
);
939 FIXME("vt=%d\n", V_VT(var
+i
));
943 nsAString_Finish(&nsstr
);
944 SafeArrayUnaccessData(psarray
);
949 static HRESULT WINAPI
HTMLDocument_writeln(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
951 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
952 FIXME("(%p)->(%p)\n", This
, psarray
);
956 static HRESULT WINAPI
HTMLDocument_open(IHTMLDocument2
*iface
, BSTR url
, VARIANT name
,
957 VARIANT features
, VARIANT replace
, IDispatch
**pomWindowResult
)
959 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
962 static const WCHAR text_htmlW
[] = {'t','e','x','t','/','h','t','m','l',0};
964 TRACE("(%p)->(%s %s %s %s %p)\n", This
, debugstr_w(url
), debugstr_variant(&name
),
965 debugstr_variant(&features
), debugstr_variant(&replace
), pomWindowResult
);
972 if(!url
|| strcmpW(url
, text_htmlW
) || V_VT(&name
) != VT_ERROR
973 || V_VT(&features
) != VT_ERROR
|| V_VT(&replace
) != VT_ERROR
)
974 FIXME("unsupported args\n");
976 nsres
= nsIDOMHTMLDocument_Open(This
->nsdoc
);
977 if(NS_FAILED(nsres
)) {
978 ERR("Open failed: %08x\n", nsres
);
982 *pomWindowResult
= (IDispatch
*)HTMLWINDOW2(This
->window
);
983 IHTMLWindow2_AddRef(HTMLWINDOW2(This
->window
));
987 static HRESULT WINAPI
HTMLDocument_close(IHTMLDocument2
*iface
)
989 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
992 TRACE("(%p)\n", This
);
999 nsres
= nsIDOMHTMLDocument_Close(This
->nsdoc
);
1000 if(NS_FAILED(nsres
)) {
1001 ERR("Close failed: %08x\n", nsres
);
1008 static HRESULT WINAPI
HTMLDocument_clear(IHTMLDocument2
*iface
)
1010 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1011 FIXME("(%p)\n", This
);
1015 static HRESULT WINAPI
HTMLDocument_queryCommandSupported(IHTMLDocument2
*iface
, BSTR cmdID
,
1016 VARIANT_BOOL
*pfRet
)
1018 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1019 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1023 static HRESULT WINAPI
HTMLDocument_queryCommandEnabled(IHTMLDocument2
*iface
, BSTR cmdID
,
1024 VARIANT_BOOL
*pfRet
)
1026 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1027 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1031 static HRESULT WINAPI
HTMLDocument_queryCommandState(IHTMLDocument2
*iface
, BSTR cmdID
,
1032 VARIANT_BOOL
*pfRet
)
1034 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1035 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1039 static HRESULT WINAPI
HTMLDocument_queryCommandIndeterm(IHTMLDocument2
*iface
, BSTR cmdID
,
1040 VARIANT_BOOL
*pfRet
)
1042 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1043 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1047 static HRESULT WINAPI
HTMLDocument_queryCommandText(IHTMLDocument2
*iface
, BSTR cmdID
,
1050 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1051 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1055 static HRESULT WINAPI
HTMLDocument_queryCommandValue(IHTMLDocument2
*iface
, BSTR cmdID
,
1058 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1059 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1063 static HRESULT WINAPI
HTMLDocument_execCommand(IHTMLDocument2
*iface
, BSTR cmdID
,
1064 VARIANT_BOOL showUI
, VARIANT value
, VARIANT_BOOL
*pfRet
)
1066 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1067 FIXME("(%p)->(%s %x %p)\n", This
, debugstr_w(cmdID
), showUI
, pfRet
);
1071 static HRESULT WINAPI
HTMLDocument_execCommandShowHelp(IHTMLDocument2
*iface
, BSTR cmdID
,
1072 VARIANT_BOOL
*pfRet
)
1074 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1075 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1079 static HRESULT WINAPI
HTMLDocument_createElement(IHTMLDocument2
*iface
, BSTR eTag
,
1080 IHTMLElement
**newElem
)
1082 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1083 nsIDOMElement
*nselem
;
1088 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eTag
), newElem
);
1091 WARN("NULL nsdoc\n");
1092 return E_UNEXPECTED
;
1095 nsAString_Init(&tag_str
, eTag
);
1096 nsres
= nsIDOMDocument_CreateElement(This
->nsdoc
, &tag_str
, &nselem
);
1097 nsAString_Finish(&tag_str
);
1098 if(NS_FAILED(nsres
)) {
1099 ERR("CreateElement failed: %08x\n", nsres
);
1103 elem
= HTMLElement_Create(This
, (nsIDOMNode
*)nselem
, TRUE
);
1104 nsIDOMElement_Release(nselem
);
1106 *newElem
= HTMLELEM(elem
);
1107 IHTMLElement_AddRef(HTMLELEM(elem
));
1111 static HRESULT WINAPI
HTMLDocument_put_onhelp(IHTMLDocument2
*iface
, VARIANT v
)
1113 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1114 FIXME("(%p)\n", This
);
1118 static HRESULT WINAPI
HTMLDocument_get_onhelp(IHTMLDocument2
*iface
, VARIANT
*p
)
1120 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1121 FIXME("(%p)->(%p)\n", This
, p
);
1125 static HRESULT WINAPI
HTMLDocument_put_onclick(IHTMLDocument2
*iface
, VARIANT v
)
1127 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1128 FIXME("(%p)\n", This
);
1132 static HRESULT WINAPI
HTMLDocument_get_onclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1134 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1135 FIXME("(%p)->(%p)\n", This
, p
);
1139 static HRESULT WINAPI
HTMLDocument_put_ondblclick(IHTMLDocument2
*iface
, VARIANT v
)
1141 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1142 FIXME("(%p)\n", This
);
1146 static HRESULT WINAPI
HTMLDocument_get_ondblclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1148 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1149 FIXME("(%p)->(%p)\n", This
, p
);
1153 static HRESULT WINAPI
HTMLDocument_put_onkeyup(IHTMLDocument2
*iface
, VARIANT v
)
1155 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1157 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1159 return set_doc_event(This
, EVENTID_KEYUP
, &v
);
1162 static HRESULT WINAPI
HTMLDocument_get_onkeyup(IHTMLDocument2
*iface
, VARIANT
*p
)
1164 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1166 TRACE("(%p)->(%p)\n", This
, p
);
1168 return get_doc_event(This
, EVENTID_KEYUP
, p
);
1171 static HRESULT WINAPI
HTMLDocument_put_onkeydown(IHTMLDocument2
*iface
, VARIANT v
)
1173 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1175 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1177 return set_doc_event(This
, EVENTID_KEYDOWN
, &v
);
1180 static HRESULT WINAPI
HTMLDocument_get_onkeydown(IHTMLDocument2
*iface
, VARIANT
*p
)
1182 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1184 TRACE("(%p)->(%p)\n", This
, p
);
1186 return get_doc_event(This
, EVENTID_KEYDOWN
, p
);
1189 static HRESULT WINAPI
HTMLDocument_put_onkeypress(IHTMLDocument2
*iface
, VARIANT v
)
1191 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1192 FIXME("(%p)\n", This
);
1196 static HRESULT WINAPI
HTMLDocument_get_onkeypress(IHTMLDocument2
*iface
, VARIANT
*p
)
1198 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1199 FIXME("(%p)->(%p)\n", This
, p
);
1203 static HRESULT WINAPI
HTMLDocument_put_onmouseup(IHTMLDocument2
*iface
, VARIANT v
)
1205 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1206 FIXME("(%p)\n", This
);
1210 static HRESULT WINAPI
HTMLDocument_get_onmouseup(IHTMLDocument2
*iface
, VARIANT
*p
)
1212 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1213 FIXME("(%p)->(%p)\n", This
, p
);
1217 static HRESULT WINAPI
HTMLDocument_put_onmousedown(IHTMLDocument2
*iface
, VARIANT v
)
1219 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1220 FIXME("(%p)\n", This
);
1224 static HRESULT WINAPI
HTMLDocument_get_onmousedown(IHTMLDocument2
*iface
, VARIANT
*p
)
1226 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1227 FIXME("(%p)->(%p)\n", This
, p
);
1231 static HRESULT WINAPI
HTMLDocument_put_onmousemove(IHTMLDocument2
*iface
, VARIANT v
)
1233 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1234 FIXME("(%p)\n", This
);
1238 static HRESULT WINAPI
HTMLDocument_get_onmousemove(IHTMLDocument2
*iface
, VARIANT
*p
)
1240 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1241 FIXME("(%p)->(%p)\n", This
, p
);
1245 static HRESULT WINAPI
HTMLDocument_put_onmouseout(IHTMLDocument2
*iface
, VARIANT v
)
1247 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1248 FIXME("(%p)\n", This
);
1252 static HRESULT WINAPI
HTMLDocument_get_onmouseout(IHTMLDocument2
*iface
, VARIANT
*p
)
1254 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1255 FIXME("(%p)->(%p)\n", This
, p
);
1259 static HRESULT WINAPI
HTMLDocument_put_onmouseover(IHTMLDocument2
*iface
, VARIANT v
)
1261 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1263 TRACE("(%p)\n", This
);
1265 return set_doc_event(This
, EVENTID_MOUSEOVER
, &v
);
1268 static HRESULT WINAPI
HTMLDocument_get_onmouseover(IHTMLDocument2
*iface
, VARIANT
*p
)
1270 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1272 TRACE("(%p)->(%p)\n", This
, p
);
1274 return get_doc_event(This
, EVENTID_MOUSEOVER
, p
);
1277 static HRESULT WINAPI
HTMLDocument_put_onreadystatechange(IHTMLDocument2
*iface
, VARIANT v
)
1279 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1280 FIXME("(%p)\n", This
);
1284 static HRESULT WINAPI
HTMLDocument_get_onreadystatechange(IHTMLDocument2
*iface
, VARIANT
*p
)
1286 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1287 FIXME("(%p)->(%p)\n", This
, p
);
1291 static HRESULT WINAPI
HTMLDocument_put_onafterupdate(IHTMLDocument2
*iface
, VARIANT v
)
1293 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1294 FIXME("(%p)\n", This
);
1298 static HRESULT WINAPI
HTMLDocument_get_onafterupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1300 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1301 FIXME("(%p)->(%p)\n", This
, p
);
1305 static HRESULT WINAPI
HTMLDocument_put_onrowexit(IHTMLDocument2
*iface
, VARIANT v
)
1307 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1308 FIXME("(%p)\n", This
);
1312 static HRESULT WINAPI
HTMLDocument_get_onrowexit(IHTMLDocument2
*iface
, VARIANT
*p
)
1314 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1315 FIXME("(%p)->(%p)\n", This
, p
);
1319 static HRESULT WINAPI
HTMLDocument_put_onrowenter(IHTMLDocument2
*iface
, VARIANT v
)
1321 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1322 FIXME("(%p)\n", This
);
1326 static HRESULT WINAPI
HTMLDocument_get_onrowenter(IHTMLDocument2
*iface
, VARIANT
*p
)
1328 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1329 FIXME("(%p)->(%p)\n", This
, p
);
1333 static HRESULT WINAPI
HTMLDocument_put_ondragstart(IHTMLDocument2
*iface
, VARIANT v
)
1335 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1337 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1339 return set_doc_event(This
, EVENTID_DRAGSTART
, &v
);
1342 static HRESULT WINAPI
HTMLDocument_get_ondragstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1344 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1346 TRACE("(%p)->(%p)\n", This
, p
);
1348 return get_doc_event(This
, EVENTID_DRAGSTART
, p
);
1351 static HRESULT WINAPI
HTMLDocument_put_onselectstart(IHTMLDocument2
*iface
, VARIANT v
)
1353 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1355 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1357 return set_doc_event(This
, EVENTID_SELECTSTART
, &v
);
1360 static HRESULT WINAPI
HTMLDocument_get_onselectstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1362 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1364 TRACE("(%p)->(%p)\n", This
, p
);
1366 return get_doc_event(This
, EVENTID_SELECTSTART
, p
);
1369 static HRESULT WINAPI
HTMLDocument_elementFromPoint(IHTMLDocument2
*iface
, LONG x
, LONG y
,
1370 IHTMLElement
**elementHit
)
1372 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1373 FIXME("(%p)->(%d %d %p)\n", This
, x
, y
, elementHit
);
1377 static HRESULT WINAPI
HTMLDocument_get_parentWindow(IHTMLDocument2
*iface
, IHTMLWindow2
**p
)
1379 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1381 TRACE("(%p)->(%p)\n", This
, p
);
1383 *p
= HTMLWINDOW2(This
->window
);
1384 IHTMLWindow2_AddRef(*p
);
1388 static HRESULT WINAPI
HTMLDocument_get_styleSheets(IHTMLDocument2
*iface
,
1389 IHTMLStyleSheetsCollection
**p
)
1391 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1392 nsIDOMStyleSheetList
*nsstylelist
;
1393 nsIDOMDocumentStyle
*nsdocstyle
;
1396 TRACE("(%p)->(%p)\n", This
, p
);
1401 WARN("NULL nsdoc\n");
1402 return E_UNEXPECTED
;
1405 nsIDOMHTMLDocument_QueryInterface(This
->nsdoc
, &IID_nsIDOMDocumentStyle
, (void**)&nsdocstyle
);
1406 nsres
= nsIDOMDocumentStyle_GetStyleSheets(nsdocstyle
, &nsstylelist
);
1407 nsIDOMDocumentStyle_Release(nsdocstyle
);
1408 if(NS_FAILED(nsres
)) {
1409 ERR("GetStyleSheets failed: %08x\n", nsres
);
1413 *p
= HTMLStyleSheetsCollection_Create(nsstylelist
);
1414 nsIDOMDocumentStyle_Release(nsstylelist
);
1419 static HRESULT WINAPI
HTMLDocument_put_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT v
)
1421 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1422 FIXME("(%p)\n", This
);
1426 static HRESULT WINAPI
HTMLDocument_get_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1428 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1429 FIXME("(%p)->(%p)\n", This
, p
);
1433 static HRESULT WINAPI
HTMLDocument_put_onerrorupdate(IHTMLDocument2
*iface
, VARIANT v
)
1435 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1436 FIXME("(%p)\n", This
);
1440 static HRESULT WINAPI
HTMLDocument_get_onerrorupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1442 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1443 FIXME("(%p)->(%p)\n", This
, p
);
1447 static HRESULT WINAPI
HTMLDocument_toString(IHTMLDocument2
*iface
, BSTR
*String
)
1449 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1450 FIXME("(%p)->(%p)\n", This
, String
);
1454 static HRESULT WINAPI
HTMLDocument_createStyleSheet(IHTMLDocument2
*iface
, BSTR bstrHref
,
1455 LONG lIndex
, IHTMLStyleSheet
**ppnewStyleSheet
)
1457 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1459 FIXME("(%p)->(%s %d %p) semi-stub\n", This
, debugstr_w(bstrHref
), lIndex
, ppnewStyleSheet
);
1461 *ppnewStyleSheet
= HTMLStyleSheet_Create(NULL
);
1465 static const IHTMLDocument2Vtbl HTMLDocumentVtbl
= {
1466 HTMLDocument_QueryInterface
,
1467 HTMLDocument_AddRef
,
1468 HTMLDocument_Release
,
1469 HTMLDocument_GetTypeInfoCount
,
1470 HTMLDocument_GetTypeInfo
,
1471 HTMLDocument_GetIDsOfNames
,
1472 HTMLDocument_Invoke
,
1473 HTMLDocument_get_Script
,
1474 HTMLDocument_get_all
,
1475 HTMLDocument_get_body
,
1476 HTMLDocument_get_activeElement
,
1477 HTMLDocument_get_images
,
1478 HTMLDocument_get_applets
,
1479 HTMLDocument_get_links
,
1480 HTMLDocument_get_forms
,
1481 HTMLDocument_get_anchors
,
1482 HTMLDocument_put_title
,
1483 HTMLDocument_get_title
,
1484 HTMLDocument_get_scripts
,
1485 HTMLDocument_put_designMode
,
1486 HTMLDocument_get_designMode
,
1487 HTMLDocument_get_selection
,
1488 HTMLDocument_get_readyState
,
1489 HTMLDocument_get_frames
,
1490 HTMLDocument_get_embeds
,
1491 HTMLDocument_get_plugins
,
1492 HTMLDocument_put_alinkColor
,
1493 HTMLDocument_get_alinkColor
,
1494 HTMLDocument_put_bgColor
,
1495 HTMLDocument_get_bgColor
,
1496 HTMLDocument_put_fgColor
,
1497 HTMLDocument_get_fgColor
,
1498 HTMLDocument_put_linkColor
,
1499 HTMLDocument_get_linkColor
,
1500 HTMLDocument_put_vlinkColor
,
1501 HTMLDocument_get_vlinkColor
,
1502 HTMLDocument_get_referrer
,
1503 HTMLDocument_get_location
,
1504 HTMLDocument_get_lastModified
,
1505 HTMLDocument_put_URL
,
1506 HTMLDocument_get_URL
,
1507 HTMLDocument_put_domain
,
1508 HTMLDocument_get_domain
,
1509 HTMLDocument_put_cookie
,
1510 HTMLDocument_get_cookie
,
1511 HTMLDocument_put_expando
,
1512 HTMLDocument_get_expando
,
1513 HTMLDocument_put_charset
,
1514 HTMLDocument_get_charset
,
1515 HTMLDocument_put_defaultCharset
,
1516 HTMLDocument_get_defaultCharset
,
1517 HTMLDocument_get_mimeType
,
1518 HTMLDocument_get_fileSize
,
1519 HTMLDocument_get_fileCreatedDate
,
1520 HTMLDocument_get_fileModifiedDate
,
1521 HTMLDocument_get_fileUpdatedDate
,
1522 HTMLDocument_get_security
,
1523 HTMLDocument_get_protocol
,
1524 HTMLDocument_get_nameProp
,
1526 HTMLDocument_writeln
,
1530 HTMLDocument_queryCommandSupported
,
1531 HTMLDocument_queryCommandEnabled
,
1532 HTMLDocument_queryCommandState
,
1533 HTMLDocument_queryCommandIndeterm
,
1534 HTMLDocument_queryCommandText
,
1535 HTMLDocument_queryCommandValue
,
1536 HTMLDocument_execCommand
,
1537 HTMLDocument_execCommandShowHelp
,
1538 HTMLDocument_createElement
,
1539 HTMLDocument_put_onhelp
,
1540 HTMLDocument_get_onhelp
,
1541 HTMLDocument_put_onclick
,
1542 HTMLDocument_get_onclick
,
1543 HTMLDocument_put_ondblclick
,
1544 HTMLDocument_get_ondblclick
,
1545 HTMLDocument_put_onkeyup
,
1546 HTMLDocument_get_onkeyup
,
1547 HTMLDocument_put_onkeydown
,
1548 HTMLDocument_get_onkeydown
,
1549 HTMLDocument_put_onkeypress
,
1550 HTMLDocument_get_onkeypress
,
1551 HTMLDocument_put_onmouseup
,
1552 HTMLDocument_get_onmouseup
,
1553 HTMLDocument_put_onmousedown
,
1554 HTMLDocument_get_onmousedown
,
1555 HTMLDocument_put_onmousemove
,
1556 HTMLDocument_get_onmousemove
,
1557 HTMLDocument_put_onmouseout
,
1558 HTMLDocument_get_onmouseout
,
1559 HTMLDocument_put_onmouseover
,
1560 HTMLDocument_get_onmouseover
,
1561 HTMLDocument_put_onreadystatechange
,
1562 HTMLDocument_get_onreadystatechange
,
1563 HTMLDocument_put_onafterupdate
,
1564 HTMLDocument_get_onafterupdate
,
1565 HTMLDocument_put_onrowexit
,
1566 HTMLDocument_get_onrowexit
,
1567 HTMLDocument_put_onrowenter
,
1568 HTMLDocument_get_onrowenter
,
1569 HTMLDocument_put_ondragstart
,
1570 HTMLDocument_get_ondragstart
,
1571 HTMLDocument_put_onselectstart
,
1572 HTMLDocument_get_onselectstart
,
1573 HTMLDocument_elementFromPoint
,
1574 HTMLDocument_get_parentWindow
,
1575 HTMLDocument_get_styleSheets
,
1576 HTMLDocument_put_onbeforeupdate
,
1577 HTMLDocument_get_onbeforeupdate
,
1578 HTMLDocument_put_onerrorupdate
,
1579 HTMLDocument_get_onerrorupdate
,
1580 HTMLDocument_toString
,
1581 HTMLDocument_createStyleSheet
1584 #define SUPPINFO_THIS(iface) DEFINE_THIS(HTMLDocument, SupportErrorInfo, iface)
1586 static HRESULT WINAPI
SupportErrorInfo_QueryInterface(ISupportErrorInfo
*iface
, REFIID riid
, void **ppv
)
1588 HTMLDocument
*This
= SUPPINFO_THIS(iface
);
1589 return IHTMLDocument_QueryInterface(HTMLDOC(This
), riid
, ppv
);
1592 static ULONG WINAPI
SupportErrorInfo_AddRef(ISupportErrorInfo
*iface
)
1594 HTMLDocument
*This
= SUPPINFO_THIS(iface
);
1595 return IHTMLDocument_AddRef(HTMLDOC(This
));
1598 static ULONG WINAPI
SupportErrorInfo_Release(ISupportErrorInfo
*iface
)
1600 HTMLDocument
*This
= SUPPINFO_THIS(iface
);
1601 return IHTMLDocument_Release(HTMLDOC(This
));
1604 static HRESULT WINAPI
SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo
*iface
, REFIID riid
)
1606 FIXME("(%p)->(%s)\n", iface
, debugstr_guid(riid
));
1610 static const ISupportErrorInfoVtbl SupportErrorInfoVtbl
= {
1611 SupportErrorInfo_QueryInterface
,
1612 SupportErrorInfo_AddRef
,
1613 SupportErrorInfo_Release
,
1614 SupportErrorInfo_InterfaceSupportsErrorInfo
1617 #define DISPEX_THIS(iface) DEFINE_THIS(HTMLDocument, IDispatchEx, iface)
1619 static HRESULT WINAPI
DocDispatchEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
1621 HTMLDocument
*This
= DISPEX_THIS(iface
);
1623 return IHTMLDocument2_QueryInterface(HTMLDOC(This
), riid
, ppv
);
1626 static ULONG WINAPI
DocDispatchEx_AddRef(IDispatchEx
*iface
)
1628 HTMLDocument
*This
= DISPEX_THIS(iface
);
1630 return IHTMLDocument2_AddRef(HTMLDOC(This
));
1633 static ULONG WINAPI
DocDispatchEx_Release(IDispatchEx
*iface
)
1635 HTMLDocument
*This
= DISPEX_THIS(iface
);
1637 return IHTMLDocument2_Release(HTMLDOC(This
));
1640 static HRESULT WINAPI
DocDispatchEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
1642 HTMLDocument
*This
= DISPEX_THIS(iface
);
1644 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This
->dispex
), pctinfo
);
1647 static HRESULT WINAPI
DocDispatchEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
1648 LCID lcid
, ITypeInfo
**ppTInfo
)
1650 HTMLDocument
*This
= DISPEX_THIS(iface
);
1652 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This
->dispex
), iTInfo
, lcid
, ppTInfo
);
1655 static HRESULT WINAPI
DocDispatchEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
1656 LPOLESTR
*rgszNames
, UINT cNames
,
1657 LCID lcid
, DISPID
*rgDispId
)
1659 HTMLDocument
*This
= DISPEX_THIS(iface
);
1661 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This
->dispex
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1664 static HRESULT WINAPI
DocDispatchEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
1665 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1666 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1668 HTMLDocument
*This
= DISPEX_THIS(iface
);
1670 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
1671 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1673 switch(dispIdMember
) {
1674 case DISPID_READYSTATE
:
1675 TRACE("DISPID_READYSTATE\n");
1677 if(!(wFlags
& DISPATCH_PROPERTYGET
))
1678 return E_INVALIDARG
;
1680 V_VT(pVarResult
) = VT_I4
;
1681 V_I4(pVarResult
) = This
->readystate
;
1685 return IDispatchEx_Invoke(DISPATCHEX(&This
->dispex
), dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
1686 pVarResult
, pExcepInfo
, puArgErr
);
1689 static HRESULT WINAPI
DocDispatchEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
1691 HTMLDocument
*This
= DISPEX_THIS(iface
);
1693 return IDispatchEx_GetDispID(DISPATCHEX(&This
->dispex
), bstrName
, grfdex
, pid
);
1696 static HRESULT WINAPI
DocDispatchEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
1697 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
1699 HTMLDocument
*This
= DISPEX_THIS(iface
);
1701 return IDispatchEx_InvokeEx(DISPATCHEX(&This
->dispex
), id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
1704 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
1706 HTMLDocument
*This
= DISPEX_THIS(iface
);
1708 return IDispatchEx_DeleteMemberByName(DISPATCHEX(&This
->dispex
), bstrName
, grfdex
);
1711 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
1713 HTMLDocument
*This
= DISPEX_THIS(iface
);
1715 return IDispatchEx_DeleteMemberByDispID(DISPATCHEX(&This
->dispex
), id
);
1718 static HRESULT WINAPI
DocDispatchEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
1720 HTMLDocument
*This
= DISPEX_THIS(iface
);
1722 return IDispatchEx_GetMemberProperties(DISPATCHEX(&This
->dispex
), id
, grfdexFetch
, pgrfdex
);
1725 static HRESULT WINAPI
DocDispatchEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
1727 HTMLDocument
*This
= DISPEX_THIS(iface
);
1729 return IDispatchEx_GetMemberName(DISPATCHEX(&This
->dispex
), id
, pbstrName
);
1732 static HRESULT WINAPI
DocDispatchEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
1734 HTMLDocument
*This
= DISPEX_THIS(iface
);
1736 return IDispatchEx_GetNextDispID(DISPATCHEX(&This
->dispex
), grfdex
, id
, pid
);
1739 static HRESULT WINAPI
DocDispatchEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
1741 HTMLDocument
*This
= DISPEX_THIS(iface
);
1743 return IDispatchEx_GetNameSpaceParent(DISPATCHEX(&This
->dispex
), ppunk
);
1748 static const IDispatchExVtbl DocDispatchExVtbl
= {
1749 DocDispatchEx_QueryInterface
,
1750 DocDispatchEx_AddRef
,
1751 DocDispatchEx_Release
,
1752 DocDispatchEx_GetTypeInfoCount
,
1753 DocDispatchEx_GetTypeInfo
,
1754 DocDispatchEx_GetIDsOfNames
,
1755 DocDispatchEx_Invoke
,
1756 DocDispatchEx_GetDispID
,
1757 DocDispatchEx_InvokeEx
,
1758 DocDispatchEx_DeleteMemberByName
,
1759 DocDispatchEx_DeleteMemberByDispID
,
1760 DocDispatchEx_GetMemberProperties
,
1761 DocDispatchEx_GetMemberName
,
1762 DocDispatchEx_GetNextDispID
,
1763 DocDispatchEx_GetNameSpaceParent
1766 static const tid_t HTMLDocument_iface_tids
[] = {
1773 static dispex_static_data_t HTMLDocument_dispex
= {
1775 DispHTMLDocument_tid
,
1777 HTMLDocument_iface_tids
1780 static HRESULT
alloc_doc(HTMLDocument
**ret
)
1784 doc
= heap_alloc_zero(sizeof(HTMLDocument
));
1785 doc
->lpHTMLDocument2Vtbl
= &HTMLDocumentVtbl
;
1786 doc
->lpIDispatchExVtbl
= &DocDispatchExVtbl
;
1787 doc
->lpSupportErrorInfoVtbl
= &SupportErrorInfoVtbl
;
1789 doc
->readystate
= READYSTATE_UNINITIALIZED
;
1790 doc
->scriptmode
= SCRIPTMODE_GECKO
;
1792 list_init(&doc
->bindings
);
1793 list_init(&doc
->script_hosts
);
1794 list_init(&doc
->selection_list
);
1795 list_init(&doc
->range_list
);
1797 HTMLDocument_HTMLDocument3_Init(doc
);
1798 HTMLDocument_HTMLDocument5_Init(doc
);
1799 HTMLDocument_Persist_Init(doc
);
1800 HTMLDocument_OleCmd_Init(doc
);
1801 HTMLDocument_OleObj_Init(doc
);
1802 HTMLDocument_View_Init(doc
);
1803 HTMLDocument_Window_Init(doc
);
1804 HTMLDocument_Service_Init(doc
);
1805 HTMLDocument_Hlink_Init(doc
);
1807 ConnectionPointContainer_Init(&doc
->cp_container
, (IUnknown
*)HTMLDOC(doc
));
1808 ConnectionPoint_Init(&doc
->cp_propnotif
, &doc
->cp_container
, &IID_IPropertyNotifySink
);
1809 ConnectionPoint_Init(&doc
->cp_htmldocevents
, &doc
->cp_container
, &DIID_HTMLDocumentEvents
);
1810 ConnectionPoint_Init(&doc
->cp_htmldocevents2
, &doc
->cp_container
, &DIID_HTMLDocumentEvents2
);
1812 init_dispex(&doc
->dispex
, (IUnknown
*)HTMLDOC(doc
), &HTMLDocument_dispex
);
1818 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*nsdoc
, HTMLDocument
**ret
)
1823 hres
= alloc_doc(&doc
);
1827 nsIDOMHTMLDocument_AddRef(nsdoc
);
1830 hres
= HTMLWindow_Create(doc
, NULL
, &doc
->window
);
1832 IHTMLDocument_Release(HTMLDOC(doc
));
1840 HRESULT
HTMLDocument_Create(IUnknown
*pUnkOuter
, REFIID riid
, void** ppvObject
)
1843 nsIDOMWindow
*nswindow
= NULL
;
1846 TRACE("(%p %s %p)\n", pUnkOuter
, debugstr_guid(riid
), ppvObject
);
1848 hres
= alloc_doc(&doc
);
1852 hres
= IHTMLDocument_QueryInterface(HTMLDOC(doc
), riid
, ppvObject
);
1853 IHTMLDocument_Release(HTMLDOC(doc
));
1857 doc
->nscontainer
= NSContainer_Create(doc
, NULL
);
1858 update_nsdocument(doc
);
1860 if(doc
->nscontainer
) {
1863 nsres
= nsIWebBrowser_GetContentDOMWindow(doc
->nscontainer
->webbrowser
, &nswindow
);
1864 if(NS_FAILED(nsres
))
1865 ERR("GetContentDOMWindow failed: %08x\n", nsres
);
1868 hres
= HTMLWindow_Create(doc
, nswindow
, &doc
->window
);
1870 nsIDOMWindow_Release(nswindow
);
1872 IHTMLDocument_Release(HTMLDOC(doc
));