2 * Copyright 2007 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
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
37 const IHTMLTableVtbl *lpHTMLTableVtbl;
40 nsIDOMHTMLTableElement *nstable;
43 #define HTMLTABLE(x) (&(x)->lpHTMLTableVtbl)
45 #define HTMLTABLE_THIS(iface) DEFINE_THIS(HTMLTable, HTMLTable, iface)
47 static HRESULT WINAPI HTMLTable_QueryInterface(IHTMLTable *iface,
48 REFIID riid, void **ppv)
50 HTMLTable *This = HTMLTABLE_THIS(iface);
52 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
55 static ULONG WINAPI HTMLTable_AddRef(IHTMLTable *iface)
57 HTMLTable *This = HTMLTABLE_THIS(iface);
59 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
62 static ULONG WINAPI HTMLTable_Release(IHTMLTable *iface)
64 HTMLTable *This = HTMLTABLE_THIS(iface);
66 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
69 static HRESULT WINAPI HTMLTable_GetTypeInfoCount(IHTMLTable *iface, UINT *pctinfo)
71 HTMLTable *This = HTMLTABLE_THIS(iface);
72 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->element.node.dispex), pctinfo);
75 static HRESULT WINAPI HTMLTable_GetTypeInfo(IHTMLTable *iface, UINT iTInfo,
76 LCID lcid, ITypeInfo **ppTInfo)
78 HTMLTable *This = HTMLTABLE_THIS(iface);
79 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->element.node.dispex), iTInfo, lcid, ppTInfo);
82 static HRESULT WINAPI HTMLTable_GetIDsOfNames(IHTMLTable *iface, REFIID riid,
83 LPOLESTR *rgszNames, UINT cNames,
84 LCID lcid, DISPID *rgDispId)
86 HTMLTable *This = HTMLTABLE_THIS(iface);
87 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
90 static HRESULT WINAPI HTMLTable_Invoke(IHTMLTable *iface, DISPID dispIdMember,
91 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
92 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
94 HTMLTable *This = HTMLTABLE_THIS(iface);
95 return IDispatchEx_Invoke(DISPATCHEX(&This->element.node.dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
96 pVarResult, pExcepInfo, puArgErr);
99 static HRESULT WINAPI HTMLTable_put_cols(IHTMLTable *iface, LONG v)
101 HTMLTable *This = HTMLTABLE_THIS(iface);
102 FIXME("(%p)->(%d)\n", This, v);
106 static HRESULT WINAPI HTMLTable_get_cols(IHTMLTable *iface, LONG *p)
108 HTMLTable *This = HTMLTABLE_THIS(iface);
109 FIXME("(%p)->(%p)\n", This, p);
113 static HRESULT WINAPI HTMLTable_put_border(IHTMLTable *iface, VARIANT v)
115 HTMLTable *This = HTMLTABLE_THIS(iface);
116 FIXME("(%p)->(v)\n", This);
120 static HRESULT WINAPI HTMLTable_get_border(IHTMLTable *iface, VARIANT *p)
122 HTMLTable *This = HTMLTABLE_THIS(iface);
123 FIXME("(%p)->(%p)\n", This, p);
127 static HRESULT WINAPI HTMLTable_put_frame(IHTMLTable *iface, BSTR v)
129 HTMLTable *This = HTMLTABLE_THIS(iface);
130 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
134 static HRESULT WINAPI HTMLTable_get_frame(IHTMLTable *iface, BSTR *p)
136 HTMLTable *This = HTMLTABLE_THIS(iface);
137 FIXME("(%p)->(%p)\n", This, p);
141 static HRESULT WINAPI HTMLTable_put_rules(IHTMLTable *iface, BSTR v)
143 HTMLTable *This = HTMLTABLE_THIS(iface);
144 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
148 static HRESULT WINAPI HTMLTable_get_rules(IHTMLTable *iface, BSTR *p)
150 HTMLTable *This = HTMLTABLE_THIS(iface);
151 FIXME("(%p)->(%p)\n", This, p);
155 static HRESULT WINAPI HTMLTable_put_cellSpacing(IHTMLTable *iface, VARIANT v)
157 HTMLTable *This = HTMLTABLE_THIS(iface);
158 FIXME("(%p)->(v)\n", This);
162 static HRESULT WINAPI HTMLTable_get_cellSpacing(IHTMLTable *iface, VARIANT *p)
164 HTMLTable *This = HTMLTABLE_THIS(iface);
165 FIXME("(%p)->(%p)\n", This, p);
169 static HRESULT WINAPI HTMLTable_put_cellPadding(IHTMLTable *iface, VARIANT v)
171 HTMLTable *This = HTMLTABLE_THIS(iface);
172 FIXME("(%p)->(v)\n", This);
176 static HRESULT WINAPI HTMLTable_get_cellPadding(IHTMLTable *iface, VARIANT *p)
178 HTMLTable *This = HTMLTABLE_THIS(iface);
179 FIXME("(%p)->(%p)\n", This, p);
183 static HRESULT WINAPI HTMLTable_put_background(IHTMLTable *iface, BSTR v)
185 HTMLTable *This = HTMLTABLE_THIS(iface);
186 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
190 static HRESULT WINAPI HTMLTable_get_background(IHTMLTable *iface, BSTR *p)
192 HTMLTable *This = HTMLTABLE_THIS(iface);
193 FIXME("(%p)->(%p)\n", This, p);
197 static HRESULT WINAPI HTMLTable_put_bgColor(IHTMLTable *iface, VARIANT v)
199 HTMLTable *This = HTMLTABLE_THIS(iface);
200 FIXME("(%p)->(v)\n", This);
204 static HRESULT WINAPI HTMLTable_get_bgColor(IHTMLTable *iface, VARIANT *p)
206 HTMLTable *This = HTMLTABLE_THIS(iface);
207 FIXME("(%p)->(%p)\n", This, p);
211 static HRESULT WINAPI HTMLTable_put_borderColor(IHTMLTable *iface, VARIANT v)
213 HTMLTable *This = HTMLTABLE_THIS(iface);
214 FIXME("(%p)->(v)\n", This);
218 static HRESULT WINAPI HTMLTable_get_borderColor(IHTMLTable *iface, VARIANT *p)
220 HTMLTable *This = HTMLTABLE_THIS(iface);
221 FIXME("(%p)->(%p)\n", This, p);
225 static HRESULT WINAPI HTMLTable_put_borderColorLight(IHTMLTable *iface, VARIANT v)
227 HTMLTable *This = HTMLTABLE_THIS(iface);
228 FIXME("(%p)->(v)\n", This);
232 static HRESULT WINAPI HTMLTable_get_borderColorLight(IHTMLTable *iface, VARIANT *p)
234 HTMLTable *This = HTMLTABLE_THIS(iface);
235 FIXME("(%p)->(%p)\n", This, p);
239 static HRESULT WINAPI HTMLTable_put_borderColorDark(IHTMLTable *iface, VARIANT v)
241 HTMLTable *This = HTMLTABLE_THIS(iface);
242 FIXME("(%p)->(v)\n", This);
246 static HRESULT WINAPI HTMLTable_get_borderColorDark(IHTMLTable *iface, VARIANT *p)
248 HTMLTable *This = HTMLTABLE_THIS(iface);
249 FIXME("(%p)->(%p)\n", This, p);
253 static HRESULT WINAPI HTMLTable_put_align(IHTMLTable *iface, BSTR v)
255 HTMLTable *This = HTMLTABLE_THIS(iface);
256 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
260 static HRESULT WINAPI HTMLTable_get_align(IHTMLTable *iface, BSTR *p)
262 HTMLTable *This = HTMLTABLE_THIS(iface);
263 FIXME("(%p)->(%p)\n", This, p);
267 static HRESULT WINAPI HTMLTable_refresh(IHTMLTable *iface)
269 HTMLTable *This = HTMLTABLE_THIS(iface);
270 FIXME("(%p)\n", This);
274 static HRESULT WINAPI HTMLTable_get_rows(IHTMLTable *iface, IHTMLElementCollection **p)
276 HTMLTable *This = HTMLTABLE_THIS(iface);
277 nsIDOMHTMLCollection *nscol;
280 TRACE("(%p)->(%p)\n", This, p);
282 nsres = nsIDOMHTMLTableElement_GetRows(This->nstable, &nscol);
283 if(NS_FAILED(nsres)) {
284 ERR("GetRows failed: %08x\n", nsres);
288 *p = create_collection_from_htmlcol(This->element.node.doc, (IUnknown*)HTMLTABLE(This), nscol);
290 nsIDOMHTMLCollection_Release(nscol);
294 static HRESULT WINAPI HTMLTable_put_width(IHTMLTable *iface, VARIANT v)
296 HTMLTable *This = HTMLTABLE_THIS(iface);
297 FIXME("(%p)->(v)\n", This);
301 static HRESULT WINAPI HTMLTable_get_width(IHTMLTable *iface, VARIANT *p)
303 HTMLTable *This = HTMLTABLE_THIS(iface);
304 FIXME("(%p)->(%p)\n", This, p);
308 static HRESULT WINAPI HTMLTable_put_height(IHTMLTable *iface, VARIANT v)
310 HTMLTable *This = HTMLTABLE_THIS(iface);
311 FIXME("(%p)->(v)\n", This);
315 static HRESULT WINAPI HTMLTable_get_height(IHTMLTable *iface, VARIANT *p)
317 HTMLTable *This = HTMLTABLE_THIS(iface);
318 FIXME("(%p)->(%p)\n", This, p);
322 static HRESULT WINAPI HTMLTable_put_dataPageSize(IHTMLTable *iface, LONG v)
324 HTMLTable *This = HTMLTABLE_THIS(iface);
325 FIXME("(%p)->(%d)\n", This, v);
329 static HRESULT WINAPI HTMLTable_get_dataPageSize(IHTMLTable *iface, LONG *p)
331 HTMLTable *This = HTMLTABLE_THIS(iface);
332 FIXME("(%p)->(%p)\n", This, p);
336 static HRESULT WINAPI HTMLTable_nextPage(IHTMLTable *iface)
338 HTMLTable *This = HTMLTABLE_THIS(iface);
339 FIXME("(%p)\n", This);
343 static HRESULT WINAPI HTMLTable_previousPage(IHTMLTable *iface)
345 HTMLTable *This = HTMLTABLE_THIS(iface);
346 FIXME("(%p)\n", This);
350 static HRESULT WINAPI HTMLTable_get_tHead(IHTMLTable *iface, IHTMLTableSection **p)
352 HTMLTable *This = HTMLTABLE_THIS(iface);
353 FIXME("(%p)->(%p)\n", This, p);
357 static HRESULT WINAPI HTMLTable_get_tFoot(IHTMLTable *iface, IHTMLTableSection **p)
359 HTMLTable *This = HTMLTABLE_THIS(iface);
360 FIXME("(%p)->(%p)\n", This, p);
364 static HRESULT WINAPI HTMLTable_get_tBodies(IHTMLTable *iface, IHTMLElementCollection **p)
366 HTMLTable *This = HTMLTABLE_THIS(iface);
367 FIXME("(%p)->(%p)\n", This, p);
371 static HRESULT WINAPI HTMLTable_get_caption(IHTMLTable *iface, IHTMLTableCaption **p)
373 HTMLTable *This = HTMLTABLE_THIS(iface);
374 FIXME("(%p)->(%p)\n", This, p);
378 static HRESULT WINAPI HTMLTable_createTHead(IHTMLTable *iface, IDispatch **head)
380 HTMLTable *This = HTMLTABLE_THIS(iface);
381 FIXME("(%p)->(%p)\n", This, head);
385 static HRESULT WINAPI HTMLTable_deleteTHead(IHTMLTable *iface)
387 HTMLTable *This = HTMLTABLE_THIS(iface);
388 FIXME("(%p)\n", This);
392 static HRESULT WINAPI HTMLTable_createTFoot(IHTMLTable *iface, IDispatch **foot)
394 HTMLTable *This = HTMLTABLE_THIS(iface);
395 FIXME("(%p)->(%p)\n", This, foot);
399 static HRESULT WINAPI HTMLTable_deleteTFoot(IHTMLTable *iface)
401 HTMLTable *This = HTMLTABLE_THIS(iface);
402 FIXME("(%p)\n", This);
406 static HRESULT WINAPI HTMLTable_createCaption(IHTMLTable *iface, IHTMLTableCaption **caption)
408 HTMLTable *This = HTMLTABLE_THIS(iface);
409 FIXME("(%p)->(%p)\n", This, caption);
413 static HRESULT WINAPI HTMLTable_deleteCaption(IHTMLTable *iface)
415 HTMLTable *This = HTMLTABLE_THIS(iface);
416 FIXME("(%p)\n", This);
420 static HRESULT WINAPI HTMLTable_insertRow(IHTMLTable *iface, LONG index, IDispatch **row)
422 HTMLTable *This = HTMLTABLE_THIS(iface);
423 FIXME("(%p)->(%d %p)\n", This, index, row);
427 static HRESULT WINAPI HTMLTable_deleteRow(IHTMLTable *iface, LONG index)
429 HTMLTable *This = HTMLTABLE_THIS(iface);
430 FIXME("(%p)->(%d)\n", This, index);
434 static HRESULT WINAPI HTMLTable_get_readyState(IHTMLTable *iface, BSTR *p)
436 HTMLTable *This = HTMLTABLE_THIS(iface);
437 FIXME("(%p)->(%p)\n", This, p);
441 static HRESULT WINAPI HTMLTable_put_onreadystatechange(IHTMLTable *iface, VARIANT v)
443 HTMLTable *This = HTMLTABLE_THIS(iface);
444 FIXME("(%p)->(v)\n", This);
448 static HRESULT WINAPI HTMLTable_get_onreadystatechange(IHTMLTable *iface, VARIANT *p)
450 HTMLTable *This = HTMLTABLE_THIS(iface);
451 FIXME("(%p)->(%p)\n", This, p);
455 #undef HTMLTABLE_THIS
457 static const IHTMLTableVtbl HTMLTableVtbl = {
458 HTMLTable_QueryInterface,
461 HTMLTable_GetTypeInfoCount,
462 HTMLTable_GetTypeInfo,
463 HTMLTable_GetIDsOfNames,
467 HTMLTable_put_border,
468 HTMLTable_get_border,
473 HTMLTable_put_cellSpacing,
474 HTMLTable_get_cellSpacing,
475 HTMLTable_put_cellPadding,
476 HTMLTable_get_cellPadding,
477 HTMLTable_put_background,
478 HTMLTable_get_background,
479 HTMLTable_put_bgColor,
480 HTMLTable_get_bgColor,
481 HTMLTable_put_borderColor,
482 HTMLTable_get_borderColor,
483 HTMLTable_put_borderColorLight,
484 HTMLTable_get_borderColorLight,
485 HTMLTable_put_borderColorDark,
486 HTMLTable_get_borderColorDark,
493 HTMLTable_put_height,
494 HTMLTable_get_height,
495 HTMLTable_put_dataPageSize,
496 HTMLTable_get_dataPageSize,
498 HTMLTable_previousPage,
501 HTMLTable_get_tBodies,
502 HTMLTable_get_caption,
503 HTMLTable_createTHead,
504 HTMLTable_deleteTHead,
505 HTMLTable_createTFoot,
506 HTMLTable_deleteTFoot,
507 HTMLTable_createCaption,
508 HTMLTable_deleteCaption,
511 HTMLTable_get_readyState,
512 HTMLTable_put_onreadystatechange,
513 HTMLTable_get_onreadystatechange
516 #define HTMLTABLE_NODE_THIS(iface) DEFINE_THIS2(HTMLTable, element.node, iface)
518 static HRESULT HTMLTable_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
520 HTMLTable *This = HTMLTABLE_NODE_THIS(iface);
524 if(IsEqualGUID(&IID_IUnknown, riid)) {
525 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
526 *ppv = HTMLTABLE(This);
527 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
528 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
529 *ppv = HTMLTABLE(This);
530 }else if(IsEqualGUID(&IID_IHTMLTable, riid)) {
531 TRACE("(%p)->(IID_IHTMLTable %p)\n", This, ppv);
532 *ppv = HTMLTABLE(This);
536 IUnknown_AddRef((IUnknown*)*ppv);
540 return HTMLElement_QI(&This->element.node, riid, ppv);
543 static void HTMLTable_destructor(HTMLDOMNode *iface)
545 HTMLTable *This = HTMLTABLE_NODE_THIS(iface);
548 nsIDOMHTMLTableElement_Release(This->nstable);
550 HTMLElement_destructor(&This->element.node);
553 #undef HTMLTABLE_NODE_THIS
555 static const NodeImplVtbl HTMLTableImplVtbl = {
560 static const tid_t HTMLTable_iface_tids[] = {
570 static dispex_static_data_t HTMLTable_dispex = {
577 HTMLElement *HTMLTable_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem)
579 HTMLTable *ret = heap_alloc_zero(sizeof(HTMLTable));
582 ret->element.node.vtbl = &HTMLTableImplVtbl;
583 ret->lpHTMLTableVtbl = &HTMLTableVtbl;
585 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTable_dispex);
587 ConnectionPoint_Init(&ret->cp, &ret->element.cp_container, &DIID_HTMLTableEvents, NULL);
589 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableElement, (void**)&ret->nstable);
591 ERR("Could not get nsIDOMHTMLTableElement iface: %08x\n", nsres);
593 return &ret->element;