winedump: Fix printing of module sources in PDB files.
[wine.git] / dlls / mshtml / htmltable.c
blob5e25373fee45741b5a63c7734a026ad22c4d9e4e
1 /*
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
19 #include <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34 struct HTMLTable {
35 HTMLElement element;
37 IHTMLTable IHTMLTable_iface;
39 ConnectionPoint cp;
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,
81 ppTInfo);
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);
106 return E_NOTIMPL;
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);
113 return E_NOTIMPL;
116 static HRESULT WINAPI HTMLTable_put_border(IHTMLTable *iface, VARIANT v)
118 HTMLTable *This = impl_from_IHTMLTable(iface);
119 FIXME("(%p)->(v)\n", This);
120 return E_NOTIMPL;
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);
127 return E_NOTIMPL;
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));
134 return E_NOTIMPL;
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);
141 return E_NOTIMPL;
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));
148 return E_NOTIMPL;
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);
155 return E_NOTIMPL;
158 static HRESULT WINAPI HTMLTable_put_cellSpacing(IHTMLTable *iface, VARIANT v)
160 HTMLTable *This = impl_from_IHTMLTable(iface);
161 FIXME("(%p)->(v)\n", This);
162 return E_NOTIMPL;
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);
169 return E_NOTIMPL;
172 static HRESULT WINAPI HTMLTable_put_cellPadding(IHTMLTable *iface, VARIANT v)
174 HTMLTable *This = impl_from_IHTMLTable(iface);
175 FIXME("(%p)->(v)\n", This);
176 return E_NOTIMPL;
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);
183 return E_NOTIMPL;
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));
190 return E_NOTIMPL;
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);
197 return E_NOTIMPL;
200 static HRESULT WINAPI HTMLTable_put_bgColor(IHTMLTable *iface, VARIANT v)
202 HTMLTable *This = impl_from_IHTMLTable(iface);
203 FIXME("(%p)->(v)\n", This);
204 return E_NOTIMPL;
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);
211 return E_NOTIMPL;
214 static HRESULT WINAPI HTMLTable_put_borderColor(IHTMLTable *iface, VARIANT v)
216 HTMLTable *This = impl_from_IHTMLTable(iface);
217 FIXME("(%p)->(v)\n", This);
218 return E_NOTIMPL;
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);
225 return E_NOTIMPL;
228 static HRESULT WINAPI HTMLTable_put_borderColorLight(IHTMLTable *iface, VARIANT v)
230 HTMLTable *This = impl_from_IHTMLTable(iface);
231 FIXME("(%p)->(v)\n", This);
232 return E_NOTIMPL;
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);
239 return E_NOTIMPL;
242 static HRESULT WINAPI HTMLTable_put_borderColorDark(IHTMLTable *iface, VARIANT v)
244 HTMLTable *This = impl_from_IHTMLTable(iface);
245 FIXME("(%p)->(v)\n", This);
246 return E_NOTIMPL;
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);
253 return E_NOTIMPL;
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));
260 return E_NOTIMPL;
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);
267 return E_NOTIMPL;
270 static HRESULT WINAPI HTMLTable_refresh(IHTMLTable *iface)
272 HTMLTable *This = impl_from_IHTMLTable(iface);
273 FIXME("(%p)\n", This);
274 return E_NOTIMPL;
277 static HRESULT WINAPI HTMLTable_get_rows(IHTMLTable *iface, IHTMLElementCollection **p)
279 HTMLTable *This = impl_from_IHTMLTable(iface);
280 nsIDOMHTMLCollection *nscol;
281 nsresult nsres;
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);
288 return E_FAIL;
291 *p = create_collection_from_htmlcol(This->element.node.doc, (IUnknown*)&This->IHTMLTable_iface,
292 nscol);
294 nsIDOMHTMLCollection_Release(nscol);
295 return S_OK;
298 static HRESULT WINAPI HTMLTable_put_width(IHTMLTable *iface, VARIANT v)
300 HTMLTable *This = impl_from_IHTMLTable(iface);
301 FIXME("(%p)->(v)\n", This);
302 return E_NOTIMPL;
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);
309 return E_NOTIMPL;
312 static HRESULT WINAPI HTMLTable_put_height(IHTMLTable *iface, VARIANT v)
314 HTMLTable *This = impl_from_IHTMLTable(iface);
315 FIXME("(%p)->(v)\n", This);
316 return E_NOTIMPL;
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);
323 return E_NOTIMPL;
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);
330 return E_NOTIMPL;
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);
337 return E_NOTIMPL;
340 static HRESULT WINAPI HTMLTable_nextPage(IHTMLTable *iface)
342 HTMLTable *This = impl_from_IHTMLTable(iface);
343 FIXME("(%p)\n", This);
344 return E_NOTIMPL;
347 static HRESULT WINAPI HTMLTable_previousPage(IHTMLTable *iface)
349 HTMLTable *This = impl_from_IHTMLTable(iface);
350 FIXME("(%p)\n", This);
351 return E_NOTIMPL;
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);
358 return E_NOTIMPL;
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);
365 return E_NOTIMPL;
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);
372 return E_NOTIMPL;
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);
379 return E_NOTIMPL;
382 static HRESULT WINAPI HTMLTable_createTHead(IHTMLTable *iface, IDispatch **head)
384 HTMLTable *This = impl_from_IHTMLTable(iface);
385 FIXME("(%p)->(%p)\n", This, head);
386 return E_NOTIMPL;
389 static HRESULT WINAPI HTMLTable_deleteTHead(IHTMLTable *iface)
391 HTMLTable *This = impl_from_IHTMLTable(iface);
392 FIXME("(%p)\n", This);
393 return E_NOTIMPL;
396 static HRESULT WINAPI HTMLTable_createTFoot(IHTMLTable *iface, IDispatch **foot)
398 HTMLTable *This = impl_from_IHTMLTable(iface);
399 FIXME("(%p)->(%p)\n", This, foot);
400 return E_NOTIMPL;
403 static HRESULT WINAPI HTMLTable_deleteTFoot(IHTMLTable *iface)
405 HTMLTable *This = impl_from_IHTMLTable(iface);
406 FIXME("(%p)\n", This);
407 return E_NOTIMPL;
410 static HRESULT WINAPI HTMLTable_createCaption(IHTMLTable *iface, IHTMLTableCaption **caption)
412 HTMLTable *This = impl_from_IHTMLTable(iface);
413 FIXME("(%p)->(%p)\n", This, caption);
414 return E_NOTIMPL;
417 static HRESULT WINAPI HTMLTable_deleteCaption(IHTMLTable *iface)
419 HTMLTable *This = impl_from_IHTMLTable(iface);
420 FIXME("(%p)\n", This);
421 return E_NOTIMPL;
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);
428 return E_NOTIMPL;
431 static HRESULT WINAPI HTMLTable_deleteRow(IHTMLTable *iface, LONG index)
433 HTMLTable *This = impl_from_IHTMLTable(iface);
434 FIXME("(%p)->(%d)\n", This, index);
435 return E_NOTIMPL;
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);
442 return E_NOTIMPL;
445 static HRESULT WINAPI HTMLTable_put_onreadystatechange(IHTMLTable *iface, VARIANT v)
447 HTMLTable *This = impl_from_IHTMLTable(iface);
448 FIXME("(%p)->(v)\n", This);
449 return E_NOTIMPL;
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);
456 return E_NOTIMPL;
459 static const IHTMLTableVtbl HTMLTableVtbl = {
460 HTMLTable_QueryInterface,
461 HTMLTable_AddRef,
462 HTMLTable_Release,
463 HTMLTable_GetTypeInfoCount,
464 HTMLTable_GetTypeInfo,
465 HTMLTable_GetIDsOfNames,
466 HTMLTable_Invoke,
467 HTMLTable_put_cols,
468 HTMLTable_get_cols,
469 HTMLTable_put_border,
470 HTMLTable_get_border,
471 HTMLTable_put_frame,
472 HTMLTable_get_frame,
473 HTMLTable_put_rules,
474 HTMLTable_get_rules,
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,
489 HTMLTable_put_align,
490 HTMLTable_get_align,
491 HTMLTable_refresh,
492 HTMLTable_get_rows,
493 HTMLTable_put_width,
494 HTMLTable_get_width,
495 HTMLTable_put_height,
496 HTMLTable_get_height,
497 HTMLTable_put_dataPageSize,
498 HTMLTable_get_dataPageSize,
499 HTMLTable_nextPage,
500 HTMLTable_previousPage,
501 HTMLTable_get_tHead,
502 HTMLTable_get_tFoot,
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,
511 HTMLTable_insertRow,
512 HTMLTable_deleteRow,
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);
527 *ppv = NULL;
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;
540 if(*ppv) {
541 IUnknown_AddRef((IUnknown*)*ppv);
542 return S_OK;
545 return HTMLElement_QI(&This->element.node, riid, ppv);
548 static void HTMLTable_destructor(HTMLDOMNode *iface)
550 HTMLTable *This = impl_from_HTMLDOMNode(iface);
552 if(This->nstable)
553 nsIDOMHTMLTableElement_Release(This->nstable);
555 HTMLElement_destructor(&This->element.node);
558 static const NodeImplVtbl HTMLTableImplVtbl = {
559 HTMLTable_QI,
560 HTMLTable_destructor,
561 HTMLElement_clone,
564 static const tid_t HTMLTable_iface_tids[] = {
565 HTMLELEMENT_TIDS,
566 IHTMLTable_tid,
570 static dispex_static_data_t HTMLTable_dispex = {
571 NULL,
572 DispHTMLTable_tid,
573 NULL,
574 HTMLTable_iface_tids
577 HRESULT HTMLTable_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
579 HTMLTable *ret;
580 nsresult nsres;
582 ret = heap_alloc_zero(sizeof(HTMLTable));
583 if(!ret)
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);
592 heap_free(ret);
593 return E_FAIL;
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;
600 return S_OK;