push b79aff4f9e064e6702329573e5ebb8548e254b61
[wine/hacks.git] / dlls / mshtml / htmlstylesheet.c
blob30be0798016cc081c12804deed3c293cef47496e
1 /*
2 * Copyright 2006 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 "winnls.h"
30 #include "ole2.h"
32 #include "wine/debug.h"
33 #include "wine/unicode.h"
35 #include "mshtml_private.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
39 typedef struct {
40 const IHTMLStyleSheetVtbl *lpHTMLStyleSheetVtbl;
41 LONG ref;
42 } HTMLStyleSheet;
44 typedef struct {
45 const IHTMLStyleSheetsCollectionVtbl *lpHTMLStyleSheetsCollectionVtbl;
47 LONG ref;
49 nsIDOMStyleSheetList *nslist;
50 } HTMLStyleSheetsCollection;
52 #define HTMLSTYLESHEET(x) ((IHTMLStyleSheet*) &(x)->lpHTMLStyleSheetVtbl);
53 #define HTMLSTYLESHEETSCOL(x) ((IHTMLStyleSheetsCollection*) &(x)->lpHTMLStyleSheetsCollectionVtbl);
55 #define HTMLSTYLESHEETSCOL_THIS(iface) \
56 DEFINE_THIS(HTMLStyleSheetsCollection, HTMLStyleSheetsCollection, iface)
58 static HRESULT WINAPI HTMLStyleSheetsCollection_QueryInterface(IHTMLStyleSheetsCollection *iface,
59 REFIID riid, void **ppv)
61 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
63 *ppv = NULL;
65 if(IsEqualGUID(&IID_IUnknown, riid)) {
66 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
67 *ppv = HTMLSTYLESHEETSCOL(This);
68 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
69 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
70 *ppv = HTMLSTYLESHEETSCOL(This);
71 }else if(IsEqualGUID(&IID_IHTMLStyleSheetsCollection, riid)) {
72 TRACE("(%p)->(IID_IHTMLStyleSheetsCollection %p)\n", This, ppv);
73 *ppv = HTMLSTYLESHEETSCOL(This);
76 if(*ppv) {
77 IUnknown_AddRef((IUnknown*)*ppv);
78 return S_OK;
81 WARN("unsupported %s\n", debugstr_guid(riid));
82 return E_NOINTERFACE;
85 static ULONG WINAPI HTMLStyleSheetsCollection_AddRef(IHTMLStyleSheetsCollection *iface)
87 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
88 LONG ref = InterlockedIncrement(&This->ref);
90 TRACE("(%p) ref=%d\n", This, ref);
92 return ref;
95 static ULONG WINAPI HTMLStyleSheetsCollection_Release(IHTMLStyleSheetsCollection *iface)
97 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
98 LONG ref = InterlockedDecrement(&This->ref);
100 TRACE("(%p) ref=%d\n", This, ref);
102 if(!ref)
103 mshtml_free(This);
105 return ref;
108 static HRESULT WINAPI HTMLStyleSheetsCollection_GetTypeInfoCount(IHTMLStyleSheetsCollection *iface,
109 UINT *pctinfo)
111 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
112 FIXME("(%p)->(%p)\n", This, pctinfo);
113 return E_NOTIMPL;
116 static HRESULT WINAPI HTMLStyleSheetsCollection_GetTypeInfo(IHTMLStyleSheetsCollection *iface,
117 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
119 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
120 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
121 return E_NOTIMPL;
124 static HRESULT WINAPI HTMLStyleSheetsCollection_GetIDsOfNames(IHTMLStyleSheetsCollection *iface,
125 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
127 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
128 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
129 lcid, rgDispId);
130 return E_NOTIMPL;
133 static HRESULT WINAPI HTMLStyleSheetsCollection_Invoke(IHTMLStyleSheetsCollection *iface,
134 DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
135 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
137 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
138 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
139 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
140 return E_NOTIMPL;
143 static HRESULT WINAPI HTMLStyleSheetsCollection_get_length(IHTMLStyleSheetsCollection *iface,
144 long *p)
146 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
147 PRUint32 len = 0;
149 TRACE("(%p)->(%p)\n", This, p);
151 if(This->nslist)
152 nsIDOMStyleSheetList_GetLength(This->nslist, &len);
154 *p = len;
155 return S_OK;
158 static HRESULT WINAPI HTMLStyleSheetsCollection_get__newEnum(IHTMLStyleSheetsCollection *iface,
159 IUnknown **p)
161 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
162 FIXME("(%p)->(%p)\n", This, p);
163 return E_NOTIMPL;
166 static HRESULT WINAPI HTMLStyleSheetsCollection_item(IHTMLStyleSheetsCollection *iface,
167 VARIANT *pvarIndex, VARIANT *pvarResult)
169 HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
170 FIXME("(%p)->(%p %p)\n", This, pvarIndex, pvarResult);
171 return E_NOTIMPL;
174 #undef HTMLSTYLESHEETSCOL_THIS
176 static const IHTMLStyleSheetsCollectionVtbl HTMLStyleSheetsCollectionVtbl = {
177 HTMLStyleSheetsCollection_QueryInterface,
178 HTMLStyleSheetsCollection_AddRef,
179 HTMLStyleSheetsCollection_Release,
180 HTMLStyleSheetsCollection_GetTypeInfoCount,
181 HTMLStyleSheetsCollection_GetTypeInfo,
182 HTMLStyleSheetsCollection_GetIDsOfNames,
183 HTMLStyleSheetsCollection_Invoke,
184 HTMLStyleSheetsCollection_get_length,
185 HTMLStyleSheetsCollection_get__newEnum,
186 HTMLStyleSheetsCollection_item
189 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList *nslist)
191 HTMLStyleSheetsCollection *ret = mshtml_alloc(sizeof(HTMLStyleSheetsCollection));
193 ret->lpHTMLStyleSheetsCollectionVtbl = &HTMLStyleSheetsCollectionVtbl;
194 ret->ref = 1;
196 if(nslist)
197 nsIDOMStyleSheetList_AddRef(nslist);
198 ret->nslist = nslist;
200 return HTMLSTYLESHEETSCOL(ret);
203 #define HTMLSTYLESHEET_THIS(iface) DEFINE_THIS(HTMLStyleSheet, HTMLStyleSheet, iface)
205 static HRESULT WINAPI HTMLStyleSheet_QueryInterface(IHTMLStyleSheet *iface, REFIID riid, void **ppv)
207 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
209 *ppv = NULL;
211 if(IsEqualGUID(&IID_IUnknown, riid)) {
212 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
213 *ppv = HTMLSTYLESHEET(This);
214 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
215 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
216 *ppv = HTMLSTYLESHEET(This);
217 }else if(IsEqualGUID(&IID_IHTMLStyleSheet, riid)) {
218 TRACE("(%p)->(IID_IHTMLStyleSheet %p)\n", This, ppv);
219 *ppv = HTMLSTYLESHEET(This);
222 if(*ppv) {
223 IUnknown_AddRef((IUnknown*)*ppv);
224 return S_OK;
227 WARN("unsupported %s\n", debugstr_guid(riid));
228 return E_NOINTERFACE;
231 static ULONG WINAPI HTMLStyleSheet_AddRef(IHTMLStyleSheet *iface)
233 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
234 LONG ref = InterlockedIncrement(&This->ref);
236 TRACE("(%p) ref=%d\n", This, ref);
238 return ref;
241 static ULONG WINAPI HTMLStyleSheet_Release(IHTMLStyleSheet *iface)
243 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
244 LONG ref = InterlockedDecrement(&This->ref);
246 TRACE("(%p) ref=%d\n", This, ref);
248 if(!ref)
249 mshtml_free(This);
251 return ref;
254 static HRESULT WINAPI HTMLStyleSheet_GetTypeInfoCount(IHTMLStyleSheet *iface, UINT *pctinfo)
256 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
257 FIXME("(%p)->(%p)\n", This, pctinfo);
258 return E_NOTIMPL;
261 static HRESULT WINAPI HTMLStyleSheet_GetTypeInfo(IHTMLStyleSheet *iface, UINT iTInfo,
262 LCID lcid, ITypeInfo **ppTInfo)
264 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
265 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
266 return E_NOTIMPL;
269 static HRESULT WINAPI HTMLStyleSheet_GetIDsOfNames(IHTMLStyleSheet *iface, REFIID riid,
270 LPOLESTR *rgszNames, UINT cNames,
271 LCID lcid, DISPID *rgDispId)
273 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
274 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
275 lcid, rgDispId);
276 return E_NOTIMPL;
279 static HRESULT WINAPI HTMLStyleSheet_Invoke(IHTMLStyleSheet *iface, DISPID dispIdMember,
280 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
281 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
283 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
284 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
285 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
286 return E_NOTIMPL;
289 static HRESULT WINAPI HTMLStyleSheet_put_title(IHTMLStyleSheet *iface, BSTR v)
291 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
292 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
293 return E_NOTIMPL;
296 static HRESULT WINAPI HTMLStyleSheet_get_title(IHTMLStyleSheet *iface, BSTR *p)
298 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
299 FIXME("(%p)->(%p)\n", This, p);
300 return E_NOTIMPL;
303 static HRESULT WINAPI HTMLStyleSheet_get_parentStyleSheet(IHTMLStyleSheet *iface,
304 IHTMLStyleSheet **p)
306 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
307 FIXME("(%p)->(%p)\n", This, p);
308 return E_NOTIMPL;
311 static HRESULT WINAPI HTMLStyleSheet_get_owningElement(IHTMLStyleSheet *iface, IHTMLElement **p)
313 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
314 FIXME("(%p)->(%p)\n", This, p);
315 return E_NOTIMPL;
318 static HRESULT WINAPI HTMLStyleSheet_put_disabled(IHTMLStyleSheet *iface, VARIANT_BOOL v)
320 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
321 FIXME("(%p)->(%x)\n", This, v);
322 return E_NOTIMPL;
325 static HRESULT WINAPI HTMLStyleSheet_get_disabled(IHTMLStyleSheet *iface, VARIANT_BOOL *p)
327 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
328 FIXME("(%p)->(%p)\n", This, p);
329 return E_NOTIMPL;
332 static HRESULT WINAPI HTMLStyleSheet_get_readOnly(IHTMLStyleSheet *iface, VARIANT_BOOL *p)
334 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
335 FIXME("(%p)->(%p)\n", This, p);
336 return E_NOTIMPL;
339 static HRESULT WINAPI HTMLStyleSheet_get_imports(IHTMLStyleSheet *iface,
340 IHTMLStyleSheetsCollection **p)
342 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
343 FIXME("(%p)->(%p)\n", This, p);
344 return E_NOTIMPL;
347 static HRESULT WINAPI HTMLStyleSheet_put_href(IHTMLStyleSheet *iface, BSTR v)
349 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
350 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
351 return E_NOTIMPL;
354 static HRESULT WINAPI HTMLStyleSheet_get_href(IHTMLStyleSheet *iface, BSTR *p)
356 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
357 FIXME("(%p)->(%p)\n", This, p);
358 return E_NOTIMPL;
361 static HRESULT WINAPI HTMLStyleSheet_get_type(IHTMLStyleSheet *iface, BSTR *p)
363 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
364 FIXME("(%p)->(%p)\n", This, p);
365 return E_NOTIMPL;
368 static HRESULT WINAPI HTMLStyleSheet_get_id(IHTMLStyleSheet *iface, BSTR *p)
370 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
371 FIXME("(%p)->(%p)\n", This, p);
372 return E_NOTIMPL;
375 static HRESULT WINAPI HTMLStyleSheet_addImport(IHTMLStyleSheet *iface, BSTR bstrURL,
376 long lIndex, long *plIndex)
378 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
379 FIXME("(%p)->(%s %ld %p)\n", This, debugstr_w(bstrURL), lIndex, plIndex);
380 return E_NOTIMPL;
383 static HRESULT WINAPI HTMLStyleSheet_addRule(IHTMLStyleSheet *iface, BSTR bstrSelector,
384 BSTR bstrStyle, long lIndex, long *plIndex)
386 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
387 FIXME("(%p)->(%s %s %ld %p)\n", This, debugstr_w(bstrSelector), debugstr_w(bstrStyle),
388 lIndex, plIndex);
389 return E_NOTIMPL;
392 static HRESULT WINAPI HTMLStyleSheet_removeImport(IHTMLStyleSheet *iface, long lIndex)
394 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
395 FIXME("(%p)->(%ld)\n", This, lIndex);
396 return E_NOTIMPL;
399 static HRESULT WINAPI HTMLStyleSheet_removeRule(IHTMLStyleSheet *iface, long lIndex)
401 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
402 FIXME("(%p)->(%ld)\n", This, lIndex);
403 return E_NOTIMPL;
406 static HRESULT WINAPI HTMLStyleSheet_put_media(IHTMLStyleSheet *iface, BSTR v)
408 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
409 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
410 return E_NOTIMPL;
413 static HRESULT WINAPI HTMLStyleSheet_get_media(IHTMLStyleSheet *iface, BSTR *p)
415 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
416 FIXME("(%p)->(%p)\n", This, p);
417 return E_NOTIMPL;
420 static HRESULT WINAPI HTMLStyleSheet_put_cssText(IHTMLStyleSheet *iface, BSTR v)
422 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
423 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
424 return E_NOTIMPL;
427 static HRESULT WINAPI HTMLStyleSheet_get_cssText(IHTMLStyleSheet *iface, BSTR *p)
429 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
430 FIXME("(%p)->(%p)\n", This, p);
431 return E_NOTIMPL;
434 static HRESULT WINAPI HTMLStyleSheet_get_rules(IHTMLStyleSheet *iface,
435 IHTMLStyleSheetRulesCollection **p)
437 HTMLStyleSheet *This = HTMLSTYLESHEET_THIS(iface);
438 FIXME("(%p)->(%p)\n", This, p);
439 return E_NOTIMPL;
442 static const IHTMLStyleSheetVtbl HTMLStyleSheetVtbl = {
443 HTMLStyleSheet_QueryInterface,
444 HTMLStyleSheet_AddRef,
445 HTMLStyleSheet_Release,
446 HTMLStyleSheet_GetTypeInfoCount,
447 HTMLStyleSheet_GetTypeInfo,
448 HTMLStyleSheet_GetIDsOfNames,
449 HTMLStyleSheet_Invoke,
450 HTMLStyleSheet_put_title,
451 HTMLStyleSheet_get_title,
452 HTMLStyleSheet_get_parentStyleSheet,
453 HTMLStyleSheet_get_owningElement,
454 HTMLStyleSheet_put_disabled,
455 HTMLStyleSheet_get_disabled,
456 HTMLStyleSheet_get_readOnly,
457 HTMLStyleSheet_get_imports,
458 HTMLStyleSheet_put_href,
459 HTMLStyleSheet_get_href,
460 HTMLStyleSheet_get_type,
461 HTMLStyleSheet_get_id,
462 HTMLStyleSheet_addImport,
463 HTMLStyleSheet_addRule,
464 HTMLStyleSheet_removeImport,
465 HTMLStyleSheet_removeRule,
466 HTMLStyleSheet_put_media,
467 HTMLStyleSheet_get_media,
468 HTMLStyleSheet_put_cssText,
469 HTMLStyleSheet_get_cssText,
470 HTMLStyleSheet_get_rules
473 IHTMLStyleSheet *HTMLStyleSheet_Create(void)
475 HTMLStyleSheet *ret = mshtml_alloc(sizeof(HTMLStyleSheet));
477 ret->lpHTMLStyleSheetVtbl = &HTMLStyleSheetVtbl;
478 ret->ref = 1;
480 return HTMLSTYLESHEET(ret);