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
);
57 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
58 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
59 *ppv
= HTMLBODY(This
);
60 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
61 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
62 *ppv
= HTMLBODY(This
);
63 }else if(IsEqualGUID(&IID_IHTMLBodyElement
, riid
)) {
64 TRACE("(%p)->(IID_IHTMLBodyElement %p)\n", This
, ppv
);
65 *ppv
= HTMLBODY(This
);
69 IUnknown_AddRef((IUnknown
*)*ppv
);
73 hres
= HTMLElement_QI(This
->element
, riid
, ppv
);
75 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
80 static ULONG WINAPI
HTMLBodyElement_AddRef(IHTMLBodyElement
*iface
)
82 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
84 TRACE("(%p)\n", This
);
86 return IHTMLDocument2_AddRef(HTMLDOC(This
->element
->node
->doc
));
89 static ULONG WINAPI
HTMLBodyElement_Release(IHTMLBodyElement
*iface
)
91 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
93 TRACE("(%p)\n", This
);
95 return IHTMLDocument2_Release(HTMLDOC(This
->element
->node
->doc
));
98 static HRESULT WINAPI
HTMLBodyElement_GetTypeInfoCount(IHTMLBodyElement
*iface
, UINT
*pctinfo
)
100 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
101 FIXME("(%p)->(%p)\n", This
, pctinfo
);
105 static HRESULT WINAPI
HTMLBodyElement_GetTypeInfo(IHTMLBodyElement
*iface
, UINT iTInfo
,
106 LCID lcid
, ITypeInfo
**ppTInfo
)
108 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
109 FIXME("(%p)->(%u %lu %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
113 static HRESULT WINAPI
HTMLBodyElement_GetIDsOfNames(IHTMLBodyElement
*iface
, REFIID riid
,
114 LPOLESTR
*rgszNames
, UINT cNames
,
115 LCID lcid
, DISPID
*rgDispId
)
117 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
118 FIXME("(%p)->(%s %p %u %lu %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
123 static HRESULT WINAPI
HTMLBodyElement_Invoke(IHTMLBodyElement
*iface
, DISPID dispIdMember
,
124 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
125 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
127 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
128 FIXME("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
129 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
133 static HRESULT WINAPI
HTMLBodyElement_put_background(IHTMLBodyElement
*iface
, BSTR v
)
135 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
136 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
140 static HRESULT WINAPI
HTMLBodyElement_get_background(IHTMLBodyElement
*iface
, BSTR
*p
)
142 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
143 TRACE("(%p)->(%p)\n", This
, p
);
147 static HRESULT WINAPI
HTMLBodyElement_put_bgProperties(IHTMLBodyElement
*iface
, BSTR v
)
149 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
150 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
154 static HRESULT WINAPI
HTMLBodyElement_get_bgProperties(IHTMLBodyElement
*iface
, BSTR
*p
)
156 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
157 TRACE("(%p)->(%p)\n", This
, p
);
161 static HRESULT WINAPI
HTMLBodyElement_put_leftMargin(IHTMLBodyElement
*iface
, VARIANT v
)
163 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
164 TRACE("(%p)->()\n", This
);
168 static HRESULT WINAPI
HTMLBodyElement_get_leftMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
170 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
171 TRACE("(%p)->(%p)\n", This
, p
);
175 static HRESULT WINAPI
HTMLBodyElement_put_topMargin(IHTMLBodyElement
*iface
, VARIANT v
)
177 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
178 TRACE("(%p)->()\n", This
);
182 static HRESULT WINAPI
HTMLBodyElement_get_topMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
184 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
185 TRACE("(%p)->(%p)\n", This
, p
);
189 static HRESULT WINAPI
HTMLBodyElement_put_rightMargin(IHTMLBodyElement
*iface
, VARIANT v
)
191 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
192 TRACE("(%p)->()\n", This
);
196 static HRESULT WINAPI
HTMLBodyElement_get_rightMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
198 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
199 TRACE("(%p)->(%p)\n", This
, p
);
203 static HRESULT WINAPI
HTMLBodyElement_put_bottomMargin(IHTMLBodyElement
*iface
, VARIANT v
)
205 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
206 TRACE("(%p)->()\n", This
);
210 static HRESULT WINAPI
HTMLBodyElement_get_bottomMargin(IHTMLBodyElement
*iface
, VARIANT
*p
)
212 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
213 TRACE("(%p)->(%p)\n", This
, p
);
217 static HRESULT WINAPI
HTMLBodyElement_put_noWrap(IHTMLBodyElement
*iface
, VARIANT_BOOL v
)
219 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
220 TRACE("(%p)->(%x)\n", This
, v
);
224 static HRESULT WINAPI
HTMLBodyElement_get_noWrap(IHTMLBodyElement
*iface
, VARIANT_BOOL
*p
)
226 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
227 TRACE("(%p)->(%p)\n", This
, p
);
231 static HRESULT WINAPI
HTMLBodyElement_put_bgColor(IHTMLBodyElement
*iface
, VARIANT v
)
233 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
234 TRACE("(%p)->()\n", This
);
238 static HRESULT WINAPI
HTMLBodyElement_get_bgColor(IHTMLBodyElement
*iface
, VARIANT
*p
)
240 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
241 TRACE("(%p)->(%p)\n", This
, p
);
245 static HRESULT WINAPI
HTMLBodyElement_put_text(IHTMLBodyElement
*iface
, VARIANT v
)
247 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
248 TRACE("(%p)->()\n", This
);
252 static HRESULT WINAPI
HTMLBodyElement_get_text(IHTMLBodyElement
*iface
, VARIANT
*p
)
254 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
255 TRACE("(%p)->(%p)\n", This
, p
);
259 static HRESULT WINAPI
HTMLBodyElement_put_link(IHTMLBodyElement
*iface
, VARIANT v
)
261 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
262 TRACE("(%p)->()\n", This
);
266 static HRESULT WINAPI
HTMLBodyElement_get_link(IHTMLBodyElement
*iface
, VARIANT
*p
)
268 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
269 TRACE("(%p)->(%p)\n", This
, p
);
273 static HRESULT WINAPI
HTMLBodyElement_put_vLink(IHTMLBodyElement
*iface
, VARIANT v
)
275 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
276 TRACE("(%p)->()\n", This
);
280 static HRESULT WINAPI
HTMLBodyElement_get_vLink(IHTMLBodyElement
*iface
, VARIANT
*p
)
282 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
283 TRACE("(%p)->(%p)\n", This
, p
);
287 static HRESULT WINAPI
HTMLBodyElement_put_aLink(IHTMLBodyElement
*iface
, VARIANT v
)
289 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
290 TRACE("(%p)->()\n", This
);
294 static HRESULT WINAPI
HTMLBodyElement_get_aLink(IHTMLBodyElement
*iface
, VARIANT
*p
)
296 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
297 TRACE("(%p)->(%p)\n", This
, p
);
301 static HRESULT WINAPI
HTMLBodyElement_put_onload(IHTMLBodyElement
*iface
, VARIANT v
)
303 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
304 TRACE("(%p)->()\n", This
);
308 static HRESULT WINAPI
HTMLBodyElement_get_onload(IHTMLBodyElement
*iface
, VARIANT
*p
)
310 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
311 TRACE("(%p)->(%p)\n", This
, p
);
315 static HRESULT WINAPI
HTMLBodyElement_put_onunload(IHTMLBodyElement
*iface
, VARIANT v
)
317 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
318 TRACE("(%p)->()\n", This
);
322 static HRESULT WINAPI
HTMLBodyElement_get_onunload(IHTMLBodyElement
*iface
, VARIANT
*p
)
324 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
325 TRACE("(%p)->(%p)\n", This
, p
);
329 static HRESULT WINAPI
HTMLBodyElement_put_scroll(IHTMLBodyElement
*iface
, BSTR v
)
331 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
332 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
336 static HRESULT WINAPI
HTMLBodyElement_get_scroll(IHTMLBodyElement
*iface
, BSTR
*p
)
338 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
339 TRACE("(%p)->(%p)\n", This
, p
);
343 static HRESULT WINAPI
HTMLBodyElement_put_onselect(IHTMLBodyElement
*iface
, VARIANT v
)
345 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
346 TRACE("(%p)->()\n", This
);
350 static HRESULT WINAPI
HTMLBodyElement_get_onselect(IHTMLBodyElement
*iface
, VARIANT
*p
)
352 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
353 TRACE("(%p)->(%p)\n", This
, p
);
357 static HRESULT WINAPI
HTMLBodyElement_put_onbeforeunload(IHTMLBodyElement
*iface
, VARIANT v
)
359 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
360 TRACE("(%p)->()\n", This
);
364 static HRESULT WINAPI
HTMLBodyElement_get_onbeforeunload(IHTMLBodyElement
*iface
, VARIANT
*p
)
366 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
367 TRACE("(%p)->(%p)\n", This
, p
);
371 static HRESULT WINAPI
HTMLBodyElement_createTextRange(IHTMLBodyElement
*iface
, IHTMLTxtRange
**range
)
373 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
374 TRACE("(%p)->(%p)\n", This
, range
);
378 static void HTMLBodyElement_destructor(IUnknown
*iface
)
380 HTMLBodyElement
*This
= HTMLBODY_THIS(iface
);
382 nsIDOMHTMLBodyElement_Release(This
->nsbody
);
383 HeapFree(GetProcessHeap(), 0, This
);
386 static const IHTMLBodyElementVtbl HTMLBodyElementVtbl
= {
387 HTMLBodyElement_QueryInterface
,
388 HTMLBodyElement_AddRef
,
389 HTMLBodyElement_Release
,
390 HTMLBodyElement_GetTypeInfoCount
,
391 HTMLBodyElement_GetTypeInfo
,
392 HTMLBodyElement_GetIDsOfNames
,
393 HTMLBodyElement_Invoke
,
394 HTMLBodyElement_put_background
,
395 HTMLBodyElement_get_background
,
396 HTMLBodyElement_put_bgProperties
,
397 HTMLBodyElement_get_bgProperties
,
398 HTMLBodyElement_put_leftMargin
,
399 HTMLBodyElement_get_leftMargin
,
400 HTMLBodyElement_put_topMargin
,
401 HTMLBodyElement_get_topMargin
,
402 HTMLBodyElement_put_rightMargin
,
403 HTMLBodyElement_get_rightMargin
,
404 HTMLBodyElement_put_bottomMargin
,
405 HTMLBodyElement_get_bottomMargin
,
406 HTMLBodyElement_put_noWrap
,
407 HTMLBodyElement_get_noWrap
,
408 HTMLBodyElement_put_bgColor
,
409 HTMLBodyElement_get_bgColor
,
410 HTMLBodyElement_put_text
,
411 HTMLBodyElement_get_text
,
412 HTMLBodyElement_put_link
,
413 HTMLBodyElement_get_link
,
414 HTMLBodyElement_put_vLink
,
415 HTMLBodyElement_get_vLink
,
416 HTMLBodyElement_put_aLink
,
417 HTMLBodyElement_get_aLink
,
418 HTMLBodyElement_put_onload
,
419 HTMLBodyElement_get_onload
,
420 HTMLBodyElement_put_onunload
,
421 HTMLBodyElement_get_onunload
,
422 HTMLBodyElement_put_scroll
,
423 HTMLBodyElement_get_scroll
,
424 HTMLBodyElement_put_onselect
,
425 HTMLBodyElement_get_onselect
,
426 HTMLBodyElement_put_onbeforeunload
,
427 HTMLBodyElement_get_onbeforeunload
,
428 HTMLBodyElement_createTextRange
431 void HTMLBodyElement_Create(HTMLElement
*element
)
433 HTMLBodyElement
*ret
= HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLBodyElement
));
436 ret
->lpHTMLBodyElementVtbl
= &HTMLBodyElementVtbl
;
437 ret
->element
= element
;
439 nsres
= nsIDOMHTMLElement_QueryInterface(element
->nselem
, &IID_nsIDOMHTMLBodyElement
,
440 (void**)&ret
->nsbody
);
442 ERR("Could not get nsDOMHTMLBodyElement: %08lx\n", nsres
);
444 element
->impl
= (IUnknown
*)HTMLBODY(ret
);
445 element
->destructor
= HTMLBodyElement_destructor
;