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
29 #include "wine/debug.h"
31 #include "mshtml_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
38 IHTMLTable IHTMLTable_iface
;
39 IHTMLTable2 IHTMLTable2_iface
;
40 IHTMLTable3 IHTMLTable3_iface
;
42 nsIDOMHTMLTableElement
*nstable
;
45 static inline HTMLTable
*impl_from_IHTMLTable(IHTMLTable
*iface
)
47 return CONTAINING_RECORD(iface
, HTMLTable
, IHTMLTable_iface
);
50 static inline HTMLTable
*impl_from_IHTMLTable2(IHTMLTable2
*iface
)
52 return CONTAINING_RECORD(iface
, HTMLTable
, IHTMLTable2_iface
);
55 static inline HTMLTable
*impl_from_IHTMLTable3(IHTMLTable3
*iface
)
57 return CONTAINING_RECORD(iface
, HTMLTable
, IHTMLTable3_iface
);
60 static HRESULT
var2str(const VARIANT
*p
, nsAString
*nsstr
)
68 return nsAString_Init(nsstr
, V_BSTR(p
))?
71 hres
= VarBstrFromR8(V_R8(p
), MAKELCID(MAKELANGID(LANG_ENGLISH
,SUBLANG_ENGLISH_US
),SORT_DEFAULT
), 0, &str
);
74 hres
= VarBstrFromR4(V_R4(p
), MAKELCID(MAKELANGID(LANG_ENGLISH
,SUBLANG_ENGLISH_US
),SORT_DEFAULT
), 0, &str
);
77 hres
= VarBstrFromI4(V_I4(p
), MAKELCID(MAKELANGID(LANG_ENGLISH
,SUBLANG_ENGLISH_US
),SORT_DEFAULT
), 0, &str
);
80 FIXME("unsupported arg %s\n", debugstr_variant(p
));
86 ret
= nsAString_Init(nsstr
, str
);
88 return ret
? S_OK
: E_OUTOFMEMORY
;
91 static HRESULT
nsstr_to_truncated_bstr(const nsAString
*nsstr
, BSTR
*ret_ptr
)
93 const PRUnichar
*str
, *ptr
, *end
= NULL
;
96 nsAString_GetData(nsstr
, &str
);
98 for(ptr
= str
; isdigitW(*ptr
); ptr
++);
100 for(end
= ptr
++; isdigitW(*ptr
); ptr
++);
105 ret
= end
? SysAllocStringLen(str
, end
-str
) : SysAllocString(str
);
108 return ret
? S_OK
: E_OUTOFMEMORY
;
111 static HRESULT WINAPI
HTMLTable_QueryInterface(IHTMLTable
*iface
,
112 REFIID riid
, void **ppv
)
114 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
116 return IHTMLDOMNode_QueryInterface(&This
->element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
119 static ULONG WINAPI
HTMLTable_AddRef(IHTMLTable
*iface
)
121 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
123 return IHTMLDOMNode_AddRef(&This
->element
.node
.IHTMLDOMNode_iface
);
126 static ULONG WINAPI
HTMLTable_Release(IHTMLTable
*iface
)
128 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
130 return IHTMLDOMNode_Release(&This
->element
.node
.IHTMLDOMNode_iface
);
133 static HRESULT WINAPI
HTMLTable_GetTypeInfoCount(IHTMLTable
*iface
, UINT
*pctinfo
)
135 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
136 return IDispatchEx_GetTypeInfoCount(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
139 static HRESULT WINAPI
HTMLTable_GetTypeInfo(IHTMLTable
*iface
, UINT iTInfo
,
140 LCID lcid
, ITypeInfo
**ppTInfo
)
142 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
143 return IDispatchEx_GetTypeInfo(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
,
147 static HRESULT WINAPI
HTMLTable_GetIDsOfNames(IHTMLTable
*iface
, REFIID riid
,
148 LPOLESTR
*rgszNames
, UINT cNames
,
149 LCID lcid
, DISPID
*rgDispId
)
151 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
152 return IDispatchEx_GetIDsOfNames(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
,
153 cNames
, lcid
, rgDispId
);
156 static HRESULT WINAPI
HTMLTable_Invoke(IHTMLTable
*iface
, DISPID dispIdMember
,
157 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
158 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
160 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
161 return IDispatchEx_Invoke(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
,
162 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
165 static HRESULT WINAPI
HTMLTable_put_cols(IHTMLTable
*iface
, LONG v
)
167 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
168 FIXME("(%p)->(%d)\n", This
, v
);
172 static HRESULT WINAPI
HTMLTable_get_cols(IHTMLTable
*iface
, LONG
*p
)
174 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
175 FIXME("(%p)->(%p)\n", This
, p
);
179 static HRESULT WINAPI
HTMLTable_put_border(IHTMLTable
*iface
, VARIANT v
)
181 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
182 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
186 static HRESULT WINAPI
HTMLTable_get_border(IHTMLTable
*iface
, VARIANT
*p
)
188 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
189 FIXME("(%p)->(%p)\n", This
, p
);
193 static HRESULT WINAPI
HTMLTable_put_frame(IHTMLTable
*iface
, BSTR v
)
195 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
199 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
201 nsAString_InitDepend(&str
, v
);
202 nsres
= nsIDOMHTMLTableElement_SetFrame(This
->nstable
, &str
);
203 nsAString_Finish(&str
);
205 if (NS_FAILED(nsres
)) {
206 ERR("SetFrame(%s) failed: %08x\n", debugstr_w(v
), nsres
);
212 static HRESULT WINAPI
HTMLTable_get_frame(IHTMLTable
*iface
, BSTR
*p
)
214 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
218 TRACE("(%p)->(%p)\n", This
, p
);
220 nsAString_Init(&str
, NULL
);
221 nsres
= nsIDOMHTMLTableElement_GetFrame(This
->nstable
, &str
);
223 return return_nsstr(nsres
, &str
, p
);
226 static HRESULT WINAPI
HTMLTable_put_rules(IHTMLTable
*iface
, BSTR v
)
228 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
229 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
233 static HRESULT WINAPI
HTMLTable_get_rules(IHTMLTable
*iface
, BSTR
*p
)
235 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
236 FIXME("(%p)->(%p)\n", This
, p
);
240 static HRESULT WINAPI
HTMLTable_put_cellSpacing(IHTMLTable
*iface
, VARIANT v
)
242 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
247 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
251 nsAString_InitDepend(&nsstr
, V_BSTR(&v
));
254 static const WCHAR formatW
[] = {'%','d',0};
255 sprintfW(buf
, formatW
, V_I4(&v
));
256 nsAString_InitDepend(&nsstr
, buf
);
260 FIXME("unsupported arg %s\n", debugstr_variant(&v
));
264 nsres
= nsIDOMHTMLTableElement_SetCellSpacing(This
->nstable
, &nsstr
);
265 nsAString_Finish(&nsstr
);
266 if(NS_FAILED(nsres
)) {
267 ERR("SetCellSpacing failed: %08x\n", nsres
);
274 static HRESULT WINAPI
HTMLTable_get_cellSpacing(IHTMLTable
*iface
, VARIANT
*p
)
276 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
280 TRACE("(%p)->(%p)\n", This
, p
);
282 nsAString_Init(&nsstr
, NULL
);
283 nsres
= nsIDOMHTMLTableElement_GetCellSpacing(This
->nstable
, &nsstr
);
285 return return_nsstr(nsres
, &nsstr
, &V_BSTR(p
));
288 static HRESULT WINAPI
HTMLTable_put_cellPadding(IHTMLTable
*iface
, VARIANT v
)
290 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
295 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
297 hres
= var2str(&v
, &val
);
301 nsres
= nsIDOMHTMLTableElement_SetCellPadding(This
->nstable
, &val
);
302 nsAString_Finish(&val
);
303 if(NS_FAILED(nsres
)) {
304 ERR("Set Width(%s) failed, err = %08x\n", debugstr_variant(&v
), nsres
);
311 static HRESULT WINAPI
HTMLTable_get_cellPadding(IHTMLTable
*iface
, VARIANT
*p
)
313 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
317 TRACE("(%p)->(%p)\n", This
, p
);
319 nsAString_Init(&val
, NULL
);
320 nsres
= nsIDOMHTMLTableElement_GetCellPadding(This
->nstable
, &val
);
321 return return_nsstr_variant(nsres
, &val
, p
);
324 static HRESULT WINAPI
HTMLTable_put_background(IHTMLTable
*iface
, BSTR v
)
326 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
327 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
331 static HRESULT WINAPI
HTMLTable_get_background(IHTMLTable
*iface
, BSTR
*p
)
333 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
334 FIXME("(%p)->(%p)\n", This
, p
);
338 static HRESULT WINAPI
HTMLTable_put_bgColor(IHTMLTable
*iface
, VARIANT v
)
340 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
344 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
346 if(!variant_to_nscolor(&v
, &val
))
349 nsres
= nsIDOMHTMLTableElement_SetBgColor(This
->nstable
, &val
);
350 nsAString_Finish(&val
);
351 if (NS_FAILED(nsres
)){
352 ERR("Set BgColor(%s) failed!\n", debugstr_variant(&v
));
359 static HRESULT WINAPI
HTMLTable_get_bgColor(IHTMLTable
*iface
, VARIANT
*p
)
361 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
365 const PRUnichar
*color
;
367 TRACE("(%p)->(%p)\n", This
, p
);
369 nsAString_Init(&strColor
, NULL
);
370 nsres
= nsIDOMHTMLTableElement_GetBgColor(This
->nstable
, &strColor
);
372 if(NS_SUCCEEDED(nsres
)) {
373 nsAString_GetData(&strColor
, &color
);
375 hres
= nscolor_to_str(color
, &V_BSTR(p
));
377 ERR("SetBgColor failed: %08x\n", nsres
);
381 nsAString_Finish(&strColor
);
385 static HRESULT WINAPI
HTMLTable_put_borderColor(IHTMLTable
*iface
, VARIANT v
)
387 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
388 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
392 static HRESULT WINAPI
HTMLTable_get_borderColor(IHTMLTable
*iface
, VARIANT
*p
)
394 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
395 FIXME("(%p)->(%p)\n", This
, p
);
399 static HRESULT WINAPI
HTMLTable_put_borderColorLight(IHTMLTable
*iface
, VARIANT v
)
401 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
402 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
406 static HRESULT WINAPI
HTMLTable_get_borderColorLight(IHTMLTable
*iface
, VARIANT
*p
)
408 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
409 FIXME("(%p)->(%p)\n", This
, p
);
413 static HRESULT WINAPI
HTMLTable_put_borderColorDark(IHTMLTable
*iface
, VARIANT v
)
415 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
416 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
420 static HRESULT WINAPI
HTMLTable_get_borderColorDark(IHTMLTable
*iface
, VARIANT
*p
)
422 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
423 FIXME("(%p)->(%p)\n", This
, p
);
427 static HRESULT WINAPI
HTMLTable_put_align(IHTMLTable
*iface
, BSTR v
)
429 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
433 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
435 nsAString_InitDepend(&val
, v
);
437 nsres
= nsIDOMHTMLTableElement_SetAlign(This
->nstable
, &val
);
438 nsAString_Finish(&val
);
439 if (NS_FAILED(nsres
)){
440 ERR("Set Align(%s) failed!\n", debugstr_w(v
));
446 static HRESULT WINAPI
HTMLTable_get_align(IHTMLTable
*iface
, BSTR
*p
)
448 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
452 TRACE("(%p)->(%p)\n", This
, p
);
454 nsAString_Init(&val
, NULL
);
455 nsres
= nsIDOMHTMLTableElement_GetAlign(This
->nstable
, &val
);
457 return return_nsstr(nsres
, &val
, p
);
460 static HRESULT WINAPI
HTMLTable_refresh(IHTMLTable
*iface
)
462 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
463 FIXME("(%p)\n", This
);
467 static HRESULT WINAPI
HTMLTable_get_rows(IHTMLTable
*iface
, IHTMLElementCollection
**p
)
469 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
470 nsIDOMHTMLCollection
*nscol
;
473 TRACE("(%p)->(%p)\n", This
, p
);
475 nsres
= nsIDOMHTMLTableElement_GetRows(This
->nstable
, &nscol
);
476 if(NS_FAILED(nsres
)) {
477 ERR("GetRows failed: %08x\n", nsres
);
481 *p
= create_collection_from_htmlcol(This
->element
.node
.doc
, nscol
);
483 nsIDOMHTMLCollection_Release(nscol
);
487 static HRESULT WINAPI
HTMLTable_put_width(IHTMLTable
*iface
, VARIANT v
)
489 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
494 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
495 hres
= var2str(&v
, &val
);
498 ERR("Set Width(%s) failed when initializing a nsAString, err = %08x\n",
499 debugstr_variant(&v
), hres
);
503 nsres
= nsIDOMHTMLTableElement_SetWidth(This
->nstable
, &val
);
504 nsAString_Finish(&val
);
506 if (NS_FAILED(nsres
)){
507 ERR("Set Width(%s) failed, err = %08x\n", debugstr_variant(&v
), nsres
);
513 static HRESULT WINAPI
HTMLTable_get_width(IHTMLTable
*iface
, VARIANT
*p
)
515 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
521 TRACE("(%p)->(%p)\n", This
, p
);
522 nsAString_Init(&val
, NULL
);
523 nsres
= nsIDOMHTMLTableElement_GetWidth(This
->nstable
, &val
);
524 if (NS_FAILED(nsres
)){
525 ERR("Get Width failed!\n");
526 nsAString_Finish(&val
);
530 hres
= nsstr_to_truncated_bstr(&val
, &bstr
);
531 nsAString_Finish(&val
);
538 static HRESULT WINAPI
HTMLTable_put_height(IHTMLTable
*iface
, VARIANT v
)
540 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
541 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
545 static HRESULT WINAPI
HTMLTable_get_height(IHTMLTable
*iface
, VARIANT
*p
)
547 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
548 FIXME("(%p)->(%p)\n", This
, p
);
552 static HRESULT WINAPI
HTMLTable_put_dataPageSize(IHTMLTable
*iface
, LONG v
)
554 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
555 FIXME("(%p)->(%d)\n", This
, v
);
559 static HRESULT WINAPI
HTMLTable_get_dataPageSize(IHTMLTable
*iface
, LONG
*p
)
561 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
562 FIXME("(%p)->(%p)\n", This
, p
);
566 static HRESULT WINAPI
HTMLTable_nextPage(IHTMLTable
*iface
)
568 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
569 FIXME("(%p)\n", This
);
573 static HRESULT WINAPI
HTMLTable_previousPage(IHTMLTable
*iface
)
575 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
576 FIXME("(%p)\n", This
);
580 static HRESULT WINAPI
HTMLTable_get_tHead(IHTMLTable
*iface
, IHTMLTableSection
**p
)
582 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
583 FIXME("(%p)->(%p)\n", This
, p
);
587 static HRESULT WINAPI
HTMLTable_get_tFoot(IHTMLTable
*iface
, IHTMLTableSection
**p
)
589 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
590 FIXME("(%p)->(%p)\n", This
, p
);
594 static HRESULT WINAPI
HTMLTable_get_tBodies(IHTMLTable
*iface
, IHTMLElementCollection
**p
)
596 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
597 nsIDOMHTMLCollection
*nscol
= NULL
;
600 TRACE("(%p)->(%p)\n", This
, p
);
602 nsres
= nsIDOMHTMLTableElement_GetTBodies(This
->nstable
, &nscol
);
603 if(NS_FAILED(nsres
)) {
604 ERR("GetTBodies failed: %08x\n", nsres
);
608 *p
= create_collection_from_htmlcol(This
->element
.node
.doc
, nscol
);
610 nsIDOMHTMLCollection_Release(nscol
);
614 static HRESULT WINAPI
HTMLTable_get_caption(IHTMLTable
*iface
, IHTMLTableCaption
**p
)
616 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
617 FIXME("(%p)->(%p)\n", This
, p
);
621 static HRESULT WINAPI
HTMLTable_createTHead(IHTMLTable
*iface
, IDispatch
**head
)
623 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
624 FIXME("(%p)->(%p)\n", This
, head
);
628 static HRESULT WINAPI
HTMLTable_deleteTHead(IHTMLTable
*iface
)
630 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
631 FIXME("(%p)\n", This
);
635 static HRESULT WINAPI
HTMLTable_createTFoot(IHTMLTable
*iface
, IDispatch
**foot
)
637 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
638 FIXME("(%p)->(%p)\n", This
, foot
);
642 static HRESULT WINAPI
HTMLTable_deleteTFoot(IHTMLTable
*iface
)
644 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
645 FIXME("(%p)\n", This
);
649 static HRESULT WINAPI
HTMLTable_createCaption(IHTMLTable
*iface
, IHTMLTableCaption
**caption
)
651 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
652 FIXME("(%p)->(%p)\n", This
, caption
);
656 static HRESULT WINAPI
HTMLTable_deleteCaption(IHTMLTable
*iface
)
658 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
659 FIXME("(%p)\n", This
);
663 static HRESULT WINAPI
HTMLTable_insertRow(IHTMLTable
*iface
, LONG index
, IDispatch
**row
)
665 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
666 nsIDOMHTMLElement
*nselem
;
671 TRACE("(%p)->(%d %p)\n", This
, index
, row
);
672 nsres
= nsIDOMHTMLTableElement_InsertRow(This
->nstable
, index
, &nselem
);
673 if(NS_FAILED(nsres
)) {
674 ERR("Insert Row at %d failed: %08x\n", index
, nsres
);
678 hres
= HTMLTableRow_Create(This
->element
.node
.doc
, nselem
, &elem
);
679 nsIDOMHTMLElement_Release(nselem
);
681 ERR("Create TableRow failed: %08x\n", hres
);
685 *row
= (IDispatch
*)&elem
->IHTMLElement_iface
;
689 static HRESULT WINAPI
HTMLTable_deleteRow(IHTMLTable
*iface
, LONG index
)
691 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
694 TRACE("(%p)->(%d)\n", This
, index
);
695 nsres
= nsIDOMHTMLTableElement_DeleteRow(This
->nstable
, index
);
696 if(NS_FAILED(nsres
)) {
697 ERR("Delete Row failed: %08x\n", nsres
);
703 static HRESULT WINAPI
HTMLTable_get_readyState(IHTMLTable
*iface
, BSTR
*p
)
705 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
706 FIXME("(%p)->(%p)\n", This
, p
);
710 static HRESULT WINAPI
HTMLTable_put_onreadystatechange(IHTMLTable
*iface
, VARIANT v
)
712 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
713 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
717 static HRESULT WINAPI
HTMLTable_get_onreadystatechange(IHTMLTable
*iface
, VARIANT
*p
)
719 HTMLTable
*This
= impl_from_IHTMLTable(iface
);
720 FIXME("(%p)->(%p)\n", This
, p
);
724 static const IHTMLTableVtbl HTMLTableVtbl
= {
725 HTMLTable_QueryInterface
,
728 HTMLTable_GetTypeInfoCount
,
729 HTMLTable_GetTypeInfo
,
730 HTMLTable_GetIDsOfNames
,
734 HTMLTable_put_border
,
735 HTMLTable_get_border
,
740 HTMLTable_put_cellSpacing
,
741 HTMLTable_get_cellSpacing
,
742 HTMLTable_put_cellPadding
,
743 HTMLTable_get_cellPadding
,
744 HTMLTable_put_background
,
745 HTMLTable_get_background
,
746 HTMLTable_put_bgColor
,
747 HTMLTable_get_bgColor
,
748 HTMLTable_put_borderColor
,
749 HTMLTable_get_borderColor
,
750 HTMLTable_put_borderColorLight
,
751 HTMLTable_get_borderColorLight
,
752 HTMLTable_put_borderColorDark
,
753 HTMLTable_get_borderColorDark
,
760 HTMLTable_put_height
,
761 HTMLTable_get_height
,
762 HTMLTable_put_dataPageSize
,
763 HTMLTable_get_dataPageSize
,
765 HTMLTable_previousPage
,
768 HTMLTable_get_tBodies
,
769 HTMLTable_get_caption
,
770 HTMLTable_createTHead
,
771 HTMLTable_deleteTHead
,
772 HTMLTable_createTFoot
,
773 HTMLTable_deleteTFoot
,
774 HTMLTable_createCaption
,
775 HTMLTable_deleteCaption
,
778 HTMLTable_get_readyState
,
779 HTMLTable_put_onreadystatechange
,
780 HTMLTable_get_onreadystatechange
784 static HRESULT WINAPI
HTMLTable2_QueryInterface(IHTMLTable2
*iface
,
785 REFIID riid
, void **ppv
)
787 HTMLTable
*This
= impl_from_IHTMLTable2(iface
);
789 return IHTMLDOMNode_QueryInterface(&This
->element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
792 static ULONG WINAPI
HTMLTable2_AddRef(IHTMLTable2
*iface
)
794 HTMLTable
*This
= impl_from_IHTMLTable2(iface
);
796 return IHTMLDOMNode_AddRef(&This
->element
.node
.IHTMLDOMNode_iface
);
799 static ULONG WINAPI
HTMLTable2_Release(IHTMLTable2
*iface
)
801 HTMLTable
*This
= impl_from_IHTMLTable2(iface
);
803 return IHTMLDOMNode_Release(&This
->element
.node
.IHTMLDOMNode_iface
);
806 static HRESULT WINAPI
HTMLTable2_GetTypeInfoCount(IHTMLTable2
*iface
, UINT
*pctinfo
)
808 HTMLTable
*This
= impl_from_IHTMLTable2(iface
);
809 return IDispatchEx_GetTypeInfoCount(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
812 static HRESULT WINAPI
HTMLTable2_GetTypeInfo(IHTMLTable2
*iface
, UINT iTInfo
,
813 LCID lcid
, ITypeInfo
**ppTInfo
)
815 HTMLTable
*This
= impl_from_IHTMLTable2(iface
);
816 return IDispatchEx_GetTypeInfo(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
,
820 static HRESULT WINAPI
HTMLTable2_GetIDsOfNames(IHTMLTable2
*iface
, REFIID riid
,
821 LPOLESTR
*rgszNames
, UINT cNames
,
822 LCID lcid
, DISPID
*rgDispId
)
824 HTMLTable
*This
= impl_from_IHTMLTable2(iface
);
825 return IDispatchEx_GetIDsOfNames(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
,
826 cNames
, lcid
, rgDispId
);
829 static HRESULT WINAPI
HTMLTable2_Invoke(IHTMLTable2
*iface
, DISPID dispIdMember
,
830 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
831 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
833 HTMLTable
*This
= impl_from_IHTMLTable2(iface
);
834 return IDispatchEx_Invoke(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
,
835 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
838 static HRESULT WINAPI
HTMLTable2_firstPage(IHTMLTable2
*iface
)
840 HTMLTable
*This
= impl_from_IHTMLTable2(iface
);
841 FIXME("(%p)->()\n", This
);
845 static HRESULT WINAPI
HTMLTable2_lastPage(IHTMLTable2
*iface
)
847 HTMLTable
*This
= impl_from_IHTMLTable2(iface
);
848 FIXME("(%p)->()\n", This
);
852 static HRESULT WINAPI
HTMLTable2_cells(IHTMLTable2
*iface
, IHTMLElementCollection
**p
)
854 HTMLTable
*This
= impl_from_IHTMLTable2(iface
);
855 FIXME("(%p)->(%p)\n", This
, p
);
859 static HRESULT WINAPI
HTMLTable2_moveRow(IHTMLTable2
*iface
, LONG indexFrom
, LONG indexTo
, IDispatch
**row
)
861 HTMLTable
*This
= impl_from_IHTMLTable2(iface
);
862 FIXME("(%p)->(%d %d %p)\n", This
, indexFrom
, indexTo
, row
);
867 static const IHTMLTable2Vtbl HTMLTable2Vtbl
= {
868 HTMLTable2_QueryInterface
,
871 HTMLTable2_GetTypeInfoCount
,
872 HTMLTable2_GetTypeInfo
,
873 HTMLTable2_GetIDsOfNames
,
875 HTMLTable2_firstPage
,
882 static HRESULT WINAPI
HTMLTable3_QueryInterface(IHTMLTable3
*iface
,
883 REFIID riid
, void **ppv
)
885 HTMLTable
*This
= impl_from_IHTMLTable3(iface
);
887 return IHTMLDOMNode_QueryInterface(&This
->element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
890 static ULONG WINAPI
HTMLTable3_AddRef(IHTMLTable3
*iface
)
892 HTMLTable
*This
= impl_from_IHTMLTable3(iface
);
894 return IHTMLDOMNode_AddRef(&This
->element
.node
.IHTMLDOMNode_iface
);
897 static ULONG WINAPI
HTMLTable3_Release(IHTMLTable3
*iface
)
899 HTMLTable
*This
= impl_from_IHTMLTable3(iface
);
901 return IHTMLDOMNode_Release(&This
->element
.node
.IHTMLDOMNode_iface
);
904 static HRESULT WINAPI
HTMLTable3_GetTypeInfoCount(IHTMLTable3
*iface
, UINT
*pctinfo
)
906 HTMLTable
*This
= impl_from_IHTMLTable3(iface
);
907 return IDispatchEx_GetTypeInfoCount(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
910 static HRESULT WINAPI
HTMLTable3_GetTypeInfo(IHTMLTable3
*iface
, UINT iTInfo
,
911 LCID lcid
, ITypeInfo
**ppTInfo
)
913 HTMLTable
*This
= impl_from_IHTMLTable3(iface
);
914 return IDispatchEx_GetTypeInfo(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
,
918 static HRESULT WINAPI
HTMLTable3_GetIDsOfNames(IHTMLTable3
*iface
, REFIID riid
,
919 LPOLESTR
*rgszNames
, UINT cNames
,
920 LCID lcid
, DISPID
*rgDispId
)
922 HTMLTable
*This
= impl_from_IHTMLTable3(iface
);
923 return IDispatchEx_GetIDsOfNames(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
,
924 cNames
, lcid
, rgDispId
);
927 static HRESULT WINAPI
HTMLTable3_Invoke(IHTMLTable3
*iface
, DISPID dispIdMember
,
928 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
929 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
931 HTMLTable
*This
= impl_from_IHTMLTable3(iface
);
932 return IDispatchEx_Invoke(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
,
933 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
936 static HRESULT WINAPI
HTMLTable3_put_summary(IHTMLTable3
*iface
, BSTR v
)
938 HTMLTable
*This
= impl_from_IHTMLTable3(iface
);
942 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
944 nsAString_InitDepend(&str
, v
);
946 nsres
= nsIDOMHTMLTableElement_SetSummary(This
->nstable
, &str
);
948 nsAString_Finish(&str
);
949 if (NS_FAILED(nsres
)) {
950 ERR("Set summary(%s) failed: %08x\n", debugstr_w(v
), nsres
);
956 static HRESULT WINAPI
HTMLTable3_get_summary(IHTMLTable3
*iface
, BSTR
* p
)
958 HTMLTable
*This
= impl_from_IHTMLTable3(iface
);
962 TRACE("(%p)->(%p)\n", This
, p
);
964 nsAString_Init(&str
, NULL
);
965 nsres
= nsIDOMHTMLTableElement_GetSummary(This
->nstable
, &str
);
967 return return_nsstr(nsres
, &str
, p
);
970 static const IHTMLTable3Vtbl HTMLTable3Vtbl
= {
971 HTMLTable3_QueryInterface
,
974 HTMLTable3_GetTypeInfoCount
,
975 HTMLTable3_GetTypeInfo
,
976 HTMLTable3_GetIDsOfNames
,
978 HTMLTable3_put_summary
,
979 HTMLTable3_get_summary
982 static inline HTMLTable
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
984 return CONTAINING_RECORD(iface
, HTMLTable
, element
.node
);
987 static HRESULT
HTMLTable_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
989 HTMLTable
*This
= impl_from_HTMLDOMNode(iface
);
993 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
994 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
995 *ppv
= &This
->IHTMLTable_iface
;
996 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
997 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
998 *ppv
= &This
->IHTMLTable_iface
;
999 }else if(IsEqualGUID(&IID_IHTMLTable
, riid
)) {
1000 TRACE("(%p)->(IID_IHTMLTable %p)\n", This
, ppv
);
1001 *ppv
= &This
->IHTMLTable_iface
;
1002 }else if(IsEqualGUID(&IID_IHTMLTable2
, riid
)) {
1003 TRACE("(%p)->(IID_IHTMLTable2 %p)\n", This
, ppv
);
1004 *ppv
= &This
->IHTMLTable2_iface
;
1005 }else if(IsEqualGUID(&IID_IHTMLTable3
, riid
)) {
1006 TRACE("(%p)->(IID_IHTMLTable3 %p)\n", This
, ppv
);
1007 *ppv
= &This
->IHTMLTable3_iface
;
1011 IUnknown_AddRef((IUnknown
*)*ppv
);
1015 return HTMLElement_QI(&This
->element
.node
, riid
, ppv
);
1018 static void HTMLTable_traverse(HTMLDOMNode
*iface
, nsCycleCollectionTraversalCallback
*cb
)
1020 HTMLTable
*This
= impl_from_HTMLDOMNode(iface
);
1023 note_cc_edge((nsISupports
*)This
->nstable
, "This->nstable", cb
);
1026 static void HTMLTable_unlink(HTMLDOMNode
*iface
)
1028 HTMLTable
*This
= impl_from_HTMLDOMNode(iface
);
1031 nsIDOMHTMLTableElement
*nstable
= This
->nstable
;
1033 This
->nstable
= NULL
;
1034 nsIDOMHTMLTableElement_Release(nstable
);
1038 static const cpc_entry_t HTMLTable_cpc
[] = {
1039 {&DIID_HTMLTableEvents
},
1044 static const NodeImplVtbl HTMLTableImplVtbl
= {
1047 HTMLElement_destructor
,
1050 HTMLElement_handle_event
,
1051 HTMLElement_get_attr_col
,
1064 static const tid_t HTMLTable_iface_tids
[] = {
1072 static dispex_static_data_t HTMLTable_dispex
= {
1075 HTMLTable_iface_tids
,
1076 HTMLElement_init_dispex_info
1079 HRESULT
HTMLTable_Create(HTMLDocumentNode
*doc
, nsIDOMHTMLElement
*nselem
, HTMLElement
**elem
)
1084 ret
= heap_alloc_zero(sizeof(HTMLTable
));
1086 return E_OUTOFMEMORY
;
1088 ret
->element
.node
.vtbl
= &HTMLTableImplVtbl
;
1089 ret
->IHTMLTable_iface
.lpVtbl
= &HTMLTableVtbl
;
1090 ret
->IHTMLTable2_iface
.lpVtbl
= &HTMLTable2Vtbl
;
1091 ret
->IHTMLTable3_iface
.lpVtbl
= &HTMLTable3Vtbl
;
1093 HTMLElement_Init(&ret
->element
, doc
, nselem
, &HTMLTable_dispex
);
1095 nsres
= nsIDOMHTMLElement_QueryInterface(nselem
, &IID_nsIDOMHTMLTableElement
, (void**)&ret
->nstable
);
1096 assert(nsres
== NS_OK
);
1098 *elem
= &ret
->element
;