wldap32: Return an error when ldap_parse_sort_control or ldap_parse_vlv_control is...
[wine/multimedia.git] / dlls / mshtml / htmlimg.c
blob50c3c65e86fd48c5c1d1c2af8b233d915ec46a98
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 IHTMLImgElementVtbl *lpHTMLImgElementVtbl;
39 nsIDOMHTMLImageElement *nsimg;
40 } HTMLImgElement;
42 #define HTMLIMG(x) ((IHTMLImgElement*) &(x)->lpHTMLImgElementVtbl)
44 #define HTMLIMG_THIS(iface) DEFINE_THIS(HTMLImgElement, HTMLImgElement, iface)
46 static HRESULT WINAPI HTMLImgElement_QueryInterface(IHTMLImgElement *iface, REFIID riid, void **ppv)
48 HTMLImgElement *This = HTMLIMG_THIS(iface);
50 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
53 static ULONG WINAPI HTMLImgElement_AddRef(IHTMLImgElement *iface)
55 HTMLImgElement *This = HTMLIMG_THIS(iface);
57 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
60 static ULONG WINAPI HTMLImgElement_Release(IHTMLImgElement *iface)
62 HTMLImgElement *This = HTMLIMG_THIS(iface);
64 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
67 static HRESULT WINAPI HTMLImgElement_GetTypeInfoCount(IHTMLImgElement *iface, UINT *pctinfo)
69 HTMLImgElement *This = HTMLIMG_THIS(iface);
70 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->element.node.dispex), pctinfo);
73 static HRESULT WINAPI HTMLImgElement_GetTypeInfo(IHTMLImgElement *iface, UINT iTInfo,
74 LCID lcid, ITypeInfo **ppTInfo)
76 HTMLImgElement *This = HTMLIMG_THIS(iface);
77 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->element.node.dispex), iTInfo, lcid, ppTInfo);
80 static HRESULT WINAPI HTMLImgElement_GetIDsOfNames(IHTMLImgElement *iface, REFIID riid,
81 LPOLESTR *rgszNames, UINT cNames,
82 LCID lcid, DISPID *rgDispId)
84 HTMLImgElement *This = HTMLIMG_THIS(iface);
85 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
88 static HRESULT WINAPI HTMLImgElement_Invoke(IHTMLImgElement *iface, DISPID dispIdMember,
89 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
90 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
92 HTMLImgElement *This = HTMLIMG_THIS(iface);
93 return IDispatchEx_Invoke(DISPATCHEX(&This->element.node.dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
94 pVarResult, pExcepInfo, puArgErr);
97 static HRESULT WINAPI HTMLImgElement_put_isMap(IHTMLImgElement *iface, VARIANT_BOOL v)
99 HTMLImgElement *This = HTMLIMG_THIS(iface);
100 FIXME("(%p)->(%x)\n", This, v);
101 return E_NOTIMPL;
104 static HRESULT WINAPI HTMLImgElement_get_isMap(IHTMLImgElement *iface, VARIANT_BOOL *p)
106 HTMLImgElement *This = HTMLIMG_THIS(iface);
107 FIXME("(%p)->(%p)\n", This, p);
108 return E_NOTIMPL;
111 static HRESULT WINAPI HTMLImgElement_put_useMap(IHTMLImgElement *iface, BSTR v)
113 HTMLImgElement *This = HTMLIMG_THIS(iface);
114 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
115 return E_NOTIMPL;
118 static HRESULT WINAPI HTMLImgElement_get_useMap(IHTMLImgElement *iface, BSTR *p)
120 HTMLImgElement *This = HTMLIMG_THIS(iface);
121 FIXME("(%p)->(%p)\n", This, p);
122 return E_NOTIMPL;
125 static HRESULT WINAPI HTMLImgElement_get_mimeType(IHTMLImgElement *iface, BSTR *p)
127 HTMLImgElement *This = HTMLIMG_THIS(iface);
128 FIXME("(%p)->(%p)\n", This, p);
129 return E_NOTIMPL;
132 static HRESULT WINAPI HTMLImgElement_get_fileSize(IHTMLImgElement *iface, BSTR *p)
134 HTMLImgElement *This = HTMLIMG_THIS(iface);
135 FIXME("(%p)->(%p)\n", This, p);
136 return E_NOTIMPL;
139 static HRESULT WINAPI HTMLImgElement_get_fileCreatedDate(IHTMLImgElement *iface, BSTR *p)
141 HTMLImgElement *This = HTMLIMG_THIS(iface);
142 FIXME("(%p)->(%p)\n", This, p);
143 return E_NOTIMPL;
146 static HRESULT WINAPI HTMLImgElement_get_fileModifiedDate(IHTMLImgElement *iface, BSTR *p)
148 HTMLImgElement *This = HTMLIMG_THIS(iface);
149 FIXME("(%p)->(%p)\n", This, p);
150 return E_NOTIMPL;
153 static HRESULT WINAPI HTMLImgElement_get_fileUpdatedDate(IHTMLImgElement *iface, BSTR *p)
155 HTMLImgElement *This = HTMLIMG_THIS(iface);
156 FIXME("(%p)->(%p)\n", This, p);
157 return E_NOTIMPL;
160 static HRESULT WINAPI HTMLImgElement_get_protocol(IHTMLImgElement *iface, BSTR *p)
162 HTMLImgElement *This = HTMLIMG_THIS(iface);
163 FIXME("(%p)->(%p)\n", This, p);
164 return E_NOTIMPL;
167 static HRESULT WINAPI HTMLImgElement_get_href(IHTMLImgElement *iface, BSTR *p)
169 HTMLImgElement *This = HTMLIMG_THIS(iface);
170 FIXME("(%p)->(%p)\n", This, p);
171 return E_NOTIMPL;
174 static HRESULT WINAPI HTMLImgElement_get_nameProp(IHTMLImgElement *iface, BSTR *p)
176 HTMLImgElement *This = HTMLIMG_THIS(iface);
177 FIXME("(%p)->(%p)\n", This, p);
178 return E_NOTIMPL;
181 static HRESULT WINAPI HTMLImgElement_put_border(IHTMLImgElement *iface, VARIANT v)
183 HTMLImgElement *This = HTMLIMG_THIS(iface);
184 FIXME("(%p)->()\n", This);
185 return E_NOTIMPL;
188 static HRESULT WINAPI HTMLImgElement_get_border(IHTMLImgElement *iface, VARIANT *p)
190 HTMLImgElement *This = HTMLIMG_THIS(iface);
191 FIXME("(%p)->(%p)\n", This, p);
192 return E_NOTIMPL;
195 static HRESULT WINAPI HTMLImgElement_put_vspace(IHTMLImgElement *iface, long v)
197 HTMLImgElement *This = HTMLIMG_THIS(iface);
198 FIXME("(%p)->(%ld)\n", This, v);
199 return E_NOTIMPL;
202 static HRESULT WINAPI HTMLImgElement_get_vspace(IHTMLImgElement *iface, long *p)
204 HTMLImgElement *This = HTMLIMG_THIS(iface);
205 FIXME("(%p)->(%p)\n", This, p);
206 return E_NOTIMPL;
209 static HRESULT WINAPI HTMLImgElement_put_hspace(IHTMLImgElement *iface, long v)
211 HTMLImgElement *This = HTMLIMG_THIS(iface);
212 FIXME("(%p)->(%ld)\n", This, v);
213 return E_NOTIMPL;
216 static HRESULT WINAPI HTMLImgElement_get_hspace(IHTMLImgElement *iface, long *p)
218 HTMLImgElement *This = HTMLIMG_THIS(iface);
219 FIXME("(%p)->(%p)\n", This, p);
220 return E_NOTIMPL;
223 static HRESULT WINAPI HTMLImgElement_put_alt(IHTMLImgElement *iface, BSTR v)
225 HTMLImgElement *This = HTMLIMG_THIS(iface);
226 nsAString alt_str;
227 nsresult nsres;
229 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
231 nsAString_Init(&alt_str, v);
232 nsres = nsIDOMHTMLImageElement_SetAlt(This->nsimg, &alt_str);
233 nsAString_Finish(&alt_str);
234 if(NS_FAILED(nsres))
235 ERR("SetAlt failed: %08x\n", nsres);
237 return S_OK;
240 static HRESULT WINAPI HTMLImgElement_get_alt(IHTMLImgElement *iface, BSTR *p)
242 HTMLImgElement *This = HTMLIMG_THIS(iface);
243 nsAString alt_str;
244 nsresult nsres;
246 TRACE("(%p)->(%p)\n", This, p);
248 nsAString_Init(&alt_str, NULL);
249 nsres = nsIDOMHTMLImageElement_GetAlt(This->nsimg, &alt_str);
250 if(NS_SUCCEEDED(nsres)) {
251 const PRUnichar *alt;
253 nsAString_GetData(&alt_str, &alt);
254 *p = *alt ? SysAllocString(alt) : NULL;
255 }else {
256 ERR("GetAlt failed: %08x\n", nsres);
258 nsAString_Finish(&alt_str);
260 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
263 static HRESULT WINAPI HTMLImgElement_put_src(IHTMLImgElement *iface, BSTR v)
265 HTMLImgElement *This = HTMLIMG_THIS(iface);
266 nsAString src_str;
267 nsresult nsres;
269 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
271 nsAString_Init(&src_str, v);
272 nsres = nsIDOMHTMLImageElement_SetSrc(This->nsimg, &src_str);
273 nsAString_Finish(&src_str);
274 if(NS_FAILED(nsres))
275 ERR("SetSrc failed: %08x\n", nsres);
277 return NS_OK;
280 static HRESULT WINAPI HTMLImgElement_get_src(IHTMLImgElement *iface, BSTR *p)
282 HTMLImgElement *This = HTMLIMG_THIS(iface);
283 FIXME("(%p)->(%p)\n", This, p);
284 return E_NOTIMPL;
287 static HRESULT WINAPI HTMLImgElement_put_lowsrc(IHTMLImgElement *iface, BSTR v)
289 HTMLImgElement *This = HTMLIMG_THIS(iface);
290 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
291 return E_NOTIMPL;
294 static HRESULT WINAPI HTMLImgElement_get_lowsrc(IHTMLImgElement *iface, BSTR *p)
296 HTMLImgElement *This = HTMLIMG_THIS(iface);
297 FIXME("(%p)->(%p)\n", This, p);
298 return E_NOTIMPL;
301 static HRESULT WINAPI HTMLImgElement_put_vrml(IHTMLImgElement *iface, BSTR v)
303 HTMLImgElement *This = HTMLIMG_THIS(iface);
304 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
305 return E_NOTIMPL;
308 static HRESULT WINAPI HTMLImgElement_get_vrml(IHTMLImgElement *iface, BSTR *p)
310 HTMLImgElement *This = HTMLIMG_THIS(iface);
311 FIXME("(%p)->(%p)\n", This, p);
312 return E_NOTIMPL;
315 static HRESULT WINAPI HTMLImgElement_put_dynsrc(IHTMLImgElement *iface, BSTR v)
317 HTMLImgElement *This = HTMLIMG_THIS(iface);
318 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
319 return E_NOTIMPL;
322 static HRESULT WINAPI HTMLImgElement_get_dynsrc(IHTMLImgElement *iface, BSTR *p)
324 HTMLImgElement *This = HTMLIMG_THIS(iface);
325 FIXME("(%p)->(%p)\n", This, p);
326 return E_NOTIMPL;
329 static HRESULT WINAPI HTMLImgElement_get_readyState(IHTMLImgElement *iface, BSTR *p)
331 HTMLImgElement *This = HTMLIMG_THIS(iface);
332 FIXME("(%p)->(%p)\n", This, p);
333 return E_NOTIMPL;
336 static HRESULT WINAPI HTMLImgElement_get_complete(IHTMLImgElement *iface, VARIANT_BOOL *p)
338 HTMLImgElement *This = HTMLIMG_THIS(iface);
339 FIXME("(%p)->(%p)\n", This, p);
340 return E_NOTIMPL;
343 static HRESULT WINAPI HTMLImgElement_put_loop(IHTMLImgElement *iface, VARIANT v)
345 HTMLImgElement *This = HTMLIMG_THIS(iface);
346 FIXME("(%p)->()\n", This);
347 return E_NOTIMPL;
350 static HRESULT WINAPI HTMLImgElement_get_loop(IHTMLImgElement *iface, VARIANT *p)
352 HTMLImgElement *This = HTMLIMG_THIS(iface);
353 FIXME("(%p)->(%p)\n", This, p);
354 return E_NOTIMPL;
357 static HRESULT WINAPI HTMLImgElement_put_align(IHTMLImgElement *iface, BSTR v)
359 HTMLImgElement *This = HTMLIMG_THIS(iface);
360 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
361 return E_NOTIMPL;
364 static HRESULT WINAPI HTMLImgElement_get_align(IHTMLImgElement *iface, BSTR *p)
366 HTMLImgElement *This = HTMLIMG_THIS(iface);
367 FIXME("(%p)->(%p)\n", This, p);
368 return E_NOTIMPL;
371 static HRESULT WINAPI HTMLImgElement_put_onload(IHTMLImgElement *iface, VARIANT v)
373 HTMLImgElement *This = HTMLIMG_THIS(iface);
374 FIXME("(%p)->()\n", This);
375 return E_NOTIMPL;
378 static HRESULT WINAPI HTMLImgElement_get_onload(IHTMLImgElement *iface, VARIANT *p)
380 HTMLImgElement *This = HTMLIMG_THIS(iface);
381 FIXME("(%p)->(%p)\n", This, p);
382 return E_NOTIMPL;
385 static HRESULT WINAPI HTMLImgElement_put_onerror(IHTMLImgElement *iface, VARIANT v)
387 HTMLImgElement *This = HTMLIMG_THIS(iface);
388 FIXME("(%p)->()\n", This);
389 return E_NOTIMPL;
392 static HRESULT WINAPI HTMLImgElement_get_onerror(IHTMLImgElement *iface, VARIANT *p)
394 HTMLImgElement *This = HTMLIMG_THIS(iface);
395 FIXME("(%p)->(%p)\n", This, p);
396 return E_NOTIMPL;
399 static HRESULT WINAPI HTMLImgElement_put_onabort(IHTMLImgElement *iface, VARIANT v)
401 HTMLImgElement *This = HTMLIMG_THIS(iface);
402 FIXME("(%p)->()\n", This);
403 return E_NOTIMPL;
406 static HRESULT WINAPI HTMLImgElement_get_onabort(IHTMLImgElement *iface, VARIANT *p)
408 HTMLImgElement *This = HTMLIMG_THIS(iface);
409 FIXME("(%p)->(%p)\n", This, p);
410 return E_NOTIMPL;
413 static HRESULT WINAPI HTMLImgElement_put_name(IHTMLImgElement *iface, BSTR v)
415 HTMLImgElement *This = HTMLIMG_THIS(iface);
416 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
417 return E_NOTIMPL;
420 static HRESULT WINAPI HTMLImgElement_get_name(IHTMLImgElement *iface, BSTR *p)
422 HTMLImgElement *This = HTMLIMG_THIS(iface);
423 FIXME("(%p)->(%p)\n", This, p);
424 return E_NOTIMPL;
427 static HRESULT WINAPI HTMLImgElement_put_width(IHTMLImgElement *iface, long v)
429 HTMLImgElement *This = HTMLIMG_THIS(iface);
430 FIXME("(%p)->(%ld)\n", This, v);
431 return E_NOTIMPL;
434 static HRESULT WINAPI HTMLImgElement_get_width(IHTMLImgElement *iface, long *p)
436 HTMLImgElement *This = HTMLIMG_THIS(iface);
437 FIXME("(%p)->(%p)\n", This, p);
438 return E_NOTIMPL;
441 static HRESULT WINAPI HTMLImgElement_put_height(IHTMLImgElement *iface, long v)
443 HTMLImgElement *This = HTMLIMG_THIS(iface);
444 FIXME("(%p)->(%ld)\n", This, v);
445 return E_NOTIMPL;
448 static HRESULT WINAPI HTMLImgElement_get_height(IHTMLImgElement *iface, long *p)
450 HTMLImgElement *This = HTMLIMG_THIS(iface);
451 FIXME("(%p)->(%p)\n", This, p);
452 return E_NOTIMPL;
455 static HRESULT WINAPI HTMLImgElement_put_start(IHTMLImgElement *iface, BSTR v)
457 HTMLImgElement *This = HTMLIMG_THIS(iface);
458 FIXME("(%p)->()\n", This);
459 return E_NOTIMPL;
462 static HRESULT WINAPI HTMLImgElement_get_start(IHTMLImgElement *iface, BSTR *p)
464 HTMLImgElement *This = HTMLIMG_THIS(iface);
465 FIXME("(%p)->(%p)\n", This, p);
466 return E_NOTIMPL;
469 #undef HTMLIMG_THIS
471 static const IHTMLImgElementVtbl HTMLImgElementVtbl = {
472 HTMLImgElement_QueryInterface,
473 HTMLImgElement_AddRef,
474 HTMLImgElement_Release,
475 HTMLImgElement_GetTypeInfoCount,
476 HTMLImgElement_GetTypeInfo,
477 HTMLImgElement_GetIDsOfNames,
478 HTMLImgElement_Invoke,
479 HTMLImgElement_put_isMap,
480 HTMLImgElement_get_isMap,
481 HTMLImgElement_put_useMap,
482 HTMLImgElement_get_useMap,
483 HTMLImgElement_get_mimeType,
484 HTMLImgElement_get_fileSize,
485 HTMLImgElement_get_fileCreatedDate,
486 HTMLImgElement_get_fileModifiedDate,
487 HTMLImgElement_get_fileUpdatedDate,
488 HTMLImgElement_get_protocol,
489 HTMLImgElement_get_href,
490 HTMLImgElement_get_nameProp,
491 HTMLImgElement_put_border,
492 HTMLImgElement_get_border,
493 HTMLImgElement_put_vspace,
494 HTMLImgElement_get_vspace,
495 HTMLImgElement_put_hspace,
496 HTMLImgElement_get_hspace,
497 HTMLImgElement_put_alt,
498 HTMLImgElement_get_alt,
499 HTMLImgElement_put_src,
500 HTMLImgElement_get_src,
501 HTMLImgElement_put_lowsrc,
502 HTMLImgElement_get_lowsrc,
503 HTMLImgElement_put_vrml,
504 HTMLImgElement_get_vrml,
505 HTMLImgElement_put_dynsrc,
506 HTMLImgElement_get_dynsrc,
507 HTMLImgElement_get_readyState,
508 HTMLImgElement_get_complete,
509 HTMLImgElement_put_loop,
510 HTMLImgElement_get_loop,
511 HTMLImgElement_put_align,
512 HTMLImgElement_get_align,
513 HTMLImgElement_put_onload,
514 HTMLImgElement_get_onload,
515 HTMLImgElement_put_onerror,
516 HTMLImgElement_get_onerror,
517 HTMLImgElement_put_onabort,
518 HTMLImgElement_get_onabort,
519 HTMLImgElement_put_name,
520 HTMLImgElement_get_name,
521 HTMLImgElement_put_width,
522 HTMLImgElement_get_width,
523 HTMLImgElement_put_height,
524 HTMLImgElement_get_height,
525 HTMLImgElement_put_start,
526 HTMLImgElement_get_start
529 #define HTMLIMG_NODE_THIS(iface) DEFINE_THIS2(HTMLImgElement, element.node, iface)
531 static HRESULT HTMLImgElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
533 HTMLImgElement *This = HTMLIMG_NODE_THIS(iface);
535 *ppv = NULL;
537 if(IsEqualGUID(&IID_IHTMLImgElement, riid)) {
538 TRACE("(%p)->(IID_IHTMLImgElement %p)\n", This, ppv);
539 *ppv = HTMLIMG(This);
540 }else {
541 return HTMLElement_QI(&This->element.node, riid, ppv);
544 IUnknown_AddRef((IUnknown*)*ppv);
545 return S_OK;
548 static void HTMLImgElement_destructor(HTMLDOMNode *iface)
550 HTMLImgElement *This = HTMLIMG_NODE_THIS(iface);
552 if(This->nsimg)
553 nsIDOMHTMLImageElement_Release(This->nsimg);
555 HTMLElement_destructor(&This->element.node);
558 #undef HTMLIMG_NODE_THIS
560 static const NodeImplVtbl HTMLImgElementImplVtbl = {
561 HTMLImgElement_QI,
562 HTMLImgElement_destructor
565 static const tid_t HTMLImgElement_iface_tids[] = {
566 IHTMLDOMNode_tid,
567 IHTMLDOMNode2_tid,
568 IHTMLElement_tid,
569 IHTMLElement2_tid,
570 IHTMLImgElement_tid,
573 static dispex_static_data_t HTMLImgElement_dispex = {
574 NULL,
575 DispHTMLImg_tid,
576 NULL,
577 HTMLImgElement_iface_tids
580 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement *nselem)
582 HTMLImgElement *ret = heap_alloc_zero(sizeof(HTMLImgElement));
583 nsresult nsres;
585 ret->lpHTMLImgElementVtbl = &HTMLImgElementVtbl;
586 ret->element.node.vtbl = &HTMLImgElementImplVtbl;
588 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLImageElement, (void**)&ret->nsimg);
589 if(NS_FAILED(nsres))
590 ERR("Could not get nsIDOMHTMLImageElement: %08x\n", nsres);
592 init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLIMG(ret), &HTMLImgElement_dispex);
593 HTMLElement_Init(&ret->element);
595 return &ret->element;