wined3d: Use context->ops->prepare_upload_bo() in wined3d_device_context_map() if...
[wine.git] / dlls / mshtml / htmltable.c
blobad74ad309661aca6991f58936989e0f85e486425
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 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: %08x\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);
489 if(This->nscell) {
490 nsIDOMHTMLTableCellElement *nscell = This->nscell;
492 This->nscell = NULL;
493 nsIDOMHTMLTableCellElement_Release(nscell);
497 static const NodeImplVtbl HTMLTableCellImplVtbl = {
498 &CLSID_HTMLTableCell,
499 HTMLTableCell_QI,
500 HTMLTableCell_destructor,
501 HTMLElement_cpc,
502 HTMLElement_clone,
503 HTMLElement_handle_event,
504 HTMLElement_get_attr_col,
505 NULL,
506 NULL,
507 NULL,
508 NULL,
509 NULL,
510 NULL,
511 NULL,
512 NULL,
513 HTMLTableCell_traverse,
514 HTMLTableCell_unlink
517 static const tid_t HTMLTableCell_iface_tids[] = {
518 HTMLELEMENT_TIDS,
519 IHTMLTableCell_tid,
523 static dispex_static_data_t HTMLTableCell_dispex = {
524 NULL,
525 DispHTMLTableCell_tid,
526 HTMLTableCell_iface_tids,
527 HTMLElement_init_dispex_info
530 HRESULT HTMLTableCell_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
532 HTMLTableCell *ret;
533 nsresult nsres;
535 ret = heap_alloc_zero(sizeof(*ret));
536 if(!ret)
537 return E_OUTOFMEMORY;
539 ret->IHTMLTableCell_iface.lpVtbl = &HTMLTableCellVtbl;
540 ret->element.node.vtbl = &HTMLTableCellImplVtbl;
542 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTableCell_dispex);
544 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableCellElement, (void**)&ret->nscell);
545 assert(nsres == NS_OK);
547 *elem = &ret->element;
548 return S_OK;
551 struct HTMLTableRow {
552 HTMLElement element;
554 IHTMLTableRow IHTMLTableRow_iface;
556 nsIDOMHTMLTableRowElement *nsrow;
559 static inline HTMLTableRow *impl_from_IHTMLTableRow(IHTMLTableRow *iface)
561 return CONTAINING_RECORD(iface, HTMLTableRow, IHTMLTableRow_iface);
564 static HRESULT WINAPI HTMLTableRow_QueryInterface(IHTMLTableRow *iface,
565 REFIID riid, void **ppv)
567 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
569 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
572 static ULONG WINAPI HTMLTableRow_AddRef(IHTMLTableRow *iface)
574 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
576 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
579 static ULONG WINAPI HTMLTableRow_Release(IHTMLTableRow *iface)
581 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
583 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
586 static HRESULT WINAPI HTMLTableRow_GetTypeInfoCount(IHTMLTableRow *iface, UINT *pctinfo)
588 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
589 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
592 static HRESULT WINAPI HTMLTableRow_GetTypeInfo(IHTMLTableRow *iface, UINT iTInfo,
593 LCID lcid, ITypeInfo **ppTInfo)
595 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
596 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
597 ppTInfo);
600 static HRESULT WINAPI HTMLTableRow_GetIDsOfNames(IHTMLTableRow *iface, REFIID riid,
601 LPOLESTR *rgszNames, UINT cNames,
602 LCID lcid, DISPID *rgDispId)
604 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
605 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
606 cNames, lcid, rgDispId);
609 static HRESULT WINAPI HTMLTableRow_Invoke(IHTMLTableRow *iface, DISPID dispIdMember,
610 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
611 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
613 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
614 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
615 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
618 static HRESULT WINAPI HTMLTableRow_put_align(IHTMLTableRow *iface, BSTR v)
620 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
621 nsAString val;
622 nsresult nsres;
624 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
626 nsAString_InitDepend(&val, v);
628 nsres = nsIDOMHTMLTableRowElement_SetAlign(This->nsrow, &val);
629 nsAString_Finish(&val);
630 if (NS_FAILED(nsres)){
631 ERR("Set Align(%s) failed!\n", debugstr_w(v));
632 return E_FAIL;
634 return S_OK;
637 static HRESULT WINAPI HTMLTableRow_get_align(IHTMLTableRow *iface, BSTR *p)
639 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
640 nsAString val;
641 nsresult nsres;
643 TRACE("(%p)->(%p)\n", This, p);
645 nsAString_Init(&val, NULL);
646 nsres = nsIDOMHTMLTableRowElement_GetAlign(This->nsrow, &val);
648 return return_nsstr(nsres, &val, p);
651 static HRESULT WINAPI HTMLTableRow_put_vAlign(IHTMLTableRow *iface, BSTR v)
653 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
654 nsAString val;
655 nsresult nsres;
657 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
659 nsAString_InitDepend(&val, v);
661 nsres = nsIDOMHTMLTableRowElement_SetVAlign(This->nsrow, &val);
662 nsAString_Finish(&val);
664 if (NS_FAILED(nsres)){
665 ERR("Set VAlign(%s) failed!\n", debugstr_w(v));
666 return E_FAIL;
669 return S_OK;
672 static HRESULT WINAPI HTMLTableRow_get_vAlign(IHTMLTableRow *iface, BSTR *p)
674 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
675 nsAString val;
676 nsresult nsres;
678 TRACE("(%p)->(%p)\n", This, p);
680 nsAString_Init(&val, NULL);
681 nsres = nsIDOMHTMLTableRowElement_GetVAlign(This->nsrow, &val);
683 return return_nsstr(nsres, &val, p);
686 static HRESULT WINAPI HTMLTableRow_put_bgColor(IHTMLTableRow *iface, VARIANT v)
688 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
689 nsAString val;
690 nsresult nsres;
692 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
694 if (!variant_to_nscolor(&v, &val))
695 return S_OK;
697 nsres = nsIDOMHTMLTableRowElement_SetBgColor(This->nsrow, &val);
698 nsAString_Finish(&val);
700 if (NS_FAILED(nsres)){
701 ERR("Set BgColor(%s) failed!\n", debugstr_variant(&v));
702 return E_FAIL;
705 return S_OK;
708 static HRESULT WINAPI HTMLTableRow_get_bgColor(IHTMLTableRow *iface, VARIANT *p)
710 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
711 nsAString strColor;
712 nsresult nsres;
713 HRESULT hres;
714 const PRUnichar *color;
716 TRACE("(%p)->(%p)\n", This, p);
718 nsAString_Init(&strColor, NULL);
719 nsres = nsIDOMHTMLTableRowElement_GetBgColor(This->nsrow, &strColor);
721 if(NS_SUCCEEDED(nsres)) {
722 nsAString_GetData(&strColor, &color);
723 V_VT(p) = VT_BSTR;
724 hres = nscolor_to_str(color, &V_BSTR(p));
725 }else {
726 ERR("SetBgColor failed: %08x\n", nsres);
727 hres = E_FAIL;
730 nsAString_Finish(&strColor);
731 return hres;
734 static HRESULT WINAPI HTMLTableRow_put_borderColor(IHTMLTableRow *iface, VARIANT v)
736 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
737 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
738 return E_NOTIMPL;
741 static HRESULT WINAPI HTMLTableRow_get_borderColor(IHTMLTableRow *iface, VARIANT *p)
743 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
744 FIXME("(%p)->(%p)\n", This, p);
745 return E_NOTIMPL;
748 static HRESULT WINAPI HTMLTableRow_put_borderColorLight(IHTMLTableRow *iface, VARIANT v)
750 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
751 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
752 return E_NOTIMPL;
755 static HRESULT WINAPI HTMLTableRow_get_borderColorLight(IHTMLTableRow *iface, VARIANT *p)
757 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
758 FIXME("(%p)->(%p)\n", This, p);
759 return E_NOTIMPL;
762 static HRESULT WINAPI HTMLTableRow_put_borderColorDark(IHTMLTableRow *iface, VARIANT v)
764 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
765 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
766 return E_NOTIMPL;
769 static HRESULT WINAPI HTMLTableRow_get_borderColorDark(IHTMLTableRow *iface, VARIANT *p)
771 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
772 FIXME("(%p)->(%p)\n", This, p);
773 return E_NOTIMPL;
776 static HRESULT WINAPI HTMLTableRow_get_rowIndex(IHTMLTableRow *iface, LONG *p)
778 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
779 nsresult nsres;
781 TRACE("(%p)->(%p)\n", This, p);
782 nsres = nsIDOMHTMLTableRowElement_GetRowIndex(This->nsrow, p);
783 if(NS_FAILED(nsres)) {
784 ERR("Get rowIndex failed: %08x\n", nsres);
785 return E_FAIL;
787 return S_OK;
790 static HRESULT WINAPI HTMLTableRow_get_sectionRowIndex(IHTMLTableRow *iface, LONG *p)
792 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
793 nsresult nsres;
795 TRACE("(%p)->(%p)\n", This, p);
796 nsres = nsIDOMHTMLTableRowElement_GetSectionRowIndex(This->nsrow, p);
797 if(NS_FAILED(nsres)) {
798 ERR("Get selectionRowIndex failed: %08x\n", nsres);
799 return E_FAIL;
801 return S_OK;
804 static HRESULT WINAPI HTMLTableRow_get_cells(IHTMLTableRow *iface, IHTMLElementCollection **p)
806 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
807 nsIDOMHTMLCollection *nscol;
808 nsresult nsres;
810 TRACE("(%p)->(%p)\n", This, p);
812 nsres = nsIDOMHTMLTableRowElement_GetCells(This->nsrow, &nscol);
813 if(NS_FAILED(nsres)) {
814 ERR("GetCells failed: %08x\n", nsres);
815 return E_FAIL;
818 *p = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->element.node.event_target.dispex));
820 nsIDOMHTMLCollection_Release(nscol);
821 return S_OK;
824 static HRESULT WINAPI HTMLTableRow_insertCell(IHTMLTableRow *iface, LONG index, IDispatch **row)
826 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
827 nsIDOMHTMLElement *nselem;
828 HTMLElement *elem;
829 nsresult nsres;
830 HRESULT hres;
832 TRACE("(%p)->(%d %p)\n", This, index, row);
833 nsres = nsIDOMHTMLTableRowElement_InsertCell(This->nsrow, index, &nselem);
834 if(NS_FAILED(nsres)) {
835 ERR("Insert Cell at %d failed: %08x\n", index, nsres);
836 return E_FAIL;
839 hres = HTMLTableCell_Create(This->element.node.doc, (nsIDOMElement*)nselem, &elem);
840 nsIDOMHTMLElement_Release(nselem);
841 if (FAILED(hres)) {
842 ERR("Create TableCell failed: %08x\n", hres);
843 return hres;
846 *row = (IDispatch *)&elem->IHTMLElement_iface;
847 return S_OK;
850 static HRESULT WINAPI HTMLTableRow_deleteCell(IHTMLTableRow *iface, LONG index)
852 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
853 nsresult nsres;
855 TRACE("(%p)->(%d)\n", This, index);
856 nsres = nsIDOMHTMLTableRowElement_DeleteCell(This->nsrow, index);
857 if(NS_FAILED(nsres)) {
858 ERR("Delete Cell failed: %08x\n", nsres);
859 return E_FAIL;
861 return S_OK;
864 static const IHTMLTableRowVtbl HTMLTableRowVtbl = {
865 HTMLTableRow_QueryInterface,
866 HTMLTableRow_AddRef,
867 HTMLTableRow_Release,
868 HTMLTableRow_GetTypeInfoCount,
869 HTMLTableRow_GetTypeInfo,
870 HTMLTableRow_GetIDsOfNames,
871 HTMLTableRow_Invoke,
872 HTMLTableRow_put_align,
873 HTMLTableRow_get_align,
874 HTMLTableRow_put_vAlign,
875 HTMLTableRow_get_vAlign,
876 HTMLTableRow_put_bgColor,
877 HTMLTableRow_get_bgColor,
878 HTMLTableRow_put_borderColor,
879 HTMLTableRow_get_borderColor,
880 HTMLTableRow_put_borderColorLight,
881 HTMLTableRow_get_borderColorLight,
882 HTMLTableRow_put_borderColorDark,
883 HTMLTableRow_get_borderColorDark,
884 HTMLTableRow_get_rowIndex,
885 HTMLTableRow_get_sectionRowIndex,
886 HTMLTableRow_get_cells,
887 HTMLTableRow_insertCell,
888 HTMLTableRow_deleteCell
891 static inline HTMLTableRow *HTMLTableRow_from_HTMLDOMNode(HTMLDOMNode *iface)
893 return CONTAINING_RECORD(iface, HTMLTableRow, element.node);
896 static HRESULT HTMLTableRow_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
898 HTMLTableRow *This = HTMLTableRow_from_HTMLDOMNode(iface);
900 *ppv = NULL;
902 if(IsEqualGUID(&IID_IUnknown, riid)) {
903 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
904 *ppv = &This->IHTMLTableRow_iface;
905 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
906 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
907 *ppv = &This->IHTMLTableRow_iface;
908 }else if(IsEqualGUID(&IID_IHTMLTableRow, riid)) {
909 TRACE("(%p)->(IID_IHTMLTableRow %p)\n", This, ppv);
910 *ppv = &This->IHTMLTableRow_iface;
913 if(*ppv) {
914 IUnknown_AddRef((IUnknown*)*ppv);
915 return S_OK;
918 return HTMLElement_QI(&This->element.node, riid, ppv);
921 static void HTMLTableRow_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
923 HTMLTableRow *This = HTMLTableRow_from_HTMLDOMNode(iface);
925 if(This->nsrow)
926 note_cc_edge((nsISupports*)This->nsrow, "This->nstablerow", cb);
929 static void HTMLTableRow_unlink(HTMLDOMNode *iface)
931 HTMLTableRow *This = HTMLTableRow_from_HTMLDOMNode(iface);
933 if(This->nsrow) {
934 nsIDOMHTMLTableRowElement *nsrow = This->nsrow;
936 This->nsrow = NULL;
937 nsIDOMHTMLTableRowElement_Release(nsrow);
941 static const NodeImplVtbl HTMLTableRowImplVtbl = {
942 &CLSID_HTMLTableRow,
943 HTMLTableRow_QI,
944 HTMLElement_destructor,
945 HTMLElement_cpc,
946 HTMLElement_clone,
947 HTMLElement_handle_event,
948 HTMLElement_get_attr_col,
949 NULL,
950 NULL,
951 NULL,
952 NULL,
953 NULL,
954 NULL,
955 NULL,
956 NULL,
957 HTMLTableRow_traverse,
958 HTMLTableRow_unlink
961 static const tid_t HTMLTableRow_iface_tids[] = {
962 HTMLELEMENT_TIDS,
963 IHTMLTableRow_tid,
967 static dispex_static_data_t HTMLTableRow_dispex = {
968 NULL,
969 DispHTMLTableRow_tid,
970 HTMLTableRow_iface_tids,
971 HTMLElement_init_dispex_info
974 HRESULT HTMLTableRow_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
976 HTMLTableRow *ret;
977 nsresult nsres;
979 ret = heap_alloc_zero(sizeof(HTMLTableRow));
980 if(!ret)
981 return E_OUTOFMEMORY;
983 ret->IHTMLTableRow_iface.lpVtbl = &HTMLTableRowVtbl;
984 ret->element.node.vtbl = &HTMLTableRowImplVtbl;
986 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTableRow_dispex);
988 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableRowElement, (void**)&ret->nsrow);
989 assert(nsres == NS_OK);
991 *elem = &ret->element;
992 return S_OK;
995 struct HTMLTable {
996 HTMLElement element;
998 IHTMLTable IHTMLTable_iface;
999 IHTMLTable2 IHTMLTable2_iface;
1000 IHTMLTable3 IHTMLTable3_iface;
1002 nsIDOMHTMLTableElement *nstable;
1005 static inline HTMLTable *impl_from_IHTMLTable(IHTMLTable *iface)
1007 return CONTAINING_RECORD(iface, HTMLTable, IHTMLTable_iface);
1010 static inline HTMLTable *impl_from_IHTMLTable2(IHTMLTable2 *iface)
1012 return CONTAINING_RECORD(iface, HTMLTable, IHTMLTable2_iface);
1015 static inline HTMLTable *impl_from_IHTMLTable3(IHTMLTable3 *iface)
1017 return CONTAINING_RECORD(iface, HTMLTable, IHTMLTable3_iface);
1020 static HRESULT var2str(const VARIANT *p, nsAString *nsstr)
1022 BSTR str;
1023 BOOL ret;
1024 HRESULT hres;
1026 switch(V_VT(p)) {
1027 case VT_BSTR:
1028 return nsAString_Init(nsstr, V_BSTR(p))?
1029 S_OK : E_OUTOFMEMORY;
1030 case VT_R8:
1031 hres = VarBstrFromR8(V_R8(p), MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), 0, &str);
1032 break;
1033 case VT_R4:
1034 hres = VarBstrFromR4(V_R4(p), MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), 0, &str);
1035 break;
1036 case VT_I4:
1037 hres = VarBstrFromI4(V_I4(p), MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), 0, &str);
1038 break;
1039 default:
1040 FIXME("unsupported arg %s\n", debugstr_variant(p));
1041 return E_NOTIMPL;
1043 if (FAILED(hres))
1044 return hres;
1046 ret = nsAString_Init(nsstr, str);
1047 SysFreeString(str);
1048 return ret ? S_OK : E_OUTOFMEMORY;
1051 static HRESULT WINAPI HTMLTable_QueryInterface(IHTMLTable *iface,
1052 REFIID riid, void **ppv)
1054 HTMLTable *This = impl_from_IHTMLTable(iface);
1056 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1059 static ULONG WINAPI HTMLTable_AddRef(IHTMLTable *iface)
1061 HTMLTable *This = impl_from_IHTMLTable(iface);
1063 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1066 static ULONG WINAPI HTMLTable_Release(IHTMLTable *iface)
1068 HTMLTable *This = impl_from_IHTMLTable(iface);
1070 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1073 static HRESULT WINAPI HTMLTable_GetTypeInfoCount(IHTMLTable *iface, UINT *pctinfo)
1075 HTMLTable *This = impl_from_IHTMLTable(iface);
1076 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1079 static HRESULT WINAPI HTMLTable_GetTypeInfo(IHTMLTable *iface, UINT iTInfo,
1080 LCID lcid, ITypeInfo **ppTInfo)
1082 HTMLTable *This = impl_from_IHTMLTable(iface);
1083 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
1084 ppTInfo);
1087 static HRESULT WINAPI HTMLTable_GetIDsOfNames(IHTMLTable *iface, REFIID riid,
1088 LPOLESTR *rgszNames, UINT cNames,
1089 LCID lcid, DISPID *rgDispId)
1091 HTMLTable *This = impl_from_IHTMLTable(iface);
1092 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1093 cNames, lcid, rgDispId);
1096 static HRESULT WINAPI HTMLTable_Invoke(IHTMLTable *iface, DISPID dispIdMember,
1097 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1098 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1100 HTMLTable *This = impl_from_IHTMLTable(iface);
1101 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1102 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1105 static HRESULT WINAPI HTMLTable_put_cols(IHTMLTable *iface, LONG v)
1107 HTMLTable *This = impl_from_IHTMLTable(iface);
1108 FIXME("(%p)->(%d)\n", This, v);
1109 return E_NOTIMPL;
1112 static HRESULT WINAPI HTMLTable_get_cols(IHTMLTable *iface, LONG *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_border(IHTMLTable *iface, VARIANT v)
1121 HTMLTable *This = impl_from_IHTMLTable(iface);
1122 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1123 return E_NOTIMPL;
1126 static HRESULT WINAPI HTMLTable_get_border(IHTMLTable *iface, VARIANT *p)
1128 HTMLTable *This = impl_from_IHTMLTable(iface);
1129 FIXME("(%p)->(%p)\n", This, p);
1130 return E_NOTIMPL;
1133 static HRESULT WINAPI HTMLTable_put_frame(IHTMLTable *iface, BSTR v)
1135 HTMLTable *This = impl_from_IHTMLTable(iface);
1136 nsAString str;
1137 nsresult nsres;
1139 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1141 nsAString_InitDepend(&str, v);
1142 nsres = nsIDOMHTMLTableElement_SetFrame(This->nstable, &str);
1143 nsAString_Finish(&str);
1145 if (NS_FAILED(nsres)) {
1146 ERR("SetFrame(%s) failed: %08x\n", debugstr_w(v), nsres);
1147 return E_FAIL;
1149 return S_OK;
1152 static HRESULT WINAPI HTMLTable_get_frame(IHTMLTable *iface, BSTR *p)
1154 HTMLTable *This = impl_from_IHTMLTable(iface);
1155 nsAString str;
1156 nsresult nsres;
1158 TRACE("(%p)->(%p)\n", This, p);
1160 nsAString_Init(&str, NULL);
1161 nsres = nsIDOMHTMLTableElement_GetFrame(This->nstable, &str);
1163 return return_nsstr(nsres, &str, p);
1166 static HRESULT WINAPI HTMLTable_put_rules(IHTMLTable *iface, BSTR v)
1168 HTMLTable *This = impl_from_IHTMLTable(iface);
1169 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1170 return E_NOTIMPL;
1173 static HRESULT WINAPI HTMLTable_get_rules(IHTMLTable *iface, BSTR *p)
1175 HTMLTable *This = impl_from_IHTMLTable(iface);
1176 FIXME("(%p)->(%p)\n", This, p);
1177 return E_NOTIMPL;
1180 static HRESULT WINAPI HTMLTable_put_cellSpacing(IHTMLTable *iface, VARIANT v)
1182 HTMLTable *This = impl_from_IHTMLTable(iface);
1183 nsAString nsstr;
1184 WCHAR buf[64];
1185 nsresult nsres;
1187 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1189 switch(V_VT(&v)) {
1190 case VT_BSTR:
1191 nsAString_InitDepend(&nsstr, V_BSTR(&v));
1192 break;
1193 case VT_I4: {
1194 swprintf(buf, ARRAY_SIZE(buf), L"%d", V_I4(&v));
1195 nsAString_InitDepend(&nsstr, buf);
1196 break;
1198 default:
1199 FIXME("unsupported arg %s\n", debugstr_variant(&v));
1200 return E_NOTIMPL;
1203 nsres = nsIDOMHTMLTableElement_SetCellSpacing(This->nstable, &nsstr);
1204 nsAString_Finish(&nsstr);
1205 if(NS_FAILED(nsres)) {
1206 ERR("SetCellSpacing failed: %08x\n", nsres);
1207 return E_FAIL;
1210 return S_OK;
1213 static HRESULT WINAPI HTMLTable_get_cellSpacing(IHTMLTable *iface, VARIANT *p)
1215 HTMLTable *This = impl_from_IHTMLTable(iface);
1216 nsAString nsstr;
1217 nsresult nsres;
1219 TRACE("(%p)->(%p)\n", This, p);
1221 nsAString_Init(&nsstr, NULL);
1222 nsres = nsIDOMHTMLTableElement_GetCellSpacing(This->nstable, &nsstr);
1223 V_VT(p) = VT_BSTR;
1224 return return_nsstr(nsres, &nsstr, &V_BSTR(p));
1227 static HRESULT WINAPI HTMLTable_put_cellPadding(IHTMLTable *iface, VARIANT v)
1229 HTMLTable *This = impl_from_IHTMLTable(iface);
1230 nsAString val;
1231 HRESULT hres;
1232 nsresult nsres;
1234 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1236 hres = var2str(&v, &val);
1237 if(FAILED(hres))
1238 return hres;
1240 nsres = nsIDOMHTMLTableElement_SetCellPadding(This->nstable, &val);
1241 nsAString_Finish(&val);
1242 if(NS_FAILED(nsres)) {
1243 ERR("Set Width(%s) failed, err = %08x\n", debugstr_variant(&v), nsres);
1244 return E_FAIL;
1247 return S_OK;
1250 static HRESULT WINAPI HTMLTable_get_cellPadding(IHTMLTable *iface, VARIANT *p)
1252 HTMLTable *This = impl_from_IHTMLTable(iface);
1253 nsAString val;
1254 nsresult nsres;
1256 TRACE("(%p)->(%p)\n", This, p);
1258 nsAString_Init(&val, NULL);
1259 nsres = nsIDOMHTMLTableElement_GetCellPadding(This->nstable, &val);
1260 return return_nsstr_variant(nsres, &val, 0, p);
1263 static HRESULT WINAPI HTMLTable_put_background(IHTMLTable *iface, BSTR v)
1265 HTMLTable *This = impl_from_IHTMLTable(iface);
1266 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1267 return E_NOTIMPL;
1270 static HRESULT WINAPI HTMLTable_get_background(IHTMLTable *iface, BSTR *p)
1272 HTMLTable *This = impl_from_IHTMLTable(iface);
1273 FIXME("(%p)->(%p)\n", This, p);
1274 return E_NOTIMPL;
1277 static HRESULT WINAPI HTMLTable_put_bgColor(IHTMLTable *iface, VARIANT v)
1279 HTMLTable *This = impl_from_IHTMLTable(iface);
1280 nsAString val;
1281 nsresult nsres;
1283 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1285 if(!variant_to_nscolor(&v, &val))
1286 return S_OK;
1288 nsres = nsIDOMHTMLTableElement_SetBgColor(This->nstable, &val);
1289 nsAString_Finish(&val);
1290 if (NS_FAILED(nsres)){
1291 ERR("Set BgColor(%s) failed!\n", debugstr_variant(&v));
1292 return E_FAIL;
1295 return S_OK;
1298 static HRESULT WINAPI HTMLTable_get_bgColor(IHTMLTable *iface, VARIANT *p)
1300 HTMLTable *This = impl_from_IHTMLTable(iface);
1301 nsAString strColor;
1302 nsresult nsres;
1303 HRESULT hres;
1304 const PRUnichar *color;
1306 TRACE("(%p)->(%p)\n", This, p);
1308 nsAString_Init(&strColor, NULL);
1309 nsres = nsIDOMHTMLTableElement_GetBgColor(This->nstable, &strColor);
1311 if(NS_SUCCEEDED(nsres)) {
1312 nsAString_GetData(&strColor, &color);
1313 V_VT(p) = VT_BSTR;
1314 hres = nscolor_to_str(color, &V_BSTR(p));
1315 }else {
1316 ERR("SetBgColor failed: %08x\n", nsres);
1317 hres = E_FAIL;
1320 nsAString_Finish(&strColor);
1321 return hres;
1324 static HRESULT WINAPI HTMLTable_put_borderColor(IHTMLTable *iface, VARIANT v)
1326 HTMLTable *This = impl_from_IHTMLTable(iface);
1327 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1328 return E_NOTIMPL;
1331 static HRESULT WINAPI HTMLTable_get_borderColor(IHTMLTable *iface, VARIANT *p)
1333 HTMLTable *This = impl_from_IHTMLTable(iface);
1334 FIXME("(%p)->(%p)\n", This, p);
1335 return E_NOTIMPL;
1338 static HRESULT WINAPI HTMLTable_put_borderColorLight(IHTMLTable *iface, VARIANT v)
1340 HTMLTable *This = impl_from_IHTMLTable(iface);
1341 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1342 return E_NOTIMPL;
1345 static HRESULT WINAPI HTMLTable_get_borderColorLight(IHTMLTable *iface, VARIANT *p)
1347 HTMLTable *This = impl_from_IHTMLTable(iface);
1348 FIXME("(%p)->(%p)\n", This, p);
1349 return E_NOTIMPL;
1352 static HRESULT WINAPI HTMLTable_put_borderColorDark(IHTMLTable *iface, VARIANT v)
1354 HTMLTable *This = impl_from_IHTMLTable(iface);
1355 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1356 return E_NOTIMPL;
1359 static HRESULT WINAPI HTMLTable_get_borderColorDark(IHTMLTable *iface, VARIANT *p)
1361 HTMLTable *This = impl_from_IHTMLTable(iface);
1362 FIXME("(%p)->(%p)\n", This, p);
1363 return E_NOTIMPL;
1366 static HRESULT WINAPI HTMLTable_put_align(IHTMLTable *iface, BSTR v)
1368 HTMLTable *This = impl_from_IHTMLTable(iface);
1369 nsAString val;
1370 nsresult nsres;
1372 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1374 nsAString_InitDepend(&val, v);
1376 nsres = nsIDOMHTMLTableElement_SetAlign(This->nstable, &val);
1377 nsAString_Finish(&val);
1378 if (NS_FAILED(nsres)){
1379 ERR("Set Align(%s) failed!\n", debugstr_w(v));
1380 return E_FAIL;
1382 return S_OK;
1385 static HRESULT WINAPI HTMLTable_get_align(IHTMLTable *iface, BSTR *p)
1387 HTMLTable *This = impl_from_IHTMLTable(iface);
1388 nsAString val;
1389 nsresult nsres;
1391 TRACE("(%p)->(%p)\n", This, p);
1393 nsAString_Init(&val, NULL);
1394 nsres = nsIDOMHTMLTableElement_GetAlign(This->nstable, &val);
1396 return return_nsstr(nsres, &val, p);
1399 static HRESULT WINAPI HTMLTable_refresh(IHTMLTable *iface)
1401 HTMLTable *This = impl_from_IHTMLTable(iface);
1402 FIXME("(%p)\n", This);
1403 return E_NOTIMPL;
1406 static HRESULT WINAPI HTMLTable_get_rows(IHTMLTable *iface, IHTMLElementCollection **p)
1408 HTMLTable *This = impl_from_IHTMLTable(iface);
1409 nsIDOMHTMLCollection *nscol;
1410 nsresult nsres;
1412 TRACE("(%p)->(%p)\n", This, p);
1414 nsres = nsIDOMHTMLTableElement_GetRows(This->nstable, &nscol);
1415 if(NS_FAILED(nsres)) {
1416 ERR("GetRows failed: %08x\n", nsres);
1417 return E_FAIL;
1420 *p = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->element.node.event_target.dispex));
1422 nsIDOMHTMLCollection_Release(nscol);
1423 return S_OK;
1426 static HRESULT WINAPI HTMLTable_put_width(IHTMLTable *iface, VARIANT v)
1428 HTMLTable *This = impl_from_IHTMLTable(iface);
1429 nsAString val;
1430 HRESULT hres;
1431 nsresult nsres;
1433 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1434 hres = var2str(&v, &val);
1436 if (FAILED(hres)){
1437 ERR("Set Width(%s) failed when initializing a nsAString, err = %08x\n",
1438 debugstr_variant(&v), hres);
1439 return hres;
1442 nsres = nsIDOMHTMLTableElement_SetWidth(This->nstable, &val);
1443 nsAString_Finish(&val);
1445 if (NS_FAILED(nsres)){
1446 ERR("Set Width(%s) failed, err = %08x\n", debugstr_variant(&v), nsres);
1447 return E_FAIL;
1449 return S_OK;
1452 static HRESULT WINAPI HTMLTable_get_width(IHTMLTable *iface, VARIANT *p)
1454 HTMLTable *This = impl_from_IHTMLTable(iface);
1455 nsAString val;
1456 nsresult nsres;
1458 TRACE("(%p)->(%p)\n", This, p);
1460 nsAString_Init(&val, NULL);
1461 nsres = nsIDOMHTMLTableElement_GetWidth(This->nstable, &val);
1462 return return_nsstr_variant(nsres, &val, NSSTR_IMPLICIT_PX, p);
1465 static HRESULT WINAPI HTMLTable_put_height(IHTMLTable *iface, VARIANT v)
1467 HTMLTable *This = impl_from_IHTMLTable(iface);
1468 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1469 return E_NOTIMPL;
1472 static HRESULT WINAPI HTMLTable_get_height(IHTMLTable *iface, VARIANT *p)
1474 HTMLTable *This = impl_from_IHTMLTable(iface);
1475 FIXME("(%p)->(%p)\n", This, p);
1476 return E_NOTIMPL;
1479 static HRESULT WINAPI HTMLTable_put_dataPageSize(IHTMLTable *iface, LONG v)
1481 HTMLTable *This = impl_from_IHTMLTable(iface);
1482 FIXME("(%p)->(%d)\n", This, v);
1483 return E_NOTIMPL;
1486 static HRESULT WINAPI HTMLTable_get_dataPageSize(IHTMLTable *iface, LONG *p)
1488 HTMLTable *This = impl_from_IHTMLTable(iface);
1489 FIXME("(%p)->(%p)\n", This, p);
1490 return E_NOTIMPL;
1493 static HRESULT WINAPI HTMLTable_nextPage(IHTMLTable *iface)
1495 HTMLTable *This = impl_from_IHTMLTable(iface);
1496 FIXME("(%p)\n", This);
1497 return E_NOTIMPL;
1500 static HRESULT WINAPI HTMLTable_previousPage(IHTMLTable *iface)
1502 HTMLTable *This = impl_from_IHTMLTable(iface);
1503 FIXME("(%p)\n", This);
1504 return E_NOTIMPL;
1507 static HRESULT WINAPI HTMLTable_get_tHead(IHTMLTable *iface, IHTMLTableSection **p)
1509 HTMLTable *This = impl_from_IHTMLTable(iface);
1510 FIXME("(%p)->(%p)\n", This, p);
1511 return E_NOTIMPL;
1514 static HRESULT WINAPI HTMLTable_get_tFoot(IHTMLTable *iface, IHTMLTableSection **p)
1516 HTMLTable *This = impl_from_IHTMLTable(iface);
1517 FIXME("(%p)->(%p)\n", This, p);
1518 return E_NOTIMPL;
1521 static HRESULT WINAPI HTMLTable_get_tBodies(IHTMLTable *iface, IHTMLElementCollection **p)
1523 HTMLTable *This = impl_from_IHTMLTable(iface);
1524 nsIDOMHTMLCollection *nscol = NULL;
1525 nsresult nsres;
1527 TRACE("(%p)->(%p)\n", This, p);
1529 nsres = nsIDOMHTMLTableElement_GetTBodies(This->nstable, &nscol);
1530 if(NS_FAILED(nsres)) {
1531 ERR("GetTBodies failed: %08x\n", nsres);
1532 return E_FAIL;
1535 *p = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->element.node.event_target.dispex));
1537 nsIDOMHTMLCollection_Release(nscol);
1538 return S_OK;
1541 static HRESULT WINAPI HTMLTable_get_caption(IHTMLTable *iface, IHTMLTableCaption **p)
1543 HTMLTable *This = impl_from_IHTMLTable(iface);
1544 FIXME("(%p)->(%p)\n", This, p);
1545 return E_NOTIMPL;
1548 static HRESULT WINAPI HTMLTable_createTHead(IHTMLTable *iface, IDispatch **head)
1550 HTMLTable *This = impl_from_IHTMLTable(iface);
1551 FIXME("(%p)->(%p)\n", This, head);
1552 return E_NOTIMPL;
1555 static HRESULT WINAPI HTMLTable_deleteTHead(IHTMLTable *iface)
1557 HTMLTable *This = impl_from_IHTMLTable(iface);
1558 FIXME("(%p)\n", This);
1559 return E_NOTIMPL;
1562 static HRESULT WINAPI HTMLTable_createTFoot(IHTMLTable *iface, IDispatch **foot)
1564 HTMLTable *This = impl_from_IHTMLTable(iface);
1565 FIXME("(%p)->(%p)\n", This, foot);
1566 return E_NOTIMPL;
1569 static HRESULT WINAPI HTMLTable_deleteTFoot(IHTMLTable *iface)
1571 HTMLTable *This = impl_from_IHTMLTable(iface);
1572 FIXME("(%p)\n", This);
1573 return E_NOTIMPL;
1576 static HRESULT WINAPI HTMLTable_createCaption(IHTMLTable *iface, IHTMLTableCaption **caption)
1578 HTMLTable *This = impl_from_IHTMLTable(iface);
1579 FIXME("(%p)->(%p)\n", This, caption);
1580 return E_NOTIMPL;
1583 static HRESULT WINAPI HTMLTable_deleteCaption(IHTMLTable *iface)
1585 HTMLTable *This = impl_from_IHTMLTable(iface);
1586 FIXME("(%p)\n", This);
1587 return E_NOTIMPL;
1590 static HRESULT WINAPI HTMLTable_insertRow(IHTMLTable *iface, LONG index, IDispatch **row)
1592 HTMLTable *This = impl_from_IHTMLTable(iface);
1593 nsIDOMHTMLElement *nselem;
1594 HTMLElement *elem;
1595 nsresult nsres;
1596 HRESULT hres;
1598 TRACE("(%p)->(%d %p)\n", This, index, row);
1599 nsres = nsIDOMHTMLTableElement_InsertRow(This->nstable, index, &nselem);
1600 if(NS_FAILED(nsres)) {
1601 ERR("Insert Row at %d failed: %08x\n", index, nsres);
1602 return E_FAIL;
1605 hres = HTMLTableRow_Create(This->element.node.doc, (nsIDOMElement*)nselem, &elem);
1606 nsIDOMHTMLElement_Release(nselem);
1607 if (FAILED(hres)) {
1608 ERR("Create TableRow failed: %08x\n", hres);
1609 return hres;
1612 *row = (IDispatch *)&elem->IHTMLElement_iface;
1613 return S_OK;
1616 static HRESULT WINAPI HTMLTable_deleteRow(IHTMLTable *iface, LONG index)
1618 HTMLTable *This = impl_from_IHTMLTable(iface);
1619 nsresult nsres;
1621 TRACE("(%p)->(%d)\n", This, index);
1622 nsres = nsIDOMHTMLTableElement_DeleteRow(This->nstable, index);
1623 if(NS_FAILED(nsres)) {
1624 ERR("Delete Row failed: %08x\n", nsres);
1625 return E_FAIL;
1627 return S_OK;
1630 static HRESULT WINAPI HTMLTable_get_readyState(IHTMLTable *iface, BSTR *p)
1632 HTMLTable *This = impl_from_IHTMLTable(iface);
1633 FIXME("(%p)->(%p)\n", This, p);
1634 return E_NOTIMPL;
1637 static HRESULT WINAPI HTMLTable_put_onreadystatechange(IHTMLTable *iface, VARIANT v)
1639 HTMLTable *This = impl_from_IHTMLTable(iface);
1640 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1641 return E_NOTIMPL;
1644 static HRESULT WINAPI HTMLTable_get_onreadystatechange(IHTMLTable *iface, VARIANT *p)
1646 HTMLTable *This = impl_from_IHTMLTable(iface);
1647 FIXME("(%p)->(%p)\n", This, p);
1648 return E_NOTIMPL;
1651 static const IHTMLTableVtbl HTMLTableVtbl = {
1652 HTMLTable_QueryInterface,
1653 HTMLTable_AddRef,
1654 HTMLTable_Release,
1655 HTMLTable_GetTypeInfoCount,
1656 HTMLTable_GetTypeInfo,
1657 HTMLTable_GetIDsOfNames,
1658 HTMLTable_Invoke,
1659 HTMLTable_put_cols,
1660 HTMLTable_get_cols,
1661 HTMLTable_put_border,
1662 HTMLTable_get_border,
1663 HTMLTable_put_frame,
1664 HTMLTable_get_frame,
1665 HTMLTable_put_rules,
1666 HTMLTable_get_rules,
1667 HTMLTable_put_cellSpacing,
1668 HTMLTable_get_cellSpacing,
1669 HTMLTable_put_cellPadding,
1670 HTMLTable_get_cellPadding,
1671 HTMLTable_put_background,
1672 HTMLTable_get_background,
1673 HTMLTable_put_bgColor,
1674 HTMLTable_get_bgColor,
1675 HTMLTable_put_borderColor,
1676 HTMLTable_get_borderColor,
1677 HTMLTable_put_borderColorLight,
1678 HTMLTable_get_borderColorLight,
1679 HTMLTable_put_borderColorDark,
1680 HTMLTable_get_borderColorDark,
1681 HTMLTable_put_align,
1682 HTMLTable_get_align,
1683 HTMLTable_refresh,
1684 HTMLTable_get_rows,
1685 HTMLTable_put_width,
1686 HTMLTable_get_width,
1687 HTMLTable_put_height,
1688 HTMLTable_get_height,
1689 HTMLTable_put_dataPageSize,
1690 HTMLTable_get_dataPageSize,
1691 HTMLTable_nextPage,
1692 HTMLTable_previousPage,
1693 HTMLTable_get_tHead,
1694 HTMLTable_get_tFoot,
1695 HTMLTable_get_tBodies,
1696 HTMLTable_get_caption,
1697 HTMLTable_createTHead,
1698 HTMLTable_deleteTHead,
1699 HTMLTable_createTFoot,
1700 HTMLTable_deleteTFoot,
1701 HTMLTable_createCaption,
1702 HTMLTable_deleteCaption,
1703 HTMLTable_insertRow,
1704 HTMLTable_deleteRow,
1705 HTMLTable_get_readyState,
1706 HTMLTable_put_onreadystatechange,
1707 HTMLTable_get_onreadystatechange
1710 /* IHTMLTable2 */
1711 static HRESULT WINAPI HTMLTable2_QueryInterface(IHTMLTable2 *iface,
1712 REFIID riid, void **ppv)
1714 HTMLTable *This = impl_from_IHTMLTable2(iface);
1716 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1719 static ULONG WINAPI HTMLTable2_AddRef(IHTMLTable2 *iface)
1721 HTMLTable *This = impl_from_IHTMLTable2(iface);
1723 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1726 static ULONG WINAPI HTMLTable2_Release(IHTMLTable2 *iface)
1728 HTMLTable *This = impl_from_IHTMLTable2(iface);
1730 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1733 static HRESULT WINAPI HTMLTable2_GetTypeInfoCount(IHTMLTable2 *iface, UINT *pctinfo)
1735 HTMLTable *This = impl_from_IHTMLTable2(iface);
1736 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1739 static HRESULT WINAPI HTMLTable2_GetTypeInfo(IHTMLTable2 *iface, UINT iTInfo,
1740 LCID lcid, ITypeInfo **ppTInfo)
1742 HTMLTable *This = impl_from_IHTMLTable2(iface);
1743 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
1744 ppTInfo);
1747 static HRESULT WINAPI HTMLTable2_GetIDsOfNames(IHTMLTable2 *iface, REFIID riid,
1748 LPOLESTR *rgszNames, UINT cNames,
1749 LCID lcid, DISPID *rgDispId)
1751 HTMLTable *This = impl_from_IHTMLTable2(iface);
1752 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1753 cNames, lcid, rgDispId);
1756 static HRESULT WINAPI HTMLTable2_Invoke(IHTMLTable2 *iface, DISPID dispIdMember,
1757 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1758 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1760 HTMLTable *This = impl_from_IHTMLTable2(iface);
1761 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1762 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1765 static HRESULT WINAPI HTMLTable2_firstPage(IHTMLTable2 *iface)
1767 HTMLTable *This = impl_from_IHTMLTable2(iface);
1768 FIXME("(%p)->()\n", This);
1769 return E_NOTIMPL;
1772 static HRESULT WINAPI HTMLTable2_lastPage(IHTMLTable2 *iface)
1774 HTMLTable *This = impl_from_IHTMLTable2(iface);
1775 FIXME("(%p)->()\n", This);
1776 return E_NOTIMPL;
1779 static HRESULT WINAPI HTMLTable2_cells(IHTMLTable2 *iface, IHTMLElementCollection **p)
1781 HTMLTable *This = impl_from_IHTMLTable2(iface);
1782 FIXME("(%p)->(%p)\n", This, p);
1783 return E_NOTIMPL;
1786 static HRESULT WINAPI HTMLTable2_moveRow(IHTMLTable2 *iface, LONG indexFrom, LONG indexTo, IDispatch **row)
1788 HTMLTable *This = impl_from_IHTMLTable2(iface);
1789 FIXME("(%p)->(%d %d %p)\n", This, indexFrom, indexTo, row);
1790 return E_NOTIMPL;
1794 static const IHTMLTable2Vtbl HTMLTable2Vtbl = {
1795 HTMLTable2_QueryInterface,
1796 HTMLTable2_AddRef,
1797 HTMLTable2_Release,
1798 HTMLTable2_GetTypeInfoCount,
1799 HTMLTable2_GetTypeInfo,
1800 HTMLTable2_GetIDsOfNames,
1801 HTMLTable2_Invoke,
1802 HTMLTable2_firstPage,
1803 HTMLTable2_lastPage,
1804 HTMLTable2_cells,
1805 HTMLTable2_moveRow
1808 /* IHTMLTable3 */
1809 static HRESULT WINAPI HTMLTable3_QueryInterface(IHTMLTable3 *iface,
1810 REFIID riid, void **ppv)
1812 HTMLTable *This = impl_from_IHTMLTable3(iface);
1814 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1817 static ULONG WINAPI HTMLTable3_AddRef(IHTMLTable3 *iface)
1819 HTMLTable *This = impl_from_IHTMLTable3(iface);
1821 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1824 static ULONG WINAPI HTMLTable3_Release(IHTMLTable3 *iface)
1826 HTMLTable *This = impl_from_IHTMLTable3(iface);
1828 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1831 static HRESULT WINAPI HTMLTable3_GetTypeInfoCount(IHTMLTable3 *iface, UINT *pctinfo)
1833 HTMLTable *This = impl_from_IHTMLTable3(iface);
1834 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1837 static HRESULT WINAPI HTMLTable3_GetTypeInfo(IHTMLTable3 *iface, UINT iTInfo,
1838 LCID lcid, ITypeInfo **ppTInfo)
1840 HTMLTable *This = impl_from_IHTMLTable3(iface);
1841 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
1842 ppTInfo);
1845 static HRESULT WINAPI HTMLTable3_GetIDsOfNames(IHTMLTable3 *iface, REFIID riid,
1846 LPOLESTR *rgszNames, UINT cNames,
1847 LCID lcid, DISPID *rgDispId)
1849 HTMLTable *This = impl_from_IHTMLTable3(iface);
1850 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1851 cNames, lcid, rgDispId);
1854 static HRESULT WINAPI HTMLTable3_Invoke(IHTMLTable3 *iface, DISPID dispIdMember,
1855 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1856 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1858 HTMLTable *This = impl_from_IHTMLTable3(iface);
1859 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1860 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1863 static HRESULT WINAPI HTMLTable3_put_summary(IHTMLTable3 *iface, BSTR v)
1865 HTMLTable *This = impl_from_IHTMLTable3(iface);
1866 nsAString str;
1867 nsresult nsres;
1869 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1871 nsAString_InitDepend(&str, v);
1873 nsres = nsIDOMHTMLTableElement_SetSummary(This->nstable, &str);
1875 nsAString_Finish(&str);
1876 if (NS_FAILED(nsres)) {
1877 ERR("Set summary(%s) failed: %08x\n", debugstr_w(v), nsres);
1878 return E_FAIL;
1880 return S_OK;
1883 static HRESULT WINAPI HTMLTable3_get_summary(IHTMLTable3 *iface, BSTR * p)
1885 HTMLTable *This = impl_from_IHTMLTable3(iface);
1886 nsAString str;
1887 nsresult nsres;
1889 TRACE("(%p)->(%p)\n", This, p);
1891 nsAString_Init(&str, NULL);
1892 nsres = nsIDOMHTMLTableElement_GetSummary(This->nstable, &str);
1894 return return_nsstr(nsres, &str, p);
1897 static const IHTMLTable3Vtbl HTMLTable3Vtbl = {
1898 HTMLTable3_QueryInterface,
1899 HTMLTable3_AddRef,
1900 HTMLTable3_Release,
1901 HTMLTable3_GetTypeInfoCount,
1902 HTMLTable3_GetTypeInfo,
1903 HTMLTable3_GetIDsOfNames,
1904 HTMLTable3_Invoke,
1905 HTMLTable3_put_summary,
1906 HTMLTable3_get_summary
1909 static inline HTMLTable *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
1911 return CONTAINING_RECORD(iface, HTMLTable, element.node);
1914 static HRESULT HTMLTable_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1916 HTMLTable *This = impl_from_HTMLDOMNode(iface);
1918 *ppv = NULL;
1920 if(IsEqualGUID(&IID_IUnknown, riid)) {
1921 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1922 *ppv = &This->IHTMLTable_iface;
1923 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1924 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1925 *ppv = &This->IHTMLTable_iface;
1926 }else if(IsEqualGUID(&IID_IHTMLTable, riid)) {
1927 TRACE("(%p)->(IID_IHTMLTable %p)\n", This, ppv);
1928 *ppv = &This->IHTMLTable_iface;
1929 }else if(IsEqualGUID(&IID_IHTMLTable2, riid)) {
1930 TRACE("(%p)->(IID_IHTMLTable2 %p)\n", This, ppv);
1931 *ppv = &This->IHTMLTable2_iface;
1932 }else if(IsEqualGUID(&IID_IHTMLTable3, riid)) {
1933 TRACE("(%p)->(IID_IHTMLTable3 %p)\n", This, ppv);
1934 *ppv = &This->IHTMLTable3_iface;
1937 if(*ppv) {
1938 IUnknown_AddRef((IUnknown*)*ppv);
1939 return S_OK;
1942 return HTMLElement_QI(&This->element.node, riid, ppv);
1945 static void HTMLTable_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
1947 HTMLTable *This = impl_from_HTMLDOMNode(iface);
1949 if(This->nstable)
1950 note_cc_edge((nsISupports*)This->nstable, "This->nstable", cb);
1953 static void HTMLTable_unlink(HTMLDOMNode *iface)
1955 HTMLTable *This = impl_from_HTMLDOMNode(iface);
1957 if(This->nstable) {
1958 nsIDOMHTMLTableElement *nstable = This->nstable;
1960 This->nstable = NULL;
1961 nsIDOMHTMLTableElement_Release(nstable);
1965 static const cpc_entry_t HTMLTable_cpc[] = {
1966 {&DIID_HTMLTableEvents},
1967 HTMLELEMENT_CPC,
1968 {NULL}
1971 static const NodeImplVtbl HTMLTableImplVtbl = {
1972 &CLSID_HTMLTable,
1973 HTMLTable_QI,
1974 HTMLElement_destructor,
1975 HTMLTable_cpc,
1976 HTMLElement_clone,
1977 HTMLElement_handle_event,
1978 HTMLElement_get_attr_col,
1979 NULL,
1980 NULL,
1981 NULL,
1982 NULL,
1983 NULL,
1984 NULL,
1985 NULL,
1986 NULL,
1987 HTMLTable_traverse,
1988 HTMLTable_unlink
1991 static const tid_t HTMLTable_iface_tids[] = {
1992 HTMLELEMENT_TIDS,
1993 IHTMLTable_tid,
1994 IHTMLTable2_tid,
1995 IHTMLTable3_tid,
1999 static dispex_static_data_t HTMLTable_dispex = {
2000 NULL,
2001 DispHTMLTable_tid,
2002 HTMLTable_iface_tids,
2003 HTMLElement_init_dispex_info
2006 HRESULT HTMLTable_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
2008 HTMLTable *ret;
2009 nsresult nsres;
2011 ret = heap_alloc_zero(sizeof(HTMLTable));
2012 if(!ret)
2013 return E_OUTOFMEMORY;
2015 ret->element.node.vtbl = &HTMLTableImplVtbl;
2016 ret->IHTMLTable_iface.lpVtbl = &HTMLTableVtbl;
2017 ret->IHTMLTable2_iface.lpVtbl = &HTMLTable2Vtbl;
2018 ret->IHTMLTable3_iface.lpVtbl = &HTMLTable3Vtbl;
2020 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTable_dispex);
2022 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableElement, (void**)&ret->nstable);
2023 assert(nsres == NS_OK);
2025 *elem = &ret->element;
2026 return S_OK;