mshtml: Added IHTMLStyle::[get|put]_textAlign implementation.
[wine] / dlls / mshtml / htmlcomment.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
20 #include <stdarg.h>
21
22 #define COBJMACROS
23
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
28
29 #include "mshtml_private.h"
30
31 #include "wine/debug.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34
35 typedef struct {
36     HTMLElement element;
37     const IHTMLCommentElementVtbl   *lpIHTMLCommentElementVtbl;
38 } HTMLCommentElement;
39
40 #define HTMLCOMMENT(x)  ((IHTMLCommentElement*)  &(x)->lpIHTMLCommentElementVtbl)
41
42 #define HTMLCOMMENT_THIS(iface) DEFINE_THIS(HTMLCommentElement, IHTMLCommentElement, iface)
43
44 static HRESULT WINAPI HTMLCommentElement_QueryInterface(IHTMLCommentElement *iface,
45         REFIID riid, void **ppv)
46 {
47     HTMLCommentElement *This = HTMLCOMMENT_THIS(iface);
48
49     return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
50 }
51
52 static ULONG WINAPI HTMLCommentElement_AddRef(IHTMLCommentElement *iface)
53 {
54     HTMLCommentElement *This = HTMLCOMMENT_THIS(iface);
55
56     return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
57 }
58
59 static ULONG WINAPI HTMLCommentElement_Release(IHTMLCommentElement *iface)
60 {
61     HTMLCommentElement *This = HTMLCOMMENT_THIS(iface);
62
63     return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
64 }
65
66 static HRESULT WINAPI HTMLCommentElement_GetTypeInfoCount(IHTMLCommentElement *iface, UINT *pctinfo)
67 {
68     HTMLCommentElement *This = HTMLCOMMENT_THIS(iface);
69     FIXME("(%p)->(%p)\n", This, pctinfo);
70     return E_NOTIMPL;
71 }
72
73 static HRESULT WINAPI HTMLCommentElement_GetTypeInfo(IHTMLCommentElement *iface, UINT iTInfo,
74         LCID lcid, ITypeInfo **ppTInfo)
75 {
76     HTMLCommentElement *This = HTMLCOMMENT_THIS(iface);
77     FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
78     return E_NOTIMPL;
79 }
80
81 static HRESULT WINAPI HTMLCommentElement_GetIDsOfNames(IHTMLCommentElement *iface, REFIID riid,
82                                                 LPOLESTR *rgszNames, UINT cNames,
83                                                 LCID lcid, DISPID *rgDispId)
84 {
85     HTMLCommentElement *This = HTMLCOMMENT_THIS(iface);
86     FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
87                                         lcid, rgDispId);
88     return E_NOTIMPL;
89 }
90
91 static HRESULT WINAPI HTMLCommentElement_Invoke(IHTMLCommentElement *iface, DISPID dispIdMember,
92                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
93                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
94 {
95     HTMLCommentElement *This = HTMLCOMMENT_THIS(iface);
96     FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
97           lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
98     return E_NOTIMPL;
99 }
100
101 static HRESULT WINAPI HTMLCommentElement_put_text(IHTMLCommentElement *iface, BSTR v)
102 {
103     HTMLCommentElement *This = HTMLCOMMENT_THIS(iface);
104     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
105     return E_NOTIMPL;
106 }
107
108 static HRESULT WINAPI HTMLCommentElement_get_text(IHTMLCommentElement *iface, BSTR *p)
109 {
110     HTMLCommentElement *This = HTMLCOMMENT_THIS(iface);
111     FIXME("(%p)->(%p)\n", This, p);
112     return E_NOTIMPL;
113 }
114
115 static HRESULT WINAPI HTMLCommentElement_put_atomic(IHTMLCommentElement *iface, long v)
116 {
117     HTMLCommentElement *This = HTMLCOMMENT_THIS(iface);
118     FIXME("(%p)->(%ld)\n", This, v);
119     return E_NOTIMPL;
120 }
121
122 static HRESULT WINAPI HTMLCommentElement_get_atomic(IHTMLCommentElement *iface, long *p)
123 {
124     HTMLCommentElement *This = HTMLCOMMENT_THIS(iface);
125     FIXME("(%p)->(%p)\n", This, p);
126     return E_NOTIMPL;
127 }
128
129 #undef HTMLCOMMENT_THIS
130
131 static const IHTMLCommentElementVtbl HTMLCommentElementVtbl = {
132     HTMLCommentElement_QueryInterface,
133     HTMLCommentElement_AddRef,
134     HTMLCommentElement_Release,
135     HTMLCommentElement_GetTypeInfoCount,
136     HTMLCommentElement_GetTypeInfo,
137     HTMLCommentElement_GetIDsOfNames,
138     HTMLCommentElement_Invoke,
139     HTMLCommentElement_put_text,
140     HTMLCommentElement_get_text,
141     HTMLCommentElement_put_atomic,
142     HTMLCommentElement_get_atomic
143 };
144
145 #define HTMLCOMMENT_NODE_THIS(iface) DEFINE_THIS2(HTMLCommentElement, element.node, iface)
146
147 HRESULT HTMLCommentElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
148 {
149     HTMLCommentElement *This = HTMLCOMMENT_NODE_THIS(iface);
150
151     *ppv =  NULL;
152
153     if(IsEqualGUID(&IID_IHTMLCommentElement, riid)) {
154         TRACE("(%p)->(IID_IHTMLCommentElement %p)\n", This, ppv);
155         *ppv = HTMLCOMMENT(This);
156     }else {
157         return HTMLElement_QI(&This->element.node, riid, ppv);
158     }
159
160     IUnknown_AddRef((IUnknown*)*ppv);
161     return S_OK;
162 }
163
164 void HTMLCommentElement_destructor(HTMLDOMNode *iface)
165 {
166     HTMLCommentElement *This = HTMLCOMMENT_NODE_THIS(iface);
167
168     HTMLElement_destructor(&This->element.node);
169 }
170
171 #undef HTMLCOMMENT_NODE_THIS
172
173 static const NodeImplVtbl HTMLCommentElementImplVtbl = {
174     HTMLCommentElement_QI,
175     HTMLCommentElement_destructor
176 };
177
178 static const tid_t HTMLCommentElement_iface_tids[] = {
179     IHTMLDOMNode_tid,
180     IHTMLDOMNode2_tid,
181     IHTMLElement_tid,
182     IHTMLElement2_tid,
183     IHTMLCommentElement_tid,
184     0
185 };
186 static dispex_static_data_t HTMLCommentElement_dispex = {
187     NULL,
188     DispHTMLCommentElement_tid,
189     NULL,
190     HTMLCommentElement_iface_tids
191 };
192
193 HTMLElement *HTMLCommentElement_Create(HTMLDocument *doc, nsIDOMNode *nsnode)
194 {
195     HTMLCommentElement *ret = heap_alloc_zero(sizeof(*ret));
196
197     ret->element.node.vtbl = &HTMLCommentElementImplVtbl;
198     ret->lpIHTMLCommentElementVtbl = &HTMLCommentElementVtbl;
199
200     init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLCOMMENT(ret), &HTMLCommentElement_dispex);
201     HTMLElement_Init(&ret->element);
202     HTMLDOMNode_Init(doc, &ret->element.node, nsnode);
203
204     return &ret->element;
205 }