wined3d: Merge volumetexture_init() and texture_init().
[wine.git] / dlls / mshtml / htmltable.c
blob4ae1a4fea043ae2e8483f1dd958537ce050e5f60
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>
20 #include <assert.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
29 #include "wine/debug.h"
31 #include "mshtml_private.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)->(%d)\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: %08x\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: %08x\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)->(%d)\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: %08x\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: %08x\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: %08x\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: %08x\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: %08x\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 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
336 return E_NOTIMPL;
339 static HRESULT WINAPI HTMLTableCell_get_width(IHTMLTableCell *iface, VARIANT *p)
341 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
342 FIXME("(%p)->(%p)\n", This, p);
343 return E_NOTIMPL;
346 static HRESULT WINAPI HTMLTableCell_put_height(IHTMLTableCell *iface, VARIANT v)
348 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
349 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
350 return E_NOTIMPL;
353 static HRESULT WINAPI HTMLTableCell_get_height(IHTMLTableCell *iface, VARIANT *p)
355 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
356 FIXME("(%p)->(%p)\n", This, p);
357 return E_NOTIMPL;
360 static HRESULT WINAPI HTMLTableCell_get_cellIndex(IHTMLTableCell *iface, LONG *p)
362 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
363 nsresult nsres;
365 TRACE("(%p)->(%p)\n", This, p);
366 nsres = nsIDOMHTMLTableCellElement_GetCellIndex(This->nscell, p);
367 if (NS_FAILED(nsres)) {
368 ERR("Get CellIndex failed: %08x\n", nsres);
369 return E_FAIL;
372 return S_OK;
375 static const IHTMLTableCellVtbl HTMLTableCellVtbl = {
376 HTMLTableCell_QueryInterface,
377 HTMLTableCell_AddRef,
378 HTMLTableCell_Release,
379 HTMLTableCell_GetTypeInfoCount,
380 HTMLTableCell_GetTypeInfo,
381 HTMLTableCell_GetIDsOfNames,
382 HTMLTableCell_Invoke,
383 HTMLTableCell_put_rowSpan,
384 HTMLTableCell_get_rowSpan,
385 HTMLTableCell_put_colSpan,
386 HTMLTableCell_get_colSpan,
387 HTMLTableCell_put_align,
388 HTMLTableCell_get_align,
389 HTMLTableCell_put_vAlign,
390 HTMLTableCell_get_vAlign,
391 HTMLTableCell_put_bgColor,
392 HTMLTableCell_get_bgColor,
393 HTMLTableCell_put_noWrap,
394 HTMLTableCell_get_noWrap,
395 HTMLTableCell_put_background,
396 HTMLTableCell_get_background,
397 HTMLTableCell_put_borderColor,
398 HTMLTableCell_get_borderColor,
399 HTMLTableCell_put_borderColorLight,
400 HTMLTableCell_get_borderColorLight,
401 HTMLTableCell_put_borderColorDark,
402 HTMLTableCell_get_borderColorDark,
403 HTMLTableCell_put_width,
404 HTMLTableCell_get_width,
405 HTMLTableCell_put_height,
406 HTMLTableCell_get_height,
407 HTMLTableCell_get_cellIndex
410 static inline HTMLTableCell *HTMLTableCell_from_HTMLDOMNode(HTMLDOMNode *iface)
412 return CONTAINING_RECORD(iface, HTMLTableCell, element.node);
415 static HRESULT HTMLTableCell_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
417 HTMLTableCell *This = HTMLTableCell_from_HTMLDOMNode(iface);
419 if(IsEqualGUID(&IID_IUnknown, riid)) {
420 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
421 *ppv = &This->IHTMLTableCell_iface;
422 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
423 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
424 *ppv = &This->IHTMLTableCell_iface;
425 }else if(IsEqualGUID(&IID_IHTMLTableCell, riid)) {
426 TRACE("(%p)->(IID_IHTMLTableCell %p)\n", This, ppv);
427 *ppv = &This->IHTMLTableCell_iface;
428 }else {
429 return HTMLElement_QI(&This->element.node, riid, ppv);
432 IUnknown_AddRef((IUnknown*)*ppv);
433 return S_OK;
436 static void HTMLTableCell_destructor(HTMLDOMNode *iface)
438 HTMLTableCell *This = HTMLTableCell_from_HTMLDOMNode(iface);
440 HTMLElement_destructor(&This->element.node);
443 static void HTMLTableCell_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
445 HTMLTableCell *This = HTMLTableCell_from_HTMLDOMNode(iface);
447 if(This->nscell)
448 note_cc_edge((nsISupports*)This->nscell, "This->nstablecell", cb);
451 static void HTMLTableCell_unlink(HTMLDOMNode *iface)
453 HTMLTableCell *This = HTMLTableCell_from_HTMLDOMNode(iface);
455 if(This->nscell) {
456 nsIDOMHTMLTableCellElement *nscell = This->nscell;
458 This->nscell = NULL;
459 nsIDOMHTMLTableCellElement_Release(nscell);
463 static const NodeImplVtbl HTMLTableCellImplVtbl = {
464 &CLSID_HTMLTableCell,
465 HTMLTableCell_QI,
466 HTMLTableCell_destructor,
467 HTMLElement_cpc,
468 HTMLElement_clone,
469 HTMLElement_handle_event,
470 HTMLElement_get_attr_col,
471 NULL,
472 NULL,
473 NULL,
474 NULL,
475 NULL,
476 NULL,
477 NULL,
478 NULL,
479 HTMLTableCell_traverse,
480 HTMLTableCell_unlink
483 static const tid_t HTMLTableCell_iface_tids[] = {
484 HTMLELEMENT_TIDS,
485 IHTMLTableCell_tid,
489 static dispex_static_data_t HTMLTableCell_dispex = {
490 NULL,
491 DispHTMLTableCell_tid,
492 HTMLTableCell_iface_tids,
493 HTMLElement_init_dispex_info
496 HRESULT HTMLTableCell_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
498 HTMLTableCell *ret;
499 nsresult nsres;
501 ret = heap_alloc_zero(sizeof(*ret));
502 if(!ret)
503 return E_OUTOFMEMORY;
505 ret->IHTMLTableCell_iface.lpVtbl = &HTMLTableCellVtbl;
506 ret->element.node.vtbl = &HTMLTableCellImplVtbl;
508 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTableCell_dispex);
510 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableCellElement, (void**)&ret->nscell);
511 assert(nsres == NS_OK);
513 *elem = &ret->element;
514 return S_OK;
517 struct HTMLTableRow {
518 HTMLElement element;
520 IHTMLTableRow IHTMLTableRow_iface;
522 nsIDOMHTMLTableRowElement *nsrow;
525 static inline HTMLTableRow *impl_from_IHTMLTableRow(IHTMLTableRow *iface)
527 return CONTAINING_RECORD(iface, HTMLTableRow, IHTMLTableRow_iface);
530 static HRESULT WINAPI HTMLTableRow_QueryInterface(IHTMLTableRow *iface,
531 REFIID riid, void **ppv)
533 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
535 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
538 static ULONG WINAPI HTMLTableRow_AddRef(IHTMLTableRow *iface)
540 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
542 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
545 static ULONG WINAPI HTMLTableRow_Release(IHTMLTableRow *iface)
547 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
549 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
552 static HRESULT WINAPI HTMLTableRow_GetTypeInfoCount(IHTMLTableRow *iface, UINT *pctinfo)
554 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
555 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
558 static HRESULT WINAPI HTMLTableRow_GetTypeInfo(IHTMLTableRow *iface, UINT iTInfo,
559 LCID lcid, ITypeInfo **ppTInfo)
561 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
562 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
563 ppTInfo);
566 static HRESULT WINAPI HTMLTableRow_GetIDsOfNames(IHTMLTableRow *iface, REFIID riid,
567 LPOLESTR *rgszNames, UINT cNames,
568 LCID lcid, DISPID *rgDispId)
570 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
571 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
572 cNames, lcid, rgDispId);
575 static HRESULT WINAPI HTMLTableRow_Invoke(IHTMLTableRow *iface, DISPID dispIdMember,
576 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
577 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
579 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
580 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
581 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
584 static HRESULT WINAPI HTMLTableRow_put_align(IHTMLTableRow *iface, BSTR v)
586 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
587 nsAString val;
588 nsresult nsres;
590 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
592 nsAString_InitDepend(&val, v);
594 nsres = nsIDOMHTMLTableRowElement_SetAlign(This->nsrow, &val);
595 nsAString_Finish(&val);
596 if (NS_FAILED(nsres)){
597 ERR("Set Align(%s) failed!\n", debugstr_w(v));
598 return E_FAIL;
600 return S_OK;
603 static HRESULT WINAPI HTMLTableRow_get_align(IHTMLTableRow *iface, BSTR *p)
605 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
606 nsAString val;
607 nsresult nsres;
609 TRACE("(%p)->(%p)\n", This, p);
611 nsAString_Init(&val, NULL);
612 nsres = nsIDOMHTMLTableRowElement_GetAlign(This->nsrow, &val);
614 return return_nsstr(nsres, &val, p);
617 static HRESULT WINAPI HTMLTableRow_put_vAlign(IHTMLTableRow *iface, BSTR v)
619 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
620 nsAString val;
621 nsresult nsres;
623 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
625 nsAString_InitDepend(&val, v);
627 nsres = nsIDOMHTMLTableRowElement_SetVAlign(This->nsrow, &val);
628 nsAString_Finish(&val);
630 if (NS_FAILED(nsres)){
631 ERR("Set VAlign(%s) failed!\n", debugstr_w(v));
632 return E_FAIL;
635 return S_OK;
638 static HRESULT WINAPI HTMLTableRow_get_vAlign(IHTMLTableRow *iface, BSTR *p)
640 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
641 nsAString val;
642 nsresult nsres;
644 TRACE("(%p)->(%p)\n", This, p);
646 nsAString_Init(&val, NULL);
647 nsres = nsIDOMHTMLTableRowElement_GetVAlign(This->nsrow, &val);
649 return return_nsstr(nsres, &val, p);
652 static HRESULT WINAPI HTMLTableRow_put_bgColor(IHTMLTableRow *iface, VARIANT v)
654 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
655 nsAString val;
656 nsresult nsres;
658 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
660 if (!variant_to_nscolor(&v, &val))
661 return S_OK;
663 nsres = nsIDOMHTMLTableRowElement_SetBgColor(This->nsrow, &val);
664 nsAString_Finish(&val);
666 if (NS_FAILED(nsres)){
667 ERR("Set BgColor(%s) failed!\n", debugstr_variant(&v));
668 return E_FAIL;
671 return S_OK;
674 static HRESULT WINAPI HTMLTableRow_get_bgColor(IHTMLTableRow *iface, VARIANT *p)
676 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
677 nsAString strColor;
678 nsresult nsres;
679 HRESULT hres;
680 const PRUnichar *color;
682 TRACE("(%p)->(%p)\n", This, p);
684 nsAString_Init(&strColor, NULL);
685 nsres = nsIDOMHTMLTableRowElement_GetBgColor(This->nsrow, &strColor);
687 if(NS_SUCCEEDED(nsres)) {
688 nsAString_GetData(&strColor, &color);
689 V_VT(p) = VT_BSTR;
690 hres = nscolor_to_str(color, &V_BSTR(p));
691 }else {
692 ERR("SetBgColor failed: %08x\n", nsres);
693 hres = E_FAIL;
696 nsAString_Finish(&strColor);
697 return hres;
700 static HRESULT WINAPI HTMLTableRow_put_borderColor(IHTMLTableRow *iface, VARIANT v)
702 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
703 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
704 return E_NOTIMPL;
707 static HRESULT WINAPI HTMLTableRow_get_borderColor(IHTMLTableRow *iface, VARIANT *p)
709 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
710 FIXME("(%p)->(%p)\n", This, p);
711 return E_NOTIMPL;
714 static HRESULT WINAPI HTMLTableRow_put_borderColorLight(IHTMLTableRow *iface, VARIANT v)
716 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
717 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
718 return E_NOTIMPL;
721 static HRESULT WINAPI HTMLTableRow_get_borderColorLight(IHTMLTableRow *iface, VARIANT *p)
723 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
724 FIXME("(%p)->(%p)\n", This, p);
725 return E_NOTIMPL;
728 static HRESULT WINAPI HTMLTableRow_put_borderColorDark(IHTMLTableRow *iface, VARIANT v)
730 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
731 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
732 return E_NOTIMPL;
735 static HRESULT WINAPI HTMLTableRow_get_borderColorDark(IHTMLTableRow *iface, VARIANT *p)
737 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
738 FIXME("(%p)->(%p)\n", This, p);
739 return E_NOTIMPL;
742 static HRESULT WINAPI HTMLTableRow_get_rowIndex(IHTMLTableRow *iface, LONG *p)
744 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
745 nsresult nsres;
747 TRACE("(%p)->(%p)\n", This, p);
748 nsres = nsIDOMHTMLTableRowElement_GetRowIndex(This->nsrow, p);
749 if(NS_FAILED(nsres)) {
750 ERR("Get rowIndex failed: %08x\n", nsres);
751 return E_FAIL;
753 return S_OK;
756 static HRESULT WINAPI HTMLTableRow_get_sectionRowIndex(IHTMLTableRow *iface, LONG *p)
758 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
759 nsresult nsres;
761 TRACE("(%p)->(%p)\n", This, p);
762 nsres = nsIDOMHTMLTableRowElement_GetSectionRowIndex(This->nsrow, p);
763 if(NS_FAILED(nsres)) {
764 ERR("Get selectionRowIndex failed: %08x\n", nsres);
765 return E_FAIL;
767 return S_OK;
770 static HRESULT WINAPI HTMLTableRow_get_cells(IHTMLTableRow *iface, IHTMLElementCollection **p)
772 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
773 nsIDOMHTMLCollection *nscol;
774 nsresult nsres;
776 TRACE("(%p)->(%p)\n", This, p);
778 nsres = nsIDOMHTMLTableRowElement_GetCells(This->nsrow, &nscol);
779 if(NS_FAILED(nsres)) {
780 ERR("GetCells failed: %08x\n", nsres);
781 return E_FAIL;
784 *p = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->element.node.event_target.dispex));
786 nsIDOMHTMLCollection_Release(nscol);
787 return S_OK;
790 static HRESULT WINAPI HTMLTableRow_insertCell(IHTMLTableRow *iface, LONG index, IDispatch **row)
792 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
793 nsIDOMHTMLElement *nselem;
794 HTMLElement *elem;
795 nsresult nsres;
796 HRESULT hres;
798 TRACE("(%p)->(%d %p)\n", This, index, row);
799 nsres = nsIDOMHTMLTableRowElement_InsertCell(This->nsrow, index, &nselem);
800 if(NS_FAILED(nsres)) {
801 ERR("Insert Cell at %d failed: %08x\n", index, nsres);
802 return E_FAIL;
805 hres = HTMLTableCell_Create(This->element.node.doc, (nsIDOMElement*)nselem, &elem);
806 nsIDOMHTMLElement_Release(nselem);
807 if (FAILED(hres)) {
808 ERR("Create TableCell failed: %08x\n", hres);
809 return hres;
812 *row = (IDispatch *)&elem->IHTMLElement_iface;
813 return S_OK;
816 static HRESULT WINAPI HTMLTableRow_deleteCell(IHTMLTableRow *iface, LONG index)
818 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
819 nsresult nsres;
821 TRACE("(%p)->(%d)\n", This, index);
822 nsres = nsIDOMHTMLTableRowElement_DeleteCell(This->nsrow, index);
823 if(NS_FAILED(nsres)) {
824 ERR("Delete Cell failed: %08x\n", nsres);
825 return E_FAIL;
827 return S_OK;
830 static const IHTMLTableRowVtbl HTMLTableRowVtbl = {
831 HTMLTableRow_QueryInterface,
832 HTMLTableRow_AddRef,
833 HTMLTableRow_Release,
834 HTMLTableRow_GetTypeInfoCount,
835 HTMLTableRow_GetTypeInfo,
836 HTMLTableRow_GetIDsOfNames,
837 HTMLTableRow_Invoke,
838 HTMLTableRow_put_align,
839 HTMLTableRow_get_align,
840 HTMLTableRow_put_vAlign,
841 HTMLTableRow_get_vAlign,
842 HTMLTableRow_put_bgColor,
843 HTMLTableRow_get_bgColor,
844 HTMLTableRow_put_borderColor,
845 HTMLTableRow_get_borderColor,
846 HTMLTableRow_put_borderColorLight,
847 HTMLTableRow_get_borderColorLight,
848 HTMLTableRow_put_borderColorDark,
849 HTMLTableRow_get_borderColorDark,
850 HTMLTableRow_get_rowIndex,
851 HTMLTableRow_get_sectionRowIndex,
852 HTMLTableRow_get_cells,
853 HTMLTableRow_insertCell,
854 HTMLTableRow_deleteCell
857 static inline HTMLTableRow *HTMLTableRow_from_HTMLDOMNode(HTMLDOMNode *iface)
859 return CONTAINING_RECORD(iface, HTMLTableRow, element.node);
862 static HRESULT HTMLTableRow_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
864 HTMLTableRow *This = HTMLTableRow_from_HTMLDOMNode(iface);
866 *ppv = NULL;
868 if(IsEqualGUID(&IID_IUnknown, riid)) {
869 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
870 *ppv = &This->IHTMLTableRow_iface;
871 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
872 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
873 *ppv = &This->IHTMLTableRow_iface;
874 }else if(IsEqualGUID(&IID_IHTMLTableRow, riid)) {
875 TRACE("(%p)->(IID_IHTMLTableRow %p)\n", This, ppv);
876 *ppv = &This->IHTMLTableRow_iface;
879 if(*ppv) {
880 IUnknown_AddRef((IUnknown*)*ppv);
881 return S_OK;
884 return HTMLElement_QI(&This->element.node, riid, ppv);
887 static void HTMLTableRow_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
889 HTMLTableRow *This = HTMLTableRow_from_HTMLDOMNode(iface);
891 if(This->nsrow)
892 note_cc_edge((nsISupports*)This->nsrow, "This->nstablerow", cb);
895 static void HTMLTableRow_unlink(HTMLDOMNode *iface)
897 HTMLTableRow *This = HTMLTableRow_from_HTMLDOMNode(iface);
899 if(This->nsrow) {
900 nsIDOMHTMLTableRowElement *nsrow = This->nsrow;
902 This->nsrow = NULL;
903 nsIDOMHTMLTableRowElement_Release(nsrow);
907 static const NodeImplVtbl HTMLTableRowImplVtbl = {
908 &CLSID_HTMLTableRow,
909 HTMLTableRow_QI,
910 HTMLElement_destructor,
911 HTMLElement_cpc,
912 HTMLElement_clone,
913 HTMLElement_handle_event,
914 HTMLElement_get_attr_col,
915 NULL,
916 NULL,
917 NULL,
918 NULL,
919 NULL,
920 NULL,
921 NULL,
922 NULL,
923 HTMLTableRow_traverse,
924 HTMLTableRow_unlink
927 static const tid_t HTMLTableRow_iface_tids[] = {
928 HTMLELEMENT_TIDS,
929 IHTMLTableRow_tid,
933 static dispex_static_data_t HTMLTableRow_dispex = {
934 NULL,
935 DispHTMLTableRow_tid,
936 HTMLTableRow_iface_tids,
937 HTMLElement_init_dispex_info
940 HRESULT HTMLTableRow_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
942 HTMLTableRow *ret;
943 nsresult nsres;
945 ret = heap_alloc_zero(sizeof(HTMLTableRow));
946 if(!ret)
947 return E_OUTOFMEMORY;
949 ret->IHTMLTableRow_iface.lpVtbl = &HTMLTableRowVtbl;
950 ret->element.node.vtbl = &HTMLTableRowImplVtbl;
952 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTableRow_dispex);
954 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableRowElement, (void**)&ret->nsrow);
955 assert(nsres == NS_OK);
957 *elem = &ret->element;
958 return S_OK;
961 struct HTMLTable {
962 HTMLElement element;
964 IHTMLTable IHTMLTable_iface;
965 IHTMLTable2 IHTMLTable2_iface;
966 IHTMLTable3 IHTMLTable3_iface;
968 nsIDOMHTMLTableElement *nstable;
971 static inline HTMLTable *impl_from_IHTMLTable(IHTMLTable *iface)
973 return CONTAINING_RECORD(iface, HTMLTable, IHTMLTable_iface);
976 static inline HTMLTable *impl_from_IHTMLTable2(IHTMLTable2 *iface)
978 return CONTAINING_RECORD(iface, HTMLTable, IHTMLTable2_iface);
981 static inline HTMLTable *impl_from_IHTMLTable3(IHTMLTable3 *iface)
983 return CONTAINING_RECORD(iface, HTMLTable, IHTMLTable3_iface);
986 static HRESULT var2str(const VARIANT *p, nsAString *nsstr)
988 BSTR str;
989 BOOL ret;
990 HRESULT hres;
992 switch(V_VT(p)) {
993 case VT_BSTR:
994 return nsAString_Init(nsstr, V_BSTR(p))?
995 S_OK : E_OUTOFMEMORY;
996 case VT_R8:
997 hres = VarBstrFromR8(V_R8(p), MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), 0, &str);
998 break;
999 case VT_R4:
1000 hres = VarBstrFromR4(V_R4(p), MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), 0, &str);
1001 break;
1002 case VT_I4:
1003 hres = VarBstrFromI4(V_I4(p), MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), 0, &str);
1004 break;
1005 default:
1006 FIXME("unsupported arg %s\n", debugstr_variant(p));
1007 return E_NOTIMPL;
1009 if (FAILED(hres))
1010 return hres;
1012 ret = nsAString_Init(nsstr, str);
1013 SysFreeString(str);
1014 return ret ? S_OK : E_OUTOFMEMORY;
1017 static HRESULT nsstr_to_truncated_bstr(const nsAString *nsstr, BSTR *ret_ptr)
1019 const PRUnichar *str, *ptr, *end = NULL;
1020 BSTR ret;
1022 nsAString_GetData(nsstr, &str);
1024 for(ptr = str; isdigitW(*ptr); ptr++);
1025 if(*ptr == '.') {
1026 for(end = ptr++; isdigitW(*ptr); ptr++);
1027 if(*ptr)
1028 end = NULL;
1031 ret = end ? SysAllocStringLen(str, end-str) : SysAllocString(str);
1033 *ret_ptr = ret;
1034 return ret ? S_OK : E_OUTOFMEMORY;
1037 static HRESULT WINAPI HTMLTable_QueryInterface(IHTMLTable *iface,
1038 REFIID riid, void **ppv)
1040 HTMLTable *This = impl_from_IHTMLTable(iface);
1042 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1045 static ULONG WINAPI HTMLTable_AddRef(IHTMLTable *iface)
1047 HTMLTable *This = impl_from_IHTMLTable(iface);
1049 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1052 static ULONG WINAPI HTMLTable_Release(IHTMLTable *iface)
1054 HTMLTable *This = impl_from_IHTMLTable(iface);
1056 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1059 static HRESULT WINAPI HTMLTable_GetTypeInfoCount(IHTMLTable *iface, UINT *pctinfo)
1061 HTMLTable *This = impl_from_IHTMLTable(iface);
1062 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1065 static HRESULT WINAPI HTMLTable_GetTypeInfo(IHTMLTable *iface, UINT iTInfo,
1066 LCID lcid, ITypeInfo **ppTInfo)
1068 HTMLTable *This = impl_from_IHTMLTable(iface);
1069 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
1070 ppTInfo);
1073 static HRESULT WINAPI HTMLTable_GetIDsOfNames(IHTMLTable *iface, REFIID riid,
1074 LPOLESTR *rgszNames, UINT cNames,
1075 LCID lcid, DISPID *rgDispId)
1077 HTMLTable *This = impl_from_IHTMLTable(iface);
1078 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1079 cNames, lcid, rgDispId);
1082 static HRESULT WINAPI HTMLTable_Invoke(IHTMLTable *iface, DISPID dispIdMember,
1083 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1084 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1086 HTMLTable *This = impl_from_IHTMLTable(iface);
1087 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1088 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1091 static HRESULT WINAPI HTMLTable_put_cols(IHTMLTable *iface, LONG v)
1093 HTMLTable *This = impl_from_IHTMLTable(iface);
1094 FIXME("(%p)->(%d)\n", This, v);
1095 return E_NOTIMPL;
1098 static HRESULT WINAPI HTMLTable_get_cols(IHTMLTable *iface, LONG *p)
1100 HTMLTable *This = impl_from_IHTMLTable(iface);
1101 FIXME("(%p)->(%p)\n", This, p);
1102 return E_NOTIMPL;
1105 static HRESULT WINAPI HTMLTable_put_border(IHTMLTable *iface, VARIANT v)
1107 HTMLTable *This = impl_from_IHTMLTable(iface);
1108 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1109 return E_NOTIMPL;
1112 static HRESULT WINAPI HTMLTable_get_border(IHTMLTable *iface, VARIANT *p)
1114 HTMLTable *This = impl_from_IHTMLTable(iface);
1115 FIXME("(%p)->(%p)\n", This, p);
1116 return E_NOTIMPL;
1119 static HRESULT WINAPI HTMLTable_put_frame(IHTMLTable *iface, BSTR v)
1121 HTMLTable *This = impl_from_IHTMLTable(iface);
1122 nsAString str;
1123 nsresult nsres;
1125 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1127 nsAString_InitDepend(&str, v);
1128 nsres = nsIDOMHTMLTableElement_SetFrame(This->nstable, &str);
1129 nsAString_Finish(&str);
1131 if (NS_FAILED(nsres)) {
1132 ERR("SetFrame(%s) failed: %08x\n", debugstr_w(v), nsres);
1133 return E_FAIL;
1135 return S_OK;
1138 static HRESULT WINAPI HTMLTable_get_frame(IHTMLTable *iface, BSTR *p)
1140 HTMLTable *This = impl_from_IHTMLTable(iface);
1141 nsAString str;
1142 nsresult nsres;
1144 TRACE("(%p)->(%p)\n", This, p);
1146 nsAString_Init(&str, NULL);
1147 nsres = nsIDOMHTMLTableElement_GetFrame(This->nstable, &str);
1149 return return_nsstr(nsres, &str, p);
1152 static HRESULT WINAPI HTMLTable_put_rules(IHTMLTable *iface, BSTR v)
1154 HTMLTable *This = impl_from_IHTMLTable(iface);
1155 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1156 return E_NOTIMPL;
1159 static HRESULT WINAPI HTMLTable_get_rules(IHTMLTable *iface, BSTR *p)
1161 HTMLTable *This = impl_from_IHTMLTable(iface);
1162 FIXME("(%p)->(%p)\n", This, p);
1163 return E_NOTIMPL;
1166 static HRESULT WINAPI HTMLTable_put_cellSpacing(IHTMLTable *iface, VARIANT v)
1168 HTMLTable *This = impl_from_IHTMLTable(iface);
1169 nsAString nsstr;
1170 WCHAR buf[64];
1171 nsresult nsres;
1173 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1175 switch(V_VT(&v)) {
1176 case VT_BSTR:
1177 nsAString_InitDepend(&nsstr, V_BSTR(&v));
1178 break;
1179 case VT_I4: {
1180 static const WCHAR formatW[] = {'%','d',0};
1181 sprintfW(buf, formatW, V_I4(&v));
1182 nsAString_InitDepend(&nsstr, buf);
1183 break;
1185 default:
1186 FIXME("unsupported arg %s\n", debugstr_variant(&v));
1187 return E_NOTIMPL;
1190 nsres = nsIDOMHTMLTableElement_SetCellSpacing(This->nstable, &nsstr);
1191 nsAString_Finish(&nsstr);
1192 if(NS_FAILED(nsres)) {
1193 ERR("SetCellSpacing failed: %08x\n", nsres);
1194 return E_FAIL;
1197 return S_OK;
1200 static HRESULT WINAPI HTMLTable_get_cellSpacing(IHTMLTable *iface, VARIANT *p)
1202 HTMLTable *This = impl_from_IHTMLTable(iface);
1203 nsAString nsstr;
1204 nsresult nsres;
1206 TRACE("(%p)->(%p)\n", This, p);
1208 nsAString_Init(&nsstr, NULL);
1209 nsres = nsIDOMHTMLTableElement_GetCellSpacing(This->nstable, &nsstr);
1210 V_VT(p) = VT_BSTR;
1211 return return_nsstr(nsres, &nsstr, &V_BSTR(p));
1214 static HRESULT WINAPI HTMLTable_put_cellPadding(IHTMLTable *iface, VARIANT v)
1216 HTMLTable *This = impl_from_IHTMLTable(iface);
1217 nsAString val;
1218 HRESULT hres;
1219 nsresult nsres;
1221 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1223 hres = var2str(&v, &val);
1224 if(FAILED(hres))
1225 return hres;
1227 nsres = nsIDOMHTMLTableElement_SetCellPadding(This->nstable, &val);
1228 nsAString_Finish(&val);
1229 if(NS_FAILED(nsres)) {
1230 ERR("Set Width(%s) failed, err = %08x\n", debugstr_variant(&v), nsres);
1231 return E_FAIL;
1234 return S_OK;
1237 static HRESULT WINAPI HTMLTable_get_cellPadding(IHTMLTable *iface, VARIANT *p)
1239 HTMLTable *This = impl_from_IHTMLTable(iface);
1240 nsAString val;
1241 nsresult nsres;
1243 TRACE("(%p)->(%p)\n", This, p);
1245 nsAString_Init(&val, NULL);
1246 nsres = nsIDOMHTMLTableElement_GetCellPadding(This->nstable, &val);
1247 return return_nsstr_variant(nsres, &val, p);
1250 static HRESULT WINAPI HTMLTable_put_background(IHTMLTable *iface, BSTR v)
1252 HTMLTable *This = impl_from_IHTMLTable(iface);
1253 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1254 return E_NOTIMPL;
1257 static HRESULT WINAPI HTMLTable_get_background(IHTMLTable *iface, BSTR *p)
1259 HTMLTable *This = impl_from_IHTMLTable(iface);
1260 FIXME("(%p)->(%p)\n", This, p);
1261 return E_NOTIMPL;
1264 static HRESULT WINAPI HTMLTable_put_bgColor(IHTMLTable *iface, VARIANT v)
1266 HTMLTable *This = impl_from_IHTMLTable(iface);
1267 nsAString val;
1268 nsresult nsres;
1270 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1272 if(!variant_to_nscolor(&v, &val))
1273 return S_OK;
1275 nsres = nsIDOMHTMLTableElement_SetBgColor(This->nstable, &val);
1276 nsAString_Finish(&val);
1277 if (NS_FAILED(nsres)){
1278 ERR("Set BgColor(%s) failed!\n", debugstr_variant(&v));
1279 return E_FAIL;
1282 return S_OK;
1285 static HRESULT WINAPI HTMLTable_get_bgColor(IHTMLTable *iface, VARIANT *p)
1287 HTMLTable *This = impl_from_IHTMLTable(iface);
1288 nsAString strColor;
1289 nsresult nsres;
1290 HRESULT hres;
1291 const PRUnichar *color;
1293 TRACE("(%p)->(%p)\n", This, p);
1295 nsAString_Init(&strColor, NULL);
1296 nsres = nsIDOMHTMLTableElement_GetBgColor(This->nstable, &strColor);
1298 if(NS_SUCCEEDED(nsres)) {
1299 nsAString_GetData(&strColor, &color);
1300 V_VT(p) = VT_BSTR;
1301 hres = nscolor_to_str(color, &V_BSTR(p));
1302 }else {
1303 ERR("SetBgColor failed: %08x\n", nsres);
1304 hres = E_FAIL;
1307 nsAString_Finish(&strColor);
1308 return hres;
1311 static HRESULT WINAPI HTMLTable_put_borderColor(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_borderColor(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_borderColorLight(IHTMLTable *iface, VARIANT v)
1327 HTMLTable *This = impl_from_IHTMLTable(iface);
1328 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1329 return E_NOTIMPL;
1332 static HRESULT WINAPI HTMLTable_get_borderColorLight(IHTMLTable *iface, VARIANT *p)
1334 HTMLTable *This = impl_from_IHTMLTable(iface);
1335 FIXME("(%p)->(%p)\n", This, p);
1336 return E_NOTIMPL;
1339 static HRESULT WINAPI HTMLTable_put_borderColorDark(IHTMLTable *iface, VARIANT v)
1341 HTMLTable *This = impl_from_IHTMLTable(iface);
1342 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1343 return E_NOTIMPL;
1346 static HRESULT WINAPI HTMLTable_get_borderColorDark(IHTMLTable *iface, VARIANT *p)
1348 HTMLTable *This = impl_from_IHTMLTable(iface);
1349 FIXME("(%p)->(%p)\n", This, p);
1350 return E_NOTIMPL;
1353 static HRESULT WINAPI HTMLTable_put_align(IHTMLTable *iface, BSTR v)
1355 HTMLTable *This = impl_from_IHTMLTable(iface);
1356 nsAString val;
1357 nsresult nsres;
1359 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1361 nsAString_InitDepend(&val, v);
1363 nsres = nsIDOMHTMLTableElement_SetAlign(This->nstable, &val);
1364 nsAString_Finish(&val);
1365 if (NS_FAILED(nsres)){
1366 ERR("Set Align(%s) failed!\n", debugstr_w(v));
1367 return E_FAIL;
1369 return S_OK;
1372 static HRESULT WINAPI HTMLTable_get_align(IHTMLTable *iface, BSTR *p)
1374 HTMLTable *This = impl_from_IHTMLTable(iface);
1375 nsAString val;
1376 nsresult nsres;
1378 TRACE("(%p)->(%p)\n", This, p);
1380 nsAString_Init(&val, NULL);
1381 nsres = nsIDOMHTMLTableElement_GetAlign(This->nstable, &val);
1383 return return_nsstr(nsres, &val, p);
1386 static HRESULT WINAPI HTMLTable_refresh(IHTMLTable *iface)
1388 HTMLTable *This = impl_from_IHTMLTable(iface);
1389 FIXME("(%p)\n", This);
1390 return E_NOTIMPL;
1393 static HRESULT WINAPI HTMLTable_get_rows(IHTMLTable *iface, IHTMLElementCollection **p)
1395 HTMLTable *This = impl_from_IHTMLTable(iface);
1396 nsIDOMHTMLCollection *nscol;
1397 nsresult nsres;
1399 TRACE("(%p)->(%p)\n", This, p);
1401 nsres = nsIDOMHTMLTableElement_GetRows(This->nstable, &nscol);
1402 if(NS_FAILED(nsres)) {
1403 ERR("GetRows failed: %08x\n", nsres);
1404 return E_FAIL;
1407 *p = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->element.node.event_target.dispex));
1409 nsIDOMHTMLCollection_Release(nscol);
1410 return S_OK;
1413 static HRESULT WINAPI HTMLTable_put_width(IHTMLTable *iface, VARIANT v)
1415 HTMLTable *This = impl_from_IHTMLTable(iface);
1416 nsAString val;
1417 HRESULT hres;
1418 nsresult nsres;
1420 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1421 hres = var2str(&v, &val);
1423 if (FAILED(hres)){
1424 ERR("Set Width(%s) failed when initializing a nsAString, err = %08x\n",
1425 debugstr_variant(&v), hres);
1426 return hres;
1429 nsres = nsIDOMHTMLTableElement_SetWidth(This->nstable, &val);
1430 nsAString_Finish(&val);
1432 if (NS_FAILED(nsres)){
1433 ERR("Set Width(%s) failed, err = %08x\n", debugstr_variant(&v), nsres);
1434 return E_FAIL;
1436 return S_OK;
1439 static HRESULT WINAPI HTMLTable_get_width(IHTMLTable *iface, VARIANT *p)
1441 HTMLTable *This = impl_from_IHTMLTable(iface);
1442 nsAString val;
1443 BSTR bstr;
1444 nsresult nsres;
1445 HRESULT hres;
1447 TRACE("(%p)->(%p)\n", This, p);
1448 nsAString_Init(&val, NULL);
1449 nsres = nsIDOMHTMLTableElement_GetWidth(This->nstable, &val);
1450 if (NS_FAILED(nsres)){
1451 ERR("Get Width failed!\n");
1452 nsAString_Finish(&val);
1453 return E_FAIL;
1456 hres = nsstr_to_truncated_bstr(&val, &bstr);
1457 nsAString_Finish(&val);
1459 V_VT(p) = VT_BSTR;
1460 V_BSTR(p) = bstr;
1461 return hres;
1464 static HRESULT WINAPI HTMLTable_put_height(IHTMLTable *iface, VARIANT v)
1466 HTMLTable *This = impl_from_IHTMLTable(iface);
1467 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1468 return E_NOTIMPL;
1471 static HRESULT WINAPI HTMLTable_get_height(IHTMLTable *iface, VARIANT *p)
1473 HTMLTable *This = impl_from_IHTMLTable(iface);
1474 FIXME("(%p)->(%p)\n", This, p);
1475 return E_NOTIMPL;
1478 static HRESULT WINAPI HTMLTable_put_dataPageSize(IHTMLTable *iface, LONG v)
1480 HTMLTable *This = impl_from_IHTMLTable(iface);
1481 FIXME("(%p)->(%d)\n", This, v);
1482 return E_NOTIMPL;
1485 static HRESULT WINAPI HTMLTable_get_dataPageSize(IHTMLTable *iface, LONG *p)
1487 HTMLTable *This = impl_from_IHTMLTable(iface);
1488 FIXME("(%p)->(%p)\n", This, p);
1489 return E_NOTIMPL;
1492 static HRESULT WINAPI HTMLTable_nextPage(IHTMLTable *iface)
1494 HTMLTable *This = impl_from_IHTMLTable(iface);
1495 FIXME("(%p)\n", This);
1496 return E_NOTIMPL;
1499 static HRESULT WINAPI HTMLTable_previousPage(IHTMLTable *iface)
1501 HTMLTable *This = impl_from_IHTMLTable(iface);
1502 FIXME("(%p)\n", This);
1503 return E_NOTIMPL;
1506 static HRESULT WINAPI HTMLTable_get_tHead(IHTMLTable *iface, IHTMLTableSection **p)
1508 HTMLTable *This = impl_from_IHTMLTable(iface);
1509 FIXME("(%p)->(%p)\n", This, p);
1510 return E_NOTIMPL;
1513 static HRESULT WINAPI HTMLTable_get_tFoot(IHTMLTable *iface, IHTMLTableSection **p)
1515 HTMLTable *This = impl_from_IHTMLTable(iface);
1516 FIXME("(%p)->(%p)\n", This, p);
1517 return E_NOTIMPL;
1520 static HRESULT WINAPI HTMLTable_get_tBodies(IHTMLTable *iface, IHTMLElementCollection **p)
1522 HTMLTable *This = impl_from_IHTMLTable(iface);
1523 nsIDOMHTMLCollection *nscol = NULL;
1524 nsresult nsres;
1526 TRACE("(%p)->(%p)\n", This, p);
1528 nsres = nsIDOMHTMLTableElement_GetTBodies(This->nstable, &nscol);
1529 if(NS_FAILED(nsres)) {
1530 ERR("GetTBodies failed: %08x\n", nsres);
1531 return E_FAIL;
1534 *p = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->element.node.event_target.dispex));
1536 nsIDOMHTMLCollection_Release(nscol);
1537 return S_OK;
1540 static HRESULT WINAPI HTMLTable_get_caption(IHTMLTable *iface, IHTMLTableCaption **p)
1542 HTMLTable *This = impl_from_IHTMLTable(iface);
1543 FIXME("(%p)->(%p)\n", This, p);
1544 return E_NOTIMPL;
1547 static HRESULT WINAPI HTMLTable_createTHead(IHTMLTable *iface, IDispatch **head)
1549 HTMLTable *This = impl_from_IHTMLTable(iface);
1550 FIXME("(%p)->(%p)\n", This, head);
1551 return E_NOTIMPL;
1554 static HRESULT WINAPI HTMLTable_deleteTHead(IHTMLTable *iface)
1556 HTMLTable *This = impl_from_IHTMLTable(iface);
1557 FIXME("(%p)\n", This);
1558 return E_NOTIMPL;
1561 static HRESULT WINAPI HTMLTable_createTFoot(IHTMLTable *iface, IDispatch **foot)
1563 HTMLTable *This = impl_from_IHTMLTable(iface);
1564 FIXME("(%p)->(%p)\n", This, foot);
1565 return E_NOTIMPL;
1568 static HRESULT WINAPI HTMLTable_deleteTFoot(IHTMLTable *iface)
1570 HTMLTable *This = impl_from_IHTMLTable(iface);
1571 FIXME("(%p)\n", This);
1572 return E_NOTIMPL;
1575 static HRESULT WINAPI HTMLTable_createCaption(IHTMLTable *iface, IHTMLTableCaption **caption)
1577 HTMLTable *This = impl_from_IHTMLTable(iface);
1578 FIXME("(%p)->(%p)\n", This, caption);
1579 return E_NOTIMPL;
1582 static HRESULT WINAPI HTMLTable_deleteCaption(IHTMLTable *iface)
1584 HTMLTable *This = impl_from_IHTMLTable(iface);
1585 FIXME("(%p)\n", This);
1586 return E_NOTIMPL;
1589 static HRESULT WINAPI HTMLTable_insertRow(IHTMLTable *iface, LONG index, IDispatch **row)
1591 HTMLTable *This = impl_from_IHTMLTable(iface);
1592 nsIDOMHTMLElement *nselem;
1593 HTMLElement *elem;
1594 nsresult nsres;
1595 HRESULT hres;
1597 TRACE("(%p)->(%d %p)\n", This, index, row);
1598 nsres = nsIDOMHTMLTableElement_InsertRow(This->nstable, index, &nselem);
1599 if(NS_FAILED(nsres)) {
1600 ERR("Insert Row at %d failed: %08x\n", index, nsres);
1601 return E_FAIL;
1604 hres = HTMLTableRow_Create(This->element.node.doc, (nsIDOMElement*)nselem, &elem);
1605 nsIDOMHTMLElement_Release(nselem);
1606 if (FAILED(hres)) {
1607 ERR("Create TableRow failed: %08x\n", hres);
1608 return hres;
1611 *row = (IDispatch *)&elem->IHTMLElement_iface;
1612 return S_OK;
1615 static HRESULT WINAPI HTMLTable_deleteRow(IHTMLTable *iface, LONG index)
1617 HTMLTable *This = impl_from_IHTMLTable(iface);
1618 nsresult nsres;
1620 TRACE("(%p)->(%d)\n", This, index);
1621 nsres = nsIDOMHTMLTableElement_DeleteRow(This->nstable, index);
1622 if(NS_FAILED(nsres)) {
1623 ERR("Delete Row failed: %08x\n", nsres);
1624 return E_FAIL;
1626 return S_OK;
1629 static HRESULT WINAPI HTMLTable_get_readyState(IHTMLTable *iface, BSTR *p)
1631 HTMLTable *This = impl_from_IHTMLTable(iface);
1632 FIXME("(%p)->(%p)\n", This, p);
1633 return E_NOTIMPL;
1636 static HRESULT WINAPI HTMLTable_put_onreadystatechange(IHTMLTable *iface, VARIANT v)
1638 HTMLTable *This = impl_from_IHTMLTable(iface);
1639 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1640 return E_NOTIMPL;
1643 static HRESULT WINAPI HTMLTable_get_onreadystatechange(IHTMLTable *iface, VARIANT *p)
1645 HTMLTable *This = impl_from_IHTMLTable(iface);
1646 FIXME("(%p)->(%p)\n", This, p);
1647 return E_NOTIMPL;
1650 static const IHTMLTableVtbl HTMLTableVtbl = {
1651 HTMLTable_QueryInterface,
1652 HTMLTable_AddRef,
1653 HTMLTable_Release,
1654 HTMLTable_GetTypeInfoCount,
1655 HTMLTable_GetTypeInfo,
1656 HTMLTable_GetIDsOfNames,
1657 HTMLTable_Invoke,
1658 HTMLTable_put_cols,
1659 HTMLTable_get_cols,
1660 HTMLTable_put_border,
1661 HTMLTable_get_border,
1662 HTMLTable_put_frame,
1663 HTMLTable_get_frame,
1664 HTMLTable_put_rules,
1665 HTMLTable_get_rules,
1666 HTMLTable_put_cellSpacing,
1667 HTMLTable_get_cellSpacing,
1668 HTMLTable_put_cellPadding,
1669 HTMLTable_get_cellPadding,
1670 HTMLTable_put_background,
1671 HTMLTable_get_background,
1672 HTMLTable_put_bgColor,
1673 HTMLTable_get_bgColor,
1674 HTMLTable_put_borderColor,
1675 HTMLTable_get_borderColor,
1676 HTMLTable_put_borderColorLight,
1677 HTMLTable_get_borderColorLight,
1678 HTMLTable_put_borderColorDark,
1679 HTMLTable_get_borderColorDark,
1680 HTMLTable_put_align,
1681 HTMLTable_get_align,
1682 HTMLTable_refresh,
1683 HTMLTable_get_rows,
1684 HTMLTable_put_width,
1685 HTMLTable_get_width,
1686 HTMLTable_put_height,
1687 HTMLTable_get_height,
1688 HTMLTable_put_dataPageSize,
1689 HTMLTable_get_dataPageSize,
1690 HTMLTable_nextPage,
1691 HTMLTable_previousPage,
1692 HTMLTable_get_tHead,
1693 HTMLTable_get_tFoot,
1694 HTMLTable_get_tBodies,
1695 HTMLTable_get_caption,
1696 HTMLTable_createTHead,
1697 HTMLTable_deleteTHead,
1698 HTMLTable_createTFoot,
1699 HTMLTable_deleteTFoot,
1700 HTMLTable_createCaption,
1701 HTMLTable_deleteCaption,
1702 HTMLTable_insertRow,
1703 HTMLTable_deleteRow,
1704 HTMLTable_get_readyState,
1705 HTMLTable_put_onreadystatechange,
1706 HTMLTable_get_onreadystatechange
1709 /* IHTMLTable2 */
1710 static HRESULT WINAPI HTMLTable2_QueryInterface(IHTMLTable2 *iface,
1711 REFIID riid, void **ppv)
1713 HTMLTable *This = impl_from_IHTMLTable2(iface);
1715 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1718 static ULONG WINAPI HTMLTable2_AddRef(IHTMLTable2 *iface)
1720 HTMLTable *This = impl_from_IHTMLTable2(iface);
1722 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1725 static ULONG WINAPI HTMLTable2_Release(IHTMLTable2 *iface)
1727 HTMLTable *This = impl_from_IHTMLTable2(iface);
1729 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1732 static HRESULT WINAPI HTMLTable2_GetTypeInfoCount(IHTMLTable2 *iface, UINT *pctinfo)
1734 HTMLTable *This = impl_from_IHTMLTable2(iface);
1735 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1738 static HRESULT WINAPI HTMLTable2_GetTypeInfo(IHTMLTable2 *iface, UINT iTInfo,
1739 LCID lcid, ITypeInfo **ppTInfo)
1741 HTMLTable *This = impl_from_IHTMLTable2(iface);
1742 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
1743 ppTInfo);
1746 static HRESULT WINAPI HTMLTable2_GetIDsOfNames(IHTMLTable2 *iface, REFIID riid,
1747 LPOLESTR *rgszNames, UINT cNames,
1748 LCID lcid, DISPID *rgDispId)
1750 HTMLTable *This = impl_from_IHTMLTable2(iface);
1751 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1752 cNames, lcid, rgDispId);
1755 static HRESULT WINAPI HTMLTable2_Invoke(IHTMLTable2 *iface, DISPID dispIdMember,
1756 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1757 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1759 HTMLTable *This = impl_from_IHTMLTable2(iface);
1760 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1761 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1764 static HRESULT WINAPI HTMLTable2_firstPage(IHTMLTable2 *iface)
1766 HTMLTable *This = impl_from_IHTMLTable2(iface);
1767 FIXME("(%p)->()\n", This);
1768 return E_NOTIMPL;
1771 static HRESULT WINAPI HTMLTable2_lastPage(IHTMLTable2 *iface)
1773 HTMLTable *This = impl_from_IHTMLTable2(iface);
1774 FIXME("(%p)->()\n", This);
1775 return E_NOTIMPL;
1778 static HRESULT WINAPI HTMLTable2_cells(IHTMLTable2 *iface, IHTMLElementCollection **p)
1780 HTMLTable *This = impl_from_IHTMLTable2(iface);
1781 FIXME("(%p)->(%p)\n", This, p);
1782 return E_NOTIMPL;
1785 static HRESULT WINAPI HTMLTable2_moveRow(IHTMLTable2 *iface, LONG indexFrom, LONG indexTo, IDispatch **row)
1787 HTMLTable *This = impl_from_IHTMLTable2(iface);
1788 FIXME("(%p)->(%d %d %p)\n", This, indexFrom, indexTo, row);
1789 return E_NOTIMPL;
1793 static const IHTMLTable2Vtbl HTMLTable2Vtbl = {
1794 HTMLTable2_QueryInterface,
1795 HTMLTable2_AddRef,
1796 HTMLTable2_Release,
1797 HTMLTable2_GetTypeInfoCount,
1798 HTMLTable2_GetTypeInfo,
1799 HTMLTable2_GetIDsOfNames,
1800 HTMLTable2_Invoke,
1801 HTMLTable2_firstPage,
1802 HTMLTable2_lastPage,
1803 HTMLTable2_cells,
1804 HTMLTable2_moveRow
1807 /* IHTMLTable3 */
1808 static HRESULT WINAPI HTMLTable3_QueryInterface(IHTMLTable3 *iface,
1809 REFIID riid, void **ppv)
1811 HTMLTable *This = impl_from_IHTMLTable3(iface);
1813 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1816 static ULONG WINAPI HTMLTable3_AddRef(IHTMLTable3 *iface)
1818 HTMLTable *This = impl_from_IHTMLTable3(iface);
1820 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1823 static ULONG WINAPI HTMLTable3_Release(IHTMLTable3 *iface)
1825 HTMLTable *This = impl_from_IHTMLTable3(iface);
1827 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1830 static HRESULT WINAPI HTMLTable3_GetTypeInfoCount(IHTMLTable3 *iface, UINT *pctinfo)
1832 HTMLTable *This = impl_from_IHTMLTable3(iface);
1833 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1836 static HRESULT WINAPI HTMLTable3_GetTypeInfo(IHTMLTable3 *iface, UINT iTInfo,
1837 LCID lcid, ITypeInfo **ppTInfo)
1839 HTMLTable *This = impl_from_IHTMLTable3(iface);
1840 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
1841 ppTInfo);
1844 static HRESULT WINAPI HTMLTable3_GetIDsOfNames(IHTMLTable3 *iface, REFIID riid,
1845 LPOLESTR *rgszNames, UINT cNames,
1846 LCID lcid, DISPID *rgDispId)
1848 HTMLTable *This = impl_from_IHTMLTable3(iface);
1849 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1850 cNames, lcid, rgDispId);
1853 static HRESULT WINAPI HTMLTable3_Invoke(IHTMLTable3 *iface, DISPID dispIdMember,
1854 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1855 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1857 HTMLTable *This = impl_from_IHTMLTable3(iface);
1858 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1859 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1862 static HRESULT WINAPI HTMLTable3_put_summary(IHTMLTable3 *iface, BSTR v)
1864 HTMLTable *This = impl_from_IHTMLTable3(iface);
1865 nsAString str;
1866 nsresult nsres;
1868 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1870 nsAString_InitDepend(&str, v);
1872 nsres = nsIDOMHTMLTableElement_SetSummary(This->nstable, &str);
1874 nsAString_Finish(&str);
1875 if (NS_FAILED(nsres)) {
1876 ERR("Set summary(%s) failed: %08x\n", debugstr_w(v), nsres);
1877 return E_FAIL;
1879 return S_OK;
1882 static HRESULT WINAPI HTMLTable3_get_summary(IHTMLTable3 *iface, BSTR * p)
1884 HTMLTable *This = impl_from_IHTMLTable3(iface);
1885 nsAString str;
1886 nsresult nsres;
1888 TRACE("(%p)->(%p)\n", This, p);
1890 nsAString_Init(&str, NULL);
1891 nsres = nsIDOMHTMLTableElement_GetSummary(This->nstable, &str);
1893 return return_nsstr(nsres, &str, p);
1896 static const IHTMLTable3Vtbl HTMLTable3Vtbl = {
1897 HTMLTable3_QueryInterface,
1898 HTMLTable3_AddRef,
1899 HTMLTable3_Release,
1900 HTMLTable3_GetTypeInfoCount,
1901 HTMLTable3_GetTypeInfo,
1902 HTMLTable3_GetIDsOfNames,
1903 HTMLTable3_Invoke,
1904 HTMLTable3_put_summary,
1905 HTMLTable3_get_summary
1908 static inline HTMLTable *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
1910 return CONTAINING_RECORD(iface, HTMLTable, element.node);
1913 static HRESULT HTMLTable_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1915 HTMLTable *This = impl_from_HTMLDOMNode(iface);
1917 *ppv = NULL;
1919 if(IsEqualGUID(&IID_IUnknown, riid)) {
1920 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1921 *ppv = &This->IHTMLTable_iface;
1922 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1923 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1924 *ppv = &This->IHTMLTable_iface;
1925 }else if(IsEqualGUID(&IID_IHTMLTable, riid)) {
1926 TRACE("(%p)->(IID_IHTMLTable %p)\n", This, ppv);
1927 *ppv = &This->IHTMLTable_iface;
1928 }else if(IsEqualGUID(&IID_IHTMLTable2, riid)) {
1929 TRACE("(%p)->(IID_IHTMLTable2 %p)\n", This, ppv);
1930 *ppv = &This->IHTMLTable2_iface;
1931 }else if(IsEqualGUID(&IID_IHTMLTable3, riid)) {
1932 TRACE("(%p)->(IID_IHTMLTable3 %p)\n", This, ppv);
1933 *ppv = &This->IHTMLTable3_iface;
1936 if(*ppv) {
1937 IUnknown_AddRef((IUnknown*)*ppv);
1938 return S_OK;
1941 return HTMLElement_QI(&This->element.node, riid, ppv);
1944 static void HTMLTable_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
1946 HTMLTable *This = impl_from_HTMLDOMNode(iface);
1948 if(This->nstable)
1949 note_cc_edge((nsISupports*)This->nstable, "This->nstable", cb);
1952 static void HTMLTable_unlink(HTMLDOMNode *iface)
1954 HTMLTable *This = impl_from_HTMLDOMNode(iface);
1956 if(This->nstable) {
1957 nsIDOMHTMLTableElement *nstable = This->nstable;
1959 This->nstable = NULL;
1960 nsIDOMHTMLTableElement_Release(nstable);
1964 static const cpc_entry_t HTMLTable_cpc[] = {
1965 {&DIID_HTMLTableEvents},
1966 HTMLELEMENT_CPC,
1967 {NULL}
1970 static const NodeImplVtbl HTMLTableImplVtbl = {
1971 &CLSID_HTMLTable,
1972 HTMLTable_QI,
1973 HTMLElement_destructor,
1974 HTMLTable_cpc,
1975 HTMLElement_clone,
1976 HTMLElement_handle_event,
1977 HTMLElement_get_attr_col,
1978 NULL,
1979 NULL,
1980 NULL,
1981 NULL,
1982 NULL,
1983 NULL,
1984 NULL,
1985 NULL,
1986 HTMLTable_traverse,
1987 HTMLTable_unlink
1990 static const tid_t HTMLTable_iface_tids[] = {
1991 HTMLELEMENT_TIDS,
1992 IHTMLTable_tid,
1993 IHTMLTable2_tid,
1994 IHTMLTable3_tid,
1998 static dispex_static_data_t HTMLTable_dispex = {
1999 NULL,
2000 DispHTMLTable_tid,
2001 HTMLTable_iface_tids,
2002 HTMLElement_init_dispex_info
2005 HRESULT HTMLTable_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
2007 HTMLTable *ret;
2008 nsresult nsres;
2010 ret = heap_alloc_zero(sizeof(HTMLTable));
2011 if(!ret)
2012 return E_OUTOFMEMORY;
2014 ret->element.node.vtbl = &HTMLTableImplVtbl;
2015 ret->IHTMLTable_iface.lpVtbl = &HTMLTableVtbl;
2016 ret->IHTMLTable2_iface.lpVtbl = &HTMLTable2Vtbl;
2017 ret->IHTMLTable3_iface.lpVtbl = &HTMLTable3Vtbl;
2019 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTable_dispex);
2021 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableElement, (void**)&ret->nstable);
2022 assert(nsres == NS_OK);
2024 *elem = &ret->element;
2025 return S_OK;