push cc8bc80451cc24f4d7cf75168b569f0ebfe19547
[wine/hacks.git] / dlls / mshtml / htmldoc5.c
blobbd54cc476ad14cc4d57d9043dd1f26b6f2ab6598
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 "config.h"
21 #include <stdarg.h>
22 #include <stdio.h>
24 #define COBJMACROS
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "ole2.h"
31 #include "wine/debug.h"
33 #include "mshtml_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
37 #define HTMLDOC5_THIS(iface) DEFINE_THIS(HTMLDocument, HTMLDocument5, iface)
39 static HRESULT WINAPI HTMLDocument5_QueryInterface(IHTMLDocument5 *iface,
40 REFIID riid, void **ppv)
42 HTMLDocument *This = HTMLDOC5_THIS(iface);
43 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
46 static ULONG WINAPI HTMLDocument5_AddRef(IHTMLDocument5 *iface)
48 HTMLDocument *This = HTMLDOC5_THIS(iface);
49 return IHTMLDocument2_AddRef(HTMLDOC(This));
52 static ULONG WINAPI HTMLDocument5_Release(IHTMLDocument5 *iface)
54 HTMLDocument *This = HTMLDOC5_THIS(iface);
55 return IHTMLDocument2_Release(HTMLDOC(This));
58 static HRESULT WINAPI HTMLDocument5_GetTypeInfoCount(IHTMLDocument5 *iface, UINT *pctinfo)
60 HTMLDocument *This = HTMLDOC5_THIS(iface);
61 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo);
64 static HRESULT WINAPI HTMLDocument5_GetTypeInfo(IHTMLDocument5 *iface, UINT iTInfo,
65 LCID lcid, ITypeInfo **ppTInfo)
67 HTMLDocument *This = HTMLDOC5_THIS(iface);
68 return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo);
71 static HRESULT WINAPI HTMLDocument5_GetIDsOfNames(IHTMLDocument5 *iface, REFIID riid,
72 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
74 HTMLDocument *This = HTMLDOC5_THIS(iface);
75 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId);
78 static HRESULT WINAPI HTMLDocument5_Invoke(IHTMLDocument5 *iface, DISPID dispIdMember,
79 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
80 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
82 HTMLDocument *This = HTMLDOC5_THIS(iface);
83 return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams,
84 pVarResult, pExcepInfo, puArgErr);
87 static HRESULT WINAPI HTMLDocument5_put_onmousewheel(IHTMLDocument5 *iface, VARIANT v)
89 HTMLDocument *This = HTMLDOC5_THIS(iface);
90 FIXME("(%p)->(v)\n", This);
91 return E_NOTIMPL;
94 static HRESULT WINAPI HTMLDocument5_get_onmousewheel(IHTMLDocument5 *iface, VARIANT *p)
96 HTMLDocument *This = HTMLDOC5_THIS(iface);
97 FIXME("(%p)->(%p)\n", This, p);
98 return E_NOTIMPL;
101 static HRESULT WINAPI HTMLDocument5_get_doctype(IHTMLDocument5 *iface, IHTMLDOMNode **p)
103 HTMLDocument *This = HTMLDOC5_THIS(iface);
104 FIXME("(%p)->(%p)\n", This, p);
105 return E_NOTIMPL;
108 static HRESULT WINAPI HTMLDocument5_get_implementation(IHTMLDocument5 *iface, IHTMLDOMImplementation **p)
110 HTMLDocument *This = HTMLDOC5_THIS(iface);
111 FIXME("(%p)->(%p)\n", This, p);
112 return E_NOTIMPL;
115 static HRESULT WINAPI HTMLDocument5_createAttribute(IHTMLDocument5 *iface, BSTR bstrattrName,
116 IHTMLDOMAttribute **ppattribute)
118 HTMLDocument *This = HTMLDOC5_THIS(iface);
119 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrattrName), ppattribute);
120 return E_NOTIMPL;
123 static HRESULT WINAPI HTMLDocument5_createComment(IHTMLDocument5 *iface, BSTR bstrdata,
124 IHTMLDOMNode **ppRetNode)
126 HTMLDocument *This = HTMLDOC5_THIS(iface);
127 nsIDOMComment *nscomment;
128 HTMLDOMNode *node;
129 nsAString str;
130 nsresult nsres;
132 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrdata), ppRetNode);
134 if(!This->nsdoc) {
135 WARN("NULL nsdoc\n");
136 return E_UNEXPECTED;
139 nsAString_Init(&str, bstrdata);
140 nsres = nsIDOMHTMLDocument_CreateComment(This->nsdoc, &str, &nscomment);
141 nsAString_Finish(&str);
142 if(NS_FAILED(nsres)) {
143 ERR("CreateTextNode failed: %08x\n", nsres);
144 return E_FAIL;
147 node = &HTMLCommentElement_Create(This, (nsIDOMNode*)nscomment)->node;
148 nsIDOMElement_Release(nscomment);
150 *ppRetNode = HTMLDOMNODE(node);
151 IHTMLDOMNode_AddRef(HTMLDOMNODE(node));
152 return S_OK;
155 static HRESULT WINAPI HTMLDocument5_put_onfocusin(IHTMLDocument5 *iface, VARIANT v)
157 HTMLDocument *This = HTMLDOC5_THIS(iface);
158 FIXME("(%p)->(v)\n", This);
159 return E_NOTIMPL;
162 static HRESULT WINAPI HTMLDocument5_get_onfocusin(IHTMLDocument5 *iface, VARIANT *p)
164 HTMLDocument *This = HTMLDOC5_THIS(iface);
165 FIXME("(%p)->(%p)\n", This, p);
166 return E_NOTIMPL;
169 static HRESULT WINAPI HTMLDocument5_put_onfocusout(IHTMLDocument5 *iface, VARIANT v)
171 HTMLDocument *This = HTMLDOC5_THIS(iface);
172 FIXME("(%p)->(v)\n", This);
173 return E_NOTIMPL;
176 static HRESULT WINAPI HTMLDocument5_get_onfocusout(IHTMLDocument5 *iface, VARIANT *p)
178 HTMLDocument *This = HTMLDOC5_THIS(iface);
179 FIXME("(%p)->(%p)\n", This, p);
180 return E_NOTIMPL;
183 static HRESULT WINAPI HTMLDocument5_put_onactivate(IHTMLDocument5 *iface, VARIANT v)
185 HTMLDocument *This = HTMLDOC5_THIS(iface);
186 FIXME("(%p)->(v)\n", This);
187 return E_NOTIMPL;
190 static HRESULT WINAPI HTMLDocument5_get_onactivate(IHTMLDocument5 *iface, VARIANT *p)
192 HTMLDocument *This = HTMLDOC5_THIS(iface);
193 FIXME("(%p)->(%p)\n", This, p);
194 return E_NOTIMPL;
197 static HRESULT WINAPI HTMLDocument5_put_ondeactivate(IHTMLDocument5 *iface, VARIANT v)
199 HTMLDocument *This = HTMLDOC5_THIS(iface);
200 FIXME("(%p)->(v)\n", This);
201 return E_NOTIMPL;
204 static HRESULT WINAPI HTMLDocument5_get_ondeactivate(IHTMLDocument5 *iface, VARIANT *p)
206 HTMLDocument *This = HTMLDOC5_THIS(iface);
207 FIXME("(%p)->(%p)\n", This, p);
208 return E_NOTIMPL;
211 static HRESULT WINAPI HTMLDocument5_put_onbeforeactivate(IHTMLDocument5 *iface, VARIANT v)
213 HTMLDocument *This = HTMLDOC5_THIS(iface);
214 FIXME("(%p)->(v)\n", This);
215 return E_NOTIMPL;
218 static HRESULT WINAPI HTMLDocument5_get_onbeforeactivate(IHTMLDocument5 *iface, VARIANT *p)
220 HTMLDocument *This = HTMLDOC5_THIS(iface);
221 FIXME("(%p)->(%p)\n", This, p);
222 return E_NOTIMPL;
225 static HRESULT WINAPI HTMLDocument5_put_onbeforedeactivate(IHTMLDocument5 *iface, VARIANT v)
227 HTMLDocument *This = HTMLDOC5_THIS(iface);
228 FIXME("(%p)->(v)\n", This);
229 return E_NOTIMPL;
232 static HRESULT WINAPI HTMLDocument5_get_onbeforedeactivate(IHTMLDocument5 *iface, VARIANT *p)
234 HTMLDocument *This = HTMLDOC5_THIS(iface);
235 FIXME("(%p)->(%p)\n", This, p);
236 return E_NOTIMPL;
239 static HRESULT WINAPI HTMLDocument5_get_compatMode(IHTMLDocument5 *iface, BSTR *p)
241 HTMLDocument *This = HTMLDOC5_THIS(iface);
242 nsIDOMNSHTMLDocument *nshtmldoc;
243 nsAString mode_str;
244 const PRUnichar *mode;
245 nsresult nsres;
247 TRACE("(%p)->(%p)\n", This, p);
249 if(!This->nsdoc) {
250 WARN("NULL nsdoc\n");
251 return E_UNEXPECTED;
254 nsres = nsIDOMHTMLDocument_QueryInterface(This->nsdoc, &IID_nsIDOMNSHTMLDocument, (void**)&nshtmldoc);
255 if(NS_FAILED(nsres)) {
256 ERR("Could not get nsIDOMNSHTMLDocument: %08x\n", nsres);
257 return S_OK;
260 nsAString_Init(&mode_str, NULL);
261 nsIDOMNSHTMLDocument_GetCompatMode(nshtmldoc, &mode_str);
262 nsIDOMNSHTMLDocument_Release(nshtmldoc);
264 nsAString_GetData(&mode_str, &mode);
265 *p = SysAllocString(mode);
266 nsAString_Finish(&mode_str);
268 return S_OK;
271 #undef HTMLDOC5_THIS
273 static const IHTMLDocument5Vtbl HTMLDocument5Vtbl = {
274 HTMLDocument5_QueryInterface,
275 HTMLDocument5_AddRef,
276 HTMLDocument5_Release,
277 HTMLDocument5_GetTypeInfoCount,
278 HTMLDocument5_GetTypeInfo,
279 HTMLDocument5_GetIDsOfNames,
280 HTMLDocument5_Invoke,
281 HTMLDocument5_put_onmousewheel,
282 HTMLDocument5_get_onmousewheel,
283 HTMLDocument5_get_doctype,
284 HTMLDocument5_get_implementation,
285 HTMLDocument5_createAttribute,
286 HTMLDocument5_createComment,
287 HTMLDocument5_put_onfocusin,
288 HTMLDocument5_get_onfocusin,
289 HTMLDocument5_put_onfocusout,
290 HTMLDocument5_get_onfocusout,
291 HTMLDocument5_put_onactivate,
292 HTMLDocument5_get_onactivate,
293 HTMLDocument5_put_ondeactivate,
294 HTMLDocument5_get_ondeactivate,
295 HTMLDocument5_put_onbeforeactivate,
296 HTMLDocument5_get_onbeforeactivate,
297 HTMLDocument5_put_onbeforedeactivate,
298 HTMLDocument5_get_onbeforedeactivate,
299 HTMLDocument5_get_compatMode
302 void HTMLDocument_HTMLDocument5_Init(HTMLDocument *This)
304 This->lpHTMLDocument5Vtbl = &HTMLDocument5Vtbl;