2 * Copyright 2012 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
19 #include "mshtml_private.h"
24 IHTMLTableCell IHTMLTableCell_iface
;
26 nsIDOMHTMLTableCellElement
*nscell
;
29 static inline HTMLTableCell
*impl_from_IHTMLTableCell(IHTMLTableCell
*iface
)
31 return CONTAINING_RECORD(iface
, HTMLTableCell
, IHTMLTableCell_iface
);
34 static HRESULT WINAPI
HTMLTableCell_QueryInterface(IHTMLTableCell
*iface
, REFIID riid
, void **ppv
)
36 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
38 return IHTMLDOMNode_QueryInterface(&This
->element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
41 static ULONG WINAPI
HTMLTableCell_AddRef(IHTMLTableCell
*iface
)
43 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
45 return IHTMLDOMNode_AddRef(&This
->element
.node
.IHTMLDOMNode_iface
);
48 static ULONG WINAPI
HTMLTableCell_Release(IHTMLTableCell
*iface
)
50 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
52 return IHTMLDOMNode_Release(&This
->element
.node
.IHTMLDOMNode_iface
);
55 static HRESULT WINAPI
HTMLTableCell_GetTypeInfoCount(IHTMLTableCell
*iface
, UINT
*pctinfo
)
57 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
58 return IDispatchEx_GetTypeInfoCount(&This
->element
.node
.dispex
.IDispatchEx_iface
, pctinfo
);
61 static HRESULT WINAPI
HTMLTableCell_GetTypeInfo(IHTMLTableCell
*iface
, UINT iTInfo
,
62 LCID lcid
, ITypeInfo
**ppTInfo
)
64 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
65 return IDispatchEx_GetTypeInfo(&This
->element
.node
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
,
69 static HRESULT WINAPI
HTMLTableCell_GetIDsOfNames(IHTMLTableCell
*iface
, REFIID riid
,
70 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
72 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
73 return IDispatchEx_GetIDsOfNames(&This
->element
.node
.dispex
.IDispatchEx_iface
, riid
, rgszNames
,
74 cNames
, lcid
, rgDispId
);
77 static HRESULT WINAPI
HTMLTableCell_Invoke(IHTMLTableCell
*iface
, DISPID dispIdMember
, REFIID riid
,
78 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
81 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
82 return IDispatchEx_Invoke(&This
->element
.node
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
,
83 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
86 static HRESULT WINAPI
HTMLTableCell_put_rowSpan(IHTMLTableCell
*iface
, LONG v
)
88 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
89 FIXME("(%p)->(%d)\n", This
, v
);
93 static HRESULT WINAPI
HTMLTableCell_get_rowSpan(IHTMLTableCell
*iface
, LONG
*p
)
95 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
96 FIXME("(%p)->(%p)\n", This
, p
);
100 static HRESULT WINAPI
HTMLTableCell_put_colSpan(IHTMLTableCell
*iface
, LONG v
)
102 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
103 FIXME("(%p)->(%d)\n", This
, v
);
107 static HRESULT WINAPI
HTMLTableCell_get_colSpan(IHTMLTableCell
*iface
, LONG
*p
)
109 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
110 FIXME("(%p)->(%p)\n", This
, p
);
114 static HRESULT WINAPI
HTMLTableCell_put_align(IHTMLTableCell
*iface
, BSTR v
)
116 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
120 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
122 nsAString_InitDepend(&str
, v
);
123 nsres
= nsIDOMHTMLTableCellElement_SetAlign(This
->nscell
, &str
);
124 nsAString_Finish(&str
);
125 if (NS_FAILED(nsres
)) {
126 ERR("Set Align failed: %08x\n", nsres
);
132 static HRESULT WINAPI
HTMLTableCell_get_align(IHTMLTableCell
*iface
, BSTR
*p
)
134 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
138 TRACE("(%p)->(%p)\n", This
, p
);
140 nsAString_Init(&str
, NULL
);
141 nsres
= nsIDOMHTMLTableCellElement_GetAlign(This
->nscell
, &str
);
143 return return_nsstr(nsres
, &str
, p
);
146 static HRESULT WINAPI
HTMLTableCell_put_vAlign(IHTMLTableCell
*iface
, BSTR v
)
148 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
149 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
153 static HRESULT WINAPI
HTMLTableCell_get_vAlign(IHTMLTableCell
*iface
, BSTR
*p
)
155 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
156 FIXME("(%p)->(%p)\n", This
, p
);
160 static HRESULT WINAPI
HTMLTableCell_put_bgColor(IHTMLTableCell
*iface
, VARIANT v
)
162 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
166 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
168 if(!variant_to_nscolor(&v
, &strColor
))
171 nsres
= nsIDOMHTMLTableCellElement_SetBgColor(This
->nscell
, &strColor
);
172 nsAString_Finish(&strColor
);
173 if(NS_FAILED(nsres
)) {
174 ERR("SetBgColor(%s) failed: %08x\n", debugstr_variant(&v
), nsres
);
181 static HRESULT WINAPI
HTMLTableCell_get_bgColor(IHTMLTableCell
*iface
, VARIANT
*p
)
183 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
188 TRACE("(%p)->(%p)\n", This
, p
);
190 nsAString_Init(&strColor
, NULL
);
191 nsres
= nsIDOMHTMLTableCellElement_GetBgColor(This
->nscell
, &strColor
);
193 if(NS_SUCCEEDED(nsres
)) {
194 const PRUnichar
*color
;
195 nsAString_GetData(&strColor
, &color
);
197 hres
= nscolor_to_str(color
, &V_BSTR(p
));
199 ERR("GetBgColor failed: %08x\n", nsres
);
202 nsAString_Finish(&strColor
);
206 static HRESULT WINAPI
HTMLTableCell_put_noWrap(IHTMLTableCell
*iface
, VARIANT_BOOL v
)
208 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
209 FIXME("(%p)->(%x)\n", This
, v
);
213 static HRESULT WINAPI
HTMLTableCell_get_noWrap(IHTMLTableCell
*iface
, VARIANT_BOOL
*p
)
215 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
216 FIXME("(%p)->(%p)\n", This
, p
);
220 static HRESULT WINAPI
HTMLTableCell_put_background(IHTMLTableCell
*iface
, BSTR v
)
222 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
223 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
227 static HRESULT WINAPI
HTMLTableCell_get_background(IHTMLTableCell
*iface
, BSTR
*p
)
229 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
230 FIXME("(%p)->(%p)\n", This
, p
);
234 static HRESULT WINAPI
HTMLTableCell_put_borderColor(IHTMLTableCell
*iface
, VARIANT v
)
236 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
237 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
241 static HRESULT WINAPI
HTMLTableCell_get_borderColor(IHTMLTableCell
*iface
, VARIANT
*p
)
243 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
244 FIXME("(%p)->(%p)\n", This
, p
);
248 static HRESULT WINAPI
HTMLTableCell_put_borderColorLight(IHTMLTableCell
*iface
, VARIANT v
)
250 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
251 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
255 static HRESULT WINAPI
HTMLTableCell_get_borderColorLight(IHTMLTableCell
*iface
, VARIANT
*p
)
257 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
258 FIXME("(%p)->(%p)\n", This
, p
);
262 static HRESULT WINAPI
HTMLTableCell_put_borderColorDark(IHTMLTableCell
*iface
, VARIANT v
)
264 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
265 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
269 static HRESULT WINAPI
HTMLTableCell_get_borderColorDark(IHTMLTableCell
*iface
, VARIANT
*p
)
271 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
272 FIXME("(%p)->(%p)\n", This
, p
);
276 static HRESULT WINAPI
HTMLTableCell_put_width(IHTMLTableCell
*iface
, VARIANT v
)
278 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
279 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
283 static HRESULT WINAPI
HTMLTableCell_get_width(IHTMLTableCell
*iface
, VARIANT
*p
)
285 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
286 FIXME("(%p)->(%p)\n", This
, p
);
290 static HRESULT WINAPI
HTMLTableCell_put_height(IHTMLTableCell
*iface
, VARIANT v
)
292 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
293 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
297 static HRESULT WINAPI
HTMLTableCell_get_height(IHTMLTableCell
*iface
, VARIANT
*p
)
299 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
300 FIXME("(%p)->(%p)\n", This
, p
);
304 static HRESULT WINAPI
HTMLTableCell_get_cellIndex(IHTMLTableCell
*iface
, LONG
*p
)
306 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
309 TRACE("(%p)->(%p)\n", This
, p
);
310 nsres
= nsIDOMHTMLTableCellElement_GetCellIndex(This
->nscell
, p
);
311 if (NS_FAILED(nsres
)) {
312 ERR("Get CellIndex failed: %08x\n", nsres
);
319 static const IHTMLTableCellVtbl HTMLTableCellVtbl
= {
320 HTMLTableCell_QueryInterface
,
321 HTMLTableCell_AddRef
,
322 HTMLTableCell_Release
,
323 HTMLTableCell_GetTypeInfoCount
,
324 HTMLTableCell_GetTypeInfo
,
325 HTMLTableCell_GetIDsOfNames
,
326 HTMLTableCell_Invoke
,
327 HTMLTableCell_put_rowSpan
,
328 HTMLTableCell_get_rowSpan
,
329 HTMLTableCell_put_colSpan
,
330 HTMLTableCell_get_colSpan
,
331 HTMLTableCell_put_align
,
332 HTMLTableCell_get_align
,
333 HTMLTableCell_put_vAlign
,
334 HTMLTableCell_get_vAlign
,
335 HTMLTableCell_put_bgColor
,
336 HTMLTableCell_get_bgColor
,
337 HTMLTableCell_put_noWrap
,
338 HTMLTableCell_get_noWrap
,
339 HTMLTableCell_put_background
,
340 HTMLTableCell_get_background
,
341 HTMLTableCell_put_borderColor
,
342 HTMLTableCell_get_borderColor
,
343 HTMLTableCell_put_borderColorLight
,
344 HTMLTableCell_get_borderColorLight
,
345 HTMLTableCell_put_borderColorDark
,
346 HTMLTableCell_get_borderColorDark
,
347 HTMLTableCell_put_width
,
348 HTMLTableCell_get_width
,
349 HTMLTableCell_put_height
,
350 HTMLTableCell_get_height
,
351 HTMLTableCell_get_cellIndex
354 static inline HTMLTableCell
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
356 return CONTAINING_RECORD(iface
, HTMLTableCell
, element
.node
);
359 static HRESULT
HTMLTableCell_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
361 HTMLTableCell
*This
= impl_from_HTMLDOMNode(iface
);
363 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
364 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
365 *ppv
= &This
->IHTMLTableCell_iface
;
366 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
367 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
368 *ppv
= &This
->IHTMLTableCell_iface
;
369 }else if(IsEqualGUID(&IID_IHTMLTableCell
, riid
)) {
370 TRACE("(%p)->(IID_IHTMLTableCell %p)\n", This
, ppv
);
371 *ppv
= &This
->IHTMLTableCell_iface
;
373 return HTMLElement_QI(&This
->element
.node
, riid
, ppv
);
376 IUnknown_AddRef((IUnknown
*)*ppv
);
380 static void HTMLTableCell_destructor(HTMLDOMNode
*iface
)
382 HTMLTableCell
*This
= impl_from_HTMLDOMNode(iface
);
384 HTMLElement_destructor(&This
->element
.node
);
387 static const NodeImplVtbl HTMLTableCellImplVtbl
= {
389 HTMLTableCell_destructor
,
392 HTMLElement_handle_event
,
393 HTMLElement_get_attr_col
396 static const tid_t HTMLTableCell_iface_tids
[] = {
402 static dispex_static_data_t HTMLTableCell_dispex
= {
404 DispHTMLTableCell_tid
,
406 HTMLTableCell_iface_tids
409 HRESULT
HTMLTableCell_Create(HTMLDocumentNode
*doc
, nsIDOMHTMLElement
*nselem
, HTMLElement
**elem
)
414 ret
= heap_alloc_zero(sizeof(*ret
));
416 return E_OUTOFMEMORY
;
418 ret
->IHTMLTableCell_iface
.lpVtbl
= &HTMLTableCellVtbl
;
419 ret
->element
.node
.vtbl
= &HTMLTableCellImplVtbl
;
421 HTMLElement_Init(&ret
->element
, doc
, nselem
, &HTMLTableCell_dispex
);
423 nsres
= nsIDOMHTMLElement_QueryInterface(nselem
, &IID_nsIDOMHTMLTableCellElement
, (void**)&ret
->nscell
);
425 /* Share nscell reference with nsnode */
426 assert(nsres
== NS_OK
&& (nsIDOMNode
*)ret
->nscell
== ret
->element
.node
.nsnode
);
427 nsIDOMNode_Release(ret
->element
.node
.nsnode
);
429 *elem
= &ret
->element
;