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(&This
->plugin_container
.element
.node
.IHTMLDOMNode_iface
,
58 static ULONG WINAPI
HTMLObjectElement_AddRef(IHTMLObjectElement
*iface
)
60 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
62 return IHTMLDOMNode_AddRef(&This
->plugin_container
.element
.node
.IHTMLDOMNode_iface
);
65 static ULONG WINAPI
HTMLObjectElement_Release(IHTMLObjectElement
*iface
)
67 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
69 return IHTMLDOMNode_Release(&This
->plugin_container
.element
.node
.IHTMLDOMNode_iface
);
72 static HRESULT WINAPI
HTMLObjectElement_GetTypeInfoCount(IHTMLObjectElement
*iface
, UINT
*pctinfo
)
74 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
75 return IDispatchEx_GetTypeInfoCount(&This
->plugin_container
.element
.node
.dispex
.IDispatchEx_iface
,
79 static HRESULT WINAPI
HTMLObjectElement_GetTypeInfo(IHTMLObjectElement
*iface
, UINT iTInfo
,
80 LCID lcid
, ITypeInfo
**ppTInfo
)
82 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
83 return IDispatchEx_GetTypeInfo(&This
->plugin_container
.element
.node
.dispex
.IDispatchEx_iface
,
84 iTInfo
, lcid
, ppTInfo
);
87 static HRESULT WINAPI
HTMLObjectElement_GetIDsOfNames(IHTMLObjectElement
*iface
, REFIID riid
,
88 LPOLESTR
*rgszNames
, UINT cNames
,
89 LCID lcid
, DISPID
*rgDispId
)
91 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
92 return IDispatchEx_GetIDsOfNames(&This
->plugin_container
.element
.node
.dispex
.IDispatchEx_iface
,
93 riid
, rgszNames
, cNames
, lcid
, rgDispId
);
96 static HRESULT WINAPI
HTMLObjectElement_Invoke(IHTMLObjectElement
*iface
, DISPID dispIdMember
,
97 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
98 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
100 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
101 return IDispatchEx_Invoke(&This
->plugin_container
.element
.node
.dispex
.IDispatchEx_iface
,
102 dispIdMember
, riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
105 static HRESULT WINAPI
HTMLObjectElement_get_object(IHTMLObjectElement
*iface
, IDispatch
**p
)
107 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
109 TRACE("(%p)->(%p)\n", This
, p
);
111 return get_plugin_disp(&This
->plugin_container
, p
);
114 static HRESULT WINAPI
HTMLObjectElement_get_classid(IHTMLObjectElement
*iface
, BSTR
*p
)
116 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
117 FIXME("(%p)->(%p)\n", This
, p
);
121 static HRESULT WINAPI
HTMLObjectElement_get_data(IHTMLObjectElement
*iface
, BSTR
*p
)
123 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
124 FIXME("(%p)->(%p)\n", This
, p
);
128 static HRESULT WINAPI
HTMLObjectElement_put_recordset(IHTMLObjectElement
*iface
, IDispatch
*v
)
130 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
131 FIXME("(%p)->(%p)\n", This
, v
);
135 static HRESULT WINAPI
HTMLObjectElement_get_recordset(IHTMLObjectElement
*iface
, IDispatch
**p
)
137 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
138 FIXME("(%p)->(%p)\n", This
, p
);
142 static HRESULT WINAPI
HTMLObjectElement_put_align(IHTMLObjectElement
*iface
, BSTR v
)
144 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
145 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
149 static HRESULT WINAPI
HTMLObjectElement_get_align(IHTMLObjectElement
*iface
, BSTR
*p
)
151 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
152 FIXME("(%p)->(%p)\n", This
, p
);
156 static HRESULT WINAPI
HTMLObjectElement_put_name(IHTMLObjectElement
*iface
, BSTR v
)
158 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
159 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
163 static HRESULT WINAPI
HTMLObjectElement_get_name(IHTMLObjectElement
*iface
, BSTR
*p
)
165 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
166 FIXME("(%p)->(%p)\n", This
, p
);
170 static HRESULT WINAPI
HTMLObjectElement_put_codeBase(IHTMLObjectElement
*iface
, BSTR v
)
172 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
173 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
177 static HRESULT WINAPI
HTMLObjectElement_get_codeBase(IHTMLObjectElement
*iface
, BSTR
*p
)
179 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
180 FIXME("(%p)->(%p)\n", This
, p
);
184 static HRESULT WINAPI
HTMLObjectElement_put_codeType(IHTMLObjectElement
*iface
, BSTR v
)
186 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
187 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
191 static HRESULT WINAPI
HTMLObjectElement_get_codeType(IHTMLObjectElement
*iface
, BSTR
*p
)
193 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
194 FIXME("(%p)->(%p)\n", This
, p
);
198 static HRESULT WINAPI
HTMLObjectElement_put_code(IHTMLObjectElement
*iface
, BSTR v
)
200 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
201 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
205 static HRESULT WINAPI
HTMLObjectElement_get_code(IHTMLObjectElement
*iface
, BSTR
*p
)
207 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
208 FIXME("(%p)->(%p)\n", This
, p
);
212 static HRESULT WINAPI
HTMLObjectElement_get_BaseHref(IHTMLObjectElement
*iface
, BSTR
*p
)
214 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
215 FIXME("(%p)->(%p)\n", This
, p
);
219 static HRESULT WINAPI
HTMLObjectElement_put_type(IHTMLObjectElement
*iface
, BSTR v
)
221 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
222 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
226 static HRESULT WINAPI
HTMLObjectElement_get_type(IHTMLObjectElement
*iface
, BSTR
*p
)
228 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
229 FIXME("(%p)->(%p)\n", This
, p
);
233 static HRESULT WINAPI
HTMLObjectElement_get_form(IHTMLObjectElement
*iface
, IHTMLFormElement
**p
)
235 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
236 FIXME("(%p)->(%p)\n", This
, p
);
240 static HRESULT WINAPI
HTMLObjectElement_put_width(IHTMLObjectElement
*iface
, VARIANT v
)
242 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
243 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
247 static HRESULT WINAPI
HTMLObjectElement_get_width(IHTMLObjectElement
*iface
, VARIANT
*p
)
249 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
250 FIXME("(%p)->(%p)\n", This
, p
);
254 static HRESULT WINAPI
HTMLObjectElement_put_height(IHTMLObjectElement
*iface
, VARIANT v
)
256 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
257 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
261 static HRESULT WINAPI
HTMLObjectElement_get_height(IHTMLObjectElement
*iface
, VARIANT
*p
)
263 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
264 FIXME("(%p)->(%p)\n", This
, p
);
268 static HRESULT WINAPI
HTMLObjectElement_get_readyState(IHTMLObjectElement
*iface
, LONG
*p
)
270 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
271 FIXME("(%p)->(%p)\n", This
, p
);
275 static HRESULT WINAPI
HTMLObjectElement_put_onreadystatechange(IHTMLObjectElement
*iface
, VARIANT v
)
277 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
278 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
282 static HRESULT WINAPI
HTMLObjectElement_get_onreadystatechange(IHTMLObjectElement
*iface
, VARIANT
*p
)
284 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
285 FIXME("(%p)->(%p)\n", This
, p
);
289 static HRESULT WINAPI
HTMLObjectElement_put_onerror(IHTMLObjectElement
*iface
, VARIANT v
)
291 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
292 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
296 static HRESULT WINAPI
HTMLObjectElement_get_onerror(IHTMLObjectElement
*iface
, VARIANT
*p
)
298 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
299 FIXME("(%p)->(%p)\n", This
, p
);
303 static HRESULT WINAPI
HTMLObjectElement_put_altHtml(IHTMLObjectElement
*iface
, BSTR v
)
305 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
306 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
310 static HRESULT WINAPI
HTMLObjectElement_get_altHtml(IHTMLObjectElement
*iface
, BSTR
*p
)
312 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
313 FIXME("(%p)->(%p)\n", This
, p
);
317 static HRESULT WINAPI
HTMLObjectElement_put_vspace(IHTMLObjectElement
*iface
, LONG v
)
319 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
320 FIXME("(%p)->(%d)\n", This
, v
);
324 static HRESULT WINAPI
HTMLObjectElement_get_vspace(IHTMLObjectElement
*iface
, LONG
*p
)
326 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
330 TRACE("(%p)->(%p)\n", This
, p
);
332 nsres
= nsIDOMHTMLObjectElement_GetVspace(This
->nsobject
, &vspace
);
333 if(NS_FAILED(nsres
)) {
334 ERR("GetVspace failed: %08x\n", nsres
);
342 static HRESULT WINAPI
HTMLObjectElement_put_hspace(IHTMLObjectElement
*iface
, LONG v
)
344 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
345 FIXME("(%p)->(%d)\n", This
, v
);
349 static HRESULT WINAPI
HTMLObjectElement_get_hspace(IHTMLObjectElement
*iface
, LONG
*p
)
351 HTMLObjectElement
*This
= impl_from_IHTMLObjectElement(iface
);
352 FIXME("(%p)->(%p)\n", This
, p
);
356 static const IHTMLObjectElementVtbl HTMLObjectElementVtbl
= {
357 HTMLObjectElement_QueryInterface
,
358 HTMLObjectElement_AddRef
,
359 HTMLObjectElement_Release
,
360 HTMLObjectElement_GetTypeInfoCount
,
361 HTMLObjectElement_GetTypeInfo
,
362 HTMLObjectElement_GetIDsOfNames
,
363 HTMLObjectElement_Invoke
,
364 HTMLObjectElement_get_object
,
365 HTMLObjectElement_get_classid
,
366 HTMLObjectElement_get_data
,
367 HTMLObjectElement_put_recordset
,
368 HTMLObjectElement_get_recordset
,
369 HTMLObjectElement_put_align
,
370 HTMLObjectElement_get_align
,
371 HTMLObjectElement_put_name
,
372 HTMLObjectElement_get_name
,
373 HTMLObjectElement_put_codeBase
,
374 HTMLObjectElement_get_codeBase
,
375 HTMLObjectElement_put_codeType
,
376 HTMLObjectElement_get_codeType
,
377 HTMLObjectElement_put_code
,
378 HTMLObjectElement_get_code
,
379 HTMLObjectElement_get_BaseHref
,
380 HTMLObjectElement_put_type
,
381 HTMLObjectElement_get_type
,
382 HTMLObjectElement_get_form
,
383 HTMLObjectElement_put_width
,
384 HTMLObjectElement_get_width
,
385 HTMLObjectElement_put_height
,
386 HTMLObjectElement_get_height
,
387 HTMLObjectElement_get_readyState
,
388 HTMLObjectElement_put_onreadystatechange
,
389 HTMLObjectElement_get_onreadystatechange
,
390 HTMLObjectElement_put_onerror
,
391 HTMLObjectElement_get_onerror
,
392 HTMLObjectElement_put_altHtml
,
393 HTMLObjectElement_get_altHtml
,
394 HTMLObjectElement_put_vspace
,
395 HTMLObjectElement_get_vspace
,
396 HTMLObjectElement_put_hspace
,
397 HTMLObjectElement_get_hspace
400 static inline HTMLObjectElement
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
402 return CONTAINING_RECORD(iface
, HTMLObjectElement
, plugin_container
.element
.node
);
405 static HRESULT
HTMLObjectElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
407 HTMLObjectElement
*This
= impl_from_HTMLDOMNode(iface
);
409 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
410 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
411 *ppv
= &This
->IHTMLObjectElement_iface
;
412 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
413 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
414 *ppv
= &This
->IHTMLObjectElement_iface
;
415 }else if(IsEqualGUID(&IID_IHTMLObjectElement
, riid
)) {
416 TRACE("(%p)->(IID_IHTMLObjectElement %p)\n", This
, ppv
);
417 *ppv
= &This
->IHTMLObjectElement_iface
;
418 }else if(IsEqualGUID(&IID_HTMLPluginContainer
, riid
)) {
419 TRACE("(%p)->(IID_HTMLPluginContainer %p)\n", This
, ppv
);
420 *ppv
= &This
->plugin_container
;
425 hres
= HTMLElement_QI(&This
->plugin_container
.element
.node
, riid
, ppv
);
426 if(hres
== E_NOINTERFACE
&& This
->plugin_container
.plugin_host
&& This
->plugin_container
.plugin_host
->plugin_unk
) {
427 IUnknown
*plugin_iface
, *ret
;
429 hres
= IUnknown_QueryInterface(This
->plugin_container
.plugin_host
->plugin_unk
, riid
, (void**)&plugin_iface
);
431 hres
= wrap_iface(plugin_iface
, (IUnknown
*)&This
->IHTMLObjectElement_iface
, &ret
);
432 IUnknown_Release(plugin_iface
);
436 TRACE("returning plugin iface %p wrapped to %p\n", plugin_iface
, ret
);
445 IUnknown_AddRef((IUnknown
*)*ppv
);
449 static void HTMLObjectElement_destructor(HTMLDOMNode
*iface
)
451 HTMLObjectElement
*This
= impl_from_HTMLDOMNode(iface
);
453 if(This
->plugin_container
.plugin_host
)
454 detach_plugin_host(This
->plugin_container
.plugin_host
);
456 nsIDOMHTMLObjectElement_Release(This
->nsobject
);
458 HTMLElement_destructor(&This
->plugin_container
.element
.node
);
461 static HRESULT
HTMLObjectElement_get_readystate(HTMLDOMNode
*iface
, BSTR
*p
)
463 HTMLObjectElement
*This
= impl_from_HTMLDOMNode(iface
);
464 FIXME("(%p)->(%p)\n", This
, p
);
468 static HRESULT
HTMLObjectElement_get_dispid(HTMLDOMNode
*iface
, BSTR name
,
469 DWORD grfdex
, DISPID
*pid
)
471 HTMLObjectElement
*This
= impl_from_HTMLDOMNode(iface
);
473 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(name
), grfdex
, pid
);
475 return get_plugin_dispid(&This
->plugin_container
, name
, pid
);
478 static HRESULT
HTMLObjectElement_invoke(HTMLDOMNode
*iface
, DISPID id
, LCID lcid
,
479 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
481 HTMLObjectElement
*This
= impl_from_HTMLDOMNode(iface
);
483 TRACE("(%p)->(%d)\n", This
, id
);
485 return invoke_plugin_prop(&This
->plugin_container
, id
, lcid
, flags
, params
, res
, ei
);
488 static const NodeImplVtbl HTMLObjectElementImplVtbl
= {
489 HTMLObjectElement_QI
,
490 HTMLObjectElement_destructor
,
492 HTMLElement_get_attr_col
,
499 HTMLObjectElement_get_readystate
,
500 HTMLObjectElement_get_dispid
,
501 HTMLObjectElement_invoke
504 static const tid_t HTMLObjectElement_iface_tids
[] = {
506 IHTMLObjectElement_tid
,
509 static dispex_static_data_t HTMLObjectElement_dispex
= {
511 DispHTMLObjectElement_tid
,
513 HTMLObjectElement_iface_tids
516 HRESULT
HTMLObjectElement_Create(HTMLDocumentNode
*doc
, nsIDOMHTMLElement
*nselem
, HTMLElement
**elem
)
518 HTMLObjectElement
*ret
;
521 ret
= heap_alloc_zero(sizeof(*ret
));
523 return E_OUTOFMEMORY
;
525 ret
->IHTMLObjectElement_iface
.lpVtbl
= &HTMLObjectElementVtbl
;
526 ret
->plugin_container
.element
.node
.vtbl
= &HTMLObjectElementImplVtbl
;
528 nsres
= nsIDOMHTMLElement_QueryInterface(nselem
, &IID_nsIDOMHTMLObjectElement
, (void**)&ret
->nsobject
);
529 if(NS_FAILED(nsres
)) {
530 ERR("Could not get nsIDOMHTMLObjectElement iface: %08x\n", nsres
);
535 HTMLElement_Init(&ret
->plugin_container
.element
, doc
, nselem
, &HTMLObjectElement_dispex
);
537 *elem
= &ret
->plugin_container
.element
;