35fa01b1f837e7fabbb6ad0ea5855c188b8616b2
[reactos.git] / reactos / dll / win32 / 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 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->element.node.dispex), pctinfo);
62 }
63
64 static HRESULT WINAPI HTMLTextContainer_GetTypeInfo(IHTMLTextContainer *iface, UINT iTInfo,
65 LCID lcid, ITypeInfo **ppTInfo)
66 {
67 HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
68 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->element.node.dispex), iTInfo, lcid, ppTInfo);
69 }
70
71 static HRESULT WINAPI HTMLTextContainer_GetIDsOfNames(IHTMLTextContainer *iface, REFIID riid,
72 LPOLESTR *rgszNames, UINT cNames,
73 LCID lcid, DISPID *rgDispId)
74 {
75 HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
76 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
77 }
78
79 static HRESULT WINAPI HTMLTextContainer_Invoke(IHTMLTextContainer *iface, DISPID dispIdMember,
80 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
81 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
82 {
83 HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
84 return IDispatchEx_Invoke(DISPATCHEX(&This->element.node.dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
85 pVarResult, pExcepInfo, puArgErr);
86 }
87
88 static HRESULT WINAPI HTMLTextContainer_createControlRange(IHTMLTextContainer *iface,
89 IDispatch **range)
90 {
91 HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
92 FIXME("(%p)->(%p)\n", This, range);
93 return E_NOTIMPL;
94 }
95
96 static HRESULT WINAPI HTMLTextContainer_get_scrollHeight(IHTMLTextContainer *iface, LONG *p)
97 {
98 HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
99
100 TRACE("(%p)->(%p)\n", This, p);
101
102 return IHTMLElement2_get_scrollHeight(HTMLELEM2(&This->element), p);
103 }
104
105 static HRESULT WINAPI HTMLTextContainer_get_scrollWidth(IHTMLTextContainer *iface, LONG *p)
106 {
107 HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
108
109 TRACE("(%p)->(%p)\n", This, p);
110
111 return IHTMLElement2_get_scrollWidth(HTMLELEM2(&This->element), p);
112 }
113
114 static HRESULT WINAPI HTMLTextContainer_put_scrollTop(IHTMLTextContainer *iface, LONG v)
115 {
116 HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
117
118 TRACE("(%p)->(%d)\n", This, v);
119
120 return IHTMLElement2_put_scrollTop(HTMLELEM2(&This->element), v);
121 }
122
123 static HRESULT WINAPI HTMLTextContainer_get_scrollTop(IHTMLTextContainer *iface, LONG *p)
124 {
125 HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
126
127 TRACE("(%p)->(%p)\n", This, p);
128
129 return IHTMLElement2_get_scrollTop(HTMLELEM2(&This->element), p);
130 }
131
132 static HRESULT WINAPI HTMLTextContainer_put_scrollLeft(IHTMLTextContainer *iface, LONG v)
133 {
134 HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
135
136 TRACE("(%p)->(%d)\n", This, v);
137
138 return IHTMLElement2_put_scrollLeft(HTMLELEM2(&This->element), v);
139 }
140
141 static HRESULT WINAPI HTMLTextContainer_get_scrollLeft(IHTMLTextContainer *iface, LONG *p)
142 {
143 HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
144
145 TRACE("(%p)->(%p)\n", This, p);
146
147 return IHTMLElement2_get_scrollLeft(HTMLELEM2(&This->element), p);
148 }
149
150 static HRESULT WINAPI HTMLTextContainer_put_onscroll(IHTMLTextContainer *iface, VARIANT v)
151 {
152 HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
153 FIXME("(%p)->()\n", This);
154 return E_NOTIMPL;
155 }
156
157 static HRESULT WINAPI HTMLTextContainer_get_onscroll(IHTMLTextContainer *iface, VARIANT *p)
158 {
159 HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
160 FIXME("(%p)->(%p)\n", This, p);
161 return E_NOTIMPL;
162 }
163
164 #undef HTMLTEXTCONT_THIS
165
166 static const IHTMLTextContainerVtbl HTMLTextContainerVtbl = {
167 HTMLTextContainer_QueryInterface,
168 HTMLTextContainer_AddRef,
169 HTMLTextContainer_Release,
170 HTMLTextContainer_GetTypeInfoCount,
171 HTMLTextContainer_GetTypeInfo,
172 HTMLTextContainer_GetIDsOfNames,
173 HTMLTextContainer_Invoke,
174 HTMLTextContainer_createControlRange,
175 HTMLTextContainer_get_scrollHeight,
176 HTMLTextContainer_get_scrollWidth,
177 HTMLTextContainer_put_scrollTop,
178 HTMLTextContainer_get_scrollTop,
179 HTMLTextContainer_put_scrollLeft,
180 HTMLTextContainer_get_scrollLeft,
181 HTMLTextContainer_put_onscroll,
182 HTMLTextContainer_get_onscroll
183 };
184
185 void HTMLTextContainer_Init(HTMLTextContainer *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
186 dispex_static_data_t *dispex_data)
187 {
188 This->lpHTMLTextContainerVtbl = &HTMLTextContainerVtbl;
189
190 HTMLElement_Init(&This->element, doc, nselem, dispex_data);
191
192 ConnectionPoint_Init(&This->cp, &This->element.cp_container, &DIID_HTMLTextContainerEvents);
193 }