1 /*
2 * Copyright 2010 Jacek Caban for CodeWeavers
3 *
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.
8 *
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.
13 *
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
17 */
18
19 #include "mshtml_private.h"
20
21 typedef struct {
22 HTMLPluginContainer plugin_container;
23
24 IHTMLObjectElement IHTMLObjectElement_iface;
25 IHTMLObjectElement2 IHTMLObjectElement2_iface;
26
27 nsIDOMHTMLObjectElement *nsobject;
28 } HTMLObjectElement;
29
impl_from_IHTMLObjectElement(IHTMLObjectElement * iface)30 static inline HTMLObjectElement *impl_from_IHTMLObjectElement(IHTMLObjectElement *iface)
31 {
32 return CONTAINING_RECORD(iface, HTMLObjectElement, IHTMLObjectElement_iface);
33 }
34
HTMLObjectElement_QueryInterface(IHTMLObjectElement * iface,REFIID riid,void ** ppv)35 static HRESULT WINAPI HTMLObjectElement_QueryInterface(IHTMLObjectElement *iface,
36 REFIID riid, void **ppv)
37 {
38 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
39
40 return IHTMLDOMNode_QueryInterface(&This->plugin_container.element.node.IHTMLDOMNode_iface,
41 riid, ppv);
42 }
43
HTMLObjectElement_AddRef(IHTMLObjectElement * iface)44 static ULONG WINAPI HTMLObjectElement_AddRef(IHTMLObjectElement *iface)
45 {
46 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
47
48 return IHTMLDOMNode_AddRef(&This->plugin_container.element.node.IHTMLDOMNode_iface);
49 }
50
HTMLObjectElement_Release(IHTMLObjectElement * iface)51 static ULONG WINAPI HTMLObjectElement_Release(IHTMLObjectElement *iface)
52 {
53 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
54
55 return IHTMLDOMNode_Release(&This->plugin_container.element.node.IHTMLDOMNode_iface);
56 }
57
HTMLObjectElement_GetTypeInfoCount(IHTMLObjectElement * iface,UINT * pctinfo)58 static HRESULT WINAPI HTMLObjectElement_GetTypeInfoCount(IHTMLObjectElement *iface, UINT *pctinfo)
59 {
60 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
61 return IDispatchEx_GetTypeInfoCount(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
62 pctinfo);
63 }
64
HTMLObjectElement_GetTypeInfo(IHTMLObjectElement * iface,UINT iTInfo,LCID lcid,ITypeInfo ** ppTInfo)65 static HRESULT WINAPI HTMLObjectElement_GetTypeInfo(IHTMLObjectElement *iface, UINT iTInfo,
66 LCID lcid, ITypeInfo **ppTInfo)
67 {
68 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
69 return IDispatchEx_GetTypeInfo(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
70 iTInfo, lcid, ppTInfo);
71 }
72
HTMLObjectElement_GetIDsOfNames(IHTMLObjectElement * iface,REFIID riid,LPOLESTR * rgszNames,UINT cNames,LCID lcid,DISPID * rgDispId)73 static HRESULT WINAPI HTMLObjectElement_GetIDsOfNames(IHTMLObjectElement *iface, REFIID riid,
74 LPOLESTR *rgszNames, UINT cNames,
75 LCID lcid, DISPID *rgDispId)
76 {
77 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
78 return IDispatchEx_GetIDsOfNames(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
79 riid, rgszNames, cNames, lcid, rgDispId);
80 }
81
HTMLObjectElement_Invoke(IHTMLObjectElement * iface,DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS * pDispParams,VARIANT * pVarResult,EXCEPINFO * pExcepInfo,UINT * puArgErr)82 static HRESULT WINAPI HTMLObjectElement_Invoke(IHTMLObjectElement *iface, DISPID dispIdMember,
83 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
84 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
85 {
86 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
87 return IDispatchEx_Invoke(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
88 dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
89 }
90
HTMLObjectElement_get_object(IHTMLObjectElement * iface,IDispatch ** p)91 static HRESULT WINAPI HTMLObjectElement_get_object(IHTMLObjectElement *iface, IDispatch **p)
92 {
93 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
94
95 TRACE("(%p)->(%p)\n", This, p);
96
97 return get_plugin_disp(&This->plugin_container, p);
98 }
99
HTMLObjectElement_get_classid(IHTMLObjectElement * iface,BSTR * p)100 static HRESULT WINAPI HTMLObjectElement_get_classid(IHTMLObjectElement *iface, BSTR *p)
101 {
102 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
103
104 TRACE("(%p)->(%p)\n", This, p);
105
106 return IHTMLObjectElement2_get_classid(&This->IHTMLObjectElement2_iface, p);
107 }
108
HTMLObjectElement_get_data(IHTMLObjectElement * iface,BSTR * p)109 static HRESULT WINAPI HTMLObjectElement_get_data(IHTMLObjectElement *iface, BSTR *p)
110 {
111 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
112
113 TRACE("(%p)->(%p)\n", This, p);
114
115 return IHTMLObjectElement2_get_data(&This->IHTMLObjectElement2_iface, p);
116 }
117
HTMLObjectElement_put_recordset(IHTMLObjectElement * iface,IDispatch * v)118 static HRESULT WINAPI HTMLObjectElement_put_recordset(IHTMLObjectElement *iface, IDispatch *v)
119 {
120 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
121 FIXME("(%p)->(%p)\n", This, v);
122 return E_NOTIMPL;
123 }
124
HTMLObjectElement_get_recordset(IHTMLObjectElement * iface,IDispatch ** p)125 static HRESULT WINAPI HTMLObjectElement_get_recordset(IHTMLObjectElement *iface, IDispatch **p)
126 {
127 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
128 FIXME("(%p)->(%p)\n", This, p);
129 return E_NOTIMPL;
130 }
131
HTMLObjectElement_put_align(IHTMLObjectElement * iface,BSTR v)132 static HRESULT WINAPI HTMLObjectElement_put_align(IHTMLObjectElement *iface, BSTR v)
133 {
134 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
135 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
136 return E_NOTIMPL;
137 }
138
HTMLObjectElement_get_align(IHTMLObjectElement * iface,BSTR * p)139 static HRESULT WINAPI HTMLObjectElement_get_align(IHTMLObjectElement *iface, BSTR *p)
140 {
141 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
142 FIXME("(%p)->(%p)\n", This, p);
143 return E_NOTIMPL;
144 }
145
HTMLObjectElement_put_name(IHTMLObjectElement * iface,BSTR v)146 static HRESULT WINAPI HTMLObjectElement_put_name(IHTMLObjectElement *iface, BSTR v)
147 {
148 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
149 nsAString nsstr;
150 nsresult nsres;
151
152 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
153
154 nsAString_InitDepend(&nsstr, v);
155 nsres = nsIDOMHTMLObjectElement_SetName(This->nsobject, &nsstr);
156 nsAString_Finish(&nsstr);
157 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
158 }
159
HTMLObjectElement_get_name(IHTMLObjectElement * iface,BSTR * p)160 static HRESULT WINAPI HTMLObjectElement_get_name(IHTMLObjectElement *iface, BSTR *p)
161 {
162 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
163 nsAString nsstr;
164 nsresult nsres;
165
166 TRACE("(%p)->(%p)\n", This, p);
167
168 nsAString_Init(&nsstr, NULL);
169 nsres = nsIDOMHTMLObjectElement_GetName(This->nsobject, &nsstr);
170 return return_nsstr(nsres, &nsstr, p);
171 }
172
HTMLObjectElement_put_codeBase(IHTMLObjectElement * iface,BSTR v)173 static HRESULT WINAPI HTMLObjectElement_put_codeBase(IHTMLObjectElement *iface, BSTR v)
174 {
175 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
176 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
177 return E_NOTIMPL;
178 }
179
HTMLObjectElement_get_codeBase(IHTMLObjectElement * iface,BSTR * p)180 static HRESULT WINAPI HTMLObjectElement_get_codeBase(IHTMLObjectElement *iface, BSTR *p)
181 {
182 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
183 FIXME("(%p)->(%p)\n", This, p);
184 return E_NOTIMPL;
185 }
186
HTMLObjectElement_put_codeType(IHTMLObjectElement * iface,BSTR v)187 static HRESULT WINAPI HTMLObjectElement_put_codeType(IHTMLObjectElement *iface, BSTR v)
188 {
189 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
190 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
191 return E_NOTIMPL;
192 }
193
HTMLObjectElement_get_codeType(IHTMLObjectElement * iface,BSTR * p)194 static HRESULT WINAPI HTMLObjectElement_get_codeType(IHTMLObjectElement *iface, BSTR *p)
195 {
196 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
197 FIXME("(%p)->(%p)\n", This, p);
198 return E_NOTIMPL;
199 }
200
HTMLObjectElement_put_code(IHTMLObjectElement * iface,BSTR v)201 static HRESULT WINAPI HTMLObjectElement_put_code(IHTMLObjectElement *iface, BSTR v)
202 {
203 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
204 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
205 return E_NOTIMPL;
206 }
207
HTMLObjectElement_get_code(IHTMLObjectElement * iface,BSTR * p)208 static HRESULT WINAPI HTMLObjectElement_get_code(IHTMLObjectElement *iface, BSTR *p)
209 {
210 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
211 FIXME("(%p)->(%p)\n", This, p);
212 return E_NOTIMPL;
213 }
214
HTMLObjectElement_get_BaseHref(IHTMLObjectElement * iface,BSTR * p)215 static HRESULT WINAPI HTMLObjectElement_get_BaseHref(IHTMLObjectElement *iface, BSTR *p)
216 {
217 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
218 FIXME("(%p)->(%p)\n", This, p);
219 return E_NOTIMPL;
220 }
221
HTMLObjectElement_put_type(IHTMLObjectElement * iface,BSTR v)222 static HRESULT WINAPI HTMLObjectElement_put_type(IHTMLObjectElement *iface, BSTR v)
223 {
224 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
225 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
226 return E_NOTIMPL;
227 }
228
HTMLObjectElement_get_type(IHTMLObjectElement * iface,BSTR * p)229 static HRESULT WINAPI HTMLObjectElement_get_type(IHTMLObjectElement *iface, BSTR *p)
230 {
231 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
232 FIXME("(%p)->(%p)\n", This, p);
233 return E_NOTIMPL;
234 }
235
HTMLObjectElement_get_form(IHTMLObjectElement * iface,IHTMLFormElement ** p)236 static HRESULT WINAPI HTMLObjectElement_get_form(IHTMLObjectElement *iface, IHTMLFormElement **p)
237 {
238 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
239 FIXME("(%p)->(%p)\n", This, p);
240 return E_NOTIMPL;
241 }
242
HTMLObjectElement_put_width(IHTMLObjectElement * iface,VARIANT v)243 static HRESULT WINAPI HTMLObjectElement_put_width(IHTMLObjectElement *iface, VARIANT v)
244 {
245 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
246 nsAString width_str;
247 PRUnichar buf[12];
248 nsresult nsres;
249
250 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
251
252 switch(V_VT(&v)) {
253 case VT_I4: {
254 static const WCHAR formatW[] = {'%','d',0};
255 sprintfW(buf, formatW, V_I4(&v));
256 break;
257 }
258 default:
259 FIXME("unimplemented for arg %s\n", debugstr_variant(&v));
260 return E_NOTIMPL;
261 }
262
263 nsAString_InitDepend(&width_str, buf);
264 nsres = nsIDOMHTMLObjectElement_SetWidth(This->nsobject, &width_str);
265 nsAString_Finish(&width_str);
266 if(NS_FAILED(nsres)) {
267 FIXME("SetWidth failed: %08x\n", nsres);
268 return E_FAIL;
269 }
270
271 notif_container_change(&This->plugin_container, DISPID_UNKNOWN);
272 return S_OK;
273 }
274
HTMLObjectElement_get_width(IHTMLObjectElement * iface,VARIANT * p)275 static HRESULT WINAPI HTMLObjectElement_get_width(IHTMLObjectElement *iface, VARIANT *p)
276 {
277 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
278 nsAString width_str;
279 nsresult nsres;
280 HRESULT hres;
281
282 TRACE("(%p)->(%p)\n", This, p);
283
284 nsAString_Init(&width_str, NULL);
285 nsres = nsIDOMHTMLObjectElement_GetWidth(This->nsobject, &width_str);
286 if(NS_SUCCEEDED(nsres)) {
287 const PRUnichar *width;
288
289 nsAString_GetData(&width_str, &width);
290 V_VT(p) = VT_BSTR;
291 V_BSTR(p) = SysAllocString(width);
292 hres = V_BSTR(p) ? S_OK : E_OUTOFMEMORY;
293 }else {
294 ERR("GetWidth failed: %08x\n", nsres);
295 hres = E_FAIL;
296 }
297
298 nsAString_Finish(&width_str);
299 return hres;
300 }
301
HTMLObjectElement_put_height(IHTMLObjectElement * iface,VARIANT v)302 static HRESULT WINAPI HTMLObjectElement_put_height(IHTMLObjectElement *iface, VARIANT v)
303 {
304 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
305 nsAString height_str;
306 PRUnichar buf[12];
307 nsresult nsres;
308
309 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
310
311 switch(V_VT(&v)) {
312 case VT_I4: {
313 static const WCHAR formatW[] = {'%','d',0};
314 sprintfW(buf, formatW, V_I4(&v));
315 break;
316 }
317 default:
318 FIXME("unimplemented for arg %s\n", debugstr_variant(&v));
319 return E_NOTIMPL;
320 }
321
322 nsAString_InitDepend(&height_str, buf);
323 nsres = nsIDOMHTMLObjectElement_SetHeight(This->nsobject, &height_str);
324 nsAString_Finish(&height_str);
325 if(NS_FAILED(nsres)) {
326 FIXME("SetHeight failed: %08x\n", nsres);
327 return E_FAIL;
328 }
329
330 notif_container_change(&This->plugin_container, DISPID_UNKNOWN);
331 return S_OK;
332 }
333
HTMLObjectElement_get_height(IHTMLObjectElement * iface,VARIANT * p)334 static HRESULT WINAPI HTMLObjectElement_get_height(IHTMLObjectElement *iface, VARIANT *p)
335 {
336 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
337 nsAString height_str;
338 nsresult nsres;
339 HRESULT hres;
340
341 TRACE("(%p)->(%p)\n", This, p);
342
343 nsAString_Init(&height_str, NULL);
344 nsres = nsIDOMHTMLObjectElement_GetHeight(This->nsobject, &height_str);
345 if(NS_SUCCEEDED(nsres)) {
346 const PRUnichar *height;
347
348 nsAString_GetData(&height_str, &height);
349 V_VT(p) = VT_BSTR;
350 V_BSTR(p) = SysAllocString(height);
351 hres = V_BSTR(p) ? S_OK : E_OUTOFMEMORY;
352 }else {
353 ERR("GetHeight failed: %08x\n", nsres);
354 hres = E_FAIL;
355 }
356
357 nsAString_Finish(&height_str);
358 return hres;
359 }
360
HTMLObjectElement_get_readyState(IHTMLObjectElement * iface,LONG * p)361 static HRESULT WINAPI HTMLObjectElement_get_readyState(IHTMLObjectElement *iface, LONG *p)
362 {
363 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
364 FIXME("(%p)->(%p)\n", This, p);
365 return E_NOTIMPL;
366 }
367
HTMLObjectElement_put_onreadystatechange(IHTMLObjectElement * iface,VARIANT v)368 static HRESULT WINAPI HTMLObjectElement_put_onreadystatechange(IHTMLObjectElement *iface, VARIANT v)
369 {
370 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
371 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
372 return E_NOTIMPL;
373 }
374
HTMLObjectElement_get_onreadystatechange(IHTMLObjectElement * iface,VARIANT * p)375 static HRESULT WINAPI HTMLObjectElement_get_onreadystatechange(IHTMLObjectElement *iface, VARIANT *p)
376 {
377 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
378 FIXME("(%p)->(%p)\n", This, p);
379 return E_NOTIMPL;
380 }
381
HTMLObjectElement_put_onerror(IHTMLObjectElement * iface,VARIANT v)382 static HRESULT WINAPI HTMLObjectElement_put_onerror(IHTMLObjectElement *iface, VARIANT v)
383 {
384 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
385 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
386 return E_NOTIMPL;
387 }
388
HTMLObjectElement_get_onerror(IHTMLObjectElement * iface,VARIANT * p)389 static HRESULT WINAPI HTMLObjectElement_get_onerror(IHTMLObjectElement *iface, VARIANT *p)
390 {
391 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
392 FIXME("(%p)->(%p)\n", This, p);
393 return E_NOTIMPL;
394 }
395
HTMLObjectElement_put_altHtml(IHTMLObjectElement * iface,BSTR v)396 static HRESULT WINAPI HTMLObjectElement_put_altHtml(IHTMLObjectElement *iface, BSTR v)
397 {
398 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
399 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
400 return E_NOTIMPL;
401 }
402
HTMLObjectElement_get_altHtml(IHTMLObjectElement * iface,BSTR * p)403 static HRESULT WINAPI HTMLObjectElement_get_altHtml(IHTMLObjectElement *iface, BSTR *p)
404 {
405 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
406 FIXME("(%p)->(%p)\n", This, p);
407 return E_NOTIMPL;
408 }
409
HTMLObjectElement_put_vspace(IHTMLObjectElement * iface,LONG v)410 static HRESULT WINAPI HTMLObjectElement_put_vspace(IHTMLObjectElement *iface, LONG v)
411 {
412 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
413 FIXME("(%p)->(%d)\n", This, v);
414 return E_NOTIMPL;
415 }
416
HTMLObjectElement_get_vspace(IHTMLObjectElement * iface,LONG * p)417 static HRESULT WINAPI HTMLObjectElement_get_vspace(IHTMLObjectElement *iface, LONG *p)
418 {
419 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
420 nsresult nsres;
421
422 TRACE("(%p)->(%p)\n", This, p);
423
424 nsres = nsIDOMHTMLObjectElement_GetVspace(This->nsobject, p);
425 if(NS_FAILED(nsres)) {
426 ERR("GetVspace failed: %08x\n", nsres);
427 return E_FAIL;
428 }
429
430 return S_OK;
431 }
432
HTMLObjectElement_put_hspace(IHTMLObjectElement * iface,LONG v)433 static HRESULT WINAPI HTMLObjectElement_put_hspace(IHTMLObjectElement *iface, LONG v)
434 {
435 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
436 FIXME("(%p)->(%d)\n", This, v);
437 return E_NOTIMPL;
438 }
439
HTMLObjectElement_get_hspace(IHTMLObjectElement * iface,LONG * p)440 static HRESULT WINAPI HTMLObjectElement_get_hspace(IHTMLObjectElement *iface, LONG *p)
441 {
442 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
443 FIXME("(%p)->(%p)\n", This, p);
444 return E_NOTIMPL;
445 }
446
447 static const IHTMLObjectElementVtbl HTMLObjectElementVtbl = {
448 HTMLObjectElement_QueryInterface,
449 HTMLObjectElement_AddRef,
450 HTMLObjectElement_Release,
451 HTMLObjectElement_GetTypeInfoCount,
452 HTMLObjectElement_GetTypeInfo,
453 HTMLObjectElement_GetIDsOfNames,
454 HTMLObjectElement_Invoke,
455 HTMLObjectElement_get_object,
456 HTMLObjectElement_get_classid,
457 HTMLObjectElement_get_data,
458 HTMLObjectElement_put_recordset,
459 HTMLObjectElement_get_recordset,
460 HTMLObjectElement_put_align,
461 HTMLObjectElement_get_align,
462 HTMLObjectElement_put_name,
463 HTMLObjectElement_get_name,
464 HTMLObjectElement_put_codeBase,
465 HTMLObjectElement_get_codeBase,
466 HTMLObjectElement_put_codeType,
467 HTMLObjectElement_get_codeType,
468 HTMLObjectElement_put_code,
469 HTMLObjectElement_get_code,
470 HTMLObjectElement_get_BaseHref,
471 HTMLObjectElement_put_type,
472 HTMLObjectElement_get_type,
473 HTMLObjectElement_get_form,
474 HTMLObjectElement_put_width,
475 HTMLObjectElement_get_width,
476 HTMLObjectElement_put_height,
477 HTMLObjectElement_get_height,
478 HTMLObjectElement_get_readyState,
479 HTMLObjectElement_put_onreadystatechange,
480 HTMLObjectElement_get_onreadystatechange,
481 HTMLObjectElement_put_onerror,
482 HTMLObjectElement_get_onerror,
483 HTMLObjectElement_put_altHtml,
484 HTMLObjectElement_get_altHtml,
485 HTMLObjectElement_put_vspace,
486 HTMLObjectElement_get_vspace,
487 HTMLObjectElement_put_hspace,
488 HTMLObjectElement_get_hspace
489 };
490
impl_from_IHTMLObjectElement2(IHTMLObjectElement2 * iface)491 static inline HTMLObjectElement *impl_from_IHTMLObjectElement2(IHTMLObjectElement2 *iface)
492 {
493 return CONTAINING_RECORD(iface, HTMLObjectElement, IHTMLObjectElement2_iface);
494 }
495
HTMLObjectElement2_QueryInterface(IHTMLObjectElement2 * iface,REFIID riid,void ** ppv)496 static HRESULT WINAPI HTMLObjectElement2_QueryInterface(IHTMLObjectElement2 *iface,
497 REFIID riid, void **ppv)
498 {
499 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
500
501 return IHTMLDOMNode_QueryInterface(&This->plugin_container.element.node.IHTMLDOMNode_iface,
502 riid, ppv);
503 }
504
HTMLObjectElement2_AddRef(IHTMLObjectElement2 * iface)505 static ULONG WINAPI HTMLObjectElement2_AddRef(IHTMLObjectElement2 *iface)
506 {
507 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
508
509 return IHTMLDOMNode_AddRef(&This->plugin_container.element.node.IHTMLDOMNode_iface);
510 }
511
HTMLObjectElement2_Release(IHTMLObjectElement2 * iface)512 static ULONG WINAPI HTMLObjectElement2_Release(IHTMLObjectElement2 *iface)
513 {
514 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
515
516 return IHTMLDOMNode_Release(&This->plugin_container.element.node.IHTMLDOMNode_iface);
517 }
518
HTMLObjectElement2_GetTypeInfoCount(IHTMLObjectElement2 * iface,UINT * pctinfo)519 static HRESULT WINAPI HTMLObjectElement2_GetTypeInfoCount(IHTMLObjectElement2 *iface, UINT *pctinfo)
520 {
521 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
522 return IDispatchEx_GetTypeInfoCount(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
523 pctinfo);
524 }
525
HTMLObjectElement2_GetTypeInfo(IHTMLObjectElement2 * iface,UINT iTInfo,LCID lcid,ITypeInfo ** ppTInfo)526 static HRESULT WINAPI HTMLObjectElement2_GetTypeInfo(IHTMLObjectElement2 *iface, UINT iTInfo,
527 LCID lcid, ITypeInfo **ppTInfo)
528 {
529 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
530 return IDispatchEx_GetTypeInfo(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
531 iTInfo, lcid, ppTInfo);
532 }
533
HTMLObjectElement2_GetIDsOfNames(IHTMLObjectElement2 * iface,REFIID riid,LPOLESTR * rgszNames,UINT cNames,LCID lcid,DISPID * rgDispId)534 static HRESULT WINAPI HTMLObjectElement2_GetIDsOfNames(IHTMLObjectElement2 *iface, REFIID riid,
535 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
536 {
537 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
538 return IDispatchEx_GetIDsOfNames(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
539 riid, rgszNames, cNames, lcid, rgDispId);
540 }
541
HTMLObjectElement2_Invoke(IHTMLObjectElement2 * iface,DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS * pDispParams,VARIANT * pVarResult,EXCEPINFO * pExcepInfo,UINT * puArgErr)542 static HRESULT WINAPI HTMLObjectElement2_Invoke(IHTMLObjectElement2 *iface, DISPID dispIdMember,
543 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
544 EXCEPINFO *pExcepInfo, UINT *puArgErr)
545 {
546 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
547 return IDispatchEx_Invoke(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
548 dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
549 }
550
HTMLObjectElement2_namedRecordset(IHTMLObjectElement2 * iface,BSTR dataMember,VARIANT * hierarchy,IDispatch ** ppRecordset)551 static HRESULT WINAPI HTMLObjectElement2_namedRecordset(IHTMLObjectElement2 *iface, BSTR dataMember,
552 VARIANT *hierarchy, IDispatch **ppRecordset)
553 {
554 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
555 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(dataMember), hierarchy, ppRecordset);
556 return E_NOTIMPL;
557 }
558
HTMLObjectElement2_put_classid(IHTMLObjectElement2 * iface,BSTR v)559 static HRESULT WINAPI HTMLObjectElement2_put_classid(IHTMLObjectElement2 *iface, BSTR v)
560 {
561 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
562 HRESULT hres;
563
564 static const WCHAR classidW[] = {'c','l','a','s','s','i','d',0};
565
566 FIXME("(%p)->(%s) semi-stub\n", This, debugstr_w(v));
567
568 hres = elem_string_attr_setter(&This->plugin_container.element, classidW, v);
569 if(FAILED(hres))
570 return hres;
571
572 if(This->plugin_container.plugin_host) {
573 FIXME("Host already associated.\n");
574 return E_NOTIMPL;
575 }
576
577 /*
578 * NOTE:
579 * If the element is not yet in DOM tree, we should embed it as soon as it's added.
580 * However, Gecko for some reason decides not to create NP plugin in this case,
581 * so this won't work.
582 */
583
584 return create_plugin_host(This->plugin_container.element.node.doc, &This->plugin_container);
585 }
586
HTMLObjectElement2_get_classid(IHTMLObjectElement2 * iface,BSTR * p)587 static HRESULT WINAPI HTMLObjectElement2_get_classid(IHTMLObjectElement2 *iface, BSTR *p)
588 {
589 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
590 FIXME("(%p)->(%p)\n", This, p);
591 return E_NOTIMPL;
592 }
593
HTMLObjectElement2_put_data(IHTMLObjectElement2 * iface,BSTR v)594 static HRESULT WINAPI HTMLObjectElement2_put_data(IHTMLObjectElement2 *iface, BSTR v)
595 {
596 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
597 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
598 return E_NOTIMPL;
599 }
600
HTMLObjectElement2_get_data(IHTMLObjectElement2 * iface,BSTR * p)601 static HRESULT WINAPI HTMLObjectElement2_get_data(IHTMLObjectElement2 *iface, BSTR *p)
602 {
603 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
604 FIXME("(%p)->(%p)\n", This, p);
605 return E_NOTIMPL;
606 }
607
608 static const IHTMLObjectElement2Vtbl HTMLObjectElement2Vtbl = {
609 HTMLObjectElement2_QueryInterface,
610 HTMLObjectElement2_AddRef,
611 HTMLObjectElement2_Release,
612 HTMLObjectElement2_GetTypeInfoCount,
613 HTMLObjectElement2_GetTypeInfo,
614 HTMLObjectElement2_GetIDsOfNames,
615 HTMLObjectElement2_Invoke,
616 HTMLObjectElement2_namedRecordset,
617 HTMLObjectElement2_put_classid,
618 HTMLObjectElement2_get_classid,
619 HTMLObjectElement2_put_data,
620 HTMLObjectElement2_get_data
621 };
622
impl_from_HTMLDOMNode(HTMLDOMNode * iface)623 static inline HTMLObjectElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
624 {
625 return CONTAINING_RECORD(iface, HTMLObjectElement, plugin_container.element.node);
626 }
627
HTMLObjectElement_QI(HTMLDOMNode * iface,REFIID riid,void ** ppv)628 static HRESULT HTMLObjectElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
629 {
630 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
631
632 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
633
634 if(IsEqualGUID(&IID_IUnknown, riid)) {
635 *ppv = &This->IHTMLObjectElement_iface;
636 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
637 *ppv = &This->IHTMLObjectElement_iface;
638 }else if(IsEqualGUID(&IID_IHTMLObjectElement, riid)) {
639 *ppv = &This->IHTMLObjectElement_iface;
640 }else if(IsEqualGUID(&IID_IHTMLObjectElement2, riid)) {
641 *ppv = &This->IHTMLObjectElement2_iface;
642 }else if(IsEqualGUID(&IID_HTMLPluginContainer, riid)) {
643 /* Special pseudo-interface returning HTMLPluginContainse struct. */
644 *ppv = &This->plugin_container;
645 node_addref(&This->plugin_container.element.node);
646 return S_OK;
647 }else {
648 HRESULT hres;
649
650 hres = HTMLElement_QI(&This->plugin_container.element.node, riid, ppv);
651 if(hres == E_NOINTERFACE && This->plugin_container.plugin_host && This->plugin_container.plugin_host->plugin_unk) {
652 IUnknown *plugin_iface, *ret;
653
654 hres = IUnknown_QueryInterface(This->plugin_container.plugin_host->plugin_unk, riid, (void**)&plugin_iface);
655 if(hres == S_OK) {
656 hres = wrap_iface(plugin_iface, (IUnknown*)&This->IHTMLObjectElement_iface, &ret);
657 IUnknown_Release(plugin_iface);
658 if(FAILED(hres))
659 return hres;
660
661 TRACE("returning plugin iface %p wrapped to %p\n", plugin_iface, ret);
662 *ppv = ret;
663 return S_OK;
664 }
665 }
666
667 return hres;
668 }
669
670 IUnknown_AddRef((IUnknown*)*ppv);
671 return S_OK;
672 }
673
HTMLObjectElement_destructor(HTMLDOMNode * iface)674 static void HTMLObjectElement_destructor(HTMLDOMNode *iface)
675 {
676 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
677
678 if(This->plugin_container.plugin_host)
679 detach_plugin_host(This->plugin_container.plugin_host);
680
681 HTMLElement_destructor(&This->plugin_container.element.node);
682 }
683
HTMLObjectElement_get_readystate(HTMLDOMNode * iface,BSTR * p)684 static HRESULT HTMLObjectElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
685 {
686 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
687 FIXME("(%p)->(%p)\n", This, p);
688 return E_NOTIMPL;
689 }
690
HTMLObjectElement_get_dispid(HTMLDOMNode * iface,BSTR name,DWORD grfdex,DISPID * pid)691 static HRESULT HTMLObjectElement_get_dispid(HTMLDOMNode *iface, BSTR name,
692 DWORD grfdex, DISPID *pid)
693 {
694 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
695
696 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(name), grfdex, pid);
697
698 return get_plugin_dispid(&This->plugin_container, name, pid);
699 }
700
HTMLObjectElement_invoke(HTMLDOMNode * iface,DISPID id,LCID lcid,WORD flags,DISPPARAMS * params,VARIANT * res,EXCEPINFO * ei,IServiceProvider * caller)701 static HRESULT HTMLObjectElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid,
702 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
703 {
704 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
705
706 TRACE("(%p)->(%d)\n", This, id);
707
708 return invoke_plugin_prop(&This->plugin_container, id, lcid, flags, params, res, ei);
709 }
710
HTMLObjectElement_traverse(HTMLDOMNode * iface,nsCycleCollectionTraversalCallback * cb)711 static void HTMLObjectElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
712 {
713 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
714
715 if(This->nsobject)
716 note_cc_edge((nsISupports*)This->nsobject, "This->nsobject", cb);
717 }
718
HTMLObjectElement_unlink(HTMLDOMNode * iface)719 static void HTMLObjectElement_unlink(HTMLDOMNode *iface)
720 {
721 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
722
723 if(This->nsobject) {
724 nsIDOMHTMLObjectElement *nsobject = This->nsobject;
725
726 This->nsobject = NULL;
727 nsIDOMHTMLObjectElement_Release(nsobject);
728 }
729 }
730
731 static const NodeImplVtbl HTMLObjectElementImplVtbl = {
732 HTMLObjectElement_QI,
733 HTMLObjectElement_destructor,
734 HTMLElement_cpc,
735 HTMLElement_clone,
736 HTMLElement_handle_event,
737 HTMLElement_get_attr_col,
738 NULL,
739 NULL,
740 NULL,
741 NULL,
742 NULL,
743 HTMLObjectElement_get_readystate,
744 HTMLObjectElement_get_dispid,
745 HTMLObjectElement_invoke,
746 NULL,
747 HTMLObjectElement_traverse,
748 HTMLObjectElement_unlink
749 };
750
751 static const tid_t HTMLObjectElement_iface_tids[] = {
752 IHTMLObjectElement2_tid,
753 IHTMLObjectElement_tid,
754 HTMLELEMENT_TIDS,
755 0
756 };
757 static dispex_static_data_t HTMLObjectElement_dispex = {
758 NULL,
759 DispHTMLObjectElement_tid,
760 NULL,
761 HTMLObjectElement_iface_tids
762 };
763
HTMLObjectElement_Create(HTMLDocumentNode * doc,nsIDOMHTMLElement * nselem,HTMLElement ** elem)764 HRESULT HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
765 {
766 HTMLObjectElement *ret;
767 nsresult nsres;
768
769 ret = heap_alloc_zero(sizeof(*ret));
770 if(!ret)
771 return E_OUTOFMEMORY;
772
773 ret->IHTMLObjectElement_iface.lpVtbl = &HTMLObjectElementVtbl;
774 ret->IHTMLObjectElement2_iface.lpVtbl = &HTMLObjectElement2Vtbl;
775 ret->plugin_container.element.node.vtbl = &HTMLObjectElementImplVtbl;
776
777 HTMLElement_Init(&ret->plugin_container.element, doc, nselem, &HTMLObjectElement_dispex);
778
779 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLObjectElement, (void**)&ret->nsobject);
780 assert(nsres == NS_OK);
781
782 *elem = &ret->plugin_container.element;
783 return S_OK;
784 }
785