2 * Copyright 2005 Jacek Caban
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "wine/debug.h"
33 #include "mshtml_private.h"
34 #include "htmlevent.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
38 #define HTMLDOC_THIS(iface) DEFINE_THIS(HTMLDocument, HTMLDocument2, iface)
40 static HRESULT WINAPI
HTMLDocument_QueryInterface(IHTMLDocument2
*iface
, REFIID riid
, void **ppvObject
)
42 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
45 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
46 TRACE("(%p)->(IID_IUnknown, %p)\n", This
, ppvObject
);
47 *ppvObject
= HTMLDOC(This
);
48 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
49 TRACE("(%p)->(IID_IDispatch, %p)\n", This
, ppvObject
);
50 *ppvObject
= DISPATCHEX(This
);
51 }else if(IsEqualGUID(&IID_IDispatchEx
, riid
)) {
52 TRACE("(%p)->(IID_IDispatchEx, %p)\n", This
, ppvObject
);
53 *ppvObject
= DISPATCHEX(This
);
54 }else if(IsEqualGUID(&IID_IHTMLDocument
, riid
)) {
55 TRACE("(%p)->(IID_IHTMLDocument, %p)\n", This
, ppvObject
);
56 *ppvObject
= HTMLDOC(This
);
57 }else if(IsEqualGUID(&IID_IHTMLDocument2
, riid
)) {
58 TRACE("(%p)->(IID_IHTMLDocument2, %p)\n", This
, ppvObject
);
59 *ppvObject
= HTMLDOC(This
);
60 }else if(IsEqualGUID(&IID_IHTMLDocument3
, riid
)) {
61 TRACE("(%p)->(IID_IHTMLDocument3, %p)\n", This
, ppvObject
);
62 *ppvObject
= HTMLDOC3(This
);
63 }else if(IsEqualGUID(&IID_IHTMLDocument4
, riid
)) {
64 TRACE("(%p)->(IID_IHTMLDocument4, %p)\n", This
, ppvObject
);
65 *ppvObject
= HTMLDOC4(This
);
66 }else if(IsEqualGUID(&IID_IHTMLDocument5
, riid
)) {
67 TRACE("(%p)->(IID_IHTMLDocument5, %p)\n", This
, ppvObject
);
68 *ppvObject
= HTMLDOC5(This
);
69 }else if(IsEqualGUID(&IID_IPersist
, riid
)) {
70 TRACE("(%p)->(IID_IPersist, %p)\n", This
, ppvObject
);
71 *ppvObject
= PERSIST(This
);
72 }else if(IsEqualGUID(&IID_IPersistMoniker
, riid
)) {
73 TRACE("(%p)->(IID_IPersistMoniker, %p)\n", This
, ppvObject
);
74 *ppvObject
= PERSISTMON(This
);
75 }else if(IsEqualGUID(&IID_IPersistFile
, riid
)) {
76 TRACE("(%p)->(IID_IPersistFile, %p)\n", This
, ppvObject
);
77 *ppvObject
= PERSISTFILE(This
);
78 }else if(IsEqualGUID(&IID_IMonikerProp
, riid
)) {
79 TRACE("(%p)->(IID_IMonikerProp, %p)\n", This
, ppvObject
);
80 *ppvObject
= MONPROP(This
);
81 }else if(IsEqualGUID(&IID_IOleObject
, riid
)) {
82 TRACE("(%p)->(IID_IOleObject, %p)\n", This
, ppvObject
);
83 *ppvObject
= OLEOBJ(This
);
84 }else if(IsEqualGUID(&IID_IOleDocument
, riid
)) {
85 TRACE("(%p)->(IID_IOleDocument, %p)\n", This
, ppvObject
);
86 *ppvObject
= OLEDOC(This
);
87 }else if(IsEqualGUID(&IID_IOleDocumentView
, riid
)) {
88 TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This
, ppvObject
);
89 *ppvObject
= DOCVIEW(This
);
90 }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject
, riid
)) {
91 TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This
, ppvObject
);
92 *ppvObject
= ACTOBJ(This
);
93 }else if(IsEqualGUID(&IID_IViewObject
, riid
)) {
94 TRACE("(%p)->(IID_IViewObject, %p)\n", This
, ppvObject
);
95 *ppvObject
= VIEWOBJ(This
);
96 }else if(IsEqualGUID(&IID_IViewObject2
, riid
)) {
97 TRACE("(%p)->(IID_IViewObject2, %p)\n", This
, ppvObject
);
98 *ppvObject
= VIEWOBJ2(This
);
99 }else if(IsEqualGUID(&IID_IOleWindow
, riid
)) {
100 TRACE("(%p)->(IID_IOleWindow, %p)\n", This
, ppvObject
);
101 *ppvObject
= OLEWIN(This
);
102 }else if(IsEqualGUID(&IID_IOleInPlaceObject
, riid
)) {
103 TRACE("(%p)->(IID_IOleInPlaceObject, %p)\n", This
, ppvObject
);
104 *ppvObject
= INPLACEOBJ(This
);
105 }else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless
, riid
)) {
106 TRACE("(%p)->(IID_IOleInPlaceObjectWindowless, %p)\n", This
, ppvObject
);
107 *ppvObject
= INPLACEWIN(This
);
108 }else if(IsEqualGUID(&IID_IServiceProvider
, riid
)) {
109 TRACE("(%p)->(IID_IServiceProvider, %p)\n", This
, ppvObject
);
110 *ppvObject
= SERVPROV(This
);
111 }else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
)) {
112 TRACE("(%p)->(IID_IOleCommandTarget, %p)\n", This
, ppvObject
);
113 *ppvObject
= CMDTARGET(This
);
114 }else if(IsEqualGUID(&IID_IOleControl
, riid
)) {
115 TRACE("(%p)->(IID_IOleControl, %p)\n", This
, ppvObject
);
116 *ppvObject
= CONTROL(This
);
117 }else if(IsEqualGUID(&IID_IHlinkTarget
, riid
)) {
118 TRACE("(%p)->(IID_IHlinkTarget, %p)\n", This
, ppvObject
);
119 *ppvObject
= HLNKTARGET(This
);
120 }else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
)) {
121 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This
, ppvObject
);
122 *ppvObject
= CONPTCONT(&This
->cp_container
);
123 }else if(IsEqualGUID(&IID_IPersistStreamInit
, riid
)) {
124 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This
, ppvObject
);
125 *ppvObject
= PERSTRINIT(This
);
126 }else if(IsEqualGUID(&IID_ICustomDoc
, riid
)) {
127 TRACE("(%p)->(IID_ICustomDoc %p)\n", This
, ppvObject
);
128 *ppvObject
= CUSTOMDOC(This
);
129 }else if(IsEqualGUID(&DIID_DispHTMLDocument
, riid
)) {
130 TRACE("(%p)->(DIID_DispHTMLDocument %p)\n", This
, ppvObject
);
131 *ppvObject
= HTMLDOC(This
);
132 }else if(IsEqualGUID(&CLSID_CMarkup
, riid
)) {
133 FIXME("(%p)->(CLSID_CMarkup %p)\n", This
, ppvObject
);
134 return E_NOINTERFACE
;
135 }else if(IsEqualGUID(&IID_IRunnableObject
, riid
)) {
136 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This
, ppvObject
);
137 return E_NOINTERFACE
;
138 }else if(IsEqualGUID(&IID_IPersistPropertyBag
, riid
)) {
139 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This
, ppvObject
);
140 return E_NOINTERFACE
;
141 }else if(dispex_query_interface(&This
->dispex
, riid
, ppvObject
)) {
142 return *ppvObject
? S_OK
: E_NOINTERFACE
;
146 IHTMLDocument2_AddRef(iface
);
150 FIXME("(%p)->(%s %p) interface not supported\n", This
, debugstr_guid(riid
), ppvObject
);
151 return E_NOINTERFACE
;
154 static ULONG WINAPI
HTMLDocument_AddRef(IHTMLDocument2
*iface
)
156 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
157 ULONG ref
= InterlockedIncrement(&This
->ref
);
158 TRACE("(%p) ref = %u\n", This
, ref
);
162 static ULONG WINAPI
HTMLDocument_Release(IHTMLDocument2
*iface
)
164 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
165 ULONG ref
= InterlockedDecrement(&This
->ref
);
167 TRACE("(%p) ref = %u\n", This
, ref
);
170 remove_doc_tasks(This
);
171 release_script_hosts(This
);
174 IOleObject_SetClientSite(OLEOBJ(This
), NULL
);
175 if(This
->in_place_active
)
176 IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(This
));
178 IOleDocumentView_SetInPlaceSite(DOCVIEW(This
), NULL
);
180 IOleUndoManager_Release(This
->undomgr
);
182 set_document_bscallback(This
, NULL
);
183 set_current_mon(This
, NULL
);
185 if(This
->tooltips_hwnd
)
186 DestroyWindow(This
->tooltips_hwnd
);
188 DestroyWindow(This
->hwnd
);
190 if(This
->option_factory
) {
191 This
->option_factory
->doc
= NULL
;
192 IHTMLOptionElementFactory_Release(HTMLOPTFACTORY(This
->option_factory
));
196 This
->location
->doc
= NULL
;
199 IHTMLWindow2_Release(HTMLWINDOW2(This
->window
));
201 if(This
->event_target
)
202 release_event_target(This
->event_target
);
204 heap_free(This
->mime
);
205 detach_selection(This
);
209 ConnectionPointContainer_Destroy(&This
->cp_container
);
212 nsIDOMHTMLDocument_Release(This
->nsdoc
);
213 if(This
->nscontainer
)
214 NSContainer_Release(This
->nscontainer
);
224 static HRESULT WINAPI
HTMLDocument_GetTypeInfoCount(IHTMLDocument2
*iface
, UINT
*pctinfo
)
226 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
228 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This
), pctinfo
);
231 static HRESULT WINAPI
HTMLDocument_GetTypeInfo(IHTMLDocument2
*iface
, UINT iTInfo
,
232 LCID lcid
, ITypeInfo
**ppTInfo
)
234 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
236 return IDispatchEx_GetTypeInfo(DISPATCHEX(This
), iTInfo
, lcid
, ppTInfo
);
239 static HRESULT WINAPI
HTMLDocument_GetIDsOfNames(IHTMLDocument2
*iface
, REFIID riid
,
240 LPOLESTR
*rgszNames
, UINT cNames
,
241 LCID lcid
, DISPID
*rgDispId
)
243 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
245 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
248 static HRESULT WINAPI
HTMLDocument_Invoke(IHTMLDocument2
*iface
, DISPID dispIdMember
,
249 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
250 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
252 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
254 return IDispatchEx_Invoke(DISPATCHEX(This
), dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
255 pVarResult
, pExcepInfo
, puArgErr
);
258 static HRESULT WINAPI
HTMLDocument_get_Script(IHTMLDocument2
*iface
, IDispatch
**p
)
260 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
262 TRACE("(%p)->(%p)\n", This
, p
);
264 *p
= (IDispatch
*)HTMLWINDOW2(This
->window
);
265 IDispatch_AddRef(*p
);
269 static HRESULT WINAPI
HTMLDocument_get_all(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
271 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
272 nsIDOMElement
*nselem
= NULL
;
275 TRACE("(%p)->(%p)\n", This
, p
);
278 WARN("NULL nsdoc\n");
282 nsres
= nsIDOMHTMLDocument_GetDocumentElement(This
->nsdoc
, &nselem
);
283 if(NS_FAILED(nsres
)) {
284 ERR("GetDocumentElement failed: %08x\n", nsres
);
289 *p
= create_all_collection(get_node(This
, (nsIDOMNode
*)nselem
, TRUE
), TRUE
);
290 nsIDOMElement_Release(nselem
);
298 static HRESULT WINAPI
HTMLDocument_get_body(IHTMLDocument2
*iface
, IHTMLElement
**p
)
300 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
301 nsIDOMHTMLElement
*nsbody
= NULL
;
305 TRACE("(%p)->(%p)\n", This
, p
);
308 WARN("NULL nsdoc\n");
312 nsres
= nsIDOMHTMLDocument_GetBody(This
->nsdoc
, &nsbody
);
313 if(NS_FAILED(nsres
)) {
314 TRACE("Could not get body: %08x\n", nsres
);
319 node
= get_node(This
, (nsIDOMNode
*)nsbody
, TRUE
);
320 nsIDOMHTMLElement_Release(nsbody
);
322 IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node
), &IID_IHTMLElement
, (void**)p
);
327 TRACE("*p = %p\n", *p
);
331 static HRESULT WINAPI
HTMLDocument_get_activeElement(IHTMLDocument2
*iface
, IHTMLElement
**p
)
333 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
334 FIXME("(%p)->(%p)\n", This
, p
);
338 static HRESULT WINAPI
HTMLDocument_get_images(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
340 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
341 nsIDOMHTMLCollection
*nscoll
= NULL
;
344 TRACE("(%p)->(%p)\n", This
, p
);
352 WARN("NULL nsdoc\n");
356 nsres
= nsIDOMHTMLDocument_GetImages(This
->nsdoc
, &nscoll
);
357 if(NS_FAILED(nsres
)) {
358 ERR("GetImages failed: %08x\n", nsres
);
363 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
364 nsIDOMElement_Release(nscoll
);
370 static HRESULT WINAPI
HTMLDocument_get_applets(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
372 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
373 nsIDOMHTMLCollection
*nscoll
= NULL
;
376 TRACE("(%p)->(%p)\n", This
, p
);
384 WARN("NULL nsdoc\n");
388 nsres
= nsIDOMHTMLDocument_GetApplets(This
->nsdoc
, &nscoll
);
389 if(NS_FAILED(nsres
)) {
390 ERR("GetApplets failed: %08x\n", nsres
);
395 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
396 nsIDOMElement_Release(nscoll
);
402 static HRESULT WINAPI
HTMLDocument_get_links(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
404 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
405 nsIDOMHTMLCollection
*nscoll
= NULL
;
408 TRACE("(%p)->(%p)\n", This
, p
);
416 WARN("NULL nsdoc\n");
420 nsres
= nsIDOMHTMLDocument_GetLinks(This
->nsdoc
, &nscoll
);
421 if(NS_FAILED(nsres
)) {
422 ERR("GetLinks failed: %08x\n", nsres
);
427 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
428 nsIDOMElement_Release(nscoll
);
434 static HRESULT WINAPI
HTMLDocument_get_forms(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
436 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
437 nsIDOMHTMLCollection
*nscoll
= NULL
;
440 TRACE("(%p)->(%p)\n", This
, p
);
448 WARN("NULL nsdoc\n");
452 nsres
= nsIDOMHTMLDocument_GetForms(This
->nsdoc
, &nscoll
);
453 if(NS_FAILED(nsres
)) {
454 ERR("GetForms failed: %08x\n", nsres
);
459 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
460 nsIDOMElement_Release(nscoll
);
466 static HRESULT WINAPI
HTMLDocument_get_anchors(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
468 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
469 nsIDOMHTMLCollection
*nscoll
= NULL
;
472 TRACE("(%p)->(%p)\n", This
, p
);
480 WARN("NULL nsdoc\n");
484 nsres
= nsIDOMHTMLDocument_GetAnchors(This
->nsdoc
, &nscoll
);
485 if(NS_FAILED(nsres
)) {
486 ERR("GetAnchors failed: %08x\n", nsres
);
491 *p
= create_collection_from_htmlcol(This
, (IUnknown
*)HTMLDOC(This
), nscoll
);
492 nsIDOMElement_Release(nscoll
);
498 static HRESULT WINAPI
HTMLDocument_put_title(IHTMLDocument2
*iface
, BSTR v
)
500 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
504 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
507 WARN("NULL nsdoc\n");
511 nsAString_Init(&nsstr
, v
);
512 nsres
= nsIDOMHTMLDocument_SetTitle(This
->nsdoc
, &nsstr
);
513 nsAString_Finish(&nsstr
);
515 ERR("SetTitle failed: %08x\n", nsres
);
520 static HRESULT WINAPI
HTMLDocument_get_title(IHTMLDocument2
*iface
, BSTR
*p
)
522 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
523 const PRUnichar
*ret
;
527 TRACE("(%p)->(%p)\n", This
, p
);
530 WARN("NULL nsdoc\n");
535 nsAString_Init(&nsstr
, NULL
);
536 nsres
= nsIDOMHTMLDocument_GetTitle(This
->nsdoc
, &nsstr
);
537 if (NS_SUCCEEDED(nsres
)) {
538 nsAString_GetData(&nsstr
, &ret
);
539 *p
= SysAllocString(ret
);
541 nsAString_Finish(&nsstr
);
543 if(NS_FAILED(nsres
)) {
544 ERR("GetTitle failed: %08x\n", nsres
);
551 static HRESULT WINAPI
HTMLDocument_get_scripts(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
553 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
554 FIXME("(%p)->(%p)\n", This
, p
);
558 static HRESULT WINAPI
HTMLDocument_put_designMode(IHTMLDocument2
*iface
, BSTR v
)
560 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
561 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
565 static HRESULT WINAPI
HTMLDocument_get_designMode(IHTMLDocument2
*iface
, BSTR
*p
)
567 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
568 static WCHAR szOff
[] = {'O','f','f',0};
569 FIXME("(%p)->(%p) always returning Off\n", This
, p
);
574 *p
= SysAllocString(szOff
);
579 static HRESULT WINAPI
HTMLDocument_get_selection(IHTMLDocument2
*iface
, IHTMLSelectionObject
**p
)
581 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
582 nsISelection
*nsselection
= NULL
;
584 TRACE("(%p)->(%p)\n", This
, p
);
586 if(This
->nscontainer
) {
587 nsIDOMWindow
*dom_window
= NULL
;
589 nsIWebBrowser_GetContentDOMWindow(This
->nscontainer
->webbrowser
, &dom_window
);
591 nsIDOMWindow_GetSelection(dom_window
, &nsselection
);
592 nsIDOMWindow_Release(dom_window
);
596 *p
= HTMLSelectionObject_Create(This
, nsselection
);
600 static HRESULT WINAPI
HTMLDocument_get_readyState(IHTMLDocument2
*iface
, BSTR
*p
)
602 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
604 static const WCHAR wszUninitialized
[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
605 static const WCHAR wszLoading
[] = {'l','o','a','d','i','n','g',0};
606 static const WCHAR wszLoaded
[] = {'l','o','a','d','e','d',0};
607 static const WCHAR wszInteractive
[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
608 static const WCHAR wszComplete
[] = {'c','o','m','p','l','e','t','e',0};
610 static const LPCWSTR readystate_str
[] = {
618 TRACE("(%p)->(%p)\n", iface
, p
);
623 *p
= SysAllocString(readystate_str
[This
->readystate
]);
627 static HRESULT WINAPI
HTMLDocument_get_frames(IHTMLDocument2
*iface
, IHTMLFramesCollection2
**p
)
629 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
630 FIXME("(%p)->(%p)\n", This
, p
);
634 static HRESULT WINAPI
HTMLDocument_get_embeds(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
636 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
637 FIXME("(%p)->(%p)\n", This
, p
);
641 static HRESULT WINAPI
HTMLDocument_get_plugins(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
643 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
644 FIXME("(%p)->(%p)\n", This
, p
);
648 static HRESULT WINAPI
HTMLDocument_put_alinkColor(IHTMLDocument2
*iface
, VARIANT v
)
650 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
651 FIXME("(%p)\n", This
);
655 static HRESULT WINAPI
HTMLDocument_get_alinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
657 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
658 FIXME("(%p)->(%p)\n", This
, p
);
662 static HRESULT WINAPI
HTMLDocument_put_bgColor(IHTMLDocument2
*iface
, VARIANT v
)
664 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
665 FIXME("(%p)\n", This
);
669 static HRESULT WINAPI
HTMLDocument_get_bgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
671 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
672 FIXME("(%p)->(%p)\n", This
, p
);
676 static HRESULT WINAPI
HTMLDocument_put_fgColor(IHTMLDocument2
*iface
, VARIANT v
)
678 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
679 FIXME("(%p)\n", This
);
683 static HRESULT WINAPI
HTMLDocument_get_fgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
685 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
686 FIXME("(%p)->(%p)\n", This
, p
);
690 static HRESULT WINAPI
HTMLDocument_put_linkColor(IHTMLDocument2
*iface
, VARIANT v
)
692 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
693 FIXME("(%p)->()\n", This
);
697 static HRESULT WINAPI
HTMLDocument_get_linkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
699 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
700 FIXME("(%p)->(%p)\n", This
, p
);
704 static HRESULT WINAPI
HTMLDocument_put_vlinkColor(IHTMLDocument2
*iface
, VARIANT v
)
706 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
707 FIXME("(%p)\n", This
);
711 static HRESULT WINAPI
HTMLDocument_get_vlinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
713 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
714 FIXME("(%p)->(%p)\n", This
, p
);
718 static HRESULT WINAPI
HTMLDocument_get_referrer(IHTMLDocument2
*iface
, BSTR
*p
)
720 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
721 FIXME("(%p)->(%p)\n", This
, p
);
725 static HRESULT WINAPI
HTMLDocument_get_location(IHTMLDocument2
*iface
, IHTMLLocation
**p
)
727 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
729 TRACE("(%p)->(%p)\n", This
, p
);
732 IHTMLLocation_AddRef(HTMLLOCATION(This
->location
));
734 This
->location
= HTMLLocation_Create(This
);
736 *p
= HTMLLOCATION(This
->location
);
740 static HRESULT WINAPI
HTMLDocument_get_lastModified(IHTMLDocument2
*iface
, BSTR
*p
)
742 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
743 FIXME("(%p)->(%p)\n", This
, p
);
747 static HRESULT WINAPI
HTMLDocument_put_URL(IHTMLDocument2
*iface
, BSTR v
)
749 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
750 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
754 static HRESULT WINAPI
HTMLDocument_get_URL(IHTMLDocument2
*iface
, BSTR
*p
)
756 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
758 static const WCHAR about_blank_url
[] =
759 {'a','b','o','u','t',':','b','l','a','n','k',0};
761 TRACE("(%p)->(%p)\n", iface
, p
);
763 *p
= SysAllocString(This
->url
? This
->url
: about_blank_url
);
767 static HRESULT WINAPI
HTMLDocument_put_domain(IHTMLDocument2
*iface
, BSTR v
)
769 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
770 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
774 static HRESULT WINAPI
HTMLDocument_get_domain(IHTMLDocument2
*iface
, BSTR
*p
)
776 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
777 FIXME("(%p)->(%p)\n", This
, p
);
781 static HRESULT WINAPI
HTMLDocument_put_cookie(IHTMLDocument2
*iface
, BSTR v
)
783 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
784 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
788 static HRESULT WINAPI
HTMLDocument_get_cookie(IHTMLDocument2
*iface
, BSTR
*p
)
790 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
791 FIXME("(%p)->(%p)\n", This
, p
);
795 static HRESULT WINAPI
HTMLDocument_put_expando(IHTMLDocument2
*iface
, VARIANT_BOOL v
)
797 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
798 FIXME("(%p)->(%x)\n", This
, v
);
802 static HRESULT WINAPI
HTMLDocument_get_expando(IHTMLDocument2
*iface
, VARIANT_BOOL
*p
)
804 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
805 FIXME("(%p)->(%p)\n", This
, p
);
809 static HRESULT WINAPI
HTMLDocument_put_charset(IHTMLDocument2
*iface
, BSTR v
)
811 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
812 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
816 static HRESULT WINAPI
HTMLDocument_get_charset(IHTMLDocument2
*iface
, BSTR
*p
)
818 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
819 FIXME("(%p)->(%p)\n", This
, p
);
823 static HRESULT WINAPI
HTMLDocument_put_defaultCharset(IHTMLDocument2
*iface
, BSTR v
)
825 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
826 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
830 static HRESULT WINAPI
HTMLDocument_get_defaultCharset(IHTMLDocument2
*iface
, BSTR
*p
)
832 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
833 FIXME("(%p)->(%p)\n", This
, p
);
837 static HRESULT WINAPI
HTMLDocument_get_mimeType(IHTMLDocument2
*iface
, BSTR
*p
)
839 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
840 FIXME("(%p)->(%p)\n", This
, p
);
844 static HRESULT WINAPI
HTMLDocument_get_fileSize(IHTMLDocument2
*iface
, BSTR
*p
)
846 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
847 FIXME("(%p)->(%p)\n", This
, p
);
851 static HRESULT WINAPI
HTMLDocument_get_fileCreatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
853 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
854 FIXME("(%p)->(%p)\n", This
, p
);
858 static HRESULT WINAPI
HTMLDocument_get_fileModifiedDate(IHTMLDocument2
*iface
, BSTR
*p
)
860 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
861 FIXME("(%p)->(%p)\n", This
, p
);
865 static HRESULT WINAPI
HTMLDocument_get_fileUpdatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
867 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
868 FIXME("(%p)->(%p)\n", This
, p
);
872 static HRESULT WINAPI
HTMLDocument_get_security(IHTMLDocument2
*iface
, BSTR
*p
)
874 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
875 FIXME("(%p)->(%p)\n", This
, p
);
879 static HRESULT WINAPI
HTMLDocument_get_protocol(IHTMLDocument2
*iface
, BSTR
*p
)
881 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
882 FIXME("(%p)->(%p)\n", This
, p
);
886 static HRESULT WINAPI
HTMLDocument_get_nameProp(IHTMLDocument2
*iface
, BSTR
*p
)
888 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
889 FIXME("(%p)->(%p)\n", This
, p
);
893 static HRESULT WINAPI
HTMLDocument_write(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
895 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
902 TRACE("(%p)->(%p)\n", iface
, psarray
);
905 WARN("NULL nsdoc\n");
909 if(psarray
->cDims
!= 1) {
910 FIXME("cDims=%d\n", psarray
->cDims
);
914 hres
= SafeArrayAccessData(psarray
, (void**)&var
);
916 WARN("SafeArrayAccessData failed: %08x\n", hres
);
920 nsAString_Init(&nsstr
, NULL
);
922 for(i
=0; i
< psarray
->rgsabound
[0].cElements
; i
++) {
923 if(V_VT(var
+i
) == VT_BSTR
) {
924 nsAString_SetData(&nsstr
, V_BSTR(var
+i
));
925 nsres
= nsIDOMHTMLDocument_Write(This
->nsdoc
, &nsstr
);
927 ERR("Write failed: %08x\n", nsres
);
929 FIXME("vt=%d\n", V_VT(var
+i
));
933 nsAString_Finish(&nsstr
);
934 SafeArrayUnaccessData(psarray
);
939 static HRESULT WINAPI
HTMLDocument_writeln(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
941 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
942 FIXME("(%p)->(%p)\n", This
, psarray
);
946 static HRESULT WINAPI
HTMLDocument_open(IHTMLDocument2
*iface
, BSTR url
, VARIANT name
,
947 VARIANT features
, VARIANT replace
, IDispatch
**pomWindowResult
)
949 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
952 static const WCHAR text_htmlW
[] = {'t','e','x','t','/','h','t','m','l',0};
954 TRACE("(%p)->(%s %s %s %s %p)\n", This
, debugstr_w(url
), debugstr_variant(&name
),
955 debugstr_variant(&features
), debugstr_variant(&replace
), pomWindowResult
);
962 if(!url
|| strcmpW(url
, text_htmlW
) || V_VT(&name
) != VT_ERROR
963 || V_VT(&features
) != VT_ERROR
|| V_VT(&replace
) != VT_ERROR
)
964 FIXME("unsupported args\n");
966 nsres
= nsIDOMHTMLDocument_Open(This
->nsdoc
);
967 if(NS_FAILED(nsres
)) {
968 ERR("Open failed: %08x\n", nsres
);
972 *pomWindowResult
= (IDispatch
*)HTMLWINDOW2(This
->window
);
973 IHTMLWindow2_AddRef(HTMLWINDOW2(This
->window
));
977 static HRESULT WINAPI
HTMLDocument_close(IHTMLDocument2
*iface
)
979 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
982 TRACE("(%p)\n", This
);
989 nsres
= nsIDOMHTMLDocument_Close(This
->nsdoc
);
990 if(NS_FAILED(nsres
)) {
991 ERR("Close failed: %08x\n", nsres
);
998 static HRESULT WINAPI
HTMLDocument_clear(IHTMLDocument2
*iface
)
1000 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1001 FIXME("(%p)\n", This
);
1005 static HRESULT WINAPI
HTMLDocument_queryCommandSupported(IHTMLDocument2
*iface
, BSTR cmdID
,
1006 VARIANT_BOOL
*pfRet
)
1008 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1009 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1013 static HRESULT WINAPI
HTMLDocument_queryCommandEnabled(IHTMLDocument2
*iface
, BSTR cmdID
,
1014 VARIANT_BOOL
*pfRet
)
1016 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1017 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1021 static HRESULT WINAPI
HTMLDocument_queryCommandState(IHTMLDocument2
*iface
, BSTR cmdID
,
1022 VARIANT_BOOL
*pfRet
)
1024 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1025 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1029 static HRESULT WINAPI
HTMLDocument_queryCommandIndeterm(IHTMLDocument2
*iface
, BSTR cmdID
,
1030 VARIANT_BOOL
*pfRet
)
1032 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1033 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1037 static HRESULT WINAPI
HTMLDocument_queryCommandText(IHTMLDocument2
*iface
, BSTR cmdID
,
1040 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1041 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1045 static HRESULT WINAPI
HTMLDocument_queryCommandValue(IHTMLDocument2
*iface
, BSTR cmdID
,
1048 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1049 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1053 static HRESULT WINAPI
HTMLDocument_execCommand(IHTMLDocument2
*iface
, BSTR cmdID
,
1054 VARIANT_BOOL showUI
, VARIANT value
, VARIANT_BOOL
*pfRet
)
1056 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1057 FIXME("(%p)->(%s %x %p)\n", This
, debugstr_w(cmdID
), showUI
, pfRet
);
1061 static HRESULT WINAPI
HTMLDocument_execCommandShowHelp(IHTMLDocument2
*iface
, BSTR cmdID
,
1062 VARIANT_BOOL
*pfRet
)
1064 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1065 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1069 static HRESULT WINAPI
HTMLDocument_createElement(IHTMLDocument2
*iface
, BSTR eTag
,
1070 IHTMLElement
**newElem
)
1072 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1073 nsIDOMElement
*nselem
;
1078 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eTag
), newElem
);
1081 WARN("NULL nsdoc\n");
1082 return E_UNEXPECTED
;
1085 nsAString_Init(&tag_str
, eTag
);
1086 nsres
= nsIDOMDocument_CreateElement(This
->nsdoc
, &tag_str
, &nselem
);
1087 nsAString_Finish(&tag_str
);
1088 if(NS_FAILED(nsres
)) {
1089 ERR("CreateElement failed: %08x\n", nsres
);
1093 elem
= HTMLElement_Create(This
, (nsIDOMNode
*)nselem
, TRUE
);
1094 nsIDOMElement_Release(nselem
);
1096 *newElem
= HTMLELEM(elem
);
1097 IHTMLElement_AddRef(HTMLELEM(elem
));
1101 static HRESULT WINAPI
HTMLDocument_put_onhelp(IHTMLDocument2
*iface
, VARIANT v
)
1103 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1104 FIXME("(%p)\n", This
);
1108 static HRESULT WINAPI
HTMLDocument_get_onhelp(IHTMLDocument2
*iface
, VARIANT
*p
)
1110 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1111 FIXME("(%p)->(%p)\n", This
, p
);
1115 static HRESULT WINAPI
HTMLDocument_put_onclick(IHTMLDocument2
*iface
, VARIANT v
)
1117 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1118 FIXME("(%p)\n", This
);
1122 static HRESULT WINAPI
HTMLDocument_get_onclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1124 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1125 FIXME("(%p)->(%p)\n", This
, p
);
1129 static HRESULT WINAPI
HTMLDocument_put_ondblclick(IHTMLDocument2
*iface
, VARIANT v
)
1131 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1132 FIXME("(%p)\n", This
);
1136 static HRESULT WINAPI
HTMLDocument_get_ondblclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1138 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1139 FIXME("(%p)->(%p)\n", This
, p
);
1143 static HRESULT WINAPI
HTMLDocument_put_onkeyup(IHTMLDocument2
*iface
, VARIANT v
)
1145 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1147 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1149 return set_doc_event(This
, EVENTID_KEYUP
, &v
);
1152 static HRESULT WINAPI
HTMLDocument_get_onkeyup(IHTMLDocument2
*iface
, VARIANT
*p
)
1154 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1156 TRACE("(%p)->(%p)\n", This
, p
);
1158 return get_doc_event(This
, EVENTID_KEYUP
, p
);
1161 static HRESULT WINAPI
HTMLDocument_put_onkeydown(IHTMLDocument2
*iface
, VARIANT v
)
1163 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1165 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1167 return set_doc_event(This
, EVENTID_KEYDOWN
, &v
);
1170 static HRESULT WINAPI
HTMLDocument_get_onkeydown(IHTMLDocument2
*iface
, VARIANT
*p
)
1172 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1174 TRACE("(%p)->(%p)\n", This
, p
);
1176 return get_doc_event(This
, EVENTID_KEYDOWN
, p
);
1179 static HRESULT WINAPI
HTMLDocument_put_onkeypress(IHTMLDocument2
*iface
, VARIANT v
)
1181 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1182 FIXME("(%p)\n", This
);
1186 static HRESULT WINAPI
HTMLDocument_get_onkeypress(IHTMLDocument2
*iface
, VARIANT
*p
)
1188 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1189 FIXME("(%p)->(%p)\n", This
, p
);
1193 static HRESULT WINAPI
HTMLDocument_put_onmouseup(IHTMLDocument2
*iface
, VARIANT v
)
1195 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1196 FIXME("(%p)\n", This
);
1200 static HRESULT WINAPI
HTMLDocument_get_onmouseup(IHTMLDocument2
*iface
, VARIANT
*p
)
1202 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1203 FIXME("(%p)->(%p)\n", This
, p
);
1207 static HRESULT WINAPI
HTMLDocument_put_onmousedown(IHTMLDocument2
*iface
, VARIANT v
)
1209 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1210 FIXME("(%p)\n", This
);
1214 static HRESULT WINAPI
HTMLDocument_get_onmousedown(IHTMLDocument2
*iface
, VARIANT
*p
)
1216 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1217 FIXME("(%p)->(%p)\n", This
, p
);
1221 static HRESULT WINAPI
HTMLDocument_put_onmousemove(IHTMLDocument2
*iface
, VARIANT v
)
1223 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1224 FIXME("(%p)\n", This
);
1228 static HRESULT WINAPI
HTMLDocument_get_onmousemove(IHTMLDocument2
*iface
, VARIANT
*p
)
1230 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1231 FIXME("(%p)->(%p)\n", This
, p
);
1235 static HRESULT WINAPI
HTMLDocument_put_onmouseout(IHTMLDocument2
*iface
, VARIANT v
)
1237 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1238 FIXME("(%p)\n", This
);
1242 static HRESULT WINAPI
HTMLDocument_get_onmouseout(IHTMLDocument2
*iface
, VARIANT
*p
)
1244 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1245 FIXME("(%p)->(%p)\n", This
, p
);
1249 static HRESULT WINAPI
HTMLDocument_put_onmouseover(IHTMLDocument2
*iface
, VARIANT v
)
1251 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1253 TRACE("(%p)\n", This
);
1255 return set_doc_event(This
, EVENTID_MOUSEOVER
, &v
);
1258 static HRESULT WINAPI
HTMLDocument_get_onmouseover(IHTMLDocument2
*iface
, VARIANT
*p
)
1260 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1262 TRACE("(%p)->(%p)\n", This
, p
);
1264 return get_doc_event(This
, EVENTID_MOUSEOVER
, p
);
1267 static HRESULT WINAPI
HTMLDocument_put_onreadystatechange(IHTMLDocument2
*iface
, VARIANT v
)
1269 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1270 FIXME("(%p)\n", This
);
1274 static HRESULT WINAPI
HTMLDocument_get_onreadystatechange(IHTMLDocument2
*iface
, VARIANT
*p
)
1276 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1277 FIXME("(%p)->(%p)\n", This
, p
);
1281 static HRESULT WINAPI
HTMLDocument_put_onafterupdate(IHTMLDocument2
*iface
, VARIANT v
)
1283 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1284 FIXME("(%p)\n", This
);
1288 static HRESULT WINAPI
HTMLDocument_get_onafterupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1290 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1291 FIXME("(%p)->(%p)\n", This
, p
);
1295 static HRESULT WINAPI
HTMLDocument_put_onrowexit(IHTMLDocument2
*iface
, VARIANT v
)
1297 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1298 FIXME("(%p)\n", This
);
1302 static HRESULT WINAPI
HTMLDocument_get_onrowexit(IHTMLDocument2
*iface
, VARIANT
*p
)
1304 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1305 FIXME("(%p)->(%p)\n", This
, p
);
1309 static HRESULT WINAPI
HTMLDocument_put_onrowenter(IHTMLDocument2
*iface
, VARIANT v
)
1311 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1312 FIXME("(%p)\n", This
);
1316 static HRESULT WINAPI
HTMLDocument_get_onrowenter(IHTMLDocument2
*iface
, VARIANT
*p
)
1318 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1319 FIXME("(%p)->(%p)\n", This
, p
);
1323 static HRESULT WINAPI
HTMLDocument_put_ondragstart(IHTMLDocument2
*iface
, VARIANT v
)
1325 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1327 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1329 return set_doc_event(This
, EVENTID_DRAGSTART
, &v
);
1332 static HRESULT WINAPI
HTMLDocument_get_ondragstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1334 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1336 TRACE("(%p)->(%p)\n", This
, p
);
1338 return get_doc_event(This
, EVENTID_DRAGSTART
, p
);
1341 static HRESULT WINAPI
HTMLDocument_put_onselectstart(IHTMLDocument2
*iface
, VARIANT v
)
1343 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1345 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1347 return set_doc_event(This
, EVENTID_SELECTSTART
, &v
);
1350 static HRESULT WINAPI
HTMLDocument_get_onselectstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1352 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1354 TRACE("(%p)->(%p)\n", This
, p
);
1356 return get_doc_event(This
, EVENTID_SELECTSTART
, p
);
1359 static HRESULT WINAPI
HTMLDocument_elementFromPoint(IHTMLDocument2
*iface
, long x
, long y
,
1360 IHTMLElement
**elementHit
)
1362 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1363 FIXME("(%p)->(%ld %ld %p)\n", This
, x
, y
, elementHit
);
1367 static HRESULT WINAPI
HTMLDocument_get_parentWindow(IHTMLDocument2
*iface
, IHTMLWindow2
**p
)
1369 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1371 TRACE("(%p)->(%p)\n", This
, p
);
1373 *p
= HTMLWINDOW2(This
->window
);
1374 IHTMLWindow2_AddRef(*p
);
1378 static HRESULT WINAPI
HTMLDocument_get_styleSheets(IHTMLDocument2
*iface
,
1379 IHTMLStyleSheetsCollection
**p
)
1381 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1382 nsIDOMStyleSheetList
*nsstylelist
;
1383 nsIDOMDocumentStyle
*nsdocstyle
;
1386 TRACE("(%p)->(%p)\n", This
, p
);
1391 WARN("NULL nsdoc\n");
1392 return E_UNEXPECTED
;
1395 nsIDOMHTMLDocument_QueryInterface(This
->nsdoc
, &IID_nsIDOMDocumentStyle
, (void**)&nsdocstyle
);
1396 nsres
= nsIDOMDocumentStyle_GetStyleSheets(nsdocstyle
, &nsstylelist
);
1397 nsIDOMDocumentStyle_Release(nsdocstyle
);
1398 if(NS_FAILED(nsres
)) {
1399 ERR("GetStyleSheets failed: %08x\n", nsres
);
1403 *p
= HTMLStyleSheetsCollection_Create(nsstylelist
);
1404 nsIDOMDocumentStyle_Release(nsstylelist
);
1409 static HRESULT WINAPI
HTMLDocument_put_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT v
)
1411 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1412 FIXME("(%p)\n", This
);
1416 static HRESULT WINAPI
HTMLDocument_get_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1418 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1419 FIXME("(%p)->(%p)\n", This
, p
);
1423 static HRESULT WINAPI
HTMLDocument_put_onerrorupdate(IHTMLDocument2
*iface
, VARIANT v
)
1425 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1426 FIXME("(%p)\n", This
);
1430 static HRESULT WINAPI
HTMLDocument_get_onerrorupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1432 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1433 FIXME("(%p)->(%p)\n", This
, p
);
1437 static HRESULT WINAPI
HTMLDocument_toString(IHTMLDocument2
*iface
, BSTR
*String
)
1439 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1440 FIXME("(%p)->(%p)\n", This
, String
);
1444 static HRESULT WINAPI
HTMLDocument_createStyleSheet(IHTMLDocument2
*iface
, BSTR bstrHref
,
1445 long lIndex
, IHTMLStyleSheet
**ppnewStyleSheet
)
1447 HTMLDocument
*This
= HTMLDOC_THIS(iface
);
1449 FIXME("(%p)->(%s %ld %p) semi-stub\n", This
, debugstr_w(bstrHref
), lIndex
, ppnewStyleSheet
);
1451 *ppnewStyleSheet
= HTMLStyleSheet_Create(NULL
);
1455 static const IHTMLDocument2Vtbl HTMLDocumentVtbl
= {
1456 HTMLDocument_QueryInterface
,
1457 HTMLDocument_AddRef
,
1458 HTMLDocument_Release
,
1459 HTMLDocument_GetTypeInfoCount
,
1460 HTMLDocument_GetTypeInfo
,
1461 HTMLDocument_GetIDsOfNames
,
1462 HTMLDocument_Invoke
,
1463 HTMLDocument_get_Script
,
1464 HTMLDocument_get_all
,
1465 HTMLDocument_get_body
,
1466 HTMLDocument_get_activeElement
,
1467 HTMLDocument_get_images
,
1468 HTMLDocument_get_applets
,
1469 HTMLDocument_get_links
,
1470 HTMLDocument_get_forms
,
1471 HTMLDocument_get_anchors
,
1472 HTMLDocument_put_title
,
1473 HTMLDocument_get_title
,
1474 HTMLDocument_get_scripts
,
1475 HTMLDocument_put_designMode
,
1476 HTMLDocument_get_designMode
,
1477 HTMLDocument_get_selection
,
1478 HTMLDocument_get_readyState
,
1479 HTMLDocument_get_frames
,
1480 HTMLDocument_get_embeds
,
1481 HTMLDocument_get_plugins
,
1482 HTMLDocument_put_alinkColor
,
1483 HTMLDocument_get_alinkColor
,
1484 HTMLDocument_put_bgColor
,
1485 HTMLDocument_get_bgColor
,
1486 HTMLDocument_put_fgColor
,
1487 HTMLDocument_get_fgColor
,
1488 HTMLDocument_put_linkColor
,
1489 HTMLDocument_get_linkColor
,
1490 HTMLDocument_put_vlinkColor
,
1491 HTMLDocument_get_vlinkColor
,
1492 HTMLDocument_get_referrer
,
1493 HTMLDocument_get_location
,
1494 HTMLDocument_get_lastModified
,
1495 HTMLDocument_put_URL
,
1496 HTMLDocument_get_URL
,
1497 HTMLDocument_put_domain
,
1498 HTMLDocument_get_domain
,
1499 HTMLDocument_put_cookie
,
1500 HTMLDocument_get_cookie
,
1501 HTMLDocument_put_expando
,
1502 HTMLDocument_get_expando
,
1503 HTMLDocument_put_charset
,
1504 HTMLDocument_get_charset
,
1505 HTMLDocument_put_defaultCharset
,
1506 HTMLDocument_get_defaultCharset
,
1507 HTMLDocument_get_mimeType
,
1508 HTMLDocument_get_fileSize
,
1509 HTMLDocument_get_fileCreatedDate
,
1510 HTMLDocument_get_fileModifiedDate
,
1511 HTMLDocument_get_fileUpdatedDate
,
1512 HTMLDocument_get_security
,
1513 HTMLDocument_get_protocol
,
1514 HTMLDocument_get_nameProp
,
1516 HTMLDocument_writeln
,
1520 HTMLDocument_queryCommandSupported
,
1521 HTMLDocument_queryCommandEnabled
,
1522 HTMLDocument_queryCommandState
,
1523 HTMLDocument_queryCommandIndeterm
,
1524 HTMLDocument_queryCommandText
,
1525 HTMLDocument_queryCommandValue
,
1526 HTMLDocument_execCommand
,
1527 HTMLDocument_execCommandShowHelp
,
1528 HTMLDocument_createElement
,
1529 HTMLDocument_put_onhelp
,
1530 HTMLDocument_get_onhelp
,
1531 HTMLDocument_put_onclick
,
1532 HTMLDocument_get_onclick
,
1533 HTMLDocument_put_ondblclick
,
1534 HTMLDocument_get_ondblclick
,
1535 HTMLDocument_put_onkeyup
,
1536 HTMLDocument_get_onkeyup
,
1537 HTMLDocument_put_onkeydown
,
1538 HTMLDocument_get_onkeydown
,
1539 HTMLDocument_put_onkeypress
,
1540 HTMLDocument_get_onkeypress
,
1541 HTMLDocument_put_onmouseup
,
1542 HTMLDocument_get_onmouseup
,
1543 HTMLDocument_put_onmousedown
,
1544 HTMLDocument_get_onmousedown
,
1545 HTMLDocument_put_onmousemove
,
1546 HTMLDocument_get_onmousemove
,
1547 HTMLDocument_put_onmouseout
,
1548 HTMLDocument_get_onmouseout
,
1549 HTMLDocument_put_onmouseover
,
1550 HTMLDocument_get_onmouseover
,
1551 HTMLDocument_put_onreadystatechange
,
1552 HTMLDocument_get_onreadystatechange
,
1553 HTMLDocument_put_onafterupdate
,
1554 HTMLDocument_get_onafterupdate
,
1555 HTMLDocument_put_onrowexit
,
1556 HTMLDocument_get_onrowexit
,
1557 HTMLDocument_put_onrowenter
,
1558 HTMLDocument_get_onrowenter
,
1559 HTMLDocument_put_ondragstart
,
1560 HTMLDocument_get_ondragstart
,
1561 HTMLDocument_put_onselectstart
,
1562 HTMLDocument_get_onselectstart
,
1563 HTMLDocument_elementFromPoint
,
1564 HTMLDocument_get_parentWindow
,
1565 HTMLDocument_get_styleSheets
,
1566 HTMLDocument_put_onbeforeupdate
,
1567 HTMLDocument_get_onbeforeupdate
,
1568 HTMLDocument_put_onerrorupdate
,
1569 HTMLDocument_get_onerrorupdate
,
1570 HTMLDocument_toString
,
1571 HTMLDocument_createStyleSheet
1574 #define DISPEX_THIS(iface) DEFINE_THIS(HTMLDocument, IDispatchEx, iface)
1576 static HRESULT WINAPI
DocDispatchEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
1578 HTMLDocument
*This
= DISPEX_THIS(iface
);
1580 return IHTMLDocument2_QueryInterface(HTMLDOC(This
), riid
, ppv
);
1583 static ULONG WINAPI
DocDispatchEx_AddRef(IDispatchEx
*iface
)
1585 HTMLDocument
*This
= DISPEX_THIS(iface
);
1587 return IHTMLDocument2_AddRef(HTMLDOC(This
));
1590 static ULONG WINAPI
DocDispatchEx_Release(IDispatchEx
*iface
)
1592 HTMLDocument
*This
= DISPEX_THIS(iface
);
1594 return IHTMLDocument2_Release(HTMLDOC(This
));
1597 static HRESULT WINAPI
DocDispatchEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
1599 HTMLDocument
*This
= DISPEX_THIS(iface
);
1601 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This
->dispex
), pctinfo
);
1604 static HRESULT WINAPI
DocDispatchEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
1605 LCID lcid
, ITypeInfo
**ppTInfo
)
1607 HTMLDocument
*This
= DISPEX_THIS(iface
);
1609 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This
->dispex
), iTInfo
, lcid
, ppTInfo
);
1612 static HRESULT WINAPI
DocDispatchEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
1613 LPOLESTR
*rgszNames
, UINT cNames
,
1614 LCID lcid
, DISPID
*rgDispId
)
1616 HTMLDocument
*This
= DISPEX_THIS(iface
);
1618 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This
->dispex
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1621 static HRESULT WINAPI
DocDispatchEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
1622 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1623 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1625 HTMLDocument
*This
= DISPEX_THIS(iface
);
1627 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
1628 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1630 switch(dispIdMember
) {
1631 case DISPID_READYSTATE
:
1632 TRACE("DISPID_READYSTATE\n");
1634 if(!(wFlags
& DISPATCH_PROPERTYGET
))
1635 return E_INVALIDARG
;
1637 V_VT(pVarResult
) = VT_I4
;
1638 V_I4(pVarResult
) = This
->readystate
;
1642 return IDispatchEx_Invoke(DISPATCHEX(&This
->dispex
), dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
1643 pVarResult
, pExcepInfo
, puArgErr
);
1646 static HRESULT WINAPI
DocDispatchEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
1648 HTMLDocument
*This
= DISPEX_THIS(iface
);
1650 return IDispatchEx_GetDispID(DISPATCHEX(&This
->dispex
), bstrName
, grfdex
, pid
);
1653 static HRESULT WINAPI
DocDispatchEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
1654 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
1656 HTMLDocument
*This
= DISPEX_THIS(iface
);
1658 return IDispatchEx_InvokeEx(DISPATCHEX(&This
->dispex
), id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
1661 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
1663 HTMLDocument
*This
= DISPEX_THIS(iface
);
1665 return IDispatchEx_DeleteMemberByName(DISPATCHEX(&This
->dispex
), bstrName
, grfdex
);
1668 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
1670 HTMLDocument
*This
= DISPEX_THIS(iface
);
1672 return IDispatchEx_DeleteMemberByDispID(DISPATCHEX(&This
->dispex
), id
);
1675 static HRESULT WINAPI
DocDispatchEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
1677 HTMLDocument
*This
= DISPEX_THIS(iface
);
1679 return IDispatchEx_GetMemberProperties(DISPATCHEX(&This
->dispex
), id
, grfdexFetch
, pgrfdex
);
1682 static HRESULT WINAPI
DocDispatchEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
1684 HTMLDocument
*This
= DISPEX_THIS(iface
);
1686 return IDispatchEx_GetMemberName(DISPATCHEX(&This
->dispex
), id
, pbstrName
);
1689 static HRESULT WINAPI
DocDispatchEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
1691 HTMLDocument
*This
= DISPEX_THIS(iface
);
1693 return IDispatchEx_GetNextDispID(DISPATCHEX(&This
->dispex
), grfdex
, id
, pid
);
1696 static HRESULT WINAPI
DocDispatchEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
1698 HTMLDocument
*This
= DISPEX_THIS(iface
);
1700 return IDispatchEx_GetNameSpaceParent(DISPATCHEX(&This
->dispex
), ppunk
);
1705 static const IDispatchExVtbl DocDispatchExVtbl
= {
1706 DocDispatchEx_QueryInterface
,
1707 DocDispatchEx_AddRef
,
1708 DocDispatchEx_Release
,
1709 DocDispatchEx_GetTypeInfoCount
,
1710 DocDispatchEx_GetTypeInfo
,
1711 DocDispatchEx_GetIDsOfNames
,
1712 DocDispatchEx_Invoke
,
1713 DocDispatchEx_GetDispID
,
1714 DocDispatchEx_InvokeEx
,
1715 DocDispatchEx_DeleteMemberByName
,
1716 DocDispatchEx_DeleteMemberByDispID
,
1717 DocDispatchEx_GetMemberProperties
,
1718 DocDispatchEx_GetMemberName
,
1719 DocDispatchEx_GetNextDispID
,
1720 DocDispatchEx_GetNameSpaceParent
1723 static const tid_t HTMLDocument_iface_tids
[] = {
1730 static dispex_static_data_t HTMLDocument_dispex
= {
1732 DispHTMLDocument_tid
,
1734 HTMLDocument_iface_tids
1737 static HRESULT
alloc_doc(HTMLDocument
**ret
)
1741 doc
= heap_alloc_zero(sizeof(HTMLDocument
));
1742 doc
->lpHTMLDocument2Vtbl
= &HTMLDocumentVtbl
;
1743 doc
->lpIDispatchExVtbl
= &DocDispatchExVtbl
;
1745 doc
->readystate
= READYSTATE_UNINITIALIZED
;
1746 doc
->scriptmode
= SCRIPTMODE_GECKO
;
1748 list_init(&doc
->bindings
);
1749 list_init(&doc
->script_hosts
);
1750 list_init(&doc
->selection_list
);
1751 list_init(&doc
->range_list
);
1753 HTMLDocument_HTMLDocument3_Init(doc
);
1754 HTMLDocument_HTMLDocument5_Init(doc
);
1755 HTMLDocument_Persist_Init(doc
);
1756 HTMLDocument_OleCmd_Init(doc
);
1757 HTMLDocument_OleObj_Init(doc
);
1758 HTMLDocument_View_Init(doc
);
1759 HTMLDocument_Window_Init(doc
);
1760 HTMLDocument_Service_Init(doc
);
1761 HTMLDocument_Hlink_Init(doc
);
1763 ConnectionPointContainer_Init(&doc
->cp_container
, (IUnknown
*)HTMLDOC(doc
));
1764 ConnectionPoint_Init(&doc
->cp_propnotif
, &doc
->cp_container
, &IID_IPropertyNotifySink
);
1765 ConnectionPoint_Init(&doc
->cp_htmldocevents
, &doc
->cp_container
, &DIID_HTMLDocumentEvents
);
1766 ConnectionPoint_Init(&doc
->cp_htmldocevents2
, &doc
->cp_container
, &DIID_HTMLDocumentEvents2
);
1768 init_dispex(&doc
->dispex
, (IUnknown
*)HTMLDOC(doc
), &HTMLDocument_dispex
);
1774 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*nsdoc
, HTMLDocument
**ret
)
1779 hres
= alloc_doc(&doc
);
1783 nsIDOMHTMLDocument_AddRef(nsdoc
);
1786 hres
= HTMLWindow_Create(doc
, NULL
, &doc
->window
);
1788 IHTMLDocument_Release(HTMLDOC(doc
));
1796 HRESULT
HTMLDocument_Create(IUnknown
*pUnkOuter
, REFIID riid
, void** ppvObject
)
1799 nsIDOMWindow
*nswindow
= NULL
;
1802 TRACE("(%p %s %p)\n", pUnkOuter
, debugstr_guid(riid
), ppvObject
);
1804 hres
= alloc_doc(&doc
);
1808 hres
= IHTMLDocument_QueryInterface(HTMLDOC(doc
), riid
, ppvObject
);
1809 IHTMLDocument_Release(HTMLDOC(doc
));
1815 doc
->nscontainer
= NSContainer_Create(doc
, NULL
);
1816 update_nsdocument(doc
);
1818 if(doc
->nscontainer
) {
1821 nsres
= nsIWebBrowser_GetContentDOMWindow(doc
->nscontainer
->webbrowser
, &nswindow
);
1822 if(NS_FAILED(nsres
))
1823 ERR("GetContentDOMWindow failed: %08x\n", nsres
);
1826 hres
= HTMLWindow_Create(doc
, nswindow
, &doc
->window
);
1828 nsIDOMWindow_Release(nswindow
);
1830 IHTMLDocument_Release(HTMLDOC(doc
));