iexplore: Added self-registration code.
[wine] / dlls / mshtml / htmlanchor.c
1 /*
2  * Copyright 2007 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 "config.h"
20
21 #include <stdarg.h>
22 #include <stdio.h>
23
24 #define COBJMACROS
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "winnls.h"
30 #include "ole2.h"
31
32 #include "wine/debug.h"
33
34 #include "mshtml_private.h"
35
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
37
38 typedef struct {
39     HTMLElement element;
40
41     const IHTMLAnchorElementVtbl *lpHTMLAnchorElementVtbl;
42 } HTMLAnchorElement;
43
44 #define HTMLANCHOR(x)  ((IHTMLAnchorElement*)  &(x)->lpHTMLAnchorElementVtbl)
45
46 #define HTMLANCHOR_THIS(iface) DEFINE_THIS(HTMLAnchorElement, HTMLAnchorElement, iface)
47
48 static HRESULT WINAPI HTMLAnchorElement_QueryInterface(IHTMLAnchorElement *iface,
49         REFIID riid, void **ppv)
50 {
51     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
52
53     return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
54 }
55
56 static ULONG WINAPI HTMLAnchorElement_AddRef(IHTMLAnchorElement *iface)
57 {
58     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
59
60     return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
61 }
62
63 static ULONG WINAPI HTMLAnchorElement_Release(IHTMLAnchorElement *iface)
64 {
65     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
66
67     return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
68 }
69
70 static HRESULT WINAPI HTMLAnchorElement_GetTypeInfoCount(IHTMLAnchorElement *iface, UINT *pctinfo)
71 {
72     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
73     FIXME("(%p)->(%p)\n", This, pctinfo);
74     return E_NOTIMPL;
75 }
76
77 static HRESULT WINAPI HTMLAnchorElement_GetTypeInfo(IHTMLAnchorElement *iface, UINT iTInfo,
78                                               LCID lcid, ITypeInfo **ppTInfo)
79 {
80     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
81     FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
82     return E_NOTIMPL;
83 }
84
85 static HRESULT WINAPI HTMLAnchorElement_GetIDsOfNames(IHTMLAnchorElement *iface, REFIID riid,
86                                                 LPOLESTR *rgszNames, UINT cNames,
87                                                 LCID lcid, DISPID *rgDispId)
88 {
89     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
90     FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
91                                         lcid, rgDispId);
92     return E_NOTIMPL;
93 }
94
95 static HRESULT WINAPI HTMLAnchorElement_Invoke(IHTMLAnchorElement *iface, DISPID dispIdMember,
96                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
97                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
98 {
99     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
100     FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
101             lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
102     return E_NOTIMPL;
103 }
104
105 static HRESULT WINAPI HTMLAnchorElement_put_href(IHTMLAnchorElement *iface, BSTR v)
106 {
107     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
108     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
109     return E_NOTIMPL;
110 }
111
112 static HRESULT WINAPI HTMLAnchorElement_get_href(IHTMLAnchorElement *iface, BSTR *p)
113 {
114     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
115     FIXME("(%p)->(%p)\n", This, p);
116     return E_NOTIMPL;
117 }
118
119 static HRESULT WINAPI HTMLAnchorElement_put_target(IHTMLAnchorElement *iface, BSTR v)
120 {
121     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
122     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
123     return E_NOTIMPL;
124 }
125
126 static HRESULT WINAPI HTMLAnchorElement_get_target(IHTMLAnchorElement *iface, BSTR *p)
127 {
128     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
129     FIXME("(%p)->(%p)\n", This, p);
130     return E_NOTIMPL;
131 }
132
133 static HRESULT WINAPI HTMLAnchorElement_put_rel(IHTMLAnchorElement *iface, BSTR v)
134 {
135     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
136     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
137     return E_NOTIMPL;
138 }
139
140 static HRESULT WINAPI HTMLAnchorElement_get_rel(IHTMLAnchorElement *iface, BSTR *p)
141 {
142     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
143     FIXME("(%p)->(%p)\n", This, p);
144     return E_NOTIMPL;
145 }
146
147 static HRESULT WINAPI HTMLAnchorElement_put_rev(IHTMLAnchorElement *iface, BSTR v)
148 {
149     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
150     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
151     return E_NOTIMPL;
152 }
153
154 static HRESULT WINAPI HTMLAnchorElement_get_rev(IHTMLAnchorElement *iface, BSTR *p)
155 {
156     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
157     FIXME("(%p)->(%p)\n", This, p);
158     return E_NOTIMPL;
159 }
160
161 static HRESULT WINAPI HTMLAnchorElement_put_urn(IHTMLAnchorElement *iface, BSTR v)
162 {
163     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
164     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
165     return E_NOTIMPL;
166 }
167
168 static HRESULT WINAPI HTMLAnchorElement_get_urn(IHTMLAnchorElement *iface, BSTR *p)
169 {
170     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
171     FIXME("(%p)->(%p)\n", This, p);
172     return E_NOTIMPL;
173 }
174
175 static HRESULT WINAPI HTMLAnchorElement_put_Methods(IHTMLAnchorElement *iface, BSTR v)
176 {
177     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
178     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
179     return E_NOTIMPL;
180 }
181
182 static HRESULT WINAPI HTMLAnchorElement_get_Methods(IHTMLAnchorElement *iface, BSTR *p)
183 {
184     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
185     FIXME("(%p)->(%p)\n", This, p);
186     return E_NOTIMPL;
187 }
188
189 static HRESULT WINAPI HTMLAnchorElement_put_name(IHTMLAnchorElement *iface, BSTR v)
190 {
191     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
192     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
193     return E_NOTIMPL;
194 }
195
196 static HRESULT WINAPI HTMLAnchorElement_get_name(IHTMLAnchorElement *iface, BSTR *p)
197 {
198     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
199     FIXME("(%p)->(%p)\n", This, p);
200     return E_NOTIMPL;
201 }
202
203 static HRESULT WINAPI HTMLAnchorElement_put_host(IHTMLAnchorElement *iface, BSTR v)
204 {
205     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
206     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
207     return E_NOTIMPL;
208 }
209
210 static HRESULT WINAPI HTMLAnchorElement_get_host(IHTMLAnchorElement *iface, BSTR *p)
211 {
212     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
213     FIXME("(%p)->(%p)\n", This, p);
214     return E_NOTIMPL;
215 }
216
217 static HRESULT WINAPI HTMLAnchorElement_put_hostname(IHTMLAnchorElement *iface, BSTR v)
218 {
219     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
220     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
221     return E_NOTIMPL;
222 }
223
224 static HRESULT WINAPI HTMLAnchorElement_get_hostname(IHTMLAnchorElement *iface, BSTR *p)
225 {
226     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
227     FIXME("(%p)->(%p)\n", This, p);
228     return E_NOTIMPL;
229 }
230
231 static HRESULT WINAPI HTMLAnchorElement_put_pathname(IHTMLAnchorElement *iface, BSTR v)
232 {
233     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
234     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
235     return E_NOTIMPL;
236 }
237
238 static HRESULT WINAPI HTMLAnchorElement_get_pathname(IHTMLAnchorElement *iface, BSTR *p)
239 {
240     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
241     FIXME("(%p)->(%p)\n", This, p);
242     return E_NOTIMPL;
243 }
244
245 static HRESULT WINAPI HTMLAnchorElement_put_port(IHTMLAnchorElement *iface, BSTR v)
246 {
247     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
248     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
249     return E_NOTIMPL;
250 }
251
252 static HRESULT WINAPI HTMLAnchorElement_get_port(IHTMLAnchorElement *iface, BSTR *p)
253 {
254     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
255     FIXME("(%p)->(%p)\n", This, p);
256     return E_NOTIMPL;
257 }
258
259 static HRESULT WINAPI HTMLAnchorElement_put_protocol(IHTMLAnchorElement *iface, BSTR v)
260 {
261     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
262     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
263     return E_NOTIMPL;
264 }
265
266 static HRESULT WINAPI HTMLAnchorElement_get_protocol(IHTMLAnchorElement *iface, BSTR *p)
267 {
268     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
269     FIXME("(%p)->(%p)\n", This, p);
270     return E_NOTIMPL;
271 }
272
273 static HRESULT WINAPI HTMLAnchorElement_put_search(IHTMLAnchorElement *iface, BSTR v)
274 {
275     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
276     FIXME("(%p)->(%p)\n", This, debugstr_w(v));
277     return E_NOTIMPL;
278 }
279
280 static HRESULT WINAPI HTMLAnchorElement_get_search(IHTMLAnchorElement *iface, BSTR *p)
281 {
282     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
283     FIXME("(%p)->(%p)\n", This, p);
284     return E_NOTIMPL;
285 }
286
287 static HRESULT WINAPI HTMLAnchorElement_put_hash(IHTMLAnchorElement *iface, BSTR v)
288 {
289     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
290     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
291     return E_NOTIMPL;
292 }
293
294 static HRESULT WINAPI HTMLAnchorElement_get_hash(IHTMLAnchorElement *iface, BSTR *p)
295 {
296     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
297     FIXME("(%p)->(%p)\n", This, p);
298     return E_NOTIMPL;
299 }
300
301 static HRESULT WINAPI HTMLAnchorElement_put_onblur(IHTMLAnchorElement *iface, VARIANT v)
302 {
303     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
304     FIXME("(%p)->()\n", This);
305     return E_NOTIMPL;
306 }
307
308 static HRESULT WINAPI HTMLAnchorElement_get_onblur(IHTMLAnchorElement *iface, VARIANT *p)
309 {
310     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
311     FIXME("(%p)->(%p)\n", This, p);
312     return E_NOTIMPL;
313 }
314
315 static HRESULT WINAPI HTMLAnchorElement_put_onfocus(IHTMLAnchorElement *iface, VARIANT v)
316 {
317     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
318     FIXME("(%p)->()\n", This);
319     return E_NOTIMPL;
320 }
321
322 static HRESULT WINAPI HTMLAnchorElement_get_onfocus(IHTMLAnchorElement *iface, VARIANT *p)
323 {
324     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
325     FIXME("(%p)->(%p)\n", This, p);
326     return E_NOTIMPL;
327 }
328
329 static HRESULT WINAPI HTMLAnchorElement_put_accessKey(IHTMLAnchorElement *iface, BSTR v)
330 {
331     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
332     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
333     return E_NOTIMPL;
334 }
335
336 static HRESULT WINAPI HTMLAnchorElement_get_accessKey(IHTMLAnchorElement *iface, BSTR *p)
337 {
338     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
339     FIXME("(%p)->(%p)\n", This, p);
340     return E_NOTIMPL;
341 }
342
343 static HRESULT WINAPI HTMLAnchorElement_get_protocolLong(IHTMLAnchorElement *iface, BSTR *p)
344 {
345     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
346     FIXME("(%p)->(%p)\n", This, p);
347     return E_NOTIMPL;
348 }
349
350 static HRESULT WINAPI HTMLAnchorElement_get_mimeType(IHTMLAnchorElement *iface, BSTR *p)
351 {
352     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
353     FIXME("(%p)->(%p)\n", This, p);
354     return E_NOTIMPL;
355 }
356
357 static HRESULT WINAPI HTMLAnchorElement_get_nameProp(IHTMLAnchorElement *iface, BSTR *p)
358 {
359     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
360     FIXME("(%p)->(%p)\n", This, p);
361     return E_NOTIMPL;
362 }
363
364 static HRESULT WINAPI HTMLAnchorElement_put_tabIndex(IHTMLAnchorElement *iface, short v)
365 {
366     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
367     FIXME("(%p)->()\n", This);
368     return E_NOTIMPL;
369 }
370
371 static HRESULT WINAPI HTMLAnchorElement_get_tabIndex(IHTMLAnchorElement *iface, short *p)
372 {
373     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
374     FIXME("(%p)->(%p)\n", This, p);
375     return E_NOTIMPL;
376 }
377
378 static HRESULT WINAPI HTMLAnchorElement_focus(IHTMLAnchorElement *iface)
379 {
380     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
381     FIXME("(%p)\n", This);
382     return E_NOTIMPL;
383 }
384
385 static HRESULT WINAPI HTMLAnchorElement_blur(IHTMLAnchorElement *iface)
386 {
387     HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
388     FIXME("(%p)\n", This);
389     return E_NOTIMPL;
390 }
391
392 #undef HTMLANCHOR_THIS
393
394 static const IHTMLAnchorElementVtbl HTMLAnchorElementVtbl = {
395     HTMLAnchorElement_QueryInterface,
396     HTMLAnchorElement_AddRef,
397     HTMLAnchorElement_Release,
398     HTMLAnchorElement_GetTypeInfoCount,
399     HTMLAnchorElement_GetTypeInfo,
400     HTMLAnchorElement_GetIDsOfNames,
401     HTMLAnchorElement_Invoke,
402     HTMLAnchorElement_put_href,
403     HTMLAnchorElement_get_href,
404     HTMLAnchorElement_put_target,
405     HTMLAnchorElement_get_target,
406     HTMLAnchorElement_put_rel,
407     HTMLAnchorElement_get_rel,
408     HTMLAnchorElement_put_rev,
409     HTMLAnchorElement_get_rev,
410     HTMLAnchorElement_put_urn,
411     HTMLAnchorElement_get_urn,
412     HTMLAnchorElement_put_Methods,
413     HTMLAnchorElement_get_Methods,
414     HTMLAnchorElement_put_name,
415     HTMLAnchorElement_get_name,
416     HTMLAnchorElement_put_host,
417     HTMLAnchorElement_get_host,
418     HTMLAnchorElement_put_hostname,
419     HTMLAnchorElement_get_hostname,
420     HTMLAnchorElement_put_pathname,
421     HTMLAnchorElement_get_pathname,
422     HTMLAnchorElement_put_port,
423     HTMLAnchorElement_get_port,
424     HTMLAnchorElement_put_protocol,
425     HTMLAnchorElement_get_protocol,
426     HTMLAnchorElement_put_search,
427     HTMLAnchorElement_get_search,
428     HTMLAnchorElement_put_hash,
429     HTMLAnchorElement_get_hash,
430     HTMLAnchorElement_put_onblur,
431     HTMLAnchorElement_get_onblur,
432     HTMLAnchorElement_put_onfocus,
433     HTMLAnchorElement_get_onfocus,
434     HTMLAnchorElement_put_accessKey,
435     HTMLAnchorElement_get_accessKey,
436     HTMLAnchorElement_get_protocolLong,
437     HTMLAnchorElement_get_mimeType,
438     HTMLAnchorElement_get_nameProp,
439     HTMLAnchorElement_put_tabIndex,
440     HTMLAnchorElement_get_tabIndex,
441     HTMLAnchorElement_focus,
442     HTMLAnchorElement_blur
443 };
444
445 #define HTMLANCHOR_NODE_THIS(iface) DEFINE_THIS2(HTMLAnchorElement, element.node, iface)
446
447 static HRESULT HTMLAnchorElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
448 {
449     HTMLAnchorElement *This = HTMLANCHOR_NODE_THIS(iface);
450
451     *ppv = NULL;
452
453     if(IsEqualGUID(&IID_IUnknown, riid)) {
454         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
455         *ppv = HTMLANCHOR(This);
456     }else if(IsEqualGUID(&IID_IDispatch, riid)) {
457         TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
458         *ppv = HTMLANCHOR(This);
459     }else if(IsEqualGUID(&IID_IHTMLAnchorElement, riid)) {
460         TRACE("(%p)->(IID_IHTMLAnchorElement %p)\n", This, ppv);
461         *ppv = HTMLANCHOR(This);
462     }
463
464     if(*ppv) {
465         IUnknown_AddRef((IUnknown*)*ppv);
466         return S_OK;
467     }
468
469     return HTMLElement_QI(&This->element.node, riid, ppv);
470 }
471
472 static void HTMLAnchorElement_destructor(HTMLDOMNode *iface)
473 {
474     HTMLAnchorElement *This = HTMLANCHOR_NODE_THIS(iface);
475     HTMLElement_destructor(&This->element.node);
476 }
477
478 #undef HTMLANCHOR_NODE_THIS
479
480 static const NodeImplVtbl HTMLAnchorElementImplVtbl = {
481     HTMLAnchorElement_QI,
482     HTMLAnchorElement_destructor
483 };
484
485 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement *nselem)
486 {
487     HTMLAnchorElement *ret = mshtml_alloc(sizeof(HTMLAnchorElement));
488
489     ret->lpHTMLAnchorElementVtbl = &HTMLAnchorElementVtbl;
490     ret->element.node.vtbl = &HTMLAnchorElementImplVtbl;
491
492     return &ret->element;
493 }