imagehlp: Use the IMAGE_FIRST_SECTION helper macro.
[wine.git] / dlls / mshtml / htmlobject.c
blobb5c3d3677bd8ccb61eb4939c64cb442bced5b27f
1 /*
2 * Copyright 2010 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 "winreg.h"
27 #include "ole2.h"
29 #include "wine/debug.h"
31 #include "mshtml_private.h"
32 #include "htmlevent.h"
33 #include "pluginhost.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
37 struct HTMLObjectElement {
38 HTMLPluginContainer plugin_container;
40 IHTMLObjectElement IHTMLObjectElement_iface;
41 IHTMLObjectElement2 IHTMLObjectElement2_iface;
43 nsIDOMHTMLObjectElement *nsobject;
46 static inline HTMLObjectElement *impl_from_IHTMLObjectElement(IHTMLObjectElement *iface)
48 return CONTAINING_RECORD(iface, HTMLObjectElement, IHTMLObjectElement_iface);
51 static HRESULT WINAPI HTMLObjectElement_QueryInterface(IHTMLObjectElement *iface,
52 REFIID riid, void **ppv)
54 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
56 return IHTMLDOMNode_QueryInterface(&This->plugin_container.element.node.IHTMLDOMNode_iface,
57 riid, ppv);
60 static ULONG WINAPI HTMLObjectElement_AddRef(IHTMLObjectElement *iface)
62 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
64 return IHTMLDOMNode_AddRef(&This->plugin_container.element.node.IHTMLDOMNode_iface);
67 static ULONG WINAPI HTMLObjectElement_Release(IHTMLObjectElement *iface)
69 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
71 return IHTMLDOMNode_Release(&This->plugin_container.element.node.IHTMLDOMNode_iface);
74 static HRESULT WINAPI HTMLObjectElement_GetTypeInfoCount(IHTMLObjectElement *iface, UINT *pctinfo)
76 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
77 return IDispatchEx_GetTypeInfoCount(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
78 pctinfo);
81 static HRESULT WINAPI HTMLObjectElement_GetTypeInfo(IHTMLObjectElement *iface, UINT iTInfo,
82 LCID lcid, ITypeInfo **ppTInfo)
84 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
85 return IDispatchEx_GetTypeInfo(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
86 iTInfo, lcid, ppTInfo);
89 static HRESULT WINAPI HTMLObjectElement_GetIDsOfNames(IHTMLObjectElement *iface, REFIID riid,
90 LPOLESTR *rgszNames, UINT cNames,
91 LCID lcid, DISPID *rgDispId)
93 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
94 return IDispatchEx_GetIDsOfNames(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
95 riid, rgszNames, cNames, lcid, rgDispId);
98 static HRESULT WINAPI HTMLObjectElement_Invoke(IHTMLObjectElement *iface, DISPID dispIdMember,
99 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
100 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
102 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
103 return IDispatchEx_Invoke(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
104 dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
107 static HRESULT WINAPI HTMLObjectElement_get_object(IHTMLObjectElement *iface, IDispatch **p)
109 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
111 TRACE("(%p)->(%p)\n", This, p);
113 return get_plugin_disp(&This->plugin_container, p);
116 static HRESULT WINAPI HTMLObjectElement_get_classid(IHTMLObjectElement *iface, BSTR *p)
118 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
120 TRACE("(%p)->(%p)\n", This, p);
122 return IHTMLObjectElement2_get_classid(&This->IHTMLObjectElement2_iface, p);
125 static HRESULT WINAPI HTMLObjectElement_get_data(IHTMLObjectElement *iface, BSTR *p)
127 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
129 TRACE("(%p)->(%p)\n", This, p);
131 return IHTMLObjectElement2_get_data(&This->IHTMLObjectElement2_iface, p);
134 static HRESULT WINAPI HTMLObjectElement_put_recordset(IHTMLObjectElement *iface, IDispatch *v)
136 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
137 FIXME("(%p)->(%p)\n", This, v);
138 return E_NOTIMPL;
141 static HRESULT WINAPI HTMLObjectElement_get_recordset(IHTMLObjectElement *iface, IDispatch **p)
143 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
144 FIXME("(%p)->(%p)\n", This, p);
145 return E_NOTIMPL;
148 static HRESULT WINAPI HTMLObjectElement_put_align(IHTMLObjectElement *iface, BSTR v)
150 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
151 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
152 return E_NOTIMPL;
155 static HRESULT WINAPI HTMLObjectElement_get_align(IHTMLObjectElement *iface, BSTR *p)
157 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
158 FIXME("(%p)->(%p)\n", This, p);
159 return E_NOTIMPL;
162 static HRESULT WINAPI HTMLObjectElement_put_name(IHTMLObjectElement *iface, BSTR v)
164 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
165 nsAString nsstr;
166 nsresult nsres;
168 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
170 nsAString_InitDepend(&nsstr, v);
171 nsres = nsIDOMHTMLObjectElement_SetName(This->nsobject, &nsstr);
172 nsAString_Finish(&nsstr);
173 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
176 static HRESULT WINAPI HTMLObjectElement_get_name(IHTMLObjectElement *iface, BSTR *p)
178 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
179 nsAString nsstr;
180 nsresult nsres;
182 TRACE("(%p)->(%p)\n", This, p);
184 nsAString_Init(&nsstr, NULL);
185 nsres = nsIDOMHTMLObjectElement_GetName(This->nsobject, &nsstr);
186 return return_nsstr(nsres, &nsstr, p);
189 static HRESULT WINAPI HTMLObjectElement_put_codeBase(IHTMLObjectElement *iface, BSTR v)
191 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
192 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
193 return E_NOTIMPL;
196 static HRESULT WINAPI HTMLObjectElement_get_codeBase(IHTMLObjectElement *iface, BSTR *p)
198 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
199 FIXME("(%p)->(%p)\n", This, p);
200 return E_NOTIMPL;
203 static HRESULT WINAPI HTMLObjectElement_put_codeType(IHTMLObjectElement *iface, BSTR v)
205 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
206 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
207 return E_NOTIMPL;
210 static HRESULT WINAPI HTMLObjectElement_get_codeType(IHTMLObjectElement *iface, BSTR *p)
212 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
213 FIXME("(%p)->(%p)\n", This, p);
214 return E_NOTIMPL;
217 static HRESULT WINAPI HTMLObjectElement_put_code(IHTMLObjectElement *iface, BSTR v)
219 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
220 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
221 return E_NOTIMPL;
224 static HRESULT WINAPI HTMLObjectElement_get_code(IHTMLObjectElement *iface, BSTR *p)
226 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
227 FIXME("(%p)->(%p)\n", This, p);
228 return E_NOTIMPL;
231 static HRESULT WINAPI HTMLObjectElement_get_BaseHref(IHTMLObjectElement *iface, BSTR *p)
233 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
234 FIXME("(%p)->(%p)\n", This, p);
235 return E_NOTIMPL;
238 static HRESULT WINAPI HTMLObjectElement_put_type(IHTMLObjectElement *iface, BSTR v)
240 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
241 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
242 return E_NOTIMPL;
245 static HRESULT WINAPI HTMLObjectElement_get_type(IHTMLObjectElement *iface, BSTR *p)
247 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
248 FIXME("(%p)->(%p)\n", This, p);
249 return E_NOTIMPL;
252 static HRESULT WINAPI HTMLObjectElement_get_form(IHTMLObjectElement *iface, IHTMLFormElement **p)
254 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
255 FIXME("(%p)->(%p)\n", This, p);
256 return E_NOTIMPL;
259 static HRESULT WINAPI HTMLObjectElement_put_width(IHTMLObjectElement *iface, VARIANT v)
261 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
262 nsAString width_str;
263 PRUnichar buf[12];
264 nsresult nsres;
266 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
268 switch(V_VT(&v)) {
269 case VT_I4: {
270 swprintf(buf, ARRAY_SIZE(buf), L"%d", V_I4(&v));
271 break;
273 default:
274 FIXME("unimplemented for arg %s\n", debugstr_variant(&v));
275 return E_NOTIMPL;
278 nsAString_InitDepend(&width_str, buf);
279 nsres = nsIDOMHTMLObjectElement_SetWidth(This->nsobject, &width_str);
280 nsAString_Finish(&width_str);
281 if(NS_FAILED(nsres)) {
282 FIXME("SetWidth failed: %08lx\n", nsres);
283 return E_FAIL;
286 notif_container_change(&This->plugin_container, DISPID_UNKNOWN);
287 return S_OK;
290 static HRESULT WINAPI HTMLObjectElement_get_width(IHTMLObjectElement *iface, VARIANT *p)
292 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
293 nsAString width_str;
294 nsresult nsres;
295 HRESULT hres;
297 TRACE("(%p)->(%p)\n", This, p);
299 nsAString_Init(&width_str, NULL);
300 nsres = nsIDOMHTMLObjectElement_GetWidth(This->nsobject, &width_str);
301 if(NS_SUCCEEDED(nsres)) {
302 const PRUnichar *width;
304 nsAString_GetData(&width_str, &width);
305 V_VT(p) = VT_BSTR;
306 V_BSTR(p) = SysAllocString(width);
307 hres = V_BSTR(p) ? S_OK : E_OUTOFMEMORY;
308 }else {
309 ERR("GetWidth failed: %08lx\n", nsres);
310 hres = E_FAIL;
313 nsAString_Finish(&width_str);
314 return hres;
317 static HRESULT WINAPI HTMLObjectElement_put_height(IHTMLObjectElement *iface, VARIANT v)
319 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
320 nsAString height_str;
321 PRUnichar buf[12];
322 nsresult nsres;
324 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
326 switch(V_VT(&v)) {
327 case VT_I4: {
328 swprintf(buf, ARRAY_SIZE(buf), L"%d", V_I4(&v));
329 break;
331 default:
332 FIXME("unimplemented for arg %s\n", debugstr_variant(&v));
333 return E_NOTIMPL;
336 nsAString_InitDepend(&height_str, buf);
337 nsres = nsIDOMHTMLObjectElement_SetHeight(This->nsobject, &height_str);
338 nsAString_Finish(&height_str);
339 if(NS_FAILED(nsres)) {
340 FIXME("SetHeight failed: %08lx\n", nsres);
341 return E_FAIL;
344 notif_container_change(&This->plugin_container, DISPID_UNKNOWN);
345 return S_OK;
348 static HRESULT WINAPI HTMLObjectElement_get_height(IHTMLObjectElement *iface, VARIANT *p)
350 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
351 nsAString height_str;
352 nsresult nsres;
353 HRESULT hres;
355 TRACE("(%p)->(%p)\n", This, p);
357 nsAString_Init(&height_str, NULL);
358 nsres = nsIDOMHTMLObjectElement_GetHeight(This->nsobject, &height_str);
359 if(NS_SUCCEEDED(nsres)) {
360 const PRUnichar *height;
362 nsAString_GetData(&height_str, &height);
363 V_VT(p) = VT_BSTR;
364 V_BSTR(p) = SysAllocString(height);
365 hres = V_BSTR(p) ? S_OK : E_OUTOFMEMORY;
366 }else {
367 ERR("GetHeight failed: %08lx\n", nsres);
368 hres = E_FAIL;
371 nsAString_Finish(&height_str);
372 return hres;
375 static HRESULT WINAPI HTMLObjectElement_get_readyState(IHTMLObjectElement *iface, LONG *p)
377 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
378 FIXME("(%p)->(%p)\n", This, p);
379 return E_NOTIMPL;
382 static HRESULT WINAPI HTMLObjectElement_put_onreadystatechange(IHTMLObjectElement *iface, VARIANT v)
384 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
385 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
386 return E_NOTIMPL;
389 static HRESULT WINAPI HTMLObjectElement_get_onreadystatechange(IHTMLObjectElement *iface, VARIANT *p)
391 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
392 FIXME("(%p)->(%p)\n", This, p);
393 return E_NOTIMPL;
396 static HRESULT WINAPI HTMLObjectElement_put_onerror(IHTMLObjectElement *iface, VARIANT v)
398 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
399 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
400 return E_NOTIMPL;
403 static HRESULT WINAPI HTMLObjectElement_get_onerror(IHTMLObjectElement *iface, VARIANT *p)
405 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
406 FIXME("(%p)->(%p)\n", This, p);
407 return E_NOTIMPL;
410 static HRESULT WINAPI HTMLObjectElement_put_altHtml(IHTMLObjectElement *iface, BSTR v)
412 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
413 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
414 return E_NOTIMPL;
417 static HRESULT WINAPI HTMLObjectElement_get_altHtml(IHTMLObjectElement *iface, BSTR *p)
419 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
420 FIXME("(%p)->(%p)\n", This, p);
421 return E_NOTIMPL;
424 static HRESULT WINAPI HTMLObjectElement_put_vspace(IHTMLObjectElement *iface, LONG v)
426 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
427 FIXME("(%p)->(%ld)\n", This, v);
428 return E_NOTIMPL;
431 static HRESULT WINAPI HTMLObjectElement_get_vspace(IHTMLObjectElement *iface, LONG *p)
433 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
434 nsresult nsres;
436 TRACE("(%p)->(%p)\n", This, p);
438 nsres = nsIDOMHTMLObjectElement_GetVspace(This->nsobject, p);
439 if(NS_FAILED(nsres)) {
440 ERR("GetVspace failed: %08lx\n", nsres);
441 return E_FAIL;
444 return S_OK;
447 static HRESULT WINAPI HTMLObjectElement_put_hspace(IHTMLObjectElement *iface, LONG v)
449 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
450 FIXME("(%p)->(%ld)\n", This, v);
451 return E_NOTIMPL;
454 static HRESULT WINAPI HTMLObjectElement_get_hspace(IHTMLObjectElement *iface, LONG *p)
456 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
457 FIXME("(%p)->(%p)\n", This, p);
458 return E_NOTIMPL;
461 static const IHTMLObjectElementVtbl HTMLObjectElementVtbl = {
462 HTMLObjectElement_QueryInterface,
463 HTMLObjectElement_AddRef,
464 HTMLObjectElement_Release,
465 HTMLObjectElement_GetTypeInfoCount,
466 HTMLObjectElement_GetTypeInfo,
467 HTMLObjectElement_GetIDsOfNames,
468 HTMLObjectElement_Invoke,
469 HTMLObjectElement_get_object,
470 HTMLObjectElement_get_classid,
471 HTMLObjectElement_get_data,
472 HTMLObjectElement_put_recordset,
473 HTMLObjectElement_get_recordset,
474 HTMLObjectElement_put_align,
475 HTMLObjectElement_get_align,
476 HTMLObjectElement_put_name,
477 HTMLObjectElement_get_name,
478 HTMLObjectElement_put_codeBase,
479 HTMLObjectElement_get_codeBase,
480 HTMLObjectElement_put_codeType,
481 HTMLObjectElement_get_codeType,
482 HTMLObjectElement_put_code,
483 HTMLObjectElement_get_code,
484 HTMLObjectElement_get_BaseHref,
485 HTMLObjectElement_put_type,
486 HTMLObjectElement_get_type,
487 HTMLObjectElement_get_form,
488 HTMLObjectElement_put_width,
489 HTMLObjectElement_get_width,
490 HTMLObjectElement_put_height,
491 HTMLObjectElement_get_height,
492 HTMLObjectElement_get_readyState,
493 HTMLObjectElement_put_onreadystatechange,
494 HTMLObjectElement_get_onreadystatechange,
495 HTMLObjectElement_put_onerror,
496 HTMLObjectElement_get_onerror,
497 HTMLObjectElement_put_altHtml,
498 HTMLObjectElement_get_altHtml,
499 HTMLObjectElement_put_vspace,
500 HTMLObjectElement_get_vspace,
501 HTMLObjectElement_put_hspace,
502 HTMLObjectElement_get_hspace
505 static inline HTMLObjectElement *impl_from_IHTMLObjectElement2(IHTMLObjectElement2 *iface)
507 return CONTAINING_RECORD(iface, HTMLObjectElement, IHTMLObjectElement2_iface);
510 static HRESULT WINAPI HTMLObjectElement2_QueryInterface(IHTMLObjectElement2 *iface,
511 REFIID riid, void **ppv)
513 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
515 return IHTMLDOMNode_QueryInterface(&This->plugin_container.element.node.IHTMLDOMNode_iface,
516 riid, ppv);
519 static ULONG WINAPI HTMLObjectElement2_AddRef(IHTMLObjectElement2 *iface)
521 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
523 return IHTMLDOMNode_AddRef(&This->plugin_container.element.node.IHTMLDOMNode_iface);
526 static ULONG WINAPI HTMLObjectElement2_Release(IHTMLObjectElement2 *iface)
528 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
530 return IHTMLDOMNode_Release(&This->plugin_container.element.node.IHTMLDOMNode_iface);
533 static HRESULT WINAPI HTMLObjectElement2_GetTypeInfoCount(IHTMLObjectElement2 *iface, UINT *pctinfo)
535 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
536 return IDispatchEx_GetTypeInfoCount(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
537 pctinfo);
540 static HRESULT WINAPI HTMLObjectElement2_GetTypeInfo(IHTMLObjectElement2 *iface, UINT iTInfo,
541 LCID lcid, ITypeInfo **ppTInfo)
543 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
544 return IDispatchEx_GetTypeInfo(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
545 iTInfo, lcid, ppTInfo);
548 static HRESULT WINAPI HTMLObjectElement2_GetIDsOfNames(IHTMLObjectElement2 *iface, REFIID riid,
549 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
551 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
552 return IDispatchEx_GetIDsOfNames(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
553 riid, rgszNames, cNames, lcid, rgDispId);
556 static HRESULT WINAPI HTMLObjectElement2_Invoke(IHTMLObjectElement2 *iface, DISPID dispIdMember,
557 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
558 EXCEPINFO *pExcepInfo, UINT *puArgErr)
560 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
561 return IDispatchEx_Invoke(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
562 dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
565 static HRESULT WINAPI HTMLObjectElement2_namedRecordset(IHTMLObjectElement2 *iface, BSTR dataMember,
566 VARIANT *hierarchy, IDispatch **ppRecordset)
568 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
569 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(dataMember), hierarchy, ppRecordset);
570 return E_NOTIMPL;
573 static HRESULT WINAPI HTMLObjectElement2_put_classid(IHTMLObjectElement2 *iface, BSTR v)
575 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
576 HRESULT hres;
578 FIXME("(%p)->(%s) semi-stub\n", This, debugstr_w(v));
580 hres = elem_string_attr_setter(&This->plugin_container.element, L"classid", v);
581 if(FAILED(hres))
582 return hres;
584 if(This->plugin_container.plugin_host) {
585 FIXME("Host already associated.\n");
586 return E_NOTIMPL;
590 * NOTE:
591 * If the element is not yet in DOM tree, we should embed it as soon as it's added.
592 * However, Gecko for some reason decides not to create NP plugin in this case,
593 * so this won't work.
596 return create_plugin_host(This->plugin_container.element.node.doc, &This->plugin_container);
599 static HRESULT WINAPI HTMLObjectElement2_get_classid(IHTMLObjectElement2 *iface, BSTR *p)
601 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
602 FIXME("(%p)->(%p)\n", This, p);
603 return E_NOTIMPL;
606 static HRESULT WINAPI HTMLObjectElement2_put_data(IHTMLObjectElement2 *iface, BSTR v)
608 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
609 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
610 return E_NOTIMPL;
613 static HRESULT WINAPI HTMLObjectElement2_get_data(IHTMLObjectElement2 *iface, BSTR *p)
615 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
616 FIXME("(%p)->(%p)\n", This, p);
617 return E_NOTIMPL;
620 static const IHTMLObjectElement2Vtbl HTMLObjectElement2Vtbl = {
621 HTMLObjectElement2_QueryInterface,
622 HTMLObjectElement2_AddRef,
623 HTMLObjectElement2_Release,
624 HTMLObjectElement2_GetTypeInfoCount,
625 HTMLObjectElement2_GetTypeInfo,
626 HTMLObjectElement2_GetIDsOfNames,
627 HTMLObjectElement2_Invoke,
628 HTMLObjectElement2_namedRecordset,
629 HTMLObjectElement2_put_classid,
630 HTMLObjectElement2_get_classid,
631 HTMLObjectElement2_put_data,
632 HTMLObjectElement2_get_data
635 static inline HTMLObjectElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
637 return CONTAINING_RECORD(iface, HTMLObjectElement, plugin_container.element.node);
640 static HRESULT HTMLObjectElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
642 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
643 FIXME("(%p)->(%p)\n", This, p);
644 return E_NOTIMPL;
647 static inline HTMLObjectElement *impl_from_DispatchEx(DispatchEx *iface)
649 return CONTAINING_RECORD(iface, HTMLObjectElement, plugin_container.element.node.event_target.dispex);
652 static void *HTMLObjectElement_query_interface(DispatchEx *dispex, REFIID riid)
654 HTMLObjectElement *This = impl_from_DispatchEx(dispex);
655 void *elem_iface;
657 if(IsEqualGUID(&IID_IHTMLObjectElement, riid))
658 return &This->IHTMLObjectElement_iface;
659 if(IsEqualGUID(&IID_IHTMLObjectElement2, riid))
660 return &This->IHTMLObjectElement2_iface;
661 if(IsEqualGUID(&IID_HTMLPluginContainer, riid)) {
662 /* Special pseudo-interface returning HTMLPluginContainer struct. */
663 return &This->plugin_container;
666 elem_iface = HTMLElement_query_interface(&This->plugin_container.element.node.event_target.dispex, riid);
667 if(!elem_iface && This->plugin_container.plugin_host && This->plugin_container.plugin_host->plugin_unk) {
668 IUnknown *plugin_iface, *ret;
669 HRESULT hres = IUnknown_QueryInterface(This->plugin_container.plugin_host->plugin_unk, riid, (void**)&plugin_iface);
671 if(hres == S_OK) {
672 hres = wrap_iface(plugin_iface, (IUnknown*)&This->IHTMLObjectElement_iface, &ret);
673 IUnknown_Release(plugin_iface);
674 if(FAILED(hres)) {
675 ERR("wrap_iface failed: %08lx\n", hres);
676 return NULL;
679 TRACE("returning plugin iface %p wrapped to %p\n", plugin_iface, ret);
680 return ret;
684 return elem_iface;
687 static void HTMLObjectElement_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb)
689 HTMLObjectElement *This = impl_from_DispatchEx(dispex);
690 HTMLDOMNode_traverse(dispex, cb);
692 if(This->nsobject)
693 note_cc_edge((nsISupports*)This->nsobject, "nsobject", cb);
696 static void HTMLObjectElement_unlink(DispatchEx *dispex)
698 HTMLObjectElement *This = impl_from_DispatchEx(dispex);
699 HTMLDOMNode_unlink(dispex);
700 unlink_ref(&This->nsobject);
703 static void HTMLObjectElement_destructor(DispatchEx *dispex)
705 HTMLObjectElement *This = impl_from_DispatchEx(dispex);
707 if(This->plugin_container.plugin_host)
708 detach_plugin_host(This->plugin_container.plugin_host);
710 HTMLElement_destructor(&This->plugin_container.element.node.event_target.dispex);
713 static HRESULT HTMLObjectElement_get_dispid(DispatchEx *dispex, BSTR name, DWORD grfdex, DISPID *dispid)
715 HTMLObjectElement *This = impl_from_DispatchEx(dispex);
717 TRACE("(%p)->(%s %lx %p)\n", This, debugstr_w(name), grfdex, dispid);
719 return get_plugin_dispid(&This->plugin_container, name, dispid);
722 static HRESULT HTMLObjectElement_dispex_get_name(DispatchEx *dispex, DISPID id, BSTR *name)
724 HTMLObjectElement *This = impl_from_DispatchEx(dispex);
726 FIXME("(%p)->(%lx %p)\n", This, id, name);
728 return E_NOTIMPL;
731 static HRESULT HTMLObjectElement_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
732 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
734 HTMLObjectElement *This = impl_from_DispatchEx(dispex);
736 TRACE("(%p)->(%ld)\n", This, id);
738 return invoke_plugin_prop(&This->plugin_container, id, lcid, flags, params, res, ei);
741 static const NodeImplVtbl HTMLObjectElementImplVtbl = {
742 .clsid = &CLSID_HTMLObjectElement,
743 .cpc_entries = HTMLElement_cpc,
744 .clone = HTMLElement_clone,
745 .get_attr_col = HTMLElement_get_attr_col,
746 .get_readystate = HTMLObjectElement_get_readystate,
749 static const event_target_vtbl_t HTMLObjectElement_event_target_vtbl = {
751 HTMLELEMENT_DISPEX_VTBL_ENTRIES,
752 .query_interface= HTMLObjectElement_query_interface,
753 .destructor = HTMLObjectElement_destructor,
754 .traverse = HTMLObjectElement_traverse,
755 .unlink = HTMLObjectElement_unlink,
756 .get_dispid = HTMLObjectElement_get_dispid,
757 .get_name = HTMLObjectElement_dispex_get_name,
758 .invoke = HTMLObjectElement_invoke
760 HTMLELEMENT_EVENT_TARGET_VTBL_ENTRIES,
761 .handle_event = HTMLElement_handle_event
764 static const tid_t HTMLObjectElement_iface_tids[] = {
765 IHTMLObjectElement2_tid,
766 IHTMLObjectElement_tid,
767 HTMLELEMENT_TIDS,
770 static dispex_static_data_t HTMLObjectElement_dispex = {
771 "HTMLObjectElement",
772 &HTMLObjectElement_event_target_vtbl.dispex_vtbl,
773 DispHTMLObjectElement_tid,
774 HTMLObjectElement_iface_tids,
775 HTMLElement_init_dispex_info
778 HRESULT HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
780 HTMLObjectElement *ret;
781 nsresult nsres;
783 ret = calloc(1, sizeof(*ret));
784 if(!ret)
785 return E_OUTOFMEMORY;
787 ret->IHTMLObjectElement_iface.lpVtbl = &HTMLObjectElementVtbl;
788 ret->IHTMLObjectElement2_iface.lpVtbl = &HTMLObjectElement2Vtbl;
789 ret->plugin_container.element.node.vtbl = &HTMLObjectElementImplVtbl;
791 HTMLElement_Init(&ret->plugin_container.element, doc, nselem, &HTMLObjectElement_dispex);
793 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLObjectElement, (void**)&ret->nsobject);
794 assert(nsres == NS_OK);
796 *elem = &ret->plugin_container.element;
797 return S_OK;
800 struct HTMLEmbed {
801 HTMLElement element;
803 IHTMLEmbedElement IHTMLEmbedElement_iface;
806 static inline HTMLEmbed *impl_from_IHTMLEmbedElement(IHTMLEmbedElement *iface)
808 return CONTAINING_RECORD(iface, HTMLEmbed, IHTMLEmbedElement_iface);
811 static HRESULT WINAPI HTMLEmbedElement_QueryInterface(IHTMLEmbedElement *iface,
812 REFIID riid, void **ppv)
814 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
816 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
819 static ULONG WINAPI HTMLEmbedElement_AddRef(IHTMLEmbedElement *iface)
821 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
823 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
826 static ULONG WINAPI HTMLEmbedElement_Release(IHTMLEmbedElement *iface)
828 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
830 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
833 static HRESULT WINAPI HTMLEmbedElement_GetTypeInfoCount(IHTMLEmbedElement *iface, UINT *pctinfo)
835 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
836 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
839 static HRESULT WINAPI HTMLEmbedElement_GetTypeInfo(IHTMLEmbedElement *iface, UINT iTInfo,
840 LCID lcid, ITypeInfo **ppTInfo)
842 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
843 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
844 ppTInfo);
847 static HRESULT WINAPI HTMLEmbedElement_GetIDsOfNames(IHTMLEmbedElement *iface, REFIID riid,
848 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
850 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
851 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
852 cNames, lcid, rgDispId);
855 static HRESULT WINAPI HTMLEmbedElement_Invoke(IHTMLEmbedElement *iface, DISPID dispIdMember,
856 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
857 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
859 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
860 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
861 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
864 static HRESULT WINAPI HTMLEmbedElement_put_hidden(IHTMLEmbedElement *iface, BSTR v)
866 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
867 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
868 return E_NOTIMPL;
871 static HRESULT WINAPI HTMLEmbedElement_get_hidden(IHTMLEmbedElement *iface, BSTR *p)
873 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
874 FIXME("(%p)->(%p)\n", This, p);
875 return E_NOTIMPL;
878 static HRESULT WINAPI HTMLEmbedElement_get_palette(IHTMLEmbedElement *iface, BSTR *p)
880 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
881 FIXME("(%p)->(%p)\n", This, p);
882 return E_NOTIMPL;
885 static HRESULT WINAPI HTMLEmbedElement_get_pluginspage(IHTMLEmbedElement *iface, BSTR *p)
887 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
888 FIXME("(%p)->(%p)\n", This, p);
889 return E_NOTIMPL;
892 static HRESULT WINAPI HTMLEmbedElement_put_src(IHTMLEmbedElement *iface, BSTR v)
894 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
895 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
896 return E_NOTIMPL;
899 static HRESULT WINAPI HTMLEmbedElement_get_src(IHTMLEmbedElement *iface, BSTR *p)
901 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
902 FIXME("(%p)->(%p)\n", This, p);
903 return E_NOTIMPL;
906 static HRESULT WINAPI HTMLEmbedElement_put_units(IHTMLEmbedElement *iface, BSTR v)
908 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
909 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
910 return E_NOTIMPL;
913 static HRESULT WINAPI HTMLEmbedElement_get_units(IHTMLEmbedElement *iface, BSTR *p)
915 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
916 FIXME("(%p)->(%p)\n", This, p);
917 return E_NOTIMPL;
920 static HRESULT WINAPI HTMLEmbedElement_put_name(IHTMLEmbedElement *iface, BSTR v)
922 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
923 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
924 return E_NOTIMPL;
927 static HRESULT WINAPI HTMLEmbedElement_get_name(IHTMLEmbedElement *iface, BSTR *p)
929 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
930 FIXME("(%p)->(%p)\n", This, p);
931 return E_NOTIMPL;
934 static HRESULT WINAPI HTMLEmbedElement_put_width(IHTMLEmbedElement *iface, VARIANT v)
936 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
937 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
938 return E_NOTIMPL;
941 static HRESULT WINAPI HTMLEmbedElement_get_width(IHTMLEmbedElement *iface, VARIANT *p)
943 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
944 FIXME("(%p)->(%p)\n", This, p);
945 return E_NOTIMPL;
948 static HRESULT WINAPI HTMLEmbedElement_put_height(IHTMLEmbedElement *iface, VARIANT v)
950 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
951 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
952 return E_NOTIMPL;
955 static HRESULT WINAPI HTMLEmbedElement_get_height(IHTMLEmbedElement *iface, VARIANT *p)
957 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
958 FIXME("(%p)->(%p)\n", This, p);
959 return E_NOTIMPL;
962 static const IHTMLEmbedElementVtbl HTMLEmbedElementVtbl = {
963 HTMLEmbedElement_QueryInterface,
964 HTMLEmbedElement_AddRef,
965 HTMLEmbedElement_Release,
966 HTMLEmbedElement_GetTypeInfoCount,
967 HTMLEmbedElement_GetTypeInfo,
968 HTMLEmbedElement_GetIDsOfNames,
969 HTMLEmbedElement_Invoke,
970 HTMLEmbedElement_put_hidden,
971 HTMLEmbedElement_get_hidden,
972 HTMLEmbedElement_get_palette,
973 HTMLEmbedElement_get_pluginspage,
974 HTMLEmbedElement_put_src,
975 HTMLEmbedElement_get_src,
976 HTMLEmbedElement_put_units,
977 HTMLEmbedElement_get_units,
978 HTMLEmbedElement_put_name,
979 HTMLEmbedElement_get_name,
980 HTMLEmbedElement_put_width,
981 HTMLEmbedElement_get_width,
982 HTMLEmbedElement_put_height,
983 HTMLEmbedElement_get_height
986 static inline HTMLEmbed *embed_from_DispatchEx(DispatchEx *iface)
988 return CONTAINING_RECORD(iface, HTMLEmbed, element.node.event_target.dispex);
991 static void *HTMLEmbedElement_query_interface(DispatchEx *dispex, REFIID riid)
993 HTMLEmbed *This = embed_from_DispatchEx(dispex);
995 if(IsEqualGUID(&IID_IHTMLEmbedElement, riid))
996 return &This->IHTMLEmbedElement_iface;
998 return HTMLElement_query_interface(&This->element.node.event_target.dispex, riid);
1001 static const NodeImplVtbl HTMLEmbedElementImplVtbl = {
1002 .clsid = &CLSID_HTMLEmbed,
1003 .cpc_entries = HTMLElement_cpc,
1004 .clone = HTMLElement_clone,
1005 .get_attr_col = HTMLElement_get_attr_col
1008 static const event_target_vtbl_t HTMLEmbedElement_event_target_vtbl = {
1010 HTMLELEMENT_DISPEX_VTBL_ENTRIES,
1011 .query_interface= HTMLEmbedElement_query_interface,
1012 .destructor = HTMLElement_destructor,
1013 .traverse = HTMLDOMNode_traverse,
1014 .unlink = HTMLDOMNode_unlink
1016 HTMLELEMENT_EVENT_TARGET_VTBL_ENTRIES,
1017 .handle_event = HTMLElement_handle_event
1020 static const tid_t HTMLEmbedElement_iface_tids[] = {
1021 HTMLELEMENT_TIDS,
1022 IHTMLEmbedElement_tid,
1025 static dispex_static_data_t HTMLEmbedElement_dispex = {
1026 "HTMLEmbedElement",
1027 &HTMLEmbedElement_event_target_vtbl.dispex_vtbl,
1028 DispHTMLEmbed_tid,
1029 HTMLEmbedElement_iface_tids,
1030 HTMLElement_init_dispex_info
1033 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
1035 HTMLEmbed *ret;
1037 ret = calloc(1, sizeof(*ret));
1038 if(!ret)
1039 return E_OUTOFMEMORY;
1041 ret->IHTMLEmbedElement_iface.lpVtbl = &HTMLEmbedElementVtbl;
1042 ret->element.node.vtbl = &HTMLEmbedElementImplVtbl;
1044 HTMLElement_Init(&ret->element, doc, nselem, &HTMLEmbedElement_dispex);
1045 *elem = &ret->element;
1046 return S_OK;