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"
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
37 #define HTMLDOC_THIS(iface) DEFINE_THIS(HTMLDocument, HTMLDocument2, iface)
39 static HRESULT WINAPI
HTMLDocument_QueryInterface(IHTMLDocument2
*iface
, REFIID riid
, void **ppvObject
)
41 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
44 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
45 TRACE("(%p)->(IID_IUnknown, %p)\n", This
, ppvObject
);
46 *ppvObject
= HTMLDOC(This
);
47 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
48 TRACE("(%p)->(IID_IDispatch, %p)\n", This
, ppvObject
);
49 *ppvObject
= DISPATCHEX(This
);
50 }else if(IsEqualGUID(&IID_IDispatchEx
, riid
)) {
51 TRACE("(%p)->(IID_IDispatchEx, %p)\n", This
, ppvObject
);
52 *ppvObject
= DISPATCHEX(This
);
53 }else if(IsEqualGUID(&IID_IHTMLDocument
, riid
)) {
54 TRACE("(%p)->(IID_IHTMLDocument, %p)\n", This
, ppvObject
);
55 *ppvObject
= HTMLDOC(This
);
56 }else if(IsEqualGUID(&IID_IHTMLDocument2
, riid
)) {
57 TRACE("(%p)->(IID_IHTMLDocument2, %p)\n", This
, ppvObject
);
58 *ppvObject
= HTMLDOC(This
);
59 }else if(IsEqualGUID(&IID_IHTMLDocument3
, riid
)) {
60 TRACE("(%p)->(IID_IHTMLDocument3, %p)\n", This
, ppvObject
);
61 *ppvObject
= HTMLDOC3(This
);
62 }else if(IsEqualGUID(&IID_IHTMLDocument4
, riid
)) {
63 TRACE("(%p)->(IID_IHTMLDocument4, %p)\n", This
, ppvObject
);
64 *ppvObject
= HTMLDOC4(This
);
65 }else if(IsEqualGUID(&IID_IHTMLDocument5
, riid
)) {
66 TRACE("(%p)->(IID_IHTMLDocument5, %p)\n", This
, ppvObject
);
67 *ppvObject
= HTMLDOC5(This
);
68 }else if(IsEqualGUID(&IID_IPersist
, riid
)) {
69 TRACE("(%p)->(IID_IPersist, %p)\n", This
, ppvObject
);
70 *ppvObject
= PERSIST(This
);
71 }else if(IsEqualGUID(&IID_IPersistMoniker
, riid
)) {
72 TRACE("(%p)->(IID_IPersistMoniker, %p)\n", This
, ppvObject
);
73 *ppvObject
= PERSISTMON(This
);
74 }else if(IsEqualGUID(&IID_IPersistFile
, riid
)) {
75 TRACE("(%p)->(IID_IPersistFile, %p)\n", This
, ppvObject
);
76 *ppvObject
= PERSISTFILE(This
);
77 }else if(IsEqualGUID(&IID_IMonikerProp
, riid
)) {
78 TRACE("(%p)->(IID_IMonikerProp, %p)\n", This
, ppvObject
);
79 *ppvObject
= MONPROP(This
);
80 }else if(IsEqualGUID(&IID_IOleObject
, riid
)) {
81 TRACE("(%p)->(IID_IOleObject, %p)\n", This
, ppvObject
);
82 *ppvObject
= OLEOBJ(This
);
83 }else if(IsEqualGUID(&IID_IOleDocument
, riid
)) {
84 TRACE("(%p)->(IID_IOleDocument, %p)\n", This
, ppvObject
);
85 *ppvObject
= OLEDOC(This
);
86 }else if(IsEqualGUID(&IID_IOleDocumentView
, riid
)) {
87 TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This
, ppvObject
);
88 *ppvObject
= DOCVIEW(This
);
89 }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject
, riid
)) {
90 TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This
, ppvObject
);
91 *ppvObject
= ACTOBJ(This
);
92 }else if(IsEqualGUID(&IID_IViewObject
, riid
)) {
93 TRACE("(%p)->(IID_IViewObject, %p)\n", This
, ppvObject
);
94 *ppvObject
= VIEWOBJ(This
);
95 }else if(IsEqualGUID(&IID_IViewObject2
, riid
)) {
96 TRACE("(%p)->(IID_IViewObject2, %p)\n", This
, ppvObject
);
97 *ppvObject
= VIEWOBJ2(This
);
98 }else if(IsEqualGUID(&IID_IOleWindow
, riid
)) {
99 TRACE("(%p)->(IID_IOleWindow, %p)\n", This
, ppvObject
);
100 *ppvObject
= OLEWIN(This
);
101 }else if(IsEqualGUID(&IID_IOleInPlaceObject
, riid
)) {
102 TRACE("(%p)->(IID_IOleInPlaceObject, %p)\n", This
, ppvObject
);
103 *ppvObject
= INPLACEOBJ(This
);
104 }else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless
, riid
)) {
105 TRACE("(%p)->(IID_IOleInPlaceObjectWindowless, %p)\n", This
, ppvObject
);
106 *ppvObject
= INPLACEWIN(This
);
107 }else if(IsEqualGUID(&IID_IServiceProvider
, riid
)) {
108 TRACE("(%p)->(IID_IServiceProvider, %p)\n", This
, ppvObject
);
109 *ppvObject
= SERVPROV(This
);
110 }else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
)) {
111 TRACE("(%p)->(IID_IOleCommandTarget, %p)\n", This
, ppvObject
);
112 *ppvObject
= CMDTARGET(This
);
113 }else if(IsEqualGUID(&IID_IOleControl
, riid
)) {
114 TRACE("(%p)->(IID_IOleControl, %p)\n", This
, ppvObject
);
115 *ppvObject
= CONTROL(This
);
116 }else if(IsEqualGUID(&IID_IHlinkTarget
, riid
)) {
117 TRACE("(%p)->(IID_IHlinkTarget, %p)\n", This
, ppvObject
);
118 *ppvObject
= HLNKTARGET(This
);
119 }else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
)) {
120 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This
, ppvObject
);
121 *ppvObject
= CONPTCONT(&This
->cp_container
);
122 }else if(IsEqualGUID(&IID_IPersistStreamInit
, riid
)) {
123 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This
, ppvObject
);
124 *ppvObject
= PERSTRINIT(This
);
125 }else if(IsEqualGUID(&IID_ICustomDoc
, riid
)) {
126 TRACE("(%p)->(IID_ICustomDoc %p)\n", This
, ppvObject
);
127 *ppvObject
= CUSTOMDOC(This
);
128 }else if(IsEqualGUID(&DIID_DispHTMLDocument
, riid
)) {
129 TRACE("(%p)->(DIID_DispHTMLDocument %p)\n", This
, ppvObject
);
130 *ppvObject
= HTMLDOC(This
);
131 }else if(IsEqualGUID(&CLSID_CMarkup
, riid
)) {
132 FIXME("(%p)->(CLSID_CMarkup %p)\n", This
, ppvObject
);
133 return E_NOINTERFACE
;
134 }else if(IsEqualGUID(&IID_IRunnableObject
, riid
)) {
135 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This
, ppvObject
);
136 return E_NOINTERFACE
;
137 }else if(IsEqualGUID(&IID_IPersistPropertyBag
, riid
)) {
138 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This
, ppvObject
);
139 return E_NOINTERFACE
;
140 }else if(dispex_query_interface(&This
->dispex
, riid
, ppvObject
)) {
141 return *ppvObject
? S_OK
: E_NOINTERFACE
;
145 IHTMLDocument2_AddRef(iface
);
149 FIXME("(%p)->(%s %p) interface not supported\n", This
, debugstr_guid(riid
), ppvObject
);
150 return E_NOINTERFACE
;
153 static ULONG WINAPI
HTMLDocument_AddRef(IHTMLDocument2
*iface
)
155 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
156 ULONG ref
= InterlockedIncrement(&This
->ref
);
157 TRACE("(%p) ref = %u\n", This
, ref
);
161 static ULONG WINAPI
HTMLDocument_Release(IHTMLDocument2
*iface
)
163 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
164 ULONG ref
= InterlockedDecrement(&This
->ref
);
166 TRACE("(%p) ref = %u\n", This
, ref
);
169 remove_doc_tasks(This
);
170 release_script_hosts(This
);
173 IOleObject_SetClientSite(OLEOBJ(This
), NULL
);
174 if(This
->in_place_active
)
175 IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(This
));
177 IOleDocumentView_SetInPlaceSite(DOCVIEW(This
), NULL
);
179 IOleUndoManager_Release(This
->undomgr
);
181 set_document_bscallback(This
, NULL
);
182 set_current_mon(This
, NULL
);
184 if(This
->tooltips_hwnd
)
185 DestroyWindow(This
->tooltips_hwnd
);
187 DestroyWindow(This
->hwnd
);
189 if(This
->option_factory
) {
190 This
->option_factory
->doc
= NULL
;
191 IHTMLOptionElementFactory_Release(HTMLOPTFACTORY(This
->option_factory
));
195 This
->location
->doc
= NULL
;
198 IHTMLWindow2_Release(HTMLWINDOW2(This
->window
));
200 heap_free(This
->mime
);
201 detach_selection(This
);
205 ConnectionPointContainer_Destroy(&This
->cp_container
);
207 if(This
->nscontainer
)
208 NSContainer_Release(This
->nscontainer
);
218 static HRESULT WINAPI
HTMLDocument_GetTypeInfoCount(IHTMLDocument2
*iface
, UINT
*pctinfo
)
220 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
222 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This
), pctinfo
);
225 static HRESULT WINAPI
HTMLDocument_GetTypeInfo(IHTMLDocument2
*iface
, UINT iTInfo
,
226 LCID lcid
, ITypeInfo
**ppTInfo
)
228 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
230 return IDispatchEx_GetTypeInfo(DISPATCHEX(This
), iTInfo
, lcid
, ppTInfo
);
233 static HRESULT WINAPI
HTMLDocument_GetIDsOfNames(IHTMLDocument2
*iface
, REFIID riid
,
234 LPOLESTR
*rgszNames
, UINT cNames
,
235 LCID lcid
, DISPID
*rgDispId
)
237 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
239 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
242 static HRESULT WINAPI
HTMLDocument_Invoke(IHTMLDocument2
*iface
, DISPID dispIdMember
,
243 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
244 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
246 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
248 return IDispatchEx_Invoke(DISPATCHEX(This
), dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
249 pVarResult
, pExcepInfo
, puArgErr
);
252 static HRESULT WINAPI
HTMLDocument_get_Script(IHTMLDocument2
*iface
, IDispatch
**p
)
254 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
255 FIXME("(%p)->(%p)\n", This
, p
);
259 static HRESULT WINAPI
HTMLDocument_get_all(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
261 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
262 nsIDOMDocument
*nsdoc
= NULL
;
263 nsIDOMElement
*nselem
= NULL
;
266 TRACE("(%p)->(%p)\n", This
, p
);
268 if(!This
->nscontainer
) {
273 nsres
= nsIWebNavigation_GetDocument(This
->nscontainer
->navigation
, &nsdoc
);
275 ERR("GetDocument failed: %08x\n", nsres
);
278 nsres
= nsIDOMHTMLDocument_GetDocumentElement(nsdoc
, &nselem
);
280 ERR("GetDocumentElement failed: %08x\n", nsres
);
288 *p
= create_all_collection(get_node(This
, (nsIDOMNode
*)nselem
, TRUE
));
290 nsIDOMElement_Release(nselem
);
294 static HRESULT WINAPI
HTMLDocument_get_body(IHTMLDocument2
*iface
, IHTMLElement
**p
)
296 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
297 nsIDOMDocument
*nsdoc
;
298 nsIDOMHTMLDocument
*nshtmldoc
;
299 nsIDOMHTMLElement
*nsbody
= NULL
;
303 TRACE("(%p)->(%p)\n", This
, p
);
307 if(!This
->nscontainer
)
310 nsres
= nsIWebNavigation_GetDocument(This
->nscontainer
->navigation
, &nsdoc
);
311 if(NS_FAILED(nsres
)) {
312 ERR("GetDocument failed: %08x\n", nsres
);
316 if(NS_FAILED(nsres
) || !nsdoc
)
319 nsIDOMDocument_QueryInterface(nsdoc
, &IID_nsIDOMHTMLDocument
, (void**)&nshtmldoc
);
320 nsIDOMDocument_Release(nsdoc
);
322 nsres
= nsIDOMHTMLDocument_GetBody(nshtmldoc
, &nsbody
);
323 nsIDOMHTMLDocument_Release(nshtmldoc
);
325 if(NS_FAILED(nsres
) || !nsbody
) {
326 TRACE("Could not get body: %08x\n", nsres
);
330 node
= get_node(This
, (nsIDOMNode
*)nsbody
, TRUE
);
331 nsIDOMHTMLElement_Release(nsbody
);
333 IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node
), &IID_IHTMLElement
, (void**)p
);
335 TRACE("*p = %p\n", *p
);
339 static HRESULT WINAPI
HTMLDocument_get_activeElement(IHTMLDocument2
*iface
, IHTMLElement
**p
)
341 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
342 FIXME("(%p)->(%p)\n", This
, p
);
346 static HRESULT WINAPI
HTMLDocument_get_images(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
348 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
349 FIXME("(%p)->(%p)\n", This
, p
);
353 static HRESULT WINAPI
HTMLDocument_get_applets(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
355 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
356 FIXME("(%p)->(%p)\n", This
, p
);
360 static HRESULT WINAPI
HTMLDocument_get_links(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
362 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
363 FIXME("(%p)->(%p)\n", This
, p
);
367 static HRESULT WINAPI
HTMLDocument_get_forms(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
369 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
370 FIXME("(%p)->(%p)\n", This
, p
);
374 static HRESULT WINAPI
HTMLDocument_get_anchors(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
376 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
377 FIXME("(%p)->(%p)\n", This
, p
);
381 static HRESULT WINAPI
HTMLDocument_put_title(IHTMLDocument2
*iface
, BSTR v
)
383 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
384 nsIDOMHTMLDocument
*nshtmldoc
;
385 nsIDOMDocument
*nsdoc
;
389 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
391 if(!This
->nscontainer
)
394 nsres
= nsIWebNavigation_GetDocument(This
->nscontainer
->navigation
, &nsdoc
);
395 if(NS_FAILED(nsres
) || !nsdoc
) {
396 ERR("GetDocument failed: %08x\n", nsres
);
400 nsIDOMDocument_QueryInterface(nsdoc
, &IID_nsIDOMHTMLDocument
, (void**)&nshtmldoc
);
401 nsIDOMDocument_Release(nsdoc
);
403 nsAString_Init(&nsstr
, v
);
404 nsres
= nsIDOMHTMLDocument_SetTitle(nshtmldoc
, &nsstr
);
405 nsIDOMHTMLDocument_Release(nshtmldoc
);
406 nsAString_Finish(&nsstr
);
408 ERR("SetTitle failed: %08x\n", nsres
);
413 static HRESULT WINAPI
HTMLDocument_get_title(IHTMLDocument2
*iface
, BSTR
*p
)
415 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
416 nsIDOMHTMLDocument
*nshtmldoc
;
417 nsIDOMDocument
*nsdoc
;
418 const PRUnichar
*ret
;
422 TRACE("(%p)->(%p)\n", This
, p
);
424 if(!This
->nscontainer
)
427 nsres
= nsIWebNavigation_GetDocument(This
->nscontainer
->navigation
, &nsdoc
);
428 if(NS_FAILED(nsres
) || !nsdoc
) {
429 ERR("GetDocument failed: %08x\n", nsres
);
433 nsIDOMDocument_QueryInterface(nsdoc
, &IID_nsIDOMHTMLDocument
, (void**)&nshtmldoc
);
434 nsIDOMDocument_Release(nsdoc
);
436 nsAString_Init(&nsstr
, NULL
);
438 nsres
= nsIDOMHTMLDocument_GetTitle(nshtmldoc
, &nsstr
);
439 nsIDOMHTMLDocument_Release(nshtmldoc
);
440 if (NS_FAILED(nsres
))
441 ERR("GetTitle failed: %08x\n", nsres
);
443 nsAString_GetData(&nsstr
, &ret
);
444 *p
= SysAllocString(ret
);
445 nsAString_Finish(&nsstr
);
450 static HRESULT WINAPI
HTMLDocument_get_scripts(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
452 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
453 FIXME("(%p)->(%p)\n", This
, p
);
457 static HRESULT WINAPI
HTMLDocument_put_designMode(IHTMLDocument2
*iface
, BSTR v
)
459 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
460 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
464 static HRESULT WINAPI
HTMLDocument_get_designMode(IHTMLDocument2
*iface
, BSTR
*p
)
466 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
467 FIXME("(%p)->(%p)\n", This
, p
);
471 static HRESULT WINAPI
HTMLDocument_get_selection(IHTMLDocument2
*iface
, IHTMLSelectionObject
**p
)
473 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
474 nsISelection
*nsselection
= NULL
;
476 TRACE("(%p)->(%p)\n", This
, p
);
478 if(This
->nscontainer
) {
479 nsIDOMWindow
*dom_window
= NULL
;
481 nsIWebBrowser_GetContentDOMWindow(This
->nscontainer
->webbrowser
, &dom_window
);
483 nsIDOMWindow_GetSelection(dom_window
, &nsselection
);
484 nsIDOMWindow_Release(dom_window
);
488 *p
= HTMLSelectionObject_Create(This
, nsselection
);
492 static HRESULT WINAPI
HTMLDocument_get_readyState(IHTMLDocument2
*iface
, BSTR
*p
)
494 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
496 static const WCHAR wszUninitialized
[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
497 static const WCHAR wszLoading
[] = {'l','o','a','d','i','n','g',0};
498 static const WCHAR wszLoaded
[] = {'l','o','a','d','e','d',0};
499 static const WCHAR wszInteractive
[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
500 static const WCHAR wszComplete
[] = {'c','o','m','p','l','e','t','e',0};
502 static const LPCWSTR readystate_str
[] = {
510 TRACE("(%p)->(%p)\n", iface
, p
);
515 *p
= SysAllocString(readystate_str
[This
->readystate
]);
519 static HRESULT WINAPI
HTMLDocument_get_frames(IHTMLDocument2
*iface
, IHTMLFramesCollection2
**p
)
521 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
522 FIXME("(%p)->(%p)\n", This
, p
);
526 static HRESULT WINAPI
HTMLDocument_get_embeds(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
528 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
529 FIXME("(%p)->(%p)\n", This
, p
);
533 static HRESULT WINAPI
HTMLDocument_get_plugins(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
535 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
536 FIXME("(%p)->(%p)\n", This
, p
);
540 static HRESULT WINAPI
HTMLDocument_put_alinkColor(IHTMLDocument2
*iface
, VARIANT v
)
542 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
543 FIXME("(%p)\n", This
);
547 static HRESULT WINAPI
HTMLDocument_get_alinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
549 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
550 FIXME("(%p)->(%p)\n", This
, p
);
554 static HRESULT WINAPI
HTMLDocument_put_bgColor(IHTMLDocument2
*iface
, VARIANT v
)
556 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
557 FIXME("(%p)\n", This
);
561 static HRESULT WINAPI
HTMLDocument_get_bgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
563 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
564 FIXME("(%p)->(%p)\n", This
, p
);
568 static HRESULT WINAPI
HTMLDocument_put_fgColor(IHTMLDocument2
*iface
, VARIANT v
)
570 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
571 FIXME("(%p)\n", This
);
575 static HRESULT WINAPI
HTMLDocument_get_fgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
577 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
578 FIXME("(%p)->(%p)\n", This
, p
);
582 static HRESULT WINAPI
HTMLDocument_put_linkColor(IHTMLDocument2
*iface
, VARIANT v
)
584 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
585 FIXME("(%p)->()\n", This
);
589 static HRESULT WINAPI
HTMLDocument_get_linkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
591 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
592 FIXME("(%p)->(%p)\n", This
, p
);
596 static HRESULT WINAPI
HTMLDocument_put_vlinkColor(IHTMLDocument2
*iface
, VARIANT v
)
598 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
599 FIXME("(%p)\n", This
);
603 static HRESULT WINAPI
HTMLDocument_get_vlinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
605 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
606 FIXME("(%p)->(%p)\n", This
, p
);
610 static HRESULT WINAPI
HTMLDocument_get_referrer(IHTMLDocument2
*iface
, BSTR
*p
)
612 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
613 FIXME("(%p)->(%p)\n", This
, p
);
617 static HRESULT WINAPI
HTMLDocument_get_location(IHTMLDocument2
*iface
, IHTMLLocation
**p
)
619 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
621 TRACE("(%p)->(%p)\n", This
, p
);
624 IHTMLLocation_AddRef(HTMLLOCATION(This
->location
));
626 This
->location
= HTMLLocation_Create(This
);
628 *p
= HTMLLOCATION(This
->location
);
632 static HRESULT WINAPI
HTMLDocument_get_lastModified(IHTMLDocument2
*iface
, BSTR
*p
)
634 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
635 FIXME("(%p)->(%p)\n", This
, p
);
639 static HRESULT WINAPI
HTMLDocument_put_URL(IHTMLDocument2
*iface
, BSTR v
)
641 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
642 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
646 static HRESULT WINAPI
HTMLDocument_get_URL(IHTMLDocument2
*iface
, BSTR
*p
)
648 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
650 static const WCHAR about_blank_url
[] =
651 {'a','b','o','u','t',':','b','l','a','n','k',0};
653 TRACE("(%p)->(%p)\n", iface
, p
);
655 *p
= SysAllocString(This
->url
? This
->url
: about_blank_url
);
659 static HRESULT WINAPI
HTMLDocument_put_domain(IHTMLDocument2
*iface
, BSTR v
)
661 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
662 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
666 static HRESULT WINAPI
HTMLDocument_get_domain(IHTMLDocument2
*iface
, BSTR
*p
)
668 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
669 FIXME("(%p)->(%p)\n", This
, p
);
673 static HRESULT WINAPI
HTMLDocument_put_cookie(IHTMLDocument2
*iface
, BSTR v
)
675 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
676 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
680 static HRESULT WINAPI
HTMLDocument_get_cookie(IHTMLDocument2
*iface
, BSTR
*p
)
682 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
683 FIXME("(%p)->(%p)\n", This
, p
);
687 static HRESULT WINAPI
HTMLDocument_put_expando(IHTMLDocument2
*iface
, VARIANT_BOOL v
)
689 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
690 FIXME("(%p)->(%x)\n", This
, v
);
694 static HRESULT WINAPI
HTMLDocument_get_expando(IHTMLDocument2
*iface
, VARIANT_BOOL
*p
)
696 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
697 FIXME("(%p)->(%p)\n", This
, p
);
701 static HRESULT WINAPI
HTMLDocument_put_charset(IHTMLDocument2
*iface
, BSTR v
)
703 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
704 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
708 static HRESULT WINAPI
HTMLDocument_get_charset(IHTMLDocument2
*iface
, BSTR
*p
)
710 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
711 FIXME("(%p)->(%p)\n", This
, p
);
715 static HRESULT WINAPI
HTMLDocument_put_defaultCharset(IHTMLDocument2
*iface
, BSTR v
)
717 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
718 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
722 static HRESULT WINAPI
HTMLDocument_get_defaultCharset(IHTMLDocument2
*iface
, BSTR
*p
)
724 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
725 FIXME("(%p)->(%p)\n", This
, p
);
729 static HRESULT WINAPI
HTMLDocument_get_mimeType(IHTMLDocument2
*iface
, BSTR
*p
)
731 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
732 FIXME("(%p)->(%p)\n", This
, p
);
736 static HRESULT WINAPI
HTMLDocument_get_fileSize(IHTMLDocument2
*iface
, BSTR
*p
)
738 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
739 FIXME("(%p)->(%p)\n", This
, p
);
743 static HRESULT WINAPI
HTMLDocument_get_fileCreatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
745 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
746 FIXME("(%p)->(%p)\n", This
, p
);
750 static HRESULT WINAPI
HTMLDocument_get_fileModifiedDate(IHTMLDocument2
*iface
, BSTR
*p
)
752 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
753 FIXME("(%p)->(%p)\n", This
, p
);
757 static HRESULT WINAPI
HTMLDocument_get_fileUpdatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
759 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
760 FIXME("(%p)->(%p)\n", This
, p
);
764 static HRESULT WINAPI
HTMLDocument_get_security(IHTMLDocument2
*iface
, BSTR
*p
)
766 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
767 FIXME("(%p)->(%p)\n", This
, p
);
771 static HRESULT WINAPI
HTMLDocument_get_protocol(IHTMLDocument2
*iface
, BSTR
*p
)
773 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
774 FIXME("(%p)->(%p)\n", This
, p
);
778 static HRESULT WINAPI
HTMLDocument_get_nameProp(IHTMLDocument2
*iface
, BSTR
*p
)
780 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
781 FIXME("(%p)->(%p)\n", This
, p
);
785 static HRESULT WINAPI
HTMLDocument_write(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
787 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
788 nsIDOMDocument
*domdoc
;
789 nsIDOMHTMLDocument
*nsdoc
;
796 TRACE("(%p)->(%p)\n", iface
, psarray
);
798 if(psarray
->cDims
!= 1) {
799 FIXME("cDims=%d\n", psarray
->cDims
);
803 if(!This
->nscontainer
)
806 nsres
= nsIWebNavigation_GetDocument(This
->nscontainer
->navigation
, &domdoc
);
807 if(NS_FAILED(nsres
)) {
808 ERR("GetDocument failed: %08x\n", nsres
);
812 nsres
= nsIDOMDocument_QueryInterface(domdoc
, &IID_nsIDOMHTMLDocument
, (void**)&nsdoc
);
813 nsIDOMDocument_Release(domdoc
);
817 hres
= SafeArrayAccessData(psarray
, (void**)&var
);
819 WARN("SafeArrayAccessData failed: %08x\n", hres
);
820 nsIDOMHTMLDocument_Release(nsdoc
);
824 nsAString_Init(&nsstr
, NULL
);
826 for(i
=0; i
< psarray
->rgsabound
[0].cElements
; i
++) {
827 if(V_VT(var
+i
) == VT_BSTR
) {
828 nsAString_SetData(&nsstr
, V_BSTR(var
+i
));
829 nsres
= nsIDOMHTMLDocument_Write(nsdoc
, &nsstr
);
831 ERR("Write failed: %08x\n", nsres
);
833 FIXME("vt=%d\n", V_VT(var
+i
));
837 nsAString_Finish(&nsstr
);
838 SafeArrayUnaccessData(psarray
);
839 nsIDOMHTMLDocument_Release(nsdoc
);
844 static HRESULT WINAPI
HTMLDocument_writeln(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
846 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
847 FIXME("(%p)->(%p)\n", This
, psarray
);
851 static HRESULT WINAPI
HTMLDocument_open(IHTMLDocument2
*iface
, BSTR url
, VARIANT name
,
852 VARIANT features
, VARIANT replace
, IDispatch
**pomWindowResult
)
854 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
855 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(url
), pomWindowResult
);
859 static HRESULT WINAPI
HTMLDocument_close(IHTMLDocument2
*iface
)
861 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
862 FIXME("(%p)\n", This
);
866 static HRESULT WINAPI
HTMLDocument_clear(IHTMLDocument2
*iface
)
868 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
869 FIXME("(%p)\n", This
);
873 static HRESULT WINAPI
HTMLDocument_queryCommandSupported(IHTMLDocument2
*iface
, BSTR cmdID
,
876 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
877 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
881 static HRESULT WINAPI
HTMLDocument_queryCommandEnabled(IHTMLDocument2
*iface
, BSTR cmdID
,
884 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
885 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
889 static HRESULT WINAPI
HTMLDocument_queryCommandState(IHTMLDocument2
*iface
, BSTR cmdID
,
892 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
893 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
897 static HRESULT WINAPI
HTMLDocument_queryCommandIndeterm(IHTMLDocument2
*iface
, BSTR cmdID
,
900 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
901 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
905 static HRESULT WINAPI
HTMLDocument_queryCommandText(IHTMLDocument2
*iface
, BSTR cmdID
,
908 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
909 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
913 static HRESULT WINAPI
HTMLDocument_queryCommandValue(IHTMLDocument2
*iface
, BSTR cmdID
,
916 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
917 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
921 static HRESULT WINAPI
HTMLDocument_execCommand(IHTMLDocument2
*iface
, BSTR cmdID
,
922 VARIANT_BOOL showUI
, VARIANT value
, VARIANT_BOOL
*pfRet
)
924 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
925 FIXME("(%p)->(%s %x %p)\n", This
, debugstr_w(cmdID
), showUI
, pfRet
);
929 static HRESULT WINAPI
HTMLDocument_execCommandShowHelp(IHTMLDocument2
*iface
, BSTR cmdID
,
932 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
933 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
937 static HRESULT WINAPI
HTMLDocument_createElement(IHTMLDocument2
*iface
, BSTR eTag
,
938 IHTMLElement
**newElem
)
940 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
941 nsIDOMDocument
*nsdoc
;
942 nsIDOMElement
*nselem
;
947 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eTag
), newElem
);
949 nsIWebNavigation_GetDocument(This
->nscontainer
->navigation
, &nsdoc
);
951 nsAString_Init(&tag_str
, eTag
);
952 nsres
= nsIDOMDocument_CreateElement(nsdoc
, &tag_str
, &nselem
);
953 nsAString_Finish(&tag_str
);
954 nsIDOMDocument_Release(nsdoc
);
955 if(NS_FAILED(nsres
)) {
956 ERR("CreateElement failed: %08x\n", nsres
);
960 elem
= HTMLElement_Create(This
, (nsIDOMNode
*)nselem
, TRUE
);
961 nsIDOMElement_Release(nselem
);
963 *newElem
= HTMLELEM(elem
);
964 IHTMLElement_AddRef(HTMLELEM(elem
));
968 static HRESULT WINAPI
HTMLDocument_put_onhelp(IHTMLDocument2
*iface
, VARIANT v
)
970 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
971 FIXME("(%p)\n", This
);
975 static HRESULT WINAPI
HTMLDocument_get_onhelp(IHTMLDocument2
*iface
, VARIANT
*p
)
977 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
978 FIXME("(%p)->(%p)\n", This
, p
);
982 static HRESULT WINAPI
HTMLDocument_put_onclick(IHTMLDocument2
*iface
, VARIANT v
)
984 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
985 FIXME("(%p)\n", This
);
989 static HRESULT WINAPI
HTMLDocument_get_onclick(IHTMLDocument2
*iface
, VARIANT
*p
)
991 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
992 FIXME("(%p)->(%p)\n", This
, p
);
996 static HRESULT WINAPI
HTMLDocument_put_ondblclick(IHTMLDocument2
*iface
, VARIANT v
)
998 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
999 FIXME("(%p)\n", This
);
1003 static HRESULT WINAPI
HTMLDocument_get_ondblclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1005 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1006 FIXME("(%p)->(%p)\n", This
, p
);
1010 static HRESULT WINAPI
HTMLDocument_put_onkeyup(IHTMLDocument2
*iface
, VARIANT v
)
1012 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1013 FIXME("(%p)\n", This
);
1017 static HRESULT WINAPI
HTMLDocument_get_onkeyup(IHTMLDocument2
*iface
, VARIANT
*p
)
1019 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1020 FIXME("(%p)->(%p)\n", This
, p
);
1024 static HRESULT WINAPI
HTMLDocument_put_onkeydown(IHTMLDocument2
*iface
, VARIANT v
)
1026 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1027 FIXME("(%p)\n", This
);
1031 static HRESULT WINAPI
HTMLDocument_get_onkeydown(IHTMLDocument2
*iface
, VARIANT
*p
)
1033 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1034 FIXME("(%p)->(%p)\n", This
, p
);
1038 static HRESULT WINAPI
HTMLDocument_put_onkeypress(IHTMLDocument2
*iface
, VARIANT v
)
1040 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1041 FIXME("(%p)\n", This
);
1045 static HRESULT WINAPI
HTMLDocument_get_onkeypress(IHTMLDocument2
*iface
, VARIANT
*p
)
1047 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1048 FIXME("(%p)->(%p)\n", This
, p
);
1052 static HRESULT WINAPI
HTMLDocument_put_onmouseup(IHTMLDocument2
*iface
, VARIANT v
)
1054 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1055 FIXME("(%p)\n", This
);
1059 static HRESULT WINAPI
HTMLDocument_get_onmouseup(IHTMLDocument2
*iface
, VARIANT
*p
)
1061 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1062 FIXME("(%p)->(%p)\n", This
, p
);
1066 static HRESULT WINAPI
HTMLDocument_put_onmousedown(IHTMLDocument2
*iface
, VARIANT v
)
1068 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1069 FIXME("(%p)\n", This
);
1073 static HRESULT WINAPI
HTMLDocument_get_onmousedown(IHTMLDocument2
*iface
, VARIANT
*p
)
1075 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1076 FIXME("(%p)->(%p)\n", This
, p
);
1080 static HRESULT WINAPI
HTMLDocument_put_onmousemove(IHTMLDocument2
*iface
, VARIANT v
)
1082 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1083 FIXME("(%p)\n", This
);
1087 static HRESULT WINAPI
HTMLDocument_get_onmousemove(IHTMLDocument2
*iface
, VARIANT
*p
)
1089 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1090 FIXME("(%p)->(%p)\n", This
, p
);
1094 static HRESULT WINAPI
HTMLDocument_put_onmouseout(IHTMLDocument2
*iface
, VARIANT v
)
1096 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1097 FIXME("(%p)\n", This
);
1101 static HRESULT WINAPI
HTMLDocument_get_onmouseout(IHTMLDocument2
*iface
, VARIANT
*p
)
1103 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1104 FIXME("(%p)->(%p)\n", This
, p
);
1108 static HRESULT WINAPI
HTMLDocument_put_onmouseover(IHTMLDocument2
*iface
, VARIANT v
)
1110 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1111 FIXME("(%p)\n", This
);
1115 static HRESULT WINAPI
HTMLDocument_get_onmouseover(IHTMLDocument2
*iface
, VARIANT
*p
)
1117 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1118 FIXME("(%p)->(%p)\n", This
, p
);
1122 static HRESULT WINAPI
HTMLDocument_put_onreadystatechange(IHTMLDocument2
*iface
, VARIANT v
)
1124 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1125 FIXME("(%p)\n", This
);
1129 static HRESULT WINAPI
HTMLDocument_get_onreadystatechange(IHTMLDocument2
*iface
, VARIANT
*p
)
1131 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1132 FIXME("(%p)->(%p)\n", This
, p
);
1136 static HRESULT WINAPI
HTMLDocument_put_onafterupdate(IHTMLDocument2
*iface
, VARIANT v
)
1138 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1139 FIXME("(%p)\n", This
);
1143 static HRESULT WINAPI
HTMLDocument_get_onafterupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1145 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1146 FIXME("(%p)->(%p)\n", This
, p
);
1150 static HRESULT WINAPI
HTMLDocument_put_onrowexit(IHTMLDocument2
*iface
, VARIANT v
)
1152 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1153 FIXME("(%p)\n", This
);
1157 static HRESULT WINAPI
HTMLDocument_get_onrowexit(IHTMLDocument2
*iface
, VARIANT
*p
)
1159 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1160 FIXME("(%p)->(%p)\n", This
, p
);
1164 static HRESULT WINAPI
HTMLDocument_put_onrowenter(IHTMLDocument2
*iface
, VARIANT v
)
1166 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1167 FIXME("(%p)\n", This
);
1171 static HRESULT WINAPI
HTMLDocument_get_onrowenter(IHTMLDocument2
*iface
, VARIANT
*p
)
1173 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1174 FIXME("(%p)->(%p)\n", This
, p
);
1178 static HRESULT WINAPI
HTMLDocument_put_ondragstart(IHTMLDocument2
*iface
, VARIANT v
)
1180 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1181 FIXME("(%p)\n", This
);
1185 static HRESULT WINAPI
HTMLDocument_get_ondragstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1187 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1188 FIXME("(%p)->(%p)\n", This
, p
);
1192 static HRESULT WINAPI
HTMLDocument_put_onselectstart(IHTMLDocument2
*iface
, VARIANT v
)
1194 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1195 FIXME("(%p)\n", This
);
1199 static HRESULT WINAPI
HTMLDocument_get_onselectstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1201 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1202 FIXME("(%p)->(%p)\n", This
, p
);
1206 static HRESULT WINAPI
HTMLDocument_elementFromPoint(IHTMLDocument2
*iface
, long x
, long y
,
1207 IHTMLElement
**elementHit
)
1209 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1210 FIXME("(%p)->(%ld %ld %p)\n", This
, x
, y
, elementHit
);
1214 static HRESULT WINAPI
HTMLDocument_get_parentWindow(IHTMLDocument2
*iface
, IHTMLWindow2
**p
)
1216 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1218 TRACE("(%p)->(%p)\n", This
, p
);
1220 *p
= HTMLWINDOW2(This
->window
);
1221 IHTMLWindow2_AddRef(*p
);
1225 static HRESULT WINAPI
HTMLDocument_get_styleSheets(IHTMLDocument2
*iface
,
1226 IHTMLStyleSheetsCollection
**p
)
1228 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1229 nsIDOMStyleSheetList
*nsstylelist
;
1230 nsIDOMDocumentStyle
*nsdocstyle
;
1231 nsIDOMDocument
*nsdoc
;
1234 TRACE("(%p)->(%p)\n", This
, p
);
1238 if(!This
->nscontainer
)
1241 nsres
= nsIWebNavigation_GetDocument(This
->nscontainer
->navigation
, &nsdoc
);
1242 if(NS_FAILED(nsres
)) {
1243 ERR("GetDocument failed: %08x\n", nsres
);
1247 if(NS_FAILED(nsres
) || !nsdoc
)
1250 nsIDOMDocument_QueryInterface(nsdoc
, &IID_nsIDOMDocumentStyle
, (void**)&nsdocstyle
);
1251 nsIDOMDocument_Release(nsdoc
);
1253 nsIDOMDocumentStyle_GetStyleSheets(nsdocstyle
, &nsstylelist
);
1254 nsIDOMDocumentStyle_Release(nsdocstyle
);
1256 *p
= HTMLStyleSheetsCollection_Create(nsstylelist
);
1257 nsIDOMDocumentStyle_Release(nsstylelist
);
1262 static HRESULT WINAPI
HTMLDocument_put_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT v
)
1264 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1265 FIXME("(%p)\n", This
);
1269 static HRESULT WINAPI
HTMLDocument_get_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1271 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1272 FIXME("(%p)->(%p)\n", This
, p
);
1276 static HRESULT WINAPI
HTMLDocument_put_onerrorupdate(IHTMLDocument2
*iface
, VARIANT v
)
1278 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1279 FIXME("(%p)\n", This
);
1283 static HRESULT WINAPI
HTMLDocument_get_onerrorupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1285 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1286 FIXME("(%p)->(%p)\n", This
, p
);
1290 static HRESULT WINAPI
HTMLDocument_toString(IHTMLDocument2
*iface
, BSTR
*String
)
1292 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1293 FIXME("(%p)->(%p)\n", This
, String
);
1297 static HRESULT WINAPI
HTMLDocument_createStyleSheet(IHTMLDocument2
*iface
, BSTR bstrHref
,
1298 long lIndex
, IHTMLStyleSheet
**ppnewStyleSheet
)
1300 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1302 FIXME("(%p)->(%s %ld %p) semi-stub\n", This
, debugstr_w(bstrHref
), lIndex
, ppnewStyleSheet
);
1304 *ppnewStyleSheet
= HTMLStyleSheet_Create(NULL
);
1308 static const IHTMLDocument2Vtbl HTMLDocumentVtbl
= {
1309 HTMLDocument_QueryInterface
,
1310 HTMLDocument_AddRef
,
1311 HTMLDocument_Release
,
1312 HTMLDocument_GetTypeInfoCount
,
1313 HTMLDocument_GetTypeInfo
,
1314 HTMLDocument_GetIDsOfNames
,
1315 HTMLDocument_Invoke
,
1316 HTMLDocument_get_Script
,
1317 HTMLDocument_get_all
,
1318 HTMLDocument_get_body
,
1319 HTMLDocument_get_activeElement
,
1320 HTMLDocument_get_images
,
1321 HTMLDocument_get_applets
,
1322 HTMLDocument_get_links
,
1323 HTMLDocument_get_forms
,
1324 HTMLDocument_get_anchors
,
1325 HTMLDocument_put_title
,
1326 HTMLDocument_get_title
,
1327 HTMLDocument_get_scripts
,
1328 HTMLDocument_put_designMode
,
1329 HTMLDocument_get_designMode
,
1330 HTMLDocument_get_selection
,
1331 HTMLDocument_get_readyState
,
1332 HTMLDocument_get_frames
,
1333 HTMLDocument_get_embeds
,
1334 HTMLDocument_get_plugins
,
1335 HTMLDocument_put_alinkColor
,
1336 HTMLDocument_get_alinkColor
,
1337 HTMLDocument_put_bgColor
,
1338 HTMLDocument_get_bgColor
,
1339 HTMLDocument_put_fgColor
,
1340 HTMLDocument_get_fgColor
,
1341 HTMLDocument_put_linkColor
,
1342 HTMLDocument_get_linkColor
,
1343 HTMLDocument_put_vlinkColor
,
1344 HTMLDocument_get_vlinkColor
,
1345 HTMLDocument_get_referrer
,
1346 HTMLDocument_get_location
,
1347 HTMLDocument_get_lastModified
,
1348 HTMLDocument_put_URL
,
1349 HTMLDocument_get_URL
,
1350 HTMLDocument_put_domain
,
1351 HTMLDocument_get_domain
,
1352 HTMLDocument_put_cookie
,
1353 HTMLDocument_get_cookie
,
1354 HTMLDocument_put_expando
,
1355 HTMLDocument_get_expando
,
1356 HTMLDocument_put_charset
,
1357 HTMLDocument_get_charset
,
1358 HTMLDocument_put_defaultCharset
,
1359 HTMLDocument_get_defaultCharset
,
1360 HTMLDocument_get_mimeType
,
1361 HTMLDocument_get_fileSize
,
1362 HTMLDocument_get_fileCreatedDate
,
1363 HTMLDocument_get_fileModifiedDate
,
1364 HTMLDocument_get_fileUpdatedDate
,
1365 HTMLDocument_get_security
,
1366 HTMLDocument_get_protocol
,
1367 HTMLDocument_get_nameProp
,
1369 HTMLDocument_writeln
,
1373 HTMLDocument_queryCommandSupported
,
1374 HTMLDocument_queryCommandEnabled
,
1375 HTMLDocument_queryCommandState
,
1376 HTMLDocument_queryCommandIndeterm
,
1377 HTMLDocument_queryCommandText
,
1378 HTMLDocument_queryCommandValue
,
1379 HTMLDocument_execCommand
,
1380 HTMLDocument_execCommandShowHelp
,
1381 HTMLDocument_createElement
,
1382 HTMLDocument_put_onhelp
,
1383 HTMLDocument_get_onhelp
,
1384 HTMLDocument_put_onclick
,
1385 HTMLDocument_get_onclick
,
1386 HTMLDocument_put_ondblclick
,
1387 HTMLDocument_get_ondblclick
,
1388 HTMLDocument_put_onkeyup
,
1389 HTMLDocument_get_onkeyup
,
1390 HTMLDocument_put_onkeydown
,
1391 HTMLDocument_get_onkeydown
,
1392 HTMLDocument_put_onkeypress
,
1393 HTMLDocument_get_onkeypress
,
1394 HTMLDocument_put_onmouseup
,
1395 HTMLDocument_get_onmouseup
,
1396 HTMLDocument_put_onmousedown
,
1397 HTMLDocument_get_onmousedown
,
1398 HTMLDocument_put_onmousemove
,
1399 HTMLDocument_get_onmousemove
,
1400 HTMLDocument_put_onmouseout
,
1401 HTMLDocument_get_onmouseout
,
1402 HTMLDocument_put_onmouseover
,
1403 HTMLDocument_get_onmouseover
,
1404 HTMLDocument_put_onreadystatechange
,
1405 HTMLDocument_get_onreadystatechange
,
1406 HTMLDocument_put_onafterupdate
,
1407 HTMLDocument_get_onafterupdate
,
1408 HTMLDocument_put_onrowexit
,
1409 HTMLDocument_get_onrowexit
,
1410 HTMLDocument_put_onrowenter
,
1411 HTMLDocument_get_onrowenter
,
1412 HTMLDocument_put_ondragstart
,
1413 HTMLDocument_get_ondragstart
,
1414 HTMLDocument_put_onselectstart
,
1415 HTMLDocument_get_onselectstart
,
1416 HTMLDocument_elementFromPoint
,
1417 HTMLDocument_get_parentWindow
,
1418 HTMLDocument_get_styleSheets
,
1419 HTMLDocument_put_onbeforeupdate
,
1420 HTMLDocument_get_onbeforeupdate
,
1421 HTMLDocument_put_onerrorupdate
,
1422 HTMLDocument_get_onerrorupdate
,
1423 HTMLDocument_toString
,
1424 HTMLDocument_createStyleSheet
1427 #define DISPEX_THIS(iface) DEFINE_THIS(HTMLDocument, IDispatchEx, iface)
1429 static HRESULT WINAPI
DocDispatchEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
1431 HTMLDocument
*This
= DISPEX_THIS(iface
);
1433 return IHTMLDocument2_QueryInterface(HTMLDOC(This
), riid
, ppv
);
1436 static ULONG WINAPI
DocDispatchEx_AddRef(IDispatchEx
*iface
)
1438 HTMLDocument
*This
= DISPEX_THIS(iface
);
1440 return IHTMLDocument2_AddRef(HTMLDOC(This
));
1443 static ULONG WINAPI
DocDispatchEx_Release(IDispatchEx
*iface
)
1445 HTMLDocument
*This
= DISPEX_THIS(iface
);
1447 return IHTMLDocument2_Release(HTMLDOC(This
));
1450 static HRESULT WINAPI
DocDispatchEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
1452 HTMLDocument
*This
= DISPEX_THIS(iface
);
1454 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This
->dispex
), pctinfo
);
1457 static HRESULT WINAPI
DocDispatchEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
1458 LCID lcid
, ITypeInfo
**ppTInfo
)
1460 HTMLDocument
*This
= DISPEX_THIS(iface
);
1462 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This
->dispex
), iTInfo
, lcid
, ppTInfo
);
1465 static HRESULT WINAPI
DocDispatchEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
1466 LPOLESTR
*rgszNames
, UINT cNames
,
1467 LCID lcid
, DISPID
*rgDispId
)
1469 HTMLDocument
*This
= DISPEX_THIS(iface
);
1471 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This
->dispex
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1474 static HRESULT WINAPI
DocDispatchEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
1475 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1476 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1478 HTMLDocument
*This
= DISPEX_THIS(iface
);
1480 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
1481 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1483 switch(dispIdMember
) {
1484 case DISPID_READYSTATE
:
1485 TRACE("DISPID_READYSTATE\n");
1487 if(!(wFlags
& DISPATCH_PROPERTYGET
))
1488 return E_INVALIDARG
;
1490 V_VT(pVarResult
) = VT_I4
;
1491 V_I4(pVarResult
) = This
->readystate
;
1495 return IDispatchEx_Invoke(DISPATCHEX(&This
->dispex
), dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
1496 pVarResult
, pExcepInfo
, puArgErr
);
1499 static HRESULT WINAPI
DocDispatchEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
1501 HTMLDocument
*This
= DISPEX_THIS(iface
);
1503 return IDispatchEx_GetDispID(DISPATCHEX(&This
->dispex
), bstrName
, grfdex
, pid
);
1506 static HRESULT WINAPI
DocDispatchEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
1507 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
1509 HTMLDocument
*This
= DISPEX_THIS(iface
);
1511 return IDispatchEx_InvokeEx(DISPATCHEX(&This
->dispex
), id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
1514 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
1516 HTMLDocument
*This
= DISPEX_THIS(iface
);
1518 return IDispatchEx_DeleteMemberByName(DISPATCHEX(&This
->dispex
), bstrName
, grfdex
);
1521 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
1523 HTMLDocument
*This
= DISPEX_THIS(iface
);
1525 return IDispatchEx_DeleteMemberByDispID(DISPATCHEX(&This
->dispex
), id
);
1528 static HRESULT WINAPI
DocDispatchEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
1530 HTMLDocument
*This
= DISPEX_THIS(iface
);
1532 return IDispatchEx_GetMemberProperties(DISPATCHEX(&This
->dispex
), id
, grfdexFetch
, pgrfdex
);
1535 static HRESULT WINAPI
DocDispatchEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
1537 HTMLDocument
*This
= DISPEX_THIS(iface
);
1539 return IDispatchEx_GetMemberName(DISPATCHEX(&This
->dispex
), id
, pbstrName
);
1542 static HRESULT WINAPI
DocDispatchEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
1544 HTMLDocument
*This
= DISPEX_THIS(iface
);
1546 return IDispatchEx_GetNextDispID(DISPATCHEX(&This
->dispex
), grfdex
, id
, pid
);
1549 static HRESULT WINAPI
DocDispatchEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
1551 HTMLDocument
*This
= DISPEX_THIS(iface
);
1553 return IDispatchEx_GetNameSpaceParent(DISPATCHEX(&This
->dispex
), ppunk
);
1558 static const IDispatchExVtbl DocDispatchExVtbl
= {
1559 DocDispatchEx_QueryInterface
,
1560 DocDispatchEx_AddRef
,
1561 DocDispatchEx_Release
,
1562 DocDispatchEx_GetTypeInfoCount
,
1563 DocDispatchEx_GetTypeInfo
,
1564 DocDispatchEx_GetIDsOfNames
,
1565 DocDispatchEx_Invoke
,
1566 DocDispatchEx_GetDispID
,
1567 DocDispatchEx_InvokeEx
,
1568 DocDispatchEx_DeleteMemberByName
,
1569 DocDispatchEx_DeleteMemberByDispID
,
1570 DocDispatchEx_GetMemberProperties
,
1571 DocDispatchEx_GetMemberName
,
1572 DocDispatchEx_GetNextDispID
,
1573 DocDispatchEx_GetNameSpaceParent
1576 static const tid_t HTMLDocument_iface_tids
[] = {
1583 static dispex_static_data_t HTMLDocument_dispex
= {
1585 DispHTMLDocument_tid
,
1587 HTMLDocument_iface_tids
1590 HRESULT
HTMLDocument_Create(IUnknown
*pUnkOuter
, REFIID riid
, void** ppvObject
)
1595 TRACE("(%p %s %p)\n", pUnkOuter
, debugstr_guid(riid
), ppvObject
);
1597 ret
= heap_alloc_zero(sizeof(HTMLDocument
));
1598 ret
->lpHTMLDocument2Vtbl
= &HTMLDocumentVtbl
;
1599 ret
->lpIDispatchExVtbl
= &DocDispatchExVtbl
;
1601 ret
->readystate
= READYSTATE_UNINITIALIZED
;
1603 list_init(&ret
->bindings
);
1604 list_init(&ret
->script_hosts
);
1605 list_init(&ret
->selection_list
);
1606 list_init(&ret
->range_list
);
1608 hres
= IHTMLDocument_QueryInterface(HTMLDOC(ret
), riid
, ppvObject
);
1616 HTMLDocument_HTMLDocument3_Init(ret
);
1617 HTMLDocument_HTMLDocument5_Init(ret
);
1618 HTMLDocument_Persist_Init(ret
);
1619 HTMLDocument_OleCmd_Init(ret
);
1620 HTMLDocument_OleObj_Init(ret
);
1621 HTMLDocument_View_Init(ret
);
1622 HTMLDocument_Window_Init(ret
);
1623 HTMLDocument_Service_Init(ret
);
1624 HTMLDocument_Hlink_Init(ret
);
1626 ConnectionPointContainer_Init(&ret
->cp_container
, (IUnknown
*)HTMLDOC(ret
));
1627 ConnectionPoint_Init(&ret
->cp_propnotif
, &ret
->cp_container
, &IID_IPropertyNotifySink
);
1628 ConnectionPoint_Init(&ret
->cp_htmldocevents
, &ret
->cp_container
, &DIID_HTMLDocumentEvents
);
1629 ConnectionPoint_Init(&ret
->cp_htmldocevents2
, &ret
->cp_container
, &DIID_HTMLDocumentEvents2
);
1631 init_dispex(&ret
->dispex
, (IUnknown
*)HTMLDOC(ret
), &HTMLDocument_dispex
);
1633 ret
->nscontainer
= NSContainer_Create(ret
, NULL
);
1634 ret
->window
= HTMLWindow_Create(ret
);