d3d10: Add ID3D10EffectStringVariableVtbl.
[wine/testsucceed.git] / dlls / mshtml / htmlanchor.c
blob09c7eda8d0b05531755f49aa21e41e066b9446b6
1 /*
2 * Copyright 2007 Jacek Caban for CodeWeavers
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.
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.
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
19 #include <stdarg.h>
20 #include <stdio.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
29 #include "wine/debug.h"
31 #include "mshtml_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
35 typedef struct {
36 HTMLElement element;
38 const IHTMLAnchorElementVtbl *lpHTMLAnchorElementVtbl;
40 nsIDOMHTMLAnchorElement *nsanchor;
41 } HTMLAnchorElement;
43 #define HTMLANCHOR(x) (&(x)->lpHTMLAnchorElementVtbl)
45 #define HTMLANCHOR_THIS(iface) DEFINE_THIS(HTMLAnchorElement, HTMLAnchorElement, iface)
47 static HRESULT WINAPI HTMLAnchorElement_QueryInterface(IHTMLAnchorElement *iface,
48 REFIID riid, void **ppv)
50 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
52 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
55 static ULONG WINAPI HTMLAnchorElement_AddRef(IHTMLAnchorElement *iface)
57 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
59 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
62 static ULONG WINAPI HTMLAnchorElement_Release(IHTMLAnchorElement *iface)
64 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
66 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
69 static HRESULT WINAPI HTMLAnchorElement_GetTypeInfoCount(IHTMLAnchorElement *iface, UINT *pctinfo)
71 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
72 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->element.node.dispex), pctinfo);
75 static HRESULT WINAPI HTMLAnchorElement_GetTypeInfo(IHTMLAnchorElement *iface, UINT iTInfo,
76 LCID lcid, ITypeInfo **ppTInfo)
78 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
79 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->element.node.dispex), iTInfo, lcid, ppTInfo);
82 static HRESULT WINAPI HTMLAnchorElement_GetIDsOfNames(IHTMLAnchorElement *iface, REFIID riid,
83 LPOLESTR *rgszNames, UINT cNames,
84 LCID lcid, DISPID *rgDispId)
86 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
87 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
90 static HRESULT WINAPI HTMLAnchorElement_Invoke(IHTMLAnchorElement *iface, DISPID dispIdMember,
91 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
92 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
94 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
95 return IDispatchEx_Invoke(DISPATCHEX(&This->element.node.dispex), dispIdMember, riid, lcid,
96 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
99 static HRESULT WINAPI HTMLAnchorElement_put_href(IHTMLAnchorElement *iface, BSTR v)
101 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
102 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
103 return E_NOTIMPL;
106 static HRESULT WINAPI HTMLAnchorElement_get_href(IHTMLAnchorElement *iface, BSTR *p)
108 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
109 nsAString href_str;
110 nsresult nsres;
111 HRESULT hres;
113 TRACE("(%p)->(%p)\n", This, p);
115 nsAString_Init(&href_str, NULL);
116 nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
117 if(NS_SUCCEEDED(nsres)) {
118 const PRUnichar *href;
120 nsAString_GetData(&href_str, &href);
121 hres = nsuri_to_url(href, TRUE, p);
122 }else {
123 ERR("GetHref failed: %08x\n", nsres);
124 hres = E_FAIL;
127 nsAString_Finish(&href_str);
128 return hres;
131 static HRESULT WINAPI HTMLAnchorElement_put_target(IHTMLAnchorElement *iface, BSTR v)
133 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
134 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
135 return E_NOTIMPL;
138 static HRESULT WINAPI HTMLAnchorElement_get_target(IHTMLAnchorElement *iface, BSTR *p)
140 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
141 FIXME("(%p)->(%p)\n", This, p);
142 return E_NOTIMPL;
145 static HRESULT WINAPI HTMLAnchorElement_put_rel(IHTMLAnchorElement *iface, BSTR v)
147 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
148 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
149 return E_NOTIMPL;
152 static HRESULT WINAPI HTMLAnchorElement_get_rel(IHTMLAnchorElement *iface, BSTR *p)
154 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
155 FIXME("(%p)->(%p)\n", This, p);
156 return E_NOTIMPL;
159 static HRESULT WINAPI HTMLAnchorElement_put_rev(IHTMLAnchorElement *iface, BSTR v)
161 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
162 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
163 return E_NOTIMPL;
166 static HRESULT WINAPI HTMLAnchorElement_get_rev(IHTMLAnchorElement *iface, BSTR *p)
168 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
169 FIXME("(%p)->(%p)\n", This, p);
170 return E_NOTIMPL;
173 static HRESULT WINAPI HTMLAnchorElement_put_urn(IHTMLAnchorElement *iface, BSTR v)
175 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
176 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
177 return E_NOTIMPL;
180 static HRESULT WINAPI HTMLAnchorElement_get_urn(IHTMLAnchorElement *iface, BSTR *p)
182 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
183 FIXME("(%p)->(%p)\n", This, p);
184 return E_NOTIMPL;
187 static HRESULT WINAPI HTMLAnchorElement_put_Methods(IHTMLAnchorElement *iface, BSTR v)
189 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
190 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
191 return E_NOTIMPL;
194 static HRESULT WINAPI HTMLAnchorElement_get_Methods(IHTMLAnchorElement *iface, BSTR *p)
196 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
197 FIXME("(%p)->(%p)\n", This, p);
198 return E_NOTIMPL;
201 static HRESULT WINAPI HTMLAnchorElement_put_name(IHTMLAnchorElement *iface, BSTR v)
203 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
204 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
205 return E_NOTIMPL;
208 static HRESULT WINAPI HTMLAnchorElement_get_name(IHTMLAnchorElement *iface, BSTR *p)
210 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
211 FIXME("(%p)->(%p)\n", This, p);
212 return E_NOTIMPL;
215 static HRESULT WINAPI HTMLAnchorElement_put_host(IHTMLAnchorElement *iface, BSTR v)
217 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
218 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
219 return E_NOTIMPL;
222 static HRESULT WINAPI HTMLAnchorElement_get_host(IHTMLAnchorElement *iface, BSTR *p)
224 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
225 FIXME("(%p)->(%p)\n", This, p);
226 return E_NOTIMPL;
229 static HRESULT WINAPI HTMLAnchorElement_put_hostname(IHTMLAnchorElement *iface, BSTR v)
231 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
232 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
233 return E_NOTIMPL;
236 static HRESULT WINAPI HTMLAnchorElement_get_hostname(IHTMLAnchorElement *iface, BSTR *p)
238 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
239 FIXME("(%p)->(%p)\n", This, p);
240 return E_NOTIMPL;
243 static HRESULT WINAPI HTMLAnchorElement_put_pathname(IHTMLAnchorElement *iface, BSTR v)
245 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
246 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
247 return E_NOTIMPL;
250 static HRESULT WINAPI HTMLAnchorElement_get_pathname(IHTMLAnchorElement *iface, BSTR *p)
252 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
253 FIXME("(%p)->(%p)\n", This, p);
254 return E_NOTIMPL;
257 static HRESULT WINAPI HTMLAnchorElement_put_port(IHTMLAnchorElement *iface, BSTR v)
259 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
260 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
261 return E_NOTIMPL;
264 static HRESULT WINAPI HTMLAnchorElement_get_port(IHTMLAnchorElement *iface, BSTR *p)
266 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
267 FIXME("(%p)->(%p)\n", This, p);
268 return E_NOTIMPL;
271 static HRESULT WINAPI HTMLAnchorElement_put_protocol(IHTMLAnchorElement *iface, BSTR v)
273 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
274 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
275 return E_NOTIMPL;
278 static HRESULT WINAPI HTMLAnchorElement_get_protocol(IHTMLAnchorElement *iface, BSTR *p)
280 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
281 FIXME("(%p)->(%p)\n", This, p);
282 return E_NOTIMPL;
285 static HRESULT WINAPI HTMLAnchorElement_put_search(IHTMLAnchorElement *iface, BSTR v)
287 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
288 FIXME("(%p)->(%p)\n", This, debugstr_w(v));
289 return E_NOTIMPL;
292 static HRESULT WINAPI HTMLAnchorElement_get_search(IHTMLAnchorElement *iface, BSTR *p)
294 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
295 FIXME("(%p)->(%p)\n", This, p);
296 return E_NOTIMPL;
299 static HRESULT WINAPI HTMLAnchorElement_put_hash(IHTMLAnchorElement *iface, BSTR v)
301 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
302 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
303 return E_NOTIMPL;
306 static HRESULT WINAPI HTMLAnchorElement_get_hash(IHTMLAnchorElement *iface, BSTR *p)
308 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
309 FIXME("(%p)->(%p)\n", This, p);
310 return E_NOTIMPL;
313 static HRESULT WINAPI HTMLAnchorElement_put_onblur(IHTMLAnchorElement *iface, VARIANT v)
315 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
316 FIXME("(%p)->()\n", This);
317 return E_NOTIMPL;
320 static HRESULT WINAPI HTMLAnchorElement_get_onblur(IHTMLAnchorElement *iface, VARIANT *p)
322 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
323 FIXME("(%p)->(%p)\n", This, p);
324 return E_NOTIMPL;
327 static HRESULT WINAPI HTMLAnchorElement_put_onfocus(IHTMLAnchorElement *iface, VARIANT v)
329 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
330 FIXME("(%p)->()\n", This);
331 return E_NOTIMPL;
334 static HRESULT WINAPI HTMLAnchorElement_get_onfocus(IHTMLAnchorElement *iface, VARIANT *p)
336 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
337 FIXME("(%p)->(%p)\n", This, p);
338 return E_NOTIMPL;
341 static HRESULT WINAPI HTMLAnchorElement_put_accessKey(IHTMLAnchorElement *iface, BSTR v)
343 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
344 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
345 return E_NOTIMPL;
348 static HRESULT WINAPI HTMLAnchorElement_get_accessKey(IHTMLAnchorElement *iface, BSTR *p)
350 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
351 FIXME("(%p)->(%p)\n", This, p);
352 return E_NOTIMPL;
355 static HRESULT WINAPI HTMLAnchorElement_get_protocolLong(IHTMLAnchorElement *iface, BSTR *p)
357 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
358 FIXME("(%p)->(%p)\n", This, p);
359 return E_NOTIMPL;
362 static HRESULT WINAPI HTMLAnchorElement_get_mimeType(IHTMLAnchorElement *iface, BSTR *p)
364 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
365 FIXME("(%p)->(%p)\n", This, p);
366 return E_NOTIMPL;
369 static HRESULT WINAPI HTMLAnchorElement_get_nameProp(IHTMLAnchorElement *iface, BSTR *p)
371 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
372 FIXME("(%p)->(%p)\n", This, p);
373 return E_NOTIMPL;
376 static HRESULT WINAPI HTMLAnchorElement_put_tabIndex(IHTMLAnchorElement *iface, short v)
378 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
379 FIXME("(%p)->()\n", This);
380 return E_NOTIMPL;
383 static HRESULT WINAPI HTMLAnchorElement_get_tabIndex(IHTMLAnchorElement *iface, short *p)
385 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
386 FIXME("(%p)->(%p)\n", This, p);
387 return E_NOTIMPL;
390 static HRESULT WINAPI HTMLAnchorElement_focus(IHTMLAnchorElement *iface)
392 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
393 FIXME("(%p)\n", This);
394 return E_NOTIMPL;
397 static HRESULT WINAPI HTMLAnchorElement_blur(IHTMLAnchorElement *iface)
399 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
400 FIXME("(%p)\n", This);
401 return E_NOTIMPL;
404 #undef HTMLANCHOR_THIS
406 static const IHTMLAnchorElementVtbl HTMLAnchorElementVtbl = {
407 HTMLAnchorElement_QueryInterface,
408 HTMLAnchorElement_AddRef,
409 HTMLAnchorElement_Release,
410 HTMLAnchorElement_GetTypeInfoCount,
411 HTMLAnchorElement_GetTypeInfo,
412 HTMLAnchorElement_GetIDsOfNames,
413 HTMLAnchorElement_Invoke,
414 HTMLAnchorElement_put_href,
415 HTMLAnchorElement_get_href,
416 HTMLAnchorElement_put_target,
417 HTMLAnchorElement_get_target,
418 HTMLAnchorElement_put_rel,
419 HTMLAnchorElement_get_rel,
420 HTMLAnchorElement_put_rev,
421 HTMLAnchorElement_get_rev,
422 HTMLAnchorElement_put_urn,
423 HTMLAnchorElement_get_urn,
424 HTMLAnchorElement_put_Methods,
425 HTMLAnchorElement_get_Methods,
426 HTMLAnchorElement_put_name,
427 HTMLAnchorElement_get_name,
428 HTMLAnchorElement_put_host,
429 HTMLAnchorElement_get_host,
430 HTMLAnchorElement_put_hostname,
431 HTMLAnchorElement_get_hostname,
432 HTMLAnchorElement_put_pathname,
433 HTMLAnchorElement_get_pathname,
434 HTMLAnchorElement_put_port,
435 HTMLAnchorElement_get_port,
436 HTMLAnchorElement_put_protocol,
437 HTMLAnchorElement_get_protocol,
438 HTMLAnchorElement_put_search,
439 HTMLAnchorElement_get_search,
440 HTMLAnchorElement_put_hash,
441 HTMLAnchorElement_get_hash,
442 HTMLAnchorElement_put_onblur,
443 HTMLAnchorElement_get_onblur,
444 HTMLAnchorElement_put_onfocus,
445 HTMLAnchorElement_get_onfocus,
446 HTMLAnchorElement_put_accessKey,
447 HTMLAnchorElement_get_accessKey,
448 HTMLAnchorElement_get_protocolLong,
449 HTMLAnchorElement_get_mimeType,
450 HTMLAnchorElement_get_nameProp,
451 HTMLAnchorElement_put_tabIndex,
452 HTMLAnchorElement_get_tabIndex,
453 HTMLAnchorElement_focus,
454 HTMLAnchorElement_blur
457 #define HTMLANCHOR_NODE_THIS(iface) DEFINE_THIS2(HTMLAnchorElement, element.node, iface)
459 static HRESULT HTMLAnchorElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
461 HTMLAnchorElement *This = HTMLANCHOR_NODE_THIS(iface);
463 *ppv = NULL;
465 if(IsEqualGUID(&IID_IUnknown, riid)) {
466 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
467 *ppv = HTMLANCHOR(This);
468 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
469 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
470 *ppv = HTMLANCHOR(This);
471 }else if(IsEqualGUID(&IID_IHTMLAnchorElement, riid)) {
472 TRACE("(%p)->(IID_IHTMLAnchorElement %p)\n", This, ppv);
473 *ppv = HTMLANCHOR(This);
476 if(*ppv) {
477 IUnknown_AddRef((IUnknown*)*ppv);
478 return S_OK;
481 return HTMLElement_QI(&This->element.node, riid, ppv);
484 static void HTMLAnchorElement_destructor(HTMLDOMNode *iface)
486 HTMLAnchorElement *This = HTMLANCHOR_NODE_THIS(iface);
488 if(This->nsanchor)
489 nsIDOMHTMLAnchorElement_Release(This->nsanchor);
491 HTMLElement_destructor(&This->element.node);
494 #undef HTMLANCHOR_NODE_THIS
496 static const NodeImplVtbl HTMLAnchorElementImplVtbl = {
497 HTMLAnchorElement_QI,
498 HTMLAnchorElement_destructor
501 static const tid_t HTMLAnchorElement_iface_tids[] = {
502 IHTMLAnchorElement_tid,
503 IHTMLDOMNode_tid,
504 IHTMLDOMNode2_tid,
505 IHTMLElement_tid,
506 IHTMLElement2_tid,
507 IHTMLElement3_tid,
508 IHTMLElement4_tid,
509 IHTMLTextContainer_tid,
510 IHTMLUniqueName_tid,
514 static dispex_static_data_t HTMLAnchorElement_dispex = {
515 NULL,
516 DispHTMLAnchorElement_tid,
517 NULL,
518 HTMLAnchorElement_iface_tids
521 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement *nselem)
523 HTMLAnchorElement *ret = heap_alloc_zero(sizeof(HTMLAnchorElement));
524 nsresult nsres;
526 ret->lpHTMLAnchorElementVtbl = &HTMLAnchorElementVtbl;
527 ret->element.node.vtbl = &HTMLAnchorElementImplVtbl;
529 HTMLElement_Init(&ret->element, &HTMLAnchorElement_dispex);
531 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLAnchorElement, (void**)&ret->nsanchor);
532 if(NS_FAILED(nsres))
533 ERR("Could not get nsIDOMHTMLAnchorElement iface: %08x\n", nsres);
535 return &ret->element;