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
29 #include "wine/debug.h"
31 #include "mshtml_private.h"
32 #include "pluginhost.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
37 HTMLPluginContainer plugin_container;
39 IHTMLObjectElement IHTMLObjectElement_iface;
41 nsIDOMHTMLObjectElement *nsobject;
44 static inline HTMLObjectElement *impl_from_IHTMLObjectElement(IHTMLObjectElement *iface)
46 return CONTAINING_RECORD(iface, HTMLObjectElement, IHTMLObjectElement_iface);
49 static HRESULT WINAPI HTMLObjectElement_QueryInterface(IHTMLObjectElement *iface,
50 REFIID riid, void **ppv)
52 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
54 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->plugin_container.element.node), riid, ppv);
57 static ULONG WINAPI HTMLObjectElement_AddRef(IHTMLObjectElement *iface)
59 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
61 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->plugin_container.element.node));
64 static ULONG WINAPI HTMLObjectElement_Release(IHTMLObjectElement *iface)
66 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
68 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->plugin_container.element.node));
71 static HRESULT WINAPI HTMLObjectElement_GetTypeInfoCount(IHTMLObjectElement *iface, UINT *pctinfo)
73 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
74 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->plugin_container.element.node.dispex), pctinfo);
77 static HRESULT WINAPI HTMLObjectElement_GetTypeInfo(IHTMLObjectElement *iface, UINT iTInfo,
78 LCID lcid, ITypeInfo **ppTInfo)
80 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
81 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->plugin_container.element.node.dispex), iTInfo, lcid, ppTInfo);
84 static HRESULT WINAPI HTMLObjectElement_GetIDsOfNames(IHTMLObjectElement *iface, REFIID riid,
85 LPOLESTR *rgszNames, UINT cNames,
86 LCID lcid, DISPID *rgDispId)
88 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
89 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->plugin_container.element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
92 static HRESULT WINAPI HTMLObjectElement_Invoke(IHTMLObjectElement *iface, DISPID dispIdMember,
93 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
94 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
96 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
97 return IDispatchEx_Invoke(DISPATCHEX(&This->plugin_container.element.node.dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
98 pVarResult, pExcepInfo, puArgErr);
101 static HRESULT WINAPI HTMLObjectElement_get_object(IHTMLObjectElement *iface, IDispatch **p)
103 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
105 TRACE("(%p)->(%p)\n", This, p);
107 return get_plugin_disp(&This->plugin_container, p);
110 static HRESULT WINAPI HTMLObjectElement_get_classid(IHTMLObjectElement *iface, BSTR *p)
112 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
113 FIXME("(%p)->(%p)\n", This, p);
117 static HRESULT WINAPI HTMLObjectElement_get_data(IHTMLObjectElement *iface, BSTR *p)
119 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
120 FIXME("(%p)->(%p)\n", This, p);
124 static HRESULT WINAPI HTMLObjectElement_put_recordset(IHTMLObjectElement *iface, IDispatch *v)
126 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
127 FIXME("(%p)->(%p)\n", This, v);
131 static HRESULT WINAPI HTMLObjectElement_get_recordset(IHTMLObjectElement *iface, IDispatch **p)
133 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
134 FIXME("(%p)->(%p)\n", This, p);
138 static HRESULT WINAPI HTMLObjectElement_put_align(IHTMLObjectElement *iface, BSTR v)
140 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
141 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
145 static HRESULT WINAPI HTMLObjectElement_get_align(IHTMLObjectElement *iface, BSTR *p)
147 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
148 FIXME("(%p)->(%p)\n", This, p);
152 static HRESULT WINAPI HTMLObjectElement_put_name(IHTMLObjectElement *iface, BSTR v)
154 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
155 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
159 static HRESULT WINAPI HTMLObjectElement_get_name(IHTMLObjectElement *iface, BSTR *p)
161 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
162 FIXME("(%p)->(%p)\n", This, p);
166 static HRESULT WINAPI HTMLObjectElement_put_codeBase(IHTMLObjectElement *iface, BSTR v)
168 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
169 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
173 static HRESULT WINAPI HTMLObjectElement_get_codeBase(IHTMLObjectElement *iface, BSTR *p)
175 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
176 FIXME("(%p)->(%p)\n", This, p);
180 static HRESULT WINAPI HTMLObjectElement_put_codeType(IHTMLObjectElement *iface, BSTR v)
182 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
183 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
187 static HRESULT WINAPI HTMLObjectElement_get_codeType(IHTMLObjectElement *iface, BSTR *p)
189 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
190 FIXME("(%p)->(%p)\n", This, p);
194 static HRESULT WINAPI HTMLObjectElement_put_code(IHTMLObjectElement *iface, BSTR v)
196 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
197 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
201 static HRESULT WINAPI HTMLObjectElement_get_code(IHTMLObjectElement *iface, BSTR *p)
203 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
204 FIXME("(%p)->(%p)\n", This, p);
208 static HRESULT WINAPI HTMLObjectElement_get_BaseHref(IHTMLObjectElement *iface, BSTR *p)
210 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
211 FIXME("(%p)->(%p)\n", This, p);
215 static HRESULT WINAPI HTMLObjectElement_put_type(IHTMLObjectElement *iface, BSTR v)
217 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
218 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
222 static HRESULT WINAPI HTMLObjectElement_get_type(IHTMLObjectElement *iface, BSTR *p)
224 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
225 FIXME("(%p)->(%p)\n", This, p);
229 static HRESULT WINAPI HTMLObjectElement_get_form(IHTMLObjectElement *iface, IHTMLFormElement **p)
231 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
232 FIXME("(%p)->(%p)\n", This, p);
236 static HRESULT WINAPI HTMLObjectElement_put_width(IHTMLObjectElement *iface, VARIANT v)
238 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
239 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
243 static HRESULT WINAPI HTMLObjectElement_get_width(IHTMLObjectElement *iface, VARIANT *p)
245 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
246 FIXME("(%p)->(%p)\n", This, p);
250 static HRESULT WINAPI HTMLObjectElement_put_height(IHTMLObjectElement *iface, VARIANT v)
252 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
253 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
257 static HRESULT WINAPI HTMLObjectElement_get_height(IHTMLObjectElement *iface, VARIANT *p)
259 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
260 FIXME("(%p)->(%p)\n", This, p);
264 static HRESULT WINAPI HTMLObjectElement_get_readyState(IHTMLObjectElement *iface, LONG *p)
266 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
267 FIXME("(%p)->(%p)\n", This, p);
271 static HRESULT WINAPI HTMLObjectElement_put_onreadystatechange(IHTMLObjectElement *iface, VARIANT v)
273 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
274 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
278 static HRESULT WINAPI HTMLObjectElement_get_onreadystatechange(IHTMLObjectElement *iface, VARIANT *p)
280 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
281 FIXME("(%p)->(%p)\n", This, p);
285 static HRESULT WINAPI HTMLObjectElement_put_onerror(IHTMLObjectElement *iface, VARIANT v)
287 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
288 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
292 static HRESULT WINAPI HTMLObjectElement_get_onerror(IHTMLObjectElement *iface, VARIANT *p)
294 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
295 FIXME("(%p)->(%p)\n", This, p);
299 static HRESULT WINAPI HTMLObjectElement_put_altHtml(IHTMLObjectElement *iface, BSTR v)
301 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
302 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
306 static HRESULT WINAPI HTMLObjectElement_get_altHtml(IHTMLObjectElement *iface, BSTR *p)
308 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
309 FIXME("(%p)->(%p)\n", This, p);
313 static HRESULT WINAPI HTMLObjectElement_put_vspace(IHTMLObjectElement *iface, LONG v)
315 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
316 FIXME("(%p)->(%d)\n", This, v);
320 static HRESULT WINAPI HTMLObjectElement_get_vspace(IHTMLObjectElement *iface, LONG *p)
322 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
326 TRACE("(%p)->(%p)\n", This, p);
328 nsres = nsIDOMHTMLObjectElement_GetVspace(This->nsobject, &vspace);
329 if(NS_FAILED(nsres)) {
330 ERR("GetVspace failed: %08x\n", nsres);
338 static HRESULT WINAPI HTMLObjectElement_put_hspace(IHTMLObjectElement *iface, LONG v)
340 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
341 FIXME("(%p)->(%d)\n", This, v);
345 static HRESULT WINAPI HTMLObjectElement_get_hspace(IHTMLObjectElement *iface, LONG *p)
347 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
348 FIXME("(%p)->(%p)\n", This, p);
352 static const IHTMLObjectElementVtbl HTMLObjectElementVtbl = {
353 HTMLObjectElement_QueryInterface,
354 HTMLObjectElement_AddRef,
355 HTMLObjectElement_Release,
356 HTMLObjectElement_GetTypeInfoCount,
357 HTMLObjectElement_GetTypeInfo,
358 HTMLObjectElement_GetIDsOfNames,
359 HTMLObjectElement_Invoke,
360 HTMLObjectElement_get_object,
361 HTMLObjectElement_get_classid,
362 HTMLObjectElement_get_data,
363 HTMLObjectElement_put_recordset,
364 HTMLObjectElement_get_recordset,
365 HTMLObjectElement_put_align,
366 HTMLObjectElement_get_align,
367 HTMLObjectElement_put_name,
368 HTMLObjectElement_get_name,
369 HTMLObjectElement_put_codeBase,
370 HTMLObjectElement_get_codeBase,
371 HTMLObjectElement_put_codeType,
372 HTMLObjectElement_get_codeType,
373 HTMLObjectElement_put_code,
374 HTMLObjectElement_get_code,
375 HTMLObjectElement_get_BaseHref,
376 HTMLObjectElement_put_type,
377 HTMLObjectElement_get_type,
378 HTMLObjectElement_get_form,
379 HTMLObjectElement_put_width,
380 HTMLObjectElement_get_width,
381 HTMLObjectElement_put_height,
382 HTMLObjectElement_get_height,
383 HTMLObjectElement_get_readyState,
384 HTMLObjectElement_put_onreadystatechange,
385 HTMLObjectElement_get_onreadystatechange,
386 HTMLObjectElement_put_onerror,
387 HTMLObjectElement_get_onerror,
388 HTMLObjectElement_put_altHtml,
389 HTMLObjectElement_get_altHtml,
390 HTMLObjectElement_put_vspace,
391 HTMLObjectElement_get_vspace,
392 HTMLObjectElement_put_hspace,
393 HTMLObjectElement_get_hspace
396 #define HTMLOBJECT_NODE_THIS(iface) DEFINE_THIS2(HTMLObjectElement, plugin_container.element.node, iface)
398 static HRESULT HTMLObjectElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
400 HTMLObjectElement *This = HTMLOBJECT_NODE_THIS(iface);
402 if(IsEqualGUID(&IID_IUnknown, riid)) {
403 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
404 *ppv = &This->IHTMLObjectElement_iface;
405 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
406 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
407 *ppv = &This->IHTMLObjectElement_iface;
408 }else if(IsEqualGUID(&IID_IHTMLObjectElement, riid)) {
409 TRACE("(%p)->(IID_IHTMLObjectElement %p)\n", This, ppv);
410 *ppv = &This->IHTMLObjectElement_iface;
411 }else if(IsEqualGUID(&IID_HTMLPluginContainer, riid)) {
412 TRACE("(%p)->(IID_HTMLPluginContainer %p)\n", This, ppv);
413 *ppv = &This->plugin_container;
416 return HTMLElement_QI(&This->plugin_container.element.node, riid, ppv);
419 IUnknown_AddRef((IUnknown*)*ppv);
423 static void HTMLObjectElement_destructor(HTMLDOMNode *iface)
425 HTMLObjectElement *This = HTMLOBJECT_NODE_THIS(iface);
427 if(This->plugin_container.plugin_host)
428 detach_plugin_host(This->plugin_container.plugin_host);
430 nsIDOMHTMLObjectElement_Release(This->nsobject);
432 HTMLElement_destructor(&This->plugin_container.element.node);
435 static HRESULT HTMLObjectElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
437 HTMLObjectElement *This = HTMLOBJECT_NODE_THIS(iface);
438 FIXME("(%p)->(%p)\n", This, p);
442 static HRESULT HTMLObjectElement_get_dispid(HTMLDOMNode *iface, BSTR name,
443 DWORD grfdex, DISPID *pid)
445 HTMLObjectElement *This = HTMLOBJECT_NODE_THIS(iface);
447 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(name), grfdex, pid);
449 return get_plugin_dispid(&This->plugin_container, name, pid);
452 static HRESULT HTMLObjectElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid,
453 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
455 HTMLObjectElement *This = HTMLOBJECT_NODE_THIS(iface);
457 TRACE("(%p)->(%d)\n", This, id);
459 return invoke_plugin_prop(&This->plugin_container, id, lcid, flags, params, res, ei);
462 #undef HTMLOBJECT_NODE_THIS
464 static const NodeImplVtbl HTMLObjectElementImplVtbl = {
465 HTMLObjectElement_QI,
466 HTMLObjectElement_destructor,
473 HTMLObjectElement_get_readystate,
474 HTMLObjectElement_get_dispid,
475 HTMLObjectElement_invoke
478 static const tid_t HTMLObjectElement_iface_tids[] = {
480 IHTMLObjectElement_tid,
483 static dispex_static_data_t HTMLObjectElement_dispex = {
485 DispHTMLObjectElement_tid,
487 HTMLObjectElement_iface_tids
490 HRESULT HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
492 HTMLObjectElement *ret;
495 ret = heap_alloc_zero(sizeof(*ret));
497 return E_OUTOFMEMORY;
499 ret->IHTMLObjectElement_iface.lpVtbl = &HTMLObjectElementVtbl;
500 ret->plugin_container.element.node.vtbl = &HTMLObjectElementImplVtbl;
502 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLObjectElement, (void**)&ret->nsobject);
503 if(NS_FAILED(nsres)) {
504 ERR("Could not get nsIDOMHTMLObjectElement iface: %08x\n", nsres);
509 HTMLElement_Init(&ret->plugin_container.element, doc, nselem, &HTMLObjectElement_dispex);
511 *elem = &ret->plugin_container.element;