mshtml: Rename the wrappers around HeapAlloc() &Co to use the new standard naming.
[wine.git] / dlls / mshtml / htmltextarea.c
blob585650f125c03dacf6fd0a41cbd6a562575e37ef
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 "config.h"
21 #include <stdarg.h>
22 #include <stdio.h>
24 #define COBJMACROS
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "winnls.h"
30 #include "ole2.h"
32 #include "wine/debug.h"
34 #include "mshtml_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
38 typedef struct {
39 HTMLElement element;
41 const IHTMLTextAreaElementVtbl *lpHTMLTextAreaElementVtbl;
43 nsIDOMHTMLTextAreaElement *nstextarea;
44 } HTMLTextAreaElement;
46 #define HTMLTXTAREA(x) ((IHTMLTextAreaElement*) &(x)->lpHTMLTextAreaElementVtbl)
48 #define HTMLTXTAREA_THIS(iface) DEFINE_THIS(HTMLTextAreaElement, HTMLTextAreaElement, iface)
50 static HRESULT WINAPI HTMLTextAreaElement_QueryInterface(IHTMLTextAreaElement *iface,
51 REFIID riid, void **ppv)
53 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
55 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
58 static ULONG WINAPI HTMLTextAreaElement_AddRef(IHTMLTextAreaElement *iface)
60 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
62 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
65 static ULONG WINAPI HTMLTextAreaElement_Release(IHTMLTextAreaElement *iface)
67 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
69 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
72 static HRESULT WINAPI HTMLTextAreaElement_GetTypeInfoCount(IHTMLTextAreaElement *iface, UINT *pctinfo)
74 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
75 FIXME("(%p)->(%p)\n", This, pctinfo);
76 return E_NOTIMPL;
79 static HRESULT WINAPI HTMLTextAreaElement_GetTypeInfo(IHTMLTextAreaElement *iface, UINT iTInfo,
80 LCID lcid, ITypeInfo **ppTInfo)
82 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
83 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
84 return E_NOTIMPL;
87 static HRESULT WINAPI HTMLTextAreaElement_GetIDsOfNames(IHTMLTextAreaElement *iface, REFIID riid,
88 LPOLESTR *rgszNames, UINT cNames,
89 LCID lcid, DISPID *rgDispId)
91 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
92 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
93 lcid, rgDispId);
94 return E_NOTIMPL;
97 static HRESULT WINAPI HTMLTextAreaElement_Invoke(IHTMLTextAreaElement *iface, DISPID dispIdMember,
98 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
99 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
101 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
102 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
103 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
104 return E_NOTIMPL;
107 static HRESULT WINAPI HTMLTextAreaElement_get_type(IHTMLTextAreaElement *iface, BSTR *p)
109 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
110 FIXME("(%p)->(%p)\n", This, p);
111 return E_NOTIMPL;
114 static HRESULT WINAPI HTMLTextAreaElement_put_value(IHTMLTextAreaElement *iface, BSTR v)
116 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
117 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
118 return E_NOTIMPL;
121 static HRESULT WINAPI HTMLTextAreaElement_get_value(IHTMLTextAreaElement *iface, BSTR *p)
123 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
124 nsAString value_str;
125 const PRUnichar *value;
126 nsresult nsres;
128 TRACE("(%p)->(%p)\n", This, p);
130 nsAString_Init(&value_str, NULL);
132 nsres = nsIDOMHTMLTextAreaElement_GetValue(This->nstextarea, &value_str);
133 if(NS_SUCCEEDED(nsres)) {
134 nsAString_GetData(&value_str, &value, NULL);
135 *p = SysAllocString(value);
136 }else {
137 ERR("GetValue failed: %08x\n", nsres);
140 nsAString_Finish(&value_str);
142 TRACE("%s\n", debugstr_w(*p));
143 return S_OK;
146 static HRESULT WINAPI HTMLTextAreaElement_put_name(IHTMLTextAreaElement *iface, BSTR v)
148 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
149 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
150 return E_NOTIMPL;
153 static HRESULT WINAPI HTMLTextAreaElement_get_name(IHTMLTextAreaElement *iface, BSTR *p)
155 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
156 nsAString name_str;
157 const PRUnichar *name;
158 nsresult nsres;
160 TRACE("(%p)->(%p)\n", This, p);
162 nsAString_Init(&name_str, NULL);
164 nsres = nsIDOMHTMLTextAreaElement_GetName(This->nstextarea, &name_str);
165 if(NS_SUCCEEDED(nsres)) {
166 nsAString_GetData(&name_str, &name, NULL);
167 *p = SysAllocString(name);
168 }else {
169 ERR("GetName failed: %08x\n", nsres);
172 nsAString_Finish(&name_str);
174 TRACE("%s\n", debugstr_w(*p));
175 return S_OK;
178 static HRESULT WINAPI HTMLTextAreaElement_put_status(IHTMLTextAreaElement *iface, VARIANT v)
180 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
181 FIXME("(%p)->()\n", This);
182 return E_NOTIMPL;
185 static HRESULT WINAPI HTMLTextAreaElement_get_status(IHTMLTextAreaElement *iface, VARIANT *p)
187 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
188 FIXME("(%p)->(%p)\n", This, p);
189 return E_NOTIMPL;
192 static HRESULT WINAPI HTMLTextAreaElement_put_disabled(IHTMLTextAreaElement *iface, VARIANT_BOOL v)
194 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
195 FIXME("(%p)->(%x)\n", This, v);
196 return E_NOTIMPL;
199 static HRESULT WINAPI HTMLTextAreaElement_get_disabled(IHTMLTextAreaElement *iface, VARIANT_BOOL *p)
201 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
202 FIXME("(%p)->(%p)\n", This, p);
203 return E_NOTIMPL;
206 static HRESULT WINAPI HTMLTextAreaElement_get_form(IHTMLTextAreaElement *iface, IHTMLFormElement **p)
208 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
209 FIXME("(%p)->(%p)\n", This, p);
210 return E_NOTIMPL;
213 static HRESULT WINAPI HTMLTextAreaElement_put_defaultValue(IHTMLTextAreaElement *iface, BSTR v)
215 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
216 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
217 return E_NOTIMPL;
220 static HRESULT WINAPI HTMLTextAreaElement_get_defaultValue(IHTMLTextAreaElement *iface, BSTR *p)
222 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
223 FIXME("(%p)->(%p)\n", This, p);
224 return E_NOTIMPL;
227 static HRESULT WINAPI HTMLTextAreaElement_select(IHTMLTextAreaElement *iface)
229 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
230 FIXME("(%p)\n", This);
231 return E_NOTIMPL;
234 static HRESULT WINAPI HTMLTextAreaElement_put_onchange(IHTMLTextAreaElement *iface, VARIANT v)
236 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
237 FIXME("(%p)->()\n", This);
238 return E_NOTIMPL;
241 static HRESULT WINAPI HTMLTextAreaElement_get_onchange(IHTMLTextAreaElement *iface, VARIANT *p)
243 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
244 FIXME("(%p)->(%p)\n", This, p);
245 return E_NOTIMPL;
248 static HRESULT WINAPI HTMLTextAreaElement_put_onselect(IHTMLTextAreaElement *iface, VARIANT v)
250 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
251 FIXME("(%p)->()\n", This);
252 return E_NOTIMPL;
255 static HRESULT WINAPI HTMLTextAreaElement_get_onselect(IHTMLTextAreaElement *iface, VARIANT *p)
257 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
258 FIXME("(%p)->(%p)\n", This, p);
259 return E_NOTIMPL;
262 static HRESULT WINAPI HTMLTextAreaElement_put_readOnly(IHTMLTextAreaElement *iface, VARIANT_BOOL v)
264 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
265 FIXME("(%p)->(%x)\n", This, v);
266 return E_NOTIMPL;
269 static HRESULT WINAPI HTMLTextAreaElement_get_readOnly(IHTMLTextAreaElement *iface, VARIANT_BOOL *p)
271 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
272 FIXME("(%p)->(%p)\n", This, p);
273 return E_NOTIMPL;
276 static HRESULT WINAPI HTMLTextAreaElement_put_rows(IHTMLTextAreaElement *iface, long v)
278 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
279 FIXME("(%p)->(%ld)\n", This, v);
280 return E_NOTIMPL;
283 static HRESULT WINAPI HTMLTextAreaElement_get_rows(IHTMLTextAreaElement *iface, long *p)
285 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
286 FIXME("(%p)->(%p)\n", This, p);
287 return E_NOTIMPL;
290 static HRESULT WINAPI HTMLTextAreaElement_put_cols(IHTMLTextAreaElement *iface, long v)
292 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
293 FIXME("(%p)->(%ld)\n", This, v);
294 return E_NOTIMPL;
297 static HRESULT WINAPI HTMLTextAreaElement_get_cols(IHTMLTextAreaElement *iface, long *p)
299 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
300 FIXME("(%p)->(%p)\n", This, p);
301 return E_NOTIMPL;
304 static HRESULT WINAPI HTMLTextAreaElement_put_wrap(IHTMLTextAreaElement *iface, BSTR v)
306 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
307 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
308 return E_NOTIMPL;
311 static HRESULT WINAPI HTMLTextAreaElement_get_wrap(IHTMLTextAreaElement *iface, BSTR *p)
313 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
314 FIXME("(%p)->(%p)\n", This, p);
315 return E_NOTIMPL;
318 static HRESULT WINAPI HTMLTextAreaElement_createTextRange(IHTMLTextAreaElement *iface,
319 IHTMLTxtRange **range)
321 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
322 FIXME("(%p)->(%p)\n", This, range);
323 return E_NOTIMPL;
326 #undef HTMLTXTAREA_THIS
328 static const IHTMLTextAreaElementVtbl HTMLTextAreaElementVtbl = {
329 HTMLTextAreaElement_QueryInterface,
330 HTMLTextAreaElement_AddRef,
331 HTMLTextAreaElement_Release,
332 HTMLTextAreaElement_GetTypeInfoCount,
333 HTMLTextAreaElement_GetTypeInfo,
334 HTMLTextAreaElement_GetIDsOfNames,
335 HTMLTextAreaElement_Invoke,
336 HTMLTextAreaElement_get_type,
337 HTMLTextAreaElement_put_value,
338 HTMLTextAreaElement_get_value,
339 HTMLTextAreaElement_put_name,
340 HTMLTextAreaElement_get_name,
341 HTMLTextAreaElement_put_status,
342 HTMLTextAreaElement_get_status,
343 HTMLTextAreaElement_put_disabled,
344 HTMLTextAreaElement_get_disabled,
345 HTMLTextAreaElement_get_form,
346 HTMLTextAreaElement_put_defaultValue,
347 HTMLTextAreaElement_get_defaultValue,
348 HTMLTextAreaElement_select,
349 HTMLTextAreaElement_put_onchange,
350 HTMLTextAreaElement_get_onchange,
351 HTMLTextAreaElement_put_onselect,
352 HTMLTextAreaElement_get_onselect,
353 HTMLTextAreaElement_put_readOnly,
354 HTMLTextAreaElement_get_readOnly,
355 HTMLTextAreaElement_put_rows,
356 HTMLTextAreaElement_get_rows,
357 HTMLTextAreaElement_put_cols,
358 HTMLTextAreaElement_get_cols,
359 HTMLTextAreaElement_put_wrap,
360 HTMLTextAreaElement_get_wrap,
361 HTMLTextAreaElement_createTextRange
364 #define HTMLTXTAREA_NODE_THIS(iface) DEFINE_THIS2(HTMLTextAreaElement, element.node, iface)
366 static HRESULT HTMLTextAreaElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
368 HTMLTextAreaElement *This = HTMLTXTAREA_NODE_THIS(iface);
370 *ppv = NULL;
372 if(IsEqualGUID(&IID_IUnknown, riid)) {
373 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
374 *ppv = HTMLTXTAREA(This);
375 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
376 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
377 *ppv = HTMLTXTAREA(This);
378 }else if(IsEqualGUID(&IID_IHTMLTextAreaElement, riid)) {
379 TRACE("(%p)->(IID_IHTMLTextAreaElement %p)\n", This, ppv);
380 *ppv = HTMLTXTAREA(This);
383 if(*ppv) {
384 IUnknown_AddRef((IUnknown*)*ppv);
385 return S_OK;
388 return HTMLElement_QI(&This->element.node, riid, ppv);
391 static void HTMLTextAreaElement_destructor(HTMLDOMNode *iface)
393 HTMLTextAreaElement *This = HTMLTXTAREA_NODE_THIS(iface);
395 nsIDOMHTMLTextAreaElement_Release(This->nstextarea);
397 HTMLElement_destructor(&This->element.node);
400 #undef HTMLTXTAREA_NODE_THIS
402 static const NodeImplVtbl HTMLTextAreaElementImplVtbl = {
403 HTMLTextAreaElement_QI,
404 HTMLTextAreaElement_destructor
407 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement *nselem)
409 HTMLTextAreaElement *ret = heap_alloc(sizeof(HTMLTextAreaElement));
410 nsresult nsres;
412 HTMLElement_Init(&ret->element);
414 ret->lpHTMLTextAreaElementVtbl = &HTMLTextAreaElementVtbl;
415 ret->element.node.vtbl = &HTMLTextAreaElementImplVtbl;
417 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTextAreaElement,
418 (void**)&ret->nstextarea);
419 if(NS_FAILED(nsres))
420 ERR("Could not get nsDOMHTMLInputElement: %08x\n", nsres);
422 return &ret->element;