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