wined3d: Rename WINED3D_MAX_TEXTURES to WINED3D_MAX_FFP_TEXTURES.
[wine.git] / dlls / mshtml / htmltable.c
blob85d1858fed7a79ced3922aeec6583db05d68a51e
1 /*
2 * Copyright 2007,2008,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 <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
31 #include "htmlevent.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
35 struct HTMLTableCell {
36 HTMLElement element;
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,
80 ppTInfo);
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,
93 UINT *puArgErr)
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 nsresult nsres;
105 TRACE("(%p)->(%ld)\n", This, v);
107 if(v <= 0)
108 return E_INVALIDARG;
110 nsres = nsIDOMHTMLTableCellElement_SetRowSpan(This->nscell, v);
111 if(NS_FAILED(nsres)) {
112 ERR("SetRowSpan failed: %08lx\n", nsres);
113 return E_FAIL;
116 return S_OK;
119 static HRESULT WINAPI HTMLTableCell_get_rowSpan(IHTMLTableCell *iface, LONG *p)
121 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
122 nsresult nsres;
124 TRACE("(%p)->(%p)\n", This, p);
126 nsres = nsIDOMHTMLTableCellElement_GetRowSpan(This->nscell, p);
127 if(NS_FAILED(nsres)) {
128 ERR("GetRowSpan failed: %08lx\n", nsres);
129 return E_FAIL;
132 return S_OK;
135 static HRESULT WINAPI HTMLTableCell_put_colSpan(IHTMLTableCell *iface, LONG v)
137 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
138 nsresult nsres;
140 TRACE("(%p)->(%ld)\n", This, v);
142 if(v <= 0)
143 return E_INVALIDARG;
145 nsres = nsIDOMHTMLTableCellElement_SetColSpan(This->nscell, v);
146 if(NS_FAILED(nsres)) {
147 ERR("SetColSpan failed: %08lx\n", nsres);
148 return E_FAIL;
151 return S_OK;
154 static HRESULT WINAPI HTMLTableCell_get_colSpan(IHTMLTableCell *iface, LONG *p)
156 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
157 nsresult nsres;
159 TRACE("(%p)->(%p)\n", This, p);
161 nsres = nsIDOMHTMLTableCellElement_GetColSpan(This->nscell, p);
162 if(NS_FAILED(nsres)) {
163 ERR("GetColSpan failed: %08lx\n", nsres);
164 return E_FAIL;
167 return S_OK;
170 static HRESULT WINAPI HTMLTableCell_put_align(IHTMLTableCell *iface, BSTR v)
172 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
173 nsAString str;
174 nsresult nsres;
176 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
178 nsAString_InitDepend(&str, v);
179 nsres = nsIDOMHTMLTableCellElement_SetAlign(This->nscell, &str);
180 nsAString_Finish(&str);
181 if (NS_FAILED(nsres)) {
182 ERR("Set Align failed: %08lx\n", nsres);
183 return E_FAIL;
185 return S_OK;
188 static HRESULT WINAPI HTMLTableCell_get_align(IHTMLTableCell *iface, BSTR *p)
190 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
191 nsAString str;
192 nsresult nsres;
194 TRACE("(%p)->(%p)\n", This, p);
196 nsAString_Init(&str, NULL);
197 nsres = nsIDOMHTMLTableCellElement_GetAlign(This->nscell, &str);
199 return return_nsstr(nsres, &str, p);
202 static HRESULT WINAPI HTMLTableCell_put_vAlign(IHTMLTableCell *iface, BSTR v)
204 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
205 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
206 return E_NOTIMPL;
209 static HRESULT WINAPI HTMLTableCell_get_vAlign(IHTMLTableCell *iface, BSTR *p)
211 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
212 FIXME("(%p)->(%p)\n", This, p);
213 return E_NOTIMPL;
216 static HRESULT WINAPI HTMLTableCell_put_bgColor(IHTMLTableCell *iface, VARIANT v)
218 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
219 nsAString strColor;
220 nsresult nsres;
222 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
224 if(!variant_to_nscolor(&v, &strColor))
225 return S_OK;
227 nsres = nsIDOMHTMLTableCellElement_SetBgColor(This->nscell, &strColor);
228 nsAString_Finish(&strColor);
229 if(NS_FAILED(nsres)) {
230 ERR("SetBgColor(%s) failed: %08lx\n", debugstr_variant(&v), nsres);
231 return E_FAIL;
234 return S_OK;
237 static HRESULT WINAPI HTMLTableCell_get_bgColor(IHTMLTableCell *iface, VARIANT *p)
239 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
240 nsAString strColor;
241 nsresult nsres;
242 HRESULT hres;
244 TRACE("(%p)->(%p)\n", This, p);
246 nsAString_Init(&strColor, NULL);
247 nsres = nsIDOMHTMLTableCellElement_GetBgColor(This->nscell, &strColor);
249 if(NS_SUCCEEDED(nsres)) {
250 const PRUnichar *color;
251 nsAString_GetData(&strColor, &color);
252 V_VT(p) = VT_BSTR;
253 hres = nscolor_to_str(color, &V_BSTR(p));
254 }else {
255 ERR("GetBgColor failed: %08lx\n", nsres);
256 hres = E_FAIL;
258 nsAString_Finish(&strColor);
259 return hres;
262 static HRESULT WINAPI HTMLTableCell_put_noWrap(IHTMLTableCell *iface, VARIANT_BOOL v)
264 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
265 FIXME("(%p)->(%x)\n", This, v);
266 return E_NOTIMPL;
269 static HRESULT WINAPI HTMLTableCell_get_noWrap(IHTMLTableCell *iface, VARIANT_BOOL *p)
271 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
272 FIXME("(%p)->(%p)\n", This, p);
273 return E_NOTIMPL;
276 static HRESULT WINAPI HTMLTableCell_put_background(IHTMLTableCell *iface, BSTR v)
278 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
279 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
280 return E_NOTIMPL;
283 static HRESULT WINAPI HTMLTableCell_get_background(IHTMLTableCell *iface, BSTR *p)
285 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
286 FIXME("(%p)->(%p)\n", This, p);
287 return E_NOTIMPL;
290 static HRESULT WINAPI HTMLTableCell_put_borderColor(IHTMLTableCell *iface, VARIANT v)
292 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
293 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
294 return E_NOTIMPL;
297 static HRESULT WINAPI HTMLTableCell_get_borderColor(IHTMLTableCell *iface, VARIANT *p)
299 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
300 FIXME("(%p)->(%p)\n", This, p);
301 return E_NOTIMPL;
304 static HRESULT WINAPI HTMLTableCell_put_borderColorLight(IHTMLTableCell *iface, VARIANT v)
306 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
307 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
308 return E_NOTIMPL;
311 static HRESULT WINAPI HTMLTableCell_get_borderColorLight(IHTMLTableCell *iface, VARIANT *p)
313 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
314 FIXME("(%p)->(%p)\n", This, p);
315 return E_NOTIMPL;
318 static HRESULT WINAPI HTMLTableCell_put_borderColorDark(IHTMLTableCell *iface, VARIANT v)
320 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
321 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
322 return E_NOTIMPL;
325 static HRESULT WINAPI HTMLTableCell_get_borderColorDark(IHTMLTableCell *iface, VARIANT *p)
327 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
328 FIXME("(%p)->(%p)\n", This, p);
329 return E_NOTIMPL;
332 static HRESULT WINAPI HTMLTableCell_put_width(IHTMLTableCell *iface, VARIANT v)
334 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
335 nsAString nsstr;
336 nsresult nsres;
337 HRESULT hres;
339 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
341 hres = variant_to_nsstr(&v, FALSE, &nsstr);
342 if(FAILED(hres))
343 return hres;
345 nsres = nsIDOMHTMLTableCellElement_SetWidth(This->nscell, &nsstr);
346 nsAString_Finish(&nsstr);
347 return map_nsresult(nsres);
350 static HRESULT WINAPI HTMLTableCell_get_width(IHTMLTableCell *iface, VARIANT *p)
352 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
353 nsAString nsstr;
354 nsresult nsres;
356 TRACE("(%p)->(%p)\n", This, p);
358 nsAString_Init(&nsstr, NULL);
359 nsres = nsIDOMHTMLTableCellElement_GetWidth(This->nscell, &nsstr);
360 return return_nsstr_variant(nsres, &nsstr, NSSTR_IMPLICIT_PX, p);
363 static HRESULT WINAPI HTMLTableCell_put_height(IHTMLTableCell *iface, VARIANT v)
365 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
366 nsAString nsstr;
367 nsresult nsres;
368 HRESULT hres;
370 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
372 hres = variant_to_nsstr(&v, FALSE, &nsstr);
373 if(FAILED(hres))
374 return hres;
376 nsres = nsIDOMHTMLTableCellElement_SetHeight(This->nscell, &nsstr);
377 nsAString_Finish(&nsstr);
378 return map_nsresult(nsres);
381 static HRESULT WINAPI HTMLTableCell_get_height(IHTMLTableCell *iface, VARIANT *p)
383 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
384 nsAString nsstr;
385 nsresult nsres;
387 TRACE("(%p)->(%p)\n", This, p);
389 nsAString_Init(&nsstr, NULL);
390 nsres = nsIDOMHTMLTableCellElement_GetHeight(This->nscell, &nsstr);
391 return return_nsstr_variant(nsres, &nsstr, NSSTR_IMPLICIT_PX, p);
394 static HRESULT WINAPI HTMLTableCell_get_cellIndex(IHTMLTableCell *iface, LONG *p)
396 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
397 nsresult nsres;
399 TRACE("(%p)->(%p)\n", This, p);
400 nsres = nsIDOMHTMLTableCellElement_GetCellIndex(This->nscell, p);
401 if (NS_FAILED(nsres)) {
402 ERR("Get CellIndex failed: %08lx\n", nsres);
403 return E_FAIL;
406 return S_OK;
409 static const IHTMLTableCellVtbl HTMLTableCellVtbl = {
410 HTMLTableCell_QueryInterface,
411 HTMLTableCell_AddRef,
412 HTMLTableCell_Release,
413 HTMLTableCell_GetTypeInfoCount,
414 HTMLTableCell_GetTypeInfo,
415 HTMLTableCell_GetIDsOfNames,
416 HTMLTableCell_Invoke,
417 HTMLTableCell_put_rowSpan,
418 HTMLTableCell_get_rowSpan,
419 HTMLTableCell_put_colSpan,
420 HTMLTableCell_get_colSpan,
421 HTMLTableCell_put_align,
422 HTMLTableCell_get_align,
423 HTMLTableCell_put_vAlign,
424 HTMLTableCell_get_vAlign,
425 HTMLTableCell_put_bgColor,
426 HTMLTableCell_get_bgColor,
427 HTMLTableCell_put_noWrap,
428 HTMLTableCell_get_noWrap,
429 HTMLTableCell_put_background,
430 HTMLTableCell_get_background,
431 HTMLTableCell_put_borderColor,
432 HTMLTableCell_get_borderColor,
433 HTMLTableCell_put_borderColorLight,
434 HTMLTableCell_get_borderColorLight,
435 HTMLTableCell_put_borderColorDark,
436 HTMLTableCell_get_borderColorDark,
437 HTMLTableCell_put_width,
438 HTMLTableCell_get_width,
439 HTMLTableCell_put_height,
440 HTMLTableCell_get_height,
441 HTMLTableCell_get_cellIndex
444 static inline HTMLTableCell *HTMLTableCell_from_DispatchEx(DispatchEx *iface)
446 return CONTAINING_RECORD(iface, HTMLTableCell, element.node.event_target.dispex);
449 static void *HTMLTableCell_query_interface(DispatchEx *dispex, REFIID riid)
451 HTMLTableCell *This = HTMLTableCell_from_DispatchEx(dispex);
453 if(IsEqualGUID(&IID_IHTMLTableCell, riid))
454 return &This->IHTMLTableCell_iface;
456 return HTMLElement_query_interface(&This->element.node.event_target.dispex, riid);
459 static void HTMLTableCell_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb)
461 HTMLTableCell *This = HTMLTableCell_from_DispatchEx(dispex);
462 HTMLDOMNode_traverse(dispex, cb);
464 if(This->nscell)
465 note_cc_edge((nsISupports*)This->nscell, "nstablecell", cb);
468 static void HTMLTableCell_unlink(DispatchEx *dispex)
470 HTMLTableCell *This = HTMLTableCell_from_DispatchEx(dispex);
471 HTMLDOMNode_unlink(dispex);
472 unlink_ref(&This->nscell);
475 static const NodeImplVtbl HTMLTableCellImplVtbl = {
476 .clsid = &CLSID_HTMLTableCell,
477 .cpc_entries = HTMLElement_cpc,
478 .clone = HTMLElement_clone,
479 .get_attr_col = HTMLElement_get_attr_col,
482 static const event_target_vtbl_t HTMLTableCell_event_target_vtbl = {
484 HTMLELEMENT_DISPEX_VTBL_ENTRIES,
485 .query_interface= HTMLTableCell_query_interface,
486 .destructor = HTMLElement_destructor,
487 .traverse = HTMLTableCell_traverse,
488 .unlink = HTMLTableCell_unlink
490 HTMLELEMENT_EVENT_TARGET_VTBL_ENTRIES,
491 .handle_event = HTMLElement_handle_event
494 static const tid_t HTMLTableCell_iface_tids[] = {
495 HTMLELEMENT_TIDS,
496 IHTMLTableCell_tid,
500 static dispex_static_data_t HTMLTableCell_dispex = {
501 "HTMLTableDataCellElement",
502 &HTMLTableCell_event_target_vtbl.dispex_vtbl,
503 DispHTMLTableCell_tid,
504 HTMLTableCell_iface_tids,
505 HTMLElement_init_dispex_info
508 HRESULT HTMLTableCell_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
510 HTMLTableCell *ret;
511 nsresult nsres;
513 ret = calloc(1, sizeof(*ret));
514 if(!ret)
515 return E_OUTOFMEMORY;
517 ret->IHTMLTableCell_iface.lpVtbl = &HTMLTableCellVtbl;
518 ret->element.node.vtbl = &HTMLTableCellImplVtbl;
520 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTableCell_dispex);
522 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableCellElement, (void**)&ret->nscell);
523 assert(nsres == NS_OK);
525 *elem = &ret->element;
526 return S_OK;
529 struct HTMLTableRow {
530 HTMLElement element;
532 IHTMLTableRow IHTMLTableRow_iface;
534 nsIDOMHTMLTableRowElement *nsrow;
537 static inline HTMLTableRow *impl_from_IHTMLTableRow(IHTMLTableRow *iface)
539 return CONTAINING_RECORD(iface, HTMLTableRow, IHTMLTableRow_iface);
542 static HRESULT WINAPI HTMLTableRow_QueryInterface(IHTMLTableRow *iface,
543 REFIID riid, void **ppv)
545 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
547 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
550 static ULONG WINAPI HTMLTableRow_AddRef(IHTMLTableRow *iface)
552 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
554 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
557 static ULONG WINAPI HTMLTableRow_Release(IHTMLTableRow *iface)
559 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
561 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
564 static HRESULT WINAPI HTMLTableRow_GetTypeInfoCount(IHTMLTableRow *iface, UINT *pctinfo)
566 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
567 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
570 static HRESULT WINAPI HTMLTableRow_GetTypeInfo(IHTMLTableRow *iface, UINT iTInfo,
571 LCID lcid, ITypeInfo **ppTInfo)
573 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
574 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
575 ppTInfo);
578 static HRESULT WINAPI HTMLTableRow_GetIDsOfNames(IHTMLTableRow *iface, REFIID riid,
579 LPOLESTR *rgszNames, UINT cNames,
580 LCID lcid, DISPID *rgDispId)
582 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
583 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
584 cNames, lcid, rgDispId);
587 static HRESULT WINAPI HTMLTableRow_Invoke(IHTMLTableRow *iface, DISPID dispIdMember,
588 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
589 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
591 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
592 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
593 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
596 static HRESULT WINAPI HTMLTableRow_put_align(IHTMLTableRow *iface, BSTR v)
598 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
599 nsAString val;
600 nsresult nsres;
602 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
604 nsAString_InitDepend(&val, v);
606 nsres = nsIDOMHTMLTableRowElement_SetAlign(This->nsrow, &val);
607 nsAString_Finish(&val);
608 if (NS_FAILED(nsres)){
609 ERR("Set Align(%s) failed!\n", debugstr_w(v));
610 return E_FAIL;
612 return S_OK;
615 static HRESULT WINAPI HTMLTableRow_get_align(IHTMLTableRow *iface, BSTR *p)
617 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
618 nsAString val;
619 nsresult nsres;
621 TRACE("(%p)->(%p)\n", This, p);
623 nsAString_Init(&val, NULL);
624 nsres = nsIDOMHTMLTableRowElement_GetAlign(This->nsrow, &val);
626 return return_nsstr(nsres, &val, p);
629 static HRESULT WINAPI HTMLTableRow_put_vAlign(IHTMLTableRow *iface, BSTR v)
631 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
632 nsAString val;
633 nsresult nsres;
635 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
637 nsAString_InitDepend(&val, v);
639 nsres = nsIDOMHTMLTableRowElement_SetVAlign(This->nsrow, &val);
640 nsAString_Finish(&val);
642 if (NS_FAILED(nsres)){
643 ERR("Set VAlign(%s) failed!\n", debugstr_w(v));
644 return E_FAIL;
647 return S_OK;
650 static HRESULT WINAPI HTMLTableRow_get_vAlign(IHTMLTableRow *iface, BSTR *p)
652 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
653 nsAString val;
654 nsresult nsres;
656 TRACE("(%p)->(%p)\n", This, p);
658 nsAString_Init(&val, NULL);
659 nsres = nsIDOMHTMLTableRowElement_GetVAlign(This->nsrow, &val);
661 return return_nsstr(nsres, &val, p);
664 static HRESULT WINAPI HTMLTableRow_put_bgColor(IHTMLTableRow *iface, VARIANT v)
666 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
667 nsAString val;
668 nsresult nsres;
670 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
672 if (!variant_to_nscolor(&v, &val))
673 return S_OK;
675 nsres = nsIDOMHTMLTableRowElement_SetBgColor(This->nsrow, &val);
676 nsAString_Finish(&val);
678 if (NS_FAILED(nsres)){
679 ERR("Set BgColor(%s) failed!\n", debugstr_variant(&v));
680 return E_FAIL;
683 return S_OK;
686 static HRESULT WINAPI HTMLTableRow_get_bgColor(IHTMLTableRow *iface, VARIANT *p)
688 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
689 nsAString strColor;
690 nsresult nsres;
691 HRESULT hres;
692 const PRUnichar *color;
694 TRACE("(%p)->(%p)\n", This, p);
696 nsAString_Init(&strColor, NULL);
697 nsres = nsIDOMHTMLTableRowElement_GetBgColor(This->nsrow, &strColor);
699 if(NS_SUCCEEDED(nsres)) {
700 nsAString_GetData(&strColor, &color);
701 V_VT(p) = VT_BSTR;
702 hres = nscolor_to_str(color, &V_BSTR(p));
703 }else {
704 ERR("SetBgColor failed: %08lx\n", nsres);
705 hres = E_FAIL;
708 nsAString_Finish(&strColor);
709 return hres;
712 static HRESULT WINAPI HTMLTableRow_put_borderColor(IHTMLTableRow *iface, VARIANT v)
714 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
715 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
716 return E_NOTIMPL;
719 static HRESULT WINAPI HTMLTableRow_get_borderColor(IHTMLTableRow *iface, VARIANT *p)
721 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
722 FIXME("(%p)->(%p)\n", This, p);
723 return E_NOTIMPL;
726 static HRESULT WINAPI HTMLTableRow_put_borderColorLight(IHTMLTableRow *iface, VARIANT v)
728 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
729 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
730 return E_NOTIMPL;
733 static HRESULT WINAPI HTMLTableRow_get_borderColorLight(IHTMLTableRow *iface, VARIANT *p)
735 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
736 FIXME("(%p)->(%p)\n", This, p);
737 return E_NOTIMPL;
740 static HRESULT WINAPI HTMLTableRow_put_borderColorDark(IHTMLTableRow *iface, VARIANT v)
742 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
743 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
744 return E_NOTIMPL;
747 static HRESULT WINAPI HTMLTableRow_get_borderColorDark(IHTMLTableRow *iface, VARIANT *p)
749 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
750 FIXME("(%p)->(%p)\n", This, p);
751 return E_NOTIMPL;
754 static HRESULT WINAPI HTMLTableRow_get_rowIndex(IHTMLTableRow *iface, LONG *p)
756 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
757 nsresult nsres;
759 TRACE("(%p)->(%p)\n", This, p);
760 nsres = nsIDOMHTMLTableRowElement_GetRowIndex(This->nsrow, p);
761 if(NS_FAILED(nsres)) {
762 ERR("Get rowIndex failed: %08lx\n", nsres);
763 return E_FAIL;
765 return S_OK;
768 static HRESULT WINAPI HTMLTableRow_get_sectionRowIndex(IHTMLTableRow *iface, LONG *p)
770 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
771 nsresult nsres;
773 TRACE("(%p)->(%p)\n", This, p);
774 nsres = nsIDOMHTMLTableRowElement_GetSectionRowIndex(This->nsrow, p);
775 if(NS_FAILED(nsres)) {
776 ERR("Get selectionRowIndex failed: %08lx\n", nsres);
777 return E_FAIL;
779 return S_OK;
782 static HRESULT WINAPI HTMLTableRow_get_cells(IHTMLTableRow *iface, IHTMLElementCollection **p)
784 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
785 nsIDOMHTMLCollection *nscol;
786 nsresult nsres;
788 TRACE("(%p)->(%p)\n", This, p);
790 nsres = nsIDOMHTMLTableRowElement_GetCells(This->nsrow, &nscol);
791 if(NS_FAILED(nsres)) {
792 ERR("GetCells failed: %08lx\n", nsres);
793 return E_FAIL;
796 *p = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->element.node.event_target.dispex));
798 nsIDOMHTMLCollection_Release(nscol);
799 return S_OK;
802 static HRESULT WINAPI HTMLTableRow_insertCell(IHTMLTableRow *iface, LONG index, IDispatch **row)
804 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
805 nsIDOMHTMLElement *nselem;
806 HTMLElement *elem;
807 nsresult nsres;
808 HRESULT hres;
810 TRACE("(%p)->(%ld %p)\n", This, index, row);
811 nsres = nsIDOMHTMLTableRowElement_InsertCell(This->nsrow, index, &nselem);
812 if(NS_FAILED(nsres)) {
813 ERR("Insert Cell at %ld failed: %08lx\n", index, nsres);
814 return E_FAIL;
817 hres = HTMLTableCell_Create(This->element.node.doc, (nsIDOMElement*)nselem, &elem);
818 nsIDOMHTMLElement_Release(nselem);
819 if (FAILED(hres)) {
820 ERR("Create TableCell failed: %08lx\n", hres);
821 return hres;
824 *row = (IDispatch *)&elem->IHTMLElement_iface;
825 return S_OK;
828 static HRESULT WINAPI HTMLTableRow_deleteCell(IHTMLTableRow *iface, LONG index)
830 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
831 nsresult nsres;
833 TRACE("(%p)->(%ld)\n", This, index);
834 nsres = nsIDOMHTMLTableRowElement_DeleteCell(This->nsrow, index);
835 if(NS_FAILED(nsres)) {
836 ERR("Delete Cell failed: %08lx\n", nsres);
837 return E_FAIL;
839 return S_OK;
842 static const IHTMLTableRowVtbl HTMLTableRowVtbl = {
843 HTMLTableRow_QueryInterface,
844 HTMLTableRow_AddRef,
845 HTMLTableRow_Release,
846 HTMLTableRow_GetTypeInfoCount,
847 HTMLTableRow_GetTypeInfo,
848 HTMLTableRow_GetIDsOfNames,
849 HTMLTableRow_Invoke,
850 HTMLTableRow_put_align,
851 HTMLTableRow_get_align,
852 HTMLTableRow_put_vAlign,
853 HTMLTableRow_get_vAlign,
854 HTMLTableRow_put_bgColor,
855 HTMLTableRow_get_bgColor,
856 HTMLTableRow_put_borderColor,
857 HTMLTableRow_get_borderColor,
858 HTMLTableRow_put_borderColorLight,
859 HTMLTableRow_get_borderColorLight,
860 HTMLTableRow_put_borderColorDark,
861 HTMLTableRow_get_borderColorDark,
862 HTMLTableRow_get_rowIndex,
863 HTMLTableRow_get_sectionRowIndex,
864 HTMLTableRow_get_cells,
865 HTMLTableRow_insertCell,
866 HTMLTableRow_deleteCell
869 static inline HTMLTableRow *HTMLTableRow_from_DispatchEx(DispatchEx *iface)
871 return CONTAINING_RECORD(iface, HTMLTableRow, element.node.event_target.dispex);
874 static void *HTMLTableRow_query_interface(DispatchEx *dispex, REFIID riid)
876 HTMLTableRow *This = HTMLTableRow_from_DispatchEx(dispex);
878 if(IsEqualGUID(&IID_IHTMLTableRow, riid))
879 return &This->IHTMLTableRow_iface;
881 return HTMLElement_query_interface(&This->element.node.event_target.dispex, riid);
884 static void HTMLTableRow_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb)
886 HTMLTableRow *This = HTMLTableRow_from_DispatchEx(dispex);
887 HTMLDOMNode_traverse(dispex, cb);
889 if(This->nsrow)
890 note_cc_edge((nsISupports*)This->nsrow, "nstablerow", cb);
893 static void HTMLTableRow_unlink(DispatchEx *dispex)
895 HTMLTableRow *This = HTMLTableRow_from_DispatchEx(dispex);
896 HTMLDOMNode_unlink(dispex);
897 unlink_ref(&This->nsrow);
900 static const NodeImplVtbl HTMLTableRowImplVtbl = {
901 .clsid = &CLSID_HTMLTableRow,
902 .cpc_entries = HTMLElement_cpc,
903 .clone = HTMLElement_clone,
904 .get_attr_col = HTMLElement_get_attr_col,
907 static const event_target_vtbl_t HTMLTableRow_event_target_vtbl = {
909 HTMLELEMENT_DISPEX_VTBL_ENTRIES,
910 .query_interface= HTMLTableRow_query_interface,
911 .destructor = HTMLElement_destructor,
912 .traverse = HTMLTableRow_traverse,
913 .unlink = HTMLTableRow_unlink
915 HTMLELEMENT_EVENT_TARGET_VTBL_ENTRIES,
916 .handle_event = HTMLElement_handle_event
919 static const tid_t HTMLTableRow_iface_tids[] = {
920 HTMLELEMENT_TIDS,
921 IHTMLTableRow_tid,
925 static dispex_static_data_t HTMLTableRow_dispex = {
926 "HTMLTableRowElement",
927 &HTMLTableRow_event_target_vtbl.dispex_vtbl,
928 DispHTMLTableRow_tid,
929 HTMLTableRow_iface_tids,
930 HTMLElement_init_dispex_info
933 HRESULT HTMLTableRow_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
935 HTMLTableRow *ret;
936 nsresult nsres;
938 ret = calloc(1, sizeof(HTMLTableRow));
939 if(!ret)
940 return E_OUTOFMEMORY;
942 ret->IHTMLTableRow_iface.lpVtbl = &HTMLTableRowVtbl;
943 ret->element.node.vtbl = &HTMLTableRowImplVtbl;
945 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTableRow_dispex);
947 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableRowElement, (void**)&ret->nsrow);
948 assert(nsres == NS_OK);
950 *elem = &ret->element;
951 return S_OK;
954 struct HTMLTable {
955 HTMLElement element;
957 IHTMLTable IHTMLTable_iface;
958 IHTMLTable2 IHTMLTable2_iface;
959 IHTMLTable3 IHTMLTable3_iface;
961 nsIDOMHTMLTableElement *nstable;
964 static inline HTMLTable *impl_from_IHTMLTable(IHTMLTable *iface)
966 return CONTAINING_RECORD(iface, HTMLTable, IHTMLTable_iface);
969 static inline HTMLTable *impl_from_IHTMLTable2(IHTMLTable2 *iface)
971 return CONTAINING_RECORD(iface, HTMLTable, IHTMLTable2_iface);
974 static inline HTMLTable *impl_from_IHTMLTable3(IHTMLTable3 *iface)
976 return CONTAINING_RECORD(iface, HTMLTable, IHTMLTable3_iface);
979 static HRESULT var2str(const VARIANT *p, nsAString *nsstr)
981 BSTR str;
982 BOOL ret;
983 HRESULT hres;
985 switch(V_VT(p)) {
986 case VT_BSTR:
987 return nsAString_Init(nsstr, V_BSTR(p))?
988 S_OK : E_OUTOFMEMORY;
989 case VT_R8:
990 hres = VarBstrFromR8(V_R8(p), MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), 0, &str);
991 break;
992 case VT_R4:
993 hres = VarBstrFromR4(V_R4(p), MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), 0, &str);
994 break;
995 case VT_I4:
996 hres = VarBstrFromI4(V_I4(p), MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), 0, &str);
997 break;
998 default:
999 FIXME("unsupported arg %s\n", debugstr_variant(p));
1000 return E_NOTIMPL;
1002 if (FAILED(hres))
1003 return hres;
1005 ret = nsAString_Init(nsstr, str);
1006 SysFreeString(str);
1007 return ret ? S_OK : E_OUTOFMEMORY;
1010 static HRESULT WINAPI HTMLTable_QueryInterface(IHTMLTable *iface,
1011 REFIID riid, void **ppv)
1013 HTMLTable *This = impl_from_IHTMLTable(iface);
1015 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1018 static ULONG WINAPI HTMLTable_AddRef(IHTMLTable *iface)
1020 HTMLTable *This = impl_from_IHTMLTable(iface);
1022 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1025 static ULONG WINAPI HTMLTable_Release(IHTMLTable *iface)
1027 HTMLTable *This = impl_from_IHTMLTable(iface);
1029 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1032 static HRESULT WINAPI HTMLTable_GetTypeInfoCount(IHTMLTable *iface, UINT *pctinfo)
1034 HTMLTable *This = impl_from_IHTMLTable(iface);
1035 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1038 static HRESULT WINAPI HTMLTable_GetTypeInfo(IHTMLTable *iface, UINT iTInfo,
1039 LCID lcid, ITypeInfo **ppTInfo)
1041 HTMLTable *This = impl_from_IHTMLTable(iface);
1042 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
1043 ppTInfo);
1046 static HRESULT WINAPI HTMLTable_GetIDsOfNames(IHTMLTable *iface, REFIID riid,
1047 LPOLESTR *rgszNames, UINT cNames,
1048 LCID lcid, DISPID *rgDispId)
1050 HTMLTable *This = impl_from_IHTMLTable(iface);
1051 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1052 cNames, lcid, rgDispId);
1055 static HRESULT WINAPI HTMLTable_Invoke(IHTMLTable *iface, DISPID dispIdMember,
1056 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1057 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1059 HTMLTable *This = impl_from_IHTMLTable(iface);
1060 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1061 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1064 static HRESULT WINAPI HTMLTable_put_cols(IHTMLTable *iface, LONG v)
1066 HTMLTable *This = impl_from_IHTMLTable(iface);
1067 FIXME("(%p)->(%ld)\n", This, v);
1068 return E_NOTIMPL;
1071 static HRESULT WINAPI HTMLTable_get_cols(IHTMLTable *iface, LONG *p)
1073 HTMLTable *This = impl_from_IHTMLTable(iface);
1074 FIXME("(%p)->(%p)\n", This, p);
1075 return E_NOTIMPL;
1078 static HRESULT WINAPI HTMLTable_put_border(IHTMLTable *iface, VARIANT v)
1080 HTMLTable *This = impl_from_IHTMLTable(iface);
1081 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1082 return E_NOTIMPL;
1085 static HRESULT WINAPI HTMLTable_get_border(IHTMLTable *iface, VARIANT *p)
1087 HTMLTable *This = impl_from_IHTMLTable(iface);
1088 FIXME("(%p)->(%p)\n", This, p);
1089 return E_NOTIMPL;
1092 static HRESULT WINAPI HTMLTable_put_frame(IHTMLTable *iface, BSTR v)
1094 HTMLTable *This = impl_from_IHTMLTable(iface);
1095 nsAString str;
1096 nsresult nsres;
1098 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1100 nsAString_InitDepend(&str, v);
1101 nsres = nsIDOMHTMLTableElement_SetFrame(This->nstable, &str);
1102 nsAString_Finish(&str);
1104 if (NS_FAILED(nsres)) {
1105 ERR("SetFrame(%s) failed: %08lx\n", debugstr_w(v), nsres);
1106 return E_FAIL;
1108 return S_OK;
1111 static HRESULT WINAPI HTMLTable_get_frame(IHTMLTable *iface, BSTR *p)
1113 HTMLTable *This = impl_from_IHTMLTable(iface);
1114 nsAString str;
1115 nsresult nsres;
1117 TRACE("(%p)->(%p)\n", This, p);
1119 nsAString_Init(&str, NULL);
1120 nsres = nsIDOMHTMLTableElement_GetFrame(This->nstable, &str);
1122 return return_nsstr(nsres, &str, p);
1125 static HRESULT WINAPI HTMLTable_put_rules(IHTMLTable *iface, BSTR v)
1127 HTMLTable *This = impl_from_IHTMLTable(iface);
1128 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1129 return E_NOTIMPL;
1132 static HRESULT WINAPI HTMLTable_get_rules(IHTMLTable *iface, BSTR *p)
1134 HTMLTable *This = impl_from_IHTMLTable(iface);
1135 FIXME("(%p)->(%p)\n", This, p);
1136 return E_NOTIMPL;
1139 static HRESULT WINAPI HTMLTable_put_cellSpacing(IHTMLTable *iface, VARIANT v)
1141 HTMLTable *This = impl_from_IHTMLTable(iface);
1142 nsAString nsstr;
1143 WCHAR buf[64];
1144 nsresult nsres;
1146 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1148 switch(V_VT(&v)) {
1149 case VT_BSTR:
1150 nsAString_InitDepend(&nsstr, V_BSTR(&v));
1151 break;
1152 case VT_I4: {
1153 swprintf(buf, ARRAY_SIZE(buf), L"%d", V_I4(&v));
1154 nsAString_InitDepend(&nsstr, buf);
1155 break;
1157 default:
1158 FIXME("unsupported arg %s\n", debugstr_variant(&v));
1159 return E_NOTIMPL;
1162 nsres = nsIDOMHTMLTableElement_SetCellSpacing(This->nstable, &nsstr);
1163 nsAString_Finish(&nsstr);
1164 if(NS_FAILED(nsres)) {
1165 ERR("SetCellSpacing failed: %08lx\n", nsres);
1166 return E_FAIL;
1169 return S_OK;
1172 static HRESULT WINAPI HTMLTable_get_cellSpacing(IHTMLTable *iface, VARIANT *p)
1174 HTMLTable *This = impl_from_IHTMLTable(iface);
1175 nsAString nsstr;
1176 nsresult nsres;
1178 TRACE("(%p)->(%p)\n", This, p);
1180 nsAString_Init(&nsstr, NULL);
1181 nsres = nsIDOMHTMLTableElement_GetCellSpacing(This->nstable, &nsstr);
1182 V_VT(p) = VT_BSTR;
1183 return return_nsstr(nsres, &nsstr, &V_BSTR(p));
1186 static HRESULT WINAPI HTMLTable_put_cellPadding(IHTMLTable *iface, VARIANT v)
1188 HTMLTable *This = impl_from_IHTMLTable(iface);
1189 nsAString val;
1190 HRESULT hres;
1191 nsresult nsres;
1193 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1195 hres = var2str(&v, &val);
1196 if(FAILED(hres))
1197 return hres;
1199 nsres = nsIDOMHTMLTableElement_SetCellPadding(This->nstable, &val);
1200 nsAString_Finish(&val);
1201 if(NS_FAILED(nsres)) {
1202 ERR("Set Width(%s) failed, err = %08lx\n", debugstr_variant(&v), nsres);
1203 return E_FAIL;
1206 return S_OK;
1209 static HRESULT WINAPI HTMLTable_get_cellPadding(IHTMLTable *iface, VARIANT *p)
1211 HTMLTable *This = impl_from_IHTMLTable(iface);
1212 nsAString val;
1213 nsresult nsres;
1215 TRACE("(%p)->(%p)\n", This, p);
1217 nsAString_Init(&val, NULL);
1218 nsres = nsIDOMHTMLTableElement_GetCellPadding(This->nstable, &val);
1219 return return_nsstr_variant(nsres, &val, 0, p);
1222 static HRESULT WINAPI HTMLTable_put_background(IHTMLTable *iface, BSTR v)
1224 HTMLTable *This = impl_from_IHTMLTable(iface);
1225 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1226 return E_NOTIMPL;
1229 static HRESULT WINAPI HTMLTable_get_background(IHTMLTable *iface, BSTR *p)
1231 HTMLTable *This = impl_from_IHTMLTable(iface);
1232 FIXME("(%p)->(%p)\n", This, p);
1233 return E_NOTIMPL;
1236 static HRESULT WINAPI HTMLTable_put_bgColor(IHTMLTable *iface, VARIANT v)
1238 HTMLTable *This = impl_from_IHTMLTable(iface);
1239 nsAString val;
1240 nsresult nsres;
1242 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1244 if(!variant_to_nscolor(&v, &val))
1245 return S_OK;
1247 nsres = nsIDOMHTMLTableElement_SetBgColor(This->nstable, &val);
1248 nsAString_Finish(&val);
1249 if (NS_FAILED(nsres)){
1250 ERR("Set BgColor(%s) failed!\n", debugstr_variant(&v));
1251 return E_FAIL;
1254 return S_OK;
1257 static HRESULT WINAPI HTMLTable_get_bgColor(IHTMLTable *iface, VARIANT *p)
1259 HTMLTable *This = impl_from_IHTMLTable(iface);
1260 nsAString strColor;
1261 nsresult nsres;
1262 HRESULT hres;
1263 const PRUnichar *color;
1265 TRACE("(%p)->(%p)\n", This, p);
1267 nsAString_Init(&strColor, NULL);
1268 nsres = nsIDOMHTMLTableElement_GetBgColor(This->nstable, &strColor);
1270 if(NS_SUCCEEDED(nsres)) {
1271 nsAString_GetData(&strColor, &color);
1272 V_VT(p) = VT_BSTR;
1273 hres = nscolor_to_str(color, &V_BSTR(p));
1274 }else {
1275 ERR("SetBgColor failed: %08lx\n", nsres);
1276 hres = E_FAIL;
1279 nsAString_Finish(&strColor);
1280 return hres;
1283 static HRESULT WINAPI HTMLTable_put_borderColor(IHTMLTable *iface, VARIANT v)
1285 HTMLTable *This = impl_from_IHTMLTable(iface);
1286 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1287 return E_NOTIMPL;
1290 static HRESULT WINAPI HTMLTable_get_borderColor(IHTMLTable *iface, VARIANT *p)
1292 HTMLTable *This = impl_from_IHTMLTable(iface);
1293 FIXME("(%p)->(%p)\n", This, p);
1294 return E_NOTIMPL;
1297 static HRESULT WINAPI HTMLTable_put_borderColorLight(IHTMLTable *iface, VARIANT v)
1299 HTMLTable *This = impl_from_IHTMLTable(iface);
1300 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1301 return E_NOTIMPL;
1304 static HRESULT WINAPI HTMLTable_get_borderColorLight(IHTMLTable *iface, VARIANT *p)
1306 HTMLTable *This = impl_from_IHTMLTable(iface);
1307 FIXME("(%p)->(%p)\n", This, p);
1308 return E_NOTIMPL;
1311 static HRESULT WINAPI HTMLTable_put_borderColorDark(IHTMLTable *iface, VARIANT v)
1313 HTMLTable *This = impl_from_IHTMLTable(iface);
1314 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1315 return E_NOTIMPL;
1318 static HRESULT WINAPI HTMLTable_get_borderColorDark(IHTMLTable *iface, VARIANT *p)
1320 HTMLTable *This = impl_from_IHTMLTable(iface);
1321 FIXME("(%p)->(%p)\n", This, p);
1322 return E_NOTIMPL;
1325 static HRESULT WINAPI HTMLTable_put_align(IHTMLTable *iface, BSTR v)
1327 HTMLTable *This = impl_from_IHTMLTable(iface);
1328 nsAString val;
1329 nsresult nsres;
1331 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1333 nsAString_InitDepend(&val, v);
1335 nsres = nsIDOMHTMLTableElement_SetAlign(This->nstable, &val);
1336 nsAString_Finish(&val);
1337 if (NS_FAILED(nsres)){
1338 ERR("Set Align(%s) failed!\n", debugstr_w(v));
1339 return E_FAIL;
1341 return S_OK;
1344 static HRESULT WINAPI HTMLTable_get_align(IHTMLTable *iface, BSTR *p)
1346 HTMLTable *This = impl_from_IHTMLTable(iface);
1347 nsAString val;
1348 nsresult nsres;
1350 TRACE("(%p)->(%p)\n", This, p);
1352 nsAString_Init(&val, NULL);
1353 nsres = nsIDOMHTMLTableElement_GetAlign(This->nstable, &val);
1355 return return_nsstr(nsres, &val, p);
1358 static HRESULT WINAPI HTMLTable_refresh(IHTMLTable *iface)
1360 HTMLTable *This = impl_from_IHTMLTable(iface);
1361 FIXME("(%p)\n", This);
1362 return E_NOTIMPL;
1365 static HRESULT WINAPI HTMLTable_get_rows(IHTMLTable *iface, IHTMLElementCollection **p)
1367 HTMLTable *This = impl_from_IHTMLTable(iface);
1368 nsIDOMHTMLCollection *nscol;
1369 nsresult nsres;
1371 TRACE("(%p)->(%p)\n", This, p);
1373 nsres = nsIDOMHTMLTableElement_GetRows(This->nstable, &nscol);
1374 if(NS_FAILED(nsres)) {
1375 ERR("GetRows failed: %08lx\n", nsres);
1376 return E_FAIL;
1379 *p = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->element.node.event_target.dispex));
1381 nsIDOMHTMLCollection_Release(nscol);
1382 return S_OK;
1385 static HRESULT WINAPI HTMLTable_put_width(IHTMLTable *iface, VARIANT v)
1387 HTMLTable *This = impl_from_IHTMLTable(iface);
1388 nsAString val;
1389 HRESULT hres;
1390 nsresult nsres;
1392 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1393 hres = var2str(&v, &val);
1395 if (FAILED(hres)){
1396 ERR("Set Width(%s) failed when initializing a nsAString, err = %08lx\n",
1397 debugstr_variant(&v), hres);
1398 return hres;
1401 nsres = nsIDOMHTMLTableElement_SetWidth(This->nstable, &val);
1402 nsAString_Finish(&val);
1404 if (NS_FAILED(nsres)){
1405 ERR("Set Width(%s) failed, err = %08lx\n", debugstr_variant(&v), nsres);
1406 return E_FAIL;
1408 return S_OK;
1411 static HRESULT WINAPI HTMLTable_get_width(IHTMLTable *iface, VARIANT *p)
1413 HTMLTable *This = impl_from_IHTMLTable(iface);
1414 nsAString val;
1415 nsresult nsres;
1417 TRACE("(%p)->(%p)\n", This, p);
1419 nsAString_Init(&val, NULL);
1420 nsres = nsIDOMHTMLTableElement_GetWidth(This->nstable, &val);
1421 return return_nsstr_variant(nsres, &val, NSSTR_IMPLICIT_PX, p);
1424 static HRESULT WINAPI HTMLTable_put_height(IHTMLTable *iface, VARIANT v)
1426 HTMLTable *This = impl_from_IHTMLTable(iface);
1427 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1428 return E_NOTIMPL;
1431 static HRESULT WINAPI HTMLTable_get_height(IHTMLTable *iface, VARIANT *p)
1433 HTMLTable *This = impl_from_IHTMLTable(iface);
1434 FIXME("(%p)->(%p)\n", This, p);
1435 return E_NOTIMPL;
1438 static HRESULT WINAPI HTMLTable_put_dataPageSize(IHTMLTable *iface, LONG v)
1440 HTMLTable *This = impl_from_IHTMLTable(iface);
1441 FIXME("(%p)->(%ld)\n", This, v);
1442 return E_NOTIMPL;
1445 static HRESULT WINAPI HTMLTable_get_dataPageSize(IHTMLTable *iface, LONG *p)
1447 HTMLTable *This = impl_from_IHTMLTable(iface);
1448 FIXME("(%p)->(%p)\n", This, p);
1449 return E_NOTIMPL;
1452 static HRESULT WINAPI HTMLTable_nextPage(IHTMLTable *iface)
1454 HTMLTable *This = impl_from_IHTMLTable(iface);
1455 FIXME("(%p)\n", This);
1456 return E_NOTIMPL;
1459 static HRESULT WINAPI HTMLTable_previousPage(IHTMLTable *iface)
1461 HTMLTable *This = impl_from_IHTMLTable(iface);
1462 FIXME("(%p)\n", This);
1463 return E_NOTIMPL;
1466 static HRESULT WINAPI HTMLTable_get_tHead(IHTMLTable *iface, IHTMLTableSection **p)
1468 HTMLTable *This = impl_from_IHTMLTable(iface);
1469 FIXME("(%p)->(%p)\n", This, p);
1470 return E_NOTIMPL;
1473 static HRESULT WINAPI HTMLTable_get_tFoot(IHTMLTable *iface, IHTMLTableSection **p)
1475 HTMLTable *This = impl_from_IHTMLTable(iface);
1476 FIXME("(%p)->(%p)\n", This, p);
1477 return E_NOTIMPL;
1480 static HRESULT WINAPI HTMLTable_get_tBodies(IHTMLTable *iface, IHTMLElementCollection **p)
1482 HTMLTable *This = impl_from_IHTMLTable(iface);
1483 nsIDOMHTMLCollection *nscol = NULL;
1484 nsresult nsres;
1486 TRACE("(%p)->(%p)\n", This, p);
1488 nsres = nsIDOMHTMLTableElement_GetTBodies(This->nstable, &nscol);
1489 if(NS_FAILED(nsres)) {
1490 ERR("GetTBodies failed: %08lx\n", nsres);
1491 return E_FAIL;
1494 *p = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->element.node.event_target.dispex));
1496 nsIDOMHTMLCollection_Release(nscol);
1497 return S_OK;
1500 static HRESULT WINAPI HTMLTable_get_caption(IHTMLTable *iface, IHTMLTableCaption **p)
1502 HTMLTable *This = impl_from_IHTMLTable(iface);
1503 FIXME("(%p)->(%p)\n", This, p);
1504 return E_NOTIMPL;
1507 static HRESULT WINAPI HTMLTable_createTHead(IHTMLTable *iface, IDispatch **head)
1509 HTMLTable *This = impl_from_IHTMLTable(iface);
1510 FIXME("(%p)->(%p)\n", This, head);
1511 return E_NOTIMPL;
1514 static HRESULT WINAPI HTMLTable_deleteTHead(IHTMLTable *iface)
1516 HTMLTable *This = impl_from_IHTMLTable(iface);
1517 FIXME("(%p)\n", This);
1518 return E_NOTIMPL;
1521 static HRESULT WINAPI HTMLTable_createTFoot(IHTMLTable *iface, IDispatch **foot)
1523 HTMLTable *This = impl_from_IHTMLTable(iface);
1524 FIXME("(%p)->(%p)\n", This, foot);
1525 return E_NOTIMPL;
1528 static HRESULT WINAPI HTMLTable_deleteTFoot(IHTMLTable *iface)
1530 HTMLTable *This = impl_from_IHTMLTable(iface);
1531 FIXME("(%p)\n", This);
1532 return E_NOTIMPL;
1535 static HRESULT WINAPI HTMLTable_createCaption(IHTMLTable *iface, IHTMLTableCaption **caption)
1537 HTMLTable *This = impl_from_IHTMLTable(iface);
1538 FIXME("(%p)->(%p)\n", This, caption);
1539 return E_NOTIMPL;
1542 static HRESULT WINAPI HTMLTable_deleteCaption(IHTMLTable *iface)
1544 HTMLTable *This = impl_from_IHTMLTable(iface);
1545 FIXME("(%p)\n", This);
1546 return E_NOTIMPL;
1549 static HRESULT WINAPI HTMLTable_insertRow(IHTMLTable *iface, LONG index, IDispatch **row)
1551 HTMLTable *This = impl_from_IHTMLTable(iface);
1552 nsIDOMHTMLElement *nselem;
1553 HTMLElement *elem;
1554 nsresult nsres;
1555 HRESULT hres;
1557 TRACE("(%p)->(%ld %p)\n", This, index, row);
1558 nsres = nsIDOMHTMLTableElement_InsertRow(This->nstable, index, &nselem);
1559 if(NS_FAILED(nsres)) {
1560 ERR("Insert Row at %ld failed: %08lx\n", index, nsres);
1561 return E_FAIL;
1564 hres = HTMLTableRow_Create(This->element.node.doc, (nsIDOMElement*)nselem, &elem);
1565 nsIDOMHTMLElement_Release(nselem);
1566 if (FAILED(hres)) {
1567 ERR("Create TableRow failed: %08lx\n", hres);
1568 return hres;
1571 *row = (IDispatch *)&elem->IHTMLElement_iface;
1572 return S_OK;
1575 static HRESULT WINAPI HTMLTable_deleteRow(IHTMLTable *iface, LONG index)
1577 HTMLTable *This = impl_from_IHTMLTable(iface);
1578 nsresult nsres;
1580 TRACE("(%p)->(%ld)\n", This, index);
1581 nsres = nsIDOMHTMLTableElement_DeleteRow(This->nstable, index);
1582 if(NS_FAILED(nsres)) {
1583 ERR("Delete Row failed: %08lx\n", nsres);
1584 return E_FAIL;
1586 return S_OK;
1589 static HRESULT WINAPI HTMLTable_get_readyState(IHTMLTable *iface, BSTR *p)
1591 HTMLTable *This = impl_from_IHTMLTable(iface);
1592 FIXME("(%p)->(%p)\n", This, p);
1593 return E_NOTIMPL;
1596 static HRESULT WINAPI HTMLTable_put_onreadystatechange(IHTMLTable *iface, VARIANT v)
1598 HTMLTable *This = impl_from_IHTMLTable(iface);
1599 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1600 return E_NOTIMPL;
1603 static HRESULT WINAPI HTMLTable_get_onreadystatechange(IHTMLTable *iface, VARIANT *p)
1605 HTMLTable *This = impl_from_IHTMLTable(iface);
1606 FIXME("(%p)->(%p)\n", This, p);
1607 return E_NOTIMPL;
1610 static const IHTMLTableVtbl HTMLTableVtbl = {
1611 HTMLTable_QueryInterface,
1612 HTMLTable_AddRef,
1613 HTMLTable_Release,
1614 HTMLTable_GetTypeInfoCount,
1615 HTMLTable_GetTypeInfo,
1616 HTMLTable_GetIDsOfNames,
1617 HTMLTable_Invoke,
1618 HTMLTable_put_cols,
1619 HTMLTable_get_cols,
1620 HTMLTable_put_border,
1621 HTMLTable_get_border,
1622 HTMLTable_put_frame,
1623 HTMLTable_get_frame,
1624 HTMLTable_put_rules,
1625 HTMLTable_get_rules,
1626 HTMLTable_put_cellSpacing,
1627 HTMLTable_get_cellSpacing,
1628 HTMLTable_put_cellPadding,
1629 HTMLTable_get_cellPadding,
1630 HTMLTable_put_background,
1631 HTMLTable_get_background,
1632 HTMLTable_put_bgColor,
1633 HTMLTable_get_bgColor,
1634 HTMLTable_put_borderColor,
1635 HTMLTable_get_borderColor,
1636 HTMLTable_put_borderColorLight,
1637 HTMLTable_get_borderColorLight,
1638 HTMLTable_put_borderColorDark,
1639 HTMLTable_get_borderColorDark,
1640 HTMLTable_put_align,
1641 HTMLTable_get_align,
1642 HTMLTable_refresh,
1643 HTMLTable_get_rows,
1644 HTMLTable_put_width,
1645 HTMLTable_get_width,
1646 HTMLTable_put_height,
1647 HTMLTable_get_height,
1648 HTMLTable_put_dataPageSize,
1649 HTMLTable_get_dataPageSize,
1650 HTMLTable_nextPage,
1651 HTMLTable_previousPage,
1652 HTMLTable_get_tHead,
1653 HTMLTable_get_tFoot,
1654 HTMLTable_get_tBodies,
1655 HTMLTable_get_caption,
1656 HTMLTable_createTHead,
1657 HTMLTable_deleteTHead,
1658 HTMLTable_createTFoot,
1659 HTMLTable_deleteTFoot,
1660 HTMLTable_createCaption,
1661 HTMLTable_deleteCaption,
1662 HTMLTable_insertRow,
1663 HTMLTable_deleteRow,
1664 HTMLTable_get_readyState,
1665 HTMLTable_put_onreadystatechange,
1666 HTMLTable_get_onreadystatechange
1669 /* IHTMLTable2 */
1670 static HRESULT WINAPI HTMLTable2_QueryInterface(IHTMLTable2 *iface,
1671 REFIID riid, void **ppv)
1673 HTMLTable *This = impl_from_IHTMLTable2(iface);
1675 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1678 static ULONG WINAPI HTMLTable2_AddRef(IHTMLTable2 *iface)
1680 HTMLTable *This = impl_from_IHTMLTable2(iface);
1682 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1685 static ULONG WINAPI HTMLTable2_Release(IHTMLTable2 *iface)
1687 HTMLTable *This = impl_from_IHTMLTable2(iface);
1689 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1692 static HRESULT WINAPI HTMLTable2_GetTypeInfoCount(IHTMLTable2 *iface, UINT *pctinfo)
1694 HTMLTable *This = impl_from_IHTMLTable2(iface);
1695 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1698 static HRESULT WINAPI HTMLTable2_GetTypeInfo(IHTMLTable2 *iface, UINT iTInfo,
1699 LCID lcid, ITypeInfo **ppTInfo)
1701 HTMLTable *This = impl_from_IHTMLTable2(iface);
1702 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
1703 ppTInfo);
1706 static HRESULT WINAPI HTMLTable2_GetIDsOfNames(IHTMLTable2 *iface, REFIID riid,
1707 LPOLESTR *rgszNames, UINT cNames,
1708 LCID lcid, DISPID *rgDispId)
1710 HTMLTable *This = impl_from_IHTMLTable2(iface);
1711 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1712 cNames, lcid, rgDispId);
1715 static HRESULT WINAPI HTMLTable2_Invoke(IHTMLTable2 *iface, DISPID dispIdMember,
1716 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1717 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1719 HTMLTable *This = impl_from_IHTMLTable2(iface);
1720 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1721 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1724 static HRESULT WINAPI HTMLTable2_firstPage(IHTMLTable2 *iface)
1726 HTMLTable *This = impl_from_IHTMLTable2(iface);
1727 FIXME("(%p)->()\n", This);
1728 return E_NOTIMPL;
1731 static HRESULT WINAPI HTMLTable2_lastPage(IHTMLTable2 *iface)
1733 HTMLTable *This = impl_from_IHTMLTable2(iface);
1734 FIXME("(%p)->()\n", This);
1735 return E_NOTIMPL;
1738 static HRESULT WINAPI HTMLTable2_cells(IHTMLTable2 *iface, IHTMLElementCollection **p)
1740 HTMLTable *This = impl_from_IHTMLTable2(iface);
1741 FIXME("(%p)->(%p)\n", This, p);
1742 return E_NOTIMPL;
1745 static HRESULT WINAPI HTMLTable2_moveRow(IHTMLTable2 *iface, LONG indexFrom, LONG indexTo, IDispatch **row)
1747 HTMLTable *This = impl_from_IHTMLTable2(iface);
1748 FIXME("(%p)->(%ld %ld %p)\n", This, indexFrom, indexTo, row);
1749 return E_NOTIMPL;
1753 static const IHTMLTable2Vtbl HTMLTable2Vtbl = {
1754 HTMLTable2_QueryInterface,
1755 HTMLTable2_AddRef,
1756 HTMLTable2_Release,
1757 HTMLTable2_GetTypeInfoCount,
1758 HTMLTable2_GetTypeInfo,
1759 HTMLTable2_GetIDsOfNames,
1760 HTMLTable2_Invoke,
1761 HTMLTable2_firstPage,
1762 HTMLTable2_lastPage,
1763 HTMLTable2_cells,
1764 HTMLTable2_moveRow
1767 /* IHTMLTable3 */
1768 static HRESULT WINAPI HTMLTable3_QueryInterface(IHTMLTable3 *iface,
1769 REFIID riid, void **ppv)
1771 HTMLTable *This = impl_from_IHTMLTable3(iface);
1773 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1776 static ULONG WINAPI HTMLTable3_AddRef(IHTMLTable3 *iface)
1778 HTMLTable *This = impl_from_IHTMLTable3(iface);
1780 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1783 static ULONG WINAPI HTMLTable3_Release(IHTMLTable3 *iface)
1785 HTMLTable *This = impl_from_IHTMLTable3(iface);
1787 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1790 static HRESULT WINAPI HTMLTable3_GetTypeInfoCount(IHTMLTable3 *iface, UINT *pctinfo)
1792 HTMLTable *This = impl_from_IHTMLTable3(iface);
1793 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1796 static HRESULT WINAPI HTMLTable3_GetTypeInfo(IHTMLTable3 *iface, UINT iTInfo,
1797 LCID lcid, ITypeInfo **ppTInfo)
1799 HTMLTable *This = impl_from_IHTMLTable3(iface);
1800 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
1801 ppTInfo);
1804 static HRESULT WINAPI HTMLTable3_GetIDsOfNames(IHTMLTable3 *iface, REFIID riid,
1805 LPOLESTR *rgszNames, UINT cNames,
1806 LCID lcid, DISPID *rgDispId)
1808 HTMLTable *This = impl_from_IHTMLTable3(iface);
1809 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1810 cNames, lcid, rgDispId);
1813 static HRESULT WINAPI HTMLTable3_Invoke(IHTMLTable3 *iface, DISPID dispIdMember,
1814 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1815 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1817 HTMLTable *This = impl_from_IHTMLTable3(iface);
1818 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1819 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1822 static HRESULT WINAPI HTMLTable3_put_summary(IHTMLTable3 *iface, BSTR v)
1824 HTMLTable *This = impl_from_IHTMLTable3(iface);
1825 nsAString str;
1826 nsresult nsres;
1828 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1830 nsAString_InitDepend(&str, v);
1832 nsres = nsIDOMHTMLTableElement_SetSummary(This->nstable, &str);
1834 nsAString_Finish(&str);
1835 if (NS_FAILED(nsres)) {
1836 ERR("Set summary(%s) failed: %08lx\n", debugstr_w(v), nsres);
1837 return E_FAIL;
1839 return S_OK;
1842 static HRESULT WINAPI HTMLTable3_get_summary(IHTMLTable3 *iface, BSTR * p)
1844 HTMLTable *This = impl_from_IHTMLTable3(iface);
1845 nsAString str;
1846 nsresult nsres;
1848 TRACE("(%p)->(%p)\n", This, p);
1850 nsAString_Init(&str, NULL);
1851 nsres = nsIDOMHTMLTableElement_GetSummary(This->nstable, &str);
1853 return return_nsstr(nsres, &str, p);
1856 static const IHTMLTable3Vtbl HTMLTable3Vtbl = {
1857 HTMLTable3_QueryInterface,
1858 HTMLTable3_AddRef,
1859 HTMLTable3_Release,
1860 HTMLTable3_GetTypeInfoCount,
1861 HTMLTable3_GetTypeInfo,
1862 HTMLTable3_GetIDsOfNames,
1863 HTMLTable3_Invoke,
1864 HTMLTable3_put_summary,
1865 HTMLTable3_get_summary
1868 static inline HTMLTable *impl_from_DispatchEx(DispatchEx *iface)
1870 return CONTAINING_RECORD(iface, HTMLTable, element.node.event_target.dispex);
1873 static void *HTMLTable_query_interface(DispatchEx *dispex, REFIID riid)
1875 HTMLTable *This = impl_from_DispatchEx(dispex);
1877 if(IsEqualGUID(&IID_IHTMLTable, riid))
1878 return &This->IHTMLTable_iface;
1879 if(IsEqualGUID(&IID_IHTMLTable2, riid))
1880 return &This->IHTMLTable2_iface;
1881 if(IsEqualGUID(&IID_IHTMLTable3, riid))
1882 return &This->IHTMLTable3_iface;
1884 return HTMLElement_query_interface(&This->element.node.event_target.dispex, riid);
1887 static void HTMLTable_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb)
1889 HTMLTable *This = impl_from_DispatchEx(dispex);
1890 HTMLDOMNode_traverse(dispex, cb);
1892 if(This->nstable)
1893 note_cc_edge((nsISupports*)This->nstable, "nstable", cb);
1896 static void HTMLTable_unlink(DispatchEx *dispex)
1898 HTMLTable *This = impl_from_DispatchEx(dispex);
1899 HTMLDOMNode_unlink(dispex);
1900 unlink_ref(&This->nstable);
1903 static const cpc_entry_t HTMLTable_cpc[] = {
1904 {&DIID_HTMLTableEvents},
1905 HTMLELEMENT_CPC,
1906 {NULL}
1909 static const NodeImplVtbl HTMLTableImplVtbl = {
1910 .clsid = &CLSID_HTMLTable,
1911 .cpc_entries = HTMLTable_cpc,
1912 .clone = HTMLElement_clone,
1913 .get_attr_col = HTMLElement_get_attr_col,
1916 static const event_target_vtbl_t HTMLTable_event_target_vtbl = {
1918 HTMLELEMENT_DISPEX_VTBL_ENTRIES,
1919 .query_interface= HTMLTable_query_interface,
1920 .destructor = HTMLElement_destructor,
1921 .traverse = HTMLTable_traverse,
1922 .unlink = HTMLTable_unlink
1924 HTMLELEMENT_EVENT_TARGET_VTBL_ENTRIES,
1925 .handle_event = HTMLElement_handle_event
1928 static const tid_t HTMLTable_iface_tids[] = {
1929 HTMLELEMENT_TIDS,
1930 IHTMLTable_tid,
1931 IHTMLTable2_tid,
1932 IHTMLTable3_tid,
1936 static dispex_static_data_t HTMLTable_dispex = {
1937 "HTMLTableElement",
1938 &HTMLTable_event_target_vtbl.dispex_vtbl,
1939 DispHTMLTable_tid,
1940 HTMLTable_iface_tids,
1941 HTMLElement_init_dispex_info
1944 HRESULT HTMLTable_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
1946 HTMLTable *ret;
1947 nsresult nsres;
1949 ret = calloc(1, sizeof(HTMLTable));
1950 if(!ret)
1951 return E_OUTOFMEMORY;
1953 ret->element.node.vtbl = &HTMLTableImplVtbl;
1954 ret->IHTMLTable_iface.lpVtbl = &HTMLTableVtbl;
1955 ret->IHTMLTable2_iface.lpVtbl = &HTMLTable2Vtbl;
1956 ret->IHTMLTable3_iface.lpVtbl = &HTMLTable3Vtbl;
1958 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTable_dispex);
1960 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableElement, (void**)&ret->nstable);
1961 assert(nsres == NS_OK);
1963 *elem = &ret->element;
1964 return S_OK;