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);
104 FIXME("(%p)->(%p)\n", This, p);
108 static HRESULT WINAPI HTMLObjectElement_get_classid(IHTMLObjectElement *iface, BSTR *p)
110 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
111 FIXME("(%p)->(%p)\n", This, p);
115 static HRESULT WINAPI HTMLObjectElement_get_data(IHTMLObjectElement *iface, BSTR *p)
117 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
118 FIXME("(%p)->(%p)\n", This, p);
122 static HRESULT WINAPI HTMLObjectElement_put_recordset(IHTMLObjectElement *iface, IDispatch *v)
124 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
125 FIXME("(%p)->(%p)\n", This, v);
129 static HRESULT WINAPI HTMLObjectElement_get_recordset(IHTMLObjectElement *iface, IDispatch **p)
131 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
132 FIXME("(%p)->(%p)\n", This, p);
136 static HRESULT WINAPI HTMLObjectElement_put_align(IHTMLObjectElement *iface, BSTR v)
138 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
139 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
143 static HRESULT WINAPI HTMLObjectElement_get_align(IHTMLObjectElement *iface, BSTR *p)
145 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
146 FIXME("(%p)->(%p)\n", This, p);
150 static HRESULT WINAPI HTMLObjectElement_put_name(IHTMLObjectElement *iface, BSTR v)
152 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
153 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
157 static HRESULT WINAPI HTMLObjectElement_get_name(IHTMLObjectElement *iface, BSTR *p)
159 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
160 FIXME("(%p)->(%p)\n", This, p);
164 static HRESULT WINAPI HTMLObjectElement_put_codeBase(IHTMLObjectElement *iface, BSTR v)
166 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
167 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
171 static HRESULT WINAPI HTMLObjectElement_get_codeBase(IHTMLObjectElement *iface, BSTR *p)
173 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
174 FIXME("(%p)->(%p)\n", This, p);
178 static HRESULT WINAPI HTMLObjectElement_put_codeType(IHTMLObjectElement *iface, BSTR v)
180 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
181 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
185 static HRESULT WINAPI HTMLObjectElement_get_codeType(IHTMLObjectElement *iface, BSTR *p)
187 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
188 FIXME("(%p)->(%p)\n", This, p);
192 static HRESULT WINAPI HTMLObjectElement_put_code(IHTMLObjectElement *iface, BSTR v)
194 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
195 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
199 static HRESULT WINAPI HTMLObjectElement_get_code(IHTMLObjectElement *iface, BSTR *p)
201 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
202 FIXME("(%p)->(%p)\n", This, p);
206 static HRESULT WINAPI HTMLObjectElement_get_BaseHref(IHTMLObjectElement *iface, BSTR *p)
208 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
209 FIXME("(%p)->(%p)\n", This, p);
213 static HRESULT WINAPI HTMLObjectElement_put_type(IHTMLObjectElement *iface, BSTR v)
215 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
216 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
220 static HRESULT WINAPI HTMLObjectElement_get_type(IHTMLObjectElement *iface, BSTR *p)
222 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
223 FIXME("(%p)->(%p)\n", This, p);
227 static HRESULT WINAPI HTMLObjectElement_get_form(IHTMLObjectElement *iface, IHTMLFormElement **p)
229 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
230 FIXME("(%p)->(%p)\n", This, p);
234 static HRESULT WINAPI HTMLObjectElement_put_width(IHTMLObjectElement *iface, VARIANT v)
236 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
237 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
241 static HRESULT WINAPI HTMLObjectElement_get_width(IHTMLObjectElement *iface, VARIANT *p)
243 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
244 FIXME("(%p)->(%p)\n", This, p);
248 static HRESULT WINAPI HTMLObjectElement_put_height(IHTMLObjectElement *iface, VARIANT v)
250 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
251 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
255 static HRESULT WINAPI HTMLObjectElement_get_height(IHTMLObjectElement *iface, VARIANT *p)
257 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
258 FIXME("(%p)->(%p)\n", This, p);
262 static HRESULT WINAPI HTMLObjectElement_get_readyState(IHTMLObjectElement *iface, LONG *p)
264 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
265 FIXME("(%p)->(%p)\n", This, p);
269 static HRESULT WINAPI HTMLObjectElement_put_onreadystatechange(IHTMLObjectElement *iface, VARIANT v)
271 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
272 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
276 static HRESULT WINAPI HTMLObjectElement_get_onreadystatechange(IHTMLObjectElement *iface, VARIANT *p)
278 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
279 FIXME("(%p)->(%p)\n", This, p);
283 static HRESULT WINAPI HTMLObjectElement_put_onerror(IHTMLObjectElement *iface, VARIANT v)
285 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
286 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
290 static HRESULT WINAPI HTMLObjectElement_get_onerror(IHTMLObjectElement *iface, VARIANT *p)
292 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
293 FIXME("(%p)->(%p)\n", This, p);
297 static HRESULT WINAPI HTMLObjectElement_put_altHtml(IHTMLObjectElement *iface, BSTR v)
299 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
300 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
304 static HRESULT WINAPI HTMLObjectElement_get_altHtml(IHTMLObjectElement *iface, BSTR *p)
306 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
307 FIXME("(%p)->(%p)\n", This, p);
311 static HRESULT WINAPI HTMLObjectElement_put_vspace(IHTMLObjectElement *iface, LONG v)
313 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
314 FIXME("(%p)->(%d)\n", This, v);
318 static HRESULT WINAPI HTMLObjectElement_get_vspace(IHTMLObjectElement *iface, LONG *p)
320 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
324 TRACE("(%p)->(%p)\n", This, p);
326 nsres = nsIDOMHTMLObjectElement_GetVspace(This->nsobject, &vspace);
327 if(NS_FAILED(nsres)) {
328 ERR("GetVspace failed: %08x\n", nsres);
336 static HRESULT WINAPI HTMLObjectElement_put_hspace(IHTMLObjectElement *iface, LONG v)
338 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
339 FIXME("(%p)->(%d)\n", This, v);
343 static HRESULT WINAPI HTMLObjectElement_get_hspace(IHTMLObjectElement *iface, LONG *p)
345 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
346 FIXME("(%p)->(%p)\n", This, p);
350 static const IHTMLObjectElementVtbl HTMLObjectElementVtbl = {
351 HTMLObjectElement_QueryInterface,
352 HTMLObjectElement_AddRef,
353 HTMLObjectElement_Release,
354 HTMLObjectElement_GetTypeInfoCount,
355 HTMLObjectElement_GetTypeInfo,
356 HTMLObjectElement_GetIDsOfNames,
357 HTMLObjectElement_Invoke,
358 HTMLObjectElement_get_object,
359 HTMLObjectElement_get_classid,
360 HTMLObjectElement_get_data,
361 HTMLObjectElement_put_recordset,
362 HTMLObjectElement_get_recordset,
363 HTMLObjectElement_put_align,
364 HTMLObjectElement_get_align,
365 HTMLObjectElement_put_name,
366 HTMLObjectElement_get_name,
367 HTMLObjectElement_put_codeBase,
368 HTMLObjectElement_get_codeBase,
369 HTMLObjectElement_put_codeType,
370 HTMLObjectElement_get_codeType,
371 HTMLObjectElement_put_code,
372 HTMLObjectElement_get_code,
373 HTMLObjectElement_get_BaseHref,
374 HTMLObjectElement_put_type,
375 HTMLObjectElement_get_type,
376 HTMLObjectElement_get_form,
377 HTMLObjectElement_put_width,
378 HTMLObjectElement_get_width,
379 HTMLObjectElement_put_height,
380 HTMLObjectElement_get_height,
381 HTMLObjectElement_get_readyState,
382 HTMLObjectElement_put_onreadystatechange,
383 HTMLObjectElement_get_onreadystatechange,
384 HTMLObjectElement_put_onerror,
385 HTMLObjectElement_get_onerror,
386 HTMLObjectElement_put_altHtml,
387 HTMLObjectElement_get_altHtml,
388 HTMLObjectElement_put_vspace,
389 HTMLObjectElement_get_vspace,
390 HTMLObjectElement_put_hspace,
391 HTMLObjectElement_get_hspace
394 #define HTMLOBJECT_NODE_THIS(iface) DEFINE_THIS2(HTMLObjectElement, plugin_container.element.node, iface)
396 static HRESULT HTMLObjectElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
398 HTMLObjectElement *This = HTMLOBJECT_NODE_THIS(iface);
400 if(IsEqualGUID(&IID_IUnknown, riid)) {
401 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
402 *ppv = &This->IHTMLObjectElement_iface;
403 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
404 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
405 *ppv = &This->IHTMLObjectElement_iface;
406 }else if(IsEqualGUID(&IID_IHTMLObjectElement, riid)) {
407 TRACE("(%p)->(IID_IHTMLObjectElement %p)\n", This, ppv);
408 *ppv = &This->IHTMLObjectElement_iface;
409 }else if(IsEqualGUID(&IID_HTMLPluginContainer, riid)) {
410 TRACE("(%p)->(IID_HTMLPluginContainer %p)\n", This, ppv);
411 *ppv = &This->plugin_container;
414 return HTMLElement_QI(&This->plugin_container.element.node, riid, ppv);
417 IUnknown_AddRef((IUnknown*)*ppv);
421 static void HTMLObjectElement_destructor(HTMLDOMNode *iface)
423 HTMLObjectElement *This = HTMLOBJECT_NODE_THIS(iface);
425 if(This->plugin_container.plugin_host)
426 detach_plugin_host(This->plugin_container.plugin_host);
428 nsIDOMHTMLObjectElement_Release(This->nsobject);
430 HTMLElement_destructor(&This->plugin_container.element.node);
433 static HRESULT HTMLObjectElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
435 HTMLObjectElement *This = HTMLOBJECT_NODE_THIS(iface);
436 FIXME("(%p)->(%p)\n", This, p);
440 #undef HTMLOBJECT_NODE_THIS
442 static const NodeImplVtbl HTMLObjectElementImplVtbl = {
443 HTMLObjectElement_QI,
444 HTMLObjectElement_destructor,
451 HTMLObjectElement_get_readystate
454 static const tid_t HTMLObjectElement_iface_tids[] = {
456 IHTMLObjectElement_tid,
459 static dispex_static_data_t HTMLObjectElement_dispex = {
461 DispHTMLObjectElement_tid,
463 HTMLObjectElement_iface_tids
466 HRESULT HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
468 HTMLObjectElement *ret;
471 ret = heap_alloc_zero(sizeof(*ret));
473 return E_OUTOFMEMORY;
475 ret->IHTMLObjectElement_iface.lpVtbl = &HTMLObjectElementVtbl;
476 ret->plugin_container.element.node.vtbl = &HTMLObjectElementImplVtbl;
478 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLObjectElement, (void**)&ret->nsobject);
479 if(NS_FAILED(nsres)) {
480 ERR("Could not get nsIDOMHTMLObjectElement iface: %08x\n", nsres);
485 HTMLElement_Init(&ret->plugin_container.element, doc, nselem, &HTMLObjectElement_dispex);
487 *elem = &ret->plugin_container.element;