gdiplus: In GdipImageSelectActiveFrame rely on codec->select_func() to fail.
[wine.git] / dlls / mshtml / htmltable.c
blob7f4c4fafb0eaf708bc8fadcc9b4b1c5af022e631
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_HTMLDOMNode(HTMLDOMNode *iface)
446 return CONTAINING_RECORD(iface, HTMLTableCell, element.node);
449 static HRESULT HTMLTableCell_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
451 HTMLTableCell *This = HTMLTableCell_from_HTMLDOMNode(iface);
453 if(IsEqualGUID(&IID_IUnknown, riid)) {
454 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
455 *ppv = &This->IHTMLTableCell_iface;
456 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
457 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
458 *ppv = &This->IHTMLTableCell_iface;
459 }else if(IsEqualGUID(&IID_IHTMLTableCell, riid)) {
460 TRACE("(%p)->(IID_IHTMLTableCell %p)\n", This, ppv);
461 *ppv = &This->IHTMLTableCell_iface;
462 }else {
463 return HTMLElement_QI(&This->element.node, riid, ppv);
466 IUnknown_AddRef((IUnknown*)*ppv);
467 return S_OK;
470 static void HTMLTableCell_destructor(HTMLDOMNode *iface)
472 HTMLTableCell *This = HTMLTableCell_from_HTMLDOMNode(iface);
474 HTMLElement_destructor(&This->element.node);
477 static void HTMLTableCell_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
479 HTMLTableCell *This = HTMLTableCell_from_HTMLDOMNode(iface);
481 if(This->nscell)
482 note_cc_edge((nsISupports*)This->nscell, "This->nstablecell", cb);
485 static void HTMLTableCell_unlink(HTMLDOMNode *iface)
487 HTMLTableCell *This = HTMLTableCell_from_HTMLDOMNode(iface);
488 unlink_ref(&This->nscell);
491 static const NodeImplVtbl HTMLTableCellImplVtbl = {
492 .clsid = &CLSID_HTMLTableCell,
493 .qi = HTMLTableCell_QI,
494 .destructor = HTMLTableCell_destructor,
495 .cpc_entries = HTMLElement_cpc,
496 .clone = HTMLElement_clone,
497 .handle_event = HTMLElement_handle_event,
498 .get_attr_col = HTMLElement_get_attr_col,
499 .traverse = HTMLTableCell_traverse,
500 .unlink = HTMLTableCell_unlink
503 static const tid_t HTMLTableCell_iface_tids[] = {
504 HTMLELEMENT_TIDS,
505 IHTMLTableCell_tid,
509 static dispex_static_data_t HTMLTableCell_dispex = {
510 "HTMLTableDataCellElement",
511 &HTMLElement_event_target_vtbl.dispex_vtbl,
512 DispHTMLTableCell_tid,
513 HTMLTableCell_iface_tids,
514 HTMLElement_init_dispex_info
517 HRESULT HTMLTableCell_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
519 HTMLTableCell *ret;
520 nsresult nsres;
522 ret = calloc(1, sizeof(*ret));
523 if(!ret)
524 return E_OUTOFMEMORY;
526 ret->IHTMLTableCell_iface.lpVtbl = &HTMLTableCellVtbl;
527 ret->element.node.vtbl = &HTMLTableCellImplVtbl;
529 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTableCell_dispex);
531 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableCellElement, (void**)&ret->nscell);
532 assert(nsres == NS_OK);
534 *elem = &ret->element;
535 return S_OK;
538 struct HTMLTableRow {
539 HTMLElement element;
541 IHTMLTableRow IHTMLTableRow_iface;
543 nsIDOMHTMLTableRowElement *nsrow;
546 static inline HTMLTableRow *impl_from_IHTMLTableRow(IHTMLTableRow *iface)
548 return CONTAINING_RECORD(iface, HTMLTableRow, IHTMLTableRow_iface);
551 static HRESULT WINAPI HTMLTableRow_QueryInterface(IHTMLTableRow *iface,
552 REFIID riid, void **ppv)
554 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
556 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
559 static ULONG WINAPI HTMLTableRow_AddRef(IHTMLTableRow *iface)
561 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
563 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
566 static ULONG WINAPI HTMLTableRow_Release(IHTMLTableRow *iface)
568 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
570 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
573 static HRESULT WINAPI HTMLTableRow_GetTypeInfoCount(IHTMLTableRow *iface, UINT *pctinfo)
575 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
576 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
579 static HRESULT WINAPI HTMLTableRow_GetTypeInfo(IHTMLTableRow *iface, UINT iTInfo,
580 LCID lcid, ITypeInfo **ppTInfo)
582 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
583 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
584 ppTInfo);
587 static HRESULT WINAPI HTMLTableRow_GetIDsOfNames(IHTMLTableRow *iface, REFIID riid,
588 LPOLESTR *rgszNames, UINT cNames,
589 LCID lcid, DISPID *rgDispId)
591 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
592 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
593 cNames, lcid, rgDispId);
596 static HRESULT WINAPI HTMLTableRow_Invoke(IHTMLTableRow *iface, DISPID dispIdMember,
597 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
598 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
600 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
601 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
602 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
605 static HRESULT WINAPI HTMLTableRow_put_align(IHTMLTableRow *iface, BSTR v)
607 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
608 nsAString val;
609 nsresult nsres;
611 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
613 nsAString_InitDepend(&val, v);
615 nsres = nsIDOMHTMLTableRowElement_SetAlign(This->nsrow, &val);
616 nsAString_Finish(&val);
617 if (NS_FAILED(nsres)){
618 ERR("Set Align(%s) failed!\n", debugstr_w(v));
619 return E_FAIL;
621 return S_OK;
624 static HRESULT WINAPI HTMLTableRow_get_align(IHTMLTableRow *iface, BSTR *p)
626 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
627 nsAString val;
628 nsresult nsres;
630 TRACE("(%p)->(%p)\n", This, p);
632 nsAString_Init(&val, NULL);
633 nsres = nsIDOMHTMLTableRowElement_GetAlign(This->nsrow, &val);
635 return return_nsstr(nsres, &val, p);
638 static HRESULT WINAPI HTMLTableRow_put_vAlign(IHTMLTableRow *iface, BSTR v)
640 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
641 nsAString val;
642 nsresult nsres;
644 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
646 nsAString_InitDepend(&val, v);
648 nsres = nsIDOMHTMLTableRowElement_SetVAlign(This->nsrow, &val);
649 nsAString_Finish(&val);
651 if (NS_FAILED(nsres)){
652 ERR("Set VAlign(%s) failed!\n", debugstr_w(v));
653 return E_FAIL;
656 return S_OK;
659 static HRESULT WINAPI HTMLTableRow_get_vAlign(IHTMLTableRow *iface, BSTR *p)
661 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
662 nsAString val;
663 nsresult nsres;
665 TRACE("(%p)->(%p)\n", This, p);
667 nsAString_Init(&val, NULL);
668 nsres = nsIDOMHTMLTableRowElement_GetVAlign(This->nsrow, &val);
670 return return_nsstr(nsres, &val, p);
673 static HRESULT WINAPI HTMLTableRow_put_bgColor(IHTMLTableRow *iface, VARIANT v)
675 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
676 nsAString val;
677 nsresult nsres;
679 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
681 if (!variant_to_nscolor(&v, &val))
682 return S_OK;
684 nsres = nsIDOMHTMLTableRowElement_SetBgColor(This->nsrow, &val);
685 nsAString_Finish(&val);
687 if (NS_FAILED(nsres)){
688 ERR("Set BgColor(%s) failed!\n", debugstr_variant(&v));
689 return E_FAIL;
692 return S_OK;
695 static HRESULT WINAPI HTMLTableRow_get_bgColor(IHTMLTableRow *iface, VARIANT *p)
697 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
698 nsAString strColor;
699 nsresult nsres;
700 HRESULT hres;
701 const PRUnichar *color;
703 TRACE("(%p)->(%p)\n", This, p);
705 nsAString_Init(&strColor, NULL);
706 nsres = nsIDOMHTMLTableRowElement_GetBgColor(This->nsrow, &strColor);
708 if(NS_SUCCEEDED(nsres)) {
709 nsAString_GetData(&strColor, &color);
710 V_VT(p) = VT_BSTR;
711 hres = nscolor_to_str(color, &V_BSTR(p));
712 }else {
713 ERR("SetBgColor failed: %08lx\n", nsres);
714 hres = E_FAIL;
717 nsAString_Finish(&strColor);
718 return hres;
721 static HRESULT WINAPI HTMLTableRow_put_borderColor(IHTMLTableRow *iface, VARIANT v)
723 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
724 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
725 return E_NOTIMPL;
728 static HRESULT WINAPI HTMLTableRow_get_borderColor(IHTMLTableRow *iface, VARIANT *p)
730 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
731 FIXME("(%p)->(%p)\n", This, p);
732 return E_NOTIMPL;
735 static HRESULT WINAPI HTMLTableRow_put_borderColorLight(IHTMLTableRow *iface, VARIANT v)
737 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
738 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
739 return E_NOTIMPL;
742 static HRESULT WINAPI HTMLTableRow_get_borderColorLight(IHTMLTableRow *iface, VARIANT *p)
744 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
745 FIXME("(%p)->(%p)\n", This, p);
746 return E_NOTIMPL;
749 static HRESULT WINAPI HTMLTableRow_put_borderColorDark(IHTMLTableRow *iface, VARIANT v)
751 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
752 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
753 return E_NOTIMPL;
756 static HRESULT WINAPI HTMLTableRow_get_borderColorDark(IHTMLTableRow *iface, VARIANT *p)
758 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
759 FIXME("(%p)->(%p)\n", This, p);
760 return E_NOTIMPL;
763 static HRESULT WINAPI HTMLTableRow_get_rowIndex(IHTMLTableRow *iface, LONG *p)
765 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
766 nsresult nsres;
768 TRACE("(%p)->(%p)\n", This, p);
769 nsres = nsIDOMHTMLTableRowElement_GetRowIndex(This->nsrow, p);
770 if(NS_FAILED(nsres)) {
771 ERR("Get rowIndex failed: %08lx\n", nsres);
772 return E_FAIL;
774 return S_OK;
777 static HRESULT WINAPI HTMLTableRow_get_sectionRowIndex(IHTMLTableRow *iface, LONG *p)
779 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
780 nsresult nsres;
782 TRACE("(%p)->(%p)\n", This, p);
783 nsres = nsIDOMHTMLTableRowElement_GetSectionRowIndex(This->nsrow, p);
784 if(NS_FAILED(nsres)) {
785 ERR("Get selectionRowIndex failed: %08lx\n", nsres);
786 return E_FAIL;
788 return S_OK;
791 static HRESULT WINAPI HTMLTableRow_get_cells(IHTMLTableRow *iface, IHTMLElementCollection **p)
793 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
794 nsIDOMHTMLCollection *nscol;
795 nsresult nsres;
797 TRACE("(%p)->(%p)\n", This, p);
799 nsres = nsIDOMHTMLTableRowElement_GetCells(This->nsrow, &nscol);
800 if(NS_FAILED(nsres)) {
801 ERR("GetCells failed: %08lx\n", nsres);
802 return E_FAIL;
805 *p = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->element.node.event_target.dispex));
807 nsIDOMHTMLCollection_Release(nscol);
808 return S_OK;
811 static HRESULT WINAPI HTMLTableRow_insertCell(IHTMLTableRow *iface, LONG index, IDispatch **row)
813 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
814 nsIDOMHTMLElement *nselem;
815 HTMLElement *elem;
816 nsresult nsres;
817 HRESULT hres;
819 TRACE("(%p)->(%ld %p)\n", This, index, row);
820 nsres = nsIDOMHTMLTableRowElement_InsertCell(This->nsrow, index, &nselem);
821 if(NS_FAILED(nsres)) {
822 ERR("Insert Cell at %ld failed: %08lx\n", index, nsres);
823 return E_FAIL;
826 hres = HTMLTableCell_Create(This->element.node.doc, (nsIDOMElement*)nselem, &elem);
827 nsIDOMHTMLElement_Release(nselem);
828 if (FAILED(hres)) {
829 ERR("Create TableCell failed: %08lx\n", hres);
830 return hres;
833 *row = (IDispatch *)&elem->IHTMLElement_iface;
834 return S_OK;
837 static HRESULT WINAPI HTMLTableRow_deleteCell(IHTMLTableRow *iface, LONG index)
839 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
840 nsresult nsres;
842 TRACE("(%p)->(%ld)\n", This, index);
843 nsres = nsIDOMHTMLTableRowElement_DeleteCell(This->nsrow, index);
844 if(NS_FAILED(nsres)) {
845 ERR("Delete Cell failed: %08lx\n", nsres);
846 return E_FAIL;
848 return S_OK;
851 static const IHTMLTableRowVtbl HTMLTableRowVtbl = {
852 HTMLTableRow_QueryInterface,
853 HTMLTableRow_AddRef,
854 HTMLTableRow_Release,
855 HTMLTableRow_GetTypeInfoCount,
856 HTMLTableRow_GetTypeInfo,
857 HTMLTableRow_GetIDsOfNames,
858 HTMLTableRow_Invoke,
859 HTMLTableRow_put_align,
860 HTMLTableRow_get_align,
861 HTMLTableRow_put_vAlign,
862 HTMLTableRow_get_vAlign,
863 HTMLTableRow_put_bgColor,
864 HTMLTableRow_get_bgColor,
865 HTMLTableRow_put_borderColor,
866 HTMLTableRow_get_borderColor,
867 HTMLTableRow_put_borderColorLight,
868 HTMLTableRow_get_borderColorLight,
869 HTMLTableRow_put_borderColorDark,
870 HTMLTableRow_get_borderColorDark,
871 HTMLTableRow_get_rowIndex,
872 HTMLTableRow_get_sectionRowIndex,
873 HTMLTableRow_get_cells,
874 HTMLTableRow_insertCell,
875 HTMLTableRow_deleteCell
878 static inline HTMLTableRow *HTMLTableRow_from_HTMLDOMNode(HTMLDOMNode *iface)
880 return CONTAINING_RECORD(iface, HTMLTableRow, element.node);
883 static HRESULT HTMLTableRow_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
885 HTMLTableRow *This = HTMLTableRow_from_HTMLDOMNode(iface);
887 *ppv = NULL;
889 if(IsEqualGUID(&IID_IUnknown, riid)) {
890 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
891 *ppv = &This->IHTMLTableRow_iface;
892 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
893 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
894 *ppv = &This->IHTMLTableRow_iface;
895 }else if(IsEqualGUID(&IID_IHTMLTableRow, riid)) {
896 TRACE("(%p)->(IID_IHTMLTableRow %p)\n", This, ppv);
897 *ppv = &This->IHTMLTableRow_iface;
900 if(*ppv) {
901 IUnknown_AddRef((IUnknown*)*ppv);
902 return S_OK;
905 return HTMLElement_QI(&This->element.node, riid, ppv);
908 static void HTMLTableRow_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
910 HTMLTableRow *This = HTMLTableRow_from_HTMLDOMNode(iface);
912 if(This->nsrow)
913 note_cc_edge((nsISupports*)This->nsrow, "This->nstablerow", cb);
916 static void HTMLTableRow_unlink(HTMLDOMNode *iface)
918 HTMLTableRow *This = HTMLTableRow_from_HTMLDOMNode(iface);
919 unlink_ref(&This->nsrow);
922 static const NodeImplVtbl HTMLTableRowImplVtbl = {
923 .clsid = &CLSID_HTMLTableRow,
924 .qi = HTMLTableRow_QI,
925 .destructor = HTMLElement_destructor,
926 .cpc_entries = HTMLElement_cpc,
927 .clone = HTMLElement_clone,
928 .handle_event = HTMLElement_handle_event,
929 .get_attr_col = HTMLElement_get_attr_col,
930 .traverse = HTMLTableRow_traverse,
931 .unlink = HTMLTableRow_unlink
934 static const tid_t HTMLTableRow_iface_tids[] = {
935 HTMLELEMENT_TIDS,
936 IHTMLTableRow_tid,
940 static dispex_static_data_t HTMLTableRow_dispex = {
941 "HTMLTableRowElement",
942 &HTMLElement_event_target_vtbl.dispex_vtbl,
943 DispHTMLTableRow_tid,
944 HTMLTableRow_iface_tids,
945 HTMLElement_init_dispex_info
948 HRESULT HTMLTableRow_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
950 HTMLTableRow *ret;
951 nsresult nsres;
953 ret = calloc(1, sizeof(HTMLTableRow));
954 if(!ret)
955 return E_OUTOFMEMORY;
957 ret->IHTMLTableRow_iface.lpVtbl = &HTMLTableRowVtbl;
958 ret->element.node.vtbl = &HTMLTableRowImplVtbl;
960 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTableRow_dispex);
962 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableRowElement, (void**)&ret->nsrow);
963 assert(nsres == NS_OK);
965 *elem = &ret->element;
966 return S_OK;
969 struct HTMLTable {
970 HTMLElement element;
972 IHTMLTable IHTMLTable_iface;
973 IHTMLTable2 IHTMLTable2_iface;
974 IHTMLTable3 IHTMLTable3_iface;
976 nsIDOMHTMLTableElement *nstable;
979 static inline HTMLTable *impl_from_IHTMLTable(IHTMLTable *iface)
981 return CONTAINING_RECORD(iface, HTMLTable, IHTMLTable_iface);
984 static inline HTMLTable *impl_from_IHTMLTable2(IHTMLTable2 *iface)
986 return CONTAINING_RECORD(iface, HTMLTable, IHTMLTable2_iface);
989 static inline HTMLTable *impl_from_IHTMLTable3(IHTMLTable3 *iface)
991 return CONTAINING_RECORD(iface, HTMLTable, IHTMLTable3_iface);
994 static HRESULT var2str(const VARIANT *p, nsAString *nsstr)
996 BSTR str;
997 BOOL ret;
998 HRESULT hres;
1000 switch(V_VT(p)) {
1001 case VT_BSTR:
1002 return nsAString_Init(nsstr, V_BSTR(p))?
1003 S_OK : E_OUTOFMEMORY;
1004 case VT_R8:
1005 hres = VarBstrFromR8(V_R8(p), MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), 0, &str);
1006 break;
1007 case VT_R4:
1008 hres = VarBstrFromR4(V_R4(p), MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), 0, &str);
1009 break;
1010 case VT_I4:
1011 hres = VarBstrFromI4(V_I4(p), MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), 0, &str);
1012 break;
1013 default:
1014 FIXME("unsupported arg %s\n", debugstr_variant(p));
1015 return E_NOTIMPL;
1017 if (FAILED(hres))
1018 return hres;
1020 ret = nsAString_Init(nsstr, str);
1021 SysFreeString(str);
1022 return ret ? S_OK : E_OUTOFMEMORY;
1025 static HRESULT WINAPI HTMLTable_QueryInterface(IHTMLTable *iface,
1026 REFIID riid, void **ppv)
1028 HTMLTable *This = impl_from_IHTMLTable(iface);
1030 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1033 static ULONG WINAPI HTMLTable_AddRef(IHTMLTable *iface)
1035 HTMLTable *This = impl_from_IHTMLTable(iface);
1037 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1040 static ULONG WINAPI HTMLTable_Release(IHTMLTable *iface)
1042 HTMLTable *This = impl_from_IHTMLTable(iface);
1044 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1047 static HRESULT WINAPI HTMLTable_GetTypeInfoCount(IHTMLTable *iface, UINT *pctinfo)
1049 HTMLTable *This = impl_from_IHTMLTable(iface);
1050 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1053 static HRESULT WINAPI HTMLTable_GetTypeInfo(IHTMLTable *iface, UINT iTInfo,
1054 LCID lcid, ITypeInfo **ppTInfo)
1056 HTMLTable *This = impl_from_IHTMLTable(iface);
1057 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
1058 ppTInfo);
1061 static HRESULT WINAPI HTMLTable_GetIDsOfNames(IHTMLTable *iface, REFIID riid,
1062 LPOLESTR *rgszNames, UINT cNames,
1063 LCID lcid, DISPID *rgDispId)
1065 HTMLTable *This = impl_from_IHTMLTable(iface);
1066 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1067 cNames, lcid, rgDispId);
1070 static HRESULT WINAPI HTMLTable_Invoke(IHTMLTable *iface, DISPID dispIdMember,
1071 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1072 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1074 HTMLTable *This = impl_from_IHTMLTable(iface);
1075 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1076 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1079 static HRESULT WINAPI HTMLTable_put_cols(IHTMLTable *iface, LONG v)
1081 HTMLTable *This = impl_from_IHTMLTable(iface);
1082 FIXME("(%p)->(%ld)\n", This, v);
1083 return E_NOTIMPL;
1086 static HRESULT WINAPI HTMLTable_get_cols(IHTMLTable *iface, LONG *p)
1088 HTMLTable *This = impl_from_IHTMLTable(iface);
1089 FIXME("(%p)->(%p)\n", This, p);
1090 return E_NOTIMPL;
1093 static HRESULT WINAPI HTMLTable_put_border(IHTMLTable *iface, VARIANT v)
1095 HTMLTable *This = impl_from_IHTMLTable(iface);
1096 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1097 return E_NOTIMPL;
1100 static HRESULT WINAPI HTMLTable_get_border(IHTMLTable *iface, VARIANT *p)
1102 HTMLTable *This = impl_from_IHTMLTable(iface);
1103 FIXME("(%p)->(%p)\n", This, p);
1104 return E_NOTIMPL;
1107 static HRESULT WINAPI HTMLTable_put_frame(IHTMLTable *iface, BSTR v)
1109 HTMLTable *This = impl_from_IHTMLTable(iface);
1110 nsAString str;
1111 nsresult nsres;
1113 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1115 nsAString_InitDepend(&str, v);
1116 nsres = nsIDOMHTMLTableElement_SetFrame(This->nstable, &str);
1117 nsAString_Finish(&str);
1119 if (NS_FAILED(nsres)) {
1120 ERR("SetFrame(%s) failed: %08lx\n", debugstr_w(v), nsres);
1121 return E_FAIL;
1123 return S_OK;
1126 static HRESULT WINAPI HTMLTable_get_frame(IHTMLTable *iface, BSTR *p)
1128 HTMLTable *This = impl_from_IHTMLTable(iface);
1129 nsAString str;
1130 nsresult nsres;
1132 TRACE("(%p)->(%p)\n", This, p);
1134 nsAString_Init(&str, NULL);
1135 nsres = nsIDOMHTMLTableElement_GetFrame(This->nstable, &str);
1137 return return_nsstr(nsres, &str, p);
1140 static HRESULT WINAPI HTMLTable_put_rules(IHTMLTable *iface, BSTR v)
1142 HTMLTable *This = impl_from_IHTMLTable(iface);
1143 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1144 return E_NOTIMPL;
1147 static HRESULT WINAPI HTMLTable_get_rules(IHTMLTable *iface, BSTR *p)
1149 HTMLTable *This = impl_from_IHTMLTable(iface);
1150 FIXME("(%p)->(%p)\n", This, p);
1151 return E_NOTIMPL;
1154 static HRESULT WINAPI HTMLTable_put_cellSpacing(IHTMLTable *iface, VARIANT v)
1156 HTMLTable *This = impl_from_IHTMLTable(iface);
1157 nsAString nsstr;
1158 WCHAR buf[64];
1159 nsresult nsres;
1161 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1163 switch(V_VT(&v)) {
1164 case VT_BSTR:
1165 nsAString_InitDepend(&nsstr, V_BSTR(&v));
1166 break;
1167 case VT_I4: {
1168 swprintf(buf, ARRAY_SIZE(buf), L"%d", V_I4(&v));
1169 nsAString_InitDepend(&nsstr, buf);
1170 break;
1172 default:
1173 FIXME("unsupported arg %s\n", debugstr_variant(&v));
1174 return E_NOTIMPL;
1177 nsres = nsIDOMHTMLTableElement_SetCellSpacing(This->nstable, &nsstr);
1178 nsAString_Finish(&nsstr);
1179 if(NS_FAILED(nsres)) {
1180 ERR("SetCellSpacing failed: %08lx\n", nsres);
1181 return E_FAIL;
1184 return S_OK;
1187 static HRESULT WINAPI HTMLTable_get_cellSpacing(IHTMLTable *iface, VARIANT *p)
1189 HTMLTable *This = impl_from_IHTMLTable(iface);
1190 nsAString nsstr;
1191 nsresult nsres;
1193 TRACE("(%p)->(%p)\n", This, p);
1195 nsAString_Init(&nsstr, NULL);
1196 nsres = nsIDOMHTMLTableElement_GetCellSpacing(This->nstable, &nsstr);
1197 V_VT(p) = VT_BSTR;
1198 return return_nsstr(nsres, &nsstr, &V_BSTR(p));
1201 static HRESULT WINAPI HTMLTable_put_cellPadding(IHTMLTable *iface, VARIANT v)
1203 HTMLTable *This = impl_from_IHTMLTable(iface);
1204 nsAString val;
1205 HRESULT hres;
1206 nsresult nsres;
1208 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1210 hres = var2str(&v, &val);
1211 if(FAILED(hres))
1212 return hres;
1214 nsres = nsIDOMHTMLTableElement_SetCellPadding(This->nstable, &val);
1215 nsAString_Finish(&val);
1216 if(NS_FAILED(nsres)) {
1217 ERR("Set Width(%s) failed, err = %08lx\n", debugstr_variant(&v), nsres);
1218 return E_FAIL;
1221 return S_OK;
1224 static HRESULT WINAPI HTMLTable_get_cellPadding(IHTMLTable *iface, VARIANT *p)
1226 HTMLTable *This = impl_from_IHTMLTable(iface);
1227 nsAString val;
1228 nsresult nsres;
1230 TRACE("(%p)->(%p)\n", This, p);
1232 nsAString_Init(&val, NULL);
1233 nsres = nsIDOMHTMLTableElement_GetCellPadding(This->nstable, &val);
1234 return return_nsstr_variant(nsres, &val, 0, p);
1237 static HRESULT WINAPI HTMLTable_put_background(IHTMLTable *iface, BSTR v)
1239 HTMLTable *This = impl_from_IHTMLTable(iface);
1240 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1241 return E_NOTIMPL;
1244 static HRESULT WINAPI HTMLTable_get_background(IHTMLTable *iface, BSTR *p)
1246 HTMLTable *This = impl_from_IHTMLTable(iface);
1247 FIXME("(%p)->(%p)\n", This, p);
1248 return E_NOTIMPL;
1251 static HRESULT WINAPI HTMLTable_put_bgColor(IHTMLTable *iface, VARIANT v)
1253 HTMLTable *This = impl_from_IHTMLTable(iface);
1254 nsAString val;
1255 nsresult nsres;
1257 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1259 if(!variant_to_nscolor(&v, &val))
1260 return S_OK;
1262 nsres = nsIDOMHTMLTableElement_SetBgColor(This->nstable, &val);
1263 nsAString_Finish(&val);
1264 if (NS_FAILED(nsres)){
1265 ERR("Set BgColor(%s) failed!\n", debugstr_variant(&v));
1266 return E_FAIL;
1269 return S_OK;
1272 static HRESULT WINAPI HTMLTable_get_bgColor(IHTMLTable *iface, VARIANT *p)
1274 HTMLTable *This = impl_from_IHTMLTable(iface);
1275 nsAString strColor;
1276 nsresult nsres;
1277 HRESULT hres;
1278 const PRUnichar *color;
1280 TRACE("(%p)->(%p)\n", This, p);
1282 nsAString_Init(&strColor, NULL);
1283 nsres = nsIDOMHTMLTableElement_GetBgColor(This->nstable, &strColor);
1285 if(NS_SUCCEEDED(nsres)) {
1286 nsAString_GetData(&strColor, &color);
1287 V_VT(p) = VT_BSTR;
1288 hres = nscolor_to_str(color, &V_BSTR(p));
1289 }else {
1290 ERR("SetBgColor failed: %08lx\n", nsres);
1291 hres = E_FAIL;
1294 nsAString_Finish(&strColor);
1295 return hres;
1298 static HRESULT WINAPI HTMLTable_put_borderColor(IHTMLTable *iface, VARIANT v)
1300 HTMLTable *This = impl_from_IHTMLTable(iface);
1301 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1302 return E_NOTIMPL;
1305 static HRESULT WINAPI HTMLTable_get_borderColor(IHTMLTable *iface, VARIANT *p)
1307 HTMLTable *This = impl_from_IHTMLTable(iface);
1308 FIXME("(%p)->(%p)\n", This, p);
1309 return E_NOTIMPL;
1312 static HRESULT WINAPI HTMLTable_put_borderColorLight(IHTMLTable *iface, VARIANT v)
1314 HTMLTable *This = impl_from_IHTMLTable(iface);
1315 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1316 return E_NOTIMPL;
1319 static HRESULT WINAPI HTMLTable_get_borderColorLight(IHTMLTable *iface, VARIANT *p)
1321 HTMLTable *This = impl_from_IHTMLTable(iface);
1322 FIXME("(%p)->(%p)\n", This, p);
1323 return E_NOTIMPL;
1326 static HRESULT WINAPI HTMLTable_put_borderColorDark(IHTMLTable *iface, VARIANT v)
1328 HTMLTable *This = impl_from_IHTMLTable(iface);
1329 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1330 return E_NOTIMPL;
1333 static HRESULT WINAPI HTMLTable_get_borderColorDark(IHTMLTable *iface, VARIANT *p)
1335 HTMLTable *This = impl_from_IHTMLTable(iface);
1336 FIXME("(%p)->(%p)\n", This, p);
1337 return E_NOTIMPL;
1340 static HRESULT WINAPI HTMLTable_put_align(IHTMLTable *iface, BSTR v)
1342 HTMLTable *This = impl_from_IHTMLTable(iface);
1343 nsAString val;
1344 nsresult nsres;
1346 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1348 nsAString_InitDepend(&val, v);
1350 nsres = nsIDOMHTMLTableElement_SetAlign(This->nstable, &val);
1351 nsAString_Finish(&val);
1352 if (NS_FAILED(nsres)){
1353 ERR("Set Align(%s) failed!\n", debugstr_w(v));
1354 return E_FAIL;
1356 return S_OK;
1359 static HRESULT WINAPI HTMLTable_get_align(IHTMLTable *iface, BSTR *p)
1361 HTMLTable *This = impl_from_IHTMLTable(iface);
1362 nsAString val;
1363 nsresult nsres;
1365 TRACE("(%p)->(%p)\n", This, p);
1367 nsAString_Init(&val, NULL);
1368 nsres = nsIDOMHTMLTableElement_GetAlign(This->nstable, &val);
1370 return return_nsstr(nsres, &val, p);
1373 static HRESULT WINAPI HTMLTable_refresh(IHTMLTable *iface)
1375 HTMLTable *This = impl_from_IHTMLTable(iface);
1376 FIXME("(%p)\n", This);
1377 return E_NOTIMPL;
1380 static HRESULT WINAPI HTMLTable_get_rows(IHTMLTable *iface, IHTMLElementCollection **p)
1382 HTMLTable *This = impl_from_IHTMLTable(iface);
1383 nsIDOMHTMLCollection *nscol;
1384 nsresult nsres;
1386 TRACE("(%p)->(%p)\n", This, p);
1388 nsres = nsIDOMHTMLTableElement_GetRows(This->nstable, &nscol);
1389 if(NS_FAILED(nsres)) {
1390 ERR("GetRows failed: %08lx\n", nsres);
1391 return E_FAIL;
1394 *p = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->element.node.event_target.dispex));
1396 nsIDOMHTMLCollection_Release(nscol);
1397 return S_OK;
1400 static HRESULT WINAPI HTMLTable_put_width(IHTMLTable *iface, VARIANT v)
1402 HTMLTable *This = impl_from_IHTMLTable(iface);
1403 nsAString val;
1404 HRESULT hres;
1405 nsresult nsres;
1407 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1408 hres = var2str(&v, &val);
1410 if (FAILED(hres)){
1411 ERR("Set Width(%s) failed when initializing a nsAString, err = %08lx\n",
1412 debugstr_variant(&v), hres);
1413 return hres;
1416 nsres = nsIDOMHTMLTableElement_SetWidth(This->nstable, &val);
1417 nsAString_Finish(&val);
1419 if (NS_FAILED(nsres)){
1420 ERR("Set Width(%s) failed, err = %08lx\n", debugstr_variant(&v), nsres);
1421 return E_FAIL;
1423 return S_OK;
1426 static HRESULT WINAPI HTMLTable_get_width(IHTMLTable *iface, VARIANT *p)
1428 HTMLTable *This = impl_from_IHTMLTable(iface);
1429 nsAString val;
1430 nsresult nsres;
1432 TRACE("(%p)->(%p)\n", This, p);
1434 nsAString_Init(&val, NULL);
1435 nsres = nsIDOMHTMLTableElement_GetWidth(This->nstable, &val);
1436 return return_nsstr_variant(nsres, &val, NSSTR_IMPLICIT_PX, p);
1439 static HRESULT WINAPI HTMLTable_put_height(IHTMLTable *iface, VARIANT v)
1441 HTMLTable *This = impl_from_IHTMLTable(iface);
1442 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1443 return E_NOTIMPL;
1446 static HRESULT WINAPI HTMLTable_get_height(IHTMLTable *iface, VARIANT *p)
1448 HTMLTable *This = impl_from_IHTMLTable(iface);
1449 FIXME("(%p)->(%p)\n", This, p);
1450 return E_NOTIMPL;
1453 static HRESULT WINAPI HTMLTable_put_dataPageSize(IHTMLTable *iface, LONG v)
1455 HTMLTable *This = impl_from_IHTMLTable(iface);
1456 FIXME("(%p)->(%ld)\n", This, v);
1457 return E_NOTIMPL;
1460 static HRESULT WINAPI HTMLTable_get_dataPageSize(IHTMLTable *iface, LONG *p)
1462 HTMLTable *This = impl_from_IHTMLTable(iface);
1463 FIXME("(%p)->(%p)\n", This, p);
1464 return E_NOTIMPL;
1467 static HRESULT WINAPI HTMLTable_nextPage(IHTMLTable *iface)
1469 HTMLTable *This = impl_from_IHTMLTable(iface);
1470 FIXME("(%p)\n", This);
1471 return E_NOTIMPL;
1474 static HRESULT WINAPI HTMLTable_previousPage(IHTMLTable *iface)
1476 HTMLTable *This = impl_from_IHTMLTable(iface);
1477 FIXME("(%p)\n", This);
1478 return E_NOTIMPL;
1481 static HRESULT WINAPI HTMLTable_get_tHead(IHTMLTable *iface, IHTMLTableSection **p)
1483 HTMLTable *This = impl_from_IHTMLTable(iface);
1484 FIXME("(%p)->(%p)\n", This, p);
1485 return E_NOTIMPL;
1488 static HRESULT WINAPI HTMLTable_get_tFoot(IHTMLTable *iface, IHTMLTableSection **p)
1490 HTMLTable *This = impl_from_IHTMLTable(iface);
1491 FIXME("(%p)->(%p)\n", This, p);
1492 return E_NOTIMPL;
1495 static HRESULT WINAPI HTMLTable_get_tBodies(IHTMLTable *iface, IHTMLElementCollection **p)
1497 HTMLTable *This = impl_from_IHTMLTable(iface);
1498 nsIDOMHTMLCollection *nscol = NULL;
1499 nsresult nsres;
1501 TRACE("(%p)->(%p)\n", This, p);
1503 nsres = nsIDOMHTMLTableElement_GetTBodies(This->nstable, &nscol);
1504 if(NS_FAILED(nsres)) {
1505 ERR("GetTBodies failed: %08lx\n", nsres);
1506 return E_FAIL;
1509 *p = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->element.node.event_target.dispex));
1511 nsIDOMHTMLCollection_Release(nscol);
1512 return S_OK;
1515 static HRESULT WINAPI HTMLTable_get_caption(IHTMLTable *iface, IHTMLTableCaption **p)
1517 HTMLTable *This = impl_from_IHTMLTable(iface);
1518 FIXME("(%p)->(%p)\n", This, p);
1519 return E_NOTIMPL;
1522 static HRESULT WINAPI HTMLTable_createTHead(IHTMLTable *iface, IDispatch **head)
1524 HTMLTable *This = impl_from_IHTMLTable(iface);
1525 FIXME("(%p)->(%p)\n", This, head);
1526 return E_NOTIMPL;
1529 static HRESULT WINAPI HTMLTable_deleteTHead(IHTMLTable *iface)
1531 HTMLTable *This = impl_from_IHTMLTable(iface);
1532 FIXME("(%p)\n", This);
1533 return E_NOTIMPL;
1536 static HRESULT WINAPI HTMLTable_createTFoot(IHTMLTable *iface, IDispatch **foot)
1538 HTMLTable *This = impl_from_IHTMLTable(iface);
1539 FIXME("(%p)->(%p)\n", This, foot);
1540 return E_NOTIMPL;
1543 static HRESULT WINAPI HTMLTable_deleteTFoot(IHTMLTable *iface)
1545 HTMLTable *This = impl_from_IHTMLTable(iface);
1546 FIXME("(%p)\n", This);
1547 return E_NOTIMPL;
1550 static HRESULT WINAPI HTMLTable_createCaption(IHTMLTable *iface, IHTMLTableCaption **caption)
1552 HTMLTable *This = impl_from_IHTMLTable(iface);
1553 FIXME("(%p)->(%p)\n", This, caption);
1554 return E_NOTIMPL;
1557 static HRESULT WINAPI HTMLTable_deleteCaption(IHTMLTable *iface)
1559 HTMLTable *This = impl_from_IHTMLTable(iface);
1560 FIXME("(%p)\n", This);
1561 return E_NOTIMPL;
1564 static HRESULT WINAPI HTMLTable_insertRow(IHTMLTable *iface, LONG index, IDispatch **row)
1566 HTMLTable *This = impl_from_IHTMLTable(iface);
1567 nsIDOMHTMLElement *nselem;
1568 HTMLElement *elem;
1569 nsresult nsres;
1570 HRESULT hres;
1572 TRACE("(%p)->(%ld %p)\n", This, index, row);
1573 nsres = nsIDOMHTMLTableElement_InsertRow(This->nstable, index, &nselem);
1574 if(NS_FAILED(nsres)) {
1575 ERR("Insert Row at %ld failed: %08lx\n", index, nsres);
1576 return E_FAIL;
1579 hres = HTMLTableRow_Create(This->element.node.doc, (nsIDOMElement*)nselem, &elem);
1580 nsIDOMHTMLElement_Release(nselem);
1581 if (FAILED(hres)) {
1582 ERR("Create TableRow failed: %08lx\n", hres);
1583 return hres;
1586 *row = (IDispatch *)&elem->IHTMLElement_iface;
1587 return S_OK;
1590 static HRESULT WINAPI HTMLTable_deleteRow(IHTMLTable *iface, LONG index)
1592 HTMLTable *This = impl_from_IHTMLTable(iface);
1593 nsresult nsres;
1595 TRACE("(%p)->(%ld)\n", This, index);
1596 nsres = nsIDOMHTMLTableElement_DeleteRow(This->nstable, index);
1597 if(NS_FAILED(nsres)) {
1598 ERR("Delete Row failed: %08lx\n", nsres);
1599 return E_FAIL;
1601 return S_OK;
1604 static HRESULT WINAPI HTMLTable_get_readyState(IHTMLTable *iface, BSTR *p)
1606 HTMLTable *This = impl_from_IHTMLTable(iface);
1607 FIXME("(%p)->(%p)\n", This, p);
1608 return E_NOTIMPL;
1611 static HRESULT WINAPI HTMLTable_put_onreadystatechange(IHTMLTable *iface, VARIANT v)
1613 HTMLTable *This = impl_from_IHTMLTable(iface);
1614 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1615 return E_NOTIMPL;
1618 static HRESULT WINAPI HTMLTable_get_onreadystatechange(IHTMLTable *iface, VARIANT *p)
1620 HTMLTable *This = impl_from_IHTMLTable(iface);
1621 FIXME("(%p)->(%p)\n", This, p);
1622 return E_NOTIMPL;
1625 static const IHTMLTableVtbl HTMLTableVtbl = {
1626 HTMLTable_QueryInterface,
1627 HTMLTable_AddRef,
1628 HTMLTable_Release,
1629 HTMLTable_GetTypeInfoCount,
1630 HTMLTable_GetTypeInfo,
1631 HTMLTable_GetIDsOfNames,
1632 HTMLTable_Invoke,
1633 HTMLTable_put_cols,
1634 HTMLTable_get_cols,
1635 HTMLTable_put_border,
1636 HTMLTable_get_border,
1637 HTMLTable_put_frame,
1638 HTMLTable_get_frame,
1639 HTMLTable_put_rules,
1640 HTMLTable_get_rules,
1641 HTMLTable_put_cellSpacing,
1642 HTMLTable_get_cellSpacing,
1643 HTMLTable_put_cellPadding,
1644 HTMLTable_get_cellPadding,
1645 HTMLTable_put_background,
1646 HTMLTable_get_background,
1647 HTMLTable_put_bgColor,
1648 HTMLTable_get_bgColor,
1649 HTMLTable_put_borderColor,
1650 HTMLTable_get_borderColor,
1651 HTMLTable_put_borderColorLight,
1652 HTMLTable_get_borderColorLight,
1653 HTMLTable_put_borderColorDark,
1654 HTMLTable_get_borderColorDark,
1655 HTMLTable_put_align,
1656 HTMLTable_get_align,
1657 HTMLTable_refresh,
1658 HTMLTable_get_rows,
1659 HTMLTable_put_width,
1660 HTMLTable_get_width,
1661 HTMLTable_put_height,
1662 HTMLTable_get_height,
1663 HTMLTable_put_dataPageSize,
1664 HTMLTable_get_dataPageSize,
1665 HTMLTable_nextPage,
1666 HTMLTable_previousPage,
1667 HTMLTable_get_tHead,
1668 HTMLTable_get_tFoot,
1669 HTMLTable_get_tBodies,
1670 HTMLTable_get_caption,
1671 HTMLTable_createTHead,
1672 HTMLTable_deleteTHead,
1673 HTMLTable_createTFoot,
1674 HTMLTable_deleteTFoot,
1675 HTMLTable_createCaption,
1676 HTMLTable_deleteCaption,
1677 HTMLTable_insertRow,
1678 HTMLTable_deleteRow,
1679 HTMLTable_get_readyState,
1680 HTMLTable_put_onreadystatechange,
1681 HTMLTable_get_onreadystatechange
1684 /* IHTMLTable2 */
1685 static HRESULT WINAPI HTMLTable2_QueryInterface(IHTMLTable2 *iface,
1686 REFIID riid, void **ppv)
1688 HTMLTable *This = impl_from_IHTMLTable2(iface);
1690 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1693 static ULONG WINAPI HTMLTable2_AddRef(IHTMLTable2 *iface)
1695 HTMLTable *This = impl_from_IHTMLTable2(iface);
1697 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1700 static ULONG WINAPI HTMLTable2_Release(IHTMLTable2 *iface)
1702 HTMLTable *This = impl_from_IHTMLTable2(iface);
1704 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1707 static HRESULT WINAPI HTMLTable2_GetTypeInfoCount(IHTMLTable2 *iface, UINT *pctinfo)
1709 HTMLTable *This = impl_from_IHTMLTable2(iface);
1710 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1713 static HRESULT WINAPI HTMLTable2_GetTypeInfo(IHTMLTable2 *iface, UINT iTInfo,
1714 LCID lcid, ITypeInfo **ppTInfo)
1716 HTMLTable *This = impl_from_IHTMLTable2(iface);
1717 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
1718 ppTInfo);
1721 static HRESULT WINAPI HTMLTable2_GetIDsOfNames(IHTMLTable2 *iface, REFIID riid,
1722 LPOLESTR *rgszNames, UINT cNames,
1723 LCID lcid, DISPID *rgDispId)
1725 HTMLTable *This = impl_from_IHTMLTable2(iface);
1726 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1727 cNames, lcid, rgDispId);
1730 static HRESULT WINAPI HTMLTable2_Invoke(IHTMLTable2 *iface, DISPID dispIdMember,
1731 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1732 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1734 HTMLTable *This = impl_from_IHTMLTable2(iface);
1735 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1736 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1739 static HRESULT WINAPI HTMLTable2_firstPage(IHTMLTable2 *iface)
1741 HTMLTable *This = impl_from_IHTMLTable2(iface);
1742 FIXME("(%p)->()\n", This);
1743 return E_NOTIMPL;
1746 static HRESULT WINAPI HTMLTable2_lastPage(IHTMLTable2 *iface)
1748 HTMLTable *This = impl_from_IHTMLTable2(iface);
1749 FIXME("(%p)->()\n", This);
1750 return E_NOTIMPL;
1753 static HRESULT WINAPI HTMLTable2_cells(IHTMLTable2 *iface, IHTMLElementCollection **p)
1755 HTMLTable *This = impl_from_IHTMLTable2(iface);
1756 FIXME("(%p)->(%p)\n", This, p);
1757 return E_NOTIMPL;
1760 static HRESULT WINAPI HTMLTable2_moveRow(IHTMLTable2 *iface, LONG indexFrom, LONG indexTo, IDispatch **row)
1762 HTMLTable *This = impl_from_IHTMLTable2(iface);
1763 FIXME("(%p)->(%ld %ld %p)\n", This, indexFrom, indexTo, row);
1764 return E_NOTIMPL;
1768 static const IHTMLTable2Vtbl HTMLTable2Vtbl = {
1769 HTMLTable2_QueryInterface,
1770 HTMLTable2_AddRef,
1771 HTMLTable2_Release,
1772 HTMLTable2_GetTypeInfoCount,
1773 HTMLTable2_GetTypeInfo,
1774 HTMLTable2_GetIDsOfNames,
1775 HTMLTable2_Invoke,
1776 HTMLTable2_firstPage,
1777 HTMLTable2_lastPage,
1778 HTMLTable2_cells,
1779 HTMLTable2_moveRow
1782 /* IHTMLTable3 */
1783 static HRESULT WINAPI HTMLTable3_QueryInterface(IHTMLTable3 *iface,
1784 REFIID riid, void **ppv)
1786 HTMLTable *This = impl_from_IHTMLTable3(iface);
1788 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1791 static ULONG WINAPI HTMLTable3_AddRef(IHTMLTable3 *iface)
1793 HTMLTable *This = impl_from_IHTMLTable3(iface);
1795 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1798 static ULONG WINAPI HTMLTable3_Release(IHTMLTable3 *iface)
1800 HTMLTable *This = impl_from_IHTMLTable3(iface);
1802 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1805 static HRESULT WINAPI HTMLTable3_GetTypeInfoCount(IHTMLTable3 *iface, UINT *pctinfo)
1807 HTMLTable *This = impl_from_IHTMLTable3(iface);
1808 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1811 static HRESULT WINAPI HTMLTable3_GetTypeInfo(IHTMLTable3 *iface, UINT iTInfo,
1812 LCID lcid, ITypeInfo **ppTInfo)
1814 HTMLTable *This = impl_from_IHTMLTable3(iface);
1815 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
1816 ppTInfo);
1819 static HRESULT WINAPI HTMLTable3_GetIDsOfNames(IHTMLTable3 *iface, REFIID riid,
1820 LPOLESTR *rgszNames, UINT cNames,
1821 LCID lcid, DISPID *rgDispId)
1823 HTMLTable *This = impl_from_IHTMLTable3(iface);
1824 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1825 cNames, lcid, rgDispId);
1828 static HRESULT WINAPI HTMLTable3_Invoke(IHTMLTable3 *iface, DISPID dispIdMember,
1829 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1830 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1832 HTMLTable *This = impl_from_IHTMLTable3(iface);
1833 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1834 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1837 static HRESULT WINAPI HTMLTable3_put_summary(IHTMLTable3 *iface, BSTR v)
1839 HTMLTable *This = impl_from_IHTMLTable3(iface);
1840 nsAString str;
1841 nsresult nsres;
1843 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1845 nsAString_InitDepend(&str, v);
1847 nsres = nsIDOMHTMLTableElement_SetSummary(This->nstable, &str);
1849 nsAString_Finish(&str);
1850 if (NS_FAILED(nsres)) {
1851 ERR("Set summary(%s) failed: %08lx\n", debugstr_w(v), nsres);
1852 return E_FAIL;
1854 return S_OK;
1857 static HRESULT WINAPI HTMLTable3_get_summary(IHTMLTable3 *iface, BSTR * p)
1859 HTMLTable *This = impl_from_IHTMLTable3(iface);
1860 nsAString str;
1861 nsresult nsres;
1863 TRACE("(%p)->(%p)\n", This, p);
1865 nsAString_Init(&str, NULL);
1866 nsres = nsIDOMHTMLTableElement_GetSummary(This->nstable, &str);
1868 return return_nsstr(nsres, &str, p);
1871 static const IHTMLTable3Vtbl HTMLTable3Vtbl = {
1872 HTMLTable3_QueryInterface,
1873 HTMLTable3_AddRef,
1874 HTMLTable3_Release,
1875 HTMLTable3_GetTypeInfoCount,
1876 HTMLTable3_GetTypeInfo,
1877 HTMLTable3_GetIDsOfNames,
1878 HTMLTable3_Invoke,
1879 HTMLTable3_put_summary,
1880 HTMLTable3_get_summary
1883 static inline HTMLTable *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
1885 return CONTAINING_RECORD(iface, HTMLTable, element.node);
1888 static HRESULT HTMLTable_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1890 HTMLTable *This = impl_from_HTMLDOMNode(iface);
1892 *ppv = NULL;
1894 if(IsEqualGUID(&IID_IUnknown, riid)) {
1895 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1896 *ppv = &This->IHTMLTable_iface;
1897 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1898 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1899 *ppv = &This->IHTMLTable_iface;
1900 }else if(IsEqualGUID(&IID_IHTMLTable, riid)) {
1901 TRACE("(%p)->(IID_IHTMLTable %p)\n", This, ppv);
1902 *ppv = &This->IHTMLTable_iface;
1903 }else if(IsEqualGUID(&IID_IHTMLTable2, riid)) {
1904 TRACE("(%p)->(IID_IHTMLTable2 %p)\n", This, ppv);
1905 *ppv = &This->IHTMLTable2_iface;
1906 }else if(IsEqualGUID(&IID_IHTMLTable3, riid)) {
1907 TRACE("(%p)->(IID_IHTMLTable3 %p)\n", This, ppv);
1908 *ppv = &This->IHTMLTable3_iface;
1911 if(*ppv) {
1912 IUnknown_AddRef((IUnknown*)*ppv);
1913 return S_OK;
1916 return HTMLElement_QI(&This->element.node, riid, ppv);
1919 static void HTMLTable_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
1921 HTMLTable *This = impl_from_HTMLDOMNode(iface);
1923 if(This->nstable)
1924 note_cc_edge((nsISupports*)This->nstable, "This->nstable", cb);
1927 static void HTMLTable_unlink(HTMLDOMNode *iface)
1929 HTMLTable *This = impl_from_HTMLDOMNode(iface);
1930 unlink_ref(&This->nstable);
1933 static const cpc_entry_t HTMLTable_cpc[] = {
1934 {&DIID_HTMLTableEvents},
1935 HTMLELEMENT_CPC,
1936 {NULL}
1939 static const NodeImplVtbl HTMLTableImplVtbl = {
1940 .clsid = &CLSID_HTMLTable,
1941 .qi = HTMLTable_QI,
1942 .destructor = HTMLElement_destructor,
1943 .cpc_entries = HTMLTable_cpc,
1944 .clone = HTMLElement_clone,
1945 .handle_event = HTMLElement_handle_event,
1946 .get_attr_col = HTMLElement_get_attr_col,
1947 .traverse = HTMLTable_traverse,
1948 .unlink = HTMLTable_unlink
1951 static const tid_t HTMLTable_iface_tids[] = {
1952 HTMLELEMENT_TIDS,
1953 IHTMLTable_tid,
1954 IHTMLTable2_tid,
1955 IHTMLTable3_tid,
1959 static dispex_static_data_t HTMLTable_dispex = {
1960 "HTMLTableElement",
1961 &HTMLElement_event_target_vtbl.dispex_vtbl,
1962 DispHTMLTable_tid,
1963 HTMLTable_iface_tids,
1964 HTMLElement_init_dispex_info
1967 HRESULT HTMLTable_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
1969 HTMLTable *ret;
1970 nsresult nsres;
1972 ret = calloc(1, sizeof(HTMLTable));
1973 if(!ret)
1974 return E_OUTOFMEMORY;
1976 ret->element.node.vtbl = &HTMLTableImplVtbl;
1977 ret->IHTMLTable_iface.lpVtbl = &HTMLTableVtbl;
1978 ret->IHTMLTable2_iface.lpVtbl = &HTMLTable2Vtbl;
1979 ret->IHTMLTable3_iface.lpVtbl = &HTMLTable3Vtbl;
1981 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTable_dispex);
1983 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableElement, (void**)&ret->nstable);
1984 assert(nsres == NS_OK);
1986 *elem = &ret->element;
1987 return S_OK;