2 * Copyright 2008 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 IHTMLTableRow IHTMLTableRow_iface
;
40 nsIDOMHTMLTableRowElement
*nsrow
;
43 static inline HTMLTableRow
*impl_from_IHTMLTableRow(IHTMLTableRow
*iface
)
45 return CONTAINING_RECORD(iface
, HTMLTableRow
, IHTMLTableRow_iface
);
48 static HRESULT WINAPI
HTMLTableRow_QueryInterface(IHTMLTableRow
*iface
,
49 REFIID riid
, void **ppv
)
51 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
53 return IHTMLDOMNode_QueryInterface(&This
->element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
56 static ULONG WINAPI
HTMLTableRow_AddRef(IHTMLTableRow
*iface
)
58 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
60 return IHTMLDOMNode_AddRef(&This
->element
.node
.IHTMLDOMNode_iface
);
63 static ULONG WINAPI
HTMLTableRow_Release(IHTMLTableRow
*iface
)
65 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
67 return IHTMLDOMNode_Release(&This
->element
.node
.IHTMLDOMNode_iface
);
70 static HRESULT WINAPI
HTMLTableRow_GetTypeInfoCount(IHTMLTableRow
*iface
, UINT
*pctinfo
)
72 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
73 return IDispatchEx_GetTypeInfoCount(&This
->element
.node
.dispex
.IDispatchEx_iface
, pctinfo
);
76 static HRESULT WINAPI
HTMLTableRow_GetTypeInfo(IHTMLTableRow
*iface
, UINT iTInfo
,
77 LCID lcid
, ITypeInfo
**ppTInfo
)
79 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
80 return IDispatchEx_GetTypeInfo(&This
->element
.node
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
,
84 static HRESULT WINAPI
HTMLTableRow_GetIDsOfNames(IHTMLTableRow
*iface
, REFIID riid
,
85 LPOLESTR
*rgszNames
, UINT cNames
,
86 LCID lcid
, DISPID
*rgDispId
)
88 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
89 return IDispatchEx_GetIDsOfNames(&This
->element
.node
.dispex
.IDispatchEx_iface
, riid
, rgszNames
,
90 cNames
, lcid
, rgDispId
);
93 static HRESULT WINAPI
HTMLTableRow_Invoke(IHTMLTableRow
*iface
, DISPID dispIdMember
,
94 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
95 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
97 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
98 return IDispatchEx_Invoke(&This
->element
.node
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
,
99 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
102 static HRESULT WINAPI
HTMLTableRow_put_align(IHTMLTableRow
*iface
, BSTR v
)
104 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
105 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
109 static HRESULT WINAPI
HTMLTableRow_get_align(IHTMLTableRow
*iface
, BSTR
*p
)
111 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
112 FIXME("(%p)->(%p)\n", This
, p
);
116 static HRESULT WINAPI
HTMLTableRow_put_vAlign(IHTMLTableRow
*iface
, BSTR v
)
118 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
119 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
123 static HRESULT WINAPI
HTMLTableRow_get_vAlign(IHTMLTableRow
*iface
, BSTR
*p
)
125 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
126 FIXME("(%p)->(%p)\n", This
, p
);
130 static HRESULT WINAPI
HTMLTableRow_put_bgColor(IHTMLTableRow
*iface
, VARIANT v
)
132 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
133 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
137 static HRESULT WINAPI
HTMLTableRow_get_bgColor(IHTMLTableRow
*iface
, VARIANT
*p
)
139 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
140 FIXME("(%p)->(%p)\n", This
, p
);
144 static HRESULT WINAPI
HTMLTableRow_put_borderColor(IHTMLTableRow
*iface
, VARIANT v
)
146 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
147 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
151 static HRESULT WINAPI
HTMLTableRow_get_borderColor(IHTMLTableRow
*iface
, VARIANT
*p
)
153 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
154 FIXME("(%p)->(%p)\n", This
, p
);
158 static HRESULT WINAPI
HTMLTableRow_put_borderColorLight(IHTMLTableRow
*iface
, VARIANT v
)
160 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
161 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
165 static HRESULT WINAPI
HTMLTableRow_get_borderColorLight(IHTMLTableRow
*iface
, VARIANT
*p
)
167 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
168 FIXME("(%p)->(%p)\n", This
, p
);
172 static HRESULT WINAPI
HTMLTableRow_put_borderColorDark(IHTMLTableRow
*iface
, VARIANT v
)
174 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
175 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
179 static HRESULT WINAPI
HTMLTableRow_get_borderColorDark(IHTMLTableRow
*iface
, VARIANT
*p
)
181 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
182 FIXME("(%p)->(%p)\n", This
, p
);
186 static HRESULT WINAPI
HTMLTableRow_get_rowIndex(IHTMLTableRow
*iface
, LONG
*p
)
188 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
189 FIXME("(%p)->(%p)\n", This
, p
);
193 static HRESULT WINAPI
HTMLTableRow_get_selectionRowIndex(IHTMLTableRow
*iface
, LONG
*p
)
195 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
196 FIXME("(%p)->(%p)\n", This
, p
);
200 static HRESULT WINAPI
HTMLTableRow_get_cells(IHTMLTableRow
*iface
, IHTMLElementCollection
**p
)
202 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
203 nsIDOMHTMLCollection
*nscol
;
206 TRACE("(%p)->(%p)\n", This
, p
);
208 nsres
= nsIDOMHTMLTableRowElement_GetCells(This
->nsrow
, &nscol
);
209 if(NS_FAILED(nsres
)) {
210 ERR("GetCells failed: %08x\n", nsres
);
214 *p
= create_collection_from_htmlcol(This
->element
.node
.doc
, nscol
);
216 nsIDOMHTMLCollection_Release(nscol
);
220 static HRESULT WINAPI
HTMLTableRow_insertCell(IHTMLTableRow
*iface
, LONG index
, IDispatch
**row
)
222 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
223 FIXME("(%p)->(%d %p)\n", This
, index
, row
);
227 static HRESULT WINAPI
HTMLTableRow_deleteCell(IHTMLTableRow
*iface
, LONG index
)
229 HTMLTableRow
*This
= impl_from_IHTMLTableRow(iface
);
230 FIXME("(%p)->(%d)\n", This
, index
);
234 static const IHTMLTableRowVtbl HTMLTableRowVtbl
= {
235 HTMLTableRow_QueryInterface
,
237 HTMLTableRow_Release
,
238 HTMLTableRow_GetTypeInfoCount
,
239 HTMLTableRow_GetTypeInfo
,
240 HTMLTableRow_GetIDsOfNames
,
242 HTMLTableRow_put_align
,
243 HTMLTableRow_get_align
,
244 HTMLTableRow_put_vAlign
,
245 HTMLTableRow_get_vAlign
,
246 HTMLTableRow_put_bgColor
,
247 HTMLTableRow_get_bgColor
,
248 HTMLTableRow_put_borderColor
,
249 HTMLTableRow_get_borderColor
,
250 HTMLTableRow_put_borderColorLight
,
251 HTMLTableRow_get_borderColorLight
,
252 HTMLTableRow_put_borderColorDark
,
253 HTMLTableRow_get_borderColorDark
,
254 HTMLTableRow_get_rowIndex
,
255 HTMLTableRow_get_selectionRowIndex
,
256 HTMLTableRow_get_cells
,
257 HTMLTableRow_insertCell
,
258 HTMLTableRow_deleteCell
261 static inline HTMLTableRow
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
263 return CONTAINING_RECORD(iface
, HTMLTableRow
, element
.node
);
266 static HRESULT
HTMLTableRow_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
268 HTMLTableRow
*This
= impl_from_HTMLDOMNode(iface
);
272 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
273 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
274 *ppv
= &This
->IHTMLTableRow_iface
;
275 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
276 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
277 *ppv
= &This
->IHTMLTableRow_iface
;
278 }else if(IsEqualGUID(&IID_IHTMLTableRow
, riid
)) {
279 TRACE("(%p)->(IID_IHTMLTableRow %p)\n", This
, ppv
);
280 *ppv
= &This
->IHTMLTableRow_iface
;
284 IUnknown_AddRef((IUnknown
*)*ppv
);
288 return HTMLElement_QI(&This
->element
.node
, riid
, ppv
);
291 static const NodeImplVtbl HTMLTableRowImplVtbl
= {
293 HTMLElement_destructor
,
296 HTMLElement_handle_event
,
297 HTMLElement_get_attr_col
300 static const tid_t HTMLTableRow_iface_tids
[] = {
306 static dispex_static_data_t HTMLTableRow_dispex
= {
308 DispHTMLTableRow_tid
,
310 HTMLTableRow_iface_tids
313 HRESULT
HTMLTableRow_Create(HTMLDocumentNode
*doc
, nsIDOMHTMLElement
*nselem
, HTMLElement
**elem
)
318 ret
= heap_alloc_zero(sizeof(HTMLTableRow
));
320 return E_OUTOFMEMORY
;
322 ret
->IHTMLTableRow_iface
.lpVtbl
= &HTMLTableRowVtbl
;
323 ret
->element
.node
.vtbl
= &HTMLTableRowImplVtbl
;
325 HTMLElement_Init(&ret
->element
, doc
, nselem
, &HTMLTableRow_dispex
);
327 nsres
= nsIDOMHTMLElement_QueryInterface(nselem
, &IID_nsIDOMHTMLTableRowElement
, (void**)&ret
->nsrow
);
329 /* Share nsrow reference with nsnode */
330 assert(nsres
== NS_OK
&& (nsIDOMNode
*)ret
->nsrow
== ret
->element
.node
.nsnode
);
331 nsIDOMNode_Release(ret
->element
.node
.nsnode
);
333 *elem
= &ret
->element
;