ReactOS  0.4.14-dev-599-g2d4d3f5
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 
21 typedef struct {
23 
24  IHTMLTableCell IHTMLTableCell_iface;
25 
28 
29 static inline HTMLTableCell *impl_from_IHTMLTableCell(IHTMLTableCell *iface)
30 {
31  return CONTAINING_RECORD(iface, HTMLTableCell, IHTMLTableCell_iface);
32 }
33 
34 static 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 
41 static ULONG WINAPI HTMLTableCell_AddRef(IHTMLTableCell *iface)
42 {
44 
45  return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
46 }
47 
48 static ULONG WINAPI HTMLTableCell_Release(IHTMLTableCell *iface)
49 {
51 
52  return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
53 }
54 
55 static HRESULT WINAPI HTMLTableCell_GetTypeInfoCount(IHTMLTableCell *iface, UINT *pctinfo)
56 {
58  return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
59 }
60 
61 static 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 
69 static HRESULT WINAPI HTMLTableCell_GetIDsOfNames(IHTMLTableCell *iface, REFIID riid,
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 
77 static 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 
86 static HRESULT WINAPI HTMLTableCell_put_rowSpan(IHTMLTableCell *iface, LONG v)
87 {
89  FIXME("(%p)->(%d)\n", This, v);
90  return E_NOTIMPL;
91 }
92 
93 static HRESULT WINAPI HTMLTableCell_get_rowSpan(IHTMLTableCell *iface, LONG *p)
94 {
96  FIXME("(%p)->(%p)\n", This, p);
97  return E_NOTIMPL;
98 }
99 
100 static HRESULT WINAPI HTMLTableCell_put_colSpan(IHTMLTableCell *iface, LONG v)
101 {
103  FIXME("(%p)->(%d)\n", This, v);
104  return E_NOTIMPL;
105 }
106 
107 static HRESULT WINAPI HTMLTableCell_get_colSpan(IHTMLTableCell *iface, LONG *p)
108 {
110  FIXME("(%p)->(%p)\n", This, p);
111  return E_NOTIMPL;
112 }
113 
114 static HRESULT WINAPI HTMLTableCell_put_align(IHTMLTableCell *iface, BSTR v)
115 {
117  nsAString str;
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 
132 static HRESULT WINAPI HTMLTableCell_get_align(IHTMLTableCell *iface, BSTR *p)
133 {
135  nsAString str;
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 
146 static 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 
153 static HRESULT WINAPI HTMLTableCell_get_vAlign(IHTMLTableCell *iface, BSTR *p)
154 {
156  FIXME("(%p)->(%p)\n", This, p);
157  return E_NOTIMPL;
158 }
159 
160 static 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 
181 static HRESULT WINAPI HTMLTableCell_get_bgColor(IHTMLTableCell *iface, VARIANT *p)
182 {
184  nsAString strColor;
185  nsresult nsres;
186  HRESULT hres;
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 
206 static HRESULT WINAPI HTMLTableCell_put_noWrap(IHTMLTableCell *iface, VARIANT_BOOL v)
207 {
209  FIXME("(%p)->(%x)\n", This, v);
210  return E_NOTIMPL;
211 }
212 
213 static HRESULT WINAPI HTMLTableCell_get_noWrap(IHTMLTableCell *iface, VARIANT_BOOL *p)
214 {
216  FIXME("(%p)->(%p)\n", This, p);
217  return E_NOTIMPL;
218 }
219 
220 static 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 
227 static HRESULT WINAPI HTMLTableCell_get_background(IHTMLTableCell *iface, BSTR *p)
228 {
230  FIXME("(%p)->(%p)\n", This, p);
231  return E_NOTIMPL;
232 }
233 
234 static HRESULT WINAPI HTMLTableCell_put_borderColor(IHTMLTableCell *iface, VARIANT v)
235 {
237  FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
238  return E_NOTIMPL;
239 }
240 
241 static 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 
276 static 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 
283 static HRESULT WINAPI HTMLTableCell_get_width(IHTMLTableCell *iface, VARIANT *p)
284 {
286  FIXME("(%p)->(%p)\n", This, p);
287  return E_NOTIMPL;
288 }
289 
290 static 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 
297 static HRESULT WINAPI HTMLTableCell_get_height(IHTMLTableCell *iface, VARIANT *p)
298 {
300  FIXME("(%p)->(%p)\n", This, p);
301  return E_NOTIMPL;
302 }
303 
304 static 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 
319 static const IHTMLTableCellVtbl HTMLTableCellVtbl = {
352 };
353 
355 {
356  return CONTAINING_RECORD(iface, HTMLTableCell, element.node);
357 }
358 
360 {
362 
363  if(IsEqualGUID(&IID_IUnknown, riid)) {
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 
427 static const tid_t HTMLTableCell_iface_tids[] = {
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 }
nsIDOMHTMLTableCellElement * nscell
Definition: htmltablecell.c:26
static HRESULT WINAPI HTMLTableCell_put_align(IHTMLTableCell *iface, BSTR v)
#define REFIID
Definition: guiddef.h:118
static HRESULT WINAPI HTMLTableCell_GetTypeInfo(IHTMLTableCell *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: htmltablecell.c:61
static HRESULT WINAPI HTMLTableCell_put_width(IHTMLTableCell *iface, VARIANT v)
static HTMLTableCell * impl_from_HTMLDOMNode(HTMLDOMNode *iface)
static const IHTMLTableCellVtbl HTMLTableCellVtbl
HRESULT HTMLElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *event, BOOL *prevent_default)
Definition: htmlelem.c:3815
HTMLElement element
Definition: htmltablecell.c:22
const cpc_entry_t HTMLElement_cpc[]
Definition: htmlelem.c:3847
static HRESULT HTMLTableCell_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
REFIID riid
Definition: precomp.h:44
static HRESULT WINAPI HTMLTableCell_QueryInterface(IHTMLTableCell *iface, REFIID riid, void **ppv)
Definition: htmltablecell.c:34
tid_t
Definition: ieframe.h:311
HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **ac)
Definition: htmlelem.c:4827
REFIID LPVOID * ppv
Definition: atlbase.h:39
static HTMLTableCell * impl_from_IHTMLTableCell(IHTMLTableCell *iface)
Definition: htmltablecell.c:29
HRESULT HTMLElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
Definition: htmlelem.c:3738
static HRESULT WINAPI HTMLTableCell_get_rowSpan(IHTMLTableCell *iface, LONG *p)
Definition: htmltablecell.c:93
#define assert(x)
Definition: debug.h:53
static HRESULT WINAPI HTMLTableCell_get_vAlign(IHTMLTableCell *iface, BSTR *p)
static ULONG WINAPI HTMLTableCell_Release(IHTMLTableCell *iface)
Definition: htmltablecell.c:48
DWORD LCID
Definition: nls.h:13
OLECHAR * BSTR
Definition: compat.h:1942
HRESULT HTMLTableCell_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
static HRESULT WINAPI HTMLTableCell_put_background(IHTMLTableCell *iface, BSTR v)
static LPOLESTR
Definition: stg_prop.c:27
#define E_FAIL
Definition: ddrawi.h:102
static HRESULT WINAPI HTMLTableCell_put_noWrap(IHTMLTableCell *iface, VARIANT_BOOL v)
static HRESULT WINAPI HTMLTableCell_get_colSpan(IHTMLTableCell *iface, LONG *p)
short VARIANT_BOOL
Definition: compat.h:1939
static void HTMLTableCell_destructor(HTMLDOMNode *iface)
static HRESULT WINAPI HTMLTableCell_GetTypeInfoCount(IHTMLTableCell *iface, UINT *pctinfo)
Definition: htmltablecell.c:55
static HRESULT WINAPI HTMLTableCell_get_borderColorDark(IHTMLTableCell *iface, VARIANT *p)
#define NS_OK
IHTMLTableCell IHTMLTableCell_iface
Definition: htmltablecell.c:24
static HRESULT WINAPI HTMLTableCell_put_colSpan(IHTMLTableCell *iface, LONG v)
static HRESULT WINAPI HTMLTableCell_get_borderColor(IHTMLTableCell *iface, VARIANT *p)
#define HTMLELEMENT_TIDS
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
long LONG
Definition: pedump.c:60
GLuint color
Definition: glext.h:6243
#define debugstr_w
Definition: kernel32.h:32
static size_t elem
Definition: string.c:68
#define FIXME(fmt,...)
Definition: debug.h:110
static HRESULT WINAPI HTMLTableCell_put_borderColorLight(IHTMLTableCell *iface, VARIANT v)
const WCHAR * str
static dispex_static_data_t HTMLTableCell_dispex
static HRESULT WINAPI HTMLTableCell_put_rowSpan(IHTMLTableCell *iface, LONG v)
Definition: htmltablecell.c:86
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define NS_FAILED(res)
HRESULT return_nsstr(nsresult, nsAString *, BSTR *) DECLSPEC_HIDDEN
Definition: nsembed.c:841
static HRESULT WINAPI HTMLTableCell_get_align(IHTMLTableCell *iface, BSTR *p)
#define TRACE(s)
Definition: solgame.cpp:4
static void HTMLTableCell_unlink(HTMLDOMNode *iface)
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static HRESULT WINAPI HTMLTableCell_get_cellIndex(IHTMLTableCell *iface, LONG *p)
const GUID IID_IUnknown
static HRESULT WINAPI HTMLTableCell_put_borderColor(IHTMLTableCell *iface, VARIANT v)
#define WINAPI
Definition: msvc.h:6
static HRESULT WINAPI HTMLTableCell_put_bgColor(IHTMLTableCell *iface, VARIANT v)
static HRESULT WINAPI HTMLTableCell_get_bgColor(IHTMLTableCell *iface, VARIANT *p)
unsigned short WORD
Definition: ntddk_ex.h:93
void HTMLElement_destructor(HTMLDOMNode *iface)
Definition: htmlelem.c:3764
static HRESULT WINAPI HTMLTableCell_get_width(IHTMLTableCell *iface, VARIANT *p)
#define NS_SUCCEEDED(res)
static HRESULT WINAPI HTMLTableCell_get_height(IHTMLTableCell *iface, VARIANT *p)
const GUID IID_IDispatch
int ret
BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr)
Definition: htmlbody.c:142
HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret)
Definition: htmlbody.c:111
#define V_VT(A)
Definition: oleauto.h:211
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
void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, dispex_static_data_t *dispex_data)
Definition: htmlelem.c:4008
static const tid_t HTMLTableCell_iface_tids[]
UINT32 nsAString_GetData(const nsAString *, const PRUnichar **) DECLSPEC_HIDDEN
Definition: nsembed.c:831
#define V_BSTR(A)
Definition: oleauto.h:226
static HRESULT WINAPI HTMLTableCell_GetIDsOfNames(IHTMLTableCell *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: htmltablecell.c:69
static HRESULT WINAPI HTMLTableCell_put_borderColorDark(IHTMLTableCell *iface, VARIANT v)
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
#define ERR(fmt,...)
Definition: debug.h:109
HRESULT HTMLElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
Definition: htmlelem.c:3793
struct stdole::EXCEPINFO EXCEPINFO
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:59
static VARIANTARG static DISPID
Definition: ordinal.c:49
const GLdouble * v
Definition: gl.h:2040
static const NodeImplVtbl HTMLTableCellImplVtbl
struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback
#define E_NOTIMPL
Definition: ddrawi.h:99
void nsAString_InitDepend(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:826
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static HRESULT WINAPI HTMLTableCell_get_background(IHTMLTableCell *iface, BSTR *p)
BOOL nsAString_Init(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:817
static ULONG WINAPI HTMLTableCell_AddRef(IHTMLTableCell *iface)
Definition: htmltablecell.c:41
void nsAString_Finish(nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:836
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
struct stdole::DISPPARAMS DISPPARAMS
static void HTMLTableCell_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
HRESULT nsresult
Definition: nsiface.idl:39
WCHAR PRUnichar
Definition: nsiface.idl:48
unsigned int ULONG
Definition: retypes.h:1
GLfloat GLfloat p
Definition: glext.h:8902
static HRESULT WINAPI HTMLTableCell_get_noWrap(IHTMLTableCell *iface, VARIANT_BOOL *p)
static HRESULT WINAPI HTMLTableCell_put_vAlign(IHTMLTableCell *iface, BSTR v)
static HRESULT WINAPI HTMLTableCell_get_borderColorLight(IHTMLTableCell *iface, VARIANT *p)
static HRESULT WINAPI HTMLTableCell_put_height(IHTMLTableCell *iface, VARIANT v)