cmd: Fix German translation.
[wine/hramrach.git] / dlls / msxml3 / domimpl.c
blobb0b1cdead0e21669cab3c1c2c0f78f6ce300d911
1 /*
2 * DOM Document Implementation 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 "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 _domimpl
42 const struct IXMLDOMImplementationVtbl *lpVtbl;
43 LONG ref;
44 } domimpl;
46 static inline domimpl *impl_from_IXMLDOMImplementation( IXMLDOMImplementation *iface )
48 return (domimpl *)((char*)iface - FIELD_OFFSET(domimpl, lpVtbl));
51 static HRESULT WINAPI dimimpl_QueryInterface(
52 IXMLDOMImplementation *iface,
53 REFIID riid,
54 void** ppvObject )
56 domimpl *This = impl_from_IXMLDOMImplementation( iface );
57 TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
59 if ( IsEqualGUID( riid, &IID_IXMLDOMImplementation ) ||
60 IsEqualGUID( riid, &IID_IDispatch ) ||
61 IsEqualGUID( riid, &IID_IUnknown ) )
63 *ppvObject = iface;
65 else
67 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
68 return E_NOINTERFACE;
71 IXMLDOMImplementation_AddRef( iface );
73 return S_OK;
76 static ULONG WINAPI dimimpl_AddRef(
77 IXMLDOMImplementation *iface )
79 domimpl *This = impl_from_IXMLDOMImplementation( iface );
80 return InterlockedIncrement( &This->ref );
83 static ULONG WINAPI dimimpl_Release(
84 IXMLDOMImplementation *iface )
86 domimpl *This = impl_from_IXMLDOMImplementation( iface );
87 ULONG ref;
89 ref = InterlockedDecrement( &This->ref );
90 if ( ref == 0 )
92 HeapFree( GetProcessHeap(), 0, This );
95 return ref;
98 static HRESULT WINAPI dimimpl_GetTypeInfoCount(
99 IXMLDOMImplementation *iface,
100 UINT* pctinfo )
102 domimpl *This = impl_from_IXMLDOMImplementation( iface );
104 TRACE("(%p)->(%p)\n", This, pctinfo);
106 *pctinfo = 1;
108 return S_OK;
111 static HRESULT WINAPI dimimpl_GetTypeInfo(
112 IXMLDOMImplementation *iface,
113 UINT iTInfo, LCID lcid,
114 ITypeInfo** ppTInfo )
116 domimpl *This = impl_from_IXMLDOMImplementation( iface );
117 HRESULT hr;
119 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
121 hr = get_typeinfo(IXMLDOMImplementation_tid, ppTInfo);
123 return hr;
126 static HRESULT WINAPI dimimpl_GetIDsOfNames(
127 IXMLDOMImplementation *iface,
128 REFIID riid, LPOLESTR* rgszNames,
129 UINT cNames, LCID lcid, DISPID* rgDispId )
131 domimpl *This = impl_from_IXMLDOMImplementation( iface );
132 ITypeInfo *typeinfo;
133 HRESULT hr;
135 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
136 lcid, rgDispId);
138 if(!rgszNames || cNames == 0 || !rgDispId)
139 return E_INVALIDARG;
141 hr = get_typeinfo(IXMLDOMImplementation_tid, &typeinfo);
142 if(SUCCEEDED(hr))
144 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
145 ITypeInfo_Release(typeinfo);
148 return hr;
151 static HRESULT WINAPI dimimpl_Invoke(
152 IXMLDOMImplementation *iface,
153 DISPID dispIdMember, REFIID riid, LCID lcid,
154 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
155 EXCEPINFO* pExcepInfo, UINT* puArgErr )
157 domimpl *This = impl_from_IXMLDOMImplementation( iface );
158 ITypeInfo *typeinfo;
159 HRESULT hr;
161 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
162 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
164 hr = get_typeinfo(IXMLDOMImplementation_tid, &typeinfo);
165 if(SUCCEEDED(hr))
167 hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
168 pVarResult, pExcepInfo, puArgErr);
169 ITypeInfo_Release(typeinfo);
172 return hr;
175 static HRESULT WINAPI dimimpl_hasFeature(IXMLDOMImplementation* This, BSTR feature, BSTR version, VARIANT_BOOL *hasFeature)
177 static const WCHAR bVersion[] = {'1','.','0',0};
178 static const WCHAR bXML[] = {'X','M','L',0};
179 static const WCHAR bDOM[] = {'D','O','M',0};
180 static const WCHAR bMSDOM[] = {'M','S','-','D','O','M',0};
181 BOOL bValidFeature = FALSE;
182 BOOL bValidVersion = FALSE;
184 TRACE("feature(%s) version (%s)\n", debugstr_w(feature), debugstr_w(version));
186 if(!feature || !hasFeature)
187 return E_INVALIDARG;
189 *hasFeature = VARIANT_FALSE;
191 if(!version || lstrcmpiW(version, bVersion) == 0)
192 bValidVersion = TRUE;
194 if(lstrcmpiW(feature, bXML) == 0 || lstrcmpiW(feature, bDOM) == 0 || lstrcmpiW(feature, bMSDOM) == 0)
195 bValidFeature = TRUE;
197 if(bValidVersion && bValidFeature)
198 *hasFeature = VARIANT_TRUE;
200 return S_OK;
203 static const struct IXMLDOMImplementationVtbl dimimpl_vtbl =
205 dimimpl_QueryInterface,
206 dimimpl_AddRef,
207 dimimpl_Release,
208 dimimpl_GetTypeInfoCount,
209 dimimpl_GetTypeInfo,
210 dimimpl_GetIDsOfNames,
211 dimimpl_Invoke,
212 dimimpl_hasFeature
215 IUnknown* create_doc_Implementation(void)
217 domimpl *This;
219 This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
220 if ( !This )
221 return NULL;
223 This->lpVtbl = &dimimpl_vtbl;
224 This->ref = 1;
226 return (IUnknown*) &This->lpVtbl;
229 #endif