mshtml: Added IHTMLLinkElement stub implementation.
[wine] / dlls / mshtml / htmllink.c
1  /*
2  * Copyright 2012 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 <stdarg.h>
20
21 #define COBJMACROS
22
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
27
28 #include "wine/debug.h"
29
30 #include "mshtml_private.h"
31
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
33
34 typedef struct {
35     HTMLElement element;
36     IHTMLLinkElement IHTMLLinkElement_iface;
37 } HTMLLinkElement;
38
39 static inline HTMLLinkElement *impl_from_IHTMLLinkElement(IHTMLLinkElement *iface)
40 {
41     return CONTAINING_RECORD(iface, HTMLLinkElement, IHTMLLinkElement_iface);
42 }
43
44 static HRESULT WINAPI HTMLLinkElement_QueryInterface(IHTMLLinkElement *iface,
45                                                          REFIID riid, void **ppv)
46 {
47     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
48
49     return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
50 }
51
52 static ULONG WINAPI HTMLLinkElement_AddRef(IHTMLLinkElement *iface)
53 {
54     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
55
56     return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
57 }
58
59 static ULONG WINAPI HTMLLinkElement_Release(IHTMLLinkElement *iface)
60 {
61     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
62
63     return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
64 }
65
66 static HRESULT WINAPI HTMLLinkElement_GetTypeInfoCount(IHTMLLinkElement *iface, UINT *pctinfo)
67 {
68     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
69
70     return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
71 }
72
73 static HRESULT WINAPI HTMLLinkElement_GetTypeInfo(IHTMLLinkElement *iface, UINT iTInfo,
74                                               LCID lcid, ITypeInfo **ppTInfo)
75 {
76     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
77
78     return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
79             ppTInfo);
80 }
81
82 static HRESULT WINAPI HTMLLinkElement_GetIDsOfNames(IHTMLLinkElement *iface, REFIID riid,
83                                                 LPOLESTR *rgszNames, UINT cNames,
84                                                 LCID lcid, DISPID *rgDispId)
85 {
86     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
87
88     return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
89             cNames, lcid, rgDispId);
90 }
91
92 static HRESULT WINAPI HTMLLinkElement_Invoke(IHTMLLinkElement *iface, DISPID dispIdMember,
93                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
94                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
95 {
96     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
97
98     return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
99             lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
100 }
101
102 static HRESULT WINAPI HTMLLinkElement_put_href(IHTMLLinkElement *iface, BSTR v)
103 {
104     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
105     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
106     return E_NOTIMPL;
107 }
108
109 static HRESULT WINAPI HTMLLinkElement_get_href(IHTMLLinkElement *iface, BSTR *p)
110 {
111     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
112     FIXME("(%p)->(%p)\n", This, p);
113     return E_NOTIMPL;
114 }
115
116 static HRESULT WINAPI HTMLLinkElement_put_rel(IHTMLLinkElement *iface, BSTR v)
117 {
118     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
119     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
120     return E_NOTIMPL;
121 }
122
123 static HRESULT WINAPI HTMLLinkElement_get_rel(IHTMLLinkElement *iface, BSTR *p)
124 {
125     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
126     FIXME("(%p)->(%p)\n", This, p);
127     return E_NOTIMPL;
128 }
129
130 static HRESULT WINAPI HTMLLinkElement_put_rev(IHTMLLinkElement *iface, BSTR v)
131 {
132     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
133     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
134     return E_NOTIMPL;
135 }
136
137 static HRESULT WINAPI HTMLLinkElement_get_rev(IHTMLLinkElement *iface, BSTR *p)
138 {
139     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
140     FIXME("(%p)->(%p)\n", This, p);
141     return E_NOTIMPL;
142 }
143
144 static HRESULT WINAPI HTMLLinkElement_put_type(IHTMLLinkElement *iface, BSTR v)
145 {
146     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
147     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
148     return E_NOTIMPL;
149 }
150
151 static HRESULT WINAPI HTMLLinkElement_get_type(IHTMLLinkElement *iface, BSTR *p)
152 {
153     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
154     FIXME("(%p)->(%p)\n", This, p);
155     return E_NOTIMPL;
156 }
157
158 static HRESULT WINAPI HTMLLinkElement_get_readyState(IHTMLLinkElement *iface, BSTR *p)
159 {
160     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
161     FIXME("(%p)->(%p)\n", This, p);
162     return E_NOTIMPL;
163 }
164
165 static HRESULT WINAPI HTMLLinkElement_put_onreadystatechange(IHTMLLinkElement *iface, VARIANT v)
166 {
167     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
168     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
169     return E_NOTIMPL;
170 }
171
172 static HRESULT WINAPI HTMLLinkElement_get_onreadystatechange(IHTMLLinkElement *iface, VARIANT *p)
173 {
174     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
175     FIXME("(%p)->(%p)\n", This, p);
176     return E_NOTIMPL;
177 }
178
179 static HRESULT WINAPI HTMLLinkElement_put_onload(IHTMLLinkElement *iface, VARIANT v)
180 {
181     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
182     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
183     return E_NOTIMPL;
184 }
185
186 static HRESULT WINAPI HTMLLinkElement_get_onload(IHTMLLinkElement *iface, VARIANT *p)
187 {
188     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
189     FIXME("(%p)->(%p)\n", This, p);
190     return E_NOTIMPL;
191 }
192
193 static HRESULT WINAPI HTMLLinkElement_put_onerror(IHTMLLinkElement *iface, VARIANT v)
194 {
195     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
196     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
197     return E_NOTIMPL;
198 }
199
200 static HRESULT WINAPI HTMLLinkElement_get_onerror(IHTMLLinkElement *iface, VARIANT *p)
201 {
202     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
203     FIXME("(%p)->(%p)\n", This, p);
204     return E_NOTIMPL;
205 }
206
207 static HRESULT WINAPI HTMLLinkElement_get_styleSheet(IHTMLLinkElement *iface, IHTMLStyleSheet **p)
208 {
209     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
210     FIXME("(%p)->(%p)\n", This, p);
211     return E_NOTIMPL;
212 }
213
214 static HRESULT WINAPI HTMLLinkElement_put_disabled(IHTMLLinkElement *iface, VARIANT_BOOL v)
215 {
216     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
217     FIXME("(%p)->(%x)\n", This, v);
218     return E_NOTIMPL;
219 }
220
221 static HRESULT WINAPI HTMLLinkElement_get_disabled(IHTMLLinkElement *iface, VARIANT_BOOL *p)
222 {
223     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
224     FIXME("(%p)->(%p)\n", This, p);
225     return E_NOTIMPL;
226 }
227
228 static HRESULT WINAPI HTMLLinkElement_put_media(IHTMLLinkElement *iface, BSTR v)
229 {
230     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
231     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
232     return E_NOTIMPL;
233 }
234
235 static HRESULT WINAPI HTMLLinkElement_get_media(IHTMLLinkElement *iface, BSTR *p)
236 {
237     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
238     FIXME("(%p)->(%p)\n", This, p);
239     return E_NOTIMPL;
240 }
241
242 static const IHTMLLinkElementVtbl HTMLLinkElementVtbl = {
243     HTMLLinkElement_QueryInterface,
244     HTMLLinkElement_AddRef,
245     HTMLLinkElement_Release,
246     HTMLLinkElement_GetTypeInfoCount,
247     HTMLLinkElement_GetTypeInfo,
248     HTMLLinkElement_GetIDsOfNames,
249     HTMLLinkElement_Invoke,
250     HTMLLinkElement_put_href,
251     HTMLLinkElement_get_href,
252     HTMLLinkElement_put_rel,
253     HTMLLinkElement_get_rel,
254     HTMLLinkElement_put_rev,
255     HTMLLinkElement_get_rev,
256     HTMLLinkElement_put_type,
257     HTMLLinkElement_get_type,
258     HTMLLinkElement_get_readyState,
259     HTMLLinkElement_put_onreadystatechange,
260     HTMLLinkElement_get_onreadystatechange,
261     HTMLLinkElement_put_onload,
262     HTMLLinkElement_get_onload,
263     HTMLLinkElement_put_onerror,
264     HTMLLinkElement_get_onerror,
265     HTMLLinkElement_get_styleSheet,
266     HTMLLinkElement_put_disabled,
267     HTMLLinkElement_get_disabled,
268     HTMLLinkElement_put_media,
269     HTMLLinkElement_get_media
270 };
271
272 static inline HTMLLinkElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
273 {
274     return CONTAINING_RECORD(iface, HTMLLinkElement, element.node);
275 }
276
277 static HRESULT HTMLLinkElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
278 {
279     HTMLLinkElement *This = impl_from_HTMLDOMNode(iface);
280
281     if(IsEqualGUID(&IID_IHTMLLinkElement, riid)) {
282         TRACE("(%p)->(IID_IHTMLLinkElement %p)\n", This, ppv);
283         *ppv = &This->IHTMLLinkElement_iface;
284     }else {
285         return HTMLElement_QI(&This->element.node, riid, ppv);
286     }
287
288     IUnknown_AddRef((IUnknown*)*ppv);
289     return S_OK;
290 }
291
292 static void HTMLLinkElement_destructor(HTMLDOMNode *iface)
293 {
294     HTMLLinkElement *This = impl_from_HTMLDOMNode(iface);
295
296     HTMLElement_destructor(&This->element.node);
297 }
298
299 static const NodeImplVtbl HTMLLinkElementImplVtbl = {
300     HTMLLinkElement_QI,
301     HTMLLinkElement_destructor,
302     HTMLElement_clone,
303     HTMLElement_handle_event,
304     HTMLElement_get_attr_col
305 };
306
307 static const tid_t HTMLLinkElement_iface_tids[] = {
308     HTMLELEMENT_TIDS,
309     IHTMLLinkElement_tid,
310     0
311 };
312 static dispex_static_data_t HTMLLinkElement_dispex = {
313     NULL,
314     DispHTMLLinkElement_tid,
315     NULL,
316     HTMLLinkElement_iface_tids
317 };
318
319 HRESULT HTMLLinkElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
320 {
321     HTMLLinkElement *ret;
322
323     ret = heap_alloc_zero(sizeof(*ret));
324     if(!ret)
325         return E_OUTOFMEMORY;
326
327     ret->IHTMLLinkElement_iface.lpVtbl = &HTMLLinkElementVtbl;
328     ret->element.node.vtbl = &HTMLLinkElementImplVtbl;
329
330     HTMLElement_Init(&ret->element, doc, nselem, &HTMLLinkElement_dispex);
331
332     *elem = &ret->element;
333     return S_OK;
334 }