mshtml: Added IHTMLObjectElement::put_width implementation.
[wine/multimedia.git] / dlls / mshtml / htmlobject.c
blob6c21814fef6d830ea4177d8d003ed6c43b194b25
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 typedef struct {
38 HTMLPluginContainer plugin_container;
40 IHTMLObjectElement IHTMLObjectElement_iface;
41 IHTMLObjectElement2 IHTMLObjectElement2_iface;
43 nsIDOMHTMLObjectElement *nsobject;
44 } HTMLObjectElement;
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.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.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.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.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 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
166 return E_NOTIMPL;
169 static HRESULT WINAPI HTMLObjectElement_get_name(IHTMLObjectElement *iface, BSTR *p)
171 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
172 FIXME("(%p)->(%p)\n", This, p);
173 return E_NOTIMPL;
176 static HRESULT WINAPI HTMLObjectElement_put_codeBase(IHTMLObjectElement *iface, BSTR v)
178 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
179 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
180 return E_NOTIMPL;
183 static HRESULT WINAPI HTMLObjectElement_get_codeBase(IHTMLObjectElement *iface, BSTR *p)
185 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
186 FIXME("(%p)->(%p)\n", This, p);
187 return E_NOTIMPL;
190 static HRESULT WINAPI HTMLObjectElement_put_codeType(IHTMLObjectElement *iface, BSTR v)
192 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
193 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
194 return E_NOTIMPL;
197 static HRESULT WINAPI HTMLObjectElement_get_codeType(IHTMLObjectElement *iface, BSTR *p)
199 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
200 FIXME("(%p)->(%p)\n", This, p);
201 return E_NOTIMPL;
204 static HRESULT WINAPI HTMLObjectElement_put_code(IHTMLObjectElement *iface, BSTR v)
206 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
207 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
208 return E_NOTIMPL;
211 static HRESULT WINAPI HTMLObjectElement_get_code(IHTMLObjectElement *iface, BSTR *p)
213 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
214 FIXME("(%p)->(%p)\n", This, p);
215 return E_NOTIMPL;
218 static HRESULT WINAPI HTMLObjectElement_get_BaseHref(IHTMLObjectElement *iface, BSTR *p)
220 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
221 FIXME("(%p)->(%p)\n", This, p);
222 return E_NOTIMPL;
225 static HRESULT WINAPI HTMLObjectElement_put_type(IHTMLObjectElement *iface, BSTR v)
227 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
228 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
229 return E_NOTIMPL;
232 static HRESULT WINAPI HTMLObjectElement_get_type(IHTMLObjectElement *iface, BSTR *p)
234 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
235 FIXME("(%p)->(%p)\n", This, p);
236 return E_NOTIMPL;
239 static HRESULT WINAPI HTMLObjectElement_get_form(IHTMLObjectElement *iface, IHTMLFormElement **p)
241 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
242 FIXME("(%p)->(%p)\n", This, p);
243 return E_NOTIMPL;
246 static HRESULT WINAPI HTMLObjectElement_put_width(IHTMLObjectElement *iface, VARIANT v)
248 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
249 nsAString width_str;
250 PRUnichar buf[12];
251 nsresult nsres;
253 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
255 switch(V_VT(&v)) {
256 case VT_I4: {
257 static const WCHAR formatW[] = {'%','d',0};
258 sprintfW(buf, formatW, V_I4(&v));
259 break;
261 default:
262 FIXME("unimplemented for arg %s\n", debugstr_variant(&v));
263 return E_NOTIMPL;
266 nsAString_InitDepend(&width_str, buf);
267 nsres = nsIDOMHTMLObjectElement_SetWidth(This->nsobject, &width_str);
268 nsAString_Finish(&width_str);
269 if(NS_FAILED(nsres)) {
270 FIXME("SetWidth failed: %08x\n", nsres);
271 return E_FAIL;
274 notif_container_change(&This->plugin_container, DISPID_UNKNOWN);
275 return S_OK;
278 static HRESULT WINAPI HTMLObjectElement_get_width(IHTMLObjectElement *iface, VARIANT *p)
280 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
281 FIXME("(%p)->(%p)\n", This, p);
282 return E_NOTIMPL;
285 static HRESULT WINAPI HTMLObjectElement_put_height(IHTMLObjectElement *iface, VARIANT v)
287 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
288 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
289 return E_NOTIMPL;
292 static HRESULT WINAPI HTMLObjectElement_get_height(IHTMLObjectElement *iface, VARIANT *p)
294 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
295 FIXME("(%p)->(%p)\n", This, p);
296 return E_NOTIMPL;
299 static HRESULT WINAPI HTMLObjectElement_get_readyState(IHTMLObjectElement *iface, LONG *p)
301 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
302 FIXME("(%p)->(%p)\n", This, p);
303 return E_NOTIMPL;
306 static HRESULT WINAPI HTMLObjectElement_put_onreadystatechange(IHTMLObjectElement *iface, VARIANT v)
308 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
309 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
310 return E_NOTIMPL;
313 static HRESULT WINAPI HTMLObjectElement_get_onreadystatechange(IHTMLObjectElement *iface, VARIANT *p)
315 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
316 FIXME("(%p)->(%p)\n", This, p);
317 return E_NOTIMPL;
320 static HRESULT WINAPI HTMLObjectElement_put_onerror(IHTMLObjectElement *iface, VARIANT v)
322 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
323 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
324 return E_NOTIMPL;
327 static HRESULT WINAPI HTMLObjectElement_get_onerror(IHTMLObjectElement *iface, VARIANT *p)
329 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
330 FIXME("(%p)->(%p)\n", This, p);
331 return E_NOTIMPL;
334 static HRESULT WINAPI HTMLObjectElement_put_altHtml(IHTMLObjectElement *iface, BSTR v)
336 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
337 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
338 return E_NOTIMPL;
341 static HRESULT WINAPI HTMLObjectElement_get_altHtml(IHTMLObjectElement *iface, BSTR *p)
343 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
344 FIXME("(%p)->(%p)\n", This, p);
345 return E_NOTIMPL;
348 static HRESULT WINAPI HTMLObjectElement_put_vspace(IHTMLObjectElement *iface, LONG v)
350 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
351 FIXME("(%p)->(%d)\n", This, v);
352 return E_NOTIMPL;
355 static HRESULT WINAPI HTMLObjectElement_get_vspace(IHTMLObjectElement *iface, LONG *p)
357 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
358 PRInt32 vspace;
359 nsresult nsres;
361 TRACE("(%p)->(%p)\n", This, p);
363 nsres = nsIDOMHTMLObjectElement_GetVspace(This->nsobject, &vspace);
364 if(NS_FAILED(nsres)) {
365 ERR("GetVspace failed: %08x\n", nsres);
366 return E_FAIL;
369 *p = vspace;
370 return S_OK;
373 static HRESULT WINAPI HTMLObjectElement_put_hspace(IHTMLObjectElement *iface, LONG v)
375 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
376 FIXME("(%p)->(%d)\n", This, v);
377 return E_NOTIMPL;
380 static HRESULT WINAPI HTMLObjectElement_get_hspace(IHTMLObjectElement *iface, LONG *p)
382 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
383 FIXME("(%p)->(%p)\n", This, p);
384 return E_NOTIMPL;
387 static const IHTMLObjectElementVtbl HTMLObjectElementVtbl = {
388 HTMLObjectElement_QueryInterface,
389 HTMLObjectElement_AddRef,
390 HTMLObjectElement_Release,
391 HTMLObjectElement_GetTypeInfoCount,
392 HTMLObjectElement_GetTypeInfo,
393 HTMLObjectElement_GetIDsOfNames,
394 HTMLObjectElement_Invoke,
395 HTMLObjectElement_get_object,
396 HTMLObjectElement_get_classid,
397 HTMLObjectElement_get_data,
398 HTMLObjectElement_put_recordset,
399 HTMLObjectElement_get_recordset,
400 HTMLObjectElement_put_align,
401 HTMLObjectElement_get_align,
402 HTMLObjectElement_put_name,
403 HTMLObjectElement_get_name,
404 HTMLObjectElement_put_codeBase,
405 HTMLObjectElement_get_codeBase,
406 HTMLObjectElement_put_codeType,
407 HTMLObjectElement_get_codeType,
408 HTMLObjectElement_put_code,
409 HTMLObjectElement_get_code,
410 HTMLObjectElement_get_BaseHref,
411 HTMLObjectElement_put_type,
412 HTMLObjectElement_get_type,
413 HTMLObjectElement_get_form,
414 HTMLObjectElement_put_width,
415 HTMLObjectElement_get_width,
416 HTMLObjectElement_put_height,
417 HTMLObjectElement_get_height,
418 HTMLObjectElement_get_readyState,
419 HTMLObjectElement_put_onreadystatechange,
420 HTMLObjectElement_get_onreadystatechange,
421 HTMLObjectElement_put_onerror,
422 HTMLObjectElement_get_onerror,
423 HTMLObjectElement_put_altHtml,
424 HTMLObjectElement_get_altHtml,
425 HTMLObjectElement_put_vspace,
426 HTMLObjectElement_get_vspace,
427 HTMLObjectElement_put_hspace,
428 HTMLObjectElement_get_hspace
431 static inline HTMLObjectElement *impl_from_IHTMLObjectElement2(IHTMLObjectElement2 *iface)
433 return CONTAINING_RECORD(iface, HTMLObjectElement, IHTMLObjectElement2_iface);
436 static HRESULT WINAPI HTMLObjectElement2_QueryInterface(IHTMLObjectElement2 *iface,
437 REFIID riid, void **ppv)
439 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
441 return IHTMLDOMNode_QueryInterface(&This->plugin_container.element.node.IHTMLDOMNode_iface,
442 riid, ppv);
445 static ULONG WINAPI HTMLObjectElement2_AddRef(IHTMLObjectElement2 *iface)
447 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
449 return IHTMLDOMNode_AddRef(&This->plugin_container.element.node.IHTMLDOMNode_iface);
452 static ULONG WINAPI HTMLObjectElement2_Release(IHTMLObjectElement2 *iface)
454 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
456 return IHTMLDOMNode_Release(&This->plugin_container.element.node.IHTMLDOMNode_iface);
459 static HRESULT WINAPI HTMLObjectElement2_GetTypeInfoCount(IHTMLObjectElement2 *iface, UINT *pctinfo)
461 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
462 return IDispatchEx_GetTypeInfoCount(&This->plugin_container.element.node.dispex.IDispatchEx_iface,
463 pctinfo);
466 static HRESULT WINAPI HTMLObjectElement2_GetTypeInfo(IHTMLObjectElement2 *iface, UINT iTInfo,
467 LCID lcid, ITypeInfo **ppTInfo)
469 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
470 return IDispatchEx_GetTypeInfo(&This->plugin_container.element.node.dispex.IDispatchEx_iface,
471 iTInfo, lcid, ppTInfo);
474 static HRESULT WINAPI HTMLObjectElement2_GetIDsOfNames(IHTMLObjectElement2 *iface, REFIID riid,
475 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
477 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
478 return IDispatchEx_GetIDsOfNames(&This->plugin_container.element.node.dispex.IDispatchEx_iface,
479 riid, rgszNames, cNames, lcid, rgDispId);
482 static HRESULT WINAPI HTMLObjectElement2_Invoke(IHTMLObjectElement2 *iface, DISPID dispIdMember,
483 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
484 EXCEPINFO *pExcepInfo, UINT *puArgErr)
486 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
487 return IDispatchEx_Invoke(&This->plugin_container.element.node.dispex.IDispatchEx_iface,
488 dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
491 static HRESULT WINAPI HTMLObjectElement2_namedRecordset(IHTMLObjectElement2 *iface, BSTR dataMember,
492 VARIANT *hierarchy, IDispatch **ppRecordset)
494 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
495 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(dataMember), hierarchy, ppRecordset);
496 return E_NOTIMPL;
499 static HRESULT WINAPI HTMLObjectElement2_put_classid(IHTMLObjectElement2 *iface, BSTR v)
501 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
502 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
503 return E_NOTIMPL;
506 static HRESULT WINAPI HTMLObjectElement2_get_classid(IHTMLObjectElement2 *iface, BSTR *p)
508 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
509 FIXME("(%p)->(%p)\n", This, p);
510 return E_NOTIMPL;
513 static HRESULT WINAPI HTMLObjectElement2_put_data(IHTMLObjectElement2 *iface, BSTR v)
515 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
516 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
517 return E_NOTIMPL;
520 static HRESULT WINAPI HTMLObjectElement2_get_data(IHTMLObjectElement2 *iface, BSTR *p)
522 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
523 FIXME("(%p)->(%p)\n", This, p);
524 return E_NOTIMPL;
527 static const IHTMLObjectElement2Vtbl HTMLObjectElement2Vtbl = {
528 HTMLObjectElement2_QueryInterface,
529 HTMLObjectElement2_AddRef,
530 HTMLObjectElement2_Release,
531 HTMLObjectElement2_GetTypeInfoCount,
532 HTMLObjectElement2_GetTypeInfo,
533 HTMLObjectElement2_GetIDsOfNames,
534 HTMLObjectElement2_Invoke,
535 HTMLObjectElement2_namedRecordset,
536 HTMLObjectElement2_put_classid,
537 HTMLObjectElement2_get_classid,
538 HTMLObjectElement2_put_data,
539 HTMLObjectElement2_get_data
542 static inline HTMLObjectElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
544 return CONTAINING_RECORD(iface, HTMLObjectElement, plugin_container.element.node);
547 static HRESULT HTMLObjectElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
549 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
551 if(IsEqualGUID(&IID_IUnknown, riid)) {
552 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
553 *ppv = &This->IHTMLObjectElement_iface;
554 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
555 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
556 *ppv = &This->IHTMLObjectElement_iface;
557 }else if(IsEqualGUID(&IID_IHTMLObjectElement, riid)) {
558 TRACE("(%p)->(IID_IHTMLObjectElement %p)\n", This, ppv);
559 *ppv = &This->IHTMLObjectElement_iface;
560 }else if(IsEqualGUID(&IID_IHTMLObjectElement2, riid)) {
561 TRACE("(%p)->(IID_IHTMLObjectElement2 %p)\n", This, ppv);
562 *ppv = &This->IHTMLObjectElement2_iface;
563 }else if(IsEqualGUID(&IID_HTMLPluginContainer, riid)) {
564 TRACE("(%p)->(IID_HTMLPluginContainer %p)\n", This, ppv);
565 *ppv = &This->plugin_container;
566 return S_OK;
567 }else {
568 HRESULT hres;
570 hres = HTMLElement_QI(&This->plugin_container.element.node, riid, ppv);
571 if(hres == E_NOINTERFACE && This->plugin_container.plugin_host && This->plugin_container.plugin_host->plugin_unk) {
572 IUnknown *plugin_iface, *ret;
574 hres = IUnknown_QueryInterface(This->plugin_container.plugin_host->plugin_unk, riid, (void**)&plugin_iface);
575 if(hres == S_OK) {
576 hres = wrap_iface(plugin_iface, (IUnknown*)&This->IHTMLObjectElement_iface, &ret);
577 IUnknown_Release(plugin_iface);
578 if(FAILED(hres))
579 return hres;
581 TRACE("returning plugin iface %p wrapped to %p\n", plugin_iface, ret);
582 *ppv = ret;
583 return S_OK;
587 return hres;
590 IUnknown_AddRef((IUnknown*)*ppv);
591 return S_OK;
594 static void HTMLObjectElement_destructor(HTMLDOMNode *iface)
596 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
598 if(This->plugin_container.plugin_host)
599 detach_plugin_host(This->plugin_container.plugin_host);
601 HTMLElement_destructor(&This->plugin_container.element.node);
604 static HRESULT HTMLObjectElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
606 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
607 FIXME("(%p)->(%p)\n", This, p);
608 return E_NOTIMPL;
611 static HRESULT HTMLObjectElement_get_dispid(HTMLDOMNode *iface, BSTR name,
612 DWORD grfdex, DISPID *pid)
614 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
616 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(name), grfdex, pid);
618 return get_plugin_dispid(&This->plugin_container, name, pid);
621 static HRESULT HTMLObjectElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid,
622 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
624 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
626 TRACE("(%p)->(%d)\n", This, id);
628 return invoke_plugin_prop(&This->plugin_container, id, lcid, flags, params, res, ei);
631 static const NodeImplVtbl HTMLObjectElementImplVtbl = {
632 HTMLObjectElement_QI,
633 HTMLObjectElement_destructor,
634 HTMLElement_clone,
635 HTMLElement_get_attr_col,
636 NULL,
637 NULL,
638 NULL,
639 NULL,
640 NULL,
641 NULL,
642 HTMLObjectElement_get_readystate,
643 HTMLObjectElement_get_dispid,
644 HTMLObjectElement_invoke
647 static const tid_t HTMLObjectElement_iface_tids[] = {
648 HTMLELEMENT_TIDS,
649 IHTMLObjectElement_tid,
650 IHTMLObjectElement2_tid,
653 static dispex_static_data_t HTMLObjectElement_dispex = {
654 NULL,
655 DispHTMLObjectElement_tid,
656 NULL,
657 HTMLObjectElement_iface_tids
660 HRESULT HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
662 HTMLObjectElement *ret;
663 nsresult nsres;
665 ret = heap_alloc_zero(sizeof(*ret));
666 if(!ret)
667 return E_OUTOFMEMORY;
669 ret->IHTMLObjectElement_iface.lpVtbl = &HTMLObjectElementVtbl;
670 ret->IHTMLObjectElement2_iface.lpVtbl = &HTMLObjectElement2Vtbl;
671 ret->plugin_container.element.node.vtbl = &HTMLObjectElementImplVtbl;
673 HTMLElement_Init(&ret->plugin_container.element, doc, nselem, &HTMLObjectElement_dispex);
675 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLObjectElement, (void**)&ret->nsobject);
677 /* Share nsobject reference with nsnode */
678 assert(nsres == NS_OK && (nsIDOMNode*)ret->nsobject == ret->plugin_container.element.node.nsnode);
679 nsIDOMNode_Release(ret->plugin_container.element.node.nsnode);
681 *elem = &ret->plugin_container.element;
682 return S_OK;