ole32: Handle SetClipboardData failing in OLE clipboard functions.
[wine.git] / dlls / mshtml / htmltablerow.c
blob862ed75318c1e78c169ece928ca9d822d4d7f6f1
1 /*
2 * Copyright 2008 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 const IHTMLTableRowVtbl *lpHTMLTableRowVtbl;
39 nsIDOMHTMLTableRowElement *nsrow;
40 } HTMLTableRow;
42 #define HTMLTABLEROW(x) (&(x)->lpHTMLTableRowVtbl)
44 #define HTMLTABLEROW_THIS(iface) DEFINE_THIS(HTMLTableRow, HTMLTableRow, iface)
46 static HRESULT WINAPI HTMLTableRow_QueryInterface(IHTMLTableRow *iface,
47 REFIID riid, void **ppv)
49 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
51 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
54 static ULONG WINAPI HTMLTableRow_AddRef(IHTMLTableRow *iface)
56 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
58 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
61 static ULONG WINAPI HTMLTableRow_Release(IHTMLTableRow *iface)
63 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
65 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
68 static HRESULT WINAPI HTMLTableRow_GetTypeInfoCount(IHTMLTableRow *iface, UINT *pctinfo)
70 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
71 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->element.node.dispex), pctinfo);
74 static HRESULT WINAPI HTMLTableRow_GetTypeInfo(IHTMLTableRow *iface, UINT iTInfo,
75 LCID lcid, ITypeInfo **ppTInfo)
77 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
78 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->element.node.dispex), iTInfo, lcid, ppTInfo);
81 static HRESULT WINAPI HTMLTableRow_GetIDsOfNames(IHTMLTableRow *iface, REFIID riid,
82 LPOLESTR *rgszNames, UINT cNames,
83 LCID lcid, DISPID *rgDispId)
85 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
86 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
89 static HRESULT WINAPI HTMLTableRow_Invoke(IHTMLTableRow *iface, DISPID dispIdMember,
90 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
91 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
93 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
94 return IDispatchEx_Invoke(DISPATCHEX(&This->element.node.dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
95 pVarResult, pExcepInfo, puArgErr);
98 static HRESULT WINAPI HTMLTableRow_put_align(IHTMLTableRow *iface, BSTR v)
100 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
101 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
102 return E_NOTIMPL;
105 static HRESULT WINAPI HTMLTableRow_get_align(IHTMLTableRow *iface, BSTR *p)
107 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
108 FIXME("(%p)->(%p)\n", This, p);
109 return E_NOTIMPL;
112 static HRESULT WINAPI HTMLTableRow_put_vAlign(IHTMLTableRow *iface, BSTR v)
114 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
115 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
116 return E_NOTIMPL;
119 static HRESULT WINAPI HTMLTableRow_get_vAlign(IHTMLTableRow *iface, BSTR *p)
121 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
122 FIXME("(%p)->(%p)\n", This, p);
123 return E_NOTIMPL;
126 static HRESULT WINAPI HTMLTableRow_put_bgColor(IHTMLTableRow *iface, VARIANT v)
128 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
129 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
130 return E_NOTIMPL;
133 static HRESULT WINAPI HTMLTableRow_get_bgColor(IHTMLTableRow *iface, VARIANT *p)
135 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
136 FIXME("(%p)->(%p)\n", This, p);
137 return E_NOTIMPL;
140 static HRESULT WINAPI HTMLTableRow_put_borderColor(IHTMLTableRow *iface, VARIANT v)
142 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
143 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
144 return E_NOTIMPL;
147 static HRESULT WINAPI HTMLTableRow_get_borderColor(IHTMLTableRow *iface, VARIANT *p)
149 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
150 FIXME("(%p)->(%p)\n", This, p);
151 return E_NOTIMPL;
154 static HRESULT WINAPI HTMLTableRow_put_borderColorLight(IHTMLTableRow *iface, VARIANT v)
156 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
157 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
158 return E_NOTIMPL;
161 static HRESULT WINAPI HTMLTableRow_get_borderColorLight(IHTMLTableRow *iface, VARIANT *p)
163 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
164 FIXME("(%p)->(%p)\n", This, p);
165 return E_NOTIMPL;
168 static HRESULT WINAPI HTMLTableRow_put_borderColorDark(IHTMLTableRow *iface, VARIANT v)
170 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
171 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
172 return E_NOTIMPL;
175 static HRESULT WINAPI HTMLTableRow_get_borderColorDark(IHTMLTableRow *iface, VARIANT *p)
177 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
178 FIXME("(%p)->(%p)\n", This, p);
179 return E_NOTIMPL;
182 static HRESULT WINAPI HTMLTableRow_get_rowIndex(IHTMLTableRow *iface, LONG *p)
184 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
185 FIXME("(%p)->(%p)\n", This, p);
186 return E_NOTIMPL;
189 static HRESULT WINAPI HTMLTableRow_get_selectionRowIndex(IHTMLTableRow *iface, LONG *p)
191 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
192 FIXME("(%p)->(%p)\n", This, p);
193 return E_NOTIMPL;
196 static HRESULT WINAPI HTMLTableRow_get_cells(IHTMLTableRow *iface, IHTMLElementCollection **p)
198 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
199 nsIDOMHTMLCollection *nscol;
200 nsresult nsres;
202 TRACE("(%p)->(%p)\n", This, p);
204 nsres = nsIDOMHTMLTableRowElement_GetCells(This->nsrow, &nscol);
205 if(NS_FAILED(nsres)) {
206 ERR("GetCells failed: %08x\n", nsres);
207 return E_FAIL;
210 *p = create_collection_from_htmlcol(This->element.node.doc, (IUnknown*)HTMLTABLEROW(This), nscol);
212 nsIDOMHTMLCollection_Release(nscol);
213 return S_OK;
216 static HRESULT WINAPI HTMLTableRow_insertCell(IHTMLTableRow *iface, LONG index, IDispatch **row)
218 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
219 FIXME("(%p)->(%d %p)\n", This, index, row);
220 return E_NOTIMPL;
223 static HRESULT WINAPI HTMLTableRow_deleteCell(IHTMLTableRow *iface, LONG index)
225 HTMLTableRow *This = HTMLTABLEROW_THIS(iface);
226 FIXME("(%p)->(%d)\n", This, index);
227 return E_NOTIMPL;
230 #undef HTMLTABLEROW_THIS
232 static const IHTMLTableRowVtbl HTMLTableRowVtbl = {
233 HTMLTableRow_QueryInterface,
234 HTMLTableRow_AddRef,
235 HTMLTableRow_Release,
236 HTMLTableRow_GetTypeInfoCount,
237 HTMLTableRow_GetTypeInfo,
238 HTMLTableRow_GetIDsOfNames,
239 HTMLTableRow_Invoke,
240 HTMLTableRow_put_align,
241 HTMLTableRow_get_align,
242 HTMLTableRow_put_vAlign,
243 HTMLTableRow_get_vAlign,
244 HTMLTableRow_put_bgColor,
245 HTMLTableRow_get_bgColor,
246 HTMLTableRow_put_borderColor,
247 HTMLTableRow_get_borderColor,
248 HTMLTableRow_put_borderColorLight,
249 HTMLTableRow_get_borderColorLight,
250 HTMLTableRow_put_borderColorDark,
251 HTMLTableRow_get_borderColorDark,
252 HTMLTableRow_get_rowIndex,
253 HTMLTableRow_get_selectionRowIndex,
254 HTMLTableRow_get_cells,
255 HTMLTableRow_insertCell,
256 HTMLTableRow_deleteCell
259 #define HTMLTABLEROW_NODE_THIS(iface) DEFINE_THIS2(HTMLTableRow, element.node, iface)
261 static HRESULT HTMLTableRow_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
263 HTMLTableRow *This = HTMLTABLEROW_NODE_THIS(iface);
265 *ppv = NULL;
267 if(IsEqualGUID(&IID_IUnknown, riid)) {
268 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
269 *ppv = HTMLTABLEROW(This);
270 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
271 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
272 *ppv = HTMLTABLEROW(This);
273 }else if(IsEqualGUID(&IID_IHTMLTableRow, riid)) {
274 TRACE("(%p)->(IID_IHTMLTableRow %p)\n", This, ppv);
275 *ppv = HTMLTABLEROW(This);
278 if(*ppv) {
279 IUnknown_AddRef((IUnknown*)*ppv);
280 return S_OK;
283 return HTMLElement_QI(&This->element.node, riid, ppv);
286 static void HTMLTableRow_destructor(HTMLDOMNode *iface)
288 HTMLTableRow *This = HTMLTABLEROW_NODE_THIS(iface);
290 if(This->nsrow)
291 nsIDOMHTMLTableRowElement_Release(This->nsrow);
293 HTMLElement_destructor(&This->element.node);
296 #undef HTMLTABLEROW_NODE_THIS
298 static const NodeImplVtbl HTMLTableRowImplVtbl = {
299 HTMLTableRow_QI,
300 HTMLTableRow_destructor
303 static const tid_t HTMLTableRow_iface_tids[] = {
304 IHTMLDOMNode_tid,
305 IHTMLDOMNode2_tid,
306 IHTMLElement_tid,
307 IHTMLElement2_tid,
308 IHTMLElement3_tid,
309 IHTMLTableRow_tid,
313 static dispex_static_data_t HTMLTableRow_dispex = {
314 NULL,
315 DispHTMLTableRow_tid,
316 NULL,
317 HTMLTableRow_iface_tids
320 HTMLElement *HTMLTableRow_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem)
322 HTMLTableRow *ret = heap_alloc_zero(sizeof(HTMLTableRow));
323 nsresult nsres;
325 ret->lpHTMLTableRowVtbl = &HTMLTableRowVtbl;
326 ret->element.node.vtbl = &HTMLTableRowImplVtbl;
328 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTableRow_dispex);
330 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableRowElement, (void**)&ret->nsrow);
331 if(NS_FAILED(nsres))
332 ERR("Could not get nsIDOMHTMLTableRowElement iface: %08x\n", nsres);
334 return &ret->element;