wineconsole: Free registry key name (valgrind).
[wine.git] / dlls / mshtml / htmltablecell.c
blobe023e318a576913367bd0716200df61f13736b12
1 /*
2 * Copyright 2012 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>
20 #include <assert.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
29 #include "wine/debug.h"
31 #include "mshtml_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
35 typedef struct {
36 HTMLElement element;
38 IHTMLTableCell IHTMLTableCell_iface;
40 nsIDOMHTMLTableCellElement *nscell;
41 } HTMLTableCell;
43 static inline HTMLTableCell *impl_from_IHTMLTableCell(IHTMLTableCell *iface)
45 return CONTAINING_RECORD(iface, HTMLTableCell, IHTMLTableCell_iface);
48 static HRESULT WINAPI HTMLTableCell_QueryInterface(IHTMLTableCell *iface, REFIID riid, void **ppv)
50 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
52 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
55 static ULONG WINAPI HTMLTableCell_AddRef(IHTMLTableCell *iface)
57 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
59 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
62 static ULONG WINAPI HTMLTableCell_Release(IHTMLTableCell *iface)
64 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
66 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
69 static HRESULT WINAPI HTMLTableCell_GetTypeInfoCount(IHTMLTableCell *iface, UINT *pctinfo)
71 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
72 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
75 static HRESULT WINAPI HTMLTableCell_GetTypeInfo(IHTMLTableCell *iface, UINT iTInfo,
76 LCID lcid, ITypeInfo **ppTInfo)
78 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
79 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
80 ppTInfo);
83 static HRESULT WINAPI HTMLTableCell_GetIDsOfNames(IHTMLTableCell *iface, REFIID riid,
84 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
86 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
87 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
88 cNames, lcid, rgDispId);
91 static HRESULT WINAPI HTMLTableCell_Invoke(IHTMLTableCell *iface, DISPID dispIdMember, REFIID riid,
92 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
93 UINT *puArgErr)
95 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
96 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
97 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
100 static HRESULT WINAPI HTMLTableCell_put_rowSpan(IHTMLTableCell *iface, LONG v)
102 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
103 FIXME("(%p)->(%d)\n", This, v);
104 return E_NOTIMPL;
107 static HRESULT WINAPI HTMLTableCell_get_rowSpan(IHTMLTableCell *iface, LONG *p)
109 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
110 FIXME("(%p)->(%p)\n", This, p);
111 return E_NOTIMPL;
114 static HRESULT WINAPI HTMLTableCell_put_colSpan(IHTMLTableCell *iface, LONG v)
116 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
117 FIXME("(%p)->(%d)\n", This, v);
118 return E_NOTIMPL;
121 static HRESULT WINAPI HTMLTableCell_get_colSpan(IHTMLTableCell *iface, LONG *p)
123 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
124 FIXME("(%p)->(%p)\n", This, p);
125 return E_NOTIMPL;
128 static HRESULT WINAPI HTMLTableCell_put_align(IHTMLTableCell *iface, BSTR v)
130 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
131 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
132 return E_NOTIMPL;
135 static HRESULT WINAPI HTMLTableCell_get_align(IHTMLTableCell *iface, BSTR *p)
137 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
138 FIXME("(%p)->(%p)\n", This, p);
139 return E_NOTIMPL;
142 static HRESULT WINAPI HTMLTableCell_put_vAlign(IHTMLTableCell *iface, BSTR v)
144 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
145 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
146 return E_NOTIMPL;
149 static HRESULT WINAPI HTMLTableCell_get_vAlign(IHTMLTableCell *iface, BSTR *p)
151 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
152 FIXME("(%p)->(%p)\n", This, p);
153 return E_NOTIMPL;
156 static HRESULT WINAPI HTMLTableCell_put_bgColor(IHTMLTableCell *iface, VARIANT v)
158 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
159 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
160 return E_NOTIMPL;
163 static HRESULT WINAPI HTMLTableCell_get_bgColor(IHTMLTableCell *iface, VARIANT *p)
165 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
166 FIXME("(%p)->(%p)\n", This, p);
167 return E_NOTIMPL;
170 static HRESULT WINAPI HTMLTableCell_put_noWrap(IHTMLTableCell *iface, VARIANT_BOOL v)
172 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
173 FIXME("(%p)->(%x)\n", This, v);
174 return E_NOTIMPL;
177 static HRESULT WINAPI HTMLTableCell_get_noWrap(IHTMLTableCell *iface, VARIANT_BOOL *p)
179 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
180 FIXME("(%p)->(%p)\n", This, p);
181 return E_NOTIMPL;
184 static HRESULT WINAPI HTMLTableCell_put_background(IHTMLTableCell *iface, BSTR v)
186 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
187 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
188 return E_NOTIMPL;
191 static HRESULT WINAPI HTMLTableCell_get_background(IHTMLTableCell *iface, BSTR *p)
193 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
194 FIXME("(%p)->(%p)\n", This, p);
195 return E_NOTIMPL;
198 static HRESULT WINAPI HTMLTableCell_put_borderColor(IHTMLTableCell *iface, VARIANT v)
200 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
201 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
202 return E_NOTIMPL;
205 static HRESULT WINAPI HTMLTableCell_get_borderColor(IHTMLTableCell *iface, VARIANT *p)
207 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
208 FIXME("(%p)->(%p)\n", This, p);
209 return E_NOTIMPL;
212 static HRESULT WINAPI HTMLTableCell_put_borderColorLight(IHTMLTableCell *iface, VARIANT v)
214 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
215 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
216 return E_NOTIMPL;
219 static HRESULT WINAPI HTMLTableCell_get_borderColorLight(IHTMLTableCell *iface, VARIANT *p)
221 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
222 FIXME("(%p)->(%p)\n", This, p);
223 return E_NOTIMPL;
226 static HRESULT WINAPI HTMLTableCell_put_borderColorDark(IHTMLTableCell *iface, VARIANT v)
228 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
229 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
230 return E_NOTIMPL;
233 static HRESULT WINAPI HTMLTableCell_get_borderColorDark(IHTMLTableCell *iface, VARIANT *p)
235 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
236 FIXME("(%p)->(%p)\n", This, p);
237 return E_NOTIMPL;
240 static HRESULT WINAPI HTMLTableCell_put_width(IHTMLTableCell *iface, VARIANT v)
242 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
243 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
244 return E_NOTIMPL;
247 static HRESULT WINAPI HTMLTableCell_get_width(IHTMLTableCell *iface, VARIANT *p)
249 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
250 FIXME("(%p)->(%p)\n", This, p);
251 return E_NOTIMPL;
254 static HRESULT WINAPI HTMLTableCell_put_height(IHTMLTableCell *iface, VARIANT v)
256 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
257 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
258 return E_NOTIMPL;
261 static HRESULT WINAPI HTMLTableCell_get_height(IHTMLTableCell *iface, VARIANT *p)
263 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
264 FIXME("(%p)->(%p)\n", This, p);
265 return E_NOTIMPL;
268 static HRESULT WINAPI HTMLTableCell_get_cellIndex(IHTMLTableCell *iface, LONG *p)
270 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
271 nsresult nsres;
273 TRACE("(%p)->(%p)\n", This, p);
274 nsres = nsIDOMHTMLTableCellElement_GetCellIndex(This->nscell, p);
275 if (NS_FAILED(nsres)) {
276 ERR("Get CellIndex failed: %08x\n", nsres);
277 return E_FAIL;
280 return S_OK;
283 static const IHTMLTableCellVtbl HTMLTableCellVtbl = {
284 HTMLTableCell_QueryInterface,
285 HTMLTableCell_AddRef,
286 HTMLTableCell_Release,
287 HTMLTableCell_GetTypeInfoCount,
288 HTMLTableCell_GetTypeInfo,
289 HTMLTableCell_GetIDsOfNames,
290 HTMLTableCell_Invoke,
291 HTMLTableCell_put_rowSpan,
292 HTMLTableCell_get_rowSpan,
293 HTMLTableCell_put_colSpan,
294 HTMLTableCell_get_colSpan,
295 HTMLTableCell_put_align,
296 HTMLTableCell_get_align,
297 HTMLTableCell_put_vAlign,
298 HTMLTableCell_get_vAlign,
299 HTMLTableCell_put_bgColor,
300 HTMLTableCell_get_bgColor,
301 HTMLTableCell_put_noWrap,
302 HTMLTableCell_get_noWrap,
303 HTMLTableCell_put_background,
304 HTMLTableCell_get_background,
305 HTMLTableCell_put_borderColor,
306 HTMLTableCell_get_borderColor,
307 HTMLTableCell_put_borderColorLight,
308 HTMLTableCell_get_borderColorLight,
309 HTMLTableCell_put_borderColorDark,
310 HTMLTableCell_get_borderColorDark,
311 HTMLTableCell_put_width,
312 HTMLTableCell_get_width,
313 HTMLTableCell_put_height,
314 HTMLTableCell_get_height,
315 HTMLTableCell_get_cellIndex
318 static inline HTMLTableCell *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
320 return CONTAINING_RECORD(iface, HTMLTableCell, element.node);
323 static HRESULT HTMLTableCell_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
325 HTMLTableCell *This = impl_from_HTMLDOMNode(iface);
327 if(IsEqualGUID(&IID_IUnknown, riid)) {
328 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
329 *ppv = &This->IHTMLTableCell_iface;
330 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
331 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
332 *ppv = &This->IHTMLTableCell_iface;
333 }else if(IsEqualGUID(&IID_IHTMLTableCell, riid)) {
334 TRACE("(%p)->(IID_IHTMLTableCell %p)\n", This, ppv);
335 *ppv = &This->IHTMLTableCell_iface;
336 }else {
337 return HTMLElement_QI(&This->element.node, riid, ppv);
340 IUnknown_AddRef((IUnknown*)*ppv);
341 return S_OK;
344 static void HTMLTableCell_destructor(HTMLDOMNode *iface)
346 HTMLTableCell *This = impl_from_HTMLDOMNode(iface);
348 HTMLElement_destructor(&This->element.node);
351 static const NodeImplVtbl HTMLTableCellImplVtbl = {
352 HTMLTableCell_QI,
353 HTMLTableCell_destructor,
354 HTMLElement_cpc,
355 HTMLElement_clone,
356 HTMLElement_handle_event,
357 HTMLElement_get_attr_col
360 static const tid_t HTMLTableCell_iface_tids[] = {
361 HTMLELEMENT_TIDS,
362 IHTMLTableCell_tid,
366 static dispex_static_data_t HTMLTableCell_dispex = {
367 NULL,
368 DispHTMLTableCell_tid,
369 NULL,
370 HTMLTableCell_iface_tids
373 HRESULT HTMLTableCell_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
375 HTMLTableCell *ret;
376 nsresult nsres;
378 ret = heap_alloc_zero(sizeof(*ret));
379 if(!ret)
380 return E_OUTOFMEMORY;
382 ret->IHTMLTableCell_iface.lpVtbl = &HTMLTableCellVtbl;
383 ret->element.node.vtbl = &HTMLTableCellImplVtbl;
385 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTableCell_dispex);
387 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableCellElement, (void**)&ret->nscell);
389 /* Share nscell reference with nsnode */
390 assert(nsres == NS_OK && (nsIDOMNode*)ret->nscell == ret->element.node.nsnode);
391 nsIDOMNode_Release(ret->element.node.nsnode);
393 *elem = &ret->element;
394 return S_OK;