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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
32 #include "wine/debug.h"
34 #include "mshtml_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
39 const IHTMLBodyElementVtbl
*lpHTMLBodyElementVtbl
;
41 HTMLTextContainer text_container
;
44 nsIDOMHTMLBodyElement
*nsbody
;
47 #define HTMLBODY(x) ((IHTMLBodyElement*) &(x)->lpHTMLBodyElementVtbl)
49 #define HTMLBODY_THIS(iface) DEFINE_THIS(HTMLBodyElement, HTMLBodyElement, iface)
51 static HRESULT WINAPI
HTMLBodyElement_QueryInterface(IHTMLBodyElement
*iface
,
52 REFIID riid
, void **ppv
)
54 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
59 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
60 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
61 *ppv
= HTMLBODY(This
);
62 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
63 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
64 *ppv
= HTMLBODY(This
);
65 }else if(IsEqualGUID(&IID_IHTMLBodyElement
, riid
)) {
66 TRACE("(%p)->(IID_IHTMLBodyElement %p)\n", This
, ppv
);
67 *ppv
= HTMLBODY(This
);
68 }else if(IsEqualGUID(&IID_IHTMLTextContainer
, riid
)) {
69 TRACE("(%p)->(IID_IHTMLTextContainer %p)\n", This
, ppv
);
70 *ppv
= HTMLTEXTCONT(&This
->text_container
);
74 IUnknown_AddRef((IUnknown
*)*ppv
);
78 hres
= HTMLElement_QI(This
->element
, riid
, ppv
);
80 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
85 static ULONG WINAPI
HTMLBodyElement_AddRef(IHTMLBodyElement
*iface
)
87 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
89 TRACE("(%p)\n", This
);
91 return IHTMLDocument2_AddRef(HTMLDOC(This
->element
->node
->doc
));
94 static ULONG WINAPI
HTMLBodyElement_Release(IHTMLBodyElement
*iface
)
96 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
98 TRACE("(%p)\n", This
);
100 return IHTMLDocument2_Release(HTMLDOC(This
->element
->node
->doc
));
103 static HRESULT WINAPI
HTMLBodyElement_GetTypeInfoCount(IHTMLBodyElement
*iface
, UINT
*pctinfo
)
105 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
106 FIXME("(%p)->(%p)\n", This
, pctinfo
);
110 static HRESULT WINAPI
HTMLBodyElement_GetTypeInfo(IHTMLBodyElement
*iface
, UINT iTInfo
,
111 LCID lcid
, ITypeInfo
**ppTInfo
)
113 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
114 FIXME("(%p)->(%u %lu %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
118 static HRESULT WINAPI
HTMLBodyElement_GetIDsOfNames(IHTMLBodyElement
*iface
, REFIID riid
,
119 LPOLESTR
*rgszNames
, UINT cNames
,
120 LCID lcid
, DISPID
*rgDispId
)
122 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
123 FIXME("(%p)->(%s %p %u %lu %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
128 static HRESULT WINAPI
HTMLBodyElement_Invoke(IHTMLBodyElement
*iface
, DISPID dispIdMember
,
129 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
130 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
132 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
133 FIXME("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
134 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
138 static HRESULT WINAPI
HTMLBodyElement_put_background(IHTMLBodyElement
*iface
, BSTR v
)
140 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
141 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
145 static HRESULT WINAPI
HTMLBodyElement_get_background(IHTMLBodyElement
*iface
, BSTR
*p
)
147 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
148 TRACE("(%p)->(%p)\n", This
, p
);
152 static HRESULT WINAPI
HTMLBodyElement_put_bgProperties(IHTMLBodyElement
*iface
, BSTR v
)
154 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
155 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
159 static HRESULT WINAPI
HTMLBodyElement_get_bgProperties(IHTMLBodyElement
*iface
, BSTR
*p
)
161 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
162 TRACE("(%p)->(%p)\n", This
, p
);
166 static HRESULT WINAPI
HTMLBodyElement_put_leftMargin(IHTMLBodyElement
*iface
, VARIANT v
)
168 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
169 TRACE("(%p)->()\n", This
);
173 static HRESULT WINAPI
HTMLBodyElement_get_leftMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
175 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
176 TRACE("(%p)->(%p)\n", This
, p
);
180 static HRESULT WINAPI
HTMLBodyElement_put_topMargin(IHTMLBodyElement
*iface
, VARIANT v
)
182 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
183 TRACE("(%p)->()\n", This
);
187 static HRESULT WINAPI
HTMLBodyElement_get_topMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
189 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
190 TRACE("(%p)->(%p)\n", This
, p
);
194 static HRESULT WINAPI
HTMLBodyElement_put_rightMargin(IHTMLBodyElement
*iface
, VARIANT v
)
196 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
197 TRACE("(%p)->()\n", This
);
201 static HRESULT WINAPI
HTMLBodyElement_get_rightMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
203 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
204 TRACE("(%p)->(%p)\n", This
, p
);
208 static HRESULT WINAPI
HTMLBodyElement_put_bottomMargin(IHTMLBodyElement
*iface
, VARIANT v
)
210 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
211 TRACE("(%p)->()\n", This
);
215 static HRESULT WINAPI
HTMLBodyElement_get_bottomMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
217 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
218 TRACE("(%p)->(%p)\n", This
, p
);
222 static HRESULT WINAPI
HTMLBodyElement_put_noWrap(IHTMLBodyElement
*iface
, VARIANT_BOOL v
)
224 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
225 TRACE("(%p)->(%x)\n", This
, v
);
229 static HRESULT WINAPI
HTMLBodyElement_get_noWrap(IHTMLBodyElement
*iface
, VARIANT_BOOL
*p
)
231 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
232 TRACE("(%p)->(%p)\n", This
, p
);
236 static HRESULT WINAPI
HTMLBodyElement_put_bgColor(IHTMLBodyElement
*iface
, VARIANT v
)
238 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
239 TRACE("(%p)->()\n", This
);
243 static HRESULT WINAPI
HTMLBodyElement_get_bgColor(IHTMLBodyElement
*iface
, VARIANT
*p
)
245 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
246 TRACE("(%p)->(%p)\n", This
, p
);
250 static HRESULT WINAPI
HTMLBodyElement_put_text(IHTMLBodyElement
*iface
, VARIANT v
)
252 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
253 TRACE("(%p)->()\n", This
);
257 static HRESULT WINAPI
HTMLBodyElement_get_text(IHTMLBodyElement
*iface
, VARIANT
*p
)
259 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
260 TRACE("(%p)->(%p)\n", This
, p
);
264 static HRESULT WINAPI
HTMLBodyElement_put_link(IHTMLBodyElement
*iface
, VARIANT v
)
266 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
267 TRACE("(%p)->()\n", This
);
271 static HRESULT WINAPI
HTMLBodyElement_get_link(IHTMLBodyElement
*iface
, VARIANT
*p
)
273 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
274 TRACE("(%p)->(%p)\n", This
, p
);
278 static HRESULT WINAPI
HTMLBodyElement_put_vLink(IHTMLBodyElement
*iface
, VARIANT v
)
280 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
281 TRACE("(%p)->()\n", This
);
285 static HRESULT WINAPI
HTMLBodyElement_get_vLink(IHTMLBodyElement
*iface
, VARIANT
*p
)
287 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
288 TRACE("(%p)->(%p)\n", This
, p
);
292 static HRESULT WINAPI
HTMLBodyElement_put_aLink(IHTMLBodyElement
*iface
, VARIANT v
)
294 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
295 TRACE("(%p)->()\n", This
);
299 static HRESULT WINAPI
HTMLBodyElement_get_aLink(IHTMLBodyElement
*iface
, VARIANT
*p
)
301 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
302 TRACE("(%p)->(%p)\n", This
, p
);
306 static HRESULT WINAPI
HTMLBodyElement_put_onload(IHTMLBodyElement
*iface
, VARIANT v
)
308 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
309 TRACE("(%p)->()\n", This
);
313 static HRESULT WINAPI
HTMLBodyElement_get_onload(IHTMLBodyElement
*iface
, VARIANT
*p
)
315 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
316 TRACE("(%p)->(%p)\n", This
, p
);
320 static HRESULT WINAPI
HTMLBodyElement_put_onunload(IHTMLBodyElement
*iface
, VARIANT v
)
322 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
323 TRACE("(%p)->()\n", This
);
327 static HRESULT WINAPI
HTMLBodyElement_get_onunload(IHTMLBodyElement
*iface
, VARIANT
*p
)
329 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
330 TRACE("(%p)->(%p)\n", This
, p
);
334 static HRESULT WINAPI
HTMLBodyElement_put_scroll(IHTMLBodyElement
*iface
, BSTR v
)
336 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
337 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
341 static HRESULT WINAPI
HTMLBodyElement_get_scroll(IHTMLBodyElement
*iface
, BSTR
*p
)
343 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
344 TRACE("(%p)->(%p)\n", This
, p
);
348 static HRESULT WINAPI
HTMLBodyElement_put_onselect(IHTMLBodyElement
*iface
, VARIANT v
)
350 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
351 TRACE("(%p)->()\n", This
);
355 static HRESULT WINAPI
HTMLBodyElement_get_onselect(IHTMLBodyElement
*iface
, VARIANT
*p
)
357 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
358 TRACE("(%p)->(%p)\n", This
, p
);
362 static HRESULT WINAPI
HTMLBodyElement_put_onbeforeunload(IHTMLBodyElement
*iface
, VARIANT v
)
364 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
365 TRACE("(%p)->()\n", This
);
369 static HRESULT WINAPI
HTMLBodyElement_get_onbeforeunload(IHTMLBodyElement
*iface
, VARIANT
*p
)
371 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
372 TRACE("(%p)->(%p)\n", This
, p
);
376 static HRESULT WINAPI
HTMLBodyElement_createTextRange(IHTMLBodyElement
*iface
, IHTMLTxtRange
**range
)
378 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
379 TRACE("(%p)->(%p)\n", This
, range
);
383 static void HTMLBodyElement_destructor(IUnknown
*iface
)
385 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
387 nsIDOMHTMLBodyElement_Release(This
->nsbody
);
391 static const IHTMLBodyElementVtbl HTMLBodyElementVtbl
= {
392 HTMLBodyElement_QueryInterface
,
393 HTMLBodyElement_AddRef
,
394 HTMLBodyElement_Release
,
395 HTMLBodyElement_GetTypeInfoCount
,
396 HTMLBodyElement_GetTypeInfo
,
397 HTMLBodyElement_GetIDsOfNames
,
398 HTMLBodyElement_Invoke
,
399 HTMLBodyElement_put_background
,
400 HTMLBodyElement_get_background
,
401 HTMLBodyElement_put_bgProperties
,
402 HTMLBodyElement_get_bgProperties
,
403 HTMLBodyElement_put_leftMargin
,
404 HTMLBodyElement_get_leftMargin
,
405 HTMLBodyElement_put_topMargin
,
406 HTMLBodyElement_get_topMargin
,
407 HTMLBodyElement_put_rightMargin
,
408 HTMLBodyElement_get_rightMargin
,
409 HTMLBodyElement_put_bottomMargin
,
410 HTMLBodyElement_get_bottomMargin
,
411 HTMLBodyElement_put_noWrap
,
412 HTMLBodyElement_get_noWrap
,
413 HTMLBodyElement_put_bgColor
,
414 HTMLBodyElement_get_bgColor
,
415 HTMLBodyElement_put_text
,
416 HTMLBodyElement_get_text
,
417 HTMLBodyElement_put_link
,
418 HTMLBodyElement_get_link
,
419 HTMLBodyElement_put_vLink
,
420 HTMLBodyElement_get_vLink
,
421 HTMLBodyElement_put_aLink
,
422 HTMLBodyElement_get_aLink
,
423 HTMLBodyElement_put_onload
,
424 HTMLBodyElement_get_onload
,
425 HTMLBodyElement_put_onunload
,
426 HTMLBodyElement_get_onunload
,
427 HTMLBodyElement_put_scroll
,
428 HTMLBodyElement_get_scroll
,
429 HTMLBodyElement_put_onselect
,
430 HTMLBodyElement_get_onselect
,
431 HTMLBodyElement_put_onbeforeunload
,
432 HTMLBodyElement_get_onbeforeunload
,
433 HTMLBodyElement_createTextRange
436 void HTMLBodyElement_Create(HTMLElement
*element
)
438 HTMLBodyElement
*ret
= mshtml_alloc(sizeof(HTMLBodyElement
));
441 ret
->lpHTMLBodyElementVtbl
= &HTMLBodyElementVtbl
;
442 ret
->element
= element
;
444 HTMLTextContainer_Init(&ret
->text_container
, (IUnknown
*)HTMLBODY(ret
));
446 nsres
= nsIDOMHTMLElement_QueryInterface(element
->nselem
, &IID_nsIDOMHTMLBodyElement
,
447 (void**)&ret
->nsbody
);
449 ERR("Could not get nsDOMHTMLBodyElement: %08lx\n", nsres
);
451 element
->impl
= (IUnknown
*)HTMLBODY(ret
);
452 element
->destructor
= HTMLBodyElement_destructor
;