mshtml: Share nsscript reference with nsnode.
[wine/multimedia.git] / dlls / mshtml / htmltablecell.c
blobebdfcbef6c2f957c11f0d4521e1aa491e61bae39
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>
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 typedef struct {
35 HTMLElement element;
37 IHTMLTableCell IHTMLTableCell_iface;
38 } HTMLTableCell;
40 static inline HTMLTableCell *impl_from_IHTMLTableCell(IHTMLTableCell *iface)
42 return CONTAINING_RECORD(iface, HTMLTableCell, IHTMLTableCell_iface);
45 static HRESULT WINAPI HTMLTableCell_QueryInterface(IHTMLTableCell *iface, REFIID riid, void **ppv)
47 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
49 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
52 static ULONG WINAPI HTMLTableCell_AddRef(IHTMLTableCell *iface)
54 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
56 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
59 static ULONG WINAPI HTMLTableCell_Release(IHTMLTableCell *iface)
61 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
63 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
66 static HRESULT WINAPI HTMLTableCell_GetTypeInfoCount(IHTMLTableCell *iface, UINT *pctinfo)
68 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
69 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
72 static HRESULT WINAPI HTMLTableCell_GetTypeInfo(IHTMLTableCell *iface, UINT iTInfo,
73 LCID lcid, ITypeInfo **ppTInfo)
75 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
76 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
77 ppTInfo);
80 static HRESULT WINAPI HTMLTableCell_GetIDsOfNames(IHTMLTableCell *iface, REFIID riid,
81 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
83 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
84 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
85 cNames, lcid, rgDispId);
88 static HRESULT WINAPI HTMLTableCell_Invoke(IHTMLTableCell *iface, DISPID dispIdMember, REFIID riid,
89 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
90 UINT *puArgErr)
92 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
93 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
94 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
97 static HRESULT WINAPI HTMLTableCell_put_rowSpan(IHTMLTableCell *iface, LONG v)
99 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
100 FIXME("(%p)->(%d)\n", This, v);
101 return E_NOTIMPL;
104 static HRESULT WINAPI HTMLTableCell_get_rowSpan(IHTMLTableCell *iface, LONG *p)
106 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
107 FIXME("(%p)->(%p)\n", This, p);
108 return E_NOTIMPL;
111 static HRESULT WINAPI HTMLTableCell_put_colSpan(IHTMLTableCell *iface, LONG v)
113 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
114 FIXME("(%p)->(%d)\n", This, v);
115 return E_NOTIMPL;
118 static HRESULT WINAPI HTMLTableCell_get_colSpan(IHTMLTableCell *iface, LONG *p)
120 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
121 FIXME("(%p)->(%p)\n", This, p);
122 return E_NOTIMPL;
125 static HRESULT WINAPI HTMLTableCell_put_align(IHTMLTableCell *iface, BSTR v)
127 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
128 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
129 return E_NOTIMPL;
132 static HRESULT WINAPI HTMLTableCell_get_align(IHTMLTableCell *iface, BSTR *p)
134 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
135 FIXME("(%p)->(%p)\n", This, p);
136 return E_NOTIMPL;
139 static HRESULT WINAPI HTMLTableCell_put_vAlign(IHTMLTableCell *iface, BSTR v)
141 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
142 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
143 return E_NOTIMPL;
146 static HRESULT WINAPI HTMLTableCell_get_vAlign(IHTMLTableCell *iface, BSTR *p)
148 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
149 FIXME("(%p)->(%p)\n", This, p);
150 return E_NOTIMPL;
153 static HRESULT WINAPI HTMLTableCell_put_bgColor(IHTMLTableCell *iface, VARIANT v)
155 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
156 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
157 return E_NOTIMPL;
160 static HRESULT WINAPI HTMLTableCell_get_bgColor(IHTMLTableCell *iface, VARIANT *p)
162 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
163 FIXME("(%p)->(%p)\n", This, p);
164 return E_NOTIMPL;
167 static HRESULT WINAPI HTMLTableCell_put_noWrap(IHTMLTableCell *iface, VARIANT_BOOL v)
169 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
170 FIXME("(%p)->(%x)\n", This, v);
171 return E_NOTIMPL;
174 static HRESULT WINAPI HTMLTableCell_get_noWrap(IHTMLTableCell *iface, VARIANT_BOOL *p)
176 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
177 FIXME("(%p)->(%p)\n", This, p);
178 return E_NOTIMPL;
181 static HRESULT WINAPI HTMLTableCell_put_background(IHTMLTableCell *iface, BSTR v)
183 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
184 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
185 return E_NOTIMPL;
188 static HRESULT WINAPI HTMLTableCell_get_background(IHTMLTableCell *iface, BSTR *p)
190 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
191 FIXME("(%p)->(%p)\n", This, p);
192 return E_NOTIMPL;
195 static HRESULT WINAPI HTMLTableCell_put_borderColor(IHTMLTableCell *iface, VARIANT v)
197 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
198 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
199 return E_NOTIMPL;
202 static HRESULT WINAPI HTMLTableCell_get_borderColor(IHTMLTableCell *iface, VARIANT *p)
204 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
205 FIXME("(%p)->(%p)\n", This, p);
206 return E_NOTIMPL;
209 static HRESULT WINAPI HTMLTableCell_put_borderColorLight(IHTMLTableCell *iface, VARIANT v)
211 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
212 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
213 return E_NOTIMPL;
216 static HRESULT WINAPI HTMLTableCell_get_borderColorLight(IHTMLTableCell *iface, VARIANT *p)
218 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
219 FIXME("(%p)->(%p)\n", This, p);
220 return E_NOTIMPL;
223 static HRESULT WINAPI HTMLTableCell_put_borderColorDark(IHTMLTableCell *iface, VARIANT v)
225 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
226 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
227 return E_NOTIMPL;
230 static HRESULT WINAPI HTMLTableCell_get_borderColorDark(IHTMLTableCell *iface, VARIANT *p)
232 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
233 FIXME("(%p)->(%p)\n", This, p);
234 return E_NOTIMPL;
237 static HRESULT WINAPI HTMLTableCell_put_width(IHTMLTableCell *iface, VARIANT v)
239 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
240 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
241 return E_NOTIMPL;
244 static HRESULT WINAPI HTMLTableCell_get_width(IHTMLTableCell *iface, VARIANT *p)
246 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
247 FIXME("(%p)->(%p)\n", This, p);
248 return E_NOTIMPL;
251 static HRESULT WINAPI HTMLTableCell_put_height(IHTMLTableCell *iface, VARIANT v)
253 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
254 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
255 return E_NOTIMPL;
258 static HRESULT WINAPI HTMLTableCell_get_height(IHTMLTableCell *iface, VARIANT *p)
260 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
261 FIXME("(%p)->(%p)\n", This, p);
262 return E_NOTIMPL;
265 static HRESULT WINAPI HTMLTableCell_get_cellIndex(IHTMLTableCell *iface, LONG *p)
267 HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
268 FIXME("(%p)->(%p)\n", This, p);
269 return E_NOTIMPL;
272 static const IHTMLTableCellVtbl HTMLTableCellVtbl = {
273 HTMLTableCell_QueryInterface,
274 HTMLTableCell_AddRef,
275 HTMLTableCell_Release,
276 HTMLTableCell_GetTypeInfoCount,
277 HTMLTableCell_GetTypeInfo,
278 HTMLTableCell_GetIDsOfNames,
279 HTMLTableCell_Invoke,
280 HTMLTableCell_put_rowSpan,
281 HTMLTableCell_get_rowSpan,
282 HTMLTableCell_put_colSpan,
283 HTMLTableCell_get_colSpan,
284 HTMLTableCell_put_align,
285 HTMLTableCell_get_align,
286 HTMLTableCell_put_vAlign,
287 HTMLTableCell_get_vAlign,
288 HTMLTableCell_put_bgColor,
289 HTMLTableCell_get_bgColor,
290 HTMLTableCell_put_noWrap,
291 HTMLTableCell_get_noWrap,
292 HTMLTableCell_put_background,
293 HTMLTableCell_get_background,
294 HTMLTableCell_put_borderColor,
295 HTMLTableCell_get_borderColor,
296 HTMLTableCell_put_borderColorLight,
297 HTMLTableCell_get_borderColorLight,
298 HTMLTableCell_put_borderColorDark,
299 HTMLTableCell_get_borderColorDark,
300 HTMLTableCell_put_width,
301 HTMLTableCell_get_width,
302 HTMLTableCell_put_height,
303 HTMLTableCell_get_height,
304 HTMLTableCell_get_cellIndex
307 static inline HTMLTableCell *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
309 return CONTAINING_RECORD(iface, HTMLTableCell, element.node);
312 static HRESULT HTMLTableCell_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
314 HTMLTableCell *This = impl_from_HTMLDOMNode(iface);
316 if(IsEqualGUID(&IID_IUnknown, riid)) {
317 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
318 *ppv = &This->IHTMLTableCell_iface;
319 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
320 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
321 *ppv = &This->IHTMLTableCell_iface;
322 }else if(IsEqualGUID(&IID_IHTMLTableCell, riid)) {
323 TRACE("(%p)->(IID_IHTMLTableCell %p)\n", This, ppv);
324 *ppv = &This->IHTMLTableCell_iface;
325 }else {
326 return HTMLElement_QI(&This->element.node, riid, ppv);
329 IUnknown_AddRef((IUnknown*)*ppv);
330 return S_OK;
333 static void HTMLTableCell_destructor(HTMLDOMNode *iface)
335 HTMLTableCell *This = impl_from_HTMLDOMNode(iface);
337 HTMLElement_destructor(&This->element.node);
340 static const NodeImplVtbl HTMLTableCellImplVtbl = {
341 HTMLTableCell_QI,
342 HTMLTableCell_destructor,
343 HTMLElement_clone,
344 HTMLElement_get_attr_col
347 static const tid_t HTMLTableCell_iface_tids[] = {
348 HTMLELEMENT_TIDS,
349 IHTMLTableCell_tid,
353 static dispex_static_data_t HTMLTableCell_dispex = {
354 NULL,
355 DispHTMLTableCell_tid,
356 NULL,
357 HTMLTableCell_iface_tids
360 HRESULT HTMLTableCell_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
362 HTMLTableCell *ret;
364 ret = heap_alloc_zero(sizeof(*ret));
365 if(!ret)
366 return E_OUTOFMEMORY;
368 ret->IHTMLTableCell_iface.lpVtbl = &HTMLTableCellVtbl;
369 ret->element.node.vtbl = &HTMLTableCellImplVtbl;
371 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTableCell_dispex);
373 *elem = &ret->element;
374 return S_OK;