wintrust: Use a helper function to get a signer's cert info from a message.
[wine] / dlls / mshtml / htmltextcont.c
1 /*
2  * Copyright 2006 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 "config.h"
20
21 #include <stdarg.h>
22 #include <stdio.h>
23
24 #define COBJMACROS
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "ole2.h"
30
31 #include "wine/debug.h"
32
33 #include "mshtml_private.h"
34
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
36
37 #define HTMLTEXTCONT_THIS(iface) DEFINE_THIS(HTMLTextContainer, HTMLTextContainer, iface)
38
39 static HRESULT WINAPI HTMLTextContainer_QueryInterface(IHTMLTextContainer *iface,
40                                                        REFIID riid, void **ppv)
41 {
42     HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
43     return IHTMLElement_QueryInterface(HTMLELEM(This->element), riid, ppv);
44 }
45
46 static ULONG WINAPI HTMLTextContainer_AddRef(IHTMLTextContainer *iface)
47 {
48     HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
49     return IHTMLElement_AddRef(HTMLELEM(This->element));
50 }
51
52 static ULONG WINAPI HTMLTextContainer_Release(IHTMLTextContainer *iface)
53 {
54     HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
55     return IHTMLElement_Release(HTMLELEM(This->element));
56 }
57
58 static HRESULT WINAPI HTMLTextContainer_GetTypeInfoCount(IHTMLTextContainer *iface, UINT *pctinfo)
59 {
60     HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
61     FIXME("(%p)->(%p)\n", This, pctinfo);
62     return E_NOTIMPL;
63 }
64
65 static HRESULT WINAPI HTMLTextContainer_GetTypeInfo(IHTMLTextContainer *iface, UINT iTInfo,
66                                               LCID lcid, ITypeInfo **ppTInfo)
67 {
68     HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
69     FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
70     return E_NOTIMPL;
71 }
72
73 static HRESULT WINAPI HTMLTextContainer_GetIDsOfNames(IHTMLTextContainer *iface, REFIID riid,
74                                                 LPOLESTR *rgszNames, UINT cNames,
75                                                 LCID lcid, DISPID *rgDispId)
76 {
77     HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
78     FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
79                                         lcid, rgDispId);
80     return E_NOTIMPL;
81 }
82
83 static HRESULT WINAPI HTMLTextContainer_Invoke(IHTMLTextContainer *iface, DISPID dispIdMember,
84                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
85                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
86 {
87     HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
88     FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
89             lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
90     return E_NOTIMPL;
91 }
92
93 static HRESULT WINAPI HTMLTextContainer_createControlRange(IHTMLTextContainer *iface,
94                                                            IDispatch **range)
95 {
96     HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
97     FIXME("(%p)->(%p)\n", This, range);
98     return E_NOTIMPL;
99 }
100
101 static HRESULT WINAPI HTMLTextContainer_get_scrollHeight(IHTMLTextContainer *iface, long *p)
102 {
103     HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
104     nsIDOMNSHTMLElement *nselem;
105     PRInt32 height = 0;
106     nsresult nsres;
107
108     TRACE("(%p)->(%p)\n", This, p);
109
110     nsres = nsIDOMElement_QueryInterface(This->element->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
111     if(NS_SUCCEEDED(nsres)) {
112         nsIDOMNSHTMLElement_GetScrollHeight(nselem, &height);
113         nsIDOMNSHTMLElement_Release(nselem);
114     }else {
115         ERR("Could not get nsIDOMNSHTMLElement interface: %08x\n", nsres);
116     }
117
118     *p = height;
119     TRACE("*p = %ld\n", *p);
120
121     return S_OK;
122 }
123
124 static HRESULT WINAPI HTMLTextContainer_get_scrollWidth(IHTMLTextContainer *iface, long *p)
125 {
126     HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
127     nsIDOMNSHTMLElement *nselem;
128     PRInt32 width = 0;
129     nsresult nsres;
130
131     TRACE("(%p)->(%p)\n", This, p);
132
133     nsres = nsIDOMElement_QueryInterface(This->element->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
134     if(NS_SUCCEEDED(nsres)) {
135         nsIDOMNSHTMLElement_GetScrollWidth(nselem, &width);
136         nsIDOMNSHTMLElement_Release(nselem);
137     }else {
138         ERR("Could not get nsIDOMNSHTMLElement interface: %08x\n", nsres);
139     }
140
141     *p = width;
142     TRACE("*p = %ld\n", *p);
143
144     return S_OK;
145 }
146
147 static HRESULT WINAPI HTMLTextContainer_put_scrollTop(IHTMLTextContainer *iface, long v)
148 {
149     HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
150     nsIDOMNSHTMLElement *nselem;
151     nsresult nsres;
152
153     TRACE("(%p)->(%ld)\n", This, v);
154
155     nsres = nsIDOMHTMLElement_QueryInterface(This->element->nselem, &IID_nsIDOMNSHTMLElement,
156                                              (void**)&nselem);
157     if(NS_SUCCEEDED(nsres)) {
158         nsIDOMNSHTMLElement_SetScrollTop(nselem, v);
159         nsIDOMNSHTMLElement_Release(nselem);
160     }else {
161         ERR("Could not get nsIDOMNSHTMLElement interface: %08x\n", nsres);
162     }
163
164     return S_OK;
165 }
166
167 static HRESULT WINAPI HTMLTextContainer_get_scrollTop(IHTMLTextContainer *iface, long *p)
168 {
169     HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
170     FIXME("(%p)->(%p)\n", This, p);
171     return E_NOTIMPL;
172 }
173
174 static HRESULT WINAPI HTMLTextContainer_put_scrollLeft(IHTMLTextContainer *iface, long v)
175 {
176     HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
177     nsIDOMNSHTMLElement *nselem;
178     nsresult nsres;
179
180     TRACE("(%p)->(%ld)\n", This, v);
181
182     nsres = nsIDOMHTMLElement_QueryInterface(This->element->nselem, &IID_nsIDOMNSHTMLElement,
183                                              (void**)&nselem);
184     if(NS_SUCCEEDED(nsres)) {
185         nsIDOMNSHTMLElement_SetScrollLeft(nselem, v);
186         nsIDOMNSHTMLElement_Release(nselem);
187     }else {
188         ERR("Could not get nsIDOMNSHTMLElement interface: %08x\n", nsres);
189     }
190
191     return S_OK;
192 }
193
194 static HRESULT WINAPI HTMLTextContainer_get_scrollLeft(IHTMLTextContainer *iface, long *p)
195 {
196     HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
197     FIXME("(%p)->(%p)\n", This, p);
198     return E_NOTIMPL;
199 }
200
201 static HRESULT WINAPI HTMLTextContainer_put_onscroll(IHTMLTextContainer *iface, VARIANT v)
202 {
203     HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
204     FIXME("(%p)->()\n", This);
205     return E_NOTIMPL;
206 }
207
208 static HRESULT WINAPI HTMLTextContainer_get_onscroll(IHTMLTextContainer *iface, VARIANT *p)
209 {
210     HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
211     FIXME("(%p)->(%p)\n", This, p);
212     return E_NOTIMPL;
213 }
214
215 #undef HTMLTEXTCONT_THIS
216
217 static const IHTMLTextContainerVtbl HTMLTextContainerVtbl = {
218     HTMLTextContainer_QueryInterface,
219     HTMLTextContainer_AddRef,
220     HTMLTextContainer_Release,
221     HTMLTextContainer_GetTypeInfoCount,
222     HTMLTextContainer_GetTypeInfo,
223     HTMLTextContainer_GetIDsOfNames,
224     HTMLTextContainer_Invoke,
225     HTMLTextContainer_createControlRange,
226     HTMLTextContainer_get_scrollHeight,
227     HTMLTextContainer_get_scrollWidth,
228     HTMLTextContainer_put_scrollTop,
229     HTMLTextContainer_get_scrollTop,
230     HTMLTextContainer_put_scrollLeft,
231     HTMLTextContainer_get_scrollLeft,
232     HTMLTextContainer_put_onscroll,
233     HTMLTextContainer_get_onscroll
234 };
235
236 void HTMLTextContainer_Init(HTMLTextContainer *This, HTMLElement *elem)
237 {
238     This->lpHTMLTextContainerVtbl = &HTMLTextContainerVtbl;
239     This->element = elem;
240 }