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(DISPATCHEX(&This->plugin_container.element.node.dispex), pctinfo);
78 static HRESULT WINAPI HTMLObjectElement_GetTypeInfo(IHTMLObjectElement *iface, UINT iTInfo,
79 LCID lcid, ITypeInfo **ppTInfo)
81 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
82 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->plugin_container.element.node.dispex), iTInfo, lcid, ppTInfo);
85 static HRESULT WINAPI HTMLObjectElement_GetIDsOfNames(IHTMLObjectElement *iface, REFIID riid,
86 LPOLESTR *rgszNames, UINT cNames,
87 LCID lcid, DISPID *rgDispId)
89 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
90 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->plugin_container.element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
93 static HRESULT WINAPI HTMLObjectElement_Invoke(IHTMLObjectElement *iface, DISPID dispIdMember,
94 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
95 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
97 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
98 return IDispatchEx_Invoke(DISPATCHEX(&This->plugin_container.element.node.dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
99 pVarResult, pExcepInfo, puArgErr);
102 static HRESULT WINAPI HTMLObjectElement_get_object(IHTMLObjectElement *iface, IDispatch **p)
104 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
106 TRACE("(%p)->(%p)\n", This, p);
108 return get_plugin_disp(&This->plugin_container, p);
111 static HRESULT WINAPI HTMLObjectElement_get_classid(IHTMLObjectElement *iface, BSTR *p)
113 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
114 FIXME("(%p)->(%p)\n", This, p);
118 static HRESULT WINAPI HTMLObjectElement_get_data(IHTMLObjectElement *iface, BSTR *p)
120 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
121 FIXME("(%p)->(%p)\n", This, p);
125 static HRESULT WINAPI HTMLObjectElement_put_recordset(IHTMLObjectElement *iface, IDispatch *v)
127 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
128 FIXME("(%p)->(%p)\n", This, v);
132 static HRESULT WINAPI HTMLObjectElement_get_recordset(IHTMLObjectElement *iface, IDispatch **p)
134 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
135 FIXME("(%p)->(%p)\n", This, p);
139 static HRESULT WINAPI HTMLObjectElement_put_align(IHTMLObjectElement *iface, BSTR v)
141 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
142 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
146 static HRESULT WINAPI HTMLObjectElement_get_align(IHTMLObjectElement *iface, BSTR *p)
148 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
149 FIXME("(%p)->(%p)\n", This, p);
153 static HRESULT WINAPI HTMLObjectElement_put_name(IHTMLObjectElement *iface, BSTR v)
155 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
156 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
160 static HRESULT WINAPI HTMLObjectElement_get_name(IHTMLObjectElement *iface, BSTR *p)
162 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
163 FIXME("(%p)->(%p)\n", This, p);
167 static HRESULT WINAPI HTMLObjectElement_put_codeBase(IHTMLObjectElement *iface, BSTR v)
169 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
170 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
174 static HRESULT WINAPI HTMLObjectElement_get_codeBase(IHTMLObjectElement *iface, BSTR *p)
176 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
177 FIXME("(%p)->(%p)\n", This, p);
181 static HRESULT WINAPI HTMLObjectElement_put_codeType(IHTMLObjectElement *iface, BSTR v)
183 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
184 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
188 static HRESULT WINAPI HTMLObjectElement_get_codeType(IHTMLObjectElement *iface, BSTR *p)
190 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
191 FIXME("(%p)->(%p)\n", This, p);
195 static HRESULT WINAPI HTMLObjectElement_put_code(IHTMLObjectElement *iface, BSTR v)
197 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
198 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
202 static HRESULT WINAPI HTMLObjectElement_get_code(IHTMLObjectElement *iface, BSTR *p)
204 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
205 FIXME("(%p)->(%p)\n", This, p);
209 static HRESULT WINAPI HTMLObjectElement_get_BaseHref(IHTMLObjectElement *iface, BSTR *p)
211 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
212 FIXME("(%p)->(%p)\n", This, p);
216 static HRESULT WINAPI HTMLObjectElement_put_type(IHTMLObjectElement *iface, BSTR v)
218 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
219 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
223 static HRESULT WINAPI HTMLObjectElement_get_type(IHTMLObjectElement *iface, BSTR *p)
225 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
226 FIXME("(%p)->(%p)\n", This, p);
230 static HRESULT WINAPI HTMLObjectElement_get_form(IHTMLObjectElement *iface, IHTMLFormElement **p)
232 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
233 FIXME("(%p)->(%p)\n", This, p);
237 static HRESULT WINAPI HTMLObjectElement_put_width(IHTMLObjectElement *iface, VARIANT v)
239 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
240 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
244 static HRESULT WINAPI HTMLObjectElement_get_width(IHTMLObjectElement *iface, VARIANT *p)
246 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
247 FIXME("(%p)->(%p)\n", This, p);
251 static HRESULT WINAPI HTMLObjectElement_put_height(IHTMLObjectElement *iface, VARIANT v)
253 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
254 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
258 static HRESULT WINAPI HTMLObjectElement_get_height(IHTMLObjectElement *iface, VARIANT *p)
260 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
261 FIXME("(%p)->(%p)\n", This, p);
265 static HRESULT WINAPI HTMLObjectElement_get_readyState(IHTMLObjectElement *iface, LONG *p)
267 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
268 FIXME("(%p)->(%p)\n", This, p);
272 static HRESULT WINAPI HTMLObjectElement_put_onreadystatechange(IHTMLObjectElement *iface, VARIANT v)
274 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
275 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
279 static HRESULT WINAPI HTMLObjectElement_get_onreadystatechange(IHTMLObjectElement *iface, VARIANT *p)
281 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
282 FIXME("(%p)->(%p)\n", This, p);
286 static HRESULT WINAPI HTMLObjectElement_put_onerror(IHTMLObjectElement *iface, VARIANT v)
288 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
289 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
293 static HRESULT WINAPI HTMLObjectElement_get_onerror(IHTMLObjectElement *iface, VARIANT *p)
295 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
296 FIXME("(%p)->(%p)\n", This, p);
300 static HRESULT WINAPI HTMLObjectElement_put_altHtml(IHTMLObjectElement *iface, BSTR v)
302 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
303 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
307 static HRESULT WINAPI HTMLObjectElement_get_altHtml(IHTMLObjectElement *iface, BSTR *p)
309 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
310 FIXME("(%p)->(%p)\n", This, p);
314 static HRESULT WINAPI HTMLObjectElement_put_vspace(IHTMLObjectElement *iface, LONG v)
316 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
317 FIXME("(%p)->(%d)\n", This, v);
321 static HRESULT WINAPI HTMLObjectElement_get_vspace(IHTMLObjectElement *iface, LONG *p)
323 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
327 TRACE("(%p)->(%p)\n", This, p);
329 nsres = nsIDOMHTMLObjectElement_GetVspace(This->nsobject, &vspace);
330 if(NS_FAILED(nsres)) {
331 ERR("GetVspace failed: %08x\n", nsres);
339 static HRESULT WINAPI HTMLObjectElement_put_hspace(IHTMLObjectElement *iface, LONG v)
341 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
342 FIXME("(%p)->(%d)\n", This, v);
346 static HRESULT WINAPI HTMLObjectElement_get_hspace(IHTMLObjectElement *iface, LONG *p)
348 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
349 FIXME("(%p)->(%p)\n", This, p);
353 static const IHTMLObjectElementVtbl HTMLObjectElementVtbl = {
354 HTMLObjectElement_QueryInterface,
355 HTMLObjectElement_AddRef,
356 HTMLObjectElement_Release,
357 HTMLObjectElement_GetTypeInfoCount,
358 HTMLObjectElement_GetTypeInfo,
359 HTMLObjectElement_GetIDsOfNames,
360 HTMLObjectElement_Invoke,
361 HTMLObjectElement_get_object,
362 HTMLObjectElement_get_classid,
363 HTMLObjectElement_get_data,
364 HTMLObjectElement_put_recordset,
365 HTMLObjectElement_get_recordset,
366 HTMLObjectElement_put_align,
367 HTMLObjectElement_get_align,
368 HTMLObjectElement_put_name,
369 HTMLObjectElement_get_name,
370 HTMLObjectElement_put_codeBase,
371 HTMLObjectElement_get_codeBase,
372 HTMLObjectElement_put_codeType,
373 HTMLObjectElement_get_codeType,
374 HTMLObjectElement_put_code,
375 HTMLObjectElement_get_code,
376 HTMLObjectElement_get_BaseHref,
377 HTMLObjectElement_put_type,
378 HTMLObjectElement_get_type,
379 HTMLObjectElement_get_form,
380 HTMLObjectElement_put_width,
381 HTMLObjectElement_get_width,
382 HTMLObjectElement_put_height,
383 HTMLObjectElement_get_height,
384 HTMLObjectElement_get_readyState,
385 HTMLObjectElement_put_onreadystatechange,
386 HTMLObjectElement_get_onreadystatechange,
387 HTMLObjectElement_put_onerror,
388 HTMLObjectElement_get_onerror,
389 HTMLObjectElement_put_altHtml,
390 HTMLObjectElement_get_altHtml,
391 HTMLObjectElement_put_vspace,
392 HTMLObjectElement_get_vspace,
393 HTMLObjectElement_put_hspace,
394 HTMLObjectElement_get_hspace
397 static inline HTMLObjectElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
399 return CONTAINING_RECORD(iface, HTMLObjectElement, plugin_container.element.node);
402 static HRESULT HTMLObjectElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
404 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
406 if(IsEqualGUID(&IID_IUnknown, riid)) {
407 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
408 *ppv = &This->IHTMLObjectElement_iface;
409 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
410 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
411 *ppv = &This->IHTMLObjectElement_iface;
412 }else if(IsEqualGUID(&IID_IHTMLObjectElement, riid)) {
413 TRACE("(%p)->(IID_IHTMLObjectElement %p)\n", This, ppv);
414 *ppv = &This->IHTMLObjectElement_iface;
415 }else if(IsEqualGUID(&IID_HTMLPluginContainer, riid)) {
416 TRACE("(%p)->(IID_HTMLPluginContainer %p)\n", This, ppv);
417 *ppv = &This->plugin_container;
420 return HTMLElement_QI(&This->plugin_container.element.node, riid, ppv);
423 IUnknown_AddRef((IUnknown*)*ppv);
427 static void HTMLObjectElement_destructor(HTMLDOMNode *iface)
429 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
431 if(This->plugin_container.plugin_host)
432 detach_plugin_host(This->plugin_container.plugin_host);
434 nsIDOMHTMLObjectElement_Release(This->nsobject);
436 HTMLElement_destructor(&This->plugin_container.element.node);
439 static HRESULT HTMLObjectElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
441 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
442 FIXME("(%p)->(%p)\n", This, p);
446 static HRESULT HTMLObjectElement_get_dispid(HTMLDOMNode *iface, BSTR name,
447 DWORD grfdex, DISPID *pid)
449 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
451 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(name), grfdex, pid);
453 return get_plugin_dispid(&This->plugin_container, name, pid);
456 static HRESULT HTMLObjectElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid,
457 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
459 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
461 TRACE("(%p)->(%d)\n", This, id);
463 return invoke_plugin_prop(&This->plugin_container, id, lcid, flags, params, res, ei);
466 #undef impl_from_HTMLDOMNode
468 static const NodeImplVtbl HTMLObjectElementImplVtbl = {
469 HTMLObjectElement_QI,
470 HTMLObjectElement_destructor,
477 HTMLObjectElement_get_readystate,
478 HTMLObjectElement_get_dispid,
479 HTMLObjectElement_invoke
482 static const tid_t HTMLObjectElement_iface_tids[] = {
484 IHTMLObjectElement_tid,
487 static dispex_static_data_t HTMLObjectElement_dispex = {
489 DispHTMLObjectElement_tid,
491 HTMLObjectElement_iface_tids
494 HRESULT HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
496 HTMLObjectElement *ret;
499 ret = heap_alloc_zero(sizeof(*ret));
501 return E_OUTOFMEMORY;
503 ret->IHTMLObjectElement_iface.lpVtbl = &HTMLObjectElementVtbl;
504 ret->plugin_container.element.node.vtbl = &HTMLObjectElementImplVtbl;
506 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLObjectElement, (void**)&ret->nsobject);
507 if(NS_FAILED(nsres)) {
508 ERR("Could not get nsIDOMHTMLObjectElement iface: %08x\n", nsres);
513 HTMLElement_Init(&ret->plugin_container.element, doc, nselem, &HTMLObjectElement_dispex);
515 *elem = &ret->plugin_container.element;