wined3d: Pass a wined3d_device_context to wined3d_cs_emit_blt_sub_resource().
[wine/zf.git] / dlls / mshtml / htmlobject.c
blobb71b0e7db6f9048973c3e6c12ea473ce7ec97b2c
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>
20 #include <assert.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "winreg.h"
28 #include "ole2.h"
30 #include "wine/debug.h"
32 #include "mshtml_private.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: %08x\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: %08x\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: %08x\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: %08x\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)->(%d)\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: %08x\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)->(%d)\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_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
642 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
644 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
646 if(IsEqualGUID(&IID_IUnknown, riid)) {
647 *ppv = &This->IHTMLObjectElement_iface;
648 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
649 *ppv = &This->IHTMLObjectElement_iface;
650 }else if(IsEqualGUID(&IID_IHTMLObjectElement, riid)) {
651 *ppv = &This->IHTMLObjectElement_iface;
652 }else if(IsEqualGUID(&IID_IHTMLObjectElement2, riid)) {
653 *ppv = &This->IHTMLObjectElement2_iface;
654 }else if(IsEqualGUID(&IID_HTMLPluginContainer, riid)) {
655 /* Special pseudo-interface returning HTMLPluginContainse struct. */
656 *ppv = &This->plugin_container;
657 node_addref(&This->plugin_container.element.node);
658 return S_OK;
659 }else {
660 HRESULT hres;
662 hres = HTMLElement_QI(&This->plugin_container.element.node, riid, ppv);
663 if(hres == E_NOINTERFACE && This->plugin_container.plugin_host && This->plugin_container.plugin_host->plugin_unk) {
664 IUnknown *plugin_iface, *ret;
666 hres = IUnknown_QueryInterface(This->plugin_container.plugin_host->plugin_unk, riid, (void**)&plugin_iface);
667 if(hres == S_OK) {
668 hres = wrap_iface(plugin_iface, (IUnknown*)&This->IHTMLObjectElement_iface, &ret);
669 IUnknown_Release(plugin_iface);
670 if(FAILED(hres))
671 return hres;
673 TRACE("returning plugin iface %p wrapped to %p\n", plugin_iface, ret);
674 *ppv = ret;
675 return S_OK;
679 return hres;
682 IUnknown_AddRef((IUnknown*)*ppv);
683 return S_OK;
686 static void HTMLObjectElement_destructor(HTMLDOMNode *iface)
688 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
690 if(This->plugin_container.plugin_host)
691 detach_plugin_host(This->plugin_container.plugin_host);
693 HTMLElement_destructor(&This->plugin_container.element.node);
696 static HRESULT HTMLObjectElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
698 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
699 FIXME("(%p)->(%p)\n", This, p);
700 return E_NOTIMPL;
703 static HRESULT HTMLObjectElement_get_dispid(HTMLDOMNode *iface, BSTR name,
704 DWORD grfdex, DISPID *pid)
706 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
708 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(name), grfdex, pid);
710 return get_plugin_dispid(&This->plugin_container, name, pid);
713 static HRESULT HTMLObjectElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid,
714 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
716 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
718 TRACE("(%p)->(%d)\n", This, id);
720 return invoke_plugin_prop(&This->plugin_container, id, lcid, flags, params, res, ei);
723 static void HTMLObjectElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
725 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
727 if(This->nsobject)
728 note_cc_edge((nsISupports*)This->nsobject, "This->nsobject", cb);
731 static void HTMLObjectElement_unlink(HTMLDOMNode *iface)
733 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
735 if(This->nsobject) {
736 nsIDOMHTMLObjectElement *nsobject = This->nsobject;
738 This->nsobject = NULL;
739 nsIDOMHTMLObjectElement_Release(nsobject);
743 static const NodeImplVtbl HTMLObjectElementImplVtbl = {
744 &CLSID_HTMLObjectElement,
745 HTMLObjectElement_QI,
746 HTMLObjectElement_destructor,
747 HTMLElement_cpc,
748 HTMLElement_clone,
749 HTMLElement_handle_event,
750 HTMLElement_get_attr_col,
751 NULL,
752 NULL,
753 NULL,
754 NULL,
755 HTMLObjectElement_get_readystate,
756 HTMLObjectElement_get_dispid,
757 HTMLObjectElement_invoke,
758 NULL,
759 HTMLObjectElement_traverse,
760 HTMLObjectElement_unlink
763 static const tid_t HTMLObjectElement_iface_tids[] = {
764 IHTMLObjectElement2_tid,
765 IHTMLObjectElement_tid,
766 HTMLELEMENT_TIDS,
769 static dispex_static_data_t HTMLObjectElement_dispex = {
770 NULL,
771 DispHTMLObjectElement_tid,
772 HTMLObjectElement_iface_tids,
773 HTMLElement_init_dispex_info
776 HRESULT HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
778 HTMLObjectElement *ret;
779 nsresult nsres;
781 ret = heap_alloc_zero(sizeof(*ret));
782 if(!ret)
783 return E_OUTOFMEMORY;
785 ret->IHTMLObjectElement_iface.lpVtbl = &HTMLObjectElementVtbl;
786 ret->IHTMLObjectElement2_iface.lpVtbl = &HTMLObjectElement2Vtbl;
787 ret->plugin_container.element.node.vtbl = &HTMLObjectElementImplVtbl;
789 HTMLElement_Init(&ret->plugin_container.element, doc, nselem, &HTMLObjectElement_dispex);
791 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLObjectElement, (void**)&ret->nsobject);
792 assert(nsres == NS_OK);
794 *elem = &ret->plugin_container.element;
795 return S_OK;
798 struct HTMLEmbed {
799 HTMLElement element;
801 IHTMLEmbedElement IHTMLEmbedElement_iface;
804 static inline HTMLEmbed *impl_from_IHTMLEmbedElement(IHTMLEmbedElement *iface)
806 return CONTAINING_RECORD(iface, HTMLEmbed, IHTMLEmbedElement_iface);
809 static HRESULT WINAPI HTMLEmbedElement_QueryInterface(IHTMLEmbedElement *iface,
810 REFIID riid, void **ppv)
812 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
814 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
817 static ULONG WINAPI HTMLEmbedElement_AddRef(IHTMLEmbedElement *iface)
819 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
821 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
824 static ULONG WINAPI HTMLEmbedElement_Release(IHTMLEmbedElement *iface)
826 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
828 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
831 static HRESULT WINAPI HTMLEmbedElement_GetTypeInfoCount(IHTMLEmbedElement *iface, UINT *pctinfo)
833 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
834 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
837 static HRESULT WINAPI HTMLEmbedElement_GetTypeInfo(IHTMLEmbedElement *iface, UINT iTInfo,
838 LCID lcid, ITypeInfo **ppTInfo)
840 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
841 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
842 ppTInfo);
845 static HRESULT WINAPI HTMLEmbedElement_GetIDsOfNames(IHTMLEmbedElement *iface, REFIID riid,
846 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
848 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
849 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
850 cNames, lcid, rgDispId);
853 static HRESULT WINAPI HTMLEmbedElement_Invoke(IHTMLEmbedElement *iface, DISPID dispIdMember,
854 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
855 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
857 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
858 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
859 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
862 static HRESULT WINAPI HTMLEmbedElement_put_hidden(IHTMLEmbedElement *iface, BSTR v)
864 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
865 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
866 return E_NOTIMPL;
869 static HRESULT WINAPI HTMLEmbedElement_get_hidden(IHTMLEmbedElement *iface, BSTR *p)
871 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
872 FIXME("(%p)->(%p)\n", This, p);
873 return E_NOTIMPL;
876 static HRESULT WINAPI HTMLEmbedElement_get_palette(IHTMLEmbedElement *iface, BSTR *p)
878 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
879 FIXME("(%p)->(%p)\n", This, p);
880 return E_NOTIMPL;
883 static HRESULT WINAPI HTMLEmbedElement_get_pluginspage(IHTMLEmbedElement *iface, BSTR *p)
885 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
886 FIXME("(%p)->(%p)\n", This, p);
887 return E_NOTIMPL;
890 static HRESULT WINAPI HTMLEmbedElement_put_src(IHTMLEmbedElement *iface, BSTR v)
892 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
893 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
894 return E_NOTIMPL;
897 static HRESULT WINAPI HTMLEmbedElement_get_src(IHTMLEmbedElement *iface, BSTR *p)
899 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
900 FIXME("(%p)->(%p)\n", This, p);
901 return E_NOTIMPL;
904 static HRESULT WINAPI HTMLEmbedElement_put_units(IHTMLEmbedElement *iface, BSTR v)
906 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
907 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
908 return E_NOTIMPL;
911 static HRESULT WINAPI HTMLEmbedElement_get_units(IHTMLEmbedElement *iface, BSTR *p)
913 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
914 FIXME("(%p)->(%p)\n", This, p);
915 return E_NOTIMPL;
918 static HRESULT WINAPI HTMLEmbedElement_put_name(IHTMLEmbedElement *iface, BSTR v)
920 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
921 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
922 return E_NOTIMPL;
925 static HRESULT WINAPI HTMLEmbedElement_get_name(IHTMLEmbedElement *iface, BSTR *p)
927 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
928 FIXME("(%p)->(%p)\n", This, p);
929 return E_NOTIMPL;
932 static HRESULT WINAPI HTMLEmbedElement_put_width(IHTMLEmbedElement *iface, VARIANT v)
934 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
935 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
936 return E_NOTIMPL;
939 static HRESULT WINAPI HTMLEmbedElement_get_width(IHTMLEmbedElement *iface, VARIANT *p)
941 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
942 FIXME("(%p)->(%p)\n", This, p);
943 return E_NOTIMPL;
946 static HRESULT WINAPI HTMLEmbedElement_put_height(IHTMLEmbedElement *iface, VARIANT v)
948 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
949 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
950 return E_NOTIMPL;
953 static HRESULT WINAPI HTMLEmbedElement_get_height(IHTMLEmbedElement *iface, VARIANT *p)
955 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
956 FIXME("(%p)->(%p)\n", This, p);
957 return E_NOTIMPL;
960 static const IHTMLEmbedElementVtbl HTMLEmbedElementVtbl = {
961 HTMLEmbedElement_QueryInterface,
962 HTMLEmbedElement_AddRef,
963 HTMLEmbedElement_Release,
964 HTMLEmbedElement_GetTypeInfoCount,
965 HTMLEmbedElement_GetTypeInfo,
966 HTMLEmbedElement_GetIDsOfNames,
967 HTMLEmbedElement_Invoke,
968 HTMLEmbedElement_put_hidden,
969 HTMLEmbedElement_get_hidden,
970 HTMLEmbedElement_get_palette,
971 HTMLEmbedElement_get_pluginspage,
972 HTMLEmbedElement_put_src,
973 HTMLEmbedElement_get_src,
974 HTMLEmbedElement_put_units,
975 HTMLEmbedElement_get_units,
976 HTMLEmbedElement_put_name,
977 HTMLEmbedElement_get_name,
978 HTMLEmbedElement_put_width,
979 HTMLEmbedElement_get_width,
980 HTMLEmbedElement_put_height,
981 HTMLEmbedElement_get_height
984 static inline HTMLEmbed *embed_from_HTMLDOMNode(HTMLDOMNode *iface)
986 return CONTAINING_RECORD(iface, HTMLEmbed, element.node);
989 static HRESULT HTMLEmbedElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
991 HTMLEmbed *This = embed_from_HTMLDOMNode(iface);
993 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
995 if(IsEqualGUID(&IID_IUnknown, riid)) {
996 *ppv = &This->IHTMLEmbedElement_iface;
997 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
998 *ppv = &This->IHTMLEmbedElement_iface;
999 }else if(IsEqualGUID(&IID_IHTMLEmbedElement, riid)) {
1000 *ppv = &This->IHTMLEmbedElement_iface;
1001 }else {
1002 return HTMLElement_QI(&This->element.node, riid, ppv);
1005 IUnknown_AddRef((IUnknown*)*ppv);
1006 return S_OK;
1009 static void HTMLEmbedElement_destructor(HTMLDOMNode *iface)
1011 HTMLEmbed *This = embed_from_HTMLDOMNode(iface);
1013 HTMLElement_destructor(&This->element.node);
1016 static const NodeImplVtbl HTMLEmbedElementImplVtbl = {
1017 &CLSID_HTMLEmbed,
1018 HTMLEmbedElement_QI,
1019 HTMLEmbedElement_destructor,
1020 HTMLElement_cpc,
1021 HTMLElement_clone,
1022 HTMLElement_handle_event,
1023 HTMLElement_get_attr_col
1026 static const tid_t HTMLEmbedElement_iface_tids[] = {
1027 HTMLELEMENT_TIDS,
1028 IHTMLEmbedElement_tid,
1031 static dispex_static_data_t HTMLEmbedElement_dispex = {
1032 NULL,
1033 DispHTMLEmbed_tid,
1034 HTMLEmbedElement_iface_tids,
1035 HTMLElement_init_dispex_info
1038 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
1040 HTMLEmbed *ret;
1042 ret = heap_alloc_zero(sizeof(*ret));
1043 if(!ret)
1044 return E_OUTOFMEMORY;
1046 ret->IHTMLEmbedElement_iface.lpVtbl = &HTMLEmbedElementVtbl;
1047 ret->element.node.vtbl = &HTMLEmbedElementImplVtbl;
1049 HTMLElement_Init(&ret->element, doc, nselem, &HTMLEmbedElement_dispex);
1050 *elem = &ret->element;
1051 return S_OK;