atl80: Added AtlComModuleRegisterServer implementation (based on AtlModuleRegisterSer...
[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 static inline HTMLTextContainer *impl_from_IHTMLTextContainer(IHTMLTextContainer *iface)
38 {
39     return CONTAINING_RECORD(iface, HTMLTextContainer, IHTMLTextContainer_iface);
40 }
41
42 static HRESULT WINAPI HTMLTextContainer_QueryInterface(IHTMLTextContainer *iface,
43                                                        REFIID riid, void **ppv)
44 {
45     HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
46     return IHTMLElement_QueryInterface(&This->element.IHTMLElement_iface, riid, ppv);
47 }
48
49 static ULONG WINAPI HTMLTextContainer_AddRef(IHTMLTextContainer *iface)
50 {
51     HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
52     return IHTMLElement_AddRef(&This->element.IHTMLElement_iface);
53 }
54
55 static ULONG WINAPI HTMLTextContainer_Release(IHTMLTextContainer *iface)
56 {
57     HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
58     return IHTMLElement_Release(&This->element.IHTMLElement_iface);
59 }
60
61 static HRESULT WINAPI HTMLTextContainer_GetTypeInfoCount(IHTMLTextContainer *iface, UINT *pctinfo)
62 {
63     HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
64     return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
65 }
66
67 static HRESULT WINAPI HTMLTextContainer_GetTypeInfo(IHTMLTextContainer *iface, UINT iTInfo,
68                                               LCID lcid, ITypeInfo **ppTInfo)
69 {
70     HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
71     return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
72             ppTInfo);
73 }
74
75 static HRESULT WINAPI HTMLTextContainer_GetIDsOfNames(IHTMLTextContainer *iface, REFIID riid,
76                                                 LPOLESTR *rgszNames, UINT cNames,
77                                                 LCID lcid, DISPID *rgDispId)
78 {
79     HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
80     return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
81             cNames, lcid, rgDispId);
82 }
83
84 static HRESULT WINAPI HTMLTextContainer_Invoke(IHTMLTextContainer *iface, DISPID dispIdMember,
85                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
86                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
87 {
88     HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
89     return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
90             lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
91 }
92
93 static HRESULT WINAPI HTMLTextContainer_createControlRange(IHTMLTextContainer *iface,
94                                                            IDispatch **range)
95 {
96     HTMLTextContainer *This = impl_from_IHTMLTextContainer(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 = impl_from_IHTMLTextContainer(iface);
104
105     TRACE("(%p)->(%p)\n", This, p);
106
107     return IHTMLElement2_get_scrollHeight(&This->element.IHTMLElement2_iface, p);
108 }
109
110 static HRESULT WINAPI HTMLTextContainer_get_scrollWidth(IHTMLTextContainer *iface, LONG *p)
111 {
112     HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
113
114     TRACE("(%p)->(%p)\n", This, p);
115
116     return IHTMLElement2_get_scrollWidth(&This->element.IHTMLElement2_iface, p);
117 }
118
119 static HRESULT WINAPI HTMLTextContainer_put_scrollTop(IHTMLTextContainer *iface, LONG v)
120 {
121     HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
122
123     TRACE("(%p)->(%d)\n", This, v);
124
125     return IHTMLElement2_put_scrollTop(&This->element.IHTMLElement2_iface, v);
126 }
127
128 static HRESULT WINAPI HTMLTextContainer_get_scrollTop(IHTMLTextContainer *iface, LONG *p)
129 {
130     HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
131
132     TRACE("(%p)->(%p)\n", This, p);
133
134     return IHTMLElement2_get_scrollTop(&This->element.IHTMLElement2_iface, p);
135 }
136
137 static HRESULT WINAPI HTMLTextContainer_put_scrollLeft(IHTMLTextContainer *iface, LONG v)
138 {
139     HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
140
141     TRACE("(%p)->(%d)\n", This, v);
142
143     return IHTMLElement2_put_scrollLeft(&This->element.IHTMLElement2_iface, v);
144 }
145
146 static HRESULT WINAPI HTMLTextContainer_get_scrollLeft(IHTMLTextContainer *iface, LONG *p)
147 {
148     HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
149
150     TRACE("(%p)->(%p)\n", This, p);
151
152     return IHTMLElement2_get_scrollLeft(&This->element.IHTMLElement2_iface, p);
153 }
154
155 static HRESULT WINAPI HTMLTextContainer_put_onscroll(IHTMLTextContainer *iface, VARIANT v)
156 {
157     HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
158     FIXME("(%p)->()\n", This);
159     return E_NOTIMPL;
160 }
161
162 static HRESULT WINAPI HTMLTextContainer_get_onscroll(IHTMLTextContainer *iface, VARIANT *p)
163 {
164     HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
165     FIXME("(%p)->(%p)\n", This, p);
166     return E_NOTIMPL;
167 }
168
169 static const IHTMLTextContainerVtbl HTMLTextContainerVtbl = {
170     HTMLTextContainer_QueryInterface,
171     HTMLTextContainer_AddRef,
172     HTMLTextContainer_Release,
173     HTMLTextContainer_GetTypeInfoCount,
174     HTMLTextContainer_GetTypeInfo,
175     HTMLTextContainer_GetIDsOfNames,
176     HTMLTextContainer_Invoke,
177     HTMLTextContainer_createControlRange,
178     HTMLTextContainer_get_scrollHeight,
179     HTMLTextContainer_get_scrollWidth,
180     HTMLTextContainer_put_scrollTop,
181     HTMLTextContainer_get_scrollTop,
182     HTMLTextContainer_put_scrollLeft,
183     HTMLTextContainer_get_scrollLeft,
184     HTMLTextContainer_put_onscroll,
185     HTMLTextContainer_get_onscroll
186 };
187
188 void HTMLTextContainer_Init(HTMLTextContainer *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
189         dispex_static_data_t *dispex_data)
190 {
191     This->IHTMLTextContainer_iface.lpVtbl = &HTMLTextContainerVtbl;
192
193     HTMLElement_Init(&This->element, doc, nselem, dispex_data);
194
195     ConnectionPoint_Init(&This->cp, &This->element.cp_container, &DIID_HTMLTextContainerEvents, NULL);
196 }