ReactOS 0.4.15-dev-7093-g01a8288
htmltablerow.c
Go to the documentation of this file.
1/*
2 * Copyright 2008 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 IHTMLTableRow IHTMLTableRow_iface;
25
28
29static inline HTMLTableRow *impl_from_IHTMLTableRow(IHTMLTableRow *iface)
30{
31 return CONTAINING_RECORD(iface, HTMLTableRow, IHTMLTableRow_iface);
32}
33
34static HRESULT WINAPI HTMLTableRow_QueryInterface(IHTMLTableRow *iface,
35 REFIID riid, void **ppv)
36{
38
39 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
40}
41
42static ULONG WINAPI HTMLTableRow_AddRef(IHTMLTableRow *iface)
43{
45
46 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
47}
48
49static ULONG WINAPI HTMLTableRow_Release(IHTMLTableRow *iface)
50{
52
53 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
54}
55
56static HRESULT WINAPI HTMLTableRow_GetTypeInfoCount(IHTMLTableRow *iface, UINT *pctinfo)
57{
59 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
60}
61
62static HRESULT WINAPI HTMLTableRow_GetTypeInfo(IHTMLTableRow *iface, UINT iTInfo,
63 LCID lcid, ITypeInfo **ppTInfo)
64{
66 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
67 ppTInfo);
68}
69
71 LPOLESTR *rgszNames, UINT cNames,
72 LCID lcid, DISPID *rgDispId)
73{
75 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
76 cNames, lcid, rgDispId);
77}
78
79static HRESULT WINAPI HTMLTableRow_Invoke(IHTMLTableRow *iface, DISPID dispIdMember,
80 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
81 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
82{
84 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
85 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
86}
87
88static HRESULT WINAPI HTMLTableRow_put_align(IHTMLTableRow *iface, BSTR v)
89{
92 nsresult nsres;
93
94 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
95
97
98 nsres = nsIDOMHTMLTableRowElement_SetAlign(This->nsrow, &val);
100 if (NS_FAILED(nsres)){
101 ERR("Set Align(%s) failed!\n", debugstr_w(v));
102 return E_FAIL;
103 }
104 return S_OK;
105}
106
107static HRESULT WINAPI HTMLTableRow_get_align(IHTMLTableRow *iface, BSTR *p)
108{
111 nsresult nsres;
112
113 TRACE("(%p)->(%p)\n", This, p);
114
116 nsres = nsIDOMHTMLTableRowElement_GetAlign(This->nsrow, &val);
117
118 return return_nsstr(nsres, &val, p);
119}
120
121static HRESULT WINAPI HTMLTableRow_put_vAlign(IHTMLTableRow *iface, BSTR v)
122{
125 nsresult nsres;
126
127 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
128
130
131 nsres = nsIDOMHTMLTableRowElement_SetVAlign(This->nsrow, &val);
133
134 if (NS_FAILED(nsres)){
135 ERR("Set VAlign(%s) failed!\n", debugstr_w(v));
136 return E_FAIL;
137 }
138
139 return S_OK;
140}
141
142static HRESULT WINAPI HTMLTableRow_get_vAlign(IHTMLTableRow *iface, BSTR *p)
143{
146 nsresult nsres;
147
148 TRACE("(%p)->(%p)\n", This, p);
149
151 nsres = nsIDOMHTMLTableRowElement_GetVAlign(This->nsrow, &val);
152
153 return return_nsstr(nsres, &val, p);
154}
155
156static HRESULT WINAPI HTMLTableRow_put_bgColor(IHTMLTableRow *iface, VARIANT v)
157{
160 nsresult nsres;
161
162 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
163
164 if (!variant_to_nscolor(&v, &val))
165 return S_OK;
166
167 nsres = nsIDOMHTMLTableRowElement_SetBgColor(This->nsrow, &val);
169
170 if (NS_FAILED(nsres)){
171 ERR("Set BgColor(%s) failed!\n", debugstr_variant(&v));
172 return E_FAIL;
173 }
174
175 return S_OK;
176}
177
178static HRESULT WINAPI HTMLTableRow_get_bgColor(IHTMLTableRow *iface, VARIANT *p)
179{
181 nsAString strColor;
182 nsresult nsres;
184 const PRUnichar *color;
185
186 TRACE("(%p)->(%p)\n", This, p);
187
188 nsAString_Init(&strColor, NULL);
189 nsres = nsIDOMHTMLTableRowElement_GetBgColor(This->nsrow, &strColor);
190
191 if(NS_SUCCEEDED(nsres)) {
192 nsAString_GetData(&strColor, &color);
193 V_VT(p) = VT_BSTR;
195 }else {
196 ERR("SetBgColor failed: %08x\n", nsres);
197 hres = E_FAIL;
198 }
199
200 nsAString_Finish(&strColor);
201 return hres;
202}
203
205{
207 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
208 return E_NOTIMPL;
209}
210
212{
214 FIXME("(%p)->(%p)\n", This, p);
215 return E_NOTIMPL;
216}
217
219{
221 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
222 return E_NOTIMPL;
223}
224
226{
228 FIXME("(%p)->(%p)\n", This, p);
229 return E_NOTIMPL;
230}
231
233{
235 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
236 return E_NOTIMPL;
237}
238
240{
242 FIXME("(%p)->(%p)\n", This, p);
243 return E_NOTIMPL;
244}
245
246static HRESULT WINAPI HTMLTableRow_get_rowIndex(IHTMLTableRow *iface, LONG *p)
247{
249 nsresult nsres;
250
251 TRACE("(%p)->(%p)\n", This, p);
252 nsres = nsIDOMHTMLTableRowElement_GetRowIndex(This->nsrow, p);
253 if(NS_FAILED(nsres)) {
254 ERR("Get rowIndex failed: %08x\n", nsres);
255 return E_FAIL;
256 }
257 return S_OK;
258}
259
261{
263 nsresult nsres;
264
265 TRACE("(%p)->(%p)\n", This, p);
266 nsres = nsIDOMHTMLTableRowElement_GetSectionRowIndex(This->nsrow, p);
267 if(NS_FAILED(nsres)) {
268 ERR("Get selectionRowIndex failed: %08x\n", nsres);
269 return E_FAIL;
270 }
271 return S_OK;
272}
273
274static HRESULT WINAPI HTMLTableRow_get_cells(IHTMLTableRow *iface, IHTMLElementCollection **p)
275{
278 nsresult nsres;
279
280 TRACE("(%p)->(%p)\n", This, p);
281
282 nsres = nsIDOMHTMLTableRowElement_GetCells(This->nsrow, &nscol);
283 if(NS_FAILED(nsres)) {
284 ERR("GetCells failed: %08x\n", nsres);
285 return E_FAIL;
286 }
287
288 *p = create_collection_from_htmlcol(This->element.node.doc, nscol);
289
290 nsIDOMHTMLCollection_Release(nscol);
291 return S_OK;
292}
293
295{
297 nsIDOMHTMLElement *nselem;
299 nsresult nsres;
301
302 TRACE("(%p)->(%d %p)\n", This, index, row);
303 nsres = nsIDOMHTMLTableRowElement_InsertCell(This->nsrow, index, &nselem);
304 if(NS_FAILED(nsres)) {
305 ERR("Insert Cell at %d failed: %08x\n", index, nsres);
306 return E_FAIL;
307 }
308
309 hres = HTMLTableCell_Create(This->element.node.doc, nselem, &elem);
310 nsIDOMHTMLElement_Release(nselem);
311 if (FAILED(hres)) {
312 ERR("Create TableCell failed: %08x\n", hres);
313 return hres;
314 }
315
316 *row = (IDispatch *)&elem->IHTMLElement_iface;
317 return S_OK;
318}
319
320static HRESULT WINAPI HTMLTableRow_deleteCell(IHTMLTableRow *iface, LONG index)
321{
323 nsresult nsres;
324
325 TRACE("(%p)->(%d)\n", This, index);
326 nsres = nsIDOMHTMLTableRowElement_DeleteCell(This->nsrow, index);
327 if(NS_FAILED(nsres)) {
328 ERR("Delete Cell failed: %08x\n", nsres);
329 return E_FAIL;
330 }
331 return S_OK;
332}
333
334static const IHTMLTableRowVtbl HTMLTableRowVtbl = {
359};
360
362{
363 return CONTAINING_RECORD(iface, HTMLTableRow, element.node);
364}
365
367{
369
370 *ppv = NULL;
371
373 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
374 *ppv = &This->IHTMLTableRow_iface;
375 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
376 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
377 *ppv = &This->IHTMLTableRow_iface;
378 }else if(IsEqualGUID(&IID_IHTMLTableRow, riid)) {
379 TRACE("(%p)->(IID_IHTMLTableRow %p)\n", This, ppv);
380 *ppv = &This->IHTMLTableRow_iface;
381 }
382
383 if(*ppv) {
384 IUnknown_AddRef((IUnknown*)*ppv);
385 return S_OK;
386 }
387
388 return HTMLElement_QI(&This->element.node, riid, ppv);
389}
390
392{
394
395 if(This->nsrow)
396 note_cc_edge((nsISupports*)This->nsrow, "This->nstablerow", cb);
397}
398
400{
402
403 if(This->nsrow) {
404 nsIDOMHTMLTableRowElement *nsrow = This->nsrow;
405
406 This->nsrow = NULL;
407 nsIDOMHTMLTableRowElement_Release(nsrow);
408 }
409}
410
418 NULL,
419 NULL,
420 NULL,
421 NULL,
422 NULL,
423 NULL,
424 NULL,
425 NULL,
426 NULL,
429};
430
433 IHTMLTableRow_tid,
434 0
435};
436
438 NULL,
439 DispHTMLTableRow_tid,
440 NULL,
442};
443
445{
447 nsresult nsres;
448
449 ret = heap_alloc_zero(sizeof(HTMLTableRow));
450 if(!ret)
451 return E_OUTOFMEMORY;
452
453 ret->IHTMLTableRow_iface.lpVtbl = &HTMLTableRowVtbl;
454 ret->element.node.vtbl = &HTMLTableRowImplVtbl;
455
456 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTableRow_dispex);
457
458 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableRowElement, (void**)&ret->nsrow);
459 assert(nsres == NS_OK);
460
461 *elem = &ret->element;
462 return S_OK;
463}
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
@ VT_BSTR
Definition: compat.h:2303
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
#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
GLuint index
Definition: glext.h:6031
GLuint GLfloat * val
Definition: glext.h:7180
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
IHTMLElementCollection * create_collection_from_htmlcol(HTMLDocumentNode *doc, nsIDOMHTMLCollection *nscol)
Definition: htmlelemcol.c:705
HRESULT HTMLTableCell_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
static HRESULT WINAPI HTMLTableRow_put_vAlign(IHTMLTableRow *iface, BSTR v)
Definition: htmltablerow.c:121
static HRESULT WINAPI HTMLTableRow_put_borderColorLight(IHTMLTableRow *iface, VARIANT v)
Definition: htmltablerow.c:218
static HRESULT WINAPI HTMLTableRow_GetTypeInfoCount(IHTMLTableRow *iface, UINT *pctinfo)
Definition: htmltablerow.c:56
static HRESULT WINAPI HTMLTableRow_get_borderColor(IHTMLTableRow *iface, VARIANT *p)
Definition: htmltablerow.c:211
static void HTMLTableRow_unlink(HTMLDOMNode *iface)
Definition: htmltablerow.c:399
static const NodeImplVtbl HTMLTableRowImplVtbl
Definition: htmltablerow.c:411
static HRESULT WINAPI HTMLTableRow_put_borderColor(IHTMLTableRow *iface, VARIANT v)
Definition: htmltablerow.c:204
static ULONG WINAPI HTMLTableRow_AddRef(IHTMLTableRow *iface)
Definition: htmltablerow.c:42
static HRESULT WINAPI HTMLTableRow_GetTypeInfo(IHTMLTableRow *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: htmltablerow.c:62
static HRESULT WINAPI HTMLTableRow_get_vAlign(IHTMLTableRow *iface, BSTR *p)
Definition: htmltablerow.c:142
static HRESULT WINAPI HTMLTableRow_get_borderColorDark(IHTMLTableRow *iface, VARIANT *p)
Definition: htmltablerow.c:239
static HRESULT WINAPI HTMLTableRow_GetIDsOfNames(IHTMLTableRow *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: htmltablerow.c:70
static const IHTMLTableRowVtbl HTMLTableRowVtbl
Definition: htmltablerow.c:334
static void HTMLTableRow_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
Definition: htmltablerow.c:391
static HRESULT WINAPI HTMLTableRow_get_align(IHTMLTableRow *iface, BSTR *p)
Definition: htmltablerow.c:107
static HRESULT WINAPI HTMLTableRow_get_borderColorLight(IHTMLTableRow *iface, VARIANT *p)
Definition: htmltablerow.c:225
static HRESULT WINAPI HTMLTableRow_Invoke(IHTMLTableRow *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: htmltablerow.c:79
HRESULT HTMLTableRow_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
Definition: htmltablerow.c:444
static HRESULT HTMLTableRow_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
Definition: htmltablerow.c:366
static HTMLTableRow * impl_from_HTMLDOMNode(HTMLDOMNode *iface)
Definition: htmltablerow.c:361
static HRESULT WINAPI HTMLTableRow_get_cells(IHTMLTableRow *iface, IHTMLElementCollection **p)
Definition: htmltablerow.c:274
static HRESULT WINAPI HTMLTableRow_get_rowIndex(IHTMLTableRow *iface, LONG *p)
Definition: htmltablerow.c:246
static HRESULT WINAPI HTMLTableRow_QueryInterface(IHTMLTableRow *iface, REFIID riid, void **ppv)
Definition: htmltablerow.c:34
static HRESULT WINAPI HTMLTableRow_put_bgColor(IHTMLTableRow *iface, VARIANT v)
Definition: htmltablerow.c:156
static HRESULT WINAPI HTMLTableRow_get_sectionRowIndex(IHTMLTableRow *iface, LONG *p)
Definition: htmltablerow.c:260
static dispex_static_data_t HTMLTableRow_dispex
Definition: htmltablerow.c:437
static HRESULT WINAPI HTMLTableRow_deleteCell(IHTMLTableRow *iface, LONG index)
Definition: htmltablerow.c:320
static ULONG WINAPI HTMLTableRow_Release(IHTMLTableRow *iface)
Definition: htmltablerow.c:49
static HRESULT WINAPI HTMLTableRow_put_align(IHTMLTableRow *iface, BSTR v)
Definition: htmltablerow.c:88
static HRESULT WINAPI HTMLTableRow_put_borderColorDark(IHTMLTableRow *iface, VARIANT v)
Definition: htmltablerow.c:232
static HTMLTableRow * impl_from_IHTMLTableRow(IHTMLTableRow *iface)
Definition: htmltablerow.c:29
static HRESULT WINAPI HTMLTableRow_insertCell(IHTMLTableRow *iface, LONG index, IDispatch **row)
Definition: htmltablerow.c:294
static HRESULT WINAPI HTMLTableRow_get_bgColor(IHTMLTableRow *iface, VARIANT *p)
Definition: htmltablerow.c:178
static const tid_t HTMLTableRow_iface_tids[]
Definition: htmltablerow.c:431
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 FAILED(hr)
Definition: intsafe.h:51
#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
DWORD LCID
Definition: nls.h:13
#define TRACE(s)
Definition: solgame.cpp:4
IHTMLTableRow IHTMLTableRow_iface
Definition: htmltablerow.c:24
HTMLElement element
Definition: htmltablerow.c:22
nsIDOMHTMLTableRowElement * nsrow
Definition: htmltablerow.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