mshtml: Updated French translation.
[wine] / dlls / mshtml / htmlcurstyle.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 "mshtml_private.h"
29 #include "htmlstyle.h"
30
31 #include "wine/debug.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34
35 struct HTMLCurrentStyle {
36     DispatchEx dispex;
37     const IHTMLCurrentStyleVtbl *lpIHTMLCurrentStyleVtbl;
38
39     LONG ref;
40
41     nsIDOMCSSStyleDeclaration *nsstyle;
42 };
43
44 #define HTMLCURSTYLE(x)  ((IHTMLCurrentStyle*)  &(x)->lpIHTMLCurrentStyleVtbl)
45
46 #define HTMLCURSTYLE_THIS(iface) DEFINE_THIS(HTMLCurrentStyle, IHTMLCurrentStyle, iface)
47
48 static HRESULT WINAPI HTMLCurrentStyle_QueryInterface(IHTMLCurrentStyle *iface, REFIID riid, void **ppv)
49 {
50     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
51
52     *ppv = NULL;
53
54     if(IsEqualGUID(&IID_IUnknown, riid)) {
55         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
56         *ppv = HTMLCURSTYLE(This);
57     }else if(IsEqualGUID(&IID_IHTMLCurrentStyle, riid)) {
58         TRACE("(%p)->(IID_IHTMLCurrentStyle %p)\n", This, ppv);
59         *ppv = HTMLCURSTYLE(This);
60     }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
61         return *ppv ? S_OK : E_NOINTERFACE;
62     }
63
64     if(*ppv) {
65         IUnknown_AddRef((IUnknown*)*ppv);
66         return S_OK;
67     }
68
69     WARN("unsupported %s\n", debugstr_guid(riid));
70     return E_NOINTERFACE;
71 }
72
73 static ULONG WINAPI HTMLCurrentStyle_AddRef(IHTMLCurrentStyle *iface)
74 {
75     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
76     LONG ref = InterlockedIncrement(&This->ref);
77
78     TRACE("(%p) ref=%d\n", This, ref);
79
80     return ref;
81 }
82
83 static ULONG WINAPI HTMLCurrentStyle_Release(IHTMLCurrentStyle *iface)
84 {
85     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
86     LONG ref = InterlockedDecrement(&This->ref);
87
88     TRACE("(%p) ref=%d\n", This, ref);
89
90     if(!ref) {
91         if(This->nsstyle)
92             nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
93         heap_free(This);
94     }
95
96     return ref;
97 }
98
99 static HRESULT WINAPI HTMLCurrentStyle_GetTypeInfoCount(IHTMLCurrentStyle *iface, UINT *pctinfo)
100 {
101     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
102     return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo);
103 }
104
105 static HRESULT WINAPI HTMLCurrentStyle_GetTypeInfo(IHTMLCurrentStyle *iface, UINT iTInfo,
106         LCID lcid, ITypeInfo **ppTInfo)
107 {
108     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
109     return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
110 }
111
112 static HRESULT WINAPI HTMLCurrentStyle_GetIDsOfNames(IHTMLCurrentStyle *iface, REFIID riid,
113         LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
114 {
115     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
116     return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
117 }
118
119 static HRESULT WINAPI HTMLCurrentStyle_Invoke(IHTMLCurrentStyle *iface, DISPID dispIdMember,
120         REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
121         VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
122 {
123     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
124     return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid,
125             wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
126 }
127
128 static HRESULT WINAPI HTMLCurrentStyle_get_position(IHTMLCurrentStyle *iface, BSTR *p)
129 {
130     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
131
132     TRACE("(%p)->(%p)\n", This, p);
133
134     return get_nsstyle_attr(This->nsstyle, STYLEID_POSITION, p);
135 }
136
137 static HRESULT WINAPI HTMLCurrentStyle_get_styleFloat(IHTMLCurrentStyle *iface, BSTR *p)
138 {
139     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
140     FIXME("(%p)->(%p)\n", This, p);
141     return E_NOTIMPL;
142 }
143
144 static HRESULT WINAPI HTMLCurrentStyle_get_color(IHTMLCurrentStyle *iface, VARIANT *p)
145 {
146     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
147     FIXME("(%p)->(%p)\n", This, p);
148     return E_NOTIMPL;
149 }
150
151 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundColor(IHTMLCurrentStyle *iface, VARIANT *p)
152 {
153     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
154     FIXME("(%p)->(%p)\n", This, p);
155     return E_NOTIMPL;
156 }
157
158 static HRESULT WINAPI HTMLCurrentStyle_get_fontFamily(IHTMLCurrentStyle *iface, BSTR *p)
159 {
160     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
161
162     TRACE("(%p)->(%p)\n", This, p);
163
164     return get_nsstyle_attr(This->nsstyle, STYLEID_FONT_FAMILY, p);
165 }
166
167 static HRESULT WINAPI HTMLCurrentStyle_get_fontStyle(IHTMLCurrentStyle *iface, BSTR *p)
168 {
169     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
170     TRACE("(%p)->(%p)\n", This, p);
171     return get_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, p);
172 }
173
174 static HRESULT WINAPI HTMLCurrentStyle_get_fontVariant(IHTMLCurrentStyle *iface, BSTR *p)
175 {
176     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
177     TRACE("(%p)->(%p)\n", This, p);
178     return get_nsstyle_attr(This->nsstyle, STYLEID_FONT_VARIANT, p);
179 }
180
181 static HRESULT WINAPI HTMLCurrentStyle_get_fontWeight(IHTMLCurrentStyle *iface, VARIANT *p)
182 {
183     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
184     TRACE("(%p)->(%p)\n", This, p);
185     return get_nsstyle_attr_var(This->nsstyle, STYLEID_FONT_WEIGHT, p, ATTR_STR_TO_INT);
186 }
187
188 static HRESULT WINAPI HTMLCurrentStyle_get_fontSize(IHTMLCurrentStyle *iface, VARIANT *p)
189 {
190     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
191     TRACE("(%p)->(%p)\n", This, p);
192     return get_nsstyle_attr_var(This->nsstyle, STYLEID_FONT_SIZE, p, 0);
193 }
194
195 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundImage(IHTMLCurrentStyle *iface, BSTR *p)
196 {
197     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
198     TRACE("(%p)->(%p)\n", This, p);
199     return get_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_IMAGE, p);
200 }
201
202 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundPositionX(IHTMLCurrentStyle *iface, VARIANT *p)
203 {
204     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
205     FIXME("(%p)->(%p)\n", This, p);
206     return E_NOTIMPL;
207 }
208
209 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundPositionY(IHTMLCurrentStyle *iface, VARIANT *p)
210 {
211     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
212     FIXME("(%p)->(%p)\n", This, p);
213     return E_NOTIMPL;
214 }
215
216 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundRepeat(IHTMLCurrentStyle *iface, BSTR *p)
217 {
218     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
219     TRACE("(%p)->(%p)\n", This, p);
220     return get_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_REPEAT, p);
221 }
222
223 static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftColor(IHTMLCurrentStyle *iface, VARIANT *p)
224 {
225     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
226     FIXME("(%p)->(%p)\n", This, p);
227     return E_NOTIMPL;
228 }
229
230 static HRESULT WINAPI HTMLCurrentStyle_get_borderTopColor(IHTMLCurrentStyle *iface, VARIANT *p)
231 {
232     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
233     FIXME("(%p)->(%p)\n", This, p);
234     return E_NOTIMPL;
235 }
236
237 static HRESULT WINAPI HTMLCurrentStyle_get_borderRightColor(IHTMLCurrentStyle *iface, VARIANT *p)
238 {
239     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
240     FIXME("(%p)->(%p)\n", This, p);
241     return E_NOTIMPL;
242 }
243
244 static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomColor(IHTMLCurrentStyle *iface, VARIANT *p)
245 {
246     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
247     FIXME("(%p)->(%p)\n", This, p);
248     return E_NOTIMPL;
249 }
250
251 static HRESULT WINAPI HTMLCurrentStyle_get_borderTopStyle(IHTMLCurrentStyle *iface, BSTR *p)
252 {
253     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
254     TRACE("(%p)->(%p)\n", This, p);
255     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_TOP_STYLE, p);
256 }
257
258 static HRESULT WINAPI HTMLCurrentStyle_get_borderRightStyle(IHTMLCurrentStyle *iface, BSTR *p)
259 {
260     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
261     TRACE("(%p)->(%p)\n", This, p);
262     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_RIGHT_STYLE, p);
263 }
264
265 static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomStyle(IHTMLCurrentStyle *iface, BSTR *p)
266 {
267     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
268     TRACE("(%p)->(%p)\n", This, p);
269     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_BOTTOM_STYLE, p);
270 }
271
272 static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftStyle(IHTMLCurrentStyle *iface, BSTR *p)
273 {
274     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
275     TRACE("(%p)->(%p)\n", This, p);
276     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_LEFT_STYLE, p);
277 }
278
279 static HRESULT WINAPI HTMLCurrentStyle_get_borderTopWidth(IHTMLCurrentStyle *iface, VARIANT *p)
280 {
281     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
282     FIXME("(%p)->(%p)\n", This, p);
283     return E_NOTIMPL;
284 }
285
286 static HRESULT WINAPI HTMLCurrentStyle_get_borderRightWidth(IHTMLCurrentStyle *iface, VARIANT *p)
287 {
288     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
289     FIXME("(%p)->(%p)\n", This, p);
290     return E_NOTIMPL;
291 }
292
293 static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomWidth(IHTMLCurrentStyle *iface, VARIANT *p)
294 {
295     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
296     FIXME("(%p)->(%p)\n", This, p);
297     return E_NOTIMPL;
298 }
299
300 static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftWidth(IHTMLCurrentStyle *iface, VARIANT *p)
301 {
302     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
303     FIXME("(%p)->(%p)\n", This, p);
304     return E_NOTIMPL;
305 }
306
307 static HRESULT WINAPI HTMLCurrentStyle_get_left(IHTMLCurrentStyle *iface, VARIANT *p)
308 {
309     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
310     TRACE("(%p)->(%p)\n", This, p);
311     return get_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, p, 0);
312 }
313
314 static HRESULT WINAPI HTMLCurrentStyle_get_top(IHTMLCurrentStyle *iface, VARIANT *p)
315 {
316     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
317     TRACE("(%p)->(%p)\n", This, p);
318     return get_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, p, 0);
319 }
320
321 static HRESULT WINAPI HTMLCurrentStyle_get_width(IHTMLCurrentStyle *iface, VARIANT *p)
322 {
323     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
324     TRACE("(%p)->(%p)\n", This, p);
325     return get_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, p, 0);
326 }
327
328 static HRESULT WINAPI HTMLCurrentStyle_get_height(IHTMLCurrentStyle *iface, VARIANT *p)
329 {
330     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
331     TRACE("(%p)->(%p)\n", This, p);
332     return get_nsstyle_attr_var(This->nsstyle, STYLEID_HEIGHT, p, 0);
333 }
334
335 static HRESULT WINAPI HTMLCurrentStyle_get_paddingLeft(IHTMLCurrentStyle *iface, VARIANT *p)
336 {
337     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
338     TRACE("(%p)->(%p)\n", This, p);
339     return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_LEFT, p, 0);
340 }
341
342 static HRESULT WINAPI HTMLCurrentStyle_get_paddingTop(IHTMLCurrentStyle *iface, VARIANT *p)
343 {
344     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
345     FIXME("(%p)->(%p)\n", This, p);
346     return E_NOTIMPL;
347 }
348
349 static HRESULT WINAPI HTMLCurrentStyle_get_paddingRight(IHTMLCurrentStyle *iface, VARIANT *p)
350 {
351     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
352     FIXME("(%p)->(%p)\n", This, p);
353     return E_NOTIMPL;
354 }
355
356 static HRESULT WINAPI HTMLCurrentStyle_get_paddingBottom(IHTMLCurrentStyle *iface, VARIANT *p)
357 {
358     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
359     FIXME("(%p)->(%p)\n", This, p);
360     return E_NOTIMPL;
361 }
362
363 static HRESULT WINAPI HTMLCurrentStyle_get_textAlign(IHTMLCurrentStyle *iface, BSTR *p)
364 {
365     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
366     TRACE("(%p)->(%p)\n", This, p);
367     return get_nsstyle_attr(This->nsstyle, STYLEID_TEXT_ALIGN, p);
368 }
369
370 static HRESULT WINAPI HTMLCurrentStyle_get_textDecoration(IHTMLCurrentStyle *iface, BSTR *p)
371 {
372     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
373     TRACE("(%p)->(%p)\n", This, p);
374     return get_nsstyle_attr(This->nsstyle, STYLEID_TEXT_DECORATION, p);
375 }
376
377 static HRESULT WINAPI HTMLCurrentStyle_get_display(IHTMLCurrentStyle *iface, BSTR *p)
378 {
379     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
380
381     TRACE("(%p)->(%p)\n", This, p);
382
383     return get_nsstyle_attr(This->nsstyle, STYLEID_DISPLAY, p);
384 }
385
386 static HRESULT WINAPI HTMLCurrentStyle_get_visibility(IHTMLCurrentStyle *iface, BSTR *p)
387 {
388     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
389     FIXME("(%p)->(%p)\n", This, p);
390     return E_NOTIMPL;
391 }
392
393 static HRESULT WINAPI HTMLCurrentStyle_get_zIndex(IHTMLCurrentStyle *iface, VARIANT *p)
394 {
395     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
396     TRACE("(%p)->(%p)\n", This, p);
397     return get_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, p, ATTR_STR_TO_INT);
398 }
399
400 static HRESULT WINAPI HTMLCurrentStyle_get_letterSpacing(IHTMLCurrentStyle *iface, VARIANT *p)
401 {
402     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
403     FIXME("(%p)->(%p)\n", This, p);
404     return E_NOTIMPL;
405 }
406
407 static HRESULT WINAPI HTMLCurrentStyle_get_lineHeight(IHTMLCurrentStyle *iface, VARIANT *p)
408 {
409     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
410     FIXME("(%p)->(%p)\n", This, p);
411     return E_NOTIMPL;
412 }
413
414 static HRESULT WINAPI HTMLCurrentStyle_get_textIndent(IHTMLCurrentStyle *iface, VARIANT *p)
415 {
416     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
417     FIXME("(%p)->(%p)\n", This, p);
418     return E_NOTIMPL;
419 }
420
421 static HRESULT WINAPI HTMLCurrentStyle_get_verticalAlign(IHTMLCurrentStyle *iface, VARIANT *p)
422 {
423     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
424     TRACE("(%p)->(%p)\n", This, p);
425     return get_nsstyle_attr_var(This->nsstyle, STYLEID_VERTICAL_ALIGN, p, 0);
426 }
427
428 static HRESULT WINAPI HTMLCurrentStyle_get_backgroundAttachment(IHTMLCurrentStyle *iface, BSTR *p)
429 {
430     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
431     FIXME("(%p)->(%p)\n", This, p);
432     return E_NOTIMPL;
433 }
434
435 static HRESULT WINAPI HTMLCurrentStyle_get_marginTop(IHTMLCurrentStyle *iface, VARIANT *p)
436 {
437     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
438     FIXME("(%p)->(%p)\n", This, p);
439     return E_NOTIMPL;
440 }
441
442 static HRESULT WINAPI HTMLCurrentStyle_get_marginRight(IHTMLCurrentStyle *iface, VARIANT *p)
443 {
444     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
445     TRACE("(%p)->(%p)\n", This, p);
446     return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, p, 0);
447 }
448
449 static HRESULT WINAPI HTMLCurrentStyle_get_marginBottom(IHTMLCurrentStyle *iface, VARIANT *p)
450 {
451     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
452     FIXME("(%p)->(%p)\n", This, p);
453     return E_NOTIMPL;
454 }
455
456 static HRESULT WINAPI HTMLCurrentStyle_get_marginLeft(IHTMLCurrentStyle *iface, VARIANT *p)
457 {
458     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
459     TRACE("(%p)->(%p)\n", This, p);
460     return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, p, 0);
461 }
462
463 static HRESULT WINAPI HTMLCurrentStyle_get_clear(IHTMLCurrentStyle *iface, BSTR *p)
464 {
465     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
466     FIXME("(%p)->(%p)\n", This, p);
467     return E_NOTIMPL;
468 }
469
470 static HRESULT WINAPI HTMLCurrentStyle_get_listStyleType(IHTMLCurrentStyle *iface, BSTR *p)
471 {
472     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
473     FIXME("(%p)->(%p)\n", This, p);
474     return E_NOTIMPL;
475 }
476
477 static HRESULT WINAPI HTMLCurrentStyle_get_listStylePosition(IHTMLCurrentStyle *iface, BSTR *p)
478 {
479     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
480     FIXME("(%p)->(%p)\n", This, p);
481     return E_NOTIMPL;
482 }
483
484 static HRESULT WINAPI HTMLCurrentStyle_get_listStyleImage(IHTMLCurrentStyle *iface, BSTR *p)
485 {
486     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
487     FIXME("(%p)->(%p)\n", This, p);
488     return E_NOTIMPL;
489 }
490
491 static HRESULT WINAPI HTMLCurrentStyle_get_clipTop(IHTMLCurrentStyle *iface, VARIANT *p)
492 {
493     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
494     FIXME("(%p)->(%p)\n", This, p);
495     return E_NOTIMPL;
496 }
497
498 static HRESULT WINAPI HTMLCurrentStyle_get_clipRight(IHTMLCurrentStyle *iface, VARIANT *p)
499 {
500     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
501     FIXME("(%p)->(%p)\n", This, p);
502     return E_NOTIMPL;
503 }
504
505 static HRESULT WINAPI HTMLCurrentStyle_get_clipBottom(IHTMLCurrentStyle *iface, VARIANT *p)
506 {
507     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
508     FIXME("(%p)->(%p)\n", This, p);
509     return E_NOTIMPL;
510 }
511
512 static HRESULT WINAPI HTMLCurrentStyle_get_clipLeft(IHTMLCurrentStyle *iface, VARIANT *p)
513 {
514     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
515     FIXME("(%p)->(%p)\n", This, p);
516     return E_NOTIMPL;
517 }
518
519 static HRESULT WINAPI HTMLCurrentStyle_get_overflow(IHTMLCurrentStyle *iface, BSTR *p)
520 {
521     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
522     FIXME("(%p)->(%p)\n", This, p);
523     return E_NOTIMPL;
524 }
525
526 static HRESULT WINAPI HTMLCurrentStyle_get_pageBreakBefore(IHTMLCurrentStyle *iface, BSTR *p)
527 {
528     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
529     FIXME("(%p)->(%p)\n", This, p);
530     return E_NOTIMPL;
531 }
532
533 static HRESULT WINAPI HTMLCurrentStyle_get_pageBreakAfter(IHTMLCurrentStyle *iface, BSTR *p)
534 {
535     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
536     FIXME("(%p)->(%p)\n", This, p);
537     return E_NOTIMPL;
538 }
539
540 static HRESULT WINAPI HTMLCurrentStyle_get_cursor(IHTMLCurrentStyle *iface, BSTR *p)
541 {
542     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
543     TRACE("(%p)->(%p)\n", This, p);
544     return get_nsstyle_attr(This->nsstyle, STYLEID_CURSOR, p);
545 }
546
547 static HRESULT WINAPI HTMLCurrentStyle_get_tableLayout(IHTMLCurrentStyle *iface, BSTR *p)
548 {
549     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
550     FIXME("(%p)->(%p)\n", This, p);
551     return E_NOTIMPL;
552 }
553
554 static HRESULT WINAPI HTMLCurrentStyle_get_borderCollapse(IHTMLCurrentStyle *iface, BSTR *p)
555 {
556     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
557     FIXME("(%p)->(%p)\n", This, p);
558     return E_NOTIMPL;
559 }
560
561 static HRESULT WINAPI HTMLCurrentStyle_get_direction(IHTMLCurrentStyle *iface, BSTR *p)
562 {
563     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
564     FIXME("(%p)->(%p)\n", This, p);
565     return E_NOTIMPL;
566 }
567
568 static HRESULT WINAPI HTMLCurrentStyle_get_behavior(IHTMLCurrentStyle *iface, BSTR *p)
569 {
570     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
571     FIXME("(%p)->(%p)\n", This, p);
572     return E_NOTIMPL;
573 }
574
575 static HRESULT WINAPI HTMLCurrentStyle_getAttribute(IHTMLCurrentStyle *iface, BSTR strAttributeName,
576         LONG lFlags, VARIANT *AttributeValue)
577 {
578     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
579     FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
580     return E_NOTIMPL;
581 }
582
583 static HRESULT WINAPI HTMLCurrentStyle_get_unicodeBidi(IHTMLCurrentStyle *iface, BSTR *p)
584 {
585     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
586     FIXME("(%p)->(%p)\n", This, p);
587     return E_NOTIMPL;
588 }
589
590 static HRESULT WINAPI HTMLCurrentStyle_get_right(IHTMLCurrentStyle *iface, VARIANT *p)
591 {
592     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
593     FIXME("(%p)->(%p)\n", This, p);
594     return E_NOTIMPL;
595 }
596
597 static HRESULT WINAPI HTMLCurrentStyle_get_bottom(IHTMLCurrentStyle *iface, VARIANT *p)
598 {
599     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
600     FIXME("(%p)->(%p)\n", This, p);
601     return E_NOTIMPL;
602 }
603
604 static HRESULT WINAPI HTMLCurrentStyle_get_imeMode(IHTMLCurrentStyle *iface, BSTR *p)
605 {
606     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
607     FIXME("(%p)->(%p)\n", This, p);
608     return E_NOTIMPL;
609 }
610
611 static HRESULT WINAPI HTMLCurrentStyle_get_rubyAlign(IHTMLCurrentStyle *iface, BSTR *p)
612 {
613     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
614     FIXME("(%p)->(%p)\n", This, p);
615     return E_NOTIMPL;
616 }
617
618 static HRESULT WINAPI HTMLCurrentStyle_get_rubyPosition(IHTMLCurrentStyle *iface, BSTR *p)
619 {
620     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
621     FIXME("(%p)->(%p)\n", This, p);
622     return E_NOTIMPL;
623 }
624
625 static HRESULT WINAPI HTMLCurrentStyle_get_rubyOverhang(IHTMLCurrentStyle *iface, BSTR *p)
626 {
627     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
628     FIXME("(%p)->(%p)\n", This, p);
629     return E_NOTIMPL;
630 }
631
632 static HRESULT WINAPI HTMLCurrentStyle_get_textAutospace(IHTMLCurrentStyle *iface, BSTR *p)
633 {
634     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
635     FIXME("(%p)->(%p)\n", This, p);
636     return E_NOTIMPL;
637 }
638
639 static HRESULT WINAPI HTMLCurrentStyle_get_lineBreak(IHTMLCurrentStyle *iface, BSTR *p)
640 {
641     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
642     FIXME("(%p)->(%p)\n", This, p);
643     return E_NOTIMPL;
644 }
645
646 static HRESULT WINAPI HTMLCurrentStyle_get_wordBreak(IHTMLCurrentStyle *iface, BSTR *p)
647 {
648     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
649     FIXME("(%p)->(%p)\n", This, p);
650     return E_NOTIMPL;
651 }
652
653 static HRESULT WINAPI HTMLCurrentStyle_get_textJustify(IHTMLCurrentStyle *iface, BSTR *p)
654 {
655     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
656     FIXME("(%p)->(%p)\n", This, p);
657     return E_NOTIMPL;
658 }
659
660 static HRESULT WINAPI HTMLCurrentStyle_get_textJustifyTrim(IHTMLCurrentStyle *iface, BSTR *p)
661 {
662     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
663     FIXME("(%p)->(%p)\n", This, p);
664     return E_NOTIMPL;
665 }
666
667 static HRESULT WINAPI HTMLCurrentStyle_get_textKashida(IHTMLCurrentStyle *iface, VARIANT *p)
668 {
669     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
670     FIXME("(%p)->(%p)\n", This, p);
671     return E_NOTIMPL;
672 }
673
674 static HRESULT WINAPI HTMLCurrentStyle_get_blockDirection(IHTMLCurrentStyle *iface, BSTR *p)
675 {
676     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
677     FIXME("(%p)->(%p)\n", This, p);
678     return E_NOTIMPL;
679 }
680
681 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridChar(IHTMLCurrentStyle *iface, VARIANT *p)
682 {
683     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
684     FIXME("(%p)->(%p)\n", This, p);
685     return E_NOTIMPL;
686 }
687
688 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridLine(IHTMLCurrentStyle *iface, VARIANT *p)
689 {
690     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
691     FIXME("(%p)->(%p)\n", This, p);
692     return E_NOTIMPL;
693 }
694
695 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridMode(IHTMLCurrentStyle *iface, BSTR *p)
696 {
697     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
698     FIXME("(%p)->(%p)\n", This, p);
699     return E_NOTIMPL;
700 }
701
702 static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridType(IHTMLCurrentStyle *iface, BSTR *p)
703 {
704     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
705     FIXME("(%p)->(%p)\n", This, p);
706     return E_NOTIMPL;
707 }
708
709 static HRESULT WINAPI HTMLCurrentStyle_get_borderStyle(IHTMLCurrentStyle *iface, BSTR *p)
710 {
711     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
712     TRACE("(%p)->(%p)\n", This, p);
713     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_STYLE, p);
714 }
715
716 static HRESULT WINAPI HTMLCurrentStyle_get_borderColor(IHTMLCurrentStyle *iface, BSTR *p)
717 {
718     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
719     TRACE("(%p)->(%p)\n", This, p);
720     return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_COLOR, p);
721 }
722
723 static HRESULT WINAPI HTMLCurrentStyle_get_borderWidth(IHTMLCurrentStyle *iface, BSTR *p)
724 {
725     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
726     FIXME("(%p)->(%p)\n", This, p);
727     return E_NOTIMPL;
728 }
729
730 static HRESULT WINAPI HTMLCurrentStyle_get_padding(IHTMLCurrentStyle *iface, BSTR *p)
731 {
732     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
733     FIXME("(%p)->(%p)\n", This, p);
734     return E_NOTIMPL;
735 }
736
737 static HRESULT WINAPI HTMLCurrentStyle_get_margin(IHTMLCurrentStyle *iface, BSTR *p)
738 {
739     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
740     FIXME("(%p)->(%p)\n", This, p);
741     return E_NOTIMPL;
742 }
743
744 static HRESULT WINAPI HTMLCurrentStyle_get_accelerator(IHTMLCurrentStyle *iface, BSTR *p)
745 {
746     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
747     FIXME("(%p)->(%p)\n", This, p);
748     return E_NOTIMPL;
749 }
750
751 static HRESULT WINAPI HTMLCurrentStyle_get_overflowX(IHTMLCurrentStyle *iface, BSTR *p)
752 {
753     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
754     FIXME("(%p)->(%p)\n", This, p);
755     return E_NOTIMPL;
756 }
757
758 static HRESULT WINAPI HTMLCurrentStyle_get_overflowY(IHTMLCurrentStyle *iface, BSTR *p)
759 {
760     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
761     FIXME("(%p)->(%p)\n", This, p);
762     return E_NOTIMPL;
763 }
764
765 static HRESULT WINAPI HTMLCurrentStyle_get_textTransform(IHTMLCurrentStyle *iface, BSTR *p)
766 {
767     HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
768     FIXME("(%p)->(%p)\n", This, p);
769     return E_NOTIMPL;
770 }
771
772 #undef HTMLCURSTYLE_THIS
773
774 static const IHTMLCurrentStyleVtbl HTMLCurrentStyleVtbl = {
775     HTMLCurrentStyle_QueryInterface,
776     HTMLCurrentStyle_AddRef,
777     HTMLCurrentStyle_Release,
778     HTMLCurrentStyle_GetTypeInfoCount,
779     HTMLCurrentStyle_GetTypeInfo,
780     HTMLCurrentStyle_GetIDsOfNames,
781     HTMLCurrentStyle_Invoke,
782     HTMLCurrentStyle_get_position,
783     HTMLCurrentStyle_get_styleFloat,
784     HTMLCurrentStyle_get_color,
785     HTMLCurrentStyle_get_backgroundColor,
786     HTMLCurrentStyle_get_fontFamily,
787     HTMLCurrentStyle_get_fontStyle,
788     HTMLCurrentStyle_get_fontVariant,
789     HTMLCurrentStyle_get_fontWeight,
790     HTMLCurrentStyle_get_fontSize,
791     HTMLCurrentStyle_get_backgroundImage,
792     HTMLCurrentStyle_get_backgroundPositionX,
793     HTMLCurrentStyle_get_backgroundPositionY,
794     HTMLCurrentStyle_get_backgroundRepeat,
795     HTMLCurrentStyle_get_borderLeftColor,
796     HTMLCurrentStyle_get_borderTopColor,
797     HTMLCurrentStyle_get_borderRightColor,
798     HTMLCurrentStyle_get_borderBottomColor,
799     HTMLCurrentStyle_get_borderTopStyle,
800     HTMLCurrentStyle_get_borderRightStyle,
801     HTMLCurrentStyle_get_borderBottomStyle,
802     HTMLCurrentStyle_get_borderLeftStyle,
803     HTMLCurrentStyle_get_borderTopWidth,
804     HTMLCurrentStyle_get_borderRightWidth,
805     HTMLCurrentStyle_get_borderBottomWidth,
806     HTMLCurrentStyle_get_borderLeftWidth,
807     HTMLCurrentStyle_get_left,
808     HTMLCurrentStyle_get_top,
809     HTMLCurrentStyle_get_width,
810     HTMLCurrentStyle_get_height,
811     HTMLCurrentStyle_get_paddingLeft,
812     HTMLCurrentStyle_get_paddingTop,
813     HTMLCurrentStyle_get_paddingRight,
814     HTMLCurrentStyle_get_paddingBottom,
815     HTMLCurrentStyle_get_textAlign,
816     HTMLCurrentStyle_get_textDecoration,
817     HTMLCurrentStyle_get_display,
818     HTMLCurrentStyle_get_visibility,
819     HTMLCurrentStyle_get_zIndex,
820     HTMLCurrentStyle_get_letterSpacing,
821     HTMLCurrentStyle_get_lineHeight,
822     HTMLCurrentStyle_get_textIndent,
823     HTMLCurrentStyle_get_verticalAlign,
824     HTMLCurrentStyle_get_backgroundAttachment,
825     HTMLCurrentStyle_get_marginTop,
826     HTMLCurrentStyle_get_marginRight,
827     HTMLCurrentStyle_get_marginBottom,
828     HTMLCurrentStyle_get_marginLeft,
829     HTMLCurrentStyle_get_clear,
830     HTMLCurrentStyle_get_listStyleType,
831     HTMLCurrentStyle_get_listStylePosition,
832     HTMLCurrentStyle_get_listStyleImage,
833     HTMLCurrentStyle_get_clipTop,
834     HTMLCurrentStyle_get_clipRight,
835     HTMLCurrentStyle_get_clipBottom,
836     HTMLCurrentStyle_get_clipLeft,
837     HTMLCurrentStyle_get_overflow,
838     HTMLCurrentStyle_get_pageBreakBefore,
839     HTMLCurrentStyle_get_pageBreakAfter,
840     HTMLCurrentStyle_get_cursor,
841     HTMLCurrentStyle_get_tableLayout,
842     HTMLCurrentStyle_get_borderCollapse,
843     HTMLCurrentStyle_get_direction,
844     HTMLCurrentStyle_get_behavior,
845     HTMLCurrentStyle_getAttribute,
846     HTMLCurrentStyle_get_unicodeBidi,
847     HTMLCurrentStyle_get_right,
848     HTMLCurrentStyle_get_bottom,
849     HTMLCurrentStyle_get_imeMode,
850     HTMLCurrentStyle_get_rubyAlign,
851     HTMLCurrentStyle_get_rubyPosition,
852     HTMLCurrentStyle_get_rubyOverhang,
853     HTMLCurrentStyle_get_textAutospace,
854     HTMLCurrentStyle_get_lineBreak,
855     HTMLCurrentStyle_get_wordBreak,
856     HTMLCurrentStyle_get_textJustify,
857     HTMLCurrentStyle_get_textJustifyTrim,
858     HTMLCurrentStyle_get_textKashida,
859     HTMLCurrentStyle_get_blockDirection,
860     HTMLCurrentStyle_get_layoutGridChar,
861     HTMLCurrentStyle_get_layoutGridLine,
862     HTMLCurrentStyle_get_layoutGridMode,
863     HTMLCurrentStyle_get_layoutGridType,
864     HTMLCurrentStyle_get_borderStyle,
865     HTMLCurrentStyle_get_borderColor,
866     HTMLCurrentStyle_get_borderWidth,
867     HTMLCurrentStyle_get_padding,
868     HTMLCurrentStyle_get_margin,
869     HTMLCurrentStyle_get_accelerator,
870     HTMLCurrentStyle_get_overflowX,
871     HTMLCurrentStyle_get_overflowY,
872     HTMLCurrentStyle_get_textTransform
873 };
874
875 static const tid_t HTMLCurrentStyle_iface_tids[] = {
876     IHTMLCurrentStyle_tid,
877     IHTMLCurrentStyle2_tid,
878     IHTMLCurrentStyle3_tid,
879     IHTMLCurrentStyle4_tid,
880     0
881 };
882 static dispex_static_data_t HTMLCurrentStyle_dispex = {
883     NULL,
884     DispHTMLCurrentStyle_tid,
885     NULL,
886     HTMLCurrentStyle_iface_tids
887 };
888
889 HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p)
890 {
891     nsIDOMCSSStyleDeclaration *nsstyle;
892     nsIDOMDocumentView *nsdocview;
893     nsIDOMAbstractView *nsview;
894     nsIDOMViewCSS *nsviewcss;
895     nsAString nsempty_str;
896     HTMLCurrentStyle *ret;
897     nsresult nsres;
898
899     if(!elem->node.doc->nsdoc)  {
900         WARN("NULL nsdoc\n");
901         return E_UNEXPECTED;
902     }
903
904     nsres = nsIDOMHTMLDocument_QueryInterface(elem->node.doc->nsdoc, &IID_nsIDOMDocumentView, (void**)&nsdocview);
905     if(NS_FAILED(nsres)) {
906         ERR("Could not get nsIDOMDocumentView: %08x\n", nsres);
907         return E_FAIL;
908     }
909
910     nsres = nsIDOMDocumentView_GetDefaultView(nsdocview, &nsview);
911     nsIDOMDocumentView_Release(nsdocview);
912     if(NS_FAILED(nsres)) {
913         ERR("GetDefaultView failed: %08x\n", nsres);
914         return E_FAIL;
915     }
916
917     nsres = nsIDOMAbstractView_QueryInterface(nsview, &IID_nsIDOMViewCSS, (void**)&nsviewcss);
918     nsIDOMAbstractView_Release(nsview);
919     if(NS_FAILED(nsres)) {
920         ERR("Could not get nsIDOMViewCSS: %08x\n", nsres);
921         return E_FAIL;
922     }
923
924     nsAString_Init(&nsempty_str, NULL);
925     nsres = nsIDOMViewCSS_GetComputedStyle(nsviewcss, (nsIDOMElement*)elem->nselem, &nsempty_str, &nsstyle);
926     nsIDOMViewCSS_Release(nsviewcss);
927     nsAString_Finish(&nsempty_str);
928     if(NS_FAILED(nsres)) {
929         ERR("GetComputedStyle failed: %08x\n", nsres);
930         return E_FAIL;
931     }
932
933     ret = heap_alloc_zero(sizeof(HTMLCurrentStyle));
934     if(!ret) {
935         nsIDOMCSSStyleDeclaration_Release(nsstyle);
936         return E_OUTOFMEMORY;
937     }
938
939     ret->lpIHTMLCurrentStyleVtbl = &HTMLCurrentStyleVtbl;
940     ret->ref = 1;
941     ret->nsstyle = nsstyle;
942
943     init_dispex(&ret->dispex, (IUnknown*)HTMLCURSTYLE(ret),  &HTMLCurrentStyle_dispex);
944
945     *p = HTMLCURSTYLE(ret);
946     return S_OK;
947 }