2 * Copyright 2006 Jacek Caban for CodeWeavers
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #include "wine/debug.h"
34 #include "mshtml_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
39 const IHTMLBodyElementVtbl *lpHTMLBodyElementVtbl;
42 nsIDOMHTMLBodyElement *nsbody;
45 #define HTMLBODY(x) ((IHTMLBodyElement*) &(x)->lpHTMLBodyElementVtbl)
47 #define HTMLBODY_THIS(iface) DEFINE_THIS(HTMLBodyElement, HTMLBodyElement, iface)
49 static HRESULT WINAPI HTMLBodyElement_QueryInterface(IHTMLBodyElement *iface,
50 REFIID riid, void **ppv)
52 HTMLBodyElement *This = HTMLBODY_THIS(iface);
56 if(IsEqualGUID(&IID_IUnknown, riid)) {
57 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
58 *ppv = HTMLBODY(This);
59 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
60 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
61 *ppv = HTMLBODY(This);
62 }else if(IsEqualGUID(&IID_IHTMLBodyElement, riid)) {
63 TRACE("(%p)->(IID_IHTMLBodyElement %p)\n", This, ppv);
64 *ppv = HTMLBODY(This);
65 }else if(IsEqualGUID(&IID_IHTMLElement, riid)) {
66 TRACE("(%p)->(IID_IHTMLElement %p)\n", This, ppv);
67 *ppv = HTMLELEM(This->element);
68 }else if(IsEqualGUID(&IID_IHTMLDOMNode, riid)) {
69 TRACE("(%p)->(IID_IHTMLDOMNode %p)\n", This, ppv);
70 *ppv = HTMLDOMNODE(This->element->node);
74 IUnknown_AddRef((IUnknown*)*ppv);
78 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
82 static ULONG WINAPI HTMLBodyElement_AddRef(IHTMLBodyElement *iface)
84 HTMLBodyElement *This = HTMLBODY_THIS(iface);
86 TRACE("(%p)\n", This);
88 return IHTMLDocument2_AddRef(HTMLDOC(This->element->node->doc));
91 static ULONG WINAPI HTMLBodyElement_Release(IHTMLBodyElement *iface)
93 HTMLBodyElement *This = HTMLBODY_THIS(iface);
95 TRACE("(%p)\n", This);
97 return IHTMLDocument2_Release(HTMLDOC(This->element->node->doc));
100 static HRESULT WINAPI HTMLBodyElement_GetTypeInfoCount(IHTMLBodyElement *iface, UINT *pctinfo)
102 HTMLBodyElement *This = HTMLBODY_THIS(iface);
103 FIXME("(%p)->(%p)\n", This, pctinfo);
107 static HRESULT WINAPI HTMLBodyElement_GetTypeInfo(IHTMLBodyElement *iface, UINT iTInfo,
108 LCID lcid, ITypeInfo **ppTInfo)
110 HTMLBodyElement *This = HTMLBODY_THIS(iface);
111 FIXME("(%p)->(%u %lu %p)\n", This, iTInfo, lcid, ppTInfo);
115 static HRESULT WINAPI HTMLBodyElement_GetIDsOfNames(IHTMLBodyElement *iface, REFIID riid,
116 LPOLESTR *rgszNames, UINT cNames,
117 LCID lcid, DISPID *rgDispId)
119 HTMLBodyElement *This = HTMLBODY_THIS(iface);
120 FIXME("(%p)->(%s %p %u %lu %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
125 static HRESULT WINAPI HTMLBodyElement_Invoke(IHTMLBodyElement *iface, DISPID dispIdMember,
126 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
127 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
129 HTMLBodyElement *This = HTMLBODY_THIS(iface);
130 FIXME("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
131 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
135 static HRESULT WINAPI HTMLBodyElement_put_background(IHTMLBodyElement *iface, BSTR v)
137 HTMLBodyElement *This = HTMLBODY_THIS(iface);
138 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
142 static HRESULT WINAPI HTMLBodyElement_get_background(IHTMLBodyElement *iface, BSTR *p)
144 HTMLBodyElement *This = HTMLBODY_THIS(iface);
145 TRACE("(%p)->(%p)\n", This, p);
149 static HRESULT WINAPI HTMLBodyElement_put_bgProperties(IHTMLBodyElement *iface, BSTR v)
151 HTMLBodyElement *This = HTMLBODY_THIS(iface);
152 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
156 static HRESULT WINAPI HTMLBodyElement_get_bgProperties(IHTMLBodyElement *iface, BSTR *p)
158 HTMLBodyElement *This = HTMLBODY_THIS(iface);
159 TRACE("(%p)->(%p)\n", This, p);
163 static HRESULT WINAPI HTMLBodyElement_put_leftMargin(IHTMLBodyElement *iface, VARIANT v)
165 HTMLBodyElement *This = HTMLBODY_THIS(iface);
166 TRACE("(%p)->()\n", This);
170 static HRESULT WINAPI HTMLBodyElement_get_leftMargin(IHTMLBodyElement *iface, VARIANT *p)
172 HTMLBodyElement *This = HTMLBODY_THIS(iface);
173 TRACE("(%p)->(%p)\n", This, p);
177 static HRESULT WINAPI HTMLBodyElement_put_topMargin(IHTMLBodyElement *iface, VARIANT v)
179 HTMLBodyElement *This = HTMLBODY_THIS(iface);
180 TRACE("(%p)->()\n", This);
184 static HRESULT WINAPI HTMLBodyElement_get_topMargin(IHTMLBodyElement *iface, VARIANT *p)
186 HTMLBodyElement *This = HTMLBODY_THIS(iface);
187 TRACE("(%p)->(%p)\n", This, p);
191 static HRESULT WINAPI HTMLBodyElement_put_rightMargin(IHTMLBodyElement *iface, VARIANT v)
193 HTMLBodyElement *This = HTMLBODY_THIS(iface);
194 TRACE("(%p)->()\n", This);
198 static HRESULT WINAPI HTMLBodyElement_get_rightMargin(IHTMLBodyElement *iface, VARIANT *p)
200 HTMLBodyElement *This = HTMLBODY_THIS(iface);
201 TRACE("(%p)->(%p)\n", This, p);
205 static HRESULT WINAPI HTMLBodyElement_put_bottomMargin(IHTMLBodyElement *iface, VARIANT v)
207 HTMLBodyElement *This = HTMLBODY_THIS(iface);
208 TRACE("(%p)->()\n", This);
212 static HRESULT WINAPI HTMLBodyElement_get_bottomMargin(IHTMLBodyElement *iface, VARIANT *p)
214 HTMLBodyElement *This = HTMLBODY_THIS(iface);
215 TRACE("(%p)->(%p)\n", This, p);
219 static HRESULT WINAPI HTMLBodyElement_put_noWrap(IHTMLBodyElement *iface, VARIANT_BOOL v)
221 HTMLBodyElement *This = HTMLBODY_THIS(iface);
222 TRACE("(%p)->(%x)\n", This, v);
226 static HRESULT WINAPI HTMLBodyElement_get_noWrap(IHTMLBodyElement *iface, VARIANT_BOOL *p)
228 HTMLBodyElement *This = HTMLBODY_THIS(iface);
229 TRACE("(%p)->(%p)\n", This, p);
233 static HRESULT WINAPI HTMLBodyElement_put_bgColor(IHTMLBodyElement *iface, VARIANT v)
235 HTMLBodyElement *This = HTMLBODY_THIS(iface);
236 TRACE("(%p)->()\n", This);
240 static HRESULT WINAPI HTMLBodyElement_get_bgColor(IHTMLBodyElement *iface, VARIANT *p)
242 HTMLBodyElement *This = HTMLBODY_THIS(iface);
243 TRACE("(%p)->(%p)\n", This, p);
247 static HRESULT WINAPI HTMLBodyElement_put_text(IHTMLBodyElement *iface, VARIANT v)
249 HTMLBodyElement *This = HTMLBODY_THIS(iface);
250 TRACE("(%p)->()\n", This);
254 static HRESULT WINAPI HTMLBodyElement_get_text(IHTMLBodyElement *iface, VARIANT *p)
256 HTMLBodyElement *This = HTMLBODY_THIS(iface);
257 TRACE("(%p)->(%p)\n", This, p);
261 static HRESULT WINAPI HTMLBodyElement_put_link(IHTMLBodyElement *iface, VARIANT v)
263 HTMLBodyElement *This = HTMLBODY_THIS(iface);
264 TRACE("(%p)->()\n", This);
268 static HRESULT WINAPI HTMLBodyElement_get_link(IHTMLBodyElement *iface, VARIANT *p)
270 HTMLBodyElement *This = HTMLBODY_THIS(iface);
271 TRACE("(%p)->(%p)\n", This, p);
275 static HRESULT WINAPI HTMLBodyElement_put_vLink(IHTMLBodyElement *iface, VARIANT v)
277 HTMLBodyElement *This = HTMLBODY_THIS(iface);
278 TRACE("(%p)->()\n", This);
282 static HRESULT WINAPI HTMLBodyElement_get_vLink(IHTMLBodyElement *iface, VARIANT *p)
284 HTMLBodyElement *This = HTMLBODY_THIS(iface);
285 TRACE("(%p)->(%p)\n", This, p);
289 static HRESULT WINAPI HTMLBodyElement_put_aLink(IHTMLBodyElement *iface, VARIANT v)
291 HTMLBodyElement *This = HTMLBODY_THIS(iface);
292 TRACE("(%p)->()\n", This);
296 static HRESULT WINAPI HTMLBodyElement_get_aLink(IHTMLBodyElement *iface, VARIANT *p)
298 HTMLBodyElement *This = HTMLBODY_THIS(iface);
299 TRACE("(%p)->(%p)\n", This, p);
303 static HRESULT WINAPI HTMLBodyElement_put_onload(IHTMLBodyElement *iface, VARIANT v)
305 HTMLBodyElement *This = HTMLBODY_THIS(iface);
306 TRACE("(%p)->()\n", This);
310 static HRESULT WINAPI HTMLBodyElement_get_onload(IHTMLBodyElement *iface, VARIANT *p)
312 HTMLBodyElement *This = HTMLBODY_THIS(iface);
313 TRACE("(%p)->(%p)\n", This, p);
317 static HRESULT WINAPI HTMLBodyElement_put_onunload(IHTMLBodyElement *iface, VARIANT v)
319 HTMLBodyElement *This = HTMLBODY_THIS(iface);
320 TRACE("(%p)->()\n", This);
324 static HRESULT WINAPI HTMLBodyElement_get_onunload(IHTMLBodyElement *iface, VARIANT *p)
326 HTMLBodyElement *This = HTMLBODY_THIS(iface);
327 TRACE("(%p)->(%p)\n", This, p);
331 static HRESULT WINAPI HTMLBodyElement_put_scroll(IHTMLBodyElement *iface, BSTR v)
333 HTMLBodyElement *This = HTMLBODY_THIS(iface);
334 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
338 static HRESULT WINAPI HTMLBodyElement_get_scroll(IHTMLBodyElement *iface, BSTR *p)
340 HTMLBodyElement *This = HTMLBODY_THIS(iface);
341 TRACE("(%p)->(%p)\n", This, p);
345 static HRESULT WINAPI HTMLBodyElement_put_onselect(IHTMLBodyElement *iface, VARIANT v)
347 HTMLBodyElement *This = HTMLBODY_THIS(iface);
348 TRACE("(%p)->()\n", This);
352 static HRESULT WINAPI HTMLBodyElement_get_onselect(IHTMLBodyElement *iface, VARIANT *p)
354 HTMLBodyElement *This = HTMLBODY_THIS(iface);
355 TRACE("(%p)->(%p)\n", This, p);
359 static HRESULT WINAPI HTMLBodyElement_put_onbeforeunload(IHTMLBodyElement *iface, VARIANT v)
361 HTMLBodyElement *This = HTMLBODY_THIS(iface);
362 TRACE("(%p)->()\n", This);
366 static HRESULT WINAPI HTMLBodyElement_get_onbeforeunload(IHTMLBodyElement *iface, VARIANT *p)
368 HTMLBodyElement *This = HTMLBODY_THIS(iface);
369 TRACE("(%p)->(%p)\n", This, p);
373 static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, IHTMLTxtRange **range)
375 HTMLBodyElement *This = HTMLBODY_THIS(iface);
376 TRACE("(%p)->(%p)\n", This, range);
380 static void HTMLBodyElement_destructor(IUnknown *iface)
382 HTMLBodyElement *This = HTMLBODY_THIS(iface);
384 nsIDOMHTMLBodyElement_Release(This->nsbody);
385 HeapFree(GetProcessHeap(), 0, This);
388 static const IHTMLBodyElementVtbl HTMLBodyElementVtbl = {
389 HTMLBodyElement_QueryInterface,
390 HTMLBodyElement_AddRef,
391 HTMLBodyElement_Release,
392 HTMLBodyElement_GetTypeInfoCount,
393 HTMLBodyElement_GetTypeInfo,
394 HTMLBodyElement_GetIDsOfNames,
395 HTMLBodyElement_Invoke,
396 HTMLBodyElement_put_background,
397 HTMLBodyElement_get_background,
398 HTMLBodyElement_put_bgProperties,
399 HTMLBodyElement_get_bgProperties,
400 HTMLBodyElement_put_leftMargin,
401 HTMLBodyElement_get_leftMargin,
402 HTMLBodyElement_put_topMargin,
403 HTMLBodyElement_get_topMargin,
404 HTMLBodyElement_put_rightMargin,
405 HTMLBodyElement_get_rightMargin,
406 HTMLBodyElement_put_bottomMargin,
407 HTMLBodyElement_get_bottomMargin,
408 HTMLBodyElement_put_noWrap,
409 HTMLBodyElement_get_noWrap,
410 HTMLBodyElement_put_bgColor,
411 HTMLBodyElement_get_bgColor,
412 HTMLBodyElement_put_text,
413 HTMLBodyElement_get_text,
414 HTMLBodyElement_put_link,
415 HTMLBodyElement_get_link,
416 HTMLBodyElement_put_vLink,
417 HTMLBodyElement_get_vLink,
418 HTMLBodyElement_put_aLink,
419 HTMLBodyElement_get_aLink,
420 HTMLBodyElement_put_onload,
421 HTMLBodyElement_get_onload,
422 HTMLBodyElement_put_onunload,
423 HTMLBodyElement_get_onunload,
424 HTMLBodyElement_put_scroll,
425 HTMLBodyElement_get_scroll,
426 HTMLBodyElement_put_onselect,
427 HTMLBodyElement_get_onselect,
428 HTMLBodyElement_put_onbeforeunload,
429 HTMLBodyElement_get_onbeforeunload,
430 HTMLBodyElement_createTextRange
433 void HTMLBodyElement_Create(HTMLElement *element)
435 HTMLBodyElement *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLBodyElement));
438 ret->lpHTMLBodyElementVtbl = &HTMLBodyElementVtbl;
439 ret->element = element;
441 nsres = nsIDOMHTMLElement_QueryInterface(element->nselem, &IID_nsIDOMHTMLBodyElement,
442 (void**)&ret->nsbody);
444 ERR("Could not get nsDOMHTMLBodyElement: %08lx\n", nsres);
446 element->impl = (IUnknown*)HTMLBODY(ret);
447 element->destructor = HTMLBodyElement_destructor;