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
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(ieframe
);
30 static inline DocHost
*impl_from_IOleClientSite(IOleClientSite
*iface
)
32 return CONTAINING_RECORD(iface
, DocHost
, IOleClientSite_iface
);
35 static HRESULT WINAPI
ClientSite_QueryInterface(IOleClientSite
*iface
, REFIID riid
, void **ppv
)
37 DocHost
*This
= impl_from_IOleClientSite(iface
);
39 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
40 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
41 *ppv
= &This
->IOleClientSite_iface
;
42 }else if(IsEqualGUID(&IID_IOleClientSite
, riid
)) {
43 TRACE("(%p)->(IID_IOleClientSite %p)\n", This
, ppv
);
44 *ppv
= &This
->IOleClientSite_iface
;
45 }else if(IsEqualGUID(&IID_IOleWindow
, riid
)) {
46 TRACE("(%p)->(IID_IOleWindow %p)\n", This
, ppv
);
47 *ppv
= &This
->IOleInPlaceSiteEx_iface
;
48 }else if(IsEqualGUID(&IID_IOleInPlaceSite
, riid
)) {
49 TRACE("(%p)->(IID_IOleInPlaceSite %p)\n", This
, ppv
);
50 *ppv
= &This
->IOleInPlaceSiteEx_iface
;
51 }else if(IsEqualGUID(&IID_IOleInPlaceSiteEx
, riid
)) {
52 TRACE("(%p)->(IID_IOleInPlaceSiteEx %p)\n", This
, ppv
);
53 *ppv
= &This
->IOleInPlaceSiteEx_iface
;
54 }else if(IsEqualGUID(&IID_IDocHostUIHandler
, riid
)) {
55 TRACE("(%p)->(IID_IDocHostUIHandler %p)\n", This
, ppv
);
56 *ppv
= &This
->IDocHostUIHandler2_iface
;
57 }else if(IsEqualGUID(&IID_IDocHostUIHandler2
, riid
)) {
58 TRACE("(%p)->(IID_IDocHostUIHandler2 %p)\n", This
, ppv
);
59 *ppv
= &This
->IDocHostUIHandler2_iface
;
60 }else if(IsEqualGUID(&IID_IOleDocumentSite
, riid
)) {
61 TRACE("(%p)->(IID_IOleDocumentSite %p)\n", This
, ppv
);
62 *ppv
= &This
->IOleDocumentSite_iface
;
63 }else if(IsEqualGUID(&IID_IOleControlSite
, riid
)) {
64 TRACE("(%p)->(IID_IOleControlSite %p)\n", This
, ppv
);
65 *ppv
= &This
->IOleControlSite_iface
;
66 }else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
)) {
67 TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This
, ppv
);
68 *ppv
= &This
->IOleCommandTarget_iface
;
69 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
70 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
71 *ppv
= &This
->IDispatch_iface
;
72 }else if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
73 TRACE("(%p)->(IID_IPropertyNotifySink %p)\n", This
, ppv
);
74 *ppv
= &This
->IPropertyNotifySink_iface
;
75 }else if(IsEqualGUID(&IID_IServiceProvider
, riid
)) {
76 TRACE("(%p)->(IID_IServiceProvider %p)\n", This
, ppv
);
77 *ppv
= &This
->IServiceProvider_iface
;
80 WARN("Unsupported interface %s\n", debugstr_guid(riid
));
84 IUnknown_AddRef((IUnknown
*)*ppv
);
88 static ULONG WINAPI
ClientSite_AddRef(IOleClientSite
*iface
)
90 DocHost
*This
= impl_from_IOleClientSite(iface
);
91 return This
->container_vtbl
->addref(This
);
94 static ULONG WINAPI
ClientSite_Release(IOleClientSite
*iface
)
96 DocHost
*This
= impl_from_IOleClientSite(iface
);
97 return This
->container_vtbl
->release(This
);
100 static HRESULT WINAPI
ClientSite_SaveObject(IOleClientSite
*iface
)
102 DocHost
*This
= impl_from_IOleClientSite(iface
);
103 FIXME("(%p)\n", This
);
107 static HRESULT WINAPI
ClientSite_GetMoniker(IOleClientSite
*iface
, DWORD dwAssign
,
108 DWORD dwWhichMoniker
, IMoniker
**ppmk
)
110 DocHost
*This
= impl_from_IOleClientSite(iface
);
111 FIXME("(%p)->(%d %d %p)\n", This
, dwAssign
, dwWhichMoniker
, ppmk
);
115 static HRESULT WINAPI
ClientSite_GetContainer(IOleClientSite
*iface
, IOleContainer
**ppContainer
)
117 DocHost
*This
= impl_from_IOleClientSite(iface
);
118 FIXME("(%p)->(%p)\n", This
, ppContainer
);
122 static HRESULT WINAPI
ClientSite_ShowObject(IOleClientSite
*iface
)
124 DocHost
*This
= impl_from_IOleClientSite(iface
);
125 FIXME("(%p)\n", This
);
129 static HRESULT WINAPI
ClientSite_OnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
131 DocHost
*This
= impl_from_IOleClientSite(iface
);
132 FIXME("(%p)->(%x)\n", This
, fShow
);
136 static HRESULT WINAPI
ClientSite_RequestNewObjectLayout(IOleClientSite
*iface
)
138 DocHost
*This
= impl_from_IOleClientSite(iface
);
139 FIXME("(%p)\n", This
);
143 static const IOleClientSiteVtbl OleClientSiteVtbl
= {
144 ClientSite_QueryInterface
,
147 ClientSite_SaveObject
,
148 ClientSite_GetMoniker
,
149 ClientSite_GetContainer
,
150 ClientSite_ShowObject
,
151 ClientSite_OnShowWindow
,
152 ClientSite_RequestNewObjectLayout
155 static inline DocHost
*impl_from_IOleInPlaceSiteEx(IOleInPlaceSiteEx
*iface
)
157 return CONTAINING_RECORD(iface
, DocHost
, IOleInPlaceSiteEx_iface
);
160 static HRESULT WINAPI
InPlaceSite_QueryInterface(IOleInPlaceSiteEx
*iface
, REFIID riid
, void **ppv
)
162 DocHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
163 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
166 static ULONG WINAPI
InPlaceSite_AddRef(IOleInPlaceSiteEx
*iface
)
168 DocHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
169 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
172 static ULONG WINAPI
InPlaceSite_Release(IOleInPlaceSiteEx
*iface
)
174 DocHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
175 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
178 static HRESULT WINAPI
InPlaceSite_GetWindow(IOleInPlaceSiteEx
*iface
, HWND
*phwnd
)
180 DocHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
182 TRACE("(%p)->(%p)\n", This
, phwnd
);
188 static HRESULT WINAPI
InPlaceSite_ContextSensitiveHelp(IOleInPlaceSiteEx
*iface
, BOOL fEnterMode
)
190 DocHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
191 FIXME("(%p)->(%x)\n", This
, fEnterMode
);
195 static HRESULT WINAPI
InPlaceSite_CanInPlaceActivate(IOleInPlaceSiteEx
*iface
)
197 DocHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
199 TRACE("(%p)\n", This
);
201 /* Nothing to do here */
205 static HRESULT WINAPI
InPlaceSite_OnInPlaceActivate(IOleInPlaceSiteEx
*iface
)
207 DocHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
209 TRACE("(%p)\n", This
);
211 /* Nothing to do here */
215 static HRESULT WINAPI
InPlaceSite_OnUIActivate(IOleInPlaceSiteEx
*iface
)
217 DocHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
218 FIXME("(%p)\n", This
);
222 static HRESULT WINAPI
InPlaceSite_GetWindowContext(IOleInPlaceSiteEx
*iface
,
223 IOleInPlaceFrame
**ppFrame
, IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
224 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
226 DocHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
228 TRACE("(%p)->(%p %p %p %p %p)\n", This
, ppFrame
, ppDoc
, lprcPosRect
,
229 lprcClipRect
, lpFrameInfo
);
231 IOleInPlaceFrame_AddRef(&This
->IOleInPlaceFrame_iface
);
232 *ppFrame
= &This
->IOleInPlaceFrame_iface
;
235 GetClientRect(This
->hwnd
, lprcPosRect
);
236 *lprcClipRect
= *lprcPosRect
;
238 lpFrameInfo
->fMDIApp
= FALSE
;
239 lpFrameInfo
->hwndFrame
= This
->frame_hwnd
;
240 lpFrameInfo
->haccel
= NULL
;
241 lpFrameInfo
->cAccelEntries
= 0; /* FIXME: should be 5 */
246 static HRESULT WINAPI
InPlaceSite_Scroll(IOleInPlaceSiteEx
*iface
, SIZE scrollExtent
)
248 DocHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
249 FIXME("(%p)->({%d %d})\n", This
, scrollExtent
.cx
, scrollExtent
.cy
);
253 static HRESULT WINAPI
InPlaceSite_OnUIDeactivate(IOleInPlaceSiteEx
*iface
, BOOL fUndoable
)
255 DocHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
256 FIXME("(%p)->(%x)\n", This
, fUndoable
);
260 static HRESULT WINAPI
InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSiteEx
*iface
)
262 DocHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
264 TRACE("(%p)\n", This
);
266 /* Nothing to do here */
270 static HRESULT WINAPI
InPlaceSite_DiscardUndoState(IOleInPlaceSiteEx
*iface
)
272 DocHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
273 FIXME("(%p)\n", This
);
277 static HRESULT WINAPI
InPlaceSite_DeactivateAndUndo(IOleInPlaceSiteEx
*iface
)
279 DocHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
280 FIXME("(%p)\n", This
);
284 static HRESULT WINAPI
InPlaceSite_OnPosRectChange(IOleInPlaceSiteEx
*iface
,
287 DocHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
288 FIXME("(%p)->(%p)\n", This
, lprcPosRect
);
292 static HRESULT WINAPI
InPlaceSite_OnInPlaceActivateEx(IOleInPlaceSiteEx
*iface
,
293 BOOL
*pfNoRedraw
, DWORD dwFlags
)
295 DocHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
297 TRACE("(%p)->(%p, %x)\n", This
, pfNoRedraw
, dwFlags
);
299 /* FIXME: Avoid redraw, when possible */
303 FIXME("dwFlags not supported (%x)\n", dwFlags
);
306 /* Nothing to do here */
310 static HRESULT WINAPI
InPlaceSite_OnInPlaceDeactivateEx(IOleInPlaceSiteEx
*iface
, BOOL fNoRedraw
)
312 DocHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
314 TRACE("(%p)->(%x)\n", This
, fNoRedraw
);
317 FIXME("fNoRedraw (%x) ignored\n", fNoRedraw
);
320 /* Nothing to do here */
324 static HRESULT WINAPI
InPlaceSite_RequestUIActivate(IOleInPlaceSiteEx
*iface
)
326 DocHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
327 TRACE("(%p)\n", This
);
329 /* OnUIActivate is always possible */
333 static const IOleInPlaceSiteExVtbl OleInPlaceSiteExVtbl
= {
334 InPlaceSite_QueryInterface
,
337 InPlaceSite_GetWindow
,
338 InPlaceSite_ContextSensitiveHelp
,
339 InPlaceSite_CanInPlaceActivate
,
340 InPlaceSite_OnInPlaceActivate
,
341 InPlaceSite_OnUIActivate
,
342 InPlaceSite_GetWindowContext
,
344 InPlaceSite_OnUIDeactivate
,
345 InPlaceSite_OnInPlaceDeactivate
,
346 InPlaceSite_DiscardUndoState
,
347 InPlaceSite_DeactivateAndUndo
,
348 InPlaceSite_OnPosRectChange
,
349 /* OleInPlaceSiteEx */
350 InPlaceSite_OnInPlaceActivateEx
,
351 InPlaceSite_OnInPlaceDeactivateEx
,
352 InPlaceSite_RequestUIActivate
355 static inline DocHost
*impl_from_IOleDocumentSite(IOleDocumentSite
*iface
)
357 return CONTAINING_RECORD(iface
, DocHost
, IOleDocumentSite_iface
);
360 static HRESULT WINAPI
OleDocumentSite_QueryInterface(IOleDocumentSite
*iface
,
361 REFIID riid
, void **ppv
)
363 DocHost
*This
= impl_from_IOleDocumentSite(iface
);
364 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
367 static ULONG WINAPI
OleDocumentSite_AddRef(IOleDocumentSite
*iface
)
369 DocHost
*This
= impl_from_IOleDocumentSite(iface
);
370 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
373 static ULONG WINAPI
OleDocumentSite_Release(IOleDocumentSite
*iface
)
375 DocHost
*This
= impl_from_IOleDocumentSite(iface
);
376 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
379 static HRESULT WINAPI
OleDocumentSite_ActivateMe(IOleDocumentSite
*iface
,
380 IOleDocumentView
*pViewToActivate
)
382 DocHost
*This
= impl_from_IOleDocumentSite(iface
);
383 IOleDocument
*oledoc
;
387 TRACE("(%p)->(%p)\n", This
, pViewToActivate
);
389 hres
= IUnknown_QueryInterface(This
->document
, &IID_IOleDocument
, (void**)&oledoc
);
393 IOleDocument_CreateView(oledoc
, (IOleInPlaceSite
*) &This
->IOleInPlaceSiteEx_iface
, NULL
, 0, &This
->view
);
394 IOleDocument_Release(oledoc
);
396 GetClientRect(This
->hwnd
, &rect
);
397 IOleDocumentView_SetRect(This
->view
, &rect
);
399 hres
= IOleDocumentView_Show(This
->view
, TRUE
);
404 static const IOleDocumentSiteVtbl OleDocumentSiteVtbl
= {
405 OleDocumentSite_QueryInterface
,
406 OleDocumentSite_AddRef
,
407 OleDocumentSite_Release
,
408 OleDocumentSite_ActivateMe
411 static inline DocHost
*impl_from_IOleControlSite(IOleControlSite
*iface
)
413 return CONTAINING_RECORD(iface
, DocHost
, IOleControlSite_iface
);
416 static HRESULT WINAPI
ControlSite_QueryInterface(IOleControlSite
*iface
, REFIID riid
, void **ppv
)
418 DocHost
*This
= impl_from_IOleControlSite(iface
);
419 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
422 static ULONG WINAPI
ControlSite_AddRef(IOleControlSite
*iface
)
424 DocHost
*This
= impl_from_IOleControlSite(iface
);
425 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
428 static ULONG WINAPI
ControlSite_Release(IOleControlSite
*iface
)
430 DocHost
*This
= impl_from_IOleControlSite(iface
);
431 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
434 static HRESULT WINAPI
ControlSite_OnControlInfoChanged(IOleControlSite
*iface
)
436 DocHost
*This
= impl_from_IOleControlSite(iface
);
437 FIXME("(%p)\n", This
);
441 static HRESULT WINAPI
ControlSite_LockInPlaceActive(IOleControlSite
*iface
, BOOL fLock
)
443 DocHost
*This
= impl_from_IOleControlSite(iface
);
444 FIXME("(%p)->(%d)\n", This
, fLock
);
448 static HRESULT WINAPI
ControlSite_GetExtendedControl(IOleControlSite
*iface
, IDispatch
**ppDisp
)
450 DocHost
*This
= impl_from_IOleControlSite(iface
);
451 FIXME("(%p)->(%p)\n", This
, ppDisp
);
455 static HRESULT WINAPI
ControlSite_TransformCoords(IOleControlSite
*iface
, POINTL
*pPtlHimetric
,
456 POINTF
*pPtfContainer
, DWORD dwFlags
)
458 DocHost
*This
= impl_from_IOleControlSite(iface
);
459 FIXME("(%p)->(%p, %p, %08x)\n", This
, pPtlHimetric
, pPtfContainer
, dwFlags
);
463 static HRESULT WINAPI
ControlSite_TranslateAccelerator(IOleControlSite
*iface
, MSG
*pMsg
,
466 DocHost
*This
= impl_from_IOleControlSite(iface
);
468 IOleClientSite
*clientsite
;
469 IOleControlSite
*controlsite
;
472 TRACE("(%p)->(%p, %08x)\n", This
, pMsg
, grfModifiers
);
474 hr
= IWebBrowser2_QueryInterface(This
->wb
, &IID_IOleObject
, (void**)&wb_obj
);
476 hr
= IOleObject_GetClientSite(wb_obj
, &clientsite
);
478 hr
= IOleClientSite_QueryInterface(clientsite
, &IID_IOleControlSite
, (void**)&controlsite
);
480 hr
= IOleControlSite_TranslateAccelerator(controlsite
, pMsg
, grfModifiers
);
481 IOleControlSite_Release(controlsite
);
483 IOleClientSite_Release(clientsite
);
485 IOleObject_Release(wb_obj
);
494 static HRESULT WINAPI
ControlSite_OnFocus(IOleControlSite
*iface
, BOOL fGotFocus
)
496 DocHost
*This
= impl_from_IOleControlSite(iface
);
497 FIXME("(%p)->(%d)\n", This
, fGotFocus
);
501 static HRESULT WINAPI
ControlSite_ShowPropertyFrame(IOleControlSite
*iface
)
503 DocHost
*This
= impl_from_IOleControlSite(iface
);
504 FIXME("(%p)\n", This
);
508 static IOleControlSiteVtbl OleControlSiteVtbl
= {
509 ControlSite_QueryInterface
,
512 ControlSite_OnControlInfoChanged
,
513 ControlSite_LockInPlaceActive
,
514 ControlSite_GetExtendedControl
,
515 ControlSite_TransformCoords
,
516 ControlSite_TranslateAccelerator
,
518 ControlSite_ShowPropertyFrame
521 static inline DocHost
*impl_from_IDispatch(IDispatch
*iface
)
523 return CONTAINING_RECORD(iface
, DocHost
, IDispatch_iface
);
526 static HRESULT WINAPI
ClDispatch_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
528 DocHost
*This
= impl_from_IDispatch(iface
);
529 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
532 static ULONG WINAPI
ClDispatch_AddRef(IDispatch
*iface
)
534 DocHost
*This
= impl_from_IDispatch(iface
);
535 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
538 static ULONG WINAPI
ClDispatch_Release(IDispatch
*iface
)
540 DocHost
*This
= impl_from_IDispatch(iface
);
541 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
544 static HRESULT WINAPI
ClDispatch_GetTypeInfoCount(IDispatch
*iface
, UINT
*pctinfo
)
546 DocHost
*This
= impl_from_IDispatch(iface
);
548 TRACE("(%p)->(%p)\n", This
, pctinfo
);
553 static HRESULT WINAPI
ClDispatch_GetTypeInfo(IDispatch
*iface
, UINT iTInfo
, LCID lcid
,
556 DocHost
*This
= impl_from_IDispatch(iface
);
558 TRACE("(%p)->(%u %d %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
563 static HRESULT WINAPI
ClDispatch_GetIDsOfNames(IDispatch
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
564 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
566 DocHost
*This
= impl_from_IDispatch(iface
);
568 TRACE("(%p)->(%s %p %u %d %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
574 static const char *debugstr_dispid(DISPID dispid
)
578 #define CASE_DISPID(did) case did: return #did
580 CASE_DISPID(DISPID_AMBIENT_USERMODE
);
581 CASE_DISPID(DISPID_AMBIENT_DLCONTROL
);
582 CASE_DISPID(DISPID_AMBIENT_USERAGENT
);
583 CASE_DISPID(DISPID_AMBIENT_PALETTE
);
584 CASE_DISPID(DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
);
585 CASE_DISPID(DISPID_AMBIENT_SILENT
);
589 sprintf(buf
, "%d", dispid
);
593 static HRESULT WINAPI
ClDispatch_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
594 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
595 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
597 DocHost
*This
= impl_from_IDispatch(iface
);
599 TRACE("(%p)->(%s %s %d %04x %p %p %p %p)\n", This
, debugstr_dispid(dispIdMember
),
600 debugstr_guid(riid
), lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
602 switch(dispIdMember
) {
603 case DISPID_AMBIENT_USERMODE
:
604 case DISPID_AMBIENT_DLCONTROL
:
605 case DISPID_AMBIENT_USERAGENT
:
606 case DISPID_AMBIENT_PALETTE
:
607 if(!This
->client_disp
)
609 return IDispatch_Invoke(This
->client_disp
, dispIdMember
, riid
, lcid
, wFlags
,
610 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
611 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
:
612 V_VT(pVarResult
) = VT_BOOL
;
613 V_BOOL(pVarResult
) = This
->offline
;
615 case DISPID_AMBIENT_SILENT
:
616 V_VT(pVarResult
) = VT_BOOL
;
617 V_BOOL(pVarResult
) = This
->offline
;
621 FIXME("unhandled dispid %d\n", dispIdMember
);
625 static const IDispatchVtbl DispatchVtbl
= {
626 ClDispatch_QueryInterface
,
629 ClDispatch_GetTypeInfoCount
,
630 ClDispatch_GetTypeInfo
,
631 ClDispatch_GetIDsOfNames
,
635 static inline DocHost
*impl_from_IServiceProvider(IServiceProvider
*iface
)
637 return CONTAINING_RECORD(iface
, DocHost
, IServiceProvider_iface
);
640 static HRESULT WINAPI
ClServiceProvider_QueryInterface(IServiceProvider
*iface
, REFIID riid
,
643 DocHost
*This
= impl_from_IServiceProvider(iface
);
644 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
647 static ULONG WINAPI
ClServiceProvider_AddRef(IServiceProvider
*iface
)
649 DocHost
*This
= impl_from_IServiceProvider(iface
);
650 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
653 static ULONG WINAPI
ClServiceProvider_Release(IServiceProvider
*iface
)
655 DocHost
*This
= impl_from_IServiceProvider(iface
);
656 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
659 static HRESULT WINAPI
ClServiceProvider_QueryService(IServiceProvider
*iface
, REFGUID guidService
,
660 REFIID riid
, void **ppv
)
662 DocHost
*This
= impl_from_IServiceProvider(iface
);
664 if(IsEqualGUID(&IID_IHlinkFrame
, guidService
)) {
665 TRACE("(%p)->(IID_IHlinkFrame %s %p)\n", This
, debugstr_guid(riid
), ppv
);
666 return IWebBrowser2_QueryInterface(This
->wb
, riid
, ppv
);
669 if(IsEqualGUID(&IID_IWebBrowserApp
, guidService
)) {
670 TRACE("IWebBrowserApp service\n");
671 return IWebBrowser2_QueryInterface(This
->wb
, riid
, ppv
);
674 if(IsEqualGUID(&IID_IShellBrowser
, guidService
)) {
675 TRACE("(%p)->(IID_IShellBrowser %s %p)\n", This
, debugstr_guid(riid
), ppv
);
677 if(!This
->browser_service
) {
680 hres
= create_browser_service(This
, &This
->browser_service
);
685 return IShellBrowser_QueryInterface(&This
->browser_service
->IShellBrowser_iface
, riid
, ppv
);
688 if(IsEqualGUID(&SID_SNewWindowManager
, guidService
)) {
689 TRACE("SID_SNewWindowManager service\n");
690 return INewWindowManager_QueryInterface(&This
->nwm
.INewWindowManager_iface
, riid
, ppv
);
693 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_guid(guidService
), debugstr_guid(riid
), ppv
);
695 return E_NOINTERFACE
;
698 static const IServiceProviderVtbl ServiceProviderVtbl
= {
699 ClServiceProvider_QueryInterface
,
700 ClServiceProvider_AddRef
,
701 ClServiceProvider_Release
,
702 ClServiceProvider_QueryService
705 void DocHost_ClientSite_Init(DocHost
*This
)
707 This
->IOleClientSite_iface
.lpVtbl
= &OleClientSiteVtbl
;
708 This
->IOleInPlaceSiteEx_iface
.lpVtbl
= &OleInPlaceSiteExVtbl
;
709 This
->IOleDocumentSite_iface
.lpVtbl
= &OleDocumentSiteVtbl
;
710 This
->IOleControlSite_iface
.lpVtbl
= &OleControlSiteVtbl
;
711 This
->IDispatch_iface
.lpVtbl
= &DispatchVtbl
;
712 This
->IServiceProvider_iface
.lpVtbl
= &ServiceProviderVtbl
;
715 void DocHost_ClientSite_Release(DocHost
*This
)
717 if(This
->browser_service
)
718 detach_browser_service(This
->browser_service
);
720 IOleDocumentView_Release(This
->view
);