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
29 #include "wine/debug.h"
31 #include "mshtml_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
38 IHTMLTableCell IHTMLTableCell_iface
;
40 nsIDOMHTMLTableCellElement
*nscell
;
43 static inline HTMLTableCell
*impl_from_IHTMLTableCell(IHTMLTableCell
*iface
)
45 return CONTAINING_RECORD(iface
, HTMLTableCell
, IHTMLTableCell_iface
);
48 static HRESULT WINAPI
HTMLTableCell_QueryInterface(IHTMLTableCell
*iface
, REFIID riid
, void **ppv
)
50 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
52 return IHTMLDOMNode_QueryInterface(&This
->element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
55 static ULONG WINAPI
HTMLTableCell_AddRef(IHTMLTableCell
*iface
)
57 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
59 return IHTMLDOMNode_AddRef(&This
->element
.node
.IHTMLDOMNode_iface
);
62 static ULONG WINAPI
HTMLTableCell_Release(IHTMLTableCell
*iface
)
64 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
66 return IHTMLDOMNode_Release(&This
->element
.node
.IHTMLDOMNode_iface
);
69 static HRESULT WINAPI
HTMLTableCell_GetTypeInfoCount(IHTMLTableCell
*iface
, UINT
*pctinfo
)
71 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
72 return IDispatchEx_GetTypeInfoCount(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
75 static HRESULT WINAPI
HTMLTableCell_GetTypeInfo(IHTMLTableCell
*iface
, UINT iTInfo
,
76 LCID lcid
, ITypeInfo
**ppTInfo
)
78 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
79 return IDispatchEx_GetTypeInfo(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
,
83 static HRESULT WINAPI
HTMLTableCell_GetIDsOfNames(IHTMLTableCell
*iface
, REFIID riid
,
84 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
86 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
87 return IDispatchEx_GetIDsOfNames(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
,
88 cNames
, lcid
, rgDispId
);
91 static HRESULT WINAPI
HTMLTableCell_Invoke(IHTMLTableCell
*iface
, DISPID dispIdMember
, REFIID riid
,
92 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
95 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
96 return IDispatchEx_Invoke(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
,
97 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
100 static HRESULT WINAPI
HTMLTableCell_put_rowSpan(IHTMLTableCell
*iface
, LONG v
)
102 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
103 FIXME("(%p)->(%d)\n", This
, v
);
107 static HRESULT WINAPI
HTMLTableCell_get_rowSpan(IHTMLTableCell
*iface
, LONG
*p
)
109 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
110 FIXME("(%p)->(%p)\n", This
, p
);
114 static HRESULT WINAPI
HTMLTableCell_put_colSpan(IHTMLTableCell
*iface
, LONG v
)
116 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
117 FIXME("(%p)->(%d)\n", This
, v
);
121 static HRESULT WINAPI
HTMLTableCell_get_colSpan(IHTMLTableCell
*iface
, LONG
*p
)
123 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
124 FIXME("(%p)->(%p)\n", This
, p
);
128 static HRESULT WINAPI
HTMLTableCell_put_align(IHTMLTableCell
*iface
, BSTR v
)
130 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
134 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
136 nsAString_InitDepend(&str
, v
);
137 nsres
= nsIDOMHTMLTableCellElement_SetAlign(This
->nscell
, &str
);
138 nsAString_Finish(&str
);
139 if (NS_FAILED(nsres
)) {
140 ERR("Set Align failed: %08x\n", nsres
);
146 static HRESULT WINAPI
HTMLTableCell_get_align(IHTMLTableCell
*iface
, BSTR
*p
)
148 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
152 TRACE("(%p)->(%p)\n", This
, p
);
154 nsAString_Init(&str
, NULL
);
155 nsres
= nsIDOMHTMLTableCellElement_GetAlign(This
->nscell
, &str
);
157 return return_nsstr(nsres
, &str
, p
);
160 static HRESULT WINAPI
HTMLTableCell_put_vAlign(IHTMLTableCell
*iface
, BSTR v
)
162 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
163 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
167 static HRESULT WINAPI
HTMLTableCell_get_vAlign(IHTMLTableCell
*iface
, BSTR
*p
)
169 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
170 FIXME("(%p)->(%p)\n", This
, p
);
174 static HRESULT WINAPI
HTMLTableCell_put_bgColor(IHTMLTableCell
*iface
, VARIANT v
)
176 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
180 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
182 if(!variant_to_nscolor(&v
, &strColor
))
185 nsres
= nsIDOMHTMLTableCellElement_SetBgColor(This
->nscell
, &strColor
);
186 nsAString_Finish(&strColor
);
187 if(NS_FAILED(nsres
)) {
188 ERR("SetBgColor(%s) failed: %08x\n", debugstr_variant(&v
), nsres
);
195 static HRESULT WINAPI
HTMLTableCell_get_bgColor(IHTMLTableCell
*iface
, VARIANT
*p
)
197 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
202 TRACE("(%p)->(%p)\n", This
, p
);
204 nsAString_Init(&strColor
, NULL
);
205 nsres
= nsIDOMHTMLTableCellElement_GetBgColor(This
->nscell
, &strColor
);
207 if(NS_SUCCEEDED(nsres
)) {
208 const PRUnichar
*color
;
209 nsAString_GetData(&strColor
, &color
);
211 hres
= nscolor_to_str(color
, &V_BSTR(p
));
213 ERR("GetBgColor failed: %08x\n", nsres
);
216 nsAString_Finish(&strColor
);
220 static HRESULT WINAPI
HTMLTableCell_put_noWrap(IHTMLTableCell
*iface
, VARIANT_BOOL v
)
222 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
223 FIXME("(%p)->(%x)\n", This
, v
);
227 static HRESULT WINAPI
HTMLTableCell_get_noWrap(IHTMLTableCell
*iface
, VARIANT_BOOL
*p
)
229 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
230 FIXME("(%p)->(%p)\n", This
, p
);
234 static HRESULT WINAPI
HTMLTableCell_put_background(IHTMLTableCell
*iface
, BSTR v
)
236 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
237 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
241 static HRESULT WINAPI
HTMLTableCell_get_background(IHTMLTableCell
*iface
, BSTR
*p
)
243 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
244 FIXME("(%p)->(%p)\n", This
, p
);
248 static HRESULT WINAPI
HTMLTableCell_put_borderColor(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_borderColor(IHTMLTableCell
*iface
, VARIANT
*p
)
257 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
258 FIXME("(%p)->(%p)\n", This
, p
);
262 static HRESULT WINAPI
HTMLTableCell_put_borderColorLight(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_borderColorLight(IHTMLTableCell
*iface
, VARIANT
*p
)
271 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
272 FIXME("(%p)->(%p)\n", This
, p
);
276 static HRESULT WINAPI
HTMLTableCell_put_borderColorDark(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_borderColorDark(IHTMLTableCell
*iface
, VARIANT
*p
)
285 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
286 FIXME("(%p)->(%p)\n", This
, p
);
290 static HRESULT WINAPI
HTMLTableCell_put_width(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_width(IHTMLTableCell
*iface
, VARIANT
*p
)
299 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
300 FIXME("(%p)->(%p)\n", This
, p
);
304 static HRESULT WINAPI
HTMLTableCell_put_height(IHTMLTableCell
*iface
, VARIANT v
)
306 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
307 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
311 static HRESULT WINAPI
HTMLTableCell_get_height(IHTMLTableCell
*iface
, VARIANT
*p
)
313 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
314 FIXME("(%p)->(%p)\n", This
, p
);
318 static HRESULT WINAPI
HTMLTableCell_get_cellIndex(IHTMLTableCell
*iface
, LONG
*p
)
320 HTMLTableCell
*This
= impl_from_IHTMLTableCell(iface
);
323 TRACE("(%p)->(%p)\n", This
, p
);
324 nsres
= nsIDOMHTMLTableCellElement_GetCellIndex(This
->nscell
, p
);
325 if (NS_FAILED(nsres
)) {
326 ERR("Get CellIndex failed: %08x\n", nsres
);
333 static const IHTMLTableCellVtbl HTMLTableCellVtbl
= {
334 HTMLTableCell_QueryInterface
,
335 HTMLTableCell_AddRef
,
336 HTMLTableCell_Release
,
337 HTMLTableCell_GetTypeInfoCount
,
338 HTMLTableCell_GetTypeInfo
,
339 HTMLTableCell_GetIDsOfNames
,
340 HTMLTableCell_Invoke
,
341 HTMLTableCell_put_rowSpan
,
342 HTMLTableCell_get_rowSpan
,
343 HTMLTableCell_put_colSpan
,
344 HTMLTableCell_get_colSpan
,
345 HTMLTableCell_put_align
,
346 HTMLTableCell_get_align
,
347 HTMLTableCell_put_vAlign
,
348 HTMLTableCell_get_vAlign
,
349 HTMLTableCell_put_bgColor
,
350 HTMLTableCell_get_bgColor
,
351 HTMLTableCell_put_noWrap
,
352 HTMLTableCell_get_noWrap
,
353 HTMLTableCell_put_background
,
354 HTMLTableCell_get_background
,
355 HTMLTableCell_put_borderColor
,
356 HTMLTableCell_get_borderColor
,
357 HTMLTableCell_put_borderColorLight
,
358 HTMLTableCell_get_borderColorLight
,
359 HTMLTableCell_put_borderColorDark
,
360 HTMLTableCell_get_borderColorDark
,
361 HTMLTableCell_put_width
,
362 HTMLTableCell_get_width
,
363 HTMLTableCell_put_height
,
364 HTMLTableCell_get_height
,
365 HTMLTableCell_get_cellIndex
368 static inline HTMLTableCell
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
370 return CONTAINING_RECORD(iface
, HTMLTableCell
, element
.node
);
373 static HRESULT
HTMLTableCell_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
375 HTMLTableCell
*This
= impl_from_HTMLDOMNode(iface
);
377 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
378 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
379 *ppv
= &This
->IHTMLTableCell_iface
;
380 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
381 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
382 *ppv
= &This
->IHTMLTableCell_iface
;
383 }else if(IsEqualGUID(&IID_IHTMLTableCell
, riid
)) {
384 TRACE("(%p)->(IID_IHTMLTableCell %p)\n", This
, ppv
);
385 *ppv
= &This
->IHTMLTableCell_iface
;
387 return HTMLElement_QI(&This
->element
.node
, riid
, ppv
);
390 IUnknown_AddRef((IUnknown
*)*ppv
);
394 static void HTMLTableCell_destructor(HTMLDOMNode
*iface
)
396 HTMLTableCell
*This
= impl_from_HTMLDOMNode(iface
);
398 HTMLElement_destructor(&This
->element
.node
);
401 static void HTMLTableCell_traverse(HTMLDOMNode
*iface
, nsCycleCollectionTraversalCallback
*cb
)
403 HTMLTableCell
*This
= impl_from_HTMLDOMNode(iface
);
406 note_cc_edge((nsISupports
*)This
->nscell
, "This->nstablecell", cb
);
409 static void HTMLTableCell_unlink(HTMLDOMNode
*iface
)
411 HTMLTableCell
*This
= impl_from_HTMLDOMNode(iface
);
414 nsIDOMHTMLTableCellElement
*nscell
= This
->nscell
;
417 nsIDOMHTMLTableCellElement_Release(nscell
);
421 static const NodeImplVtbl HTMLTableCellImplVtbl
= {
423 HTMLTableCell_destructor
,
426 HTMLElement_handle_event
,
427 HTMLElement_get_attr_col
,
437 HTMLTableCell_traverse
,
441 static const tid_t HTMLTableCell_iface_tids
[] = {
447 static dispex_static_data_t HTMLTableCell_dispex
= {
449 DispHTMLTableCell_tid
,
450 HTMLTableCell_iface_tids
,
451 HTMLElement_init_dispex_info
454 HRESULT
HTMLTableCell_Create(HTMLDocumentNode
*doc
, nsIDOMHTMLElement
*nselem
, HTMLElement
**elem
)
459 ret
= heap_alloc_zero(sizeof(*ret
));
461 return E_OUTOFMEMORY
;
463 ret
->IHTMLTableCell_iface
.lpVtbl
= &HTMLTableCellVtbl
;
464 ret
->element
.node
.vtbl
= &HTMLTableCellImplVtbl
;
466 HTMLElement_Init(&ret
->element
, doc
, nselem
, &HTMLTableCell_dispex
);
468 nsres
= nsIDOMHTMLElement_QueryInterface(nselem
, &IID_nsIDOMHTMLTableCellElement
, (void**)&ret
->nscell
);
469 assert(nsres
== NS_OK
);
471 *elem
= &ret
->element
;