2 * Copyright 2008 Jacek Caban for CodeWeavers
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.
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.
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
29 #include "mshtml_private.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
35 struct HTMLDOMTextNode {
37 const IHTMLDOMTextNodeVtbl *lpIHTMLDOMTextNodeVtbl;
42 #define HTMLTEXT(x) (&(x)->lpIHTMLDOMTextNodeVtbl)
44 #define HTMLTEXT_THIS(iface) DEFINE_THIS(HTMLDOMTextNode, IHTMLDOMTextNode, iface)
46 #define HTMLTEXT_NODE_THIS(iface) DEFINE_THIS2(HTMLDOMTextNode, node, iface)
48 static HRESULT WINAPI HTMLDOMTextNode_QueryInterface(IHTMLDOMTextNode *iface,
49 REFIID riid, void **ppv)
51 HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
53 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->node), riid, ppv);
56 static ULONG WINAPI HTMLDOMTextNode_AddRef(IHTMLDOMTextNode *iface)
58 HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
60 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->node));
63 static ULONG WINAPI HTMLDOMTextNode_Release(IHTMLDOMTextNode *iface)
65 HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
67 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->node));
70 static HRESULT WINAPI HTMLDOMTextNode_GetTypeInfoCount(IHTMLDOMTextNode *iface, UINT *pctinfo)
72 HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
73 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->node.dispex), pctinfo);
76 static HRESULT WINAPI HTMLDOMTextNode_GetTypeInfo(IHTMLDOMTextNode *iface, UINT iTInfo,
77 LCID lcid, ITypeInfo **ppTInfo)
79 HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
80 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->node.dispex), iTInfo, lcid, ppTInfo);
83 static HRESULT WINAPI HTMLDOMTextNode_GetIDsOfNames(IHTMLDOMTextNode *iface, REFIID riid,
84 LPOLESTR *rgszNames, UINT cNames,
85 LCID lcid, DISPID *rgDispId)
87 HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
88 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
91 static HRESULT WINAPI HTMLDOMTextNode_Invoke(IHTMLDOMTextNode *iface, DISPID dispIdMember,
92 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
93 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
95 HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
96 return IDispatchEx_Invoke(DISPATCHEX(&This->node.dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
97 pVarResult, pExcepInfo, puArgErr);
100 static HRESULT WINAPI HTMLDOMTextNode_put_data(IHTMLDOMTextNode *iface, BSTR v)
102 HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
103 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
107 static HRESULT WINAPI HTMLDOMTextNode_get_data(IHTMLDOMTextNode *iface, BSTR *p)
109 HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
110 FIXME("(%p)->(%p)\n", This, p);
114 static HRESULT WINAPI HTMLDOMTextNode_toString(IHTMLDOMTextNode *iface, BSTR *String)
116 HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
117 FIXME("(%p)->(%p)\n", This, String);
121 static HRESULT WINAPI HTMLDOMTextNode_get_length(IHTMLDOMTextNode *iface, LONG *p)
123 HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
127 TRACE("(%p)->(%p)\n", This, p);
129 nsres = nsIDOMText_GetLength(This->nstext, &length);
131 ERR("GetLength failed: %08x\n", nsres);
137 static HRESULT WINAPI HTMLDOMTextNode_splitText(IHTMLDOMTextNode *iface, LONG offset, IHTMLDOMNode **pRetNode)
139 HTMLDOMTextNode *This = HTMLTEXT_THIS(iface);
140 FIXME("(%p)->(%d %p)\n", This, offset, pRetNode);
146 static const IHTMLDOMTextNodeVtbl HTMLDOMTextNodeVtbl = {
147 HTMLDOMTextNode_QueryInterface,
148 HTMLDOMTextNode_AddRef,
149 HTMLDOMTextNode_Release,
150 HTMLDOMTextNode_GetTypeInfoCount,
151 HTMLDOMTextNode_GetTypeInfo,
152 HTMLDOMTextNode_GetIDsOfNames,
153 HTMLDOMTextNode_Invoke,
154 HTMLDOMTextNode_put_data,
155 HTMLDOMTextNode_get_data,
156 HTMLDOMTextNode_toString,
157 HTMLDOMTextNode_get_length,
158 HTMLDOMTextNode_splitText
161 #define HTMLTEXT_NODE_THIS(iface) DEFINE_THIS2(HTMLDOMTextNode, node, iface)
163 static HRESULT HTMLDOMTextNode_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
165 HTMLDOMTextNode *This = HTMLTEXT_NODE_THIS(iface);
169 if(IsEqualGUID(&IID_IHTMLDOMTextNode, riid)) {
170 TRACE("(%p)->(IID_IHTMLDOMTextNode %p)\n", This, ppv);
171 *ppv = HTMLTEXT(This);
173 return HTMLDOMNode_QI(&This->node, riid, ppv);
176 IUnknown_AddRef((IUnknown*)*ppv);
180 static void HTMLDOMTextNode_destructor(HTMLDOMNode *iface)
182 HTMLDOMTextNode *This = HTMLTEXT_NODE_THIS(iface);
185 IHTMLDOMTextNode_Release(This->nstext);
187 HTMLDOMNode_destructor(&This->node);
190 #undef HTMLTEXT_NODE_THIS
192 static const NodeImplVtbl HTMLDOMTextNodeImplVtbl = {
194 HTMLDOMTextNode_destructor
197 static const tid_t HTMLDOMTextNode_iface_tids[] = {
200 IHTMLDOMTextNode_tid,
203 static dispex_static_data_t HTMLDOMTextNode_dispex = {
205 DispHTMLDOMTextNode_tid,
207 HTMLDOMTextNode_iface_tids
210 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode)
212 HTMLDOMTextNode *ret;
215 ret = heap_alloc_zero(sizeof(*ret));
216 ret->node.vtbl = &HTMLDOMTextNodeImplVtbl;
217 ret->lpIHTMLDOMTextNodeVtbl = &HTMLDOMTextNodeVtbl;
219 init_dispex(&ret->node.dispex, (IUnknown*)HTMLTEXT(ret), &HTMLDOMTextNode_dispex);
220 HTMLDOMNode_Init(doc, &ret->node, nsnode);
222 nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMText, (void**)&ret->nstext);
224 ERR("Could not get nsIDOMText iface: %08x\n", nsres);