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 IHTMLTable IHTMLTable_iface;
40 nsIDOMHTMLTableElement *nstable;
43 static inline HTMLTable *impl_from_IHTMLTable(IHTMLTable *iface)
45 return CONTAINING_RECORD(iface, HTMLTable, IHTMLTable_iface);
48 static HRESULT WINAPI HTMLTable_QueryInterface(IHTMLTable *iface,
49 REFIID riid, void **ppv)
51 HTMLTable *This = impl_from_IHTMLTable(iface);
53 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
56 static ULONG WINAPI HTMLTable_AddRef(IHTMLTable *iface)
58 HTMLTable *This = impl_from_IHTMLTable(iface);
60 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
63 static ULONG WINAPI HTMLTable_Release(IHTMLTable *iface)
65 HTMLTable *This = impl_from_IHTMLTable(iface);
67 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
70 static HRESULT WINAPI HTMLTable_GetTypeInfoCount(IHTMLTable *iface, UINT *pctinfo)
72 HTMLTable *This = impl_from_IHTMLTable(iface);
73 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
76 static HRESULT WINAPI HTMLTable_GetTypeInfo(IHTMLTable *iface, UINT iTInfo,
77 LCID lcid, ITypeInfo **ppTInfo)
79 HTMLTable *This = impl_from_IHTMLTable(iface);
80 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
84 static HRESULT WINAPI HTMLTable_GetIDsOfNames(IHTMLTable *iface, REFIID riid,
85 LPOLESTR *rgszNames, UINT cNames,
86 LCID lcid, DISPID *rgDispId)
88 HTMLTable *This = impl_from_IHTMLTable(iface);
89 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
90 cNames, lcid, rgDispId);
93 static HRESULT WINAPI HTMLTable_Invoke(IHTMLTable *iface, DISPID dispIdMember,
94 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
95 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
97 HTMLTable *This = impl_from_IHTMLTable(iface);
98 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
99 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
102 static HRESULT WINAPI HTMLTable_put_cols(IHTMLTable *iface, LONG v)
104 HTMLTable *This = impl_from_IHTMLTable(iface);
105 FIXME("(%p)->(%d)\n", This, v);
109 static HRESULT WINAPI HTMLTable_get_cols(IHTMLTable *iface, LONG *p)
111 HTMLTable *This = impl_from_IHTMLTable(iface);
112 FIXME("(%p)->(%p)\n", This, p);
116 static HRESULT WINAPI HTMLTable_put_border(IHTMLTable *iface, VARIANT v)
118 HTMLTable *This = impl_from_IHTMLTable(iface);
119 FIXME("(%p)->(v)\n", This);
123 static HRESULT WINAPI HTMLTable_get_border(IHTMLTable *iface, VARIANT *p)
125 HTMLTable *This = impl_from_IHTMLTable(iface);
126 FIXME("(%p)->(%p)\n", This, p);
130 static HRESULT WINAPI HTMLTable_put_frame(IHTMLTable *iface, BSTR v)
132 HTMLTable *This = impl_from_IHTMLTable(iface);
133 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
137 static HRESULT WINAPI HTMLTable_get_frame(IHTMLTable *iface, BSTR *p)
139 HTMLTable *This = impl_from_IHTMLTable(iface);
140 FIXME("(%p)->(%p)\n", This, p);
144 static HRESULT WINAPI HTMLTable_put_rules(IHTMLTable *iface, BSTR v)
146 HTMLTable *This = impl_from_IHTMLTable(iface);
147 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
151 static HRESULT WINAPI HTMLTable_get_rules(IHTMLTable *iface, BSTR *p)
153 HTMLTable *This = impl_from_IHTMLTable(iface);
154 FIXME("(%p)->(%p)\n", This, p);
158 static HRESULT WINAPI HTMLTable_put_cellSpacing(IHTMLTable *iface, VARIANT v)
160 HTMLTable *This = impl_from_IHTMLTable(iface);
161 FIXME("(%p)->(v)\n", This);
165 static HRESULT WINAPI HTMLTable_get_cellSpacing(IHTMLTable *iface, VARIANT *p)
167 HTMLTable *This = impl_from_IHTMLTable(iface);
168 FIXME("(%p)->(%p)\n", This, p);
172 static HRESULT WINAPI HTMLTable_put_cellPadding(IHTMLTable *iface, VARIANT v)
174 HTMLTable *This = impl_from_IHTMLTable(iface);
175 FIXME("(%p)->(v)\n", This);
179 static HRESULT WINAPI HTMLTable_get_cellPadding(IHTMLTable *iface, VARIANT *p)
181 HTMLTable *This = impl_from_IHTMLTable(iface);
182 FIXME("(%p)->(%p)\n", This, p);
186 static HRESULT WINAPI HTMLTable_put_background(IHTMLTable *iface, BSTR v)
188 HTMLTable *This = impl_from_IHTMLTable(iface);
189 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
193 static HRESULT WINAPI HTMLTable_get_background(IHTMLTable *iface, BSTR *p)
195 HTMLTable *This = impl_from_IHTMLTable(iface);
196 FIXME("(%p)->(%p)\n", This, p);
200 static HRESULT WINAPI HTMLTable_put_bgColor(IHTMLTable *iface, VARIANT v)
202 HTMLTable *This = impl_from_IHTMLTable(iface);
203 FIXME("(%p)->(v)\n", This);
207 static HRESULT WINAPI HTMLTable_get_bgColor(IHTMLTable *iface, VARIANT *p)
209 HTMLTable *This = impl_from_IHTMLTable(iface);
210 FIXME("(%p)->(%p)\n", This, p);
214 static HRESULT WINAPI HTMLTable_put_borderColor(IHTMLTable *iface, VARIANT v)
216 HTMLTable *This = impl_from_IHTMLTable(iface);
217 FIXME("(%p)->(v)\n", This);
221 static HRESULT WINAPI HTMLTable_get_borderColor(IHTMLTable *iface, VARIANT *p)
223 HTMLTable *This = impl_from_IHTMLTable(iface);
224 FIXME("(%p)->(%p)\n", This, p);
228 static HRESULT WINAPI HTMLTable_put_borderColorLight(IHTMLTable *iface, VARIANT v)
230 HTMLTable *This = impl_from_IHTMLTable(iface);
231 FIXME("(%p)->(v)\n", This);
235 static HRESULT WINAPI HTMLTable_get_borderColorLight(IHTMLTable *iface, VARIANT *p)
237 HTMLTable *This = impl_from_IHTMLTable(iface);
238 FIXME("(%p)->(%p)\n", This, p);
242 static HRESULT WINAPI HTMLTable_put_borderColorDark(IHTMLTable *iface, VARIANT v)
244 HTMLTable *This = impl_from_IHTMLTable(iface);
245 FIXME("(%p)->(v)\n", This);
249 static HRESULT WINAPI HTMLTable_get_borderColorDark(IHTMLTable *iface, VARIANT *p)
251 HTMLTable *This = impl_from_IHTMLTable(iface);
252 FIXME("(%p)->(%p)\n", This, p);
256 static HRESULT WINAPI HTMLTable_put_align(IHTMLTable *iface, BSTR v)
258 HTMLTable *This = impl_from_IHTMLTable(iface);
259 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
263 static HRESULT WINAPI HTMLTable_get_align(IHTMLTable *iface, BSTR *p)
265 HTMLTable *This = impl_from_IHTMLTable(iface);
266 FIXME("(%p)->(%p)\n", This, p);
270 static HRESULT WINAPI HTMLTable_refresh(IHTMLTable *iface)
272 HTMLTable *This = impl_from_IHTMLTable(iface);
273 FIXME("(%p)\n", This);
277 static HRESULT WINAPI HTMLTable_get_rows(IHTMLTable *iface, IHTMLElementCollection **p)
279 HTMLTable *This = impl_from_IHTMLTable(iface);
280 nsIDOMHTMLCollection *nscol;
283 TRACE("(%p)->(%p)\n", This, p);
285 nsres = nsIDOMHTMLTableElement_GetRows(This->nstable, &nscol);
286 if(NS_FAILED(nsres)) {
287 ERR("GetRows failed: %08x\n", nsres);
291 *p = create_collection_from_htmlcol(This->element.node.doc, (IUnknown*)&This->IHTMLTable_iface,
294 nsIDOMHTMLCollection_Release(nscol);
298 static HRESULT WINAPI HTMLTable_put_width(IHTMLTable *iface, VARIANT v)
300 HTMLTable *This = impl_from_IHTMLTable(iface);
301 FIXME("(%p)->(v)\n", This);
305 static HRESULT WINAPI HTMLTable_get_width(IHTMLTable *iface, VARIANT *p)
307 HTMLTable *This = impl_from_IHTMLTable(iface);
308 FIXME("(%p)->(%p)\n", This, p);
312 static HRESULT WINAPI HTMLTable_put_height(IHTMLTable *iface, VARIANT v)
314 HTMLTable *This = impl_from_IHTMLTable(iface);
315 FIXME("(%p)->(v)\n", This);
319 static HRESULT WINAPI HTMLTable_get_height(IHTMLTable *iface, VARIANT *p)
321 HTMLTable *This = impl_from_IHTMLTable(iface);
322 FIXME("(%p)->(%p)\n", This, p);
326 static HRESULT WINAPI HTMLTable_put_dataPageSize(IHTMLTable *iface, LONG v)
328 HTMLTable *This = impl_from_IHTMLTable(iface);
329 FIXME("(%p)->(%d)\n", This, v);
333 static HRESULT WINAPI HTMLTable_get_dataPageSize(IHTMLTable *iface, LONG *p)
335 HTMLTable *This = impl_from_IHTMLTable(iface);
336 FIXME("(%p)->(%p)\n", This, p);
340 static HRESULT WINAPI HTMLTable_nextPage(IHTMLTable *iface)
342 HTMLTable *This = impl_from_IHTMLTable(iface);
343 FIXME("(%p)\n", This);
347 static HRESULT WINAPI HTMLTable_previousPage(IHTMLTable *iface)
349 HTMLTable *This = impl_from_IHTMLTable(iface);
350 FIXME("(%p)\n", This);
354 static HRESULT WINAPI HTMLTable_get_tHead(IHTMLTable *iface, IHTMLTableSection **p)
356 HTMLTable *This = impl_from_IHTMLTable(iface);
357 FIXME("(%p)->(%p)\n", This, p);
361 static HRESULT WINAPI HTMLTable_get_tFoot(IHTMLTable *iface, IHTMLTableSection **p)
363 HTMLTable *This = impl_from_IHTMLTable(iface);
364 FIXME("(%p)->(%p)\n", This, p);
368 static HRESULT WINAPI HTMLTable_get_tBodies(IHTMLTable *iface, IHTMLElementCollection **p)
370 HTMLTable *This = impl_from_IHTMLTable(iface);
371 FIXME("(%p)->(%p)\n", This, p);
375 static HRESULT WINAPI HTMLTable_get_caption(IHTMLTable *iface, IHTMLTableCaption **p)
377 HTMLTable *This = impl_from_IHTMLTable(iface);
378 FIXME("(%p)->(%p)\n", This, p);
382 static HRESULT WINAPI HTMLTable_createTHead(IHTMLTable *iface, IDispatch **head)
384 HTMLTable *This = impl_from_IHTMLTable(iface);
385 FIXME("(%p)->(%p)\n", This, head);
389 static HRESULT WINAPI HTMLTable_deleteTHead(IHTMLTable *iface)
391 HTMLTable *This = impl_from_IHTMLTable(iface);
392 FIXME("(%p)\n", This);
396 static HRESULT WINAPI HTMLTable_createTFoot(IHTMLTable *iface, IDispatch **foot)
398 HTMLTable *This = impl_from_IHTMLTable(iface);
399 FIXME("(%p)->(%p)\n", This, foot);
403 static HRESULT WINAPI HTMLTable_deleteTFoot(IHTMLTable *iface)
405 HTMLTable *This = impl_from_IHTMLTable(iface);
406 FIXME("(%p)\n", This);
410 static HRESULT WINAPI HTMLTable_createCaption(IHTMLTable *iface, IHTMLTableCaption **caption)
412 HTMLTable *This = impl_from_IHTMLTable(iface);
413 FIXME("(%p)->(%p)\n", This, caption);
417 static HRESULT WINAPI HTMLTable_deleteCaption(IHTMLTable *iface)
419 HTMLTable *This = impl_from_IHTMLTable(iface);
420 FIXME("(%p)\n", This);
424 static HRESULT WINAPI HTMLTable_insertRow(IHTMLTable *iface, LONG index, IDispatch **row)
426 HTMLTable *This = impl_from_IHTMLTable(iface);
427 FIXME("(%p)->(%d %p)\n", This, index, row);
431 static HRESULT WINAPI HTMLTable_deleteRow(IHTMLTable *iface, LONG index)
433 HTMLTable *This = impl_from_IHTMLTable(iface);
434 FIXME("(%p)->(%d)\n", This, index);
438 static HRESULT WINAPI HTMLTable_get_readyState(IHTMLTable *iface, BSTR *p)
440 HTMLTable *This = impl_from_IHTMLTable(iface);
441 FIXME("(%p)->(%p)\n", This, p);
445 static HRESULT WINAPI HTMLTable_put_onreadystatechange(IHTMLTable *iface, VARIANT v)
447 HTMLTable *This = impl_from_IHTMLTable(iface);
448 FIXME("(%p)->(v)\n", This);
452 static HRESULT WINAPI HTMLTable_get_onreadystatechange(IHTMLTable *iface, VARIANT *p)
454 HTMLTable *This = impl_from_IHTMLTable(iface);
455 FIXME("(%p)->(%p)\n", This, p);
459 static const IHTMLTableVtbl HTMLTableVtbl = {
460 HTMLTable_QueryInterface,
463 HTMLTable_GetTypeInfoCount,
464 HTMLTable_GetTypeInfo,
465 HTMLTable_GetIDsOfNames,
469 HTMLTable_put_border,
470 HTMLTable_get_border,
475 HTMLTable_put_cellSpacing,
476 HTMLTable_get_cellSpacing,
477 HTMLTable_put_cellPadding,
478 HTMLTable_get_cellPadding,
479 HTMLTable_put_background,
480 HTMLTable_get_background,
481 HTMLTable_put_bgColor,
482 HTMLTable_get_bgColor,
483 HTMLTable_put_borderColor,
484 HTMLTable_get_borderColor,
485 HTMLTable_put_borderColorLight,
486 HTMLTable_get_borderColorLight,
487 HTMLTable_put_borderColorDark,
488 HTMLTable_get_borderColorDark,
495 HTMLTable_put_height,
496 HTMLTable_get_height,
497 HTMLTable_put_dataPageSize,
498 HTMLTable_get_dataPageSize,
500 HTMLTable_previousPage,
503 HTMLTable_get_tBodies,
504 HTMLTable_get_caption,
505 HTMLTable_createTHead,
506 HTMLTable_deleteTHead,
507 HTMLTable_createTFoot,
508 HTMLTable_deleteTFoot,
509 HTMLTable_createCaption,
510 HTMLTable_deleteCaption,
513 HTMLTable_get_readyState,
514 HTMLTable_put_onreadystatechange,
515 HTMLTable_get_onreadystatechange
518 static inline HTMLTable *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
520 return CONTAINING_RECORD(iface, HTMLTable, element.node);
523 static HRESULT HTMLTable_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
525 HTMLTable *This = impl_from_HTMLDOMNode(iface);
529 if(IsEqualGUID(&IID_IUnknown, riid)) {
530 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
531 *ppv = &This->IHTMLTable_iface;
532 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
533 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
534 *ppv = &This->IHTMLTable_iface;
535 }else if(IsEqualGUID(&IID_IHTMLTable, riid)) {
536 TRACE("(%p)->(IID_IHTMLTable %p)\n", This, ppv);
537 *ppv = &This->IHTMLTable_iface;
541 IUnknown_AddRef((IUnknown*)*ppv);
545 return HTMLElement_QI(&This->element.node, riid, ppv);
548 static void HTMLTable_destructor(HTMLDOMNode *iface)
550 HTMLTable *This = impl_from_HTMLDOMNode(iface);
553 nsIDOMHTMLTableElement_Release(This->nstable);
555 HTMLElement_destructor(&This->element.node);
558 static const NodeImplVtbl HTMLTableImplVtbl = {
560 HTMLTable_destructor,
564 static const tid_t HTMLTable_iface_tids[] = {
570 static dispex_static_data_t HTMLTable_dispex = {
577 HRESULT HTMLTable_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
582 ret = heap_alloc_zero(sizeof(HTMLTable));
584 return E_OUTOFMEMORY;
586 ret->element.node.vtbl = &HTMLTableImplVtbl;
587 ret->IHTMLTable_iface.lpVtbl = &HTMLTableVtbl;
589 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableElement, (void**)&ret->nstable);
590 if(NS_FAILED(nsres)) {
591 ERR("Could not get nsIDOMHTMLTableElement iface: %08x\n", nsres);
596 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTable_dispex);
597 ConnectionPoint_Init(&ret->cp, &ret->element.cp_container, &DIID_HTMLTableEvents, NULL);
599 *elem = &ret->element;