mshtml: Use stored nsdoc in IHTMLDocument2::write.
[wine] / dlls / mshtml / htmlelem3.c
1 /*
2  * Copyright 2008 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 <stdarg.h>
20
21 #define COBJMACROS
22
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
27
28 #include "wine/debug.h"
29 #include "wine/unicode.h"
30
31 #include "mshtml_private.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34
35 #define HTMLELEM3_THIS(iface) DEFINE_THIS(HTMLElement, HTMLElement3, iface)
36
37 static HRESULT WINAPI HTMLElement3_QueryInterface(IHTMLElement3 *iface,
38                                                   REFIID riid, void **ppv)
39 {
40     HTMLElement *This = HTMLELEM3_THIS(iface);
41     return IHTMLElement_QueryInterface(HTMLELEM(This), riid, ppv);
42 }
43
44 static ULONG WINAPI HTMLElement3_AddRef(IHTMLElement3 *iface)
45 {
46     HTMLElement *This = HTMLELEM3_THIS(iface);
47     return IHTMLElement_AddRef(HTMLELEM(This));
48 }
49
50 static ULONG WINAPI HTMLElement3_Release(IHTMLElement3 *iface)
51 {
52     HTMLElement *This = HTMLELEM3_THIS(iface);
53     return IHTMLElement_Release(HTMLELEM(This));
54 }
55
56 static HRESULT WINAPI HTMLElement3_GetTypeInfoCount(IHTMLElement3 *iface, UINT *pctinfo)
57 {
58     HTMLElement *This = HTMLELEM3_THIS(iface);
59     return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->node.dispex), pctinfo);
60 }
61
62 static HRESULT WINAPI HTMLElement3_GetTypeInfo(IHTMLElement3 *iface, UINT iTInfo,
63                                                LCID lcid, ITypeInfo **ppTInfo)
64 {
65     HTMLElement *This = HTMLELEM3_THIS(iface);
66     return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->node.dispex), iTInfo, lcid, ppTInfo);
67 }
68
69 static HRESULT WINAPI HTMLElement3_GetIDsOfNames(IHTMLElement3 *iface, REFIID riid,
70                                                 LPOLESTR *rgszNames, UINT cNames,
71                                                 LCID lcid, DISPID *rgDispId)
72 {
73     HTMLElement *This = HTMLELEM3_THIS(iface);
74     return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
75 }
76
77 static HRESULT WINAPI HTMLElement3_Invoke(IHTMLElement3 *iface, DISPID dispIdMember,
78                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
79                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
80 {
81     HTMLElement *This = HTMLELEM3_THIS(iface);
82     return IDispatchEx_Invoke(DISPATCHEX(&This->node.dispex), dispIdMember, riid, lcid,
83             wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
84 }
85
86 static HRESULT WINAPI HTMLElement3_mergeAttributes(IHTMLElement3 *iface, IHTMLElement *mergeThis, VARIANT *pvarFlags)
87 {
88     HTMLElement *This = HTMLELEM3_THIS(iface);
89     FIXME("(%p)->(%p %p)\n", This, mergeThis, pvarFlags);
90     return E_NOTIMPL;
91 }
92
93 static HRESULT WINAPI HTMLElement3_get_isMultiLine(IHTMLElement3 *iface, VARIANT_BOOL *p)
94 {
95     HTMLElement *This = HTMLELEM3_THIS(iface);
96     FIXME("(%p)->(%p)\n", This, p);
97     return E_NOTIMPL;
98 }
99
100 static HRESULT WINAPI HTMLElement3_get_canHaveHTML(IHTMLElement3 *iface, VARIANT_BOOL *p)
101 {
102     HTMLElement *This = HTMLELEM3_THIS(iface);
103     FIXME("(%p)->(%p)\n", This, p);
104     return E_NOTIMPL;
105 }
106
107 static HRESULT WINAPI HTMLElement3_put_onlayoutcomplete(IHTMLElement3 *iface, VARIANT v)
108 {
109     HTMLElement *This = HTMLELEM3_THIS(iface);
110     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
111     return E_NOTIMPL;
112 }
113
114 static HRESULT WINAPI HTMLElement3_get_onlayoutcomplete(IHTMLElement3 *iface, VARIANT *p)
115 {
116     HTMLElement *This = HTMLELEM3_THIS(iface);
117     FIXME("(%p)->(%p)\n", This, p);
118     return E_NOTIMPL;
119 }
120
121 static HRESULT WINAPI HTMLElement3_put_onpage(IHTMLElement3 *iface, VARIANT v)
122 {
123     HTMLElement *This = HTMLELEM3_THIS(iface);
124     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
125     return E_NOTIMPL;
126 }
127
128 static HRESULT WINAPI HTMLElement3_get_onpage(IHTMLElement3 *iface, VARIANT *p)
129 {
130     HTMLElement *This = HTMLELEM3_THIS(iface);
131     FIXME("(%p)->(%p)\n", This, p);
132     return E_NOTIMPL;
133 }
134
135 static HRESULT WINAPI HTMLElement3_put_inflateBlock(IHTMLElement3 *iface, VARIANT_BOOL v)
136 {
137     HTMLElement *This = HTMLELEM3_THIS(iface);
138     FIXME("(%p)->(%x)\n", This, v);
139     return E_NOTIMPL;
140 }
141
142 static HRESULT WINAPI HTMLElement3_get_inflateBlock(IHTMLElement3 *iface, VARIANT_BOOL *p)
143 {
144     HTMLElement *This = HTMLELEM3_THIS(iface);
145     FIXME("(%p)->(%p)\n", This, p);
146     return E_NOTIMPL;
147 }
148
149 static HRESULT WINAPI HTMLElement3_put_onbeforedeactivate(IHTMLElement3 *iface, VARIANT v)
150 {
151     HTMLElement *This = HTMLELEM3_THIS(iface);
152     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
153     return E_NOTIMPL;
154 }
155
156 static HRESULT WINAPI HTMLElement3_get_onbeforedeactivate(IHTMLElement3 *iface, VARIANT *p)
157 {
158     HTMLElement *This = HTMLELEM3_THIS(iface);
159     FIXME("(%p)->(%p)\n", This, p);
160     return E_NOTIMPL;
161 }
162
163 static HRESULT WINAPI HTMLElement3_setActive(IHTMLElement3 *iface)
164 {
165     HTMLElement *This = HTMLELEM3_THIS(iface);
166     FIXME("(%p)\n", This);
167     return E_NOTIMPL;
168 }
169
170 static HRESULT WINAPI HTMLElement3_put_contentEditable(IHTMLElement3 *iface, BSTR v)
171 {
172     HTMLElement *This = HTMLELEM3_THIS(iface);
173     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
174     return E_NOTIMPL;
175 }
176
177 static HRESULT WINAPI HTMLElement3_get_contentEditable(IHTMLElement3 *iface, BSTR *p)
178 {
179     HTMLElement *This = HTMLELEM3_THIS(iface);
180     FIXME("(%p)->(%p)\n", This, p);
181     return E_NOTIMPL;
182 }
183
184 static HRESULT WINAPI HTMLElement3_get_isContentEditable(IHTMLElement3 *iface, VARIANT_BOOL *p)
185 {
186     HTMLElement *This = HTMLELEM3_THIS(iface);
187     FIXME("(%p)->(%p)\n", This, p);
188     return E_NOTIMPL;
189 }
190
191 static HRESULT WINAPI HTMLElement3_put_hideFocus(IHTMLElement3 *iface, VARIANT_BOOL v)
192 {
193     HTMLElement *This = HTMLELEM3_THIS(iface);
194     FIXME("(%p)->(%x)\n", This, v);
195     return E_NOTIMPL;
196 }
197
198 static HRESULT WINAPI HTMLElement3_get_hideFocus(IHTMLElement3 *iface, VARIANT_BOOL *p)
199 {
200     HTMLElement *This = HTMLELEM3_THIS(iface);
201     FIXME("(%p)->(%p)\n", This, p);
202     return E_NOTIMPL;
203 }
204
205 static HRESULT WINAPI HTMLElement3_put_disabled(IHTMLElement3 *iface, VARIANT_BOOL v)
206 {
207     HTMLElement *This = HTMLELEM3_THIS(iface);
208     FIXME("(%p)->(%x)\n", This, v);
209     return S_OK;
210     return E_NOTIMPL;
211 }
212
213 static HRESULT WINAPI HTMLElement3_get_disabled(IHTMLElement3 *iface, VARIANT_BOOL *p)
214 {
215     HTMLElement *This = HTMLELEM3_THIS(iface);
216     FIXME("(%p)->(%p)\n", This, p);
217     return E_NOTIMPL;
218 }
219
220 static HRESULT WINAPI HTMLElement3_get_isDisabled(IHTMLElement3 *iface, VARIANT_BOOL *p)
221 {
222     HTMLElement *This = HTMLELEM3_THIS(iface);
223     FIXME("(%p)->(%p)\n", This, p);
224     return E_NOTIMPL;
225 }
226
227 static HRESULT WINAPI HTMLElement3_put_onmove(IHTMLElement3 *iface, VARIANT v)
228 {
229     HTMLElement *This = HTMLELEM3_THIS(iface);
230     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
231     return E_NOTIMPL;
232 }
233
234 static HRESULT WINAPI HTMLElement3_get_onmove(IHTMLElement3 *iface, VARIANT *p)
235 {
236     HTMLElement *This = HTMLELEM3_THIS(iface);
237     FIXME("(%p)->(%p)\n", This, p);
238     return E_NOTIMPL;
239 }
240
241 static HRESULT WINAPI HTMLElement3_put_oncontrolselect(IHTMLElement3 *iface, VARIANT v)
242 {
243     HTMLElement *This = HTMLELEM3_THIS(iface);
244     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
245     return E_NOTIMPL;
246 }
247
248 static HRESULT WINAPI HTMLElement3_get_oncontrolselect(IHTMLElement3 *iface, VARIANT *p)
249 {
250     HTMLElement *This = HTMLELEM3_THIS(iface);
251     FIXME("(%p)->(%p)\n", This, p);
252     return E_NOTIMPL;
253 }
254
255 static HRESULT WINAPI HTMLElement3_fireEvent(IHTMLElement3 *iface, BSTR bstrEventName,
256         VARIANT *pvarEventObject, VARIANT_BOOL *pfCancelled)
257 {
258     HTMLElement *This = HTMLELEM3_THIS(iface);
259     FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(bstrEventName), pvarEventObject, pfCancelled);
260     return E_NOTIMPL;
261 }
262
263 static HRESULT WINAPI HTMLElement3_put_onresizestart(IHTMLElement3 *iface, VARIANT v)
264 {
265     HTMLElement *This = HTMLELEM3_THIS(iface);
266     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
267     return E_NOTIMPL;
268 }
269
270 static HRESULT WINAPI HTMLElement3_get_onresizestart(IHTMLElement3 *iface, VARIANT *p)
271 {
272     HTMLElement *This = HTMLELEM3_THIS(iface);
273     FIXME("(%p)->(%p)\n", This, p);
274     return E_NOTIMPL;
275 }
276
277 static HRESULT WINAPI HTMLElement3_put_onresizeend(IHTMLElement3 *iface, VARIANT v)
278 {
279     HTMLElement *This = HTMLELEM3_THIS(iface);
280     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
281     return E_NOTIMPL;
282 }
283
284 static HRESULT WINAPI HTMLElement3_get_onresizeend(IHTMLElement3 *iface, VARIANT *p)
285 {
286     HTMLElement *This = HTMLELEM3_THIS(iface);
287     FIXME("(%p)->(%p)\n", This, p);
288     return E_NOTIMPL;
289 }
290
291 static HRESULT WINAPI HTMLElement3_put_onmovestart(IHTMLElement3 *iface, VARIANT v)
292 {
293     HTMLElement *This = HTMLELEM3_THIS(iface);
294     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
295     return E_NOTIMPL;
296 }
297
298 static HRESULT WINAPI HTMLElement3_get_onmovestart(IHTMLElement3 *iface, VARIANT *p)
299 {
300     HTMLElement *This = HTMLELEM3_THIS(iface);
301     FIXME("(%p)->(%p)\n", This, p);
302     return E_NOTIMPL;
303 }
304
305 static HRESULT WINAPI HTMLElement3_put_onmoveend(IHTMLElement3 *iface, VARIANT v)
306 {
307     HTMLElement *This = HTMLELEM3_THIS(iface);
308     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
309     return E_NOTIMPL;
310 }
311
312 static HRESULT WINAPI HTMLElement3_get_onmoveend(IHTMLElement3 *iface, VARIANT *p)
313 {
314     HTMLElement *This = HTMLELEM3_THIS(iface);
315     FIXME("(%p)->(%p)\n", This, p);
316     return E_NOTIMPL;
317 }
318
319 static HRESULT WINAPI HTMLElement3_put_onmousecenter(IHTMLElement3 *iface, VARIANT v)
320 {
321     HTMLElement *This = HTMLELEM3_THIS(iface);
322     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
323     return E_NOTIMPL;
324 }
325
326 static HRESULT WINAPI HTMLElement3_get_onmousecenter(IHTMLElement3 *iface, VARIANT *p)
327 {
328     HTMLElement *This = HTMLELEM3_THIS(iface);
329     FIXME("(%p)->(%p)\n", This, p);
330     return E_NOTIMPL;
331 }
332
333 static HRESULT WINAPI HTMLElement3_put_onmouseleave(IHTMLElement3 *iface, VARIANT v)
334 {
335     HTMLElement *This = HTMLELEM3_THIS(iface);
336     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
337     return E_NOTIMPL;
338 }
339
340 static HRESULT WINAPI HTMLElement3_get_onmouseleave(IHTMLElement3 *iface, VARIANT *p)
341 {
342     HTMLElement *This = HTMLELEM3_THIS(iface);
343     FIXME("(%p)->(%p)\n", This, p);
344     return E_NOTIMPL;
345 }
346
347 static HRESULT WINAPI HTMLElement3_put_onactivate(IHTMLElement3 *iface, VARIANT v)
348 {
349     HTMLElement *This = HTMLELEM3_THIS(iface);
350     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
351     return E_NOTIMPL;
352 }
353
354 static HRESULT WINAPI HTMLElement3_get_onactivate(IHTMLElement3 *iface, VARIANT *p)
355 {
356     HTMLElement *This = HTMLELEM3_THIS(iface);
357     FIXME("(%p)->(%p)\n", This, p);
358     return E_NOTIMPL;
359 }
360
361 static HRESULT WINAPI HTMLElement3_put_ondeactivate(IHTMLElement3 *iface, VARIANT v)
362 {
363     HTMLElement *This = HTMLELEM3_THIS(iface);
364     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
365     return E_NOTIMPL;
366 }
367
368 static HRESULT WINAPI HTMLElement3_get_ondeactivate(IHTMLElement3 *iface, VARIANT *p)
369 {
370     HTMLElement *This = HTMLELEM3_THIS(iface);
371     FIXME("(%p)->(%p)\n", This, p);
372     return E_NOTIMPL;
373 }
374
375 static HRESULT WINAPI HTMLElement3_dragDrop(IHTMLElement3 *iface, VARIANT_BOOL *pfRet)
376 {
377     HTMLElement *This = HTMLELEM3_THIS(iface);
378     FIXME("(%p)->(%p)\n", This, pfRet);
379     return E_NOTIMPL;
380 }
381
382 static HRESULT WINAPI HTMLElement3_get_glyphMode(IHTMLElement3 *iface, LONG *p)
383 {
384     HTMLElement *This = HTMLELEM3_THIS(iface);
385     FIXME("(%p)->(%p)\n", This, p);
386     return E_NOTIMPL;
387 }
388
389 #undef HTMLELEM2_THIS
390
391 static const IHTMLElement3Vtbl HTMLElement3Vtbl = {
392     HTMLElement3_QueryInterface,
393     HTMLElement3_AddRef,
394     HTMLElement3_Release,
395     HTMLElement3_GetTypeInfoCount,
396     HTMLElement3_GetTypeInfo,
397     HTMLElement3_GetIDsOfNames,
398     HTMLElement3_Invoke,
399     HTMLElement3_mergeAttributes,
400     HTMLElement3_get_isMultiLine,
401     HTMLElement3_get_canHaveHTML,
402     HTMLElement3_put_onlayoutcomplete,
403     HTMLElement3_get_onlayoutcomplete,
404     HTMLElement3_put_onpage,
405     HTMLElement3_get_onpage,
406     HTMLElement3_put_inflateBlock,
407     HTMLElement3_get_inflateBlock,
408     HTMLElement3_put_onbeforedeactivate,
409     HTMLElement3_get_onbeforedeactivate,
410     HTMLElement3_setActive,
411     HTMLElement3_put_contentEditable,
412     HTMLElement3_get_contentEditable,
413     HTMLElement3_get_isContentEditable,
414     HTMLElement3_put_hideFocus,
415     HTMLElement3_get_hideFocus,
416     HTMLElement3_put_disabled,
417     HTMLElement3_get_disabled,
418     HTMLElement3_get_isDisabled,
419     HTMLElement3_put_onmove,
420     HTMLElement3_get_onmove,
421     HTMLElement3_put_oncontrolselect,
422     HTMLElement3_get_oncontrolselect,
423     HTMLElement3_fireEvent,
424     HTMLElement3_put_onresizestart,
425     HTMLElement3_get_onresizestart,
426     HTMLElement3_put_onresizeend,
427     HTMLElement3_get_onresizeend,
428     HTMLElement3_put_onmovestart,
429     HTMLElement3_get_onmovestart,
430     HTMLElement3_put_onmoveend,
431     HTMLElement3_get_onmoveend,
432     HTMLElement3_put_onmousecenter,
433     HTMLElement3_get_onmousecenter,
434     HTMLElement3_put_onmouseleave,
435     HTMLElement3_get_onmouseleave,
436     HTMLElement3_put_onactivate,
437     HTMLElement3_get_onactivate,
438     HTMLElement3_put_ondeactivate,
439     HTMLElement3_get_ondeactivate,
440     HTMLElement3_dragDrop,
441     HTMLElement3_get_glyphMode
442 };
443
444 void HTMLElement3_Init(HTMLElement *This)
445 {
446     This->lpHTMLElement3Vtbl = &HTMLElement3Vtbl;
447 }