crypt32/tests: Add a trailing '\n' to ok() calls.
[wine.git] / dlls / msxml3 / xmlview.c
blob2bf58f8d993d539410d140c961c4e30168b22870
1 /*
2 * Copyright 2012 Piotr 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
19 #include "config.h"
21 #include <stdarg.h>
23 #define COBJMACROS
24 #define NONAMELESSUNION
26 #ifdef HAVE_LIBXML2
27 #include <libxml/parser.h>
28 #endif
30 #include "windef.h"
31 #include "winbase.h"
32 #include "ole2.h"
33 #include "msxml6.h"
34 #include "mshtml.h"
35 #include "mshtmhst.h"
36 #include "perhist.h"
37 #include "docobj.h"
39 #include "wine/debug.h"
41 #include "msxml_private.h"
43 #ifdef HAVE_LIBXML2
45 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
47 typedef struct
49 IPersistMoniker IPersistMoniker_iface;
50 IPersistHistory IPersistHistory_iface;
51 IOleCommandTarget IOleCommandTarget_iface;
52 IOleObject IOleObject_iface;
54 LONG ref;
56 IUnknown *html_doc;
57 IMoniker *mon;
58 } XMLView;
60 typedef struct
62 IMoniker IMoniker_iface;
63 LONG ref;
64 IMoniker *mon;
66 IStream *stream;
67 } Moniker;
69 typedef struct
71 IBindStatusCallback IBindStatusCallback_iface;
72 LONG ref;
73 IBindStatusCallback *bsc;
75 IMoniker *mon;
76 IStream *stream;
77 } BindStatusCallback;
79 typedef struct
81 IBinding IBinding_iface;
82 LONG ref;
83 IBinding *binding;
84 } Binding;
86 static inline Binding* impl_from_IBinding(IBinding *iface)
88 return CONTAINING_RECORD(iface, Binding, IBinding_iface);
91 static HRESULT WINAPI XMLView_Binding_QueryInterface(
92 IBinding *iface, REFIID riid, void **ppvObject)
94 Binding *This = impl_from_IBinding(iface);
96 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
98 if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IBinding)) {
99 *ppvObject = iface;
100 IBinding_AddRef(iface);
101 return S_OK;
104 *ppvObject = NULL;
105 return E_NOINTERFACE;
108 static ULONG WINAPI XMLView_Binding_AddRef(IBinding *iface)
110 Binding *This = impl_from_IBinding(iface);
111 LONG ref = InterlockedIncrement(&This->ref);
113 TRACE("(%p)->(%d)\n", This, ref);
115 return ref;
118 static ULONG WINAPI XMLView_Binding_Release(IBinding *iface)
120 Binding *This = impl_from_IBinding(iface);
121 ULONG ref = InterlockedDecrement(&This->ref);
123 TRACE("(%p)->(%d)\n", This, ref);
125 if(!ref) {
126 IBinding_Release(This->binding);
127 heap_free(This);
129 return ref;
132 static HRESULT WINAPI XMLView_Binding_Abort(IBinding *iface)
134 Binding *This = impl_from_IBinding(iface);
135 TRACE("(%p)\n", This);
137 return IBinding_Abort(This->binding);
140 static HRESULT WINAPI XMLView_Binding_Suspend(IBinding *iface)
142 Binding *This = impl_from_IBinding(iface);
143 FIXME("(%p)\n", This);
144 return E_NOTIMPL;
147 static HRESULT WINAPI XMLView_Binding_Resume(IBinding *iface)
149 Binding *This = impl_from_IBinding(iface);
150 FIXME("(%p)\n", This);
151 return E_NOTIMPL;
154 static HRESULT WINAPI XMLView_Binding_SetPriority(
155 IBinding *iface, LONG nPriority)
157 Binding *This = impl_from_IBinding(iface);
158 TRACE("(%p)->(%d)\n", This, nPriority);
160 return IBinding_SetPriority(This->binding, nPriority);
163 static HRESULT WINAPI XMLView_Binding_GetPriority(
164 IBinding *iface, LONG *pnPriority)
166 Binding *This = impl_from_IBinding(iface);
167 TRACE("(%p)->(%p)\n", This, pnPriority);
169 return IBinding_GetPriority(This->binding, pnPriority);
172 static HRESULT WINAPI XMLView_Binding_GetBindResult(IBinding *iface,
173 CLSID *pclsidProtocol, DWORD *pdwResult, LPOLESTR *pszResult,
174 DWORD *pdwReserved)
176 Binding *This = impl_from_IBinding(iface);
177 FIXME("(%p)->(%s %p %p %p)\n", This, debugstr_guid(pclsidProtocol),
178 pdwResult, pszResult, pdwReserved);
179 return E_NOTIMPL;
182 static IBindingVtbl XMLView_BindingVtbl = {
183 XMLView_Binding_QueryInterface,
184 XMLView_Binding_AddRef,
185 XMLView_Binding_Release,
186 XMLView_Binding_Abort,
187 XMLView_Binding_Suspend,
188 XMLView_Binding_Resume,
189 XMLView_Binding_SetPriority,
190 XMLView_Binding_GetPriority,
191 XMLView_Binding_GetBindResult
194 static inline HRESULT XMLView_Binding_Create(IBinding *binding, IBinding **ret)
196 Binding *bind;
198 bind = heap_alloc_zero(sizeof(Binding));
199 if(!bind)
200 return E_OUTOFMEMORY;
202 bind->IBinding_iface.lpVtbl = &XMLView_BindingVtbl;
203 bind->ref = 1;
205 bind->binding = binding;
206 IBinding_AddRef(binding);
208 *ret = &bind->IBinding_iface;
209 return S_OK;
212 static inline BindStatusCallback* impl_from_IBindStatusCallback(
213 IBindStatusCallback *iface)
215 return CONTAINING_RECORD(iface, BindStatusCallback,
216 IBindStatusCallback_iface);
219 static HRESULT WINAPI XMLView_BindStatusCallback_QueryInterface(
220 IBindStatusCallback *iface, REFIID riid, void **ppvObject)
222 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
224 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
226 if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IBindStatusCallback)) {
227 *ppvObject = iface;
228 IBindStatusCallback_AddRef(iface);
229 return S_OK;
232 *ppvObject = NULL;
233 return E_NOINTERFACE;
236 static ULONG WINAPI XMLView_BindStatusCallback_AddRef(
237 IBindStatusCallback *iface)
239 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
240 LONG ref = InterlockedIncrement(&This->ref);
242 TRACE("(%p)->(%d)\n", This, ref);
244 return ref;
247 static ULONG WINAPI XMLView_BindStatusCallback_Release(
248 IBindStatusCallback *iface)
250 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
251 ULONG ref = InterlockedDecrement(&This->ref);
253 TRACE("(%p)->(%d)\n", This, ref);
255 if(!ref) {
256 if(This->stream)
257 IStream_Release(This->stream);
258 IBindStatusCallback_Release(This->bsc);
259 IMoniker_Release(This->mon);
260 heap_free(This);
262 return ref;
265 static HRESULT WINAPI XMLView_BindStatusCallback_OnStartBinding(
266 IBindStatusCallback *iface, DWORD dwReserved, IBinding *pib)
268 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
269 IBinding *binding;
270 HRESULT hres;
272 TRACE("(%p)->(%x %p)\n", This, dwReserved, pib);
274 hres = XMLView_Binding_Create(pib, &binding);
275 if(FAILED(hres)) {
276 IBinding_Abort(pib);
277 return hres;
280 hres = IBindStatusCallback_OnStartBinding(This->bsc, dwReserved, binding);
281 if(FAILED(hres)) {
282 IBinding_Abort(binding);
283 return hres;
286 IBinding_Release(binding);
287 return hres;
290 static HRESULT WINAPI XMLView_BindStatusCallback_GetPriority(
291 IBindStatusCallback *iface, LONG *pnPriority)
293 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
294 FIXME("(%p)->(%p)\n", This, pnPriority);
295 return E_NOTIMPL;
298 static HRESULT WINAPI XMLView_BindStatusCallback_OnLowResource(
299 IBindStatusCallback *iface, DWORD reserved)
301 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
302 FIXME("(%p)->(%x)\n", This, reserved);
303 return E_NOTIMPL;
306 static HRESULT WINAPI XMLView_BindStatusCallback_OnProgress(
307 IBindStatusCallback *iface, ULONG ulProgress, ULONG ulProgressMax,
308 ULONG ulStatusCode, LPCWSTR szStatusText)
310 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
311 TRACE("(%p)->(%d %d %x %s)\n", This, ulProgress, ulProgressMax,
312 ulStatusCode, debugstr_w(szStatusText));
314 switch(ulStatusCode) {
315 case BINDSTATUS_BEGINDOWNLOADDATA:
316 return IBindStatusCallback_OnProgress(This->bsc, ulProgress,
317 ulProgressMax, ulStatusCode, szStatusText);
318 case BINDSTATUS_MIMETYPEAVAILABLE:
319 return S_OK;
320 default:
321 FIXME("ulStatusCode: %d\n", ulStatusCode);
322 return E_NOTIMPL;
326 static HRESULT WINAPI XMLView_BindStatusCallback_OnStopBinding(
327 IBindStatusCallback *iface, HRESULT hresult, LPCWSTR szError)
329 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
330 TRACE("(%p)->(%x %s)\n", This, hresult, debugstr_w(szError));
331 return IBindStatusCallback_OnStopBinding(This->bsc, hresult, szError);
334 static HRESULT WINAPI XMLView_BindStatusCallback_GetBindInfo(
335 IBindStatusCallback *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
337 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
338 TRACE("(%p)->(%p %p)\n", This, grfBINDF, pbindinfo);
339 return IBindStatusCallback_GetBindInfo(This->bsc, grfBINDF, pbindinfo);
342 static inline HRESULT report_data(BindStatusCallback *This)
344 FORMATETC formatetc = {0, NULL, 1, -1, TYMED_ISTREAM};
345 STGMEDIUM stgmedium;
346 LARGE_INTEGER off;
347 ULARGE_INTEGER size;
348 HRESULT hres;
350 off.QuadPart = 0;
351 hres = IStream_Seek(This->stream, off, STREAM_SEEK_CUR, &size);
352 if(FAILED(hres))
353 return hres;
355 hres = IStream_Seek(This->stream, off, STREAM_SEEK_SET, NULL);
356 if(FAILED(hres))
357 return hres;
359 stgmedium.tymed = TYMED_ISTREAM;
360 stgmedium.u.pstm = This->stream;
361 stgmedium.pUnkForRelease = NULL;
363 hres = IBindStatusCallback_OnDataAvailable(This->bsc,
364 BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION,
365 size.u.LowPart, &formatetc, &stgmedium);
367 IStream_Release(This->stream);
368 This->stream = NULL;
369 return hres;
372 static inline HRESULT display_error_page(BindStatusCallback *This)
374 FIXME("Error page not implemented yet.\n");
375 return report_data(This);
378 static inline HRESULT handle_xml_load(BindStatusCallback *This)
380 static const WCHAR selectW[] = {'p','r','o','c','e','s','s','i','n','g','-',
381 'i','n','s','t','r','u','c','t','i','o','n','(','\'','x','m','l',
382 '-','s','t','y','l','e','s','h','e','e','t','\'',')',0};
383 static const WCHAR hrefW[] = {'h','r','e','f','=',0};
385 IXMLDOMDocument3 *xml = NULL, *xsl = NULL;
386 IXMLDOMNode *stylesheet;
387 IBindCtx *pbc;
388 IMoniker *mon;
389 LPOLESTR xsl_url;
390 LARGE_INTEGER off;
391 VARIANT_BOOL succ;
392 VARIANT var;
393 WCHAR *href = NULL, *p;
394 BSTR bstr;
395 HRESULT hres;
397 off.QuadPart = 0;
398 hres = IStream_Seek(This->stream, off, STREAM_SEEK_SET, NULL);
399 if(FAILED(hres))
400 return display_error_page(This);
402 hres = DOMDocument_create(MSXML_DEFAULT, (void**)&xml);
403 if(FAILED(hres))
404 return display_error_page(This);
406 V_VT(&var) = VT_UNKNOWN;
407 V_UNKNOWN(&var) = (IUnknown*)This->stream;
408 hres = IXMLDOMDocument3_load(xml, var, &succ);
409 if(FAILED(hres) || !succ) {
410 IXMLDOMDocument3_Release(xml);
411 return display_error_page(This);
413 V_VT(&var) = VT_EMPTY;
415 bstr = SysAllocString(selectW);
416 hres = IXMLDOMDocument3_selectSingleNode(xml, bstr, &stylesheet);
417 SysFreeString(bstr);
418 if(hres != S_OK) {
419 IXMLDOMDocument3_Release(xml);
420 return display_error_page(This);
423 hres = IXMLDOMNode_get_nodeValue(stylesheet, &var);
424 IXMLDOMNode_Release(stylesheet);
425 if(SUCCEEDED(hres) && V_VT(&var)!=VT_BSTR) {
426 FIXME("Variant type %d not supported\n", V_VT(&var));
427 VariantClear(&var);
428 hres = E_FAIL;
430 if(FAILED(hres)) {
431 IXMLDOMDocument3_Release(xml);
432 return display_error_page(This);
435 /* TODO: fix parsing processing instruction value */
436 if((p = strstrW(V_BSTR(&var), hrefW))) {
437 p += sizeof(hrefW)/sizeof(WCHAR)-1;
438 if(*p!='\'' && *p!='\"') p = NULL;
439 else {
440 href = p+1;
441 p = strchrW(href, *p);
444 if(p) {
445 *p = 0;
446 } else {
447 VariantClear(&var);
448 IXMLDOMDocument3_Release(xml);
449 return display_error_page(This);
452 hres = CreateURLMonikerEx(This->mon, href, &mon, 0);
453 VariantClear(&var);
454 if(FAILED(hres)) {
455 IXMLDOMDocument3_Release(xml);
456 return display_error_page(This);
459 hres = CreateBindCtx(0, &pbc);
460 if(SUCCEEDED(hres)) {
461 hres = IMoniker_GetDisplayName(mon, pbc, NULL, &xsl_url);
462 IMoniker_Release(mon);
463 IBindCtx_Release(pbc);
465 if(FAILED(hres)) {
466 IXMLDOMDocument3_Release(xml);
467 return display_error_page(This);
470 V_VT(&var) = VT_BSTR;
471 V_BSTR(&var) = SysAllocString(xsl_url);
472 CoTaskMemFree(xsl_url);
473 if(!V_BSTR(&var)) {
474 IXMLDOMDocument3_Release(xml);
475 return display_error_page(This);
478 hres = DOMDocument_create(MSXML_DEFAULT, (void**)&xsl);
479 if(FAILED(hres)) {
480 VariantClear(&var);
481 IXMLDOMDocument3_Release(xml);
482 return display_error_page(This);
485 /* TODO: do the binding asynchronously */
486 hres = IXMLDOMDocument3_load(xsl, var, &succ);
487 VariantClear(&var);
488 if(FAILED(hres) || !succ) {
489 IXMLDOMDocument3_Release(xsl);
490 IXMLDOMDocument3_Release(xml);
491 return display_error_page(This);
494 hres = IXMLDOMDocument3_transformNode(xml, (IXMLDOMNode*)xsl, &bstr);
495 IXMLDOMDocument3_Release(xsl);
496 IXMLDOMDocument3_Release(xml);
497 if(FAILED(hres))
498 return display_error_page(This);
500 hres = IStream_Seek(This->stream, off, STREAM_SEEK_SET, NULL);
501 if(FAILED(hres)) {
502 SysFreeString(bstr);
503 return display_error_page(This);
506 hres = IStream_Write(This->stream, (BYTE*)bstr,
507 SysStringLen(bstr)*sizeof(WCHAR), NULL);
508 SysFreeString(bstr);
509 if(FAILED(hres))
510 return display_error_page(This);
512 return report_data(This);
515 static HRESULT WINAPI XMLView_BindStatusCallback_OnDataAvailable(
516 IBindStatusCallback *iface, DWORD grfBSCF, DWORD dwSize,
517 FORMATETC *pformatetc, STGMEDIUM *pstgmed)
519 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
520 char buf[1024];
521 DWORD size;
522 HRESULT hres;
524 TRACE("(%p)->(%x %d %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed);
526 if(!This->stream)
527 return E_FAIL;
529 do {
530 hres = IStream_Read(pstgmed->u.pstm, buf, sizeof(buf), &size);
531 IStream_Write(This->stream, buf, size, &size);
532 } while(hres==S_OK && size);
534 if(FAILED(hres) && hres!=E_PENDING)
535 return hres;
536 if(hres != S_FALSE)
537 return S_OK;
539 return handle_xml_load(This);
542 static HRESULT WINAPI XMLView_BindStatusCallback_OnObjectAvailable(
543 IBindStatusCallback *iface, REFIID riid, IUnknown *punk)
545 BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
546 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), punk);
547 return E_NOTIMPL;
550 static IBindStatusCallbackVtbl XMLView_BindStatusCallbackVtbl = {
551 XMLView_BindStatusCallback_QueryInterface,
552 XMLView_BindStatusCallback_AddRef,
553 XMLView_BindStatusCallback_Release,
554 XMLView_BindStatusCallback_OnStartBinding,
555 XMLView_BindStatusCallback_GetPriority,
556 XMLView_BindStatusCallback_OnLowResource,
557 XMLView_BindStatusCallback_OnProgress,
558 XMLView_BindStatusCallback_OnStopBinding,
559 XMLView_BindStatusCallback_GetBindInfo,
560 XMLView_BindStatusCallback_OnDataAvailable,
561 XMLView_BindStatusCallback_OnObjectAvailable
564 static inline HRESULT XMLView_BindStatusCallback_Create(IBindStatusCallback *bsc_html,
565 IMoniker *mon, IStream *stream, IBindStatusCallback **ret)
567 BindStatusCallback *bsc;
569 bsc = heap_alloc_zero(sizeof(BindStatusCallback));
570 if(!bsc)
571 return E_OUTOFMEMORY;
573 bsc->IBindStatusCallback_iface.lpVtbl = &XMLView_BindStatusCallbackVtbl;
574 bsc->ref = 1;
576 bsc->bsc = bsc_html;
577 IBindStatusCallback_AddRef(bsc_html);
578 bsc->stream = stream;
579 IStream_AddRef(bsc->stream);
580 bsc->mon = mon;
581 IMoniker_AddRef(mon);
583 *ret = &bsc->IBindStatusCallback_iface;
584 return S_OK;
587 static inline Moniker* impl_from_IMoniker(IMoniker *iface)
589 return CONTAINING_RECORD(iface, Moniker, IMoniker_iface);
592 static HRESULT WINAPI XMLView_Moniker_QueryInterface(
593 IMoniker *iface, REFIID riid, void **ppvObject)
595 Moniker *This = impl_from_IMoniker(iface);
597 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
599 if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IPersist)
600 || IsEqualGUID(riid, &IID_IPersistStream) || IsEqualGUID(riid, &IID_IMoniker)) {
601 *ppvObject = iface;
602 IMoniker_AddRef(iface);
603 return S_OK;
606 *ppvObject = NULL;
607 return E_NOINTERFACE;
610 static ULONG WINAPI XMLView_Moniker_AddRef(IMoniker *iface)
612 Moniker *This = impl_from_IMoniker(iface);
613 LONG ref = InterlockedIncrement(&This->ref);
615 TRACE("(%p)->(%d)\n", This, ref);
617 return ref;
620 static ULONG WINAPI XMLView_Moniker_Release(IMoniker *iface)
622 Moniker *This = impl_from_IMoniker(iface);
623 ULONG ref = InterlockedDecrement(&This->ref);
625 TRACE("(%p)->(%d)\n", This, ref);
627 if(!ref) {
628 IMoniker_Release(This->mon);
629 heap_free(This);
631 return ref;
634 static HRESULT WINAPI XMLView_Moniker_GetClassID(IMoniker *iface, CLSID *pClassID)
636 Moniker *This = impl_from_IMoniker(iface);
637 FIXME("(%p)->(%p)\n", This, pClassID);
638 return E_NOTIMPL;
641 static HRESULT WINAPI XMLView_Moniker_IsDirty(IMoniker *iface)
643 Moniker *This = impl_from_IMoniker(iface);
644 FIXME("(%p)\n", This);
645 return E_NOTIMPL;
648 static HRESULT WINAPI XMLView_Moniker_Load(IMoniker *iface, IStream *pStm)
650 Moniker *This = impl_from_IMoniker(iface);
651 FIXME("(%p)->(%p)\n", This, pStm);
652 return E_NOTIMPL;
655 static HRESULT WINAPI XMLView_Moniker_Save(IMoniker *iface,
656 IStream *pStm, BOOL fClearDirty)
658 Moniker *This = impl_from_IMoniker(iface);
659 FIXME("(%p)->(%p %x)\n", This, pStm, fClearDirty);
660 return E_NOTIMPL;
663 static HRESULT WINAPI XMLView_Moniker_GetSizeMax(
664 IMoniker *iface, ULARGE_INTEGER *pcbSize)
666 Moniker *This = impl_from_IMoniker(iface);
667 FIXME("(%p)->(%p)\n", This, pcbSize);
668 return E_NOTIMPL;
671 static HRESULT WINAPI XMLView_Moniker_BindToObject(IMoniker *iface, IBindCtx *pbc,
672 IMoniker *pmkToLeft, REFIID riidResult, void **ppvResult)
674 Moniker *This = impl_from_IMoniker(iface);
675 FIXME("(%p)->(%p %p %s %p)\n", This, pbc, pmkToLeft,
676 debugstr_guid(riidResult), ppvResult);
677 return E_NOTIMPL;
680 static HRESULT WINAPI XMLView_Moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc,
681 IMoniker *pmkToLeft, REFIID riid, void **ppvObj)
683 Moniker *This = impl_from_IMoniker(iface);
685 TRACE("(%p)->(%p %p %s %p)\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppvObj);
687 if(IsEqualGUID(riid, &IID_IStream)) {
688 if(!This->stream)
689 return E_FAIL;
691 *ppvObj = This->stream;
692 This->stream = NULL;
693 return S_ASYNCHRONOUS;
696 return E_NOTIMPL;
699 static HRESULT WINAPI XMLView_Moniker_Reduce(IMoniker *iface, IBindCtx *pbc,
700 DWORD dwReduceHowFar, IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
702 Moniker *This = impl_from_IMoniker(iface);
703 FIXME("(%p)->(%p %d %p %p)\n", This, pbc, dwReduceHowFar, ppmkToLeft, ppmkReduced);
704 return E_NOTIMPL;
707 static HRESULT WINAPI XMLView_Moniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight,
708 BOOL fOnlyIfNotGeneric, IMoniker **ppmkComposite)
710 Moniker *This = impl_from_IMoniker(iface);
711 FIXME("(%p)->(%p %x %p)\n", This, pmkRight, fOnlyIfNotGeneric, ppmkComposite);
712 return E_NOTIMPL;
715 static HRESULT WINAPI XMLView_Moniker_Enum(IMoniker *iface,
716 BOOL fForward, IEnumMoniker **ppenumMoniker)
718 Moniker *This = impl_from_IMoniker(iface);
719 FIXME("(%p)->(%x %p)\n", This, fForward, ppenumMoniker);
720 return E_NOTIMPL;
723 static HRESULT WINAPI XMLView_Moniker_IsEqual(IMoniker *iface,
724 IMoniker *pmkOtherMoniker)
726 Moniker *This = impl_from_IMoniker(iface);
727 FIXME("(%p)->(%p)\n", This, pmkOtherMoniker);
728 return E_NOTIMPL;
731 static HRESULT WINAPI XMLView_Moniker_Hash(IMoniker *iface, DWORD *pdwHash)
733 Moniker *This = impl_from_IMoniker(iface);
734 FIXME("(%p)->(%p)\n", This, pdwHash);
735 return E_NOTIMPL;
738 static HRESULT WINAPI XMLView_Moniker_IsRunning(IMoniker *iface, IBindCtx *pbc,
739 IMoniker *pmkToLeft, IMoniker *pmkNewlyRunning)
741 Moniker *This = impl_from_IMoniker(iface);
742 FIXME("(%p)->(%p %p %p)\n", This, pbc, pmkToLeft, pmkNewlyRunning);
743 return E_NOTIMPL;
746 static HRESULT WINAPI XMLView_Moniker_GetTimeOfLastChange(IMoniker *iface,
747 IBindCtx *pbc, IMoniker *pmkToLeft, FILETIME *pFileTime)
749 Moniker *This = impl_from_IMoniker(iface);
750 FIXME("(%p)->(%p %p %p)\n", This, pbc, pmkToLeft, pFileTime);
751 return E_NOTIMPL;
754 static HRESULT WINAPI XMLView_Moniker_Inverse(IMoniker *iface, IMoniker **ppmk)
756 Moniker *This = impl_from_IMoniker(iface);
757 FIXME("(%p)->(%p)\n", This, ppmk);
758 return E_NOTIMPL;
761 static HRESULT WINAPI XMLView_Moniker_CommonPrefixWith(IMoniker *iface,
762 IMoniker *pmkOther, IMoniker **ppmkPrefix)
764 Moniker *This = impl_from_IMoniker(iface);
765 FIXME("(%p)->(%p %p)\n", This, pmkOther, ppmkPrefix);
766 return E_NOTIMPL;
769 static HRESULT WINAPI XMLView_Moniker_RelativePathTo(IMoniker *iface,
770 IMoniker *pmkOther, IMoniker **ppmkRelPath)
772 Moniker *This = impl_from_IMoniker(iface);
773 FIXME("(%p)->(%p %p)\n", This, pmkOther, ppmkRelPath);
774 return E_NOTIMPL;
777 static HRESULT WINAPI XMLView_Moniker_GetDisplayName(IMoniker *iface,
778 IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
780 Moniker *This = impl_from_IMoniker(iface);
781 TRACE("(%p)->(%p %p %p)\n", This, pbc, pmkToLeft, ppszDisplayName);
782 return IMoniker_GetDisplayName(This->mon, pbc, pmkToLeft, ppszDisplayName);
785 static HRESULT WINAPI XMLView_Moniker_ParseDisplayName(IMoniker *iface,
786 IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR pszDisplayName,
787 ULONG *pchEaten, IMoniker **ppmkOut)
789 Moniker *This = impl_from_IMoniker(iface);
790 FIXME("(%p)->(%p %p %s %p %p)\n", This, pbc, pmkToLeft,
791 debugstr_w(pszDisplayName), pchEaten, ppmkOut);
792 return E_NOTIMPL;
795 static HRESULT WINAPI XMLView_Moniker_IsSystemMoniker(
796 IMoniker *iface, DWORD *pdwMksys)
798 Moniker *This = impl_from_IMoniker(iface);
799 FIXME("(%p)->(%p)\n", This, pdwMksys);
800 return E_NOTIMPL;
803 static IMonikerVtbl XMLView_MonikerVtbl = {
804 XMLView_Moniker_QueryInterface,
805 XMLView_Moniker_AddRef,
806 XMLView_Moniker_Release,
807 XMLView_Moniker_GetClassID,
808 XMLView_Moniker_IsDirty,
809 XMLView_Moniker_Load,
810 XMLView_Moniker_Save,
811 XMLView_Moniker_GetSizeMax,
812 XMLView_Moniker_BindToObject,
813 XMLView_Moniker_BindToStorage,
814 XMLView_Moniker_Reduce,
815 XMLView_Moniker_ComposeWith,
816 XMLView_Moniker_Enum,
817 XMLView_Moniker_IsEqual,
818 XMLView_Moniker_Hash,
819 XMLView_Moniker_IsRunning,
820 XMLView_Moniker_GetTimeOfLastChange,
821 XMLView_Moniker_Inverse,
822 XMLView_Moniker_CommonPrefixWith,
823 XMLView_Moniker_RelativePathTo,
824 XMLView_Moniker_GetDisplayName,
825 XMLView_Moniker_ParseDisplayName,
826 XMLView_Moniker_IsSystemMoniker
829 static inline HRESULT XMLView_Moniker_Create(IMoniker *mon,
830 IStream *stream, IMoniker **ret)
832 Moniker *wrap;
834 wrap = heap_alloc_zero(sizeof(Moniker));
835 if(!wrap)
836 return E_OUTOFMEMORY;
838 wrap->IMoniker_iface.lpVtbl = &XMLView_MonikerVtbl;
839 wrap->ref = 1;
841 wrap->mon = mon;
842 IMoniker_AddRef(mon);
843 wrap->stream = stream;
844 IStream_AddRef(stream);
846 *ret = &wrap->IMoniker_iface;
847 return S_OK;
850 static inline XMLView* impl_from_IPersistMoniker(IPersistMoniker *iface)
852 return CONTAINING_RECORD(iface, XMLView, IPersistMoniker_iface);
855 static HRESULT WINAPI XMLView_PersistMoniker_QueryInterface(
856 IPersistMoniker *iface, REFIID riid, void **ppvObject)
858 XMLView *This = impl_from_IPersistMoniker(iface);
860 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
862 if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IPersistMoniker))
863 *ppvObject = &This->IPersistMoniker_iface;
864 else if(IsEqualGUID(riid, &IID_IPersistHistory) ||
865 IsEqualGUID(riid, &IID_IPersist))
866 *ppvObject = &This->IPersistHistory_iface;
867 else if(IsEqualGUID(riid, &IID_IOleCommandTarget))
868 *ppvObject = &This->IOleCommandTarget_iface;
869 else if(IsEqualGUID(riid, &IID_IOleObject))
870 *ppvObject = &This->IOleObject_iface;
871 else
872 return IUnknown_QueryInterface(This->html_doc, riid, ppvObject);
874 IPersistMoniker_AddRef(&This->IPersistMoniker_iface);
875 return S_OK;
878 static ULONG WINAPI XMLView_PersistMoniker_AddRef(IPersistMoniker *iface)
880 XMLView *This = impl_from_IPersistMoniker(iface);
881 LONG ref = InterlockedIncrement(&This->ref);
883 TRACE("(%p)->(%d)\n", This, ref);
885 return ref;
888 static ULONG WINAPI XMLView_PersistMoniker_Release(IPersistMoniker *iface)
890 XMLView *This = impl_from_IPersistMoniker(iface);
891 ULONG ref = InterlockedDecrement(&This->ref);
893 TRACE("(%p)->(%d)\n", This, ref);
895 if(!ref) {
896 if(This->mon)
897 IMoniker_Release(This->mon);
898 IUnknown_Release(This->html_doc);
899 heap_free(This);
901 return ref;
904 static HRESULT WINAPI XMLView_PersistMoniker_GetClassID(
905 IPersistMoniker *iface, CLSID *pClassID)
907 XMLView *This = impl_from_IPersistMoniker(iface);
908 FIXME("(%p)->(%p)\n", This, pClassID);
909 return E_NOTIMPL;
912 static HRESULT WINAPI XMLView_PersistMoniker_IsDirty(IPersistMoniker *iface)
914 XMLView *This = impl_from_IPersistMoniker(iface);
915 FIXME("(%p)\n", This);
916 return E_NOTIMPL;
919 static HRESULT WINAPI XMLView_PersistMoniker_Load(IPersistMoniker *iface,
920 BOOL fFullyAvailable, IMoniker *pimkName, LPBC pibc, DWORD grfMode)
922 static const WCHAR XSLParametersW[] = {'X','S','L','P','a','r','a','m','e','t','e','r','s',0};
923 static const WCHAR XMLBufferStreamW[] = {'X','M','L','B','u','f','f','e','r','S','t','r','e','a','m',0};
924 static const WCHAR DWNBINDINFOW[] = {'_','_','D','W','N','B','I','N','D','I','N','F','O',0};
925 static const WCHAR HTMLLOADOPTIONSW[] = {'_','_','H','T','M','L','L','O','A','D','O','P','T','I','O','N','S',0};
926 static const WCHAR BSCBHolderW[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
928 XMLView *This = impl_from_IPersistMoniker(iface);
929 IPersistMoniker *html_persist_mon;
930 IBindStatusCallback *bsc, *bsc_html;
931 IBindCtx *bindctx;
932 IStream *stream;
933 IMoniker *mon;
934 IUnknown *unk;
935 HRESULT hres;
937 TRACE("(%p)->(%x %p %p %x)\n", This, fFullyAvailable, pimkName, pibc, grfMode);
939 hres = IBindCtx_GetObjectParam(pibc, (LPOLESTR)XSLParametersW, &unk);
940 if(SUCCEEDED(hres)) {
941 FIXME("ignoring XSLParameters\n");
942 IUnknown_Release(unk);
944 hres = IBindCtx_GetObjectParam(pibc, (LPOLESTR)XMLBufferStreamW, &unk);
945 if(SUCCEEDED(hres)) {
946 FIXME("ignoring XMLBufferStream\n");
947 IUnknown_Release(unk);
950 hres = CreateBindCtx(0, &bindctx);
951 if(FAILED(hres))
952 return hres;
954 hres = IBindCtx_GetObjectParam(pibc, (LPOLESTR)DWNBINDINFOW, &unk);
955 if(SUCCEEDED(hres)) {
956 IBindCtx_RegisterObjectParam(bindctx, (LPOLESTR)DWNBINDINFOW, unk);
957 IUnknown_Release(unk);
959 hres = IBindCtx_GetObjectParam(pibc, (LPOLESTR)HTMLLOADOPTIONSW, &unk);
960 if(SUCCEEDED(hres)) {
961 IBindCtx_RegisterObjectParam(bindctx, (LPOLESTR)HTMLLOADOPTIONSW, unk);
962 IUnknown_Release(unk);
964 hres = IBindCtx_GetObjectParam(pibc, (LPOLESTR)SZ_HTML_CLIENTSITE_OBJECTPARAM, &unk);
965 if(SUCCEEDED(hres)) {
966 IBindCtx_RegisterObjectParam(bindctx, (LPOLESTR)SZ_HTML_CLIENTSITE_OBJECTPARAM, unk);
967 IUnknown_Release(unk);
970 hres = CreateStreamOnHGlobal(NULL, TRUE, &stream);
971 if(FAILED(hres)) {
972 IBindCtx_Release(bindctx);
973 return hres;
976 if(This->mon)
977 IMoniker_Release(This->mon);
978 This->mon = pimkName;
979 IMoniker_AddRef(This->mon);
981 hres = XMLView_Moniker_Create(This->mon, stream, &mon);
982 if(FAILED(hres)) {
983 IStream_Release(stream);
984 IBindCtx_Release(bindctx);
985 return hres;
988 hres = IUnknown_QueryInterface(This->html_doc,
989 &IID_IPersistMoniker, (void**)&html_persist_mon);
990 if(FAILED(hres)) {
991 IMoniker_Release(mon);
992 IStream_Release(stream);
993 IBindCtx_Release(bindctx);
994 return hres;
997 hres = IPersistMoniker_Load(html_persist_mon, FALSE, mon, bindctx, 0);
998 IPersistMoniker_Release(html_persist_mon);
999 IMoniker_Release(mon);
1000 if(FAILED(hres)) {
1001 IStream_Release(stream);
1002 IBindCtx_Release(bindctx);
1003 return hres;
1006 hres = IBindCtx_GetObjectParam(bindctx, (LPOLESTR)BSCBHolderW, &unk);
1007 IBindCtx_Release(bindctx);
1008 if(FAILED(hres)) {
1009 IStream_Release(stream);
1010 return hres;
1012 hres = IUnknown_QueryInterface(unk, &IID_IBindStatusCallback, (void**)&bsc_html);
1013 IUnknown_Release(unk);
1014 if(FAILED(hres)) {
1015 IStream_Release(stream);
1016 return hres;
1019 hres = XMLView_BindStatusCallback_Create(bsc_html, This->mon, stream, &bsc);
1020 IStream_Release(stream);
1021 if(FAILED(hres)) {
1022 IBindStatusCallback_OnStopBinding(bsc_html, hres, NULL);
1023 IBindStatusCallback_Release(bsc_html);
1024 return hres;
1027 hres = RegisterBindStatusCallback(pibc, bsc, NULL, 0);
1028 IBindStatusCallback_Release(bsc);
1029 if(FAILED(hres)) {
1030 IBindStatusCallback_OnStopBinding(bsc_html, hres, NULL);
1031 IBindStatusCallback_Release(bsc_html);
1032 return hres;
1035 hres = IMoniker_BindToStorage(pimkName, pibc, NULL,
1036 &IID_IStream, (void**)&stream);
1037 if(FAILED(hres)) {
1038 IBindStatusCallback_OnStopBinding(bsc_html, hres, NULL);
1039 IBindStatusCallback_Release(bsc_html);
1040 return hres;
1043 if(stream)
1044 IStream_Release(stream);
1045 IBindStatusCallback_Release(bsc_html);
1046 return S_OK;
1049 static HRESULT WINAPI XMLView_PersistMoniker_Save(IPersistMoniker *iface,
1050 IMoniker *pimkName, LPBC pbc, BOOL fRemember)
1052 XMLView *This = impl_from_IPersistMoniker(iface);
1053 FIXME("(%p)->(%p %p %x)\n", This, pimkName, pbc, fRemember);
1054 return E_NOTIMPL;
1057 static HRESULT WINAPI XMLView_PersistMoniker_SaveCompleted(
1058 IPersistMoniker *iface, IMoniker *pimkName, LPBC pibc)
1060 XMLView *This = impl_from_IPersistMoniker(iface);
1061 FIXME("(%p)->(%p %p)\n", This, pimkName, pibc);
1062 return E_NOTIMPL;
1065 static HRESULT WINAPI XMLView_PersistMoniker_GetCurMoniker(
1066 IPersistMoniker *iface, IMoniker **ppimkName)
1068 XMLView *This = impl_from_IPersistMoniker(iface);
1069 FIXME("(%p)->(%p)\n", This, ppimkName);
1070 return E_NOTIMPL;
1073 static IPersistMonikerVtbl XMLView_PersistMonikerVtbl = {
1074 XMLView_PersistMoniker_QueryInterface,
1075 XMLView_PersistMoniker_AddRef,
1076 XMLView_PersistMoniker_Release,
1077 XMLView_PersistMoniker_GetClassID,
1078 XMLView_PersistMoniker_IsDirty,
1079 XMLView_PersistMoniker_Load,
1080 XMLView_PersistMoniker_Save,
1081 XMLView_PersistMoniker_SaveCompleted,
1082 XMLView_PersistMoniker_GetCurMoniker
1085 static inline XMLView* impl_from_IPersistHistory(IPersistHistory *iface)
1087 return CONTAINING_RECORD(iface, XMLView, IPersistHistory_iface);
1090 static HRESULT WINAPI XMLView_PersistHistory_QueryInterface(
1091 IPersistHistory *iface, REFIID riid, void **ppvObject)
1093 XMLView *This = impl_from_IPersistHistory(iface);
1094 return IPersistMoniker_QueryInterface(&This->IPersistMoniker_iface, riid, ppvObject);
1097 static ULONG WINAPI XMLView_PersistHistory_AddRef(IPersistHistory *iface)
1099 XMLView *This = impl_from_IPersistHistory(iface);
1100 return IPersistMoniker_AddRef(&This->IPersistMoniker_iface);
1103 static ULONG WINAPI XMLView_PersistHistory_Release(IPersistHistory *iface)
1105 XMLView *This = impl_from_IPersistHistory(iface);
1106 return IPersistMoniker_Release(&This->IPersistMoniker_iface);
1109 static HRESULT WINAPI XMLView_PersistHistory_GetClassID(
1110 IPersistHistory *iface, CLSID *pClassID)
1112 XMLView *This = impl_from_IPersistHistory(iface);
1113 FIXME("(%p)->(%p)\n", This, pClassID);
1114 return E_NOTIMPL;
1117 static HRESULT WINAPI XMLView_PersistHistory_LoadHistory(
1118 IPersistHistory *iface, IStream *pStream, IBindCtx *pbc)
1120 XMLView *This = impl_from_IPersistHistory(iface);
1121 FIXME("(%p)->(%p %p)\n", This, pStream, pbc);
1122 return E_NOTIMPL;
1125 static HRESULT WINAPI XMLView_PersistHistory_SaveHistory(
1126 IPersistHistory *iface, IStream *pStream)
1128 XMLView *This = impl_from_IPersistHistory(iface);
1129 FIXME("(%p)->(%p)\n", This, pStream);
1130 return E_NOTIMPL;
1133 static HRESULT WINAPI XMLView_PersistHistory_SetPositionCookie(
1134 IPersistHistory *iface, DWORD dwPositioncookie)
1136 XMLView *This = impl_from_IPersistHistory(iface);
1137 FIXME("(%p)->(%d)\n", This, dwPositioncookie);
1138 return E_NOTIMPL;
1141 static HRESULT WINAPI XMLView_PersistHistory_GetPositionCookie(
1142 IPersistHistory *iface, DWORD *pdwPositioncookie)
1144 XMLView *This = impl_from_IPersistHistory(iface);
1145 FIXME("(%p)->(%p)\n", This, pdwPositioncookie);
1146 return E_NOTIMPL;
1149 static IPersistHistoryVtbl XMLView_PersistHistoryVtbl = {
1150 XMLView_PersistHistory_QueryInterface,
1151 XMLView_PersistHistory_AddRef,
1152 XMLView_PersistHistory_Release,
1153 XMLView_PersistHistory_GetClassID,
1154 XMLView_PersistHistory_LoadHistory,
1155 XMLView_PersistHistory_SaveHistory,
1156 XMLView_PersistHistory_SetPositionCookie,
1157 XMLView_PersistHistory_GetPositionCookie
1160 static inline XMLView* impl_from_IOleCommandTarget(IOleCommandTarget *iface)
1162 return CONTAINING_RECORD(iface, XMLView, IOleCommandTarget_iface);
1165 static HRESULT WINAPI XMLView_OleCommandTarget_QueryInterface(
1166 IOleCommandTarget *iface, REFIID riid, void **ppvObject)
1168 XMLView *This = impl_from_IOleCommandTarget(iface);
1169 return IPersistMoniker_QueryInterface(&This->IPersistMoniker_iface, riid, ppvObject);
1172 static ULONG WINAPI XMLView_OleCommandTarget_AddRef(IOleCommandTarget *iface)
1174 XMLView *This = impl_from_IOleCommandTarget(iface);
1175 return IPersistMoniker_AddRef(&This->IPersistMoniker_iface);
1178 static ULONG WINAPI XMLView_OleCommandTarget_Release(IOleCommandTarget *iface)
1180 XMLView *This = impl_from_IOleCommandTarget(iface);
1181 return IPersistMoniker_Release(&This->IPersistMoniker_iface);
1184 static HRESULT WINAPI XMLView_OleCommandTarget_QueryStatus(IOleCommandTarget *iface,
1185 const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
1187 XMLView *This = impl_from_IOleCommandTarget(iface);
1188 FIXME("(%p)->(%p %x %p %p)\n", This, pguidCmdGroup, cCmds, prgCmds, pCmdText);
1189 return E_NOTIMPL;
1192 static HRESULT WINAPI XMLView_OleCommandTarget_Exec(IOleCommandTarget *iface,
1193 const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt,
1194 VARIANT *pvaIn, VARIANT *pvaOut)
1196 XMLView *This = impl_from_IOleCommandTarget(iface);
1197 FIXME("(%p)->(%p %d %x %p %p)\n", This, pguidCmdGroup,
1198 nCmdID, nCmdexecopt, pvaIn, pvaOut);
1199 return E_NOTIMPL;
1202 static IOleCommandTargetVtbl XMLView_OleCommandTargetVtbl = {
1203 XMLView_OleCommandTarget_QueryInterface,
1204 XMLView_OleCommandTarget_AddRef,
1205 XMLView_OleCommandTarget_Release,
1206 XMLView_OleCommandTarget_QueryStatus,
1207 XMLView_OleCommandTarget_Exec
1210 static inline XMLView* impl_from_IOleObject(IOleObject *iface)
1212 return CONTAINING_RECORD(iface, XMLView, IOleObject_iface);
1215 static HRESULT WINAPI XMLView_OleObject_QueryInterface(
1216 IOleObject *iface, REFIID riid, void **ppvObject)
1218 XMLView *This = impl_from_IOleObject(iface);
1219 return IPersistMoniker_QueryInterface(&This->IPersistMoniker_iface, riid, ppvObject);
1222 static ULONG WINAPI XMLView_OleObject_AddRef(IOleObject *iface)
1224 XMLView *This = impl_from_IOleObject(iface);
1225 return IPersistMoniker_AddRef(&This->IPersistMoniker_iface);
1228 static ULONG WINAPI XMLView_OleObject_Release(IOleObject *iface)
1230 XMLView *This = impl_from_IOleObject(iface);
1231 return IPersistMoniker_Release(&This->IPersistMoniker_iface);
1234 static HRESULT WINAPI XMLView_OleObject_SetClientSite(
1235 IOleObject *iface, IOleClientSite *pClientSite)
1237 XMLView *This = impl_from_IOleObject(iface);
1238 FIXME("(%p)->(%p)\n", This, pClientSite);
1239 return E_NOTIMPL;
1242 static HRESULT WINAPI XMLView_OleObject_GetClientSite(
1243 IOleObject *iface, IOleClientSite **ppClientSite)
1245 XMLView *This = impl_from_IOleObject(iface);
1246 FIXME("(%p)->(%p)\n", This, ppClientSite);
1247 return E_NOTIMPL;
1250 static HRESULT WINAPI XMLView_OleObject_SetHostNames(IOleObject *iface,
1251 LPCOLESTR szContainerApp, LPCOLESTR szContainerObj)
1253 XMLView *This = impl_from_IOleObject(iface);
1254 FIXME("(%p)->(%s %s)\n", This, debugstr_w(szContainerApp), debugstr_w(szContainerObj));
1255 return E_NOTIMPL;
1258 static HRESULT WINAPI XMLView_OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
1260 XMLView *This = impl_from_IOleObject(iface);
1261 FIXME("(%p)->(%x)\n", This, dwSaveOption);
1262 return E_NOTIMPL;
1265 static HRESULT WINAPI XMLView_OleObject_SetMoniker(IOleObject *iface,
1266 DWORD dwWhichMoniker, IMoniker *pmk)
1268 XMLView *This = impl_from_IOleObject(iface);
1269 FIXME("(%p)->(%x %p)\n", This, dwWhichMoniker, pmk);
1270 return E_NOTIMPL;
1273 static HRESULT WINAPI XMLView_OleObject_GetMoniker(IOleObject *iface,
1274 DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
1276 XMLView *This = impl_from_IOleObject(iface);
1277 FIXME("(%p)->(%x %x %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
1278 return E_NOTIMPL;
1281 static HRESULT WINAPI XMLView_OleObject_InitFromData(IOleObject *iface,
1282 IDataObject *pDataObject, BOOL fCreation, DWORD dwReserved)
1284 XMLView *This = impl_from_IOleObject(iface);
1285 FIXME("(%p)->(%p %x %x)\n", This, pDataObject, fCreation, dwReserved);
1286 return E_NOTIMPL;
1289 static HRESULT WINAPI XMLView_OleObject_GetClipboardData(IOleObject *iface,
1290 DWORD dwReserved, IDataObject **ppDataObject)
1292 XMLView *This = impl_from_IOleObject(iface);
1293 FIXME("(%p)->(%x %p)\n", This, dwReserved, ppDataObject);
1294 return E_NOTIMPL;
1297 static HRESULT WINAPI XMLView_OleObject_DoVerb(IOleObject *iface,
1298 LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite,
1299 LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
1301 XMLView *This = impl_from_IOleObject(iface);
1302 FIXME("(%p)->(%d %p %p %d %p %p)\n", This, iVerb, lpmsg,
1303 pActiveSite, lindex, hwndParent, lprcPosRect);
1304 return E_NOTIMPL;
1307 static HRESULT WINAPI XMLView_OleObject_EnumVerbs(
1308 IOleObject *iface, IEnumOLEVERB **ppEnumOleVerb)
1310 XMLView *This = impl_from_IOleObject(iface);
1311 FIXME("(%p)->{%p)\n", This, ppEnumOleVerb);
1312 return E_NOTIMPL;
1315 static HRESULT WINAPI XMLView_OleObject_Update(IOleObject *iface)
1317 XMLView *This = impl_from_IOleObject(iface);
1318 FIXME("(%p)\n", This);
1319 return E_NOTIMPL;
1322 static HRESULT WINAPI XMLView_OleObject_IsUpToDate(IOleObject *iface)
1324 XMLView *This = impl_from_IOleObject(iface);
1325 FIXME("(%p)\n", This);
1326 return E_NOTIMPL;
1329 static HRESULT WINAPI XMLView_OleObject_GetUserClassID(IOleObject *iface, CLSID *pClsid)
1331 XMLView *This = impl_from_IOleObject(iface);
1332 FIXME("(%p)->(%p)\n", This, pClsid);
1333 return E_NOTIMPL;
1336 static HRESULT WINAPI XMLView_OleObject_GetUserType(IOleObject *iface,
1337 DWORD dwFormOfType, LPOLESTR *pszUserType)
1339 XMLView *This = impl_from_IOleObject(iface);
1340 FIXME("(%p)->(%x %p)\n", This, dwFormOfType, pszUserType);
1341 return E_NOTIMPL;
1344 static HRESULT WINAPI XMLView_OleObject_SetExtent(IOleObject *iface,
1345 DWORD dwDrawAspect, SIZEL *psizel)
1347 XMLView *This = impl_from_IOleObject(iface);
1348 FIXME("(%p)->(%x %p)\n", This, dwDrawAspect, psizel);
1349 return E_NOTIMPL;
1352 static HRESULT WINAPI XMLView_OleObject_GetExtent(IOleObject *iface,
1353 DWORD dwDrawAspect, SIZEL *psizel)
1355 XMLView *This = impl_from_IOleObject(iface);
1356 FIXME("(%p)->(%x %p)\n", This, dwDrawAspect, psizel);
1357 return E_NOTIMPL;
1360 static HRESULT WINAPI XMLView_OleObject_Advise(IOleObject *iface,
1361 IAdviseSink *pAdvSink, DWORD *pdwConnection)
1363 XMLView *This = impl_from_IOleObject(iface);
1364 FIXME("(%p)->(%p %p)\n", This, pAdvSink, pdwConnection);
1365 return E_NOTIMPL;
1368 static HRESULT WINAPI XMLView_OleObject_Unadvise(
1369 IOleObject *iface, DWORD dwConnection)
1371 XMLView *This = impl_from_IOleObject(iface);
1372 FIXME("(%p)->(%d)\n", This, dwConnection);
1373 return E_NOTIMPL;
1376 static HRESULT WINAPI XMLView_OleObject_EnumAdvise(
1377 IOleObject *iface, IEnumSTATDATA **ppenumAdvise)
1379 XMLView *This = impl_from_IOleObject(iface);
1380 FIXME("(%p)->(%p)\n", This, ppenumAdvise);
1381 return E_NOTIMPL;
1384 static HRESULT WINAPI XMLView_OleObject_GetMiscStatus(
1385 IOleObject *iface, DWORD dwAspect, DWORD *pdwStatus)
1387 XMLView *This = impl_from_IOleObject(iface);
1388 FIXME("(%p)->(%d %p)\n", This, dwAspect, pdwStatus);
1389 return E_NOTIMPL;
1392 static HRESULT WINAPI XMLView_OleObject_SetColorScheme(
1393 IOleObject *iface, LOGPALETTE *pLogpal)
1395 XMLView *This = impl_from_IOleObject(iface);
1396 FIXME("(%p)->(%p)\n", This, pLogpal);
1397 return E_NOTIMPL;
1400 static IOleObjectVtbl XMLView_OleObjectVtbl = {
1401 XMLView_OleObject_QueryInterface,
1402 XMLView_OleObject_AddRef,
1403 XMLView_OleObject_Release,
1404 XMLView_OleObject_SetClientSite,
1405 XMLView_OleObject_GetClientSite,
1406 XMLView_OleObject_SetHostNames,
1407 XMLView_OleObject_Close,
1408 XMLView_OleObject_SetMoniker,
1409 XMLView_OleObject_GetMoniker,
1410 XMLView_OleObject_InitFromData,
1411 XMLView_OleObject_GetClipboardData,
1412 XMLView_OleObject_DoVerb,
1413 XMLView_OleObject_EnumVerbs,
1414 XMLView_OleObject_Update,
1415 XMLView_OleObject_IsUpToDate,
1416 XMLView_OleObject_GetUserClassID,
1417 XMLView_OleObject_GetUserType,
1418 XMLView_OleObject_SetExtent,
1419 XMLView_OleObject_GetExtent,
1420 XMLView_OleObject_Advise,
1421 XMLView_OleObject_Unadvise,
1422 XMLView_OleObject_EnumAdvise,
1423 XMLView_OleObject_GetMiscStatus,
1424 XMLView_OleObject_SetColorScheme
1427 HRESULT XMLView_create(void **ppObj)
1429 XMLView *This;
1430 HRESULT hres;
1432 TRACE("(%p)\n", ppObj);
1434 This = heap_alloc_zero(sizeof(*This));
1435 if(!This)
1436 return E_OUTOFMEMORY;
1438 This->IPersistMoniker_iface.lpVtbl = &XMLView_PersistMonikerVtbl;
1439 This->IPersistHistory_iface.lpVtbl = &XMLView_PersistHistoryVtbl;
1440 This->IOleCommandTarget_iface.lpVtbl = &XMLView_OleCommandTargetVtbl;
1441 This->IOleObject_iface.lpVtbl = &XMLView_OleObjectVtbl;
1442 This->ref = 1;
1444 hres = CoCreateInstance(&CLSID_HTMLDocument, (IUnknown*)&This->IPersistMoniker_iface,
1445 CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&This->html_doc);
1446 if(FAILED(hres)) {
1447 heap_free(This);
1448 return hres;
1451 *ppObj = &This->IPersistMoniker_iface;
1452 return S_OK;
1455 #else
1457 HRESULT XMLView_create(void **ppObj)
1459 MESSAGE("This program tried to use a XMLView object, but\n"
1460 "libxml2 support was not present at compile time.\n");
1461 return E_NOTIMPL;
1464 #endif /* HAVE_LIBXML2 */