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