mshtml: Implement IHTMLStyle get/put borderColor.
[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 const WCHAR disabledW[] = {'d','i','s','a','b','l','e','d',0};
206
207 static HRESULT WINAPI HTMLElement3_put_disabled(IHTMLElement3 *iface, VARIANT_BOOL v)
208 {
209     HTMLElement *This = HTMLELEM3_THIS(iface);
210     VARIANT *var;
211     HRESULT hres;
212
213     TRACE("(%p)->(%x)\n", This, v);
214
215     if(This->node.vtbl->put_disabled)
216         return This->node.vtbl->put_disabled(&This->node, v);
217
218     hres = dispex_get_dprop_ref(&This->node.dispex, disabledW, TRUE, &var);
219     if(FAILED(hres))
220         return hres;
221
222     VariantClear(var);
223     V_VT(var) = VT_BOOL;
224     V_BOOL(var) = v;
225     return S_OK;
226 }
227
228 static HRESULT WINAPI HTMLElement3_get_disabled(IHTMLElement3 *iface, VARIANT_BOOL *p)
229 {
230     HTMLElement *This = HTMLELEM3_THIS(iface);
231     VARIANT *var;
232     HRESULT hres;
233
234     TRACE("(%p)->(%p)\n", This, p);
235
236     if(This->node.vtbl->get_disabled)
237         return This->node.vtbl->get_disabled(&This->node, p);
238
239     hres = dispex_get_dprop_ref(&This->node.dispex, disabledW, FALSE, &var);
240     if(hres == DISP_E_UNKNOWNNAME) {
241         *p = VARIANT_FALSE;
242         return S_OK;
243     }
244     if(FAILED(hres))
245         return hres;
246
247     if(V_VT(var) != VT_BOOL) {
248         FIXME("vt %d\n", V_VT(var));
249         return E_NOTIMPL;
250     }
251
252     *p = V_BOOL(var);
253     return S_OK;
254 }
255
256 static HRESULT WINAPI HTMLElement3_get_isDisabled(IHTMLElement3 *iface, VARIANT_BOOL *p)
257 {
258     HTMLElement *This = HTMLELEM3_THIS(iface);
259     FIXME("(%p)->(%p)\n", This, p);
260     return E_NOTIMPL;
261 }
262
263 static HRESULT WINAPI HTMLElement3_put_onmove(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_onmove(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_oncontrolselect(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_oncontrolselect(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_fireEvent(IHTMLElement3 *iface, BSTR bstrEventName,
292         VARIANT *pvarEventObject, VARIANT_BOOL *pfCancelled)
293 {
294     HTMLElement *This = HTMLELEM3_THIS(iface);
295     FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(bstrEventName), pvarEventObject, pfCancelled);
296     return E_NOTIMPL;
297 }
298
299 static HRESULT WINAPI HTMLElement3_put_onresizestart(IHTMLElement3 *iface, VARIANT v)
300 {
301     HTMLElement *This = HTMLELEM3_THIS(iface);
302     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
303     return E_NOTIMPL;
304 }
305
306 static HRESULT WINAPI HTMLElement3_get_onresizestart(IHTMLElement3 *iface, VARIANT *p)
307 {
308     HTMLElement *This = HTMLELEM3_THIS(iface);
309     FIXME("(%p)->(%p)\n", This, p);
310     return E_NOTIMPL;
311 }
312
313 static HRESULT WINAPI HTMLElement3_put_onresizeend(IHTMLElement3 *iface, VARIANT v)
314 {
315     HTMLElement *This = HTMLELEM3_THIS(iface);
316     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
317     return E_NOTIMPL;
318 }
319
320 static HRESULT WINAPI HTMLElement3_get_onresizeend(IHTMLElement3 *iface, VARIANT *p)
321 {
322     HTMLElement *This = HTMLELEM3_THIS(iface);
323     FIXME("(%p)->(%p)\n", This, p);
324     return E_NOTIMPL;
325 }
326
327 static HRESULT WINAPI HTMLElement3_put_onmovestart(IHTMLElement3 *iface, VARIANT v)
328 {
329     HTMLElement *This = HTMLELEM3_THIS(iface);
330     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
331     return E_NOTIMPL;
332 }
333
334 static HRESULT WINAPI HTMLElement3_get_onmovestart(IHTMLElement3 *iface, VARIANT *p)
335 {
336     HTMLElement *This = HTMLELEM3_THIS(iface);
337     FIXME("(%p)->(%p)\n", This, p);
338     return E_NOTIMPL;
339 }
340
341 static HRESULT WINAPI HTMLElement3_put_onmoveend(IHTMLElement3 *iface, VARIANT v)
342 {
343     HTMLElement *This = HTMLELEM3_THIS(iface);
344     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
345     return E_NOTIMPL;
346 }
347
348 static HRESULT WINAPI HTMLElement3_get_onmoveend(IHTMLElement3 *iface, VARIANT *p)
349 {
350     HTMLElement *This = HTMLELEM3_THIS(iface);
351     FIXME("(%p)->(%p)\n", This, p);
352     return E_NOTIMPL;
353 }
354
355 static HRESULT WINAPI HTMLElement3_put_onmousecenter(IHTMLElement3 *iface, VARIANT v)
356 {
357     HTMLElement *This = HTMLELEM3_THIS(iface);
358     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
359     return E_NOTIMPL;
360 }
361
362 static HRESULT WINAPI HTMLElement3_get_onmousecenter(IHTMLElement3 *iface, VARIANT *p)
363 {
364     HTMLElement *This = HTMLELEM3_THIS(iface);
365     FIXME("(%p)->(%p)\n", This, p);
366     return E_NOTIMPL;
367 }
368
369 static HRESULT WINAPI HTMLElement3_put_onmouseleave(IHTMLElement3 *iface, VARIANT v)
370 {
371     HTMLElement *This = HTMLELEM3_THIS(iface);
372     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
373     return E_NOTIMPL;
374 }
375
376 static HRESULT WINAPI HTMLElement3_get_onmouseleave(IHTMLElement3 *iface, VARIANT *p)
377 {
378     HTMLElement *This = HTMLELEM3_THIS(iface);
379     FIXME("(%p)->(%p)\n", This, p);
380     return E_NOTIMPL;
381 }
382
383 static HRESULT WINAPI HTMLElement3_put_onactivate(IHTMLElement3 *iface, VARIANT v)
384 {
385     HTMLElement *This = HTMLELEM3_THIS(iface);
386     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
387     return E_NOTIMPL;
388 }
389
390 static HRESULT WINAPI HTMLElement3_get_onactivate(IHTMLElement3 *iface, VARIANT *p)
391 {
392     HTMLElement *This = HTMLELEM3_THIS(iface);
393     FIXME("(%p)->(%p)\n", This, p);
394     return E_NOTIMPL;
395 }
396
397 static HRESULT WINAPI HTMLElement3_put_ondeactivate(IHTMLElement3 *iface, VARIANT v)
398 {
399     HTMLElement *This = HTMLELEM3_THIS(iface);
400     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
401     return E_NOTIMPL;
402 }
403
404 static HRESULT WINAPI HTMLElement3_get_ondeactivate(IHTMLElement3 *iface, VARIANT *p)
405 {
406     HTMLElement *This = HTMLELEM3_THIS(iface);
407     FIXME("(%p)->(%p)\n", This, p);
408     return E_NOTIMPL;
409 }
410
411 static HRESULT WINAPI HTMLElement3_dragDrop(IHTMLElement3 *iface, VARIANT_BOOL *pfRet)
412 {
413     HTMLElement *This = HTMLELEM3_THIS(iface);
414     FIXME("(%p)->(%p)\n", This, pfRet);
415     return E_NOTIMPL;
416 }
417
418 static HRESULT WINAPI HTMLElement3_get_glyphMode(IHTMLElement3 *iface, LONG *p)
419 {
420     HTMLElement *This = HTMLELEM3_THIS(iface);
421     FIXME("(%p)->(%p)\n", This, p);
422     return E_NOTIMPL;
423 }
424
425 #undef HTMLELEM2_THIS
426
427 static const IHTMLElement3Vtbl HTMLElement3Vtbl = {
428     HTMLElement3_QueryInterface,
429     HTMLElement3_AddRef,
430     HTMLElement3_Release,
431     HTMLElement3_GetTypeInfoCount,
432     HTMLElement3_GetTypeInfo,
433     HTMLElement3_GetIDsOfNames,
434     HTMLElement3_Invoke,
435     HTMLElement3_mergeAttributes,
436     HTMLElement3_get_isMultiLine,
437     HTMLElement3_get_canHaveHTML,
438     HTMLElement3_put_onlayoutcomplete,
439     HTMLElement3_get_onlayoutcomplete,
440     HTMLElement3_put_onpage,
441     HTMLElement3_get_onpage,
442     HTMLElement3_put_inflateBlock,
443     HTMLElement3_get_inflateBlock,
444     HTMLElement3_put_onbeforedeactivate,
445     HTMLElement3_get_onbeforedeactivate,
446     HTMLElement3_setActive,
447     HTMLElement3_put_contentEditable,
448     HTMLElement3_get_contentEditable,
449     HTMLElement3_get_isContentEditable,
450     HTMLElement3_put_hideFocus,
451     HTMLElement3_get_hideFocus,
452     HTMLElement3_put_disabled,
453     HTMLElement3_get_disabled,
454     HTMLElement3_get_isDisabled,
455     HTMLElement3_put_onmove,
456     HTMLElement3_get_onmove,
457     HTMLElement3_put_oncontrolselect,
458     HTMLElement3_get_oncontrolselect,
459     HTMLElement3_fireEvent,
460     HTMLElement3_put_onresizestart,
461     HTMLElement3_get_onresizestart,
462     HTMLElement3_put_onresizeend,
463     HTMLElement3_get_onresizeend,
464     HTMLElement3_put_onmovestart,
465     HTMLElement3_get_onmovestart,
466     HTMLElement3_put_onmoveend,
467     HTMLElement3_get_onmoveend,
468     HTMLElement3_put_onmousecenter,
469     HTMLElement3_get_onmousecenter,
470     HTMLElement3_put_onmouseleave,
471     HTMLElement3_get_onmouseleave,
472     HTMLElement3_put_onactivate,
473     HTMLElement3_get_onactivate,
474     HTMLElement3_put_ondeactivate,
475     HTMLElement3_get_ondeactivate,
476     HTMLElement3_dragDrop,
477     HTMLElement3_get_glyphMode
478 };
479
480 void HTMLElement3_Init(HTMLElement *This)
481 {
482     This->lpHTMLElement3Vtbl = &HTMLElement3Vtbl;
483 }