usp10/test: Add Tibetan shaping test.
[wine.git] / dlls / shdocvw / client.c
blob729669ba0f792e7f13753df4af9c12d0c07355a8
1 /*
2 * Copyright 2005 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
19 #include <stdio.h>
21 #include "wine/debug.h"
22 #include "shdocvw.h"
23 #include "mshtmdid.h"
24 #include "idispids.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
28 static inline DocHost *impl_from_IOleClientSite(IOleClientSite *iface)
30 return CONTAINING_RECORD(iface, DocHost, IOleClientSite_iface);
33 static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
35 DocHost *This = impl_from_IOleClientSite(iface);
37 if(IsEqualGUID(&IID_IUnknown, riid)) {
38 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
39 *ppv = &This->IOleClientSite_iface;
40 }else if(IsEqualGUID(&IID_IOleClientSite, riid)) {
41 TRACE("(%p)->(IID_IOleClientSite %p)\n", This, ppv);
42 *ppv = &This->IOleClientSite_iface;
43 }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
44 TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
45 *ppv = &This->IOleInPlaceSite_iface;
46 }else if(IsEqualGUID(&IID_IOleInPlaceSite, riid)) {
47 TRACE("(%p)->(IID_IOleInPlaceSite %p)\n", This, ppv);
48 *ppv = &This->IOleInPlaceSite_iface;
49 }else if(IsEqualGUID(&IID_IDocHostUIHandler, riid)) {
50 TRACE("(%p)->(IID_IDocHostUIHandler %p)\n", This, ppv);
51 *ppv = &This->IDocHostUIHandler2_iface;
52 }else if(IsEqualGUID(&IID_IDocHostUIHandler2, riid)) {
53 TRACE("(%p)->(IID_IDocHostUIHandler2 %p)\n", This, ppv);
54 *ppv = &This->IDocHostUIHandler2_iface;
55 }else if(IsEqualGUID(&IID_IOleDocumentSite, riid)) {
56 TRACE("(%p)->(IID_IOleDocumentSite %p)\n", This, ppv);
57 *ppv = &This->IOleDocumentSite_iface;
58 }else if(IsEqualGUID(&IID_IOleControlSite, riid)) {
59 TRACE("(%p)->(IID_IOleControlSite %p)\n", This, ppv);
60 *ppv = &This->IOleControlSite_iface;
61 }else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
62 TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This, ppv);
63 *ppv = &This->IOleCommandTarget_iface;
64 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
65 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
66 *ppv = &This->IDispatch_iface;
67 }else if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
68 TRACE("(%p)->(IID_IPropertyNotifySink %p)\n", This, ppv);
69 *ppv = &This->IPropertyNotifySink_iface;
70 }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
71 TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
72 *ppv = &This->IServiceProvider_iface;
73 }else {
74 *ppv = NULL;
75 WARN("Unsupported interface %s\n", debugstr_guid(riid));
76 return E_NOINTERFACE;
79 IOleClientSite_AddRef((IUnknown*)*ppv);
80 return S_OK;
83 static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
85 DocHost *This = impl_from_IOleClientSite(iface);
86 return This->container_vtbl->addref(This);
89 static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
91 DocHost *This = impl_from_IOleClientSite(iface);
92 return This->container_vtbl->release(This);
95 static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
97 DocHost *This = impl_from_IOleClientSite(iface);
98 FIXME("(%p)\n", This);
99 return E_NOTIMPL;
102 static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign,
103 DWORD dwWhichMoniker, IMoniker **ppmk)
105 DocHost *This = impl_from_IOleClientSite(iface);
106 FIXME("(%p)->(%d %d %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
107 return E_NOTIMPL;
110 static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
112 DocHost *This = impl_from_IOleClientSite(iface);
113 FIXME("(%p)->(%p)\n", This, ppContainer);
114 return E_NOTIMPL;
117 static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
119 DocHost *This = impl_from_IOleClientSite(iface);
120 FIXME("(%p)\n", This);
121 return E_NOTIMPL;
124 static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
126 DocHost *This = impl_from_IOleClientSite(iface);
127 FIXME("(%p)->(%x)\n", This, fShow);
128 return E_NOTIMPL;
131 static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
133 DocHost *This = impl_from_IOleClientSite(iface);
134 FIXME("(%p)\n", This);
135 return E_NOTIMPL;
138 static const IOleClientSiteVtbl OleClientSiteVtbl = {
139 ClientSite_QueryInterface,
140 ClientSite_AddRef,
141 ClientSite_Release,
142 ClientSite_SaveObject,
143 ClientSite_GetMoniker,
144 ClientSite_GetContainer,
145 ClientSite_ShowObject,
146 ClientSite_OnShowWindow,
147 ClientSite_RequestNewObjectLayout
150 static inline DocHost *impl_from_IOleInPlaceSite(IOleInPlaceSite *iface)
152 return CONTAINING_RECORD(iface, DocHost, IOleInPlaceSite_iface);
155 static HRESULT WINAPI InPlaceSite_QueryInterface(IOleInPlaceSite *iface, REFIID riid, void **ppv)
157 DocHost *This = impl_from_IOleInPlaceSite(iface);
158 return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
161 static ULONG WINAPI InPlaceSite_AddRef(IOleInPlaceSite *iface)
163 DocHost *This = impl_from_IOleInPlaceSite(iface);
164 return IOleClientSite_AddRef(&This->IOleClientSite_iface);
167 static ULONG WINAPI InPlaceSite_Release(IOleInPlaceSite *iface)
169 DocHost *This = impl_from_IOleInPlaceSite(iface);
170 return IOleClientSite_Release(&This->IOleClientSite_iface);
173 static HRESULT WINAPI InPlaceSite_GetWindow(IOleInPlaceSite *iface, HWND *phwnd)
175 DocHost *This = impl_from_IOleInPlaceSite(iface);
177 TRACE("(%p)->(%p)\n", This, phwnd);
179 *phwnd = This->hwnd;
180 return S_OK;
183 static HRESULT WINAPI InPlaceSite_ContextSensitiveHelp(IOleInPlaceSite *iface, BOOL fEnterMode)
185 DocHost *This = impl_from_IOleInPlaceSite(iface);
186 FIXME("(%p)->(%x)\n", This, fEnterMode);
187 return E_NOTIMPL;
190 static HRESULT WINAPI InPlaceSite_CanInPlaceActivate(IOleInPlaceSite *iface)
192 DocHost *This = impl_from_IOleInPlaceSite(iface);
194 TRACE("(%p)\n", This);
196 /* Nothing to do here */
197 return S_OK;
200 static HRESULT WINAPI InPlaceSite_OnInPlaceActivate(IOleInPlaceSite *iface)
202 DocHost *This = impl_from_IOleInPlaceSite(iface);
204 TRACE("(%p)\n", This);
206 /* Nothing to do here */
207 return S_OK;
210 static HRESULT WINAPI InPlaceSite_OnUIActivate(IOleInPlaceSite *iface)
212 DocHost *This = impl_from_IOleInPlaceSite(iface);
213 FIXME("(%p)\n", This);
214 return E_NOTIMPL;
217 static HRESULT WINAPI InPlaceSite_GetWindowContext(IOleInPlaceSite *iface,
218 IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
219 LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
221 DocHost *This = impl_from_IOleInPlaceSite(iface);
223 TRACE("(%p)->(%p %p %p %p %p)\n", This, ppFrame, ppDoc, lprcPosRect,
224 lprcClipRect, lpFrameInfo);
226 IOleInPlaceFrame_AddRef(&This->IOleInPlaceFrame_iface);
227 *ppFrame = &This->IOleInPlaceFrame_iface;
228 *ppDoc = NULL;
230 GetClientRect(This->hwnd, lprcPosRect);
231 *lprcClipRect = *lprcPosRect;
233 lpFrameInfo->fMDIApp = FALSE;
234 lpFrameInfo->hwndFrame = This->frame_hwnd;
235 lpFrameInfo->haccel = NULL;
236 lpFrameInfo->cAccelEntries = 0; /* FIXME: should be 5 */
238 return S_OK;
241 static HRESULT WINAPI InPlaceSite_Scroll(IOleInPlaceSite *iface, SIZE scrollExtent)
243 DocHost *This = impl_from_IOleInPlaceSite(iface);
244 FIXME("(%p)->({%d %d})\n", This, scrollExtent.cx, scrollExtent.cy);
245 return E_NOTIMPL;
248 static HRESULT WINAPI InPlaceSite_OnUIDeactivate(IOleInPlaceSite *iface, BOOL fUndoable)
250 DocHost *This = impl_from_IOleInPlaceSite(iface);
251 FIXME("(%p)->(%x)\n", This, fUndoable);
252 return E_NOTIMPL;
255 static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSite *iface)
257 DocHost *This = impl_from_IOleInPlaceSite(iface);
259 TRACE("(%p)\n", This);
261 /* Nothing to do here */
262 return S_OK;
265 static HRESULT WINAPI InPlaceSite_DiscardUndoState(IOleInPlaceSite *iface)
267 DocHost *This = impl_from_IOleInPlaceSite(iface);
268 FIXME("(%p)\n", This);
269 return E_NOTIMPL;
272 static HRESULT WINAPI InPlaceSite_DeactivateAndUndo(IOleInPlaceSite *iface)
274 DocHost *This = impl_from_IOleInPlaceSite(iface);
275 FIXME("(%p)\n", This);
276 return E_NOTIMPL;
279 static HRESULT WINAPI InPlaceSite_OnPosRectChange(IOleInPlaceSite *iface,
280 LPCRECT lprcPosRect)
282 DocHost *This = impl_from_IOleInPlaceSite(iface);
283 FIXME("(%p)->(%p)\n", This, lprcPosRect);
284 return E_NOTIMPL;
287 static const IOleInPlaceSiteVtbl OleInPlaceSiteVtbl = {
288 InPlaceSite_QueryInterface,
289 InPlaceSite_AddRef,
290 InPlaceSite_Release,
291 InPlaceSite_GetWindow,
292 InPlaceSite_ContextSensitiveHelp,
293 InPlaceSite_CanInPlaceActivate,
294 InPlaceSite_OnInPlaceActivate,
295 InPlaceSite_OnUIActivate,
296 InPlaceSite_GetWindowContext,
297 InPlaceSite_Scroll,
298 InPlaceSite_OnUIDeactivate,
299 InPlaceSite_OnInPlaceDeactivate,
300 InPlaceSite_DiscardUndoState,
301 InPlaceSite_DeactivateAndUndo,
302 InPlaceSite_OnPosRectChange
305 static inline DocHost *impl_from_IOleDocumentSite(IOleDocumentSite *iface)
307 return CONTAINING_RECORD(iface, DocHost, IOleDocumentSite_iface);
310 static HRESULT WINAPI OleDocumentSite_QueryInterface(IOleDocumentSite *iface,
311 REFIID riid, void **ppv)
313 DocHost *This = impl_from_IOleDocumentSite(iface);
314 return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
317 static ULONG WINAPI OleDocumentSite_AddRef(IOleDocumentSite *iface)
319 DocHost *This = impl_from_IOleDocumentSite(iface);
320 return IOleClientSite_AddRef(&This->IOleClientSite_iface);
323 static ULONG WINAPI OleDocumentSite_Release(IOleDocumentSite *iface)
325 DocHost *This = impl_from_IOleDocumentSite(iface);
326 return IOleClientSite_Release(&This->IOleClientSite_iface);
329 static HRESULT WINAPI OleDocumentSite_ActivateMe(IOleDocumentSite *iface,
330 IOleDocumentView *pViewToActivate)
332 DocHost *This = impl_from_IOleDocumentSite(iface);
333 IOleDocument *oledoc;
334 RECT rect;
335 HRESULT hres;
337 TRACE("(%p)->(%p)\n", This, pViewToActivate);
339 hres = IUnknown_QueryInterface(This->document, &IID_IOleDocument, (void**)&oledoc);
340 if(FAILED(hres))
341 return hres;
343 IOleDocument_CreateView(oledoc, &This->IOleInPlaceSite_iface, NULL, 0, &This->view);
344 IOleDocument_Release(oledoc);
346 GetClientRect(This->hwnd, &rect);
347 IOleDocumentView_SetRect(This->view, &rect);
349 hres = IOleDocumentView_Show(This->view, TRUE);
351 return hres;
354 static const IOleDocumentSiteVtbl OleDocumentSiteVtbl = {
355 OleDocumentSite_QueryInterface,
356 OleDocumentSite_AddRef,
357 OleDocumentSite_Release,
358 OleDocumentSite_ActivateMe
361 static inline DocHost *impl_from_IOleControlSite(IOleControlSite *iface)
363 return CONTAINING_RECORD(iface, DocHost, IOleControlSite_iface);
366 static HRESULT WINAPI ControlSite_QueryInterface(IOleControlSite *iface, REFIID riid, void **ppv)
368 DocHost *This = impl_from_IOleControlSite(iface);
369 return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
372 static ULONG WINAPI ControlSite_AddRef(IOleControlSite *iface)
374 DocHost *This = impl_from_IOleControlSite(iface);
375 return IOleClientSite_AddRef(&This->IOleClientSite_iface);
378 static ULONG WINAPI ControlSite_Release(IOleControlSite *iface)
380 DocHost *This = impl_from_IOleControlSite(iface);
381 return IOleClientSite_Release(&This->IOleClientSite_iface);
384 static HRESULT WINAPI ControlSite_OnControlInfoChanged(IOleControlSite *iface)
386 DocHost *This = impl_from_IOleControlSite(iface);
387 FIXME("(%p)\n", This);
388 return E_NOTIMPL;
391 static HRESULT WINAPI ControlSite_LockInPlaceActive(IOleControlSite *iface, BOOL fLock)
393 DocHost *This = impl_from_IOleControlSite(iface);
394 FIXME("(%p)->(%d)\n", This, fLock);
395 return E_NOTIMPL;
398 static HRESULT WINAPI ControlSite_GetExtendedControl(IOleControlSite *iface, IDispatch **ppDisp)
400 DocHost *This = impl_from_IOleControlSite(iface);
401 FIXME("(%p)->(%p)\n", This, ppDisp);
402 return E_NOTIMPL;
405 static HRESULT WINAPI ControlSite_TransformCoords(IOleControlSite *iface, POINTL *pPtlHimetric,
406 POINTF *pPtfContainer, DWORD dwFlags)
408 DocHost *This = impl_from_IOleControlSite(iface);
409 FIXME("(%p)->(%p, %p, %08x)\n", This, pPtlHimetric, pPtfContainer, dwFlags);
410 return E_NOTIMPL;
413 static HRESULT WINAPI ControlSite_TranslateAccelerator(IOleControlSite *iface, MSG *pMsg,
414 DWORD grfModifiers)
416 DocHost *This = impl_from_IOleControlSite(iface);
417 IOleObject *wb_obj;
418 IOleClientSite *clientsite;
419 IOleControlSite *controlsite;
420 HRESULT hr;
422 TRACE("(%p)->(%p, %08x)\n", This, pMsg, grfModifiers);
424 hr = IDispatch_QueryInterface(This->disp, &IID_IOleObject, (void**)&wb_obj);
425 if(SUCCEEDED(hr)) {
426 hr = IOleObject_GetClientSite(wb_obj, &clientsite);
427 if(SUCCEEDED(hr)) {
428 hr = IOleClientSite_QueryInterface(clientsite, &IID_IOleControlSite, (void**)&controlsite);
429 if(SUCCEEDED(hr)) {
430 hr = IOleControlSite_TranslateAccelerator(controlsite, pMsg, grfModifiers);
431 IOleControlSite_Release(controlsite);
433 IOleClientSite_Release(clientsite);
435 IOleObject_Release(wb_obj);
438 if(FAILED(hr))
439 return S_FALSE;
440 else
441 return hr;
444 static HRESULT WINAPI ControlSite_OnFocus(IOleControlSite *iface, BOOL fGotFocus)
446 DocHost *This = impl_from_IOleControlSite(iface);
447 FIXME("(%p)->(%d)\n", This, fGotFocus);
448 return E_NOTIMPL;
451 static HRESULT WINAPI ControlSite_ShowPropertyFrame(IOleControlSite *iface)
453 DocHost *This = impl_from_IOleControlSite(iface);
454 FIXME("(%p)\n", This);
455 return E_NOTIMPL;
458 static IOleControlSiteVtbl OleControlSiteVtbl = {
459 ControlSite_QueryInterface,
460 ControlSite_AddRef,
461 ControlSite_Release,
462 ControlSite_OnControlInfoChanged,
463 ControlSite_LockInPlaceActive,
464 ControlSite_GetExtendedControl,
465 ControlSite_TransformCoords,
466 ControlSite_TranslateAccelerator,
467 ControlSite_OnFocus,
468 ControlSite_ShowPropertyFrame
471 static inline DocHost *impl_from_IDispatch(IDispatch *iface)
473 return CONTAINING_RECORD(iface, DocHost, IDispatch_iface);
476 static HRESULT WINAPI ClDispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
478 DocHost *This = impl_from_IDispatch(iface);
479 return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
482 static ULONG WINAPI ClDispatch_AddRef(IDispatch *iface)
484 DocHost *This = impl_from_IDispatch(iface);
485 return IOleClientSite_AddRef(&This->IOleClientSite_iface);
488 static ULONG WINAPI ClDispatch_Release(IDispatch *iface)
490 DocHost *This = impl_from_IDispatch(iface);
491 return IOleClientSite_Release(&This->IOleClientSite_iface);
494 static HRESULT WINAPI ClDispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
496 DocHost *This = impl_from_IDispatch(iface);
498 TRACE("(%p)->(%p)\n", This, pctinfo);
500 return E_NOTIMPL;
503 static HRESULT WINAPI ClDispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
504 ITypeInfo **ppTInfo)
506 DocHost *This = impl_from_IDispatch(iface);
508 TRACE("(%p)->(%u %d %p)\n", This, iTInfo, lcid, ppTInfo);
510 return E_NOTIMPL;
513 static HRESULT WINAPI ClDispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
514 UINT cNames, LCID lcid, DISPID *rgDispId)
516 DocHost *This = impl_from_IDispatch(iface);
518 TRACE("(%p)->(%s %p %u %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
519 lcid, rgDispId);
521 return E_NOTIMPL;
524 static const char *debugstr_dispid(DISPID dispid)
526 static char buf[16];
528 #define CASE_DISPID(did) case did: return #did
529 switch(dispid) {
530 CASE_DISPID(DISPID_AMBIENT_USERMODE);
531 CASE_DISPID(DISPID_AMBIENT_DLCONTROL);
532 CASE_DISPID(DISPID_AMBIENT_USERAGENT);
533 CASE_DISPID(DISPID_AMBIENT_PALETTE);
534 CASE_DISPID(DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
535 CASE_DISPID(DISPID_AMBIENT_SILENT);
537 #undef CASE_DISPID
539 sprintf(buf, "%d", dispid);
540 return buf;
543 static HRESULT WINAPI ClDispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
544 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
545 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
547 DocHost *This = impl_from_IDispatch(iface);
549 TRACE("(%p)->(%s %s %d %04x %p %p %p %p)\n", This, debugstr_dispid(dispIdMember),
550 debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
552 switch(dispIdMember) {
553 case DISPID_AMBIENT_USERMODE:
554 case DISPID_AMBIENT_DLCONTROL:
555 case DISPID_AMBIENT_USERAGENT:
556 case DISPID_AMBIENT_PALETTE:
557 if(!This->client_disp)
558 return E_FAIL;
559 return IDispatch_Invoke(This->client_disp, dispIdMember, riid, lcid, wFlags,
560 pDispParams, pVarResult, pExcepInfo, puArgErr);
561 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
562 V_VT(pVarResult) = VT_BOOL;
563 V_BOOL(pVarResult) = This->offline;
564 return S_OK;
565 case DISPID_AMBIENT_SILENT:
566 V_VT(pVarResult) = VT_BOOL;
567 V_BOOL(pVarResult) = This->offline;
568 return S_OK;
571 FIXME("unhandled dispid %d\n", dispIdMember);
572 return E_NOTIMPL;
575 static const IDispatchVtbl DispatchVtbl = {
576 ClDispatch_QueryInterface,
577 ClDispatch_AddRef,
578 ClDispatch_Release,
579 ClDispatch_GetTypeInfoCount,
580 ClDispatch_GetTypeInfo,
581 ClDispatch_GetIDsOfNames,
582 ClDispatch_Invoke
585 static inline DocHost *impl_from_IServiceProvider(IServiceProvider *iface)
587 return CONTAINING_RECORD(iface, DocHost, IServiceProvider_iface);
590 static HRESULT WINAPI ClServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid,
591 void **ppv)
593 DocHost *This = impl_from_IServiceProvider(iface);
594 return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
597 static ULONG WINAPI ClServiceProvider_AddRef(IServiceProvider *iface)
599 DocHost *This = impl_from_IServiceProvider(iface);
600 return IOleClientSite_AddRef(&This->IOleClientSite_iface);
603 static ULONG WINAPI ClServiceProvider_Release(IServiceProvider *iface)
605 DocHost *This = impl_from_IServiceProvider(iface);
606 return IOleClientSite_Release(&This->IOleClientSite_iface);
609 static HRESULT WINAPI ClServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
610 REFIID riid, void **ppv)
612 DocHost *This = impl_from_IServiceProvider(iface);
614 if(IsEqualGUID(&IID_IHlinkFrame, guidService)) {
615 TRACE("(%p)->(IID_IHlinkFrame %s %p)\n", This, debugstr_guid(riid), ppv);
616 return IDispatch_QueryInterface(This->disp, riid, ppv);
619 if(IsEqualGUID(&IID_IWebBrowserApp, guidService)) {
620 TRACE("IWebBrowserApp service\n");
621 return IDispatch_QueryInterface(This->disp, riid, ppv);
624 if(IsEqualGUID(&IID_IShellBrowser, guidService)) {
625 IShellBrowser *sb;
626 HRESULT hres;
628 TRACE("(%p)->(IID_IShellBrowser %s %p)\n", This, debugstr_guid(riid), ppv);
630 hres = ShellBrowser_Create(&sb);
631 if(FAILED(hres))
632 return hres;
634 hres = IShellBrowser_QueryInterface(sb, riid, ppv);
635 IShellBrowser_Release(sb);
636 return hres;
639 FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
641 return E_NOINTERFACE;
644 static const IServiceProviderVtbl ServiceProviderVtbl = {
645 ClServiceProvider_QueryInterface,
646 ClServiceProvider_AddRef,
647 ClServiceProvider_Release,
648 ClServiceProvider_QueryService
651 void DocHost_ClientSite_Init(DocHost *This)
653 This->IOleClientSite_iface.lpVtbl = &OleClientSiteVtbl;
654 This->IOleInPlaceSite_iface.lpVtbl = &OleInPlaceSiteVtbl;
655 This->IOleDocumentSite_iface.lpVtbl = &OleDocumentSiteVtbl;
656 This->IOleControlSite_iface.lpVtbl = &OleControlSiteVtbl;
657 This->IDispatch_iface.lpVtbl = &DispatchVtbl;
658 This->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
661 void DocHost_ClientSite_Release(DocHost *This)
663 if(This->view)
664 IOleDocumentView_Release(This->view);