Revert tree-restructure attempt: r66583, r66582, r66581, r66578, sauf ntdll changes...
[reactos.git] / reactos / dll / win32 / mshtml / htmlembed.c
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 HTMLElement element;
23
24 IHTMLEmbedElement IHTMLEmbedElement_iface;
25 } HTMLEmbedElement;
26
27 static inline HTMLEmbedElement *impl_from_IHTMLEmbedElement(IHTMLEmbedElement *iface)
28 {
29 return CONTAINING_RECORD(iface, HTMLEmbedElement, IHTMLEmbedElement_iface);
30 }
31
32 static HRESULT WINAPI HTMLEmbedElement_QueryInterface(IHTMLEmbedElement *iface,
33 REFIID riid, void **ppv)
34 {
35 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
36
37 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
38 }
39
40 static ULONG WINAPI HTMLEmbedElement_AddRef(IHTMLEmbedElement *iface)
41 {
42 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
43
44 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
45 }
46
47 static ULONG WINAPI HTMLEmbedElement_Release(IHTMLEmbedElement *iface)
48 {
49 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
50
51 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
52 }
53
54 static HRESULT WINAPI HTMLEmbedElement_GetTypeInfoCount(IHTMLEmbedElement *iface, UINT *pctinfo)
55 {
56 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
57 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
58 }
59
60 static HRESULT WINAPI HTMLEmbedElement_GetTypeInfo(IHTMLEmbedElement *iface, UINT iTInfo,
61 LCID lcid, ITypeInfo **ppTInfo)
62 {
63 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
64 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
65 ppTInfo);
66 }
67
68 static HRESULT WINAPI HTMLEmbedElement_GetIDsOfNames(IHTMLEmbedElement *iface, REFIID riid,
69 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
70 {
71 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
72 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
73 cNames, lcid, rgDispId);
74 }
75
76 static HRESULT WINAPI HTMLEmbedElement_Invoke(IHTMLEmbedElement *iface, DISPID dispIdMember,
77 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
78 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
79 {
80 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
81 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
82 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
83 }
84
85 static HRESULT WINAPI HTMLEmbedElement_put_hidden(IHTMLEmbedElement *iface, BSTR v)
86 {
87 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
88 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
89 return E_NOTIMPL;
90 }
91
92 static HRESULT WINAPI HTMLEmbedElement_get_hidden(IHTMLEmbedElement *iface, BSTR *p)
93 {
94 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
95 FIXME("(%p)->(%p)\n", This, p);
96 return E_NOTIMPL;
97 }
98
99 static HRESULT WINAPI HTMLEmbedElement_get_palete(IHTMLEmbedElement *iface, BSTR *p)
100 {
101 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
102 FIXME("(%p)->(%p)\n", This, p);
103 return E_NOTIMPL;
104 }
105
106 static HRESULT WINAPI HTMLEmbedElement_get_pluginspage(IHTMLEmbedElement *iface, BSTR *p)
107 {
108 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
109 FIXME("(%p)->(%p)\n", This, p);
110 return E_NOTIMPL;
111 }
112
113 static HRESULT WINAPI HTMLEmbedElement_put_src(IHTMLEmbedElement *iface, BSTR v)
114 {
115 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
116 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
117 return E_NOTIMPL;
118 }
119
120 static HRESULT WINAPI HTMLEmbedElement_get_src(IHTMLEmbedElement *iface, BSTR *p)
121 {
122 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
123 FIXME("(%p)->(%p)\n", This, p);
124 return E_NOTIMPL;
125 }
126
127 static HRESULT WINAPI HTMLEmbedElement_put_units(IHTMLEmbedElement *iface, BSTR v)
128 {
129 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
130 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
131 return E_NOTIMPL;
132 }
133
134 static HRESULT WINAPI HTMLEmbedElement_get_units(IHTMLEmbedElement *iface, BSTR *p)
135 {
136 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
137 FIXME("(%p)->(%p)\n", This, p);
138 return E_NOTIMPL;
139 }
140
141 static HRESULT WINAPI HTMLEmbedElement_put_name(IHTMLEmbedElement *iface, BSTR v)
142 {
143 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
144 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
145 return E_NOTIMPL;
146 }
147
148 static HRESULT WINAPI HTMLEmbedElement_get_name(IHTMLEmbedElement *iface, BSTR *p)
149 {
150 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
151 FIXME("(%p)->(%p)\n", This, p);
152 return E_NOTIMPL;
153 }
154
155 static HRESULT WINAPI HTMLEmbedElement_put_width(IHTMLEmbedElement *iface, VARIANT v)
156 {
157 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
158 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
159 return E_NOTIMPL;
160 }
161
162 static HRESULT WINAPI HTMLEmbedElement_get_width(IHTMLEmbedElement *iface, VARIANT *p)
163 {
164 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
165 FIXME("(%p)->(%p)\n", This, p);
166 return E_NOTIMPL;
167 }
168
169 static HRESULT WINAPI HTMLEmbedElement_put_height(IHTMLEmbedElement *iface, VARIANT v)
170 {
171 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
172 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
173 return E_NOTIMPL;
174 }
175
176 static HRESULT WINAPI HTMLEmbedElement_get_height(IHTMLEmbedElement *iface, VARIANT *p)
177 {
178 HTMLEmbedElement *This = impl_from_IHTMLEmbedElement(iface);
179 FIXME("(%p)->(%p)\n", This, p);
180 return E_NOTIMPL;
181 }
182
183 static const IHTMLEmbedElementVtbl HTMLEmbedElementVtbl = {
184 HTMLEmbedElement_QueryInterface,
185 HTMLEmbedElement_AddRef,
186 HTMLEmbedElement_Release,
187 HTMLEmbedElement_GetTypeInfoCount,
188 HTMLEmbedElement_GetTypeInfo,
189 HTMLEmbedElement_GetIDsOfNames,
190 HTMLEmbedElement_Invoke,
191 HTMLEmbedElement_put_hidden,
192 HTMLEmbedElement_get_hidden,
193 HTMLEmbedElement_get_palete,
194 HTMLEmbedElement_get_pluginspage,
195 HTMLEmbedElement_put_src,
196 HTMLEmbedElement_get_src,
197 HTMLEmbedElement_put_units,
198 HTMLEmbedElement_get_units,
199 HTMLEmbedElement_put_name,
200 HTMLEmbedElement_get_name,
201 HTMLEmbedElement_put_width,
202 HTMLEmbedElement_get_width,
203 HTMLEmbedElement_put_height,
204 HTMLEmbedElement_get_height
205 };
206
207 static inline HTMLEmbedElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
208 {
209 return CONTAINING_RECORD(iface, HTMLEmbedElement, element.node);
210 }
211
212 static HRESULT HTMLEmbedElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
213 {
214 HTMLEmbedElement *This = impl_from_HTMLDOMNode(iface);
215
216 if(IsEqualGUID(&IID_IUnknown, riid)) {
217 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
218 *ppv = &This->IHTMLEmbedElement_iface;
219 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
220 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
221 *ppv = &This->IHTMLEmbedElement_iface;
222 }else if(IsEqualGUID(&IID_IHTMLEmbedElement, riid)) {
223 TRACE("(%p)->(IID_IHTMLEmbedElement %p)\n", This, ppv);
224 *ppv = &This->IHTMLEmbedElement_iface;
225 }else {
226 return HTMLElement_QI(&This->element.node, riid, ppv);
227 }
228
229 IUnknown_AddRef((IUnknown*)*ppv);
230 return S_OK;
231 }
232
233 static void HTMLEmbedElement_destructor(HTMLDOMNode *iface)
234 {
235 HTMLEmbedElement *This = impl_from_HTMLDOMNode(iface);
236
237 HTMLElement_destructor(&This->element.node);
238 }
239
240 static const NodeImplVtbl HTMLEmbedElementImplVtbl = {
241 HTMLEmbedElement_QI,
242 HTMLEmbedElement_destructor,
243 HTMLElement_cpc,
244 HTMLElement_clone,
245 HTMLElement_handle_event,
246 HTMLElement_get_attr_col
247 };
248
249 static const tid_t HTMLEmbedElement_iface_tids[] = {
250 HTMLELEMENT_TIDS,
251 IHTMLEmbedElement_tid,
252 0
253 };
254 static dispex_static_data_t HTMLEmbedElement_dispex = {
255 NULL,
256 DispHTMLEmbed_tid,
257 NULL,
258 HTMLEmbedElement_iface_tids
259 };
260
261 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
262 {
263 HTMLEmbedElement *ret;
264
265 ret = heap_alloc_zero(sizeof(*ret));
266 if(!ret)
267 return E_OUTOFMEMORY;
268
269 ret->IHTMLEmbedElement_iface.lpVtbl = &HTMLEmbedElementVtbl;
270 ret->element.node.vtbl = &HTMLEmbedElementImplVtbl;
271
272 HTMLElement_Init(&ret->element, doc, nselem, &HTMLEmbedElement_dispex);
273 *elem = &ret->element;
274 return S_OK;
275 }