1/*
2 * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef DOMCSSClasses_H
27#define DOMCSSClasses_H
28
29#include "WebKit.h"
30#include "DOMCoreClasses.h"
31
32#include <WebCore/CSSStyleDeclaration.h>
33
34class DOMCSSStyleDeclaration : public DOMObject, public IDOMCSSStyleDeclaration
35{
36protected:
37    DOMCSSStyleDeclaration(WebCore::CSSStyleDeclaration* d);
38    ~DOMCSSStyleDeclaration();
39
40public:
41    static IDOMCSSStyleDeclaration* createInstance(WebCore::CSSStyleDeclaration* d);
42
43public:
44    // IUnknown
45    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
46    virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMObject::AddRef(); }
47    virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMObject::Release(); }
48
49    // IWebScriptObject
50    virtual HRESULT STDMETHODCALLTYPE throwException(
51        /* [in] */ BSTR exceptionMessage,
52        /* [retval][out] */ BOOL *result) { return DOMObject::throwException(exceptionMessage, result); }
53
54    virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
55        /* [in] */ BSTR name,
56        /* [size_is][in] */ const VARIANT args[  ],
57        /* [in] */ int cArgs,
58        /* [retval][out] */ VARIANT *result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); }
59
60    virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
61        /* [in] */ BSTR script,
62        /* [retval][out] */ VARIANT *result) { return DOMObject::evaluateWebScript(script, result); }
63
64    virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
65        /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); }
66
67    virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
68        /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); }
69
70    virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
71        /* [in] */ unsigned int index,
72        /* [retval][out] */ VARIANT *result) { return DOMObject::webScriptValueAtIndex(index, result); }
73
74    virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
75        /* [in] */ unsigned int index,
76        /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); }
77
78    virtual HRESULT STDMETHODCALLTYPE setException(
79        /* [in] */ BSTR description) { return DOMObject::setException(description); }
80
81    // IDOMCSSStyleDeclaration
82    virtual HRESULT STDMETHODCALLTYPE cssText(
83        /* [retval][out] */ BSTR *result);
84
85    virtual HRESULT STDMETHODCALLTYPE setCssText(
86        /* [in] */ BSTR cssText);
87
88    virtual HRESULT STDMETHODCALLTYPE getPropertyValue(
89        /* [in] */ BSTR propertyName,
90        /* [retval][out] */ BSTR *result);
91
92    virtual HRESULT STDMETHODCALLTYPE getPropertyCSSValue(
93        /* [in] */ BSTR propertyName,
94        /* [retval][out] */ IDOMCSSValue **result);
95
96    virtual HRESULT STDMETHODCALLTYPE removeProperty(
97        /* [in] */ BSTR propertyName,
98        /* [retval][out] */ BSTR *result);
99
100    virtual HRESULT STDMETHODCALLTYPE getPropertyPriority(
101        /* [in] */ BSTR propertyName,
102        /* [retval][out] */ BSTR *result);
103
104    virtual HRESULT STDMETHODCALLTYPE setProperty(
105        /* [in] */ BSTR propertyName,
106        /* [in] */ BSTR value,
107        /* [in] */ BSTR priority);
108
109    virtual HRESULT STDMETHODCALLTYPE length(
110        /* [retval][out] */ UINT *result);
111
112    virtual HRESULT STDMETHODCALLTYPE item(
113        /* [in] */ UINT index,
114        /* [retval][out] */ BSTR *result);
115
116    virtual HRESULT STDMETHODCALLTYPE parentRule(
117        /* [retval][out] */ IDOMCSSRule **result);
118
119protected:
120    ULONG m_refCount;
121    WebCore::CSSStyleDeclaration* m_style;
122};
123
124#endif
125