mshtml: Added IHTMLObjectElement::put_height implementation.
[wine/multimedia.git] / dlls / mshtml / htmlobject.c
blob420b4d58ec73b4fec474a4e8134f5800b84e46bc
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 nsAString width_str;
282 nsresult nsres;
283 HRESULT hres;
285 TRACE("(%p)->(%p)\n", This, p);
287 nsAString_Init(&width_str, NULL);
288 nsres = nsIDOMHTMLObjectElement_GetWidth(This->nsobject, &width_str);
289 if(NS_SUCCEEDED(nsres)) {
290 const PRUnichar *width;
292 nsAString_GetData(&width_str, &width);
293 V_VT(p) = VT_BSTR;
294 V_BSTR(p) = SysAllocString(width);
295 hres = V_BSTR(p) ? S_OK : E_OUTOFMEMORY;
296 }else {
297 ERR("GetWidth failed: %08x\n", nsres);
298 hres = E_FAIL;
301 nsAString_Finish(&width_str);
302 return hres;
305 static HRESULT WINAPI HTMLObjectElement_put_height(IHTMLObjectElement *iface, VARIANT v)
307 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
308 nsAString height_str;
309 PRUnichar buf[12];
310 nsresult nsres;
312 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
314 switch(V_VT(&v)) {
315 case VT_I4: {
316 static const WCHAR formatW[] = {'%','d',0};
317 sprintfW(buf, formatW, V_I4(&v));
318 break;
320 default:
321 FIXME("unimplemented for arg %s\n", debugstr_variant(&v));
322 return E_NOTIMPL;
325 nsAString_InitDepend(&height_str, buf);
326 nsres = nsIDOMHTMLObjectElement_SetHeight(This->nsobject, &height_str);
327 nsAString_Finish(&height_str);
328 if(NS_FAILED(nsres)) {
329 FIXME("SetHeight failed: %08x\n", nsres);
330 return E_FAIL;
333 notif_container_change(&This->plugin_container, DISPID_UNKNOWN);
334 return S_OK;
337 static HRESULT WINAPI HTMLObjectElement_get_height(IHTMLObjectElement *iface, VARIANT *p)
339 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
340 FIXME("(%p)->(%p)\n", This, p);
341 return E_NOTIMPL;
344 static HRESULT WINAPI HTMLObjectElement_get_readyState(IHTMLObjectElement *iface, LONG *p)
346 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
347 FIXME("(%p)->(%p)\n", This, p);
348 return E_NOTIMPL;
351 static HRESULT WINAPI HTMLObjectElement_put_onreadystatechange(IHTMLObjectElement *iface, VARIANT v)
353 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
354 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
355 return E_NOTIMPL;
358 static HRESULT WINAPI HTMLObjectElement_get_onreadystatechange(IHTMLObjectElement *iface, VARIANT *p)
360 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
361 FIXME("(%p)->(%p)\n", This, p);
362 return E_NOTIMPL;
365 static HRESULT WINAPI HTMLObjectElement_put_onerror(IHTMLObjectElement *iface, VARIANT v)
367 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
368 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
369 return E_NOTIMPL;
372 static HRESULT WINAPI HTMLObjectElement_get_onerror(IHTMLObjectElement *iface, VARIANT *p)
374 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
375 FIXME("(%p)->(%p)\n", This, p);
376 return E_NOTIMPL;
379 static HRESULT WINAPI HTMLObjectElement_put_altHtml(IHTMLObjectElement *iface, BSTR v)
381 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
382 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
383 return E_NOTIMPL;
386 static HRESULT WINAPI HTMLObjectElement_get_altHtml(IHTMLObjectElement *iface, BSTR *p)
388 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
389 FIXME("(%p)->(%p)\n", This, p);
390 return E_NOTIMPL;
393 static HRESULT WINAPI HTMLObjectElement_put_vspace(IHTMLObjectElement *iface, LONG v)
395 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
396 FIXME("(%p)->(%d)\n", This, v);
397 return E_NOTIMPL;
400 static HRESULT WINAPI HTMLObjectElement_get_vspace(IHTMLObjectElement *iface, LONG *p)
402 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
403 PRInt32 vspace;
404 nsresult nsres;
406 TRACE("(%p)->(%p)\n", This, p);
408 nsres = nsIDOMHTMLObjectElement_GetVspace(This->nsobject, &vspace);
409 if(NS_FAILED(nsres)) {
410 ERR("GetVspace failed: %08x\n", nsres);
411 return E_FAIL;
414 *p = vspace;
415 return S_OK;
418 static HRESULT WINAPI HTMLObjectElement_put_hspace(IHTMLObjectElement *iface, LONG v)
420 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
421 FIXME("(%p)->(%d)\n", This, v);
422 return E_NOTIMPL;
425 static HRESULT WINAPI HTMLObjectElement_get_hspace(IHTMLObjectElement *iface, LONG *p)
427 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
428 FIXME("(%p)->(%p)\n", This, p);
429 return E_NOTIMPL;
432 static const IHTMLObjectElementVtbl HTMLObjectElementVtbl = {
433 HTMLObjectElement_QueryInterface,
434 HTMLObjectElement_AddRef,
435 HTMLObjectElement_Release,
436 HTMLObjectElement_GetTypeInfoCount,
437 HTMLObjectElement_GetTypeInfo,
438 HTMLObjectElement_GetIDsOfNames,
439 HTMLObjectElement_Invoke,
440 HTMLObjectElement_get_object,
441 HTMLObjectElement_get_classid,
442 HTMLObjectElement_get_data,
443 HTMLObjectElement_put_recordset,
444 HTMLObjectElement_get_recordset,
445 HTMLObjectElement_put_align,
446 HTMLObjectElement_get_align,
447 HTMLObjectElement_put_name,
448 HTMLObjectElement_get_name,
449 HTMLObjectElement_put_codeBase,
450 HTMLObjectElement_get_codeBase,
451 HTMLObjectElement_put_codeType,
452 HTMLObjectElement_get_codeType,
453 HTMLObjectElement_put_code,
454 HTMLObjectElement_get_code,
455 HTMLObjectElement_get_BaseHref,
456 HTMLObjectElement_put_type,
457 HTMLObjectElement_get_type,
458 HTMLObjectElement_get_form,
459 HTMLObjectElement_put_width,
460 HTMLObjectElement_get_width,
461 HTMLObjectElement_put_height,
462 HTMLObjectElement_get_height,
463 HTMLObjectElement_get_readyState,
464 HTMLObjectElement_put_onreadystatechange,
465 HTMLObjectElement_get_onreadystatechange,
466 HTMLObjectElement_put_onerror,
467 HTMLObjectElement_get_onerror,
468 HTMLObjectElement_put_altHtml,
469 HTMLObjectElement_get_altHtml,
470 HTMLObjectElement_put_vspace,
471 HTMLObjectElement_get_vspace,
472 HTMLObjectElement_put_hspace,
473 HTMLObjectElement_get_hspace
476 static inline HTMLObjectElement *impl_from_IHTMLObjectElement2(IHTMLObjectElement2 *iface)
478 return CONTAINING_RECORD(iface, HTMLObjectElement, IHTMLObjectElement2_iface);
481 static HRESULT WINAPI HTMLObjectElement2_QueryInterface(IHTMLObjectElement2 *iface,
482 REFIID riid, void **ppv)
484 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
486 return IHTMLDOMNode_QueryInterface(&This->plugin_container.element.node.IHTMLDOMNode_iface,
487 riid, ppv);
490 static ULONG WINAPI HTMLObjectElement2_AddRef(IHTMLObjectElement2 *iface)
492 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
494 return IHTMLDOMNode_AddRef(&This->plugin_container.element.node.IHTMLDOMNode_iface);
497 static ULONG WINAPI HTMLObjectElement2_Release(IHTMLObjectElement2 *iface)
499 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
501 return IHTMLDOMNode_Release(&This->plugin_container.element.node.IHTMLDOMNode_iface);
504 static HRESULT WINAPI HTMLObjectElement2_GetTypeInfoCount(IHTMLObjectElement2 *iface, UINT *pctinfo)
506 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
507 return IDispatchEx_GetTypeInfoCount(&This->plugin_container.element.node.dispex.IDispatchEx_iface,
508 pctinfo);
511 static HRESULT WINAPI HTMLObjectElement2_GetTypeInfo(IHTMLObjectElement2 *iface, UINT iTInfo,
512 LCID lcid, ITypeInfo **ppTInfo)
514 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
515 return IDispatchEx_GetTypeInfo(&This->plugin_container.element.node.dispex.IDispatchEx_iface,
516 iTInfo, lcid, ppTInfo);
519 static HRESULT WINAPI HTMLObjectElement2_GetIDsOfNames(IHTMLObjectElement2 *iface, REFIID riid,
520 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
522 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
523 return IDispatchEx_GetIDsOfNames(&This->plugin_container.element.node.dispex.IDispatchEx_iface,
524 riid, rgszNames, cNames, lcid, rgDispId);
527 static HRESULT WINAPI HTMLObjectElement2_Invoke(IHTMLObjectElement2 *iface, DISPID dispIdMember,
528 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
529 EXCEPINFO *pExcepInfo, UINT *puArgErr)
531 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
532 return IDispatchEx_Invoke(&This->plugin_container.element.node.dispex.IDispatchEx_iface,
533 dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
536 static HRESULT WINAPI HTMLObjectElement2_namedRecordset(IHTMLObjectElement2 *iface, BSTR dataMember,
537 VARIANT *hierarchy, IDispatch **ppRecordset)
539 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
540 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(dataMember), hierarchy, ppRecordset);
541 return E_NOTIMPL;
544 static HRESULT WINAPI HTMLObjectElement2_put_classid(IHTMLObjectElement2 *iface, BSTR v)
546 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
547 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
548 return E_NOTIMPL;
551 static HRESULT WINAPI HTMLObjectElement2_get_classid(IHTMLObjectElement2 *iface, BSTR *p)
553 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
554 FIXME("(%p)->(%p)\n", This, p);
555 return E_NOTIMPL;
558 static HRESULT WINAPI HTMLObjectElement2_put_data(IHTMLObjectElement2 *iface, BSTR v)
560 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
561 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
562 return E_NOTIMPL;
565 static HRESULT WINAPI HTMLObjectElement2_get_data(IHTMLObjectElement2 *iface, BSTR *p)
567 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
568 FIXME("(%p)->(%p)\n", This, p);
569 return E_NOTIMPL;
572 static const IHTMLObjectElement2Vtbl HTMLObjectElement2Vtbl = {
573 HTMLObjectElement2_QueryInterface,
574 HTMLObjectElement2_AddRef,
575 HTMLObjectElement2_Release,
576 HTMLObjectElement2_GetTypeInfoCount,
577 HTMLObjectElement2_GetTypeInfo,
578 HTMLObjectElement2_GetIDsOfNames,
579 HTMLObjectElement2_Invoke,
580 HTMLObjectElement2_namedRecordset,
581 HTMLObjectElement2_put_classid,
582 HTMLObjectElement2_get_classid,
583 HTMLObjectElement2_put_data,
584 HTMLObjectElement2_get_data
587 static inline HTMLObjectElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
589 return CONTAINING_RECORD(iface, HTMLObjectElement, plugin_container.element.node);
592 static HRESULT HTMLObjectElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
594 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
596 if(IsEqualGUID(&IID_IUnknown, riid)) {
597 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
598 *ppv = &This->IHTMLObjectElement_iface;
599 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
600 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
601 *ppv = &This->IHTMLObjectElement_iface;
602 }else if(IsEqualGUID(&IID_IHTMLObjectElement, riid)) {
603 TRACE("(%p)->(IID_IHTMLObjectElement %p)\n", This, ppv);
604 *ppv = &This->IHTMLObjectElement_iface;
605 }else if(IsEqualGUID(&IID_IHTMLObjectElement2, riid)) {
606 TRACE("(%p)->(IID_IHTMLObjectElement2 %p)\n", This, ppv);
607 *ppv = &This->IHTMLObjectElement2_iface;
608 }else if(IsEqualGUID(&IID_HTMLPluginContainer, riid)) {
609 TRACE("(%p)->(IID_HTMLPluginContainer %p)\n", This, ppv);
610 *ppv = &This->plugin_container;
611 return S_OK;
612 }else {
613 HRESULT hres;
615 hres = HTMLElement_QI(&This->plugin_container.element.node, riid, ppv);
616 if(hres == E_NOINTERFACE && This->plugin_container.plugin_host && This->plugin_container.plugin_host->plugin_unk) {
617 IUnknown *plugin_iface, *ret;
619 hres = IUnknown_QueryInterface(This->plugin_container.plugin_host->plugin_unk, riid, (void**)&plugin_iface);
620 if(hres == S_OK) {
621 hres = wrap_iface(plugin_iface, (IUnknown*)&This->IHTMLObjectElement_iface, &ret);
622 IUnknown_Release(plugin_iface);
623 if(FAILED(hres))
624 return hres;
626 TRACE("returning plugin iface %p wrapped to %p\n", plugin_iface, ret);
627 *ppv = ret;
628 return S_OK;
632 return hres;
635 IUnknown_AddRef((IUnknown*)*ppv);
636 return S_OK;
639 static void HTMLObjectElement_destructor(HTMLDOMNode *iface)
641 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
643 if(This->plugin_container.plugin_host)
644 detach_plugin_host(This->plugin_container.plugin_host);
646 HTMLElement_destructor(&This->plugin_container.element.node);
649 static HRESULT HTMLObjectElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
651 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
652 FIXME("(%p)->(%p)\n", This, p);
653 return E_NOTIMPL;
656 static HRESULT HTMLObjectElement_get_dispid(HTMLDOMNode *iface, BSTR name,
657 DWORD grfdex, DISPID *pid)
659 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
661 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(name), grfdex, pid);
663 return get_plugin_dispid(&This->plugin_container, name, pid);
666 static HRESULT HTMLObjectElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid,
667 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
669 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
671 TRACE("(%p)->(%d)\n", This, id);
673 return invoke_plugin_prop(&This->plugin_container, id, lcid, flags, params, res, ei);
676 static const NodeImplVtbl HTMLObjectElementImplVtbl = {
677 HTMLObjectElement_QI,
678 HTMLObjectElement_destructor,
679 HTMLElement_clone,
680 HTMLElement_get_attr_col,
681 NULL,
682 NULL,
683 NULL,
684 NULL,
685 NULL,
686 NULL,
687 HTMLObjectElement_get_readystate,
688 HTMLObjectElement_get_dispid,
689 HTMLObjectElement_invoke
692 static const tid_t HTMLObjectElement_iface_tids[] = {
693 HTMLELEMENT_TIDS,
694 IHTMLObjectElement_tid,
695 IHTMLObjectElement2_tid,
698 static dispex_static_data_t HTMLObjectElement_dispex = {
699 NULL,
700 DispHTMLObjectElement_tid,
701 NULL,
702 HTMLObjectElement_iface_tids
705 HRESULT HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
707 HTMLObjectElement *ret;
708 nsresult nsres;
710 ret = heap_alloc_zero(sizeof(*ret));
711 if(!ret)
712 return E_OUTOFMEMORY;
714 ret->IHTMLObjectElement_iface.lpVtbl = &HTMLObjectElementVtbl;
715 ret->IHTMLObjectElement2_iface.lpVtbl = &HTMLObjectElement2Vtbl;
716 ret->plugin_container.element.node.vtbl = &HTMLObjectElementImplVtbl;
718 HTMLElement_Init(&ret->plugin_container.element, doc, nselem, &HTMLObjectElement_dispex);
720 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLObjectElement, (void**)&ret->nsobject);
722 /* Share nsobject reference with nsnode */
723 assert(nsres == NS_OK && (nsIDOMNode*)ret->nsobject == ret->plugin_container.element.node.nsnode);
724 nsIDOMNode_Release(ret->plugin_container.element.node.nsnode);
726 *elem = &ret->plugin_container.element;
727 return S_OK;