wer: Add new stubbed wer.dll.
[wine/hramrach.git] / dlls / mshtml / htmltextarea.c
blobdd33c72df21f5a457334bd17e6694370c76752aa
1 /*
2 * Copyright 2006 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 IHTMLTextAreaElementVtbl *lpHTMLTextAreaElementVtbl;
39 nsIDOMHTMLTextAreaElement *nstextarea;
40 } HTMLTextAreaElement;
42 #define HTMLTXTAREA(x) ((IHTMLTextAreaElement*) &(x)->lpHTMLTextAreaElementVtbl)
44 #define HTMLTXTAREA_THIS(iface) DEFINE_THIS(HTMLTextAreaElement, HTMLTextAreaElement, iface)
46 static HRESULT WINAPI HTMLTextAreaElement_QueryInterface(IHTMLTextAreaElement *iface,
47 REFIID riid, void **ppv)
49 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
51 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
54 static ULONG WINAPI HTMLTextAreaElement_AddRef(IHTMLTextAreaElement *iface)
56 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
58 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
61 static ULONG WINAPI HTMLTextAreaElement_Release(IHTMLTextAreaElement *iface)
63 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
65 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
68 static HRESULT WINAPI HTMLTextAreaElement_GetTypeInfoCount(IHTMLTextAreaElement *iface, UINT *pctinfo)
70 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
71 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->element.node.dispex), pctinfo);
74 static HRESULT WINAPI HTMLTextAreaElement_GetTypeInfo(IHTMLTextAreaElement *iface, UINT iTInfo,
75 LCID lcid, ITypeInfo **ppTInfo)
77 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
78 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->element.node.dispex), iTInfo, lcid, ppTInfo);
81 static HRESULT WINAPI HTMLTextAreaElement_GetIDsOfNames(IHTMLTextAreaElement *iface, REFIID riid,
82 LPOLESTR *rgszNames, UINT cNames,
83 LCID lcid, DISPID *rgDispId)
85 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
86 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
89 static HRESULT WINAPI HTMLTextAreaElement_Invoke(IHTMLTextAreaElement *iface, DISPID dispIdMember,
90 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
91 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
93 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
94 return IDispatchEx_Invoke(DISPATCHEX(&This->element.node.dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
95 pVarResult, pExcepInfo, puArgErr);
98 static HRESULT WINAPI HTMLTextAreaElement_get_type(IHTMLTextAreaElement *iface, BSTR *p)
100 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
101 FIXME("(%p)->(%p)\n", This, p);
102 return E_NOTIMPL;
105 static HRESULT WINAPI HTMLTextAreaElement_put_value(IHTMLTextAreaElement *iface, BSTR v)
107 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
108 nsAString value_str;
109 nsresult nsres;
111 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
113 nsAString_InitDepend(&value_str, v);
114 nsres = nsIDOMHTMLTextAreaElement_SetValue(This->nstextarea, &value_str);
115 nsAString_Finish(&value_str);
116 if(NS_FAILED(nsres)) {
117 ERR("SetValue failed: %08x\n", nsres);
118 return E_FAIL;
121 return S_OK;
124 static HRESULT WINAPI HTMLTextAreaElement_get_value(IHTMLTextAreaElement *iface, BSTR *p)
126 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
127 nsAString value_str;
128 const PRUnichar *value;
129 nsresult nsres;
130 HRESULT hres = S_OK;
132 TRACE("(%p)->(%p)\n", This, p);
134 nsAString_Init(&value_str, NULL);
136 nsres = nsIDOMHTMLTextAreaElement_GetValue(This->nstextarea, &value_str);
137 if(NS_SUCCEEDED(nsres)) {
138 nsAString_GetData(&value_str, &value);
139 *p = *value ? SysAllocString(value) : NULL;
140 }else {
141 ERR("GetValue failed: %08x\n", nsres);
142 hres = E_FAIL;
145 nsAString_Finish(&value_str);
146 return hres;
149 static HRESULT WINAPI HTMLTextAreaElement_put_name(IHTMLTextAreaElement *iface, BSTR v)
151 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
152 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
153 return E_NOTIMPL;
156 static HRESULT WINAPI HTMLTextAreaElement_get_name(IHTMLTextAreaElement *iface, BSTR *p)
158 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
159 nsAString name_str;
160 const PRUnichar *name;
161 nsresult nsres;
163 TRACE("(%p)->(%p)\n", This, p);
165 nsAString_Init(&name_str, NULL);
167 nsres = nsIDOMHTMLTextAreaElement_GetName(This->nstextarea, &name_str);
168 if(NS_SUCCEEDED(nsres)) {
169 nsAString_GetData(&name_str, &name);
170 *p = SysAllocString(name);
171 }else {
172 ERR("GetName failed: %08x\n", nsres);
175 nsAString_Finish(&name_str);
177 TRACE("%s\n", debugstr_w(*p));
178 return S_OK;
181 static HRESULT WINAPI HTMLTextAreaElement_put_status(IHTMLTextAreaElement *iface, VARIANT v)
183 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
184 FIXME("(%p)->()\n", This);
185 return E_NOTIMPL;
188 static HRESULT WINAPI HTMLTextAreaElement_get_status(IHTMLTextAreaElement *iface, VARIANT *p)
190 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
191 FIXME("(%p)->(%p)\n", This, p);
192 return E_NOTIMPL;
195 static HRESULT WINAPI HTMLTextAreaElement_put_disabled(IHTMLTextAreaElement *iface, VARIANT_BOOL v)
197 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
198 FIXME("(%p)->(%x)\n", This, v);
199 return E_NOTIMPL;
202 static HRESULT WINAPI HTMLTextAreaElement_get_disabled(IHTMLTextAreaElement *iface, VARIANT_BOOL *p)
204 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
205 FIXME("(%p)->(%p)\n", This, p);
206 return E_NOTIMPL;
209 static HRESULT WINAPI HTMLTextAreaElement_get_form(IHTMLTextAreaElement *iface, IHTMLFormElement **p)
211 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
212 FIXME("(%p)->(%p)\n", This, p);
213 return E_NOTIMPL;
216 static HRESULT WINAPI HTMLTextAreaElement_put_defaultValue(IHTMLTextAreaElement *iface, BSTR v)
218 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
219 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
220 return E_NOTIMPL;
223 static HRESULT WINAPI HTMLTextAreaElement_get_defaultValue(IHTMLTextAreaElement *iface, BSTR *p)
225 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
226 FIXME("(%p)->(%p)\n", This, p);
227 return E_NOTIMPL;
230 static HRESULT WINAPI HTMLTextAreaElement_select(IHTMLTextAreaElement *iface)
232 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
233 FIXME("(%p)\n", This);
234 return E_NOTIMPL;
237 static HRESULT WINAPI HTMLTextAreaElement_put_onchange(IHTMLTextAreaElement *iface, VARIANT v)
239 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
240 FIXME("(%p)->()\n", This);
241 return E_NOTIMPL;
244 static HRESULT WINAPI HTMLTextAreaElement_get_onchange(IHTMLTextAreaElement *iface, VARIANT *p)
246 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
247 FIXME("(%p)->(%p)\n", This, p);
248 return E_NOTIMPL;
251 static HRESULT WINAPI HTMLTextAreaElement_put_onselect(IHTMLTextAreaElement *iface, VARIANT v)
253 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
254 FIXME("(%p)->()\n", This);
255 return E_NOTIMPL;
258 static HRESULT WINAPI HTMLTextAreaElement_get_onselect(IHTMLTextAreaElement *iface, VARIANT *p)
260 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
261 FIXME("(%p)->(%p)\n", This, p);
262 return E_NOTIMPL;
265 static HRESULT WINAPI HTMLTextAreaElement_put_readOnly(IHTMLTextAreaElement *iface, VARIANT_BOOL v)
267 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
268 nsresult nsres;
270 TRACE("(%p)->(%x)\n", This, v);
272 nsres = nsIDOMHTMLTextAreaElement_SetReadOnly(This->nstextarea, v != VARIANT_FALSE);
273 if(NS_FAILED(nsres)) {
274 ERR("SetReadOnly failed: %08x\n", nsres);
275 return E_FAIL;
278 return S_OK;
281 static HRESULT WINAPI HTMLTextAreaElement_get_readOnly(IHTMLTextAreaElement *iface, VARIANT_BOOL *p)
283 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
284 PRBool b;
285 nsresult nsres;
287 TRACE("(%p)->(%p)\n", This, p);
289 nsres = nsIDOMHTMLTextAreaElement_GetReadOnly(This->nstextarea, &b);
290 if(NS_FAILED(nsres)) {
291 ERR("GetReadOnly failed: %08x\n", nsres);
292 return E_FAIL;
295 *p = b ? VARIANT_TRUE : VARIANT_FALSE;
296 return S_OK;
299 static HRESULT WINAPI HTMLTextAreaElement_put_rows(IHTMLTextAreaElement *iface, LONG v)
301 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
302 FIXME("(%p)->(%d)\n", This, v);
303 return E_NOTIMPL;
306 static HRESULT WINAPI HTMLTextAreaElement_get_rows(IHTMLTextAreaElement *iface, LONG *p)
308 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
309 FIXME("(%p)->(%p)\n", This, p);
310 return E_NOTIMPL;
313 static HRESULT WINAPI HTMLTextAreaElement_put_cols(IHTMLTextAreaElement *iface, LONG v)
315 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
316 FIXME("(%p)->(%d)\n", This, v);
317 return E_NOTIMPL;
320 static HRESULT WINAPI HTMLTextAreaElement_get_cols(IHTMLTextAreaElement *iface, LONG *p)
322 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
323 FIXME("(%p)->(%p)\n", This, p);
324 return E_NOTIMPL;
327 static HRESULT WINAPI HTMLTextAreaElement_put_wrap(IHTMLTextAreaElement *iface, BSTR v)
329 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
330 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
331 return E_NOTIMPL;
334 static HRESULT WINAPI HTMLTextAreaElement_get_wrap(IHTMLTextAreaElement *iface, BSTR *p)
336 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
337 FIXME("(%p)->(%p)\n", This, p);
338 return E_NOTIMPL;
341 static HRESULT WINAPI HTMLTextAreaElement_createTextRange(IHTMLTextAreaElement *iface,
342 IHTMLTxtRange **range)
344 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
345 FIXME("(%p)->(%p)\n", This, range);
346 return E_NOTIMPL;
349 #undef HTMLTXTAREA_THIS
351 static const IHTMLTextAreaElementVtbl HTMLTextAreaElementVtbl = {
352 HTMLTextAreaElement_QueryInterface,
353 HTMLTextAreaElement_AddRef,
354 HTMLTextAreaElement_Release,
355 HTMLTextAreaElement_GetTypeInfoCount,
356 HTMLTextAreaElement_GetTypeInfo,
357 HTMLTextAreaElement_GetIDsOfNames,
358 HTMLTextAreaElement_Invoke,
359 HTMLTextAreaElement_get_type,
360 HTMLTextAreaElement_put_value,
361 HTMLTextAreaElement_get_value,
362 HTMLTextAreaElement_put_name,
363 HTMLTextAreaElement_get_name,
364 HTMLTextAreaElement_put_status,
365 HTMLTextAreaElement_get_status,
366 HTMLTextAreaElement_put_disabled,
367 HTMLTextAreaElement_get_disabled,
368 HTMLTextAreaElement_get_form,
369 HTMLTextAreaElement_put_defaultValue,
370 HTMLTextAreaElement_get_defaultValue,
371 HTMLTextAreaElement_select,
372 HTMLTextAreaElement_put_onchange,
373 HTMLTextAreaElement_get_onchange,
374 HTMLTextAreaElement_put_onselect,
375 HTMLTextAreaElement_get_onselect,
376 HTMLTextAreaElement_put_readOnly,
377 HTMLTextAreaElement_get_readOnly,
378 HTMLTextAreaElement_put_rows,
379 HTMLTextAreaElement_get_rows,
380 HTMLTextAreaElement_put_cols,
381 HTMLTextAreaElement_get_cols,
382 HTMLTextAreaElement_put_wrap,
383 HTMLTextAreaElement_get_wrap,
384 HTMLTextAreaElement_createTextRange
387 #define HTMLTXTAREA_NODE_THIS(iface) DEFINE_THIS2(HTMLTextAreaElement, element.node, iface)
389 static HRESULT HTMLTextAreaElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
391 HTMLTextAreaElement *This = HTMLTXTAREA_NODE_THIS(iface);
393 *ppv = NULL;
395 if(IsEqualGUID(&IID_IUnknown, riid)) {
396 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
397 *ppv = HTMLTXTAREA(This);
398 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
399 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
400 *ppv = HTMLTXTAREA(This);
401 }else if(IsEqualGUID(&IID_IHTMLTextAreaElement, riid)) {
402 TRACE("(%p)->(IID_IHTMLTextAreaElement %p)\n", This, ppv);
403 *ppv = HTMLTXTAREA(This);
406 if(*ppv) {
407 IUnknown_AddRef((IUnknown*)*ppv);
408 return S_OK;
411 return HTMLElement_QI(&This->element.node, riid, ppv);
414 static void HTMLTextAreaElement_destructor(HTMLDOMNode *iface)
416 HTMLTextAreaElement *This = HTMLTXTAREA_NODE_THIS(iface);
418 nsIDOMHTMLTextAreaElement_Release(This->nstextarea);
420 HTMLElement_destructor(&This->element.node);
423 static HRESULT HTMLTextAreaElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
425 HTMLTextAreaElement *This = HTMLTXTAREA_NODE_THIS(iface);
426 return IHTMLTextAreaElement_put_disabled(HTMLTXTAREA(This), v);
429 static HRESULT HTMLTextAreaElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
431 HTMLTextAreaElement *This = HTMLTXTAREA_NODE_THIS(iface);
432 return IHTMLTextAreaElement_get_disabled(HTMLTXTAREA(This), p);
435 #undef HTMLTXTAREA_NODE_THIS
437 static const NodeImplVtbl HTMLTextAreaElementImplVtbl = {
438 HTMLTextAreaElement_QI,
439 HTMLTextAreaElement_destructor,
440 NULL,
441 NULL,
442 HTMLTextAreaElementImpl_put_disabled,
443 HTMLTextAreaElementImpl_get_disabled
446 static const tid_t HTMLTextAreaElement_iface_tids[] = {
447 HTMLELEMENT_TIDS,
448 IHTMLTextAreaElement_tid,
452 static dispex_static_data_t HTMLTextAreaElement_dispex = {
453 NULL,
454 DispHTMLTextAreaElement_tid,
455 NULL,
456 HTMLTextAreaElement_iface_tids
459 HTMLElement *HTMLTextAreaElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem)
461 HTMLTextAreaElement *ret = heap_alloc_zero(sizeof(HTMLTextAreaElement));
462 nsresult nsres;
464 ret->lpHTMLTextAreaElementVtbl = &HTMLTextAreaElementVtbl;
465 ret->element.node.vtbl = &HTMLTextAreaElementImplVtbl;
467 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTextAreaElement_dispex);
469 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTextAreaElement,
470 (void**)&ret->nstextarea);
471 if(NS_FAILED(nsres))
472 ERR("Could not get nsDOMHTMLInputElement: %08x\n", nsres);
474 return &ret->element;