ReactOS 0.4.15-dev-7906-g1b85a5f
htmltablecell.c
Go to the documentation of this file.
1/*
2 * Copyright 2012 Jacek Caban for CodeWeavers
3 *
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.
8 *
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.
13 *
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
17 */
18
19#include "mshtml_private.h"
20
21typedef struct {
23
24 IHTMLTableCell IHTMLTableCell_iface;
25
28
29static inline HTMLTableCell *impl_from_IHTMLTableCell(IHTMLTableCell *iface)
30{
31 return CONTAINING_RECORD(iface, HTMLTableCell, IHTMLTableCell_iface);
32}
33
34static HRESULT WINAPI HTMLTableCell_QueryInterface(IHTMLTableCell *iface, REFIID riid, void **ppv)
35{
37
38 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
39}
40
41static ULONG WINAPI HTMLTableCell_AddRef(IHTMLTableCell *iface)
42{
44
45 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
46}
47
48static ULONG WINAPI HTMLTableCell_Release(IHTMLTableCell *iface)
49{
51
52 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
53}
54
55static HRESULT WINAPI HTMLTableCell_GetTypeInfoCount(IHTMLTableCell *iface, UINT *pctinfo)
56{
58 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
59}
60
61static HRESULT WINAPI HTMLTableCell_GetTypeInfo(IHTMLTableCell *iface, UINT iTInfo,
62 LCID lcid, ITypeInfo **ppTInfo)
63{
65 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
66 ppTInfo);
67}
68
70 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
71{
73 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
74 cNames, lcid, rgDispId);
75}
76
77static HRESULT WINAPI HTMLTableCell_Invoke(IHTMLTableCell *iface, DISPID dispIdMember, REFIID riid,
78 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
79 UINT *puArgErr)
80{
82 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
83 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
84}
85
86static HRESULT WINAPI HTMLTableCell_put_rowSpan(IHTMLTableCell *iface, LONG v)
87{
89 FIXME("(%p)->(%d)\n", This, v);
90 return E_NOTIMPL;
91}
92
93static HRESULT WINAPI HTMLTableCell_get_rowSpan(IHTMLTableCell *iface, LONG *p)
94{
96 FIXME("(%p)->(%p)\n", This, p);
97 return E_NOTIMPL;
98}
99
100static HRESULT WINAPI HTMLTableCell_put_colSpan(IHTMLTableCell *iface, LONG v)
101{
103 FIXME("(%p)->(%d)\n", This, v);
104 return E_NOTIMPL;
105}
106
107static HRESULT WINAPI HTMLTableCell_get_colSpan(IHTMLTableCell *iface, LONG *p)
108{
110 FIXME("(%p)->(%p)\n", This, p);
111 return E_NOTIMPL;
112}
113
114static HRESULT WINAPI HTMLTableCell_put_align(IHTMLTableCell *iface, BSTR v)
115{
118 nsresult nsres;
119
120 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
121
123 nsres = nsIDOMHTMLTableCellElement_SetAlign(This->nscell, &str);
125 if (NS_FAILED(nsres)) {
126 ERR("Set Align failed: %08x\n", nsres);
127 return E_FAIL;
128 }
129 return S_OK;
130}
131
132static HRESULT WINAPI HTMLTableCell_get_align(IHTMLTableCell *iface, BSTR *p)
133{
136 nsresult nsres;
137
138 TRACE("(%p)->(%p)\n", This, p);
139
141 nsres = nsIDOMHTMLTableCellElement_GetAlign(This->nscell, &str);
142
143 return return_nsstr(nsres, &str, p);
144}
145
146static HRESULT WINAPI HTMLTableCell_put_vAlign(IHTMLTableCell *iface, BSTR v)
147{
149 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
150 return E_NOTIMPL;
151}
152
153static HRESULT WINAPI HTMLTableCell_get_vAlign(IHTMLTableCell *iface, BSTR *p)
154{
156 FIXME("(%p)->(%p)\n", This, p);
157 return E_NOTIMPL;
158}
159
160static HRESULT WINAPI HTMLTableCell_put_bgColor(IHTMLTableCell *iface, VARIANT v)
161{
163 nsAString strColor;
164 nsresult nsres;
165
166 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
167
168 if(!variant_to_nscolor(&v, &strColor))
169 return S_OK;
170
171 nsres = nsIDOMHTMLTableCellElement_SetBgColor(This->nscell, &strColor);
172 nsAString_Finish(&strColor);
173 if(NS_FAILED(nsres)) {
174 ERR("SetBgColor(%s) failed: %08x\n", debugstr_variant(&v), nsres);
175 return E_FAIL;
176 }
177
178 return S_OK;
179}
180
181static HRESULT WINAPI HTMLTableCell_get_bgColor(IHTMLTableCell *iface, VARIANT *p)
182{
184 nsAString strColor;
185 nsresult nsres;
187
188 TRACE("(%p)->(%p)\n", This, p);
189
190 nsAString_Init(&strColor, NULL);
191 nsres = nsIDOMHTMLTableCellElement_GetBgColor(This->nscell, &strColor);
192
193 if(NS_SUCCEEDED(nsres)) {
194 const PRUnichar *color;
195 nsAString_GetData(&strColor, &color);
196 V_VT(p) = VT_BSTR;
198 }else {
199 ERR("GetBgColor failed: %08x\n", nsres);
200 hres = E_FAIL;
201 }
202 nsAString_Finish(&strColor);
203 return hres;
204}
205
207{
209 FIXME("(%p)->(%x)\n", This, v);
210 return E_NOTIMPL;
211}
212
213static HRESULT WINAPI HTMLTableCell_get_noWrap(IHTMLTableCell *iface, VARIANT_BOOL *p)
214{
216 FIXME("(%p)->(%p)\n", This, p);
217 return E_NOTIMPL;
218}
219
220static HRESULT WINAPI HTMLTableCell_put_background(IHTMLTableCell *iface, BSTR v)
221{
223 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
224 return E_NOTIMPL;
225}
226
227static HRESULT WINAPI HTMLTableCell_get_background(IHTMLTableCell *iface, BSTR *p)
228{
230 FIXME("(%p)->(%p)\n", This, p);
231 return E_NOTIMPL;
232}
233
235{
237 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
238 return E_NOTIMPL;
239}
240
241static HRESULT WINAPI HTMLTableCell_get_borderColor(IHTMLTableCell *iface, VARIANT *p)
242{
244 FIXME("(%p)->(%p)\n", This, p);
245 return E_NOTIMPL;
246}
247
249{
251 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
252 return E_NOTIMPL;
253}
254
256{
258 FIXME("(%p)->(%p)\n", This, p);
259 return E_NOTIMPL;
260}
261
263{
265 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
266 return E_NOTIMPL;
267}
268
270{
272 FIXME("(%p)->(%p)\n", This, p);
273 return E_NOTIMPL;
274}
275
276static HRESULT WINAPI HTMLTableCell_put_width(IHTMLTableCell *iface, VARIANT v)
277{
279 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
280 return E_NOTIMPL;
281}
282
283static HRESULT WINAPI HTMLTableCell_get_width(IHTMLTableCell *iface, VARIANT *p)
284{
286 FIXME("(%p)->(%p)\n", This, p);
287 return E_NOTIMPL;
288}
289
290static HRESULT WINAPI HTMLTableCell_put_height(IHTMLTableCell *iface, VARIANT v)
291{
293 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
294 return E_NOTIMPL;
295}
296
297static HRESULT WINAPI HTMLTableCell_get_height(IHTMLTableCell *iface, VARIANT *p)
298{
300 FIXME("(%p)->(%p)\n", This, p);
301 return E_NOTIMPL;
302}
303
304static HRESULT WINAPI HTMLTableCell_get_cellIndex(IHTMLTableCell *iface, LONG *p)
305{
307 nsresult nsres;
308
309 TRACE("(%p)->(%p)\n", This, p);
310 nsres = nsIDOMHTMLTableCellElement_GetCellIndex(This->nscell, p);
311 if (NS_FAILED(nsres)) {
312 ERR("Get CellIndex failed: %08x\n", nsres);
313 return E_FAIL;
314 }
315
316 return S_OK;
317}
318
319static const IHTMLTableCellVtbl HTMLTableCellVtbl = {
352};
353
355{
356 return CONTAINING_RECORD(iface, HTMLTableCell, element.node);
357}
358
360{
362
364 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
365 *ppv = &This->IHTMLTableCell_iface;
366 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
367 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
368 *ppv = &This->IHTMLTableCell_iface;
369 }else if(IsEqualGUID(&IID_IHTMLTableCell, riid)) {
370 TRACE("(%p)->(IID_IHTMLTableCell %p)\n", This, ppv);
371 *ppv = &This->IHTMLTableCell_iface;
372 }else {
373 return HTMLElement_QI(&This->element.node, riid, ppv);
374 }
375
376 IUnknown_AddRef((IUnknown*)*ppv);
377 return S_OK;
378}
379
381{
383
384 HTMLElement_destructor(&This->element.node);
385}
386
388{
390
391 if(This->nscell)
392 note_cc_edge((nsISupports*)This->nscell, "This->nstablecell", cb);
393}
394
396{
398
399 if(This->nscell) {
400 nsIDOMHTMLTableCellElement *nscell = This->nscell;
401
402 This->nscell = NULL;
403 nsIDOMHTMLTableCellElement_Release(nscell);
404 }
405}
406
414 NULL,
415 NULL,
416 NULL,
417 NULL,
418 NULL,
419 NULL,
420 NULL,
421 NULL,
422 NULL,
425};
426
429 IHTMLTableCell_tid,
430 0
431};
432
434 NULL,
435 DispHTMLTableCell_tid,
436 NULL,
438};
439
441{
443 nsresult nsres;
444
445 ret = heap_alloc_zero(sizeof(*ret));
446 if(!ret)
447 return E_OUTOFMEMORY;
448
449 ret->IHTMLTableCell_iface.lpVtbl = &HTMLTableCellVtbl;
450 ret->element.node.vtbl = &HTMLTableCellImplVtbl;
451
452 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTableCell_dispex);
453
454 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableCellElement, (void**)&ret->nscell);
455 assert(nsres == NS_OK);
456
457 *elem = &ret->element;
458 return S_OK;
459}
const GUID IID_IUnknown
#define FIXME(fmt,...)
Definition: debug.h:111
#define ERR(fmt,...)
Definition: debug.h:110
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
OLECHAR * BSTR
Definition: compat.h:2293
short VARIANT_BOOL
Definition: compat.h:2290
@ VT_BSTR
Definition: compat.h:2303
#define assert(x)
Definition: debug.h:53
unsigned short WORD
Definition: ntddk_ex.h:93
const GLdouble * v
Definition: gl.h:2040
GLuint color
Definition: glext.h:6243
GLfloat GLfloat p
Definition: glext.h:8902
HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret)
Definition: htmlbody.c:111
BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr)
Definition: htmlbody.c:142
HRESULT HTMLElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
Definition: htmlelem.c:3793
void HTMLElement_destructor(HTMLDOMNode *iface)
Definition: htmlelem.c:3764
HRESULT HTMLElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *event, BOOL *prevent_default)
Definition: htmlelem.c:3815
const cpc_entry_t HTMLElement_cpc[]
Definition: htmlelem.c:3847
void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, dispex_static_data_t *dispex_data)
Definition: htmlelem.c:4008
HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **ac)
Definition: htmlelem.c:4827
HRESULT HTMLElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
Definition: htmlelem.c:3738
HRESULT HTMLTableCell_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
static ULONG WINAPI HTMLTableCell_Release(IHTMLTableCell *iface)
Definition: htmltablecell.c:48
static ULONG WINAPI HTMLTableCell_AddRef(IHTMLTableCell *iface)
Definition: htmltablecell.c:41
static void HTMLTableCell_unlink(HTMLDOMNode *iface)
static HRESULT WINAPI HTMLTableCell_get_borderColorDark(IHTMLTableCell *iface, VARIANT *p)
static HRESULT WINAPI HTMLTableCell_get_height(IHTMLTableCell *iface, VARIANT *p)
static HRESULT WINAPI HTMLTableCell_get_borderColor(IHTMLTableCell *iface, VARIANT *p)
static HRESULT WINAPI HTMLTableCell_put_align(IHTMLTableCell *iface, BSTR v)
static HRESULT WINAPI HTMLTableCell_GetIDsOfNames(IHTMLTableCell *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: htmltablecell.c:69
static HRESULT HTMLTableCell_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
static HRESULT WINAPI HTMLTableCell_put_colSpan(IHTMLTableCell *iface, LONG v)
static const tid_t HTMLTableCell_iface_tids[]
static HRESULT WINAPI HTMLTableCell_GetTypeInfoCount(IHTMLTableCell *iface, UINT *pctinfo)
Definition: htmltablecell.c:55
static const IHTMLTableCellVtbl HTMLTableCellVtbl
static HRESULT WINAPI HTMLTableCell_put_rowSpan(IHTMLTableCell *iface, LONG v)
Definition: htmltablecell.c:86
static HRESULT WINAPI HTMLTableCell_get_borderColorLight(IHTMLTableCell *iface, VARIANT *p)
static HRESULT WINAPI HTMLTableCell_put_background(IHTMLTableCell *iface, BSTR v)
static HRESULT WINAPI HTMLTableCell_get_rowSpan(IHTMLTableCell *iface, LONG *p)
Definition: htmltablecell.c:93
static HRESULT WINAPI HTMLTableCell_put_noWrap(IHTMLTableCell *iface, VARIANT_BOOL v)
static HRESULT WINAPI HTMLTableCell_get_cellIndex(IHTMLTableCell *iface, LONG *p)
static HRESULT WINAPI HTMLTableCell_get_width(IHTMLTableCell *iface, VARIANT *p)
static HRESULT WINAPI HTMLTableCell_put_borderColorLight(IHTMLTableCell *iface, VARIANT v)
static HRESULT WINAPI HTMLTableCell_get_background(IHTMLTableCell *iface, BSTR *p)
static void HTMLTableCell_destructor(HTMLDOMNode *iface)
static HTMLTableCell * impl_from_IHTMLTableCell(IHTMLTableCell *iface)
Definition: htmltablecell.c:29
static HRESULT WINAPI HTMLTableCell_put_height(IHTMLTableCell *iface, VARIANT v)
static HRESULT WINAPI HTMLTableCell_get_bgColor(IHTMLTableCell *iface, VARIANT *p)
static HRESULT WINAPI HTMLTableCell_Invoke(IHTMLTableCell *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: htmltablecell.c:77
static HRESULT WINAPI HTMLTableCell_GetTypeInfo(IHTMLTableCell *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: htmltablecell.c:61
static HRESULT WINAPI HTMLTableCell_put_borderColorDark(IHTMLTableCell *iface, VARIANT v)
static HRESULT WINAPI HTMLTableCell_put_vAlign(IHTMLTableCell *iface, BSTR v)
static HRESULT WINAPI HTMLTableCell_put_bgColor(IHTMLTableCell *iface, VARIANT v)
static HRESULT WINAPI HTMLTableCell_get_vAlign(IHTMLTableCell *iface, BSTR *p)
static HRESULT WINAPI HTMLTableCell_put_borderColor(IHTMLTableCell *iface, VARIANT v)
static const NodeImplVtbl HTMLTableCellImplVtbl
static HRESULT WINAPI HTMLTableCell_get_align(IHTMLTableCell *iface, BSTR *p)
static HRESULT WINAPI HTMLTableCell_get_colSpan(IHTMLTableCell *iface, LONG *p)
static void HTMLTableCell_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
static HTMLTableCell * impl_from_HTMLDOMNode(HTMLDOMNode *iface)
static dispex_static_data_t HTMLTableCell_dispex
static HRESULT WINAPI HTMLTableCell_QueryInterface(IHTMLTableCell *iface, REFIID riid, void **ppv)
Definition: htmltablecell.c:34
static HRESULT WINAPI HTMLTableCell_get_noWrap(IHTMLTableCell *iface, VARIANT_BOOL *p)
static HRESULT WINAPI HTMLTableCell_put_width(IHTMLTableCell *iface, VARIANT v)
tid_t
Definition: ieframe.h:311
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define debugstr_w
Definition: kernel32.h:32
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
HRESULT hres
Definition: protocol.c:465
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
static size_t elem
Definition: string.c:68
static LPOLESTR
Definition: stg_prop.c:27
static VARIANTARG static DISPID
Definition: ordinal.c:52
#define NS_OK
void nsAString_Finish(nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:836
UINT32 nsAString_GetData(const nsAString *, const PRUnichar **) DECLSPEC_HIDDEN
Definition: nsembed.c:831
#define HTMLELEMENT_TIDS
void nsAString_InitDepend(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:826
BOOL nsAString_Init(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:817
struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback
#define NS_SUCCEEDED(res)
#define NS_FAILED(res)
HRESULT return_nsstr(nsresult, nsAString *, BSTR *) DECLSPEC_HIDDEN
Definition: nsembed.c:841
unsigned int UINT
Definition: ndis.h:50
WCHAR PRUnichar
Definition: nsiface.idl:48
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
const GUID IID_IDispatch
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
const WCHAR * str
DWORD LCID
Definition: nls.h:13
#define TRACE(s)
Definition: solgame.cpp:4
HTMLElement element
Definition: htmltablecell.c:22
IHTMLTableCell IHTMLTableCell_iface
Definition: htmltablecell.c:24
nsIDOMHTMLTableCellElement * nscell
Definition: htmltablecell.c:26
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
int ret
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531
#define WINAPI
Definition: msvc.h:6