dsdmo: Add Flanger effect stub.
[wine.git] / dlls / msxml3 / entityref.c
blob5a446b3271ddd7934c715a2c012cf8f7569fd4d2
1 /*
2 * DOM Entity Reference implementation
4 * Copyright 2007 Alistair Leslie-Hughes
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 <stdarg.h>
24 #include <libxml/parser.h>
25 #include <libxml/xmlerror.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winuser.h"
30 #include "ole2.h"
31 #include "msxml6.h"
33 #include "msxml_private.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
39 typedef struct _entityref
41 xmlnode node;
42 IXMLDOMEntityReference IXMLDOMEntityReference_iface;
43 LONG ref;
44 } entityref;
46 static const tid_t domentityref_se_tids[] = {
47 IXMLDOMNode_tid,
48 IXMLDOMEntityReference_tid,
49 NULL_tid
52 static inline entityref *impl_from_IXMLDOMEntityReference( IXMLDOMEntityReference *iface )
54 return CONTAINING_RECORD(iface, entityref, IXMLDOMEntityReference_iface);
57 static HRESULT WINAPI entityref_QueryInterface(
58 IXMLDOMEntityReference *iface,
59 REFIID riid,
60 void** ppvObject )
62 entityref *This = impl_from_IXMLDOMEntityReference( iface );
63 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
65 if ( IsEqualGUID( riid, &IID_IXMLDOMEntityReference ) ||
66 IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
67 IsEqualGUID( riid, &IID_IDispatch ) ||
68 IsEqualGUID( riid, &IID_IUnknown ) )
70 *ppvObject = iface;
72 else if(node_query_interface(&This->node, riid, ppvObject))
74 return *ppvObject ? S_OK : E_NOINTERFACE;
76 else if (IsEqualGUID( riid, &IID_ISupportErrorInfo ))
78 return node_create_supporterrorinfo(domentityref_se_tids, ppvObject);
80 else
82 TRACE("Unsupported interface %s\n", debugstr_guid(riid));
83 *ppvObject = NULL;
84 return E_NOINTERFACE;
87 IUnknown_AddRef((IUnknown*)*ppvObject);
88 return S_OK;
91 static ULONG WINAPI entityref_AddRef(
92 IXMLDOMEntityReference *iface )
94 entityref *This = impl_from_IXMLDOMEntityReference( iface );
95 ULONG ref = InterlockedIncrement( &This->ref );
96 TRACE("%p, refcount %lu.\n", iface, ref);
97 return ref;
100 static ULONG WINAPI entityref_Release(
101 IXMLDOMEntityReference *iface )
103 entityref *This = impl_from_IXMLDOMEntityReference( iface );
104 ULONG ref = InterlockedDecrement( &This->ref );
106 TRACE("%p, refcount %lu.\n", iface, ref);
108 if (!ref)
110 destroy_xmlnode(&This->node);
111 heap_free( This );
114 return ref;
117 static HRESULT WINAPI entityref_GetTypeInfoCount(
118 IXMLDOMEntityReference *iface,
119 UINT* pctinfo )
121 entityref *This = impl_from_IXMLDOMEntityReference( iface );
122 return IDispatchEx_GetTypeInfoCount(&This->node.dispex.IDispatchEx_iface, pctinfo);
125 static HRESULT WINAPI entityref_GetTypeInfo(
126 IXMLDOMEntityReference *iface,
127 UINT iTInfo, LCID lcid,
128 ITypeInfo** ppTInfo )
130 entityref *This = impl_from_IXMLDOMEntityReference( iface );
131 return IDispatchEx_GetTypeInfo(&This->node.dispex.IDispatchEx_iface,
132 iTInfo, lcid, ppTInfo);
135 static HRESULT WINAPI entityref_GetIDsOfNames(
136 IXMLDOMEntityReference *iface,
137 REFIID riid, LPOLESTR* rgszNames,
138 UINT cNames, LCID lcid, DISPID* rgDispId )
140 entityref *This = impl_from_IXMLDOMEntityReference( iface );
141 return IDispatchEx_GetIDsOfNames(&This->node.dispex.IDispatchEx_iface,
142 riid, rgszNames, cNames, lcid, rgDispId);
145 static HRESULT WINAPI entityref_Invoke(
146 IXMLDOMEntityReference *iface,
147 DISPID dispIdMember, REFIID riid, LCID lcid,
148 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
149 EXCEPINFO* pExcepInfo, UINT* puArgErr )
151 entityref *This = impl_from_IXMLDOMEntityReference( iface );
152 return IDispatchEx_Invoke(&This->node.dispex.IDispatchEx_iface,
153 dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
156 static HRESULT WINAPI entityref_get_nodeName(
157 IXMLDOMEntityReference *iface,
158 BSTR* p )
160 entityref *This = impl_from_IXMLDOMEntityReference( iface );
162 FIXME("(%p)->(%p)\n", This, p);
164 return node_get_nodeName(&This->node, p);
167 static HRESULT WINAPI entityref_get_nodeValue(
168 IXMLDOMEntityReference *iface,
169 VARIANT* value)
171 entityref *This = impl_from_IXMLDOMEntityReference( iface );
172 TRACE("(%p)->(%p)\n", This, value);
173 return return_null_var(value);
176 static HRESULT WINAPI entityref_put_nodeValue(
177 IXMLDOMEntityReference *iface,
178 VARIANT value)
180 entityref *This = impl_from_IXMLDOMEntityReference( iface );
181 TRACE("(%p)->(%s)\n", This, debugstr_variant(&value));
182 return E_FAIL;
185 static HRESULT WINAPI entityref_get_nodeType(
186 IXMLDOMEntityReference *iface,
187 DOMNodeType* domNodeType )
189 entityref *This = impl_from_IXMLDOMEntityReference( iface );
191 TRACE("(%p)->(%p)\n", This, domNodeType);
193 *domNodeType = NODE_ENTITY_REFERENCE;
194 return S_OK;
197 static HRESULT WINAPI entityref_get_parentNode(
198 IXMLDOMEntityReference *iface,
199 IXMLDOMNode** parent )
201 entityref *This = impl_from_IXMLDOMEntityReference( iface );
203 TRACE("(%p)->(%p)\n", This, parent);
205 return node_get_parent(&This->node, parent);
208 static HRESULT WINAPI entityref_get_childNodes(
209 IXMLDOMEntityReference *iface,
210 IXMLDOMNodeList** outList)
212 entityref *This = impl_from_IXMLDOMEntityReference( iface );
214 TRACE("(%p)->(%p)\n", This, outList);
216 return node_get_child_nodes(&This->node, outList);
219 static HRESULT WINAPI entityref_get_firstChild(
220 IXMLDOMEntityReference *iface,
221 IXMLDOMNode** domNode)
223 entityref *This = impl_from_IXMLDOMEntityReference( iface );
225 TRACE("(%p)->(%p)\n", This, domNode);
227 return node_get_first_child(&This->node, domNode);
230 static HRESULT WINAPI entityref_get_lastChild(
231 IXMLDOMEntityReference *iface,
232 IXMLDOMNode** domNode)
234 entityref *This = impl_from_IXMLDOMEntityReference( iface );
236 TRACE("(%p)->(%p)\n", This, domNode);
238 return node_get_last_child(&This->node, domNode);
241 static HRESULT WINAPI entityref_get_previousSibling(
242 IXMLDOMEntityReference *iface,
243 IXMLDOMNode** domNode)
245 entityref *This = impl_from_IXMLDOMEntityReference( iface );
247 TRACE("(%p)->(%p)\n", This, domNode);
249 return node_get_previous_sibling(&This->node, domNode);
252 static HRESULT WINAPI entityref_get_nextSibling(
253 IXMLDOMEntityReference *iface,
254 IXMLDOMNode** domNode)
256 entityref *This = impl_from_IXMLDOMEntityReference( iface );
258 TRACE("(%p)->(%p)\n", This, domNode);
260 return node_get_next_sibling(&This->node, domNode);
263 static HRESULT WINAPI entityref_get_attributes(
264 IXMLDOMEntityReference *iface,
265 IXMLDOMNamedNodeMap** attributeMap)
267 entityref *This = impl_from_IXMLDOMEntityReference( iface );
269 TRACE("(%p)->(%p)\n", This, attributeMap);
271 return return_null_ptr((void**)attributeMap);
274 static HRESULT WINAPI entityref_insertBefore(
275 IXMLDOMEntityReference *iface,
276 IXMLDOMNode* newNode, VARIANT refChild,
277 IXMLDOMNode** outOldNode)
279 entityref *This = impl_from_IXMLDOMEntityReference( iface );
281 FIXME("(%p)->(%p %s %p) needs test\n", This, newNode, debugstr_variant(&refChild), outOldNode);
283 return node_insert_before(&This->node, newNode, &refChild, outOldNode);
286 static HRESULT WINAPI entityref_replaceChild(
287 IXMLDOMEntityReference *iface,
288 IXMLDOMNode* newNode,
289 IXMLDOMNode* oldNode,
290 IXMLDOMNode** outOldNode)
292 entityref *This = impl_from_IXMLDOMEntityReference( iface );
294 FIXME("(%p)->(%p %p %p) needs test\n", This, newNode, oldNode, outOldNode);
296 return node_replace_child(&This->node, newNode, oldNode, outOldNode);
299 static HRESULT WINAPI entityref_removeChild(
300 IXMLDOMEntityReference *iface,
301 IXMLDOMNode *child, IXMLDOMNode **oldChild)
303 entityref *This = impl_from_IXMLDOMEntityReference( iface );
304 TRACE("(%p)->(%p %p)\n", This, child, oldChild);
305 return node_remove_child(&This->node, child, oldChild);
308 static HRESULT WINAPI entityref_appendChild(
309 IXMLDOMEntityReference *iface,
310 IXMLDOMNode *child, IXMLDOMNode **outChild)
312 entityref *This = impl_from_IXMLDOMEntityReference( iface );
313 TRACE("(%p)->(%p %p)\n", This, child, outChild);
314 return node_append_child(&This->node, child, outChild);
317 static HRESULT WINAPI entityref_hasChildNodes(
318 IXMLDOMEntityReference *iface,
319 VARIANT_BOOL *ret)
321 entityref *This = impl_from_IXMLDOMEntityReference( iface );
322 TRACE("(%p)->(%p)\n", This, ret);
323 return node_has_childnodes(&This->node, ret);
326 static HRESULT WINAPI entityref_get_ownerDocument(
327 IXMLDOMEntityReference *iface,
328 IXMLDOMDocument **doc)
330 entityref *This = impl_from_IXMLDOMEntityReference( iface );
331 TRACE("(%p)->(%p)\n", This, doc);
332 return node_get_owner_doc(&This->node, doc);
335 static HRESULT WINAPI entityref_cloneNode(
336 IXMLDOMEntityReference *iface,
337 VARIANT_BOOL deep, IXMLDOMNode** outNode)
339 entityref *This = impl_from_IXMLDOMEntityReference( iface );
340 TRACE("(%p)->(%d %p)\n", This, deep, outNode);
341 return node_clone( &This->node, deep, outNode );
344 static HRESULT WINAPI entityref_get_nodeTypeString(
345 IXMLDOMEntityReference *iface,
346 BSTR* p)
348 entityref *This = impl_from_IXMLDOMEntityReference( iface );
349 static const WCHAR entityreferenceW[] = {'e','n','t','i','t','y','r','e','f','e','r','e','n','c','e',0};
351 TRACE("(%p)->(%p)\n", This, p);
353 return return_bstr(entityreferenceW, p);
356 static HRESULT WINAPI entityref_get_text(
357 IXMLDOMEntityReference *iface,
358 BSTR* p)
360 entityref *This = impl_from_IXMLDOMEntityReference( iface );
361 TRACE("(%p)->(%p)\n", This, p);
362 return node_get_text(&This->node, p);
365 static HRESULT WINAPI entityref_put_text(
366 IXMLDOMEntityReference *iface,
367 BSTR p)
369 entityref *This = impl_from_IXMLDOMEntityReference( iface );
370 TRACE("(%p)->(%s)\n", This, debugstr_w(p));
371 return node_put_text( &This->node, p );
374 static HRESULT WINAPI entityref_get_specified(
375 IXMLDOMEntityReference *iface,
376 VARIANT_BOOL* isSpecified)
378 entityref *This = impl_from_IXMLDOMEntityReference( iface );
379 FIXME("(%p)->(%p) stub!\n", This, isSpecified);
380 *isSpecified = VARIANT_TRUE;
381 return S_OK;
384 static HRESULT WINAPI entityref_get_definition(
385 IXMLDOMEntityReference *iface,
386 IXMLDOMNode** definitionNode)
388 entityref *This = impl_from_IXMLDOMEntityReference( iface );
389 FIXME("(%p)->(%p)\n", This, definitionNode);
390 return E_NOTIMPL;
393 static HRESULT WINAPI entityref_get_nodeTypedValue(
394 IXMLDOMEntityReference *iface,
395 VARIANT* var1)
397 entityref *This = impl_from_IXMLDOMEntityReference( iface );
398 FIXME("(%p)->(%p)\n", This, var1);
399 return return_null_var(var1);
402 static HRESULT WINAPI entityref_put_nodeTypedValue(
403 IXMLDOMEntityReference *iface,
404 VARIANT typedValue)
406 entityref *This = impl_from_IXMLDOMEntityReference( iface );
407 FIXME("(%p)->(%s)\n", This, debugstr_variant(&typedValue));
408 return E_NOTIMPL;
411 static HRESULT WINAPI entityref_get_dataType(
412 IXMLDOMEntityReference *iface,
413 VARIANT* typename)
415 entityref *This = impl_from_IXMLDOMEntityReference( iface );
416 FIXME("(%p)->(%p): should return a valid value\n", This, typename);
417 return return_null_var( typename );
420 static HRESULT WINAPI entityref_put_dataType(
421 IXMLDOMEntityReference *iface,
422 BSTR p)
424 entityref *This = impl_from_IXMLDOMEntityReference( iface );
426 TRACE("(%p)->(%s)\n", This, debugstr_w(p));
428 if(!p)
429 return E_INVALIDARG;
431 return E_FAIL;
434 static HRESULT WINAPI entityref_get_xml(
435 IXMLDOMEntityReference *iface,
436 BSTR* p)
438 entityref *This = impl_from_IXMLDOMEntityReference( iface );
440 TRACE("(%p)->(%p)\n", This, p);
442 return node_get_xml(&This->node, FALSE, p);
445 static HRESULT WINAPI entityref_transformNode(
446 IXMLDOMEntityReference *iface,
447 IXMLDOMNode *node, BSTR *p)
449 entityref *This = impl_from_IXMLDOMEntityReference( iface );
450 TRACE("(%p)->(%p %p)\n", This, node, p);
451 return node_transform_node(&This->node, node, p);
454 static HRESULT WINAPI entityref_selectNodes(
455 IXMLDOMEntityReference *iface,
456 BSTR p, IXMLDOMNodeList** outList)
458 entityref *This = impl_from_IXMLDOMEntityReference( iface );
459 TRACE("(%p)->(%s %p)\n", This, debugstr_w(p), outList);
460 return node_select_nodes(&This->node, p, outList);
463 static HRESULT WINAPI entityref_selectSingleNode(
464 IXMLDOMEntityReference *iface,
465 BSTR p, IXMLDOMNode** outNode)
467 entityref *This = impl_from_IXMLDOMEntityReference( iface );
468 TRACE("(%p)->(%s %p)\n", This, debugstr_w(p), outNode);
469 return node_select_singlenode(&This->node, p, outNode);
472 static HRESULT WINAPI entityref_get_parsed(
473 IXMLDOMEntityReference *iface,
474 VARIANT_BOOL* isParsed)
476 entityref *This = impl_from_IXMLDOMEntityReference( iface );
477 FIXME("(%p)->(%p) stub!\n", This, isParsed);
478 *isParsed = VARIANT_TRUE;
479 return S_OK;
482 static HRESULT WINAPI entityref_get_namespaceURI(
483 IXMLDOMEntityReference *iface,
484 BSTR* p)
486 entityref *This = impl_from_IXMLDOMEntityReference( iface );
487 TRACE("(%p)->(%p)\n", This, p);
488 return node_get_namespaceURI(&This->node, p);
491 static HRESULT WINAPI entityref_get_prefix(
492 IXMLDOMEntityReference *iface,
493 BSTR* prefix)
495 entityref *This = impl_from_IXMLDOMEntityReference( iface );
496 FIXME("(%p)->(%p): stub\n", This, prefix);
497 return return_null_bstr( prefix );
500 static HRESULT WINAPI entityref_get_baseName(
501 IXMLDOMEntityReference *iface,
502 BSTR* name)
504 entityref *This = impl_from_IXMLDOMEntityReference( iface );
505 FIXME("(%p)->(%p): needs test\n", This, name);
506 return return_null_bstr( name );
509 static HRESULT WINAPI entityref_transformNodeToObject(
510 IXMLDOMEntityReference *iface,
511 IXMLDOMNode* domNode, VARIANT var1)
513 entityref *This = impl_from_IXMLDOMEntityReference( iface );
514 FIXME("(%p)->(%p %s)\n", This, domNode, debugstr_variant(&var1));
515 return E_NOTIMPL;
518 static const struct IXMLDOMEntityReferenceVtbl entityref_vtbl =
520 entityref_QueryInterface,
521 entityref_AddRef,
522 entityref_Release,
523 entityref_GetTypeInfoCount,
524 entityref_GetTypeInfo,
525 entityref_GetIDsOfNames,
526 entityref_Invoke,
527 entityref_get_nodeName,
528 entityref_get_nodeValue,
529 entityref_put_nodeValue,
530 entityref_get_nodeType,
531 entityref_get_parentNode,
532 entityref_get_childNodes,
533 entityref_get_firstChild,
534 entityref_get_lastChild,
535 entityref_get_previousSibling,
536 entityref_get_nextSibling,
537 entityref_get_attributes,
538 entityref_insertBefore,
539 entityref_replaceChild,
540 entityref_removeChild,
541 entityref_appendChild,
542 entityref_hasChildNodes,
543 entityref_get_ownerDocument,
544 entityref_cloneNode,
545 entityref_get_nodeTypeString,
546 entityref_get_text,
547 entityref_put_text,
548 entityref_get_specified,
549 entityref_get_definition,
550 entityref_get_nodeTypedValue,
551 entityref_put_nodeTypedValue,
552 entityref_get_dataType,
553 entityref_put_dataType,
554 entityref_get_xml,
555 entityref_transformNode,
556 entityref_selectNodes,
557 entityref_selectSingleNode,
558 entityref_get_parsed,
559 entityref_get_namespaceURI,
560 entityref_get_prefix,
561 entityref_get_baseName,
562 entityref_transformNodeToObject,
565 static const tid_t domentityref_iface_tids[] = {
566 IXMLDOMEntityReference_tid,
570 static dispex_static_data_t domentityref_dispex = {
571 NULL,
572 IXMLDOMEntityReference_tid,
573 NULL,
574 domentityref_iface_tids
577 IUnknown* create_doc_entity_ref( xmlNodePtr entity )
579 entityref *This;
581 This = heap_alloc( sizeof *This );
582 if ( !This )
583 return NULL;
585 This->IXMLDOMEntityReference_iface.lpVtbl = &entityref_vtbl;
586 This->ref = 1;
588 init_xmlnode(&This->node, entity, (IXMLDOMNode*)&This->IXMLDOMEntityReference_iface, &domentityref_dispex);
590 return (IUnknown*)&This->IXMLDOMEntityReference_iface;