secur32: Update ntlm_auth version detection to detect new samba4 version numbers.
[wine] / dlls / mshtml / htmltextarea.c
1 /*
2  * Copyright 2006 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #include "config.h"
20
21 #include <stdarg.h>
22 #include <stdio.h>
23
24 #define COBJMACROS
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "winnls.h"
30 #include "ole2.h"
31
32 #include "wine/debug.h"
33
34 #include "mshtml_private.h"
35
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
37
38 typedef struct {
39     const IHTMLTextAreaElementVtbl *lpHTMLTextAreaElementVtbl;
40
41     HTMLElement *element;
42     nsIDOMHTMLTextAreaElement *nstextarea;
43 } HTMLTextAreaElement;
44
45 #define HTMLTXTAREA(x)  ((IHTMLTextAreaElement*)  &(x)->lpHTMLTextAreaElementVtbl)
46
47 #define HTMLTXTAREA_THIS(iface) DEFINE_THIS(HTMLTextAreaElement, HTMLTextAreaElement, iface)
48
49 static HRESULT WINAPI HTMLTextAreaElement_QueryInterface(IHTMLTextAreaElement *iface,
50                                                          REFIID riid, void **ppv)
51 {
52     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
53
54     *ppv = NULL;
55
56     if(IsEqualGUID(&IID_IUnknown, riid)) {
57         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
58         *ppv = HTMLTXTAREA(This);
59     }else if(IsEqualGUID(&IID_IDispatch, riid)) {
60         TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
61         *ppv = HTMLTXTAREA(This);
62     }else if(IsEqualGUID(&IID_IHTMLTextAreaElement, riid)) {
63         TRACE("(%p)->(IID_IHTMLTextAreaElement %p)\n", This, ppv);
64         *ppv = HTMLTXTAREA(This);
65     }else if(IsEqualGUID(&IID_IHTMLElement, riid)) {
66         TRACE("(%p)->(IID_IHTMLElement %p)\n", This, ppv);
67         *ppv = HTMLELEM(This->element);
68     }else if(IsEqualGUID(&IID_IHTMLDOMNode, riid)) {
69         TRACE("(%p)->(IID_IHTMLDOMNode %p)\n", This, ppv);
70         *ppv = HTMLDOMNODE(This->element->node);
71     }
72
73     if(*ppv) {
74         IUnknown_AddRef((IUnknown*)*ppv);
75         return S_OK;
76     }
77
78     WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
79     return E_NOINTERFACE;
80 }
81
82 static ULONG WINAPI HTMLTextAreaElement_AddRef(IHTMLTextAreaElement *iface)
83 {
84     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
85
86     TRACE("(%p)\n", This);
87
88     return IHTMLDocument2_AddRef(HTMLDOC(This->element->node->doc));
89 }
90
91 static ULONG WINAPI HTMLTextAreaElement_Release(IHTMLTextAreaElement *iface)
92 {
93     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
94
95     TRACE("(%p)\n", This);
96
97     return IHTMLDocument2_Release(HTMLDOC(This->element->node->doc));
98 }
99
100 static HRESULT WINAPI HTMLTextAreaElement_GetTypeInfoCount(IHTMLTextAreaElement *iface, UINT *pctinfo)
101 {
102     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
103     FIXME("(%p)->(%p)\n", This, pctinfo);
104     return E_NOTIMPL;
105 }
106
107 static HRESULT WINAPI HTMLTextAreaElement_GetTypeInfo(IHTMLTextAreaElement *iface, UINT iTInfo,
108                                               LCID lcid, ITypeInfo **ppTInfo)
109 {
110     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
111     FIXME("(%p)->(%u %lu %p)\n", This, iTInfo, lcid, ppTInfo);
112     return E_NOTIMPL;
113 }
114
115 static HRESULT WINAPI HTMLTextAreaElement_GetIDsOfNames(IHTMLTextAreaElement *iface, REFIID riid,
116                                                 LPOLESTR *rgszNames, UINT cNames,
117                                                 LCID lcid, DISPID *rgDispId)
118 {
119     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
120     FIXME("(%p)->(%s %p %u %lu %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
121                                         lcid, rgDispId);
122     return E_NOTIMPL;
123 }
124
125 static HRESULT WINAPI HTMLTextAreaElement_Invoke(IHTMLTextAreaElement *iface, DISPID dispIdMember,
126                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
127                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
128 {
129     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
130     FIXME("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
131             lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
132     return E_NOTIMPL;
133 }
134
135 static HRESULT WINAPI HTMLTextAreaElement_get_type(IHTMLTextAreaElement *iface, BSTR *p)
136 {
137     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
138     FIXME("(%p)->(%p)\n", This, p);
139     return E_NOTIMPL;
140 }
141
142 static HRESULT WINAPI HTMLTextAreaElement_put_value(IHTMLTextAreaElement *iface, BSTR v)
143 {
144     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
145     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
146     return E_NOTIMPL;
147 }
148
149 static HRESULT WINAPI HTMLTextAreaElement_get_value(IHTMLTextAreaElement *iface, BSTR *p)
150 {
151     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
152     nsAString value_str;
153     const PRUnichar *value;
154     nsresult nsres;
155
156     TRACE("(%p)->(%p)\n", This, p);
157
158     nsAString_Init(&value_str, NULL);
159
160     nsres = nsIDOMHTMLTextAreaElement_GetValue(This->nstextarea, &value_str);
161     if(NS_SUCCEEDED(nsres)) {
162         nsAString_GetData(&value_str, &value, NULL);
163         *p = SysAllocString(value);
164     }else {
165         ERR("GetValue failed: %08lx\n", nsres);
166     }
167
168     nsAString_Finish(&value_str);
169
170     TRACE("%s\n", debugstr_w(*p));
171     return S_OK;
172 }
173
174 static HRESULT WINAPI HTMLTextAreaElement_put_name(IHTMLTextAreaElement *iface, BSTR v)
175 {
176     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
177     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
178     return E_NOTIMPL;
179 }
180
181 static HRESULT WINAPI HTMLTextAreaElement_get_name(IHTMLTextAreaElement *iface, BSTR *p)
182 {
183     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
184     nsAString name_str;
185     const PRUnichar *name;
186     nsresult nsres;
187
188     TRACE("(%p)->(%p)\n", This, p);
189
190     nsAString_Init(&name_str, NULL);
191
192     nsres = nsIDOMHTMLTextAreaElement_GetName(This->nstextarea, &name_str);
193     if(NS_SUCCEEDED(nsres)) {
194         nsAString_GetData(&name_str, &name, NULL);
195         *p = SysAllocString(name);
196     }else {
197         ERR("GetName failed: %08lx\n", nsres);
198     }
199
200     nsAString_Finish(&name_str);
201
202     TRACE("%s\n", debugstr_w(*p));
203     return S_OK;
204 }
205
206 static HRESULT WINAPI HTMLTextAreaElement_put_status(IHTMLTextAreaElement *iface, VARIANT v)
207 {
208     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
209     FIXME("(%p)->()\n", This);
210     return E_NOTIMPL;
211 }
212
213 static HRESULT WINAPI HTMLTextAreaElement_get_status(IHTMLTextAreaElement *iface, VARIANT *p)
214 {
215     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
216     FIXME("(%p)->(%p)\n", This, p);
217     return E_NOTIMPL;
218 }
219
220 static HRESULT WINAPI HTMLTextAreaElement_put_disabled(IHTMLTextAreaElement *iface, VARIANT_BOOL v)
221 {
222     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
223     FIXME("(%p)->(%x)\n", This, v);
224     return E_NOTIMPL;
225 }
226
227 static HRESULT WINAPI HTMLTextAreaElement_get_disabled(IHTMLTextAreaElement *iface, VARIANT_BOOL *p)
228 {
229     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
230     FIXME("(%p)->(%p)\n", This, p);
231     return E_NOTIMPL;
232 }
233
234 static HRESULT WINAPI HTMLTextAreaElement_get_form(IHTMLTextAreaElement *iface, IHTMLFormElement **p)
235 {
236     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
237     FIXME("(%p)->(%p)\n", This, p);
238     return E_NOTIMPL;
239 }
240
241 static HRESULT WINAPI HTMLTextAreaElement_put_defaultValue(IHTMLTextAreaElement *iface, BSTR v)
242 {
243     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
244     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
245     return E_NOTIMPL;
246 }
247
248 static HRESULT WINAPI HTMLTextAreaElement_get_defaultValue(IHTMLTextAreaElement *iface, BSTR *p)
249 {
250     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
251     FIXME("(%p)->(%p)\n", This, p);
252     return E_NOTIMPL;
253 }
254
255 static HRESULT WINAPI HTMLTextAreaElement_select(IHTMLTextAreaElement *iface)
256 {
257     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
258     FIXME("(%p)\n", This);
259     return E_NOTIMPL;
260 }
261
262 static HRESULT WINAPI HTMLTextAreaElement_put_onchange(IHTMLTextAreaElement *iface, VARIANT v)
263 {
264     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
265     FIXME("(%p)->()\n", This);
266     return E_NOTIMPL;
267 }
268
269 static HRESULT WINAPI HTMLTextAreaElement_get_onchange(IHTMLTextAreaElement *iface, VARIANT *p)
270 {
271     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
272     FIXME("(%p)->(%p)\n", This, p);
273     return E_NOTIMPL;
274 }
275
276 static HRESULT WINAPI HTMLTextAreaElement_put_onselect(IHTMLTextAreaElement *iface, VARIANT v)
277 {
278     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
279     FIXME("(%p)->()\n", This);
280     return E_NOTIMPL;
281 }
282
283 static HRESULT WINAPI HTMLTextAreaElement_get_onselect(IHTMLTextAreaElement *iface, VARIANT *p)
284 {
285     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
286     FIXME("(%p)->(%p)\n", This, p);
287     return E_NOTIMPL;
288 }
289
290 static HRESULT WINAPI HTMLTextAreaElement_put_readOnly(IHTMLTextAreaElement *iface, VARIANT_BOOL v)
291 {
292     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
293     FIXME("(%p)->(%x)\n", This, v);
294     return E_NOTIMPL;
295 }
296
297 static HRESULT WINAPI HTMLTextAreaElement_get_readOnly(IHTMLTextAreaElement *iface, VARIANT_BOOL *p)
298 {
299     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
300     FIXME("(%p)->(%p)\n", This, p);
301     return E_NOTIMPL;
302 }
303
304 static HRESULT WINAPI HTMLTextAreaElement_put_rows(IHTMLTextAreaElement *iface, long v)
305 {
306     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
307     FIXME("(%p)->(%ld)\n", This, v);
308     return E_NOTIMPL;
309 }
310
311 static HRESULT WINAPI HTMLTextAreaElement_get_rows(IHTMLTextAreaElement *iface, long *p)
312 {
313     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
314     FIXME("(%p)->(%p)\n", This, p);
315     return E_NOTIMPL;
316 }
317
318 static HRESULT WINAPI HTMLTextAreaElement_put_cols(IHTMLTextAreaElement *iface, long v)
319 {
320     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
321     FIXME("(%p)->(%ld)\n", This, v);
322     return E_NOTIMPL;
323 }
324
325 static HRESULT WINAPI HTMLTextAreaElement_get_cols(IHTMLTextAreaElement *iface, long *p)
326 {
327     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
328     FIXME("(%p)->(%p)\n", This, p);
329     return E_NOTIMPL;
330 }
331
332 static HRESULT WINAPI HTMLTextAreaElement_put_wrap(IHTMLTextAreaElement *iface, BSTR v)
333 {
334     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
335     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
336     return E_NOTIMPL;
337 }
338
339 static HRESULT WINAPI HTMLTextAreaElement_get_wrap(IHTMLTextAreaElement *iface, BSTR *p)
340 {
341     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
342     FIXME("(%p)->(%p)\n", This, p);
343     return E_NOTIMPL;
344 }
345
346 static HRESULT WINAPI HTMLTextAreaElement_createTextRange(IHTMLTextAreaElement *iface,
347                                                           IHTMLTxtRange **range)
348 {
349     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
350     FIXME("(%p)->(%p)\n", This, range);
351     return E_NOTIMPL;
352 }
353
354 static void HTMLTextAreaElement_destructor(IUnknown *iface)
355 {
356     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
357
358     nsIDOMHTMLTextAreaElement_Release(This->nstextarea);
359     HeapFree(GetProcessHeap(), 0, This);
360 }
361
362 #undef HTMLTXTAREA_THIS
363
364 static const IHTMLTextAreaElementVtbl HTMLTextAreaElementVtbl = {
365     HTMLTextAreaElement_QueryInterface,
366     HTMLTextAreaElement_AddRef,
367     HTMLTextAreaElement_Release,
368     HTMLTextAreaElement_GetTypeInfoCount,
369     HTMLTextAreaElement_GetTypeInfo,
370     HTMLTextAreaElement_GetIDsOfNames,
371     HTMLTextAreaElement_Invoke,
372     HTMLTextAreaElement_get_type,
373     HTMLTextAreaElement_put_value,
374     HTMLTextAreaElement_get_value,
375     HTMLTextAreaElement_put_name,
376     HTMLTextAreaElement_get_name,
377     HTMLTextAreaElement_put_status,
378     HTMLTextAreaElement_get_status,
379     HTMLTextAreaElement_put_disabled,
380     HTMLTextAreaElement_get_disabled,
381     HTMLTextAreaElement_get_form,
382     HTMLTextAreaElement_put_defaultValue,
383     HTMLTextAreaElement_get_defaultValue,
384     HTMLTextAreaElement_select,
385     HTMLTextAreaElement_put_onchange,
386     HTMLTextAreaElement_get_onchange,
387     HTMLTextAreaElement_put_onselect,
388     HTMLTextAreaElement_get_onselect,
389     HTMLTextAreaElement_put_readOnly,
390     HTMLTextAreaElement_get_readOnly,
391     HTMLTextAreaElement_put_rows,
392     HTMLTextAreaElement_get_rows,
393     HTMLTextAreaElement_put_cols,
394     HTMLTextAreaElement_get_cols,
395     HTMLTextAreaElement_put_wrap,
396     HTMLTextAreaElement_get_wrap,
397     HTMLTextAreaElement_createTextRange
398 };
399
400 void HTMLTextAreaElement_Create(HTMLElement *element)
401 {
402     HTMLTextAreaElement *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLTextAreaElement));
403     nsresult nsres;
404
405     ret->lpHTMLTextAreaElementVtbl = &HTMLTextAreaElementVtbl;
406     ret->element = element;
407
408     nsres = nsIDOMHTMLElement_QueryInterface(element->nselem, &IID_nsIDOMHTMLTextAreaElement,
409                                              (void**)&ret->nstextarea);
410     if(NS_FAILED(nsres))
411         ERR("Could not get nsDOMHTMLInputElement: %08lx\n", nsres);
412
413     element->impl = (IUnknown*)HTMLTXTAREA(ret);
414     element->destructor = HTMLTextAreaElement_destructor;
415 }