mshtml: Added IHTMLObjectElement::get_height implementation.
[wine/multimedia.git] / dlls / mshtml / htmlobject.c
blob741011aace5028b13ad84bfbed17373a0c7ff131
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 nsAString height_str;
341 nsresult nsres;
342 HRESULT hres;
344 TRACE("(%p)->(%p)\n", This, p);
346 nsAString_Init(&height_str, NULL);
347 nsres = nsIDOMHTMLObjectElement_GetHeight(This->nsobject, &height_str);
348 if(NS_SUCCEEDED(nsres)) {
349 const PRUnichar *height;
351 nsAString_GetData(&height_str, &height);
352 V_VT(p) = VT_BSTR;
353 V_BSTR(p) = SysAllocString(height);
354 hres = V_BSTR(p) ? S_OK : E_OUTOFMEMORY;
355 }else {
356 ERR("GetHeight failed: %08x\n", nsres);
357 hres = E_FAIL;
360 nsAString_Finish(&height_str);
361 return hres;
364 static HRESULT WINAPI HTMLObjectElement_get_readyState(IHTMLObjectElement *iface, LONG *p)
366 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
367 FIXME("(%p)->(%p)\n", This, p);
368 return E_NOTIMPL;
371 static HRESULT WINAPI HTMLObjectElement_put_onreadystatechange(IHTMLObjectElement *iface, VARIANT v)
373 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
374 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
375 return E_NOTIMPL;
378 static HRESULT WINAPI HTMLObjectElement_get_onreadystatechange(IHTMLObjectElement *iface, VARIANT *p)
380 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
381 FIXME("(%p)->(%p)\n", This, p);
382 return E_NOTIMPL;
385 static HRESULT WINAPI HTMLObjectElement_put_onerror(IHTMLObjectElement *iface, VARIANT v)
387 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
388 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
389 return E_NOTIMPL;
392 static HRESULT WINAPI HTMLObjectElement_get_onerror(IHTMLObjectElement *iface, VARIANT *p)
394 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
395 FIXME("(%p)->(%p)\n", This, p);
396 return E_NOTIMPL;
399 static HRESULT WINAPI HTMLObjectElement_put_altHtml(IHTMLObjectElement *iface, BSTR v)
401 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
402 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
403 return E_NOTIMPL;
406 static HRESULT WINAPI HTMLObjectElement_get_altHtml(IHTMLObjectElement *iface, BSTR *p)
408 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
409 FIXME("(%p)->(%p)\n", This, p);
410 return E_NOTIMPL;
413 static HRESULT WINAPI HTMLObjectElement_put_vspace(IHTMLObjectElement *iface, LONG v)
415 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
416 FIXME("(%p)->(%d)\n", This, v);
417 return E_NOTIMPL;
420 static HRESULT WINAPI HTMLObjectElement_get_vspace(IHTMLObjectElement *iface, LONG *p)
422 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
423 PRInt32 vspace;
424 nsresult nsres;
426 TRACE("(%p)->(%p)\n", This, p);
428 nsres = nsIDOMHTMLObjectElement_GetVspace(This->nsobject, &vspace);
429 if(NS_FAILED(nsres)) {
430 ERR("GetVspace failed: %08x\n", nsres);
431 return E_FAIL;
434 *p = vspace;
435 return S_OK;
438 static HRESULT WINAPI HTMLObjectElement_put_hspace(IHTMLObjectElement *iface, LONG v)
440 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
441 FIXME("(%p)->(%d)\n", This, v);
442 return E_NOTIMPL;
445 static HRESULT WINAPI HTMLObjectElement_get_hspace(IHTMLObjectElement *iface, LONG *p)
447 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
448 FIXME("(%p)->(%p)\n", This, p);
449 return E_NOTIMPL;
452 static const IHTMLObjectElementVtbl HTMLObjectElementVtbl = {
453 HTMLObjectElement_QueryInterface,
454 HTMLObjectElement_AddRef,
455 HTMLObjectElement_Release,
456 HTMLObjectElement_GetTypeInfoCount,
457 HTMLObjectElement_GetTypeInfo,
458 HTMLObjectElement_GetIDsOfNames,
459 HTMLObjectElement_Invoke,
460 HTMLObjectElement_get_object,
461 HTMLObjectElement_get_classid,
462 HTMLObjectElement_get_data,
463 HTMLObjectElement_put_recordset,
464 HTMLObjectElement_get_recordset,
465 HTMLObjectElement_put_align,
466 HTMLObjectElement_get_align,
467 HTMLObjectElement_put_name,
468 HTMLObjectElement_get_name,
469 HTMLObjectElement_put_codeBase,
470 HTMLObjectElement_get_codeBase,
471 HTMLObjectElement_put_codeType,
472 HTMLObjectElement_get_codeType,
473 HTMLObjectElement_put_code,
474 HTMLObjectElement_get_code,
475 HTMLObjectElement_get_BaseHref,
476 HTMLObjectElement_put_type,
477 HTMLObjectElement_get_type,
478 HTMLObjectElement_get_form,
479 HTMLObjectElement_put_width,
480 HTMLObjectElement_get_width,
481 HTMLObjectElement_put_height,
482 HTMLObjectElement_get_height,
483 HTMLObjectElement_get_readyState,
484 HTMLObjectElement_put_onreadystatechange,
485 HTMLObjectElement_get_onreadystatechange,
486 HTMLObjectElement_put_onerror,
487 HTMLObjectElement_get_onerror,
488 HTMLObjectElement_put_altHtml,
489 HTMLObjectElement_get_altHtml,
490 HTMLObjectElement_put_vspace,
491 HTMLObjectElement_get_vspace,
492 HTMLObjectElement_put_hspace,
493 HTMLObjectElement_get_hspace
496 static inline HTMLObjectElement *impl_from_IHTMLObjectElement2(IHTMLObjectElement2 *iface)
498 return CONTAINING_RECORD(iface, HTMLObjectElement, IHTMLObjectElement2_iface);
501 static HRESULT WINAPI HTMLObjectElement2_QueryInterface(IHTMLObjectElement2 *iface,
502 REFIID riid, void **ppv)
504 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
506 return IHTMLDOMNode_QueryInterface(&This->plugin_container.element.node.IHTMLDOMNode_iface,
507 riid, ppv);
510 static ULONG WINAPI HTMLObjectElement2_AddRef(IHTMLObjectElement2 *iface)
512 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
514 return IHTMLDOMNode_AddRef(&This->plugin_container.element.node.IHTMLDOMNode_iface);
517 static ULONG WINAPI HTMLObjectElement2_Release(IHTMLObjectElement2 *iface)
519 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
521 return IHTMLDOMNode_Release(&This->plugin_container.element.node.IHTMLDOMNode_iface);
524 static HRESULT WINAPI HTMLObjectElement2_GetTypeInfoCount(IHTMLObjectElement2 *iface, UINT *pctinfo)
526 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
527 return IDispatchEx_GetTypeInfoCount(&This->plugin_container.element.node.dispex.IDispatchEx_iface,
528 pctinfo);
531 static HRESULT WINAPI HTMLObjectElement2_GetTypeInfo(IHTMLObjectElement2 *iface, UINT iTInfo,
532 LCID lcid, ITypeInfo **ppTInfo)
534 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
535 return IDispatchEx_GetTypeInfo(&This->plugin_container.element.node.dispex.IDispatchEx_iface,
536 iTInfo, lcid, ppTInfo);
539 static HRESULT WINAPI HTMLObjectElement2_GetIDsOfNames(IHTMLObjectElement2 *iface, REFIID riid,
540 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
542 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
543 return IDispatchEx_GetIDsOfNames(&This->plugin_container.element.node.dispex.IDispatchEx_iface,
544 riid, rgszNames, cNames, lcid, rgDispId);
547 static HRESULT WINAPI HTMLObjectElement2_Invoke(IHTMLObjectElement2 *iface, DISPID dispIdMember,
548 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
549 EXCEPINFO *pExcepInfo, UINT *puArgErr)
551 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
552 return IDispatchEx_Invoke(&This->plugin_container.element.node.dispex.IDispatchEx_iface,
553 dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
556 static HRESULT WINAPI HTMLObjectElement2_namedRecordset(IHTMLObjectElement2 *iface, BSTR dataMember,
557 VARIANT *hierarchy, IDispatch **ppRecordset)
559 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
560 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(dataMember), hierarchy, ppRecordset);
561 return E_NOTIMPL;
564 static HRESULT WINAPI HTMLObjectElement2_put_classid(IHTMLObjectElement2 *iface, BSTR v)
566 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
567 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
568 return E_NOTIMPL;
571 static HRESULT WINAPI HTMLObjectElement2_get_classid(IHTMLObjectElement2 *iface, BSTR *p)
573 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
574 FIXME("(%p)->(%p)\n", This, p);
575 return E_NOTIMPL;
578 static HRESULT WINAPI HTMLObjectElement2_put_data(IHTMLObjectElement2 *iface, BSTR v)
580 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
581 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
582 return E_NOTIMPL;
585 static HRESULT WINAPI HTMLObjectElement2_get_data(IHTMLObjectElement2 *iface, BSTR *p)
587 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
588 FIXME("(%p)->(%p)\n", This, p);
589 return E_NOTIMPL;
592 static const IHTMLObjectElement2Vtbl HTMLObjectElement2Vtbl = {
593 HTMLObjectElement2_QueryInterface,
594 HTMLObjectElement2_AddRef,
595 HTMLObjectElement2_Release,
596 HTMLObjectElement2_GetTypeInfoCount,
597 HTMLObjectElement2_GetTypeInfo,
598 HTMLObjectElement2_GetIDsOfNames,
599 HTMLObjectElement2_Invoke,
600 HTMLObjectElement2_namedRecordset,
601 HTMLObjectElement2_put_classid,
602 HTMLObjectElement2_get_classid,
603 HTMLObjectElement2_put_data,
604 HTMLObjectElement2_get_data
607 static inline HTMLObjectElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
609 return CONTAINING_RECORD(iface, HTMLObjectElement, plugin_container.element.node);
612 static HRESULT HTMLObjectElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
614 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
616 if(IsEqualGUID(&IID_IUnknown, riid)) {
617 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
618 *ppv = &This->IHTMLObjectElement_iface;
619 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
620 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
621 *ppv = &This->IHTMLObjectElement_iface;
622 }else if(IsEqualGUID(&IID_IHTMLObjectElement, riid)) {
623 TRACE("(%p)->(IID_IHTMLObjectElement %p)\n", This, ppv);
624 *ppv = &This->IHTMLObjectElement_iface;
625 }else if(IsEqualGUID(&IID_IHTMLObjectElement2, riid)) {
626 TRACE("(%p)->(IID_IHTMLObjectElement2 %p)\n", This, ppv);
627 *ppv = &This->IHTMLObjectElement2_iface;
628 }else if(IsEqualGUID(&IID_HTMLPluginContainer, riid)) {
629 TRACE("(%p)->(IID_HTMLPluginContainer %p)\n", This, ppv);
630 *ppv = &This->plugin_container;
631 return S_OK;
632 }else {
633 HRESULT hres;
635 hres = HTMLElement_QI(&This->plugin_container.element.node, riid, ppv);
636 if(hres == E_NOINTERFACE && This->plugin_container.plugin_host && This->plugin_container.plugin_host->plugin_unk) {
637 IUnknown *plugin_iface, *ret;
639 hres = IUnknown_QueryInterface(This->plugin_container.plugin_host->plugin_unk, riid, (void**)&plugin_iface);
640 if(hres == S_OK) {
641 hres = wrap_iface(plugin_iface, (IUnknown*)&This->IHTMLObjectElement_iface, &ret);
642 IUnknown_Release(plugin_iface);
643 if(FAILED(hres))
644 return hres;
646 TRACE("returning plugin iface %p wrapped to %p\n", plugin_iface, ret);
647 *ppv = ret;
648 return S_OK;
652 return hres;
655 IUnknown_AddRef((IUnknown*)*ppv);
656 return S_OK;
659 static void HTMLObjectElement_destructor(HTMLDOMNode *iface)
661 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
663 if(This->plugin_container.plugin_host)
664 detach_plugin_host(This->plugin_container.plugin_host);
666 HTMLElement_destructor(&This->plugin_container.element.node);
669 static HRESULT HTMLObjectElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
671 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
672 FIXME("(%p)->(%p)\n", This, p);
673 return E_NOTIMPL;
676 static HRESULT HTMLObjectElement_get_dispid(HTMLDOMNode *iface, BSTR name,
677 DWORD grfdex, DISPID *pid)
679 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
681 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(name), grfdex, pid);
683 return get_plugin_dispid(&This->plugin_container, name, pid);
686 static HRESULT HTMLObjectElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid,
687 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
689 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
691 TRACE("(%p)->(%d)\n", This, id);
693 return invoke_plugin_prop(&This->plugin_container, id, lcid, flags, params, res, ei);
696 static const NodeImplVtbl HTMLObjectElementImplVtbl = {
697 HTMLObjectElement_QI,
698 HTMLObjectElement_destructor,
699 HTMLElement_clone,
700 HTMLElement_get_attr_col,
701 NULL,
702 NULL,
703 NULL,
704 NULL,
705 NULL,
706 NULL,
707 HTMLObjectElement_get_readystate,
708 HTMLObjectElement_get_dispid,
709 HTMLObjectElement_invoke
712 static const tid_t HTMLObjectElement_iface_tids[] = {
713 HTMLELEMENT_TIDS,
714 IHTMLObjectElement_tid,
715 IHTMLObjectElement2_tid,
718 static dispex_static_data_t HTMLObjectElement_dispex = {
719 NULL,
720 DispHTMLObjectElement_tid,
721 NULL,
722 HTMLObjectElement_iface_tids
725 HRESULT HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
727 HTMLObjectElement *ret;
728 nsresult nsres;
730 ret = heap_alloc_zero(sizeof(*ret));
731 if(!ret)
732 return E_OUTOFMEMORY;
734 ret->IHTMLObjectElement_iface.lpVtbl = &HTMLObjectElementVtbl;
735 ret->IHTMLObjectElement2_iface.lpVtbl = &HTMLObjectElement2Vtbl;
736 ret->plugin_container.element.node.vtbl = &HTMLObjectElementImplVtbl;
738 HTMLElement_Init(&ret->plugin_container.element, doc, nselem, &HTMLObjectElement_dispex);
740 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLObjectElement, (void**)&ret->nsobject);
742 /* Share nsobject reference with nsnode */
743 assert(nsres == NS_OK && (nsIDOMNode*)ret->nsobject == ret->plugin_container.element.node.nsnode);
744 nsIDOMNode_Release(ret->plugin_container.element.node.nsnode);
746 *elem = &ret->plugin_container.element;
747 return S_OK;