comctl32/tests: Add NULL terminator to unicode string constant.
[wine/hramrach.git] / dlls / mshtml / htmldoc5.c
blob12742f641261de1a61a9af28f35902d04e644f1a
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->doc_node->nsdoc) {
135 WARN("NULL nsdoc\n");
136 return E_UNEXPECTED;
139 nsAString_InitDepend(&str, bstrdata);
140 nsres = nsIDOMHTMLDocument_CreateComment(This->doc_node->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->doc_node, (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->doc_node->nsdoc) {
250 WARN("NULL nsdoc\n");
251 return E_UNEXPECTED;
254 nsres = nsIDOMHTMLDocument_QueryInterface(This->doc_node->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 #define HTMLDOC6_THIS(iface) DEFINE_THIS(HTMLDocument, HTMLDocument6, iface)
304 static HRESULT WINAPI HTMLDocument6_QueryInterface(IHTMLDocument6 *iface,
305 REFIID riid, void **ppv)
307 HTMLDocument *This = HTMLDOC6_THIS(iface);
308 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
311 static ULONG WINAPI HTMLDocument6_AddRef(IHTMLDocument6 *iface)
313 HTMLDocument *This = HTMLDOC6_THIS(iface);
314 return IHTMLDocument2_AddRef(HTMLDOC(This));
317 static ULONG WINAPI HTMLDocument6_Release(IHTMLDocument6 *iface)
319 HTMLDocument *This = HTMLDOC6_THIS(iface);
320 return IHTMLDocument2_Release(HTMLDOC(This));
323 static HRESULT WINAPI HTMLDocument6_GetTypeInfoCount(IHTMLDocument6 *iface, UINT *pctinfo)
325 HTMLDocument *This = HTMLDOC6_THIS(iface);
326 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo);
329 static HRESULT WINAPI HTMLDocument6_GetTypeInfo(IHTMLDocument6 *iface, UINT iTInfo,
330 LCID lcid, ITypeInfo **ppTInfo)
332 HTMLDocument *This = HTMLDOC6_THIS(iface);
333 return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo);
336 static HRESULT WINAPI HTMLDocument6_GetIDsOfNames(IHTMLDocument6 *iface, REFIID riid,
337 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
339 HTMLDocument *This = HTMLDOC6_THIS(iface);
340 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId);
343 static HRESULT WINAPI HTMLDocument6_Invoke(IHTMLDocument6 *iface, DISPID dispIdMember,
344 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
345 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
347 HTMLDocument *This = HTMLDOC6_THIS(iface);
348 return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams,
349 pVarResult, pExcepInfo, puArgErr);
352 static HRESULT WINAPI HTMLDocument6_get_compatible(IHTMLDocument6 *iface,
353 IHTMLDocumentCompatibleInfoCollection **p)
355 HTMLDocument *This = HTMLDOC6_THIS(iface);
356 FIXME("(%p)->(%p)\n", This, p);
357 return E_NOTIMPL;
360 static HRESULT WINAPI HTMLDocument6_get_documentMode(IHTMLDocument6 *iface,
361 VARIANT *p)
363 HTMLDocument *This = HTMLDOC6_THIS(iface);
364 FIXME("(%p)->(%p)\n", This, p);
365 return E_NOTIMPL;
368 static HRESULT WINAPI HTMLDocument6_get_onstorage(IHTMLDocument6 *iface,
369 VARIANT *p)
371 HTMLDocument *This = HTMLDOC6_THIS(iface);
372 FIXME("(%p)->(%p)\n", This, p);
373 return E_NOTIMPL;
376 static HRESULT WINAPI HTMLDocument6_put_onstorage(IHTMLDocument6 *iface,
377 VARIANT p)
379 HTMLDocument *This = HTMLDOC6_THIS(iface);
380 FIXME("(%p)->(v)\n", This);
381 return E_NOTIMPL;
384 static HRESULT WINAPI HTMLDocument6_get_onstoragecommit(IHTMLDocument6 *iface,
385 VARIANT *p)
387 HTMLDocument *This = HTMLDOC6_THIS(iface);
388 FIXME("(%p)->(%p)\n", This, p);
389 return E_NOTIMPL;
392 static HRESULT WINAPI HTMLDocument6_put_onstoragecommit(IHTMLDocument6 *iface,
393 VARIANT p)
395 HTMLDocument *This = HTMLDOC6_THIS(iface);
396 FIXME("(%p)->(v)\n", This);
397 return E_NOTIMPL;
400 static HRESULT WINAPI HTMLDocument6_getElementById(IHTMLDocument6 *iface,
401 BSTR bstrId, IHTMLElement2 **p)
403 HTMLDocument *This = HTMLDOC6_THIS(iface);
404 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrId), p);
405 return E_NOTIMPL;
408 static HRESULT WINAPI HTMLDocument6_updateSettings(IHTMLDocument6 *iface)
410 HTMLDocument *This = HTMLDOC6_THIS(iface);
411 FIXME("(%p)->()\n", This);
412 return E_NOTIMPL;
415 #undef HTMLDOC6_THIS
417 static const IHTMLDocument6Vtbl HTMLDocument6Vtbl = {
418 HTMLDocument6_QueryInterface,
419 HTMLDocument6_AddRef,
420 HTMLDocument6_Release,
421 HTMLDocument6_GetTypeInfoCount,
422 HTMLDocument6_GetTypeInfo,
423 HTMLDocument6_GetIDsOfNames,
424 HTMLDocument6_Invoke,
425 HTMLDocument6_get_compatible,
426 HTMLDocument6_get_documentMode,
427 HTMLDocument6_put_onstorage,
428 HTMLDocument6_get_onstorage,
429 HTMLDocument6_put_onstoragecommit,
430 HTMLDocument6_get_onstoragecommit,
431 HTMLDocument6_getElementById,
432 HTMLDocument6_updateSettings
435 void HTMLDocument_HTMLDocument5_Init(HTMLDocument *This)
437 This->lpHTMLDocument5Vtbl = &HTMLDocument5Vtbl;
438 This->lpHTMLDocument6Vtbl = &HTMLDocument6Vtbl;