user32: Fix for failing tests of LB_GETTEXT on listbox on Win98.
[wine/multimedia.git] / dlls / msxml3 / text.c
bloba1e7d49677d92965979d600c89fe41da354055a1
1 /*
2 * DOM text node implementation
4 * Copyright 2006 Huw Davies
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define COBJMACROS
23 #include "config.h"
25 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "ole2.h"
30 #include "msxml2.h"
32 #include "msxml_private.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
38 #ifdef HAVE_LIBXML2
40 typedef struct _domtext
42 const struct IXMLDOMTextVtbl *lpVtbl;
43 LONG ref;
44 IUnknown *element_unk;
45 IXMLDOMElement *element;
46 } domtext;
48 static inline domtext *impl_from_IXMLDOMText( IXMLDOMText *iface )
50 return (domtext *)((char*)iface - FIELD_OFFSET(domtext, lpVtbl));
53 static HRESULT WINAPI domtext_QueryInterface(
54 IXMLDOMText *iface,
55 REFIID riid,
56 void** ppvObject )
58 domtext *This = impl_from_IXMLDOMText( iface );
59 TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
61 if ( IsEqualGUID( riid, &IID_IXMLDOMText ) ||
62 IsEqualGUID( riid, &IID_IUnknown ) )
64 *ppvObject = iface;
66 else if ( IsEqualGUID( riid, &IID_IDispatch ) ||
67 IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
68 IsEqualGUID( riid, &IID_IXMLDOMElement ) )
70 return IUnknown_QueryInterface(This->element_unk, riid, ppvObject);
72 else
74 FIXME("Unsupported inteferace %s\n", debugstr_guid(riid));
75 return E_NOINTERFACE;
78 IXMLDOMText_AddRef( iface );
80 return S_OK;
83 static ULONG WINAPI domtext_AddRef(
84 IXMLDOMText *iface )
86 domtext *This = impl_from_IXMLDOMText( iface );
87 return InterlockedIncrement( &This->ref );
90 static ULONG WINAPI domtext_Release(
91 IXMLDOMText *iface )
93 domtext *This = impl_from_IXMLDOMText( iface );
94 ULONG ref;
96 ref = InterlockedDecrement( &This->ref );
97 if ( ref == 0 )
99 IUnknown_Release( This->element_unk );
100 HeapFree( GetProcessHeap(), 0, This );
103 return ref;
106 static HRESULT WINAPI domtext_GetTypeInfoCount(
107 IXMLDOMText *iface,
108 UINT* pctinfo )
110 FIXME("\n");
111 return E_NOTIMPL;
114 static HRESULT WINAPI domtext_GetTypeInfo(
115 IXMLDOMText *iface,
116 UINT iTInfo, LCID lcid,
117 ITypeInfo** ppTInfo )
119 FIXME("\n");
120 return E_NOTIMPL;
123 static HRESULT WINAPI domtext_GetIDsOfNames(
124 IXMLDOMText *iface,
125 REFIID riid, LPOLESTR* rgszNames,
126 UINT cNames, LCID lcid, DISPID* rgDispId )
128 FIXME("\n");
129 return E_NOTIMPL;
132 static HRESULT WINAPI domtext_Invoke(
133 IXMLDOMText *iface,
134 DISPID dispIdMember, REFIID riid, LCID lcid,
135 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
136 EXCEPINFO* pExcepInfo, UINT* puArgErr )
138 FIXME("\n");
139 return E_NOTIMPL;
142 static HRESULT WINAPI domtext_get_nodeName(
143 IXMLDOMText *iface,
144 BSTR* p )
146 domtext *This = impl_from_IXMLDOMText( iface );
147 return IXMLDOMNode_get_nodeName( This->element, p );
150 static HRESULT WINAPI domtext_get_nodeValue(
151 IXMLDOMText *iface,
152 VARIANT* var1 )
154 domtext *This = impl_from_IXMLDOMText( iface );
155 return IXMLDOMNode_get_nodeValue( This->element, var1 );
158 static HRESULT WINAPI domtext_put_nodeValue(
159 IXMLDOMText *iface,
160 VARIANT var1 )
162 domtext *This = impl_from_IXMLDOMText( iface );
163 return IXMLDOMNode_put_nodeValue( This->element, var1 );
166 static HRESULT WINAPI domtext_get_nodeType(
167 IXMLDOMText *iface,
168 DOMNodeType* domNodeType )
170 domtext *This = impl_from_IXMLDOMText( iface );
171 return IXMLDOMNode_get_nodeType( This->element, domNodeType );
174 static HRESULT WINAPI domtext_get_parentNode(
175 IXMLDOMText *iface,
176 IXMLDOMNode** parent )
178 domtext *This = impl_from_IXMLDOMText( iface );
179 return IXMLDOMNode_get_parentNode( This->element, parent );
182 static HRESULT WINAPI domtext_get_childNodes(
183 IXMLDOMText *iface,
184 IXMLDOMNodeList** outList)
186 domtext *This = impl_from_IXMLDOMText( iface );
187 return IXMLDOMNode_get_childNodes( This->element, outList );
190 static HRESULT WINAPI domtext_get_firstChild(
191 IXMLDOMText *iface,
192 IXMLDOMNode** domNode)
194 domtext *This = impl_from_IXMLDOMText( iface );
195 return IXMLDOMNode_get_firstChild( This->element, domNode );
198 static HRESULT WINAPI domtext_get_lastChild(
199 IXMLDOMText *iface,
200 IXMLDOMNode** domNode)
202 domtext *This = impl_from_IXMLDOMText( iface );
203 return IXMLDOMNode_get_lastChild( This->element, domNode );
206 static HRESULT WINAPI domtext_get_previousSibling(
207 IXMLDOMText *iface,
208 IXMLDOMNode** domNode)
210 domtext *This = impl_from_IXMLDOMText( iface );
211 return IXMLDOMNode_get_previousSibling( This->element, domNode );
214 static HRESULT WINAPI domtext_get_nextSibling(
215 IXMLDOMText *iface,
216 IXMLDOMNode** domNode)
218 domtext *This = impl_from_IXMLDOMText( iface );
219 return IXMLDOMNode_get_nextSibling( This->element, domNode );
222 static HRESULT WINAPI domtext_get_attributes(
223 IXMLDOMText *iface,
224 IXMLDOMNamedNodeMap** attributeMap)
226 domtext *This = impl_from_IXMLDOMText( iface );
227 return IXMLDOMNode_get_attributes( This->element, attributeMap );
230 static HRESULT WINAPI domtext_insertBefore(
231 IXMLDOMText *iface,
232 IXMLDOMNode* newNode, VARIANT var1,
233 IXMLDOMNode** outOldNode)
235 domtext *This = impl_from_IXMLDOMText( iface );
236 return IXMLDOMNode_insertBefore( This->element, newNode, var1, outOldNode );
239 static HRESULT WINAPI domtext_replaceChild(
240 IXMLDOMText *iface,
241 IXMLDOMNode* newNode,
242 IXMLDOMNode* oldNode,
243 IXMLDOMNode** outOldNode)
245 domtext *This = impl_from_IXMLDOMText( iface );
246 return IXMLDOMNode_replaceChild( This->element, newNode, oldNode, outOldNode );
249 static HRESULT WINAPI domtext_removeChild(
250 IXMLDOMText *iface,
251 IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
253 domtext *This = impl_from_IXMLDOMText( iface );
254 return IXMLDOMNode_removeChild( This->element, domNode, oldNode );
257 static HRESULT WINAPI domtext_appendChild(
258 IXMLDOMText *iface,
259 IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
261 domtext *This = impl_from_IXMLDOMText( iface );
262 return IXMLDOMNode_appendChild( This->element, newNode, outNewNode );
265 static HRESULT WINAPI domtext_hasChildNodes(
266 IXMLDOMText *iface,
267 VARIANT_BOOL* pbool)
269 domtext *This = impl_from_IXMLDOMText( iface );
270 return IXMLDOMNode_hasChildNodes( This->element, pbool );
273 static HRESULT WINAPI domtext_get_ownerDocument(
274 IXMLDOMText *iface,
275 IXMLDOMDocument** domDocument)
277 domtext *This = impl_from_IXMLDOMText( iface );
278 return IXMLDOMNode_get_ownerDocument( This->element, domDocument );
281 static HRESULT WINAPI domtext_cloneNode(
282 IXMLDOMText *iface,
283 VARIANT_BOOL pbool, IXMLDOMNode** outNode)
285 domtext *This = impl_from_IXMLDOMText( iface );
286 return IXMLDOMNode_cloneNode( This->element, pbool, outNode );
289 static HRESULT WINAPI domtext_get_nodeTypeString(
290 IXMLDOMText *iface,
291 BSTR* p)
293 domtext *This = impl_from_IXMLDOMText( iface );
294 return IXMLDOMNode_get_nodeTypeString( This->element, p );
297 static HRESULT WINAPI domtext_get_text(
298 IXMLDOMText *iface,
299 BSTR* p)
301 domtext *This = impl_from_IXMLDOMText( iface );
302 return IXMLDOMNode_get_text( This->element, p );
305 static HRESULT WINAPI domtext_put_text(
306 IXMLDOMText *iface,
307 BSTR p)
309 domtext *This = impl_from_IXMLDOMText( iface );
310 return IXMLDOMNode_put_text( This->element, p );
313 static HRESULT WINAPI domtext_get_specified(
314 IXMLDOMText *iface,
315 VARIANT_BOOL* pbool)
317 domtext *This = impl_from_IXMLDOMText( iface );
318 return IXMLDOMNode_get_specified( This->element, pbool );
321 static HRESULT WINAPI domtext_get_definition(
322 IXMLDOMText *iface,
323 IXMLDOMNode** domNode)
325 domtext *This = impl_from_IXMLDOMText( iface );
326 return IXMLDOMNode_get_definition( This->element, domNode );
329 static HRESULT WINAPI domtext_get_nodeTypedValue(
330 IXMLDOMText *iface,
331 VARIANT* var1)
333 domtext *This = impl_from_IXMLDOMText( iface );
334 return IXMLDOMNode_get_nodeTypedValue( This->element, var1 );
337 static HRESULT WINAPI domtext_put_nodeTypedValue(
338 IXMLDOMText *iface,
339 VARIANT var1)
341 domtext *This = impl_from_IXMLDOMText( iface );
342 return IXMLDOMNode_put_nodeTypedValue( This->element, var1 );
345 static HRESULT WINAPI domtext_get_dataType(
346 IXMLDOMText *iface,
347 VARIANT* var1)
349 domtext *This = impl_from_IXMLDOMText( iface );
350 return IXMLDOMNode_get_dataType( This->element, var1 );
353 static HRESULT WINAPI domtext_put_dataType(
354 IXMLDOMText *iface,
355 BSTR p)
357 domtext *This = impl_from_IXMLDOMText( iface );
358 return IXMLDOMNode_put_dataType( This->element, p );
361 static HRESULT WINAPI domtext_get_xml(
362 IXMLDOMText *iface,
363 BSTR* p)
365 domtext *This = impl_from_IXMLDOMText( iface );
366 return IXMLDOMNode_get_xml( This->element, p );
369 static HRESULT WINAPI domtext_transformNode(
370 IXMLDOMText *iface,
371 IXMLDOMNode* domNode, BSTR* p)
373 domtext *This = impl_from_IXMLDOMText( iface );
374 return IXMLDOMNode_transformNode( This->element, domNode, p );
377 static HRESULT WINAPI domtext_selectNodes(
378 IXMLDOMText *iface,
379 BSTR p, IXMLDOMNodeList** outList)
381 domtext *This = impl_from_IXMLDOMText( iface );
382 return IXMLDOMNode_selectNodes( This->element, p, outList );
385 static HRESULT WINAPI domtext_selectSingleNode(
386 IXMLDOMText *iface,
387 BSTR p, IXMLDOMNode** outNode)
389 domtext *This = impl_from_IXMLDOMText( iface );
390 return IXMLDOMNode_selectSingleNode( This->element, p, outNode );
393 static HRESULT WINAPI domtext_get_parsed(
394 IXMLDOMText *iface,
395 VARIANT_BOOL* pbool)
397 domtext *This = impl_from_IXMLDOMText( iface );
398 return IXMLDOMNode_get_parsed( This->element, pbool );
401 static HRESULT WINAPI domtext_get_namespaceURI(
402 IXMLDOMText *iface,
403 BSTR* p)
405 domtext *This = impl_from_IXMLDOMText( iface );
406 return IXMLDOMNode_get_namespaceURI( This->element, p );
409 static HRESULT WINAPI domtext_get_prefix(
410 IXMLDOMText *iface,
411 BSTR* p)
413 domtext *This = impl_from_IXMLDOMText( iface );
414 return IXMLDOMNode_get_prefix( This->element, p );
417 static HRESULT WINAPI domtext_get_baseName(
418 IXMLDOMText *iface,
419 BSTR* p)
421 domtext *This = impl_from_IXMLDOMText( iface );
422 return IXMLDOMNode_get_baseName( This->element, p );
425 static HRESULT WINAPI domtext_transformNodeToObject(
426 IXMLDOMText *iface,
427 IXMLDOMNode* domNode, VARIANT var1)
429 domtext *This = impl_from_IXMLDOMText( iface );
430 return IXMLDOMNode_transformNodeToObject( This->element, domNode, var1 );
433 static HRESULT WINAPI domtext_get_data(
434 IXMLDOMText *iface,
435 BSTR *p)
437 FIXME("\n");
438 return E_NOTIMPL;
441 static HRESULT WINAPI domtext_put_data(
442 IXMLDOMText *iface,
443 BSTR data)
445 FIXME("\n");
446 return E_NOTIMPL;
449 static HRESULT WINAPI domtext_get_length(
450 IXMLDOMText *iface,
451 long *len)
453 FIXME("\n");
454 return E_NOTIMPL;
457 static HRESULT WINAPI domtext_substringData(
458 IXMLDOMText *iface,
459 long offset, long count, BSTR *p)
461 FIXME("\n");
462 return E_NOTIMPL;
465 static HRESULT WINAPI domtext_appendData(
466 IXMLDOMText *iface,
467 BSTR p)
469 FIXME("\n");
470 return E_NOTIMPL;
473 static HRESULT WINAPI domtext_insertData(
474 IXMLDOMText *iface,
475 long offset, BSTR p)
477 FIXME("\n");
478 return E_NOTIMPL;
481 static HRESULT WINAPI domtext_deleteData(
482 IXMLDOMText *iface,
483 long offset, long count)
485 FIXME("\n");
486 return E_NOTIMPL;
489 static HRESULT WINAPI domtext_replaceData(
490 IXMLDOMText *iface,
491 long offset, long count, BSTR p)
493 FIXME("\n");
494 return E_NOTIMPL;
497 static HRESULT WINAPI domtext_splitText(
498 IXMLDOMText *iface,
499 long offset, IXMLDOMText **txtNode)
501 FIXME("\n");
502 return E_NOTIMPL;
506 static const struct IXMLDOMTextVtbl domtext_vtbl =
508 domtext_QueryInterface,
509 domtext_AddRef,
510 domtext_Release,
511 domtext_GetTypeInfoCount,
512 domtext_GetTypeInfo,
513 domtext_GetIDsOfNames,
514 domtext_Invoke,
515 domtext_get_nodeName,
516 domtext_get_nodeValue,
517 domtext_put_nodeValue,
518 domtext_get_nodeType,
519 domtext_get_parentNode,
520 domtext_get_childNodes,
521 domtext_get_firstChild,
522 domtext_get_lastChild,
523 domtext_get_previousSibling,
524 domtext_get_nextSibling,
525 domtext_get_attributes,
526 domtext_insertBefore,
527 domtext_replaceChild,
528 domtext_removeChild,
529 domtext_appendChild,
530 domtext_hasChildNodes,
531 domtext_get_ownerDocument,
532 domtext_cloneNode,
533 domtext_get_nodeTypeString,
534 domtext_get_text,
535 domtext_put_text,
536 domtext_get_specified,
537 domtext_get_definition,
538 domtext_get_nodeTypedValue,
539 domtext_put_nodeTypedValue,
540 domtext_get_dataType,
541 domtext_put_dataType,
542 domtext_get_xml,
543 domtext_transformNode,
544 domtext_selectNodes,
545 domtext_selectSingleNode,
546 domtext_get_parsed,
547 domtext_get_namespaceURI,
548 domtext_get_prefix,
549 domtext_get_baseName,
550 domtext_transformNodeToObject,
551 domtext_get_data,
552 domtext_put_data,
553 domtext_get_length,
554 domtext_substringData,
555 domtext_appendData,
556 domtext_insertData,
557 domtext_deleteData,
558 domtext_replaceData,
559 domtext_splitText
562 IUnknown* create_text( xmlNodePtr text )
564 domtext *This;
565 HRESULT hr;
567 This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
568 if ( !This )
569 return NULL;
571 This->lpVtbl = &domtext_vtbl;
572 This->ref = 1;
574 This->element_unk = create_element( text, (IUnknown*)&This->lpVtbl );
575 if(!This->element_unk)
577 HeapFree(GetProcessHeap(), 0, This);
578 return NULL;
581 hr = IUnknown_QueryInterface(This->element_unk, &IID_IXMLDOMNode, (LPVOID*)&This->element);
582 if(FAILED(hr))
584 IUnknown_Release(This->element_unk);
585 HeapFree( GetProcessHeap(), 0, This );
586 return NULL;
588 /* The ref on This->element is actually looped back into this object, so release it */
589 IXMLDOMNode_Release(This->element);
591 return (IUnknown*) &This->lpVtbl;
594 #endif