push cc8bc80451cc24f4d7cf75168b569f0ebfe19547
[wine/hacks.git] / dlls / mshtml / htmllocation.c
blobc671073b84b25fcc2b77940f2c6489da4e24120e
1 /*
2 * Copyright 2008 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>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
31 #include "resource.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
35 #define HTMLLOCATION_THIS(iface) DEFINE_THIS(HTMLLocation, HTMLLocation, iface)
37 static HRESULT WINAPI HTMLLocation_QueryInterface(IHTMLLocation *iface, REFIID riid, void **ppv)
39 HTMLLocation *This = HTMLLOCATION_THIS(iface);
41 *ppv = NULL;
43 if(IsEqualGUID(&IID_IUnknown, riid)) {
44 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
45 *ppv = HTMLLOCATION(This);
46 }else if(IsEqualGUID(&IID_IHTMLLocation, riid)) {
47 TRACE("(%p)->(IID_IHTMLLocation %p)\n", This, ppv);
48 *ppv = HTMLLOCATION(This);
49 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
50 return *ppv ? S_OK : E_NOINTERFACE;
53 if(*ppv) {
54 IUnknown_AddRef((IUnknown*)*ppv);
55 return S_OK;
58 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
59 return E_NOINTERFACE;
62 static ULONG WINAPI HTMLLocation_AddRef(IHTMLLocation *iface)
64 HTMLLocation *This = HTMLLOCATION_THIS(iface);
65 LONG ref = InterlockedIncrement(&This->ref);
67 TRACE("(%p) ref=%d\n", This, ref);
69 return ref;
72 static ULONG WINAPI HTMLLocation_Release(IHTMLLocation *iface)
74 HTMLLocation *This = HTMLLOCATION_THIS(iface);
75 LONG ref = InterlockedDecrement(&This->ref);
77 TRACE("(%p) ref=%d\n", This, ref);
79 if(!ref) {
80 if(This->doc && This->doc->location == This)
81 This->doc->location = NULL;
82 heap_free(This);
85 return ref;
88 static HRESULT WINAPI HTMLLocation_GetTypeInfoCount(IHTMLLocation *iface, UINT *pctinfo)
90 HTMLLocation *This = HTMLLOCATION_THIS(iface);
91 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo);
94 static HRESULT WINAPI HTMLLocation_GetTypeInfo(IHTMLLocation *iface, UINT iTInfo,
95 LCID lcid, ITypeInfo **ppTInfo)
97 HTMLLocation *This = HTMLLOCATION_THIS(iface);
98 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
101 static HRESULT WINAPI HTMLLocation_GetIDsOfNames(IHTMLLocation *iface, REFIID riid,
102 LPOLESTR *rgszNames, UINT cNames,
103 LCID lcid, DISPID *rgDispId)
105 HTMLLocation *This = HTMLLOCATION_THIS(iface);
106 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
109 static HRESULT WINAPI HTMLLocation_Invoke(IHTMLLocation *iface, DISPID dispIdMember,
110 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
111 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
113 HTMLLocation *This = HTMLLOCATION_THIS(iface);
114 return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid,
115 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
118 static HRESULT WINAPI HTMLLocation_put_href(IHTMLLocation *iface, BSTR v)
120 HTMLLocation *This = HTMLLOCATION_THIS(iface);
121 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
122 return E_NOTIMPL;
125 static HRESULT WINAPI HTMLLocation_get_href(IHTMLLocation *iface, BSTR *p)
127 HTMLLocation *This = HTMLLOCATION_THIS(iface);
128 FIXME("(%p)->(%p)\n", This, p);
129 return E_NOTIMPL;
132 static HRESULT WINAPI HTMLLocation_put_protocol(IHTMLLocation *iface, BSTR v)
134 HTMLLocation *This = HTMLLOCATION_THIS(iface);
135 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
136 return E_NOTIMPL;
139 static HRESULT WINAPI HTMLLocation_get_protocol(IHTMLLocation *iface, BSTR *p)
141 HTMLLocation *This = HTMLLOCATION_THIS(iface);
142 FIXME("(%p)->(%p)\n", This, p);
143 return E_NOTIMPL;
146 static HRESULT WINAPI HTMLLocation_put_host(IHTMLLocation *iface, BSTR v)
148 HTMLLocation *This = HTMLLOCATION_THIS(iface);
149 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
150 return E_NOTIMPL;
153 static HRESULT WINAPI HTMLLocation_get_host(IHTMLLocation *iface, BSTR *p)
155 HTMLLocation *This = HTMLLOCATION_THIS(iface);
156 FIXME("(%p)->(%p)\n", This, p);
157 return E_NOTIMPL;
160 static HRESULT WINAPI HTMLLocation_put_hostname(IHTMLLocation *iface, BSTR v)
162 HTMLLocation *This = HTMLLOCATION_THIS(iface);
163 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
164 return E_NOTIMPL;
167 static HRESULT WINAPI HTMLLocation_get_hostname(IHTMLLocation *iface, BSTR *p)
169 HTMLLocation *This = HTMLLOCATION_THIS(iface);
170 FIXME("(%p)->(%p)\n", This, p);
171 return E_NOTIMPL;
174 static HRESULT WINAPI HTMLLocation_put_port(IHTMLLocation *iface, BSTR v)
176 HTMLLocation *This = HTMLLOCATION_THIS(iface);
177 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
178 return E_NOTIMPL;
181 static HRESULT WINAPI HTMLLocation_get_port(IHTMLLocation *iface, BSTR *p)
183 HTMLLocation *This = HTMLLOCATION_THIS(iface);
184 FIXME("(%p)->(%p)\n", This, p);
185 return E_NOTIMPL;
188 static HRESULT WINAPI HTMLLocation_put_pathname(IHTMLLocation *iface, BSTR v)
190 HTMLLocation *This = HTMLLOCATION_THIS(iface);
191 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
192 return E_NOTIMPL;
195 static HRESULT WINAPI HTMLLocation_get_pathname(IHTMLLocation *iface, BSTR *p)
197 HTMLLocation *This = HTMLLOCATION_THIS(iface);
198 FIXME("(%p)->(%p)\n", This, p);
199 return E_NOTIMPL;
202 static HRESULT WINAPI HTMLLocation_put_search(IHTMLLocation *iface, BSTR v)
204 HTMLLocation *This = HTMLLOCATION_THIS(iface);
205 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
206 return E_NOTIMPL;
209 static HRESULT WINAPI HTMLLocation_get_search(IHTMLLocation *iface, BSTR *p)
211 HTMLLocation *This = HTMLLOCATION_THIS(iface);
212 FIXME("(%p)->(%p)\n", This, p);
213 return E_NOTIMPL;
216 static HRESULT WINAPI HTMLLocation_put_hash(IHTMLLocation *iface, BSTR v)
218 HTMLLocation *This = HTMLLOCATION_THIS(iface);
219 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
220 return E_NOTIMPL;
223 static HRESULT WINAPI HTMLLocation_get_hash(IHTMLLocation *iface, BSTR *p)
225 HTMLLocation *This = HTMLLOCATION_THIS(iface);
226 FIXME("(%p)->(%p)\n", This, p);
227 return E_NOTIMPL;
230 static HRESULT WINAPI HTMLLocation_reload(IHTMLLocation *iface, VARIANT_BOOL flag)
232 HTMLLocation *This = HTMLLOCATION_THIS(iface);
233 FIXME("(%p)->(%x)\n", This, flag);
234 return E_NOTIMPL;
237 static HRESULT WINAPI HTMLLocation_replace(IHTMLLocation *iface, BSTR bstr)
239 HTMLLocation *This = HTMLLOCATION_THIS(iface);
240 FIXME("(%p)->(%s)\n", This, debugstr_w(bstr));
241 return E_NOTIMPL;
244 static HRESULT WINAPI HTMLLocation_assign(IHTMLLocation *iface, BSTR bstr)
246 HTMLLocation *This = HTMLLOCATION_THIS(iface);
247 FIXME("(%p)->(%s)\n", This, debugstr_w(bstr));
248 return E_NOTIMPL;
251 static HRESULT WINAPI HTMLLocation_toString(IHTMLLocation *iface, BSTR *String)
253 HTMLLocation *This = HTMLLOCATION_THIS(iface);
254 FIXME("(%p)->(%p)\n", This, String);
255 return E_NOTIMPL;
258 #undef HTMLLOCATION_THIS
260 static const IHTMLLocationVtbl HTMLLocationVtbl = {
261 HTMLLocation_QueryInterface,
262 HTMLLocation_AddRef,
263 HTMLLocation_Release,
264 HTMLLocation_GetTypeInfoCount,
265 HTMLLocation_GetTypeInfo,
266 HTMLLocation_GetIDsOfNames,
267 HTMLLocation_Invoke,
268 HTMLLocation_put_href,
269 HTMLLocation_get_href,
270 HTMLLocation_put_protocol,
271 HTMLLocation_get_protocol,
272 HTMLLocation_put_host,
273 HTMLLocation_get_host,
274 HTMLLocation_put_hostname,
275 HTMLLocation_get_hostname,
276 HTMLLocation_put_port,
277 HTMLLocation_get_port,
278 HTMLLocation_put_pathname,
279 HTMLLocation_get_pathname,
280 HTMLLocation_put_search,
281 HTMLLocation_get_search,
282 HTMLLocation_put_hash,
283 HTMLLocation_get_hash,
284 HTMLLocation_reload,
285 HTMLLocation_replace,
286 HTMLLocation_assign,
287 HTMLLocation_toString
290 static const tid_t HTMLLocation_iface_tids[] = {
291 IHTMLLocation_tid,
294 static dispex_static_data_t HTMLLocation_dispex = {
295 NULL,
296 IHTMLLocation_tid,
297 NULL,
298 HTMLLocation_iface_tids
302 HTMLLocation *HTMLLocation_Create(HTMLDocument *doc)
304 HTMLLocation *ret = heap_alloc(sizeof(*ret));
306 ret->lpHTMLLocationVtbl = &HTMLLocationVtbl;
307 ret->ref = 1;
308 ret->doc = doc;
310 init_dispex(&ret->dispex, (IUnknown*)HTMLLOCATION(ret), &HTMLLocation_dispex);
312 return ret;