2 * Copyright 2005 Jacek Caban
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "wine/debug.h"
33 #include "mshtml_private.h"
34 #include "htmlevent.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
38 #define HTMLDOC_THIS(iface) DEFINE_THIS(HTMLDocument, HTMLDocument2, iface)
40 static HRESULT WINAPI
HTMLDocument_QueryInterface(IHTMLDocument2
*iface
, REFIID riid
, void **ppvObject
)
42 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
45 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
46 TRACE("(%p)->(IID_IUnknown, %p)\n", This
, ppvObject
);
47 *ppvObject
= HTMLDOC(This
);
48 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
49 TRACE("(%p)->(IID_IDispatch, %p)\n", This
, ppvObject
);
50 *ppvObject
= DISPATCHEX(This
);
51 }else if(IsEqualGUID(&IID_IDispatchEx
, riid
)) {
52 TRACE("(%p)->(IID_IDispatchEx, %p)\n", This
, ppvObject
);
53 *ppvObject
= DISPATCHEX(This
);
54 }else if(IsEqualGUID(&IID_IHTMLDocument
, riid
)) {
55 TRACE("(%p)->(IID_IHTMLDocument, %p)\n", This
, ppvObject
);
56 *ppvObject
= HTMLDOC(This
);
57 }else if(IsEqualGUID(&IID_IHTMLDocument2
, riid
)) {
58 TRACE("(%p)->(IID_IHTMLDocument2, %p)\n", This
, ppvObject
);
59 *ppvObject
= HTMLDOC(This
);
60 }else if(IsEqualGUID(&IID_IHTMLDocument3
, riid
)) {
61 TRACE("(%p)->(IID_IHTMLDocument3, %p)\n", This
, ppvObject
);
62 *ppvObject
= HTMLDOC3(This
);
63 }else if(IsEqualGUID(&IID_IHTMLDocument4
, riid
)) {
64 TRACE("(%p)->(IID_IHTMLDocument4, %p)\n", This
, ppvObject
);
65 *ppvObject
= HTMLDOC4(This
);
66 }else if(IsEqualGUID(&IID_IHTMLDocument5
, riid
)) {
67 TRACE("(%p)->(IID_IHTMLDocument5, %p)\n", This
, ppvObject
);
68 *ppvObject
= HTMLDOC5(This
);
69 }else if(IsEqualGUID(&IID_IPersist
, riid
)) {
70 TRACE("(%p)->(IID_IPersist, %p)\n", This
, ppvObject
);
71 *ppvObject
= PERSIST(This
);
72 }else if(IsEqualGUID(&IID_IPersistMoniker
, riid
)) {
73 TRACE("(%p)->(IID_IPersistMoniker, %p)\n", This
, ppvObject
);
74 *ppvObject
= PERSISTMON(This
);
75 }else if(IsEqualGUID(&IID_IPersistFile
, riid
)) {
76 TRACE("(%p)->(IID_IPersistFile, %p)\n", This
, ppvObject
);
77 *ppvObject
= PERSISTFILE(This
);
78 }else if(IsEqualGUID(&IID_IMonikerProp
, riid
)) {
79 TRACE("(%p)->(IID_IMonikerProp, %p)\n", This
, ppvObject
);
80 *ppvObject
= MONPROP(This
);
81 }else if(IsEqualGUID(&IID_IOleObject
, riid
)) {
82 TRACE("(%p)->(IID_IOleObject, %p)\n", This
, ppvObject
);
83 *ppvObject
= OLEOBJ(This
);
84 }else if(IsEqualGUID(&IID_IOleDocument
, riid
)) {
85 TRACE("(%p)->(IID_IOleDocument, %p)\n", This
, ppvObject
);
86 *ppvObject
= OLEDOC(This
);
87 }else if(IsEqualGUID(&IID_IOleDocumentView
, riid
)) {
88 TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This
, ppvObject
);
89 *ppvObject
= DOCVIEW(This
);
90 }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject
, riid
)) {
91 TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This
, ppvObject
);
92 *ppvObject
= ACTOBJ(This
);
93 }else if(IsEqualGUID(&IID_IViewObject
, riid
)) {
94 TRACE("(%p)->(IID_IViewObject, %p)\n", This
, ppvObject
);
95 *ppvObject
= VIEWOBJ(This
);
96 }else if(IsEqualGUID(&IID_IViewObject2
, riid
)) {
97 TRACE("(%p)->(IID_IViewObject2, %p)\n", This
, ppvObject
);
98 *ppvObject
= VIEWOBJ2(This
);
99 }else if(IsEqualGUID(&IID_IOleWindow
, riid
)) {
100 TRACE("(%p)->(IID_IOleWindow, %p)\n", This
, ppvObject
);
101 *ppvObject
= OLEWIN(This
);
102 }else if(IsEqualGUID(&IID_IOleInPlaceObject
, riid
)) {
103 TRACE("(%p)->(IID_IOleInPlaceObject, %p)\n", This
, ppvObject
);
104 *ppvObject
= INPLACEOBJ(This
);
105 }else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless
, riid
)) {
106 TRACE("(%p)->(IID_IOleInPlaceObjectWindowless, %p)\n", This
, ppvObject
);
107 *ppvObject
= INPLACEWIN(This
);
108 }else if(IsEqualGUID(&IID_IServiceProvider
, riid
)) {
109 TRACE("(%p)->(IID_IServiceProvider, %p)\n", This
, ppvObject
);
110 *ppvObject
= SERVPROV(This
);
111 }else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
)) {
112 TRACE("(%p)->(IID_IOleCommandTarget, %p)\n", This
, ppvObject
);
113 *ppvObject
= CMDTARGET(This
);
114 }else if(IsEqualGUID(&IID_IOleControl
, riid
)) {
115 TRACE("(%p)->(IID_IOleControl, %p)\n", This
, ppvObject
);
116 *ppvObject
= CONTROL(This
);
117 }else if(IsEqualGUID(&IID_IHlinkTarget
, riid
)) {
118 TRACE("(%p)->(IID_IHlinkTarget, %p)\n", This
, ppvObject
);
119 *ppvObject
= HLNKTARGET(This
);
120 }else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
)) {
121 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This
, ppvObject
);
122 *ppvObject
= CONPTCONT(&This
->cp_container
);
123 }else if(IsEqualGUID(&IID_IPersistStreamInit
, riid
)) {
124 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This
, ppvObject
);
125 *ppvObject
= PERSTRINIT(This
);
126 }else if(IsEqualGUID(&IID_ICustomDoc
, riid
)) {
127 TRACE("(%p)->(IID_ICustomDoc %p)\n", This
, ppvObject
);
128 *ppvObject
= CUSTOMDOC(This
);
129 }else if(IsEqualGUID(&DIID_DispHTMLDocument
, riid
)) {
130 TRACE("(%p)->(DIID_DispHTMLDocument %p)\n", This
, ppvObject
);
131 *ppvObject
= HTMLDOC(This
);
132 }else if(IsEqualGUID(&IID_ISupportErrorInfo
, riid
)) {
133 TRACE("(%p)->(IID_ISupportErrorInfo %p)\n", This
, ppvObject
);
134 *ppvObject
= SUPPERRINFO(This
);
135 }else if(IsEqualGUID(&CLSID_CMarkup
, riid
)) {
136 FIXME("(%p)->(CLSID_CMarkup %p)\n", This
, ppvObject
);
137 return E_NOINTERFACE
;
138 }else if(IsEqualGUID(&IID_IRunnableObject
, riid
)) {
139 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This
, ppvObject
);
140 return E_NOINTERFACE
;
141 }else if(IsEqualGUID(&IID_IPersistPropertyBag
, riid
)) {
142 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This
, ppvObject
);
143 return E_NOINTERFACE
;
144 }else if(IsEqualGUID(&IID_IMarshal
, riid
)) {
145 TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This
, ppvObject
);
146 return E_NOINTERFACE
;
147 }else if(dispex_query_interface(&This
->dispex
, riid
, ppvObject
)) {
148 return *ppvObject
? S_OK
: E_NOINTERFACE
;
152 IHTMLDocument2_AddRef(iface
);
156 FIXME("(%p)->(%s %p) interface not supported\n", This
, debugstr_guid(riid
), ppvObject
);
157 return E_NOINTERFACE
;
160 static ULONG WINAPI
HTMLDocument_AddRef(IHTMLDocument2
*iface
)
162 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
163 ULONG ref
= InterlockedIncrement(&This
->ref
);
164 TRACE("(%p) ref = %u\n", This
, ref
);
168 static ULONG WINAPI
HTMLDocument_Release(IHTMLDocument2
*iface
)
170 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
171 ULONG ref
= InterlockedDecrement(&This
->ref
);
173 TRACE("(%p) ref = %u\n", This
, ref
);
176 remove_doc_tasks(This
);
177 release_script_hosts(This
);
180 IOleObject_SetClientSite(OLEOBJ(This
), NULL
);
181 if(This
->in_place_active
)
182 IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(This
));
184 IOleDocumentView_SetInPlaceSite(DOCVIEW(This
), NULL
);
186 IOleUndoManager_Release(This
->undomgr
);
188 set_document_bscallback(This
, NULL
);
189 set_current_mon(This
, NULL
);
191 if(This
->tooltips_hwnd
)
192 DestroyWindow(This
->tooltips_hwnd
);
194 DestroyWindow(This
->hwnd
);
196 if(This
->option_factory
) {
197 This
->option_factory
->doc
= NULL
;
198 IHTMLOptionElementFactory_Release(HTMLOPTFACTORY(This
->option_factory
));
202 This
->location
->doc
= NULL
;
205 IHTMLWindow2_Release(HTMLWINDOW2(This
->window
));
207 if(This
->event_target
)
208 release_event_target(This
->event_target
);
210 heap_free(This
->mime
);
211 detach_selection(This
);
215 ConnectionPointContainer_Destroy(&This
->cp_container
);
218 remove_mutation_observer(This
->nscontainer
, This
->nsdoc
);
219 nsIDOMHTMLDocument_Release(This
->nsdoc
);
221 if(This
->nscontainer
)
222 NSContainer_Release(This
->nscontainer
);
230 static HRESULT WINAPI
HTMLDocument_GetTypeInfoCount(IHTMLDocument2
*iface
, UINT
*pctinfo
)
232 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
234 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This
), pctinfo
);
237 static HRESULT WINAPI
HTMLDocument_GetTypeInfo(IHTMLDocument2
*iface
, UINT iTInfo
,
238 LCID lcid
, ITypeInfo
**ppTInfo
)
240 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
242 return IDispatchEx_GetTypeInfo(DISPATCHEX(This
), iTInfo
, lcid
, ppTInfo
);
245 static HRESULT WINAPI
HTMLDocument_GetIDsOfNames(IHTMLDocument2
*iface
, REFIID riid
,
246 LPOLESTR
*rgszNames
, UINT cNames
,
247 LCID lcid
, DISPID
*rgDispId
)
249 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
251 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
254 static HRESULT WINAPI
HTMLDocument_Invoke(IHTMLDocument2
*iface
, DISPID dispIdMember
,
255 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
256 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
258 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
260 return IDispatchEx_Invoke(DISPATCHEX(This
), dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
261 pVarResult
, pExcepInfo
, puArgErr
);
264 static HRESULT WINAPI
HTMLDocument_get_Script(IHTMLDocument2
*iface
, IDispatch
**p
)
266 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
268 TRACE("(%p)->(%p)\n", This
, p
);
270 *p
= (IDispatch
*)HTMLWINDOW2(This
->window
);
271 IDispatch_AddRef(*p
);
275 static HRESULT WINAPI
HTMLDocument_get_all(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
277 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
278 nsIDOMElement
*nselem
= NULL
;
281 TRACE("(%p)->(%p)\n", This
, p
);
284 WARN("NULL nsdoc\n");
288 nsres
= nsIDOMHTMLDocument_GetDocumentElement(This
->nsdoc
, &nselem
);
289 if(NS_FAILED(nsres
)) {
290 ERR("GetDocumentElement failed: %08x\n", nsres
);
295 *p
= create_all_collection(get_node(This
, (nsIDOMNode
*)nselem
, TRUE
), TRUE
);
296 nsIDOMElement_Release(nselem
);
304 static HRESULT WINAPI
HTMLDocument_get_body(IHTMLDocument2
*iface
, IHTMLElement
**p
)
306 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
307 nsIDOMHTMLElement
*nsbody
= NULL
;
311 TRACE("(%p)->(%p)\n", This
, p
);
314 WARN("NULL nsdoc\n");
318 nsres
= nsIDOMHTMLDocument_GetBody(This
->nsdoc
, &nsbody
);
319 if(NS_FAILED(nsres
)) {
320 TRACE("Could not get body: %08x\n", nsres
);
325 node
= get_node(This
, (nsIDOMNode
*)nsbody
, TRUE
);
326 nsIDOMHTMLElement_Release(nsbody
);
328 IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node
), &IID_IHTMLElement
, (void**)p
);
333 TRACE("*p = %p\n", *p
);
337 static HRESULT WINAPI
HTMLDocument_get_activeElement(IHTMLDocument2
*iface
, IHTMLElement
**p
)
339 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
340 FIXME("(%p)->(%p)\n", This
, p
);
344 static HRESULT WINAPI
HTMLDocument_get_images(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
346 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
347 nsIDOMHTMLCollection
*nscoll
= NULL
;
350 TRACE("(%p)->(%p)\n", This
, p
);
358 WARN("NULL nsdoc\n");
362 nsres
= nsIDOMHTMLDocument_GetImages(This
->nsdoc
, &nscoll
);
363 if(NS_FAILED(nsres
)) {
364 ERR("GetImages failed: %08x\n", nsres
);
369 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
370 nsIDOMElement_Release(nscoll
);
376 static HRESULT WINAPI
HTMLDocument_get_applets(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
378 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
379 nsIDOMHTMLCollection
*nscoll
= NULL
;
382 TRACE("(%p)->(%p)\n", This
, p
);
390 WARN("NULL nsdoc\n");
394 nsres
= nsIDOMHTMLDocument_GetApplets(This
->nsdoc
, &nscoll
);
395 if(NS_FAILED(nsres
)) {
396 ERR("GetApplets failed: %08x\n", nsres
);
401 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
402 nsIDOMElement_Release(nscoll
);
408 static HRESULT WINAPI
HTMLDocument_get_links(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
410 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
411 nsIDOMHTMLCollection
*nscoll
= NULL
;
414 TRACE("(%p)->(%p)\n", This
, p
);
422 WARN("NULL nsdoc\n");
426 nsres
= nsIDOMHTMLDocument_GetLinks(This
->nsdoc
, &nscoll
);
427 if(NS_FAILED(nsres
)) {
428 ERR("GetLinks failed: %08x\n", nsres
);
433 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
434 nsIDOMElement_Release(nscoll
);
440 static HRESULT WINAPI
HTMLDocument_get_forms(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
442 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
443 nsIDOMHTMLCollection
*nscoll
= NULL
;
446 TRACE("(%p)->(%p)\n", This
, p
);
454 WARN("NULL nsdoc\n");
458 nsres
= nsIDOMHTMLDocument_GetForms(This
->nsdoc
, &nscoll
);
459 if(NS_FAILED(nsres
)) {
460 ERR("GetForms failed: %08x\n", nsres
);
465 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
466 nsIDOMElement_Release(nscoll
);
472 static HRESULT WINAPI
HTMLDocument_get_anchors(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
474 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
475 nsIDOMHTMLCollection
*nscoll
= NULL
;
478 TRACE("(%p)->(%p)\n", This
, p
);
486 WARN("NULL nsdoc\n");
490 nsres
= nsIDOMHTMLDocument_GetAnchors(This
->nsdoc
, &nscoll
);
491 if(NS_FAILED(nsres
)) {
492 ERR("GetAnchors failed: %08x\n", nsres
);
497 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
498 nsIDOMElement_Release(nscoll
);
504 static HRESULT WINAPI
HTMLDocument_put_title(IHTMLDocument2
*iface
, BSTR v
)
506 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
510 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
513 WARN("NULL nsdoc\n");
517 nsAString_Init(&nsstr
, v
);
518 nsres
= nsIDOMHTMLDocument_SetTitle(This
->nsdoc
, &nsstr
);
519 nsAString_Finish(&nsstr
);
521 ERR("SetTitle failed: %08x\n", nsres
);
526 static HRESULT WINAPI
HTMLDocument_get_title(IHTMLDocument2
*iface
, BSTR
*p
)
528 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
529 const PRUnichar
*ret
;
533 TRACE("(%p)->(%p)\n", This
, p
);
536 WARN("NULL nsdoc\n");
541 nsAString_Init(&nsstr
, NULL
);
542 nsres
= nsIDOMHTMLDocument_GetTitle(This
->nsdoc
, &nsstr
);
543 if (NS_SUCCEEDED(nsres
)) {
544 nsAString_GetData(&nsstr
, &ret
);
545 *p
= SysAllocString(ret
);
547 nsAString_Finish(&nsstr
);
549 if(NS_FAILED(nsres
)) {
550 ERR("GetTitle failed: %08x\n", nsres
);
557 static HRESULT WINAPI
HTMLDocument_get_scripts(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
559 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
560 FIXME("(%p)->(%p)\n", This
, p
);
564 static HRESULT WINAPI
HTMLDocument_put_designMode(IHTMLDocument2
*iface
, BSTR v
)
566 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
567 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
571 static HRESULT WINAPI
HTMLDocument_get_designMode(IHTMLDocument2
*iface
, BSTR
*p
)
573 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
574 static WCHAR szOff
[] = {'O','f','f',0};
575 FIXME("(%p)->(%p) always returning Off\n", This
, p
);
580 *p
= SysAllocString(szOff
);
585 static HRESULT WINAPI
HTMLDocument_get_selection(IHTMLDocument2
*iface
, IHTMLSelectionObject
**p
)
587 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
588 nsISelection
*nsselection
= NULL
;
590 TRACE("(%p)->(%p)\n", This
, p
);
592 if(This
->nscontainer
) {
593 nsIDOMWindow
*dom_window
= NULL
;
595 nsIWebBrowser_GetContentDOMWindow(This
->nscontainer
->webbrowser
, &dom_window
);
597 nsIDOMWindow_GetSelection(dom_window
, &nsselection
);
598 nsIDOMWindow_Release(dom_window
);
602 *p
= HTMLSelectionObject_Create(This
, nsselection
);
606 static HRESULT WINAPI
HTMLDocument_get_readyState(IHTMLDocument2
*iface
, BSTR
*p
)
608 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
610 static const WCHAR wszUninitialized
[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
611 static const WCHAR wszLoading
[] = {'l','o','a','d','i','n','g',0};
612 static const WCHAR wszLoaded
[] = {'l','o','a','d','e','d',0};
613 static const WCHAR wszInteractive
[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
614 static const WCHAR wszComplete
[] = {'c','o','m','p','l','e','t','e',0};
616 static const LPCWSTR readystate_str
[] = {
624 TRACE("(%p)->(%p)\n", iface
, p
);
629 *p
= SysAllocString(readystate_str
[This
->readystate
]);
633 static HRESULT WINAPI
HTMLDocument_get_frames(IHTMLDocument2
*iface
, IHTMLFramesCollection2
**p
)
635 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
636 FIXME("(%p)->(%p)\n", This
, p
);
640 static HRESULT WINAPI
HTMLDocument_get_embeds(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
642 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
643 FIXME("(%p)->(%p)\n", This
, p
);
647 static HRESULT WINAPI
HTMLDocument_get_plugins(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
649 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
650 FIXME("(%p)->(%p)\n", This
, p
);
654 static HRESULT WINAPI
HTMLDocument_put_alinkColor(IHTMLDocument2
*iface
, VARIANT v
)
656 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
657 FIXME("(%p)\n", This
);
661 static HRESULT WINAPI
HTMLDocument_get_alinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
663 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
664 FIXME("(%p)->(%p)\n", This
, p
);
668 static HRESULT WINAPI
HTMLDocument_put_bgColor(IHTMLDocument2
*iface
, VARIANT v
)
670 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
671 FIXME("(%p)\n", This
);
675 static HRESULT WINAPI
HTMLDocument_get_bgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
677 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
678 FIXME("(%p)->(%p)\n", This
, p
);
682 static HRESULT WINAPI
HTMLDocument_put_fgColor(IHTMLDocument2
*iface
, VARIANT v
)
684 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
685 FIXME("(%p)\n", This
);
689 static HRESULT WINAPI
HTMLDocument_get_fgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
691 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
692 FIXME("(%p)->(%p)\n", This
, p
);
696 static HRESULT WINAPI
HTMLDocument_put_linkColor(IHTMLDocument2
*iface
, VARIANT v
)
698 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
699 FIXME("(%p)->()\n", This
);
703 static HRESULT WINAPI
HTMLDocument_get_linkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
705 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
706 FIXME("(%p)->(%p)\n", This
, p
);
710 static HRESULT WINAPI
HTMLDocument_put_vlinkColor(IHTMLDocument2
*iface
, VARIANT v
)
712 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
713 FIXME("(%p)\n", This
);
717 static HRESULT WINAPI
HTMLDocument_get_vlinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
719 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
720 FIXME("(%p)->(%p)\n", This
, p
);
724 static HRESULT WINAPI
HTMLDocument_get_referrer(IHTMLDocument2
*iface
, BSTR
*p
)
726 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
727 FIXME("(%p)->(%p)\n", This
, p
);
731 static HRESULT WINAPI
HTMLDocument_get_location(IHTMLDocument2
*iface
, IHTMLLocation
**p
)
733 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
735 TRACE("(%p)->(%p)\n", This
, p
);
738 IHTMLLocation_AddRef(HTMLLOCATION(This
->location
));
740 This
->location
= HTMLLocation_Create(This
);
742 *p
= HTMLLOCATION(This
->location
);
746 static HRESULT WINAPI
HTMLDocument_get_lastModified(IHTMLDocument2
*iface
, BSTR
*p
)
748 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
749 FIXME("(%p)->(%p)\n", This
, p
);
753 static HRESULT WINAPI
HTMLDocument_put_URL(IHTMLDocument2
*iface
, BSTR v
)
755 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
756 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
760 static HRESULT WINAPI
HTMLDocument_get_URL(IHTMLDocument2
*iface
, BSTR
*p
)
762 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
764 static const WCHAR about_blank_url
[] =
765 {'a','b','o','u','t',':','b','l','a','n','k',0};
767 TRACE("(%p)->(%p)\n", iface
, p
);
769 *p
= SysAllocString(This
->url
? This
->url
: about_blank_url
);
773 static HRESULT WINAPI
HTMLDocument_put_domain(IHTMLDocument2
*iface
, BSTR v
)
775 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
776 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
780 static HRESULT WINAPI
HTMLDocument_get_domain(IHTMLDocument2
*iface
, BSTR
*p
)
782 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
783 FIXME("(%p)->(%p)\n", This
, p
);
787 static HRESULT WINAPI
HTMLDocument_put_cookie(IHTMLDocument2
*iface
, BSTR v
)
789 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
790 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
794 static HRESULT WINAPI
HTMLDocument_get_cookie(IHTMLDocument2
*iface
, BSTR
*p
)
796 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
797 FIXME("(%p)->(%p)\n", This
, p
);
801 static HRESULT WINAPI
HTMLDocument_put_expando(IHTMLDocument2
*iface
, VARIANT_BOOL v
)
803 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
804 FIXME("(%p)->(%x)\n", This
, v
);
808 static HRESULT WINAPI
HTMLDocument_get_expando(IHTMLDocument2
*iface
, VARIANT_BOOL
*p
)
810 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
811 FIXME("(%p)->(%p)\n", This
, p
);
815 static HRESULT WINAPI
HTMLDocument_put_charset(IHTMLDocument2
*iface
, BSTR v
)
817 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
818 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
822 static HRESULT WINAPI
HTMLDocument_get_charset(IHTMLDocument2
*iface
, BSTR
*p
)
824 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
825 FIXME("(%p)->(%p)\n", This
, p
);
829 static HRESULT WINAPI
HTMLDocument_put_defaultCharset(IHTMLDocument2
*iface
, BSTR v
)
831 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
832 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
836 static HRESULT WINAPI
HTMLDocument_get_defaultCharset(IHTMLDocument2
*iface
, BSTR
*p
)
838 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
839 FIXME("(%p)->(%p)\n", This
, p
);
843 static HRESULT WINAPI
HTMLDocument_get_mimeType(IHTMLDocument2
*iface
, BSTR
*p
)
845 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
846 FIXME("(%p)->(%p)\n", This
, p
);
850 static HRESULT WINAPI
HTMLDocument_get_fileSize(IHTMLDocument2
*iface
, BSTR
*p
)
852 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
853 FIXME("(%p)->(%p)\n", This
, p
);
857 static HRESULT WINAPI
HTMLDocument_get_fileCreatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
859 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
860 FIXME("(%p)->(%p)\n", This
, p
);
864 static HRESULT WINAPI
HTMLDocument_get_fileModifiedDate(IHTMLDocument2
*iface
, BSTR
*p
)
866 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
867 FIXME("(%p)->(%p)\n", This
, p
);
871 static HRESULT WINAPI
HTMLDocument_get_fileUpdatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
873 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
874 FIXME("(%p)->(%p)\n", This
, p
);
878 static HRESULT WINAPI
HTMLDocument_get_security(IHTMLDocument2
*iface
, BSTR
*p
)
880 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
881 FIXME("(%p)->(%p)\n", This
, p
);
885 static HRESULT WINAPI
HTMLDocument_get_protocol(IHTMLDocument2
*iface
, BSTR
*p
)
887 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
888 FIXME("(%p)->(%p)\n", This
, p
);
892 static HRESULT WINAPI
HTMLDocument_get_nameProp(IHTMLDocument2
*iface
, BSTR
*p
)
894 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
895 FIXME("(%p)->(%p)\n", This
, p
);
899 static HRESULT WINAPI
HTMLDocument_write(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
901 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
908 TRACE("(%p)->(%p)\n", iface
, psarray
);
911 WARN("NULL nsdoc\n");
915 if(psarray
->cDims
!= 1) {
916 FIXME("cDims=%d\n", psarray
->cDims
);
920 hres
= SafeArrayAccessData(psarray
, (void**)&var
);
922 WARN("SafeArrayAccessData failed: %08x\n", hres
);
926 nsAString_Init(&nsstr
, NULL
);
928 for(i
=0; i
< psarray
->rgsabound
[0].cElements
; i
++) {
929 if(V_VT(var
+i
) == VT_BSTR
) {
930 nsAString_SetData(&nsstr
, V_BSTR(var
+i
));
931 nsres
= nsIDOMHTMLDocument_Write(This
->nsdoc
, &nsstr
);
933 ERR("Write failed: %08x\n", nsres
);
935 FIXME("vt=%d\n", V_VT(var
+i
));
939 nsAString_Finish(&nsstr
);
940 SafeArrayUnaccessData(psarray
);
945 static HRESULT WINAPI
HTMLDocument_writeln(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
947 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
948 FIXME("(%p)->(%p)\n", This
, psarray
);
952 static HRESULT WINAPI
HTMLDocument_open(IHTMLDocument2
*iface
, BSTR url
, VARIANT name
,
953 VARIANT features
, VARIANT replace
, IDispatch
**pomWindowResult
)
955 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
958 static const WCHAR text_htmlW
[] = {'t','e','x','t','/','h','t','m','l',0};
960 TRACE("(%p)->(%s %s %s %s %p)\n", This
, debugstr_w(url
), debugstr_variant(&name
),
961 debugstr_variant(&features
), debugstr_variant(&replace
), pomWindowResult
);
968 if(!url
|| strcmpW(url
, text_htmlW
) || V_VT(&name
) != VT_ERROR
969 || V_VT(&features
) != VT_ERROR
|| V_VT(&replace
) != VT_ERROR
)
970 FIXME("unsupported args\n");
972 nsres
= nsIDOMHTMLDocument_Open(This
->nsdoc
);
973 if(NS_FAILED(nsres
)) {
974 ERR("Open failed: %08x\n", nsres
);
978 *pomWindowResult
= (IDispatch
*)HTMLWINDOW2(This
->window
);
979 IHTMLWindow2_AddRef(HTMLWINDOW2(This
->window
));
983 static HRESULT WINAPI
HTMLDocument_close(IHTMLDocument2
*iface
)
985 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
988 TRACE("(%p)\n", This
);
995 nsres
= nsIDOMHTMLDocument_Close(This
->nsdoc
);
996 if(NS_FAILED(nsres
)) {
997 ERR("Close failed: %08x\n", nsres
);
1004 static HRESULT WINAPI
HTMLDocument_clear(IHTMLDocument2
*iface
)
1006 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1007 FIXME("(%p)\n", This
);
1011 static HRESULT WINAPI
HTMLDocument_queryCommandSupported(IHTMLDocument2
*iface
, BSTR cmdID
,
1012 VARIANT_BOOL
*pfRet
)
1014 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1015 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1019 static HRESULT WINAPI
HTMLDocument_queryCommandEnabled(IHTMLDocument2
*iface
, BSTR cmdID
,
1020 VARIANT_BOOL
*pfRet
)
1022 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1023 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1027 static HRESULT WINAPI
HTMLDocument_queryCommandState(IHTMLDocument2
*iface
, BSTR cmdID
,
1028 VARIANT_BOOL
*pfRet
)
1030 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1031 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1035 static HRESULT WINAPI
HTMLDocument_queryCommandIndeterm(IHTMLDocument2
*iface
, BSTR cmdID
,
1036 VARIANT_BOOL
*pfRet
)
1038 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1039 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1043 static HRESULT WINAPI
HTMLDocument_queryCommandText(IHTMLDocument2
*iface
, BSTR cmdID
,
1046 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1047 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1051 static HRESULT WINAPI
HTMLDocument_queryCommandValue(IHTMLDocument2
*iface
, BSTR cmdID
,
1054 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1055 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1059 static HRESULT WINAPI
HTMLDocument_execCommand(IHTMLDocument2
*iface
, BSTR cmdID
,
1060 VARIANT_BOOL showUI
, VARIANT value
, VARIANT_BOOL
*pfRet
)
1062 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1063 FIXME("(%p)->(%s %x %p)\n", This
, debugstr_w(cmdID
), showUI
, pfRet
);
1067 static HRESULT WINAPI
HTMLDocument_execCommandShowHelp(IHTMLDocument2
*iface
, BSTR cmdID
,
1068 VARIANT_BOOL
*pfRet
)
1070 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1071 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1075 static HRESULT WINAPI
HTMLDocument_createElement(IHTMLDocument2
*iface
, BSTR eTag
,
1076 IHTMLElement
**newElem
)
1078 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1079 nsIDOMElement
*nselem
;
1084 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eTag
), newElem
);
1087 WARN("NULL nsdoc\n");
1088 return E_UNEXPECTED
;
1091 nsAString_Init(&tag_str
, eTag
);
1092 nsres
= nsIDOMDocument_CreateElement(This
->nsdoc
, &tag_str
, &nselem
);
1093 nsAString_Finish(&tag_str
);
1094 if(NS_FAILED(nsres
)) {
1095 ERR("CreateElement failed: %08x\n", nsres
);
1099 elem
= HTMLElement_Create(This
, (nsIDOMNode
*)nselem
, TRUE
);
1100 nsIDOMElement_Release(nselem
);
1102 *newElem
= HTMLELEM(elem
);
1103 IHTMLElement_AddRef(HTMLELEM(elem
));
1107 static HRESULT WINAPI
HTMLDocument_put_onhelp(IHTMLDocument2
*iface
, VARIANT v
)
1109 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1110 FIXME("(%p)\n", This
);
1114 static HRESULT WINAPI
HTMLDocument_get_onhelp(IHTMLDocument2
*iface
, VARIANT
*p
)
1116 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1117 FIXME("(%p)->(%p)\n", This
, p
);
1121 static HRESULT WINAPI
HTMLDocument_put_onclick(IHTMLDocument2
*iface
, VARIANT v
)
1123 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1124 FIXME("(%p)\n", This
);
1128 static HRESULT WINAPI
HTMLDocument_get_onclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1130 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1131 FIXME("(%p)->(%p)\n", This
, p
);
1135 static HRESULT WINAPI
HTMLDocument_put_ondblclick(IHTMLDocument2
*iface
, VARIANT v
)
1137 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1138 FIXME("(%p)\n", This
);
1142 static HRESULT WINAPI
HTMLDocument_get_ondblclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1144 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1145 FIXME("(%p)->(%p)\n", This
, p
);
1149 static HRESULT WINAPI
HTMLDocument_put_onkeyup(IHTMLDocument2
*iface
, VARIANT v
)
1151 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1153 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1155 return set_doc_event(This
, EVENTID_KEYUP
, &v
);
1158 static HRESULT WINAPI
HTMLDocument_get_onkeyup(IHTMLDocument2
*iface
, VARIANT
*p
)
1160 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1162 TRACE("(%p)->(%p)\n", This
, p
);
1164 return get_doc_event(This
, EVENTID_KEYUP
, p
);
1167 static HRESULT WINAPI
HTMLDocument_put_onkeydown(IHTMLDocument2
*iface
, VARIANT v
)
1169 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1171 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1173 return set_doc_event(This
, EVENTID_KEYDOWN
, &v
);
1176 static HRESULT WINAPI
HTMLDocument_get_onkeydown(IHTMLDocument2
*iface
, VARIANT
*p
)
1178 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1180 TRACE("(%p)->(%p)\n", This
, p
);
1182 return get_doc_event(This
, EVENTID_KEYDOWN
, p
);
1185 static HRESULT WINAPI
HTMLDocument_put_onkeypress(IHTMLDocument2
*iface
, VARIANT v
)
1187 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1188 FIXME("(%p)\n", This
);
1192 static HRESULT WINAPI
HTMLDocument_get_onkeypress(IHTMLDocument2
*iface
, VARIANT
*p
)
1194 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1195 FIXME("(%p)->(%p)\n", This
, p
);
1199 static HRESULT WINAPI
HTMLDocument_put_onmouseup(IHTMLDocument2
*iface
, VARIANT v
)
1201 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1202 FIXME("(%p)\n", This
);
1206 static HRESULT WINAPI
HTMLDocument_get_onmouseup(IHTMLDocument2
*iface
, VARIANT
*p
)
1208 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1209 FIXME("(%p)->(%p)\n", This
, p
);
1213 static HRESULT WINAPI
HTMLDocument_put_onmousedown(IHTMLDocument2
*iface
, VARIANT v
)
1215 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1216 FIXME("(%p)\n", This
);
1220 static HRESULT WINAPI
HTMLDocument_get_onmousedown(IHTMLDocument2
*iface
, VARIANT
*p
)
1222 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1223 FIXME("(%p)->(%p)\n", This
, p
);
1227 static HRESULT WINAPI
HTMLDocument_put_onmousemove(IHTMLDocument2
*iface
, VARIANT v
)
1229 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1230 FIXME("(%p)\n", This
);
1234 static HRESULT WINAPI
HTMLDocument_get_onmousemove(IHTMLDocument2
*iface
, VARIANT
*p
)
1236 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1237 FIXME("(%p)->(%p)\n", This
, p
);
1241 static HRESULT WINAPI
HTMLDocument_put_onmouseout(IHTMLDocument2
*iface
, VARIANT v
)
1243 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1244 FIXME("(%p)\n", This
);
1248 static HRESULT WINAPI
HTMLDocument_get_onmouseout(IHTMLDocument2
*iface
, VARIANT
*p
)
1250 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1251 FIXME("(%p)->(%p)\n", This
, p
);
1255 static HRESULT WINAPI
HTMLDocument_put_onmouseover(IHTMLDocument2
*iface
, VARIANT v
)
1257 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1259 TRACE("(%p)\n", This
);
1261 return set_doc_event(This
, EVENTID_MOUSEOVER
, &v
);
1264 static HRESULT WINAPI
HTMLDocument_get_onmouseover(IHTMLDocument2
*iface
, VARIANT
*p
)
1266 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1268 TRACE("(%p)->(%p)\n", This
, p
);
1270 return get_doc_event(This
, EVENTID_MOUSEOVER
, p
);
1273 static HRESULT WINAPI
HTMLDocument_put_onreadystatechange(IHTMLDocument2
*iface
, VARIANT v
)
1275 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1276 FIXME("(%p)\n", This
);
1280 static HRESULT WINAPI
HTMLDocument_get_onreadystatechange(IHTMLDocument2
*iface
, VARIANT
*p
)
1282 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1283 FIXME("(%p)->(%p)\n", This
, p
);
1287 static HRESULT WINAPI
HTMLDocument_put_onafterupdate(IHTMLDocument2
*iface
, VARIANT v
)
1289 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1290 FIXME("(%p)\n", This
);
1294 static HRESULT WINAPI
HTMLDocument_get_onafterupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1296 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1297 FIXME("(%p)->(%p)\n", This
, p
);
1301 static HRESULT WINAPI
HTMLDocument_put_onrowexit(IHTMLDocument2
*iface
, VARIANT v
)
1303 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1304 FIXME("(%p)\n", This
);
1308 static HRESULT WINAPI
HTMLDocument_get_onrowexit(IHTMLDocument2
*iface
, VARIANT
*p
)
1310 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1311 FIXME("(%p)->(%p)\n", This
, p
);
1315 static HRESULT WINAPI
HTMLDocument_put_onrowenter(IHTMLDocument2
*iface
, VARIANT v
)
1317 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1318 FIXME("(%p)\n", This
);
1322 static HRESULT WINAPI
HTMLDocument_get_onrowenter(IHTMLDocument2
*iface
, VARIANT
*p
)
1324 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1325 FIXME("(%p)->(%p)\n", This
, p
);
1329 static HRESULT WINAPI
HTMLDocument_put_ondragstart(IHTMLDocument2
*iface
, VARIANT v
)
1331 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1333 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1335 return set_doc_event(This
, EVENTID_DRAGSTART
, &v
);
1338 static HRESULT WINAPI
HTMLDocument_get_ondragstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1340 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1342 TRACE("(%p)->(%p)\n", This
, p
);
1344 return get_doc_event(This
, EVENTID_DRAGSTART
, p
);
1347 static HRESULT WINAPI
HTMLDocument_put_onselectstart(IHTMLDocument2
*iface
, VARIANT v
)
1349 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1351 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1353 return set_doc_event(This
, EVENTID_SELECTSTART
, &v
);
1356 static HRESULT WINAPI
HTMLDocument_get_onselectstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1358 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1360 TRACE("(%p)->(%p)\n", This
, p
);
1362 return get_doc_event(This
, EVENTID_SELECTSTART
, p
);
1365 static HRESULT WINAPI
HTMLDocument_elementFromPoint(IHTMLDocument2
*iface
, long x
, long y
,
1366 IHTMLElement
**elementHit
)
1368 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1369 FIXME("(%p)->(%ld %ld %p)\n", This
, x
, y
, elementHit
);
1373 static HRESULT WINAPI
HTMLDocument_get_parentWindow(IHTMLDocument2
*iface
, IHTMLWindow2
**p
)
1375 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1377 TRACE("(%p)->(%p)\n", This
, p
);
1379 *p
= HTMLWINDOW2(This
->window
);
1380 IHTMLWindow2_AddRef(*p
);
1384 static HRESULT WINAPI
HTMLDocument_get_styleSheets(IHTMLDocument2
*iface
,
1385 IHTMLStyleSheetsCollection
**p
)
1387 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1388 nsIDOMStyleSheetList
*nsstylelist
;
1389 nsIDOMDocumentStyle
*nsdocstyle
;
1392 TRACE("(%p)->(%p)\n", This
, p
);
1397 WARN("NULL nsdoc\n");
1398 return E_UNEXPECTED
;
1401 nsIDOMHTMLDocument_QueryInterface(This
->nsdoc
, &IID_nsIDOMDocumentStyle
, (void**)&nsdocstyle
);
1402 nsres
= nsIDOMDocumentStyle_GetStyleSheets(nsdocstyle
, &nsstylelist
);
1403 nsIDOMDocumentStyle_Release(nsdocstyle
);
1404 if(NS_FAILED(nsres
)) {
1405 ERR("GetStyleSheets failed: %08x\n", nsres
);
1409 *p
= HTMLStyleSheetsCollection_Create(nsstylelist
);
1410 nsIDOMDocumentStyle_Release(nsstylelist
);
1415 static HRESULT WINAPI
HTMLDocument_put_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT v
)
1417 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1418 FIXME("(%p)\n", This
);
1422 static HRESULT WINAPI
HTMLDocument_get_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1424 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1425 FIXME("(%p)->(%p)\n", This
, p
);
1429 static HRESULT WINAPI
HTMLDocument_put_onerrorupdate(IHTMLDocument2
*iface
, VARIANT v
)
1431 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1432 FIXME("(%p)\n", This
);
1436 static HRESULT WINAPI
HTMLDocument_get_onerrorupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1438 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1439 FIXME("(%p)->(%p)\n", This
, p
);
1443 static HRESULT WINAPI
HTMLDocument_toString(IHTMLDocument2
*iface
, BSTR
*String
)
1445 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1446 FIXME("(%p)->(%p)\n", This
, String
);
1450 static HRESULT WINAPI
HTMLDocument_createStyleSheet(IHTMLDocument2
*iface
, BSTR bstrHref
,
1451 long lIndex
, IHTMLStyleSheet
**ppnewStyleSheet
)
1453 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1455 FIXME("(%p)->(%s %ld %p) semi-stub\n", This
, debugstr_w(bstrHref
), lIndex
, ppnewStyleSheet
);
1457 *ppnewStyleSheet
= HTMLStyleSheet_Create(NULL
);
1461 static const IHTMLDocument2Vtbl HTMLDocumentVtbl
= {
1462 HTMLDocument_QueryInterface
,
1463 HTMLDocument_AddRef
,
1464 HTMLDocument_Release
,
1465 HTMLDocument_GetTypeInfoCount
,
1466 HTMLDocument_GetTypeInfo
,
1467 HTMLDocument_GetIDsOfNames
,
1468 HTMLDocument_Invoke
,
1469 HTMLDocument_get_Script
,
1470 HTMLDocument_get_all
,
1471 HTMLDocument_get_body
,
1472 HTMLDocument_get_activeElement
,
1473 HTMLDocument_get_images
,
1474 HTMLDocument_get_applets
,
1475 HTMLDocument_get_links
,
1476 HTMLDocument_get_forms
,
1477 HTMLDocument_get_anchors
,
1478 HTMLDocument_put_title
,
1479 HTMLDocument_get_title
,
1480 HTMLDocument_get_scripts
,
1481 HTMLDocument_put_designMode
,
1482 HTMLDocument_get_designMode
,
1483 HTMLDocument_get_selection
,
1484 HTMLDocument_get_readyState
,
1485 HTMLDocument_get_frames
,
1486 HTMLDocument_get_embeds
,
1487 HTMLDocument_get_plugins
,
1488 HTMLDocument_put_alinkColor
,
1489 HTMLDocument_get_alinkColor
,
1490 HTMLDocument_put_bgColor
,
1491 HTMLDocument_get_bgColor
,
1492 HTMLDocument_put_fgColor
,
1493 HTMLDocument_get_fgColor
,
1494 HTMLDocument_put_linkColor
,
1495 HTMLDocument_get_linkColor
,
1496 HTMLDocument_put_vlinkColor
,
1497 HTMLDocument_get_vlinkColor
,
1498 HTMLDocument_get_referrer
,
1499 HTMLDocument_get_location
,
1500 HTMLDocument_get_lastModified
,
1501 HTMLDocument_put_URL
,
1502 HTMLDocument_get_URL
,
1503 HTMLDocument_put_domain
,
1504 HTMLDocument_get_domain
,
1505 HTMLDocument_put_cookie
,
1506 HTMLDocument_get_cookie
,
1507 HTMLDocument_put_expando
,
1508 HTMLDocument_get_expando
,
1509 HTMLDocument_put_charset
,
1510 HTMLDocument_get_charset
,
1511 HTMLDocument_put_defaultCharset
,
1512 HTMLDocument_get_defaultCharset
,
1513 HTMLDocument_get_mimeType
,
1514 HTMLDocument_get_fileSize
,
1515 HTMLDocument_get_fileCreatedDate
,
1516 HTMLDocument_get_fileModifiedDate
,
1517 HTMLDocument_get_fileUpdatedDate
,
1518 HTMLDocument_get_security
,
1519 HTMLDocument_get_protocol
,
1520 HTMLDocument_get_nameProp
,
1522 HTMLDocument_writeln
,
1526 HTMLDocument_queryCommandSupported
,
1527 HTMLDocument_queryCommandEnabled
,
1528 HTMLDocument_queryCommandState
,
1529 HTMLDocument_queryCommandIndeterm
,
1530 HTMLDocument_queryCommandText
,
1531 HTMLDocument_queryCommandValue
,
1532 HTMLDocument_execCommand
,
1533 HTMLDocument_execCommandShowHelp
,
1534 HTMLDocument_createElement
,
1535 HTMLDocument_put_onhelp
,
1536 HTMLDocument_get_onhelp
,
1537 HTMLDocument_put_onclick
,
1538 HTMLDocument_get_onclick
,
1539 HTMLDocument_put_ondblclick
,
1540 HTMLDocument_get_ondblclick
,
1541 HTMLDocument_put_onkeyup
,
1542 HTMLDocument_get_onkeyup
,
1543 HTMLDocument_put_onkeydown
,
1544 HTMLDocument_get_onkeydown
,
1545 HTMLDocument_put_onkeypress
,
1546 HTMLDocument_get_onkeypress
,
1547 HTMLDocument_put_onmouseup
,
1548 HTMLDocument_get_onmouseup
,
1549 HTMLDocument_put_onmousedown
,
1550 HTMLDocument_get_onmousedown
,
1551 HTMLDocument_put_onmousemove
,
1552 HTMLDocument_get_onmousemove
,
1553 HTMLDocument_put_onmouseout
,
1554 HTMLDocument_get_onmouseout
,
1555 HTMLDocument_put_onmouseover
,
1556 HTMLDocument_get_onmouseover
,
1557 HTMLDocument_put_onreadystatechange
,
1558 HTMLDocument_get_onreadystatechange
,
1559 HTMLDocument_put_onafterupdate
,
1560 HTMLDocument_get_onafterupdate
,
1561 HTMLDocument_put_onrowexit
,
1562 HTMLDocument_get_onrowexit
,
1563 HTMLDocument_put_onrowenter
,
1564 HTMLDocument_get_onrowenter
,
1565 HTMLDocument_put_ondragstart
,
1566 HTMLDocument_get_ondragstart
,
1567 HTMLDocument_put_onselectstart
,
1568 HTMLDocument_get_onselectstart
,
1569 HTMLDocument_elementFromPoint
,
1570 HTMLDocument_get_parentWindow
,
1571 HTMLDocument_get_styleSheets
,
1572 HTMLDocument_put_onbeforeupdate
,
1573 HTMLDocument_get_onbeforeupdate
,
1574 HTMLDocument_put_onerrorupdate
,
1575 HTMLDocument_get_onerrorupdate
,
1576 HTMLDocument_toString
,
1577 HTMLDocument_createStyleSheet
1580 #define SUPPINFO_THIS(iface) DEFINE_THIS(HTMLDocument, SupportErrorInfo, iface)
1582 static HRESULT WINAPI
SupportErrorInfo_QueryInterface(ISupportErrorInfo
*iface
, REFIID riid
, void **ppv
)
1584 HTMLDocument
*This
= SUPPINFO_THIS(iface
);
1585 return IHTMLDocument_QueryInterface(HTMLDOC(This
), riid
, ppv
);
1588 static ULONG WINAPI
SupportErrorInfo_AddRef(ISupportErrorInfo
*iface
)
1590 HTMLDocument
*This
= SUPPINFO_THIS(iface
);
1591 return IHTMLDocument_AddRef(HTMLDOC(This
));
1594 static ULONG WINAPI
SupportErrorInfo_Release(ISupportErrorInfo
*iface
)
1596 HTMLDocument
*This
= SUPPINFO_THIS(iface
);
1597 return IHTMLDocument_Release(HTMLDOC(This
));
1600 static HRESULT WINAPI
SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo
*iface
, REFIID riid
)
1602 FIXME("(%p)->(%s)\n", iface
, debugstr_guid(riid
));
1606 static const ISupportErrorInfoVtbl SupportErrorInfoVtbl
= {
1607 SupportErrorInfo_QueryInterface
,
1608 SupportErrorInfo_AddRef
,
1609 SupportErrorInfo_Release
,
1610 SupportErrorInfo_InterfaceSupportsErrorInfo
1613 #define DISPEX_THIS(iface) DEFINE_THIS(HTMLDocument, IDispatchEx, iface)
1615 static HRESULT WINAPI
DocDispatchEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
1617 HTMLDocument
*This
= DISPEX_THIS(iface
);
1619 return IHTMLDocument2_QueryInterface(HTMLDOC(This
), riid
, ppv
);
1622 static ULONG WINAPI
DocDispatchEx_AddRef(IDispatchEx
*iface
)
1624 HTMLDocument
*This
= DISPEX_THIS(iface
);
1626 return IHTMLDocument2_AddRef(HTMLDOC(This
));
1629 static ULONG WINAPI
DocDispatchEx_Release(IDispatchEx
*iface
)
1631 HTMLDocument
*This
= DISPEX_THIS(iface
);
1633 return IHTMLDocument2_Release(HTMLDOC(This
));
1636 static HRESULT WINAPI
DocDispatchEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
1638 HTMLDocument
*This
= DISPEX_THIS(iface
);
1640 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This
->dispex
), pctinfo
);
1643 static HRESULT WINAPI
DocDispatchEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
1644 LCID lcid
, ITypeInfo
**ppTInfo
)
1646 HTMLDocument
*This
= DISPEX_THIS(iface
);
1648 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This
->dispex
), iTInfo
, lcid
, ppTInfo
);
1651 static HRESULT WINAPI
DocDispatchEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
1652 LPOLESTR
*rgszNames
, UINT cNames
,
1653 LCID lcid
, DISPID
*rgDispId
)
1655 HTMLDocument
*This
= DISPEX_THIS(iface
);
1657 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This
->dispex
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1660 static HRESULT WINAPI
DocDispatchEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
1661 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1662 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1664 HTMLDocument
*This
= DISPEX_THIS(iface
);
1666 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
1667 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1669 switch(dispIdMember
) {
1670 case DISPID_READYSTATE
:
1671 TRACE("DISPID_READYSTATE\n");
1673 if(!(wFlags
& DISPATCH_PROPERTYGET
))
1674 return E_INVALIDARG
;
1676 V_VT(pVarResult
) = VT_I4
;
1677 V_I4(pVarResult
) = This
->readystate
;
1681 return IDispatchEx_Invoke(DISPATCHEX(&This
->dispex
), dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
1682 pVarResult
, pExcepInfo
, puArgErr
);
1685 static HRESULT WINAPI
DocDispatchEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
1687 HTMLDocument
*This
= DISPEX_THIS(iface
);
1689 return IDispatchEx_GetDispID(DISPATCHEX(&This
->dispex
), bstrName
, grfdex
, pid
);
1692 static HRESULT WINAPI
DocDispatchEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
1693 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
1695 HTMLDocument
*This
= DISPEX_THIS(iface
);
1697 return IDispatchEx_InvokeEx(DISPATCHEX(&This
->dispex
), id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
1700 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
1702 HTMLDocument
*This
= DISPEX_THIS(iface
);
1704 return IDispatchEx_DeleteMemberByName(DISPATCHEX(&This
->dispex
), bstrName
, grfdex
);
1707 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
1709 HTMLDocument
*This
= DISPEX_THIS(iface
);
1711 return IDispatchEx_DeleteMemberByDispID(DISPATCHEX(&This
->dispex
), id
);
1714 static HRESULT WINAPI
DocDispatchEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
1716 HTMLDocument
*This
= DISPEX_THIS(iface
);
1718 return IDispatchEx_GetMemberProperties(DISPATCHEX(&This
->dispex
), id
, grfdexFetch
, pgrfdex
);
1721 static HRESULT WINAPI
DocDispatchEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
1723 HTMLDocument
*This
= DISPEX_THIS(iface
);
1725 return IDispatchEx_GetMemberName(DISPATCHEX(&This
->dispex
), id
, pbstrName
);
1728 static HRESULT WINAPI
DocDispatchEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
1730 HTMLDocument
*This
= DISPEX_THIS(iface
);
1732 return IDispatchEx_GetNextDispID(DISPATCHEX(&This
->dispex
), grfdex
, id
, pid
);
1735 static HRESULT WINAPI
DocDispatchEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
1737 HTMLDocument
*This
= DISPEX_THIS(iface
);
1739 return IDispatchEx_GetNameSpaceParent(DISPATCHEX(&This
->dispex
), ppunk
);
1744 static const IDispatchExVtbl DocDispatchExVtbl
= {
1745 DocDispatchEx_QueryInterface
,
1746 DocDispatchEx_AddRef
,
1747 DocDispatchEx_Release
,
1748 DocDispatchEx_GetTypeInfoCount
,
1749 DocDispatchEx_GetTypeInfo
,
1750 DocDispatchEx_GetIDsOfNames
,
1751 DocDispatchEx_Invoke
,
1752 DocDispatchEx_GetDispID
,
1753 DocDispatchEx_InvokeEx
,
1754 DocDispatchEx_DeleteMemberByName
,
1755 DocDispatchEx_DeleteMemberByDispID
,
1756 DocDispatchEx_GetMemberProperties
,
1757 DocDispatchEx_GetMemberName
,
1758 DocDispatchEx_GetNextDispID
,
1759 DocDispatchEx_GetNameSpaceParent
1762 static const tid_t HTMLDocument_iface_tids
[] = {
1769 static dispex_static_data_t HTMLDocument_dispex
= {
1771 DispHTMLDocument_tid
,
1773 HTMLDocument_iface_tids
1776 static HRESULT
alloc_doc(HTMLDocument
**ret
)
1780 doc
= heap_alloc_zero(sizeof(HTMLDocument
));
1781 doc
->lpHTMLDocument2Vtbl
= &HTMLDocumentVtbl
;
1782 doc
->lpIDispatchExVtbl
= &DocDispatchExVtbl
;
1783 doc
->lpSupportErrorInfoVtbl
= &SupportErrorInfoVtbl
;
1785 doc
->readystate
= READYSTATE_UNINITIALIZED
;
1786 doc
->scriptmode
= SCRIPTMODE_GECKO
;
1788 list_init(&doc
->bindings
);
1789 list_init(&doc
->script_hosts
);
1790 list_init(&doc
->selection_list
);
1791 list_init(&doc
->range_list
);
1793 HTMLDocument_HTMLDocument3_Init(doc
);
1794 HTMLDocument_HTMLDocument5_Init(doc
);
1795 HTMLDocument_Persist_Init(doc
);
1796 HTMLDocument_OleCmd_Init(doc
);
1797 HTMLDocument_OleObj_Init(doc
);
1798 HTMLDocument_View_Init(doc
);
1799 HTMLDocument_Window_Init(doc
);
1800 HTMLDocument_Service_Init(doc
);
1801 HTMLDocument_Hlink_Init(doc
);
1803 ConnectionPointContainer_Init(&doc
->cp_container
, (IUnknown
*)HTMLDOC(doc
));
1804 ConnectionPoint_Init(&doc
->cp_propnotif
, &doc
->cp_container
, &IID_IPropertyNotifySink
);
1805 ConnectionPoint_Init(&doc
->cp_htmldocevents
, &doc
->cp_container
, &DIID_HTMLDocumentEvents
);
1806 ConnectionPoint_Init(&doc
->cp_htmldocevents2
, &doc
->cp_container
, &DIID_HTMLDocumentEvents2
);
1808 init_dispex(&doc
->dispex
, (IUnknown
*)HTMLDOC(doc
), &HTMLDocument_dispex
);
1814 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*nsdoc
, HTMLDocument
**ret
)
1819 hres
= alloc_doc(&doc
);
1823 nsIDOMHTMLDocument_AddRef(nsdoc
);
1826 hres
= HTMLWindow_Create(doc
, NULL
, &doc
->window
);
1828 IHTMLDocument_Release(HTMLDOC(doc
));
1836 HRESULT
HTMLDocument_Create(IUnknown
*pUnkOuter
, REFIID riid
, void** ppvObject
)
1839 nsIDOMWindow
*nswindow
= NULL
;
1842 TRACE("(%p %s %p)\n", pUnkOuter
, debugstr_guid(riid
), ppvObject
);
1844 hres
= alloc_doc(&doc
);
1848 hres
= IHTMLDocument_QueryInterface(HTMLDOC(doc
), riid
, ppvObject
);
1849 IHTMLDocument_Release(HTMLDOC(doc
));
1853 doc
->nscontainer
= NSContainer_Create(doc
, NULL
);
1854 update_nsdocument(doc
);
1856 if(doc
->nscontainer
) {
1859 nsres
= nsIWebBrowser_GetContentDOMWindow(doc
->nscontainer
->webbrowser
, &nswindow
);
1860 if(NS_FAILED(nsres
))
1861 ERR("GetContentDOMWindow failed: %08x\n", nsres
);
1864 hres
= HTMLWindow_Create(doc
, nswindow
, &doc
->window
);
1866 nsIDOMWindow_Release(nswindow
);
1868 IHTMLDocument_Release(HTMLDOC(doc
));