xref: /reactos/dll/win32/ieframe/client.c (revision fc19c80d)
1c2c66affSColin Finck /*
2c2c66affSColin Finck  * Copyright 2005 Jacek Caban for CodeWeavers
3c2c66affSColin Finck  *
4c2c66affSColin Finck  * This library is free software; you can redistribute it and/or
5c2c66affSColin Finck  * modify it under the terms of the GNU Lesser General Public
6c2c66affSColin Finck  * License as published by the Free Software Foundation; either
7c2c66affSColin Finck  * version 2.1 of the License, or (at your option) any later version.
8c2c66affSColin Finck  *
9c2c66affSColin Finck  * This library is distributed in the hope that it will be useful,
10c2c66affSColin Finck  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11c2c66affSColin Finck  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12c2c66affSColin Finck  * Lesser General Public License for more details.
13c2c66affSColin Finck  *
14c2c66affSColin Finck  * You should have received a copy of the GNU Lesser General Public
15c2c66affSColin Finck  * License along with this library; if not, write to the Free Software
16c2c66affSColin Finck  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17c2c66affSColin Finck  */
18c2c66affSColin Finck 
19*fc19c80dSAmine Khaldi #include <stdio.h>
20*fc19c80dSAmine Khaldi 
21c2c66affSColin Finck #include "ieframe.h"
22c2c66affSColin Finck 
23*fc19c80dSAmine Khaldi #include "mshtmdid.h"
24*fc19c80dSAmine Khaldi #include "idispids.h"
25*fc19c80dSAmine Khaldi 
26*fc19c80dSAmine Khaldi #include "wine/debug.h"
27*fc19c80dSAmine Khaldi 
28*fc19c80dSAmine Khaldi WINE_DEFAULT_DEBUG_CHANNEL(ieframe);
29*fc19c80dSAmine Khaldi 
impl_from_IOleClientSite(IOleClientSite * iface)30c2c66affSColin Finck static inline DocHost *impl_from_IOleClientSite(IOleClientSite *iface)
31c2c66affSColin Finck {
32c2c66affSColin Finck     return CONTAINING_RECORD(iface, DocHost, IOleClientSite_iface);
33c2c66affSColin Finck }
34c2c66affSColin Finck 
ClientSite_QueryInterface(IOleClientSite * iface,REFIID riid,void ** ppv)35c2c66affSColin Finck static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
36c2c66affSColin Finck {
37c2c66affSColin Finck     DocHost *This = impl_from_IOleClientSite(iface);
38c2c66affSColin Finck 
39c2c66affSColin Finck     if(IsEqualGUID(&IID_IUnknown, riid)) {
40c2c66affSColin Finck         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
41c2c66affSColin Finck         *ppv = &This->IOleClientSite_iface;
42c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IOleClientSite, riid)) {
43c2c66affSColin Finck         TRACE("(%p)->(IID_IOleClientSite %p)\n", This, ppv);
44c2c66affSColin Finck         *ppv = &This->IOleClientSite_iface;
45c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
46c2c66affSColin Finck         TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
47c2c66affSColin Finck         *ppv = &This->IOleInPlaceSiteEx_iface;
48c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IOleInPlaceSite, riid)) {
49c2c66affSColin Finck         TRACE("(%p)->(IID_IOleInPlaceSite %p)\n", This, ppv);
50c2c66affSColin Finck         *ppv = &This->IOleInPlaceSiteEx_iface;
51c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IOleInPlaceSiteEx, riid)) {
52c2c66affSColin Finck         TRACE("(%p)->(IID_IOleInPlaceSiteEx %p)\n", This, ppv);
53c2c66affSColin Finck         *ppv = &This->IOleInPlaceSiteEx_iface;
54c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IDocHostUIHandler, riid)) {
55c2c66affSColin Finck         TRACE("(%p)->(IID_IDocHostUIHandler %p)\n", This, ppv);
56c2c66affSColin Finck         *ppv = &This->IDocHostUIHandler2_iface;
57c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IDocHostUIHandler2, riid)) {
58c2c66affSColin Finck         TRACE("(%p)->(IID_IDocHostUIHandler2 %p)\n", This, ppv);
59c2c66affSColin Finck         *ppv = &This->IDocHostUIHandler2_iface;
60c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IOleDocumentSite, riid)) {
61c2c66affSColin Finck         TRACE("(%p)->(IID_IOleDocumentSite %p)\n", This, ppv);
62c2c66affSColin Finck         *ppv = &This->IOleDocumentSite_iface;
63c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IOleControlSite, riid)) {
64c2c66affSColin Finck         TRACE("(%p)->(IID_IOleControlSite %p)\n", This, ppv);
65c2c66affSColin Finck         *ppv = &This->IOleControlSite_iface;
66c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
67c2c66affSColin Finck         TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This, ppv);
68c2c66affSColin Finck         *ppv = &This->IOleCommandTarget_iface;
69c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IDispatch, riid)) {
70c2c66affSColin Finck         TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
71c2c66affSColin Finck         *ppv = &This->IDispatch_iface;
72c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
73c2c66affSColin Finck         TRACE("(%p)->(IID_IPropertyNotifySink %p)\n", This, ppv);
74c2c66affSColin Finck         *ppv = &This->IPropertyNotifySink_iface;
75c2c66affSColin Finck     }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
76c2c66affSColin Finck         TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
77c2c66affSColin Finck         *ppv = &This->IServiceProvider_iface;
78c2c66affSColin Finck     }else {
79c2c66affSColin Finck         *ppv = NULL;
80c2c66affSColin Finck         WARN("Unsupported interface %s\n", debugstr_guid(riid));
81c2c66affSColin Finck         return E_NOINTERFACE;
82c2c66affSColin Finck     }
83c2c66affSColin Finck 
84c2c66affSColin Finck     IUnknown_AddRef((IUnknown*)*ppv);
85c2c66affSColin Finck     return S_OK;
86c2c66affSColin Finck }
87c2c66affSColin Finck 
ClientSite_AddRef(IOleClientSite * iface)88c2c66affSColin Finck static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
89c2c66affSColin Finck {
90c2c66affSColin Finck     DocHost *This = impl_from_IOleClientSite(iface);
91c2c66affSColin Finck     return This->container_vtbl->addref(This);
92c2c66affSColin Finck }
93c2c66affSColin Finck 
ClientSite_Release(IOleClientSite * iface)94c2c66affSColin Finck static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
95c2c66affSColin Finck {
96c2c66affSColin Finck     DocHost *This = impl_from_IOleClientSite(iface);
97c2c66affSColin Finck     return This->container_vtbl->release(This);
98c2c66affSColin Finck }
99c2c66affSColin Finck 
ClientSite_SaveObject(IOleClientSite * iface)100c2c66affSColin Finck static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
101c2c66affSColin Finck {
102c2c66affSColin Finck     DocHost *This = impl_from_IOleClientSite(iface);
103c2c66affSColin Finck     FIXME("(%p)\n", This);
104c2c66affSColin Finck     return E_NOTIMPL;
105c2c66affSColin Finck }
106c2c66affSColin Finck 
ClientSite_GetMoniker(IOleClientSite * iface,DWORD dwAssign,DWORD dwWhichMoniker,IMoniker ** ppmk)107c2c66affSColin Finck static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign,
108c2c66affSColin Finck                                             DWORD dwWhichMoniker, IMoniker **ppmk)
109c2c66affSColin Finck {
110c2c66affSColin Finck     DocHost *This = impl_from_IOleClientSite(iface);
111c2c66affSColin Finck     FIXME("(%p)->(%d %d %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
112c2c66affSColin Finck     return E_NOTIMPL;
113c2c66affSColin Finck }
114c2c66affSColin Finck 
ClientSite_GetContainer(IOleClientSite * iface,IOleContainer ** ppContainer)115c2c66affSColin Finck static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
116c2c66affSColin Finck {
117c2c66affSColin Finck     DocHost *This = impl_from_IOleClientSite(iface);
118c2c66affSColin Finck     FIXME("(%p)->(%p)\n", This, ppContainer);
119c2c66affSColin Finck     return E_NOTIMPL;
120c2c66affSColin Finck }
121c2c66affSColin Finck 
ClientSite_ShowObject(IOleClientSite * iface)122c2c66affSColin Finck static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
123c2c66affSColin Finck {
124c2c66affSColin Finck     DocHost *This = impl_from_IOleClientSite(iface);
125c2c66affSColin Finck     FIXME("(%p)\n", This);
126c2c66affSColin Finck     return E_NOTIMPL;
127c2c66affSColin Finck }
128c2c66affSColin Finck 
ClientSite_OnShowWindow(IOleClientSite * iface,BOOL fShow)129c2c66affSColin Finck static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
130c2c66affSColin Finck {
131c2c66affSColin Finck     DocHost *This = impl_from_IOleClientSite(iface);
132c2c66affSColin Finck     FIXME("(%p)->(%x)\n", This, fShow);
133c2c66affSColin Finck     return E_NOTIMPL;
134c2c66affSColin Finck }
135c2c66affSColin Finck 
ClientSite_RequestNewObjectLayout(IOleClientSite * iface)136c2c66affSColin Finck static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
137c2c66affSColin Finck {
138c2c66affSColin Finck     DocHost *This = impl_from_IOleClientSite(iface);
139c2c66affSColin Finck     FIXME("(%p)\n", This);
140c2c66affSColin Finck     return E_NOTIMPL;
141c2c66affSColin Finck }
142c2c66affSColin Finck 
143c2c66affSColin Finck static const IOleClientSiteVtbl OleClientSiteVtbl = {
144c2c66affSColin Finck     ClientSite_QueryInterface,
145c2c66affSColin Finck     ClientSite_AddRef,
146c2c66affSColin Finck     ClientSite_Release,
147c2c66affSColin Finck     ClientSite_SaveObject,
148c2c66affSColin Finck     ClientSite_GetMoniker,
149c2c66affSColin Finck     ClientSite_GetContainer,
150c2c66affSColin Finck     ClientSite_ShowObject,
151c2c66affSColin Finck     ClientSite_OnShowWindow,
152c2c66affSColin Finck     ClientSite_RequestNewObjectLayout
153c2c66affSColin Finck };
154c2c66affSColin Finck 
impl_from_IOleInPlaceSiteEx(IOleInPlaceSiteEx * iface)155c2c66affSColin Finck static inline DocHost *impl_from_IOleInPlaceSiteEx(IOleInPlaceSiteEx *iface)
156c2c66affSColin Finck {
157c2c66affSColin Finck     return CONTAINING_RECORD(iface, DocHost, IOleInPlaceSiteEx_iface);
158c2c66affSColin Finck }
159c2c66affSColin Finck 
InPlaceSite_QueryInterface(IOleInPlaceSiteEx * iface,REFIID riid,void ** ppv)160c2c66affSColin Finck static HRESULT WINAPI InPlaceSite_QueryInterface(IOleInPlaceSiteEx *iface, REFIID riid, void **ppv)
161c2c66affSColin Finck {
162c2c66affSColin Finck     DocHost *This = impl_from_IOleInPlaceSiteEx(iface);
163c2c66affSColin Finck     return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
164c2c66affSColin Finck }
165c2c66affSColin Finck 
InPlaceSite_AddRef(IOleInPlaceSiteEx * iface)166c2c66affSColin Finck static ULONG WINAPI InPlaceSite_AddRef(IOleInPlaceSiteEx *iface)
167c2c66affSColin Finck {
168c2c66affSColin Finck     DocHost *This = impl_from_IOleInPlaceSiteEx(iface);
169c2c66affSColin Finck     return IOleClientSite_AddRef(&This->IOleClientSite_iface);
170c2c66affSColin Finck }
171c2c66affSColin Finck 
InPlaceSite_Release(IOleInPlaceSiteEx * iface)172c2c66affSColin Finck static ULONG WINAPI InPlaceSite_Release(IOleInPlaceSiteEx *iface)
173c2c66affSColin Finck {
174c2c66affSColin Finck     DocHost *This = impl_from_IOleInPlaceSiteEx(iface);
175c2c66affSColin Finck     return IOleClientSite_Release(&This->IOleClientSite_iface);
176c2c66affSColin Finck }
177c2c66affSColin Finck 
InPlaceSite_GetWindow(IOleInPlaceSiteEx * iface,HWND * phwnd)178c2c66affSColin Finck static HRESULT WINAPI InPlaceSite_GetWindow(IOleInPlaceSiteEx *iface, HWND *phwnd)
179c2c66affSColin Finck {
180c2c66affSColin Finck     DocHost *This = impl_from_IOleInPlaceSiteEx(iface);
181c2c66affSColin Finck 
182c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, phwnd);
183c2c66affSColin Finck 
184c2c66affSColin Finck     *phwnd = This->hwnd;
185c2c66affSColin Finck     return S_OK;
186c2c66affSColin Finck }
187c2c66affSColin Finck 
InPlaceSite_ContextSensitiveHelp(IOleInPlaceSiteEx * iface,BOOL fEnterMode)188c2c66affSColin Finck static HRESULT WINAPI InPlaceSite_ContextSensitiveHelp(IOleInPlaceSiteEx *iface, BOOL fEnterMode)
189c2c66affSColin Finck {
190c2c66affSColin Finck     DocHost *This = impl_from_IOleInPlaceSiteEx(iface);
191c2c66affSColin Finck     FIXME("(%p)->(%x)\n", This, fEnterMode);
192c2c66affSColin Finck     return E_NOTIMPL;
193c2c66affSColin Finck }
194c2c66affSColin Finck 
InPlaceSite_CanInPlaceActivate(IOleInPlaceSiteEx * iface)195c2c66affSColin Finck static HRESULT WINAPI InPlaceSite_CanInPlaceActivate(IOleInPlaceSiteEx *iface)
196c2c66affSColin Finck {
197c2c66affSColin Finck     DocHost *This = impl_from_IOleInPlaceSiteEx(iface);
198c2c66affSColin Finck 
199c2c66affSColin Finck     TRACE("(%p)\n", This);
200c2c66affSColin Finck 
201c2c66affSColin Finck     /* Nothing to do here */
202c2c66affSColin Finck     return S_OK;
203c2c66affSColin Finck }
204c2c66affSColin Finck 
InPlaceSite_OnInPlaceActivate(IOleInPlaceSiteEx * iface)205c2c66affSColin Finck static HRESULT WINAPI InPlaceSite_OnInPlaceActivate(IOleInPlaceSiteEx *iface)
206c2c66affSColin Finck {
207c2c66affSColin Finck     DocHost *This = impl_from_IOleInPlaceSiteEx(iface);
208c2c66affSColin Finck 
209c2c66affSColin Finck     TRACE("(%p)\n", This);
210c2c66affSColin Finck 
211c2c66affSColin Finck     /* Nothing to do here */
212c2c66affSColin Finck     return S_OK;
213c2c66affSColin Finck }
214c2c66affSColin Finck 
InPlaceSite_OnUIActivate(IOleInPlaceSiteEx * iface)215c2c66affSColin Finck static HRESULT WINAPI InPlaceSite_OnUIActivate(IOleInPlaceSiteEx *iface)
216c2c66affSColin Finck {
217c2c66affSColin Finck     DocHost *This = impl_from_IOleInPlaceSiteEx(iface);
218c2c66affSColin Finck     FIXME("(%p)\n", This);
219c2c66affSColin Finck     return E_NOTIMPL;
220c2c66affSColin Finck }
221c2c66affSColin Finck 
InPlaceSite_GetWindowContext(IOleInPlaceSiteEx * iface,IOleInPlaceFrame ** ppFrame,IOleInPlaceUIWindow ** ppDoc,LPRECT lprcPosRect,LPRECT lprcClipRect,LPOLEINPLACEFRAMEINFO lpFrameInfo)222c2c66affSColin Finck static HRESULT WINAPI InPlaceSite_GetWindowContext(IOleInPlaceSiteEx *iface,
223c2c66affSColin Finck         IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
224c2c66affSColin Finck         LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
225c2c66affSColin Finck {
226c2c66affSColin Finck     DocHost *This = impl_from_IOleInPlaceSiteEx(iface);
227c2c66affSColin Finck 
228c2c66affSColin Finck     TRACE("(%p)->(%p %p %p %p %p)\n", This, ppFrame, ppDoc, lprcPosRect,
229c2c66affSColin Finck           lprcClipRect, lpFrameInfo);
230c2c66affSColin Finck 
231c2c66affSColin Finck     IOleInPlaceFrame_AddRef(&This->IOleInPlaceFrame_iface);
232c2c66affSColin Finck     *ppFrame = &This->IOleInPlaceFrame_iface;
233c2c66affSColin Finck     *ppDoc = NULL;
234c2c66affSColin Finck 
235c2c66affSColin Finck     GetClientRect(This->hwnd, lprcPosRect);
236c2c66affSColin Finck     *lprcClipRect = *lprcPosRect;
237c2c66affSColin Finck 
238c2c66affSColin Finck     lpFrameInfo->fMDIApp = FALSE;
239c2c66affSColin Finck     lpFrameInfo->hwndFrame = This->frame_hwnd;
240c2c66affSColin Finck     lpFrameInfo->haccel = NULL;
241c2c66affSColin Finck     lpFrameInfo->cAccelEntries = 0; /* FIXME: should be 5 */
242c2c66affSColin Finck 
243c2c66affSColin Finck     return S_OK;
244c2c66affSColin Finck }
245c2c66affSColin Finck 
InPlaceSite_Scroll(IOleInPlaceSiteEx * iface,SIZE scrollExtent)246c2c66affSColin Finck static HRESULT WINAPI InPlaceSite_Scroll(IOleInPlaceSiteEx *iface, SIZE scrollExtent)
247c2c66affSColin Finck {
248c2c66affSColin Finck     DocHost *This = impl_from_IOleInPlaceSiteEx(iface);
249c2c66affSColin Finck     FIXME("(%p)->({%d %d})\n", This, scrollExtent.cx, scrollExtent.cy);
250c2c66affSColin Finck     return E_NOTIMPL;
251c2c66affSColin Finck }
252c2c66affSColin Finck 
InPlaceSite_OnUIDeactivate(IOleInPlaceSiteEx * iface,BOOL fUndoable)253c2c66affSColin Finck static HRESULT WINAPI InPlaceSite_OnUIDeactivate(IOleInPlaceSiteEx *iface, BOOL fUndoable)
254c2c66affSColin Finck {
255c2c66affSColin Finck     DocHost *This = impl_from_IOleInPlaceSiteEx(iface);
256c2c66affSColin Finck     FIXME("(%p)->(%x)\n", This, fUndoable);
257c2c66affSColin Finck     return E_NOTIMPL;
258c2c66affSColin Finck }
259c2c66affSColin Finck 
InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSiteEx * iface)260c2c66affSColin Finck static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSiteEx *iface)
261c2c66affSColin Finck {
262c2c66affSColin Finck     DocHost *This = impl_from_IOleInPlaceSiteEx(iface);
263c2c66affSColin Finck 
264c2c66affSColin Finck     TRACE("(%p)\n", This);
265c2c66affSColin Finck 
266c2c66affSColin Finck     /* Nothing to do here */
267c2c66affSColin Finck     return S_OK;
268c2c66affSColin Finck }
269c2c66affSColin Finck 
InPlaceSite_DiscardUndoState(IOleInPlaceSiteEx * iface)270c2c66affSColin Finck static HRESULT WINAPI InPlaceSite_DiscardUndoState(IOleInPlaceSiteEx *iface)
271c2c66affSColin Finck {
272c2c66affSColin Finck     DocHost *This = impl_from_IOleInPlaceSiteEx(iface);
273c2c66affSColin Finck     FIXME("(%p)\n", This);
274c2c66affSColin Finck     return E_NOTIMPL;
275c2c66affSColin Finck }
276c2c66affSColin Finck 
InPlaceSite_DeactivateAndUndo(IOleInPlaceSiteEx * iface)277c2c66affSColin Finck static HRESULT WINAPI InPlaceSite_DeactivateAndUndo(IOleInPlaceSiteEx *iface)
278c2c66affSColin Finck {
279c2c66affSColin Finck     DocHost *This = impl_from_IOleInPlaceSiteEx(iface);
280c2c66affSColin Finck     FIXME("(%p)\n", This);
281c2c66affSColin Finck     return E_NOTIMPL;
282c2c66affSColin Finck }
283c2c66affSColin Finck 
InPlaceSite_OnPosRectChange(IOleInPlaceSiteEx * iface,LPCRECT lprcPosRect)284c2c66affSColin Finck static HRESULT WINAPI InPlaceSite_OnPosRectChange(IOleInPlaceSiteEx *iface,
285c2c66affSColin Finck                                                   LPCRECT lprcPosRect)
286c2c66affSColin Finck {
287c2c66affSColin Finck     DocHost *This = impl_from_IOleInPlaceSiteEx(iface);
288c2c66affSColin Finck     FIXME("(%p)->(%p)\n", This, lprcPosRect);
289c2c66affSColin Finck     return E_NOTIMPL;
290c2c66affSColin Finck }
291c2c66affSColin Finck 
InPlaceSite_OnInPlaceActivateEx(IOleInPlaceSiteEx * iface,BOOL * pfNoRedraw,DWORD dwFlags)292c2c66affSColin Finck static HRESULT WINAPI InPlaceSite_OnInPlaceActivateEx(IOleInPlaceSiteEx *iface,
293c2c66affSColin Finck                                                      BOOL *pfNoRedraw, DWORD dwFlags)
294c2c66affSColin Finck {
295c2c66affSColin Finck     DocHost *This = impl_from_IOleInPlaceSiteEx(iface);
296c2c66affSColin Finck 
297c2c66affSColin Finck     TRACE("(%p)->(%p, %x)\n", This, pfNoRedraw, dwFlags);
298c2c66affSColin Finck 
299c2c66affSColin Finck     /* FIXME: Avoid redraw, when possible */
300c2c66affSColin Finck     *pfNoRedraw = FALSE;
301c2c66affSColin Finck 
302c2c66affSColin Finck     if (dwFlags) {
303c2c66affSColin Finck         FIXME("dwFlags not supported (%x)\n", dwFlags);
304c2c66affSColin Finck     }
305c2c66affSColin Finck 
306c2c66affSColin Finck     /* Nothing to do here */
307c2c66affSColin Finck     return S_OK;
308c2c66affSColin Finck }
309c2c66affSColin Finck 
InPlaceSite_OnInPlaceDeactivateEx(IOleInPlaceSiteEx * iface,BOOL fNoRedraw)310c2c66affSColin Finck static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivateEx(IOleInPlaceSiteEx *iface, BOOL fNoRedraw)
311c2c66affSColin Finck {
312c2c66affSColin Finck     DocHost *This = impl_from_IOleInPlaceSiteEx(iface);
313c2c66affSColin Finck 
314c2c66affSColin Finck     TRACE("(%p)->(%x)\n", This, fNoRedraw);
315c2c66affSColin Finck 
316c2c66affSColin Finck     if (fNoRedraw) {
317c2c66affSColin Finck         FIXME("fNoRedraw (%x) ignored\n", fNoRedraw);
318c2c66affSColin Finck     }
319c2c66affSColin Finck 
320c2c66affSColin Finck     /* Nothing to do here */
321c2c66affSColin Finck     return S_OK;
322c2c66affSColin Finck }
323c2c66affSColin Finck 
InPlaceSite_RequestUIActivate(IOleInPlaceSiteEx * iface)324c2c66affSColin Finck static HRESULT WINAPI InPlaceSite_RequestUIActivate(IOleInPlaceSiteEx *iface)
325c2c66affSColin Finck {
326c2c66affSColin Finck     DocHost *This = impl_from_IOleInPlaceSiteEx(iface);
327c2c66affSColin Finck     TRACE("(%p)\n", This);
328c2c66affSColin Finck 
329c2c66affSColin Finck     /* OnUIActivate is always possible */
330c2c66affSColin Finck     return S_OK;
331c2c66affSColin Finck }
332c2c66affSColin Finck 
333c2c66affSColin Finck static const IOleInPlaceSiteExVtbl OleInPlaceSiteExVtbl = {
334c2c66affSColin Finck     InPlaceSite_QueryInterface,
335c2c66affSColin Finck     InPlaceSite_AddRef,
336c2c66affSColin Finck     InPlaceSite_Release,
337c2c66affSColin Finck     InPlaceSite_GetWindow,
338c2c66affSColin Finck     InPlaceSite_ContextSensitiveHelp,
339c2c66affSColin Finck     InPlaceSite_CanInPlaceActivate,
340c2c66affSColin Finck     InPlaceSite_OnInPlaceActivate,
341c2c66affSColin Finck     InPlaceSite_OnUIActivate,
342c2c66affSColin Finck     InPlaceSite_GetWindowContext,
343c2c66affSColin Finck     InPlaceSite_Scroll,
344c2c66affSColin Finck     InPlaceSite_OnUIDeactivate,
345c2c66affSColin Finck     InPlaceSite_OnInPlaceDeactivate,
346c2c66affSColin Finck     InPlaceSite_DiscardUndoState,
347c2c66affSColin Finck     InPlaceSite_DeactivateAndUndo,
348c2c66affSColin Finck     InPlaceSite_OnPosRectChange,
349c2c66affSColin Finck     /* OleInPlaceSiteEx */
350c2c66affSColin Finck     InPlaceSite_OnInPlaceActivateEx,
351c2c66affSColin Finck     InPlaceSite_OnInPlaceDeactivateEx,
352c2c66affSColin Finck     InPlaceSite_RequestUIActivate
353c2c66affSColin Finck };
354c2c66affSColin Finck 
impl_from_IOleDocumentSite(IOleDocumentSite * iface)355c2c66affSColin Finck static inline DocHost *impl_from_IOleDocumentSite(IOleDocumentSite *iface)
356c2c66affSColin Finck {
357c2c66affSColin Finck     return CONTAINING_RECORD(iface, DocHost, IOleDocumentSite_iface);
358c2c66affSColin Finck }
359c2c66affSColin Finck 
OleDocumentSite_QueryInterface(IOleDocumentSite * iface,REFIID riid,void ** ppv)360c2c66affSColin Finck static HRESULT WINAPI OleDocumentSite_QueryInterface(IOleDocumentSite *iface,
361c2c66affSColin Finck                                                      REFIID riid, void **ppv)
362c2c66affSColin Finck {
363c2c66affSColin Finck     DocHost *This = impl_from_IOleDocumentSite(iface);
364c2c66affSColin Finck     return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
365c2c66affSColin Finck }
366c2c66affSColin Finck 
OleDocumentSite_AddRef(IOleDocumentSite * iface)367c2c66affSColin Finck static ULONG WINAPI OleDocumentSite_AddRef(IOleDocumentSite *iface)
368c2c66affSColin Finck {
369c2c66affSColin Finck     DocHost *This = impl_from_IOleDocumentSite(iface);
370c2c66affSColin Finck     return IOleClientSite_AddRef(&This->IOleClientSite_iface);
371c2c66affSColin Finck }
372c2c66affSColin Finck 
OleDocumentSite_Release(IOleDocumentSite * iface)373c2c66affSColin Finck static ULONG WINAPI OleDocumentSite_Release(IOleDocumentSite *iface)
374c2c66affSColin Finck {
375c2c66affSColin Finck     DocHost *This = impl_from_IOleDocumentSite(iface);
376c2c66affSColin Finck     return IOleClientSite_Release(&This->IOleClientSite_iface);
377c2c66affSColin Finck }
378c2c66affSColin Finck 
OleDocumentSite_ActivateMe(IOleDocumentSite * iface,IOleDocumentView * pViewToActivate)379c2c66affSColin Finck static HRESULT WINAPI OleDocumentSite_ActivateMe(IOleDocumentSite *iface,
380c2c66affSColin Finck                                                  IOleDocumentView *pViewToActivate)
381c2c66affSColin Finck {
382c2c66affSColin Finck     DocHost *This = impl_from_IOleDocumentSite(iface);
383c2c66affSColin Finck     IOleDocument *oledoc;
384c2c66affSColin Finck     RECT rect;
385c2c66affSColin Finck     HRESULT hres;
386c2c66affSColin Finck 
387c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, pViewToActivate);
388c2c66affSColin Finck 
389c2c66affSColin Finck     hres = IUnknown_QueryInterface(This->document, &IID_IOleDocument, (void**)&oledoc);
390c2c66affSColin Finck     if(FAILED(hres))
391c2c66affSColin Finck         return hres;
392c2c66affSColin Finck 
393c2c66affSColin Finck     hres = IOleDocument_CreateView(oledoc, (IOleInPlaceSite*) &This->IOleInPlaceSiteEx_iface, NULL, 0, &This->view);
394c2c66affSColin Finck     IOleDocument_Release(oledoc);
395c2c66affSColin Finck     if(FAILED(hres))
396c2c66affSColin Finck         return hres;
397c2c66affSColin Finck 
398c2c66affSColin Finck     GetClientRect(This->hwnd, &rect);
399c2c66affSColin Finck     IOleDocumentView_SetRect(This->view, &rect);
400c2c66affSColin Finck 
401c2c66affSColin Finck     hres = IOleDocumentView_Show(This->view, TRUE);
402c2c66affSColin Finck 
403c2c66affSColin Finck     return hres;
404c2c66affSColin Finck }
405c2c66affSColin Finck 
406c2c66affSColin Finck static const IOleDocumentSiteVtbl OleDocumentSiteVtbl = {
407c2c66affSColin Finck     OleDocumentSite_QueryInterface,
408c2c66affSColin Finck     OleDocumentSite_AddRef,
409c2c66affSColin Finck     OleDocumentSite_Release,
410c2c66affSColin Finck     OleDocumentSite_ActivateMe
411c2c66affSColin Finck };
412c2c66affSColin Finck 
impl_from_IOleControlSite(IOleControlSite * iface)413c2c66affSColin Finck static inline DocHost *impl_from_IOleControlSite(IOleControlSite *iface)
414c2c66affSColin Finck {
415c2c66affSColin Finck     return CONTAINING_RECORD(iface, DocHost, IOleControlSite_iface);
416c2c66affSColin Finck }
417c2c66affSColin Finck 
ControlSite_QueryInterface(IOleControlSite * iface,REFIID riid,void ** ppv)418c2c66affSColin Finck static HRESULT WINAPI ControlSite_QueryInterface(IOleControlSite *iface, REFIID riid, void **ppv)
419c2c66affSColin Finck {
420c2c66affSColin Finck     DocHost *This = impl_from_IOleControlSite(iface);
421c2c66affSColin Finck     return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
422c2c66affSColin Finck }
423c2c66affSColin Finck 
ControlSite_AddRef(IOleControlSite * iface)424c2c66affSColin Finck static ULONG WINAPI ControlSite_AddRef(IOleControlSite *iface)
425c2c66affSColin Finck {
426c2c66affSColin Finck     DocHost *This = impl_from_IOleControlSite(iface);
427c2c66affSColin Finck     return IOleClientSite_AddRef(&This->IOleClientSite_iface);
428c2c66affSColin Finck }
429c2c66affSColin Finck 
ControlSite_Release(IOleControlSite * iface)430c2c66affSColin Finck static ULONG WINAPI ControlSite_Release(IOleControlSite *iface)
431c2c66affSColin Finck {
432c2c66affSColin Finck     DocHost *This = impl_from_IOleControlSite(iface);
433c2c66affSColin Finck     return IOleClientSite_Release(&This->IOleClientSite_iface);
434c2c66affSColin Finck }
435c2c66affSColin Finck 
ControlSite_OnControlInfoChanged(IOleControlSite * iface)436c2c66affSColin Finck static HRESULT WINAPI ControlSite_OnControlInfoChanged(IOleControlSite *iface)
437c2c66affSColin Finck {
438c2c66affSColin Finck     DocHost *This = impl_from_IOleControlSite(iface);
439c2c66affSColin Finck     FIXME("(%p)\n", This);
440c2c66affSColin Finck     return E_NOTIMPL;
441c2c66affSColin Finck }
442c2c66affSColin Finck 
ControlSite_LockInPlaceActive(IOleControlSite * iface,BOOL fLock)443c2c66affSColin Finck static HRESULT WINAPI ControlSite_LockInPlaceActive(IOleControlSite *iface, BOOL fLock)
444c2c66affSColin Finck {
445c2c66affSColin Finck     DocHost *This = impl_from_IOleControlSite(iface);
446c2c66affSColin Finck     FIXME("(%p)->(%d)\n", This, fLock);
447c2c66affSColin Finck     return E_NOTIMPL;
448c2c66affSColin Finck }
449c2c66affSColin Finck 
ControlSite_GetExtendedControl(IOleControlSite * iface,IDispatch ** ppDisp)450c2c66affSColin Finck static HRESULT WINAPI ControlSite_GetExtendedControl(IOleControlSite *iface, IDispatch **ppDisp)
451c2c66affSColin Finck {
452c2c66affSColin Finck     DocHost *This = impl_from_IOleControlSite(iface);
453c2c66affSColin Finck     FIXME("(%p)->(%p)\n", This, ppDisp);
454c2c66affSColin Finck     return E_NOTIMPL;
455c2c66affSColin Finck }
456c2c66affSColin Finck 
ControlSite_TransformCoords(IOleControlSite * iface,POINTL * pPtlHimetric,POINTF * pPtfContainer,DWORD dwFlags)457c2c66affSColin Finck static HRESULT WINAPI ControlSite_TransformCoords(IOleControlSite *iface, POINTL *pPtlHimetric,
458c2c66affSColin Finck                                                   POINTF *pPtfContainer, DWORD dwFlags)
459c2c66affSColin Finck {
460c2c66affSColin Finck     DocHost *This = impl_from_IOleControlSite(iface);
461c2c66affSColin Finck     FIXME("(%p)->(%p, %p, %08x)\n", This, pPtlHimetric, pPtfContainer, dwFlags);
462c2c66affSColin Finck     return E_NOTIMPL;
463c2c66affSColin Finck }
464c2c66affSColin Finck 
ControlSite_TranslateAccelerator(IOleControlSite * iface,MSG * pMsg,DWORD grfModifiers)465c2c66affSColin Finck static HRESULT WINAPI ControlSite_TranslateAccelerator(IOleControlSite *iface, MSG *pMsg,
466c2c66affSColin Finck                                                        DWORD grfModifiers)
467c2c66affSColin Finck {
468c2c66affSColin Finck     DocHost *This = impl_from_IOleControlSite(iface);
469c2c66affSColin Finck     IOleObject *wb_obj;
470c2c66affSColin Finck     IOleClientSite *clientsite;
471c2c66affSColin Finck     IOleControlSite *controlsite;
472c2c66affSColin Finck     HRESULT hr;
473c2c66affSColin Finck 
474c2c66affSColin Finck     TRACE("(%p)->(%p, %08x)\n", This, pMsg, grfModifiers);
475c2c66affSColin Finck 
476c2c66affSColin Finck     hr = IWebBrowser2_QueryInterface(This->wb, &IID_IOleObject, (void**)&wb_obj);
477c2c66affSColin Finck     if(SUCCEEDED(hr)) {
478c2c66affSColin Finck         hr = IOleObject_GetClientSite(wb_obj, &clientsite);
479c2c66affSColin Finck         if(SUCCEEDED(hr)) {
480c2c66affSColin Finck             hr = IOleClientSite_QueryInterface(clientsite, &IID_IOleControlSite, (void**)&controlsite);
481c2c66affSColin Finck             if(SUCCEEDED(hr)) {
482c2c66affSColin Finck                 hr = IOleControlSite_TranslateAccelerator(controlsite, pMsg, grfModifiers);
483c2c66affSColin Finck                 IOleControlSite_Release(controlsite);
484c2c66affSColin Finck             }
485c2c66affSColin Finck             IOleClientSite_Release(clientsite);
486c2c66affSColin Finck         }
487c2c66affSColin Finck         IOleObject_Release(wb_obj);
488c2c66affSColin Finck     }
489c2c66affSColin Finck 
490c2c66affSColin Finck     if(FAILED(hr))
491c2c66affSColin Finck         return S_FALSE;
492c2c66affSColin Finck     else
493c2c66affSColin Finck         return hr;
494c2c66affSColin Finck }
495c2c66affSColin Finck 
ControlSite_OnFocus(IOleControlSite * iface,BOOL fGotFocus)496c2c66affSColin Finck static HRESULT WINAPI ControlSite_OnFocus(IOleControlSite *iface, BOOL fGotFocus)
497c2c66affSColin Finck {
498c2c66affSColin Finck     DocHost *This = impl_from_IOleControlSite(iface);
499c2c66affSColin Finck     FIXME("(%p)->(%d)\n", This, fGotFocus);
500c2c66affSColin Finck     return E_NOTIMPL;
501c2c66affSColin Finck }
502c2c66affSColin Finck 
ControlSite_ShowPropertyFrame(IOleControlSite * iface)503c2c66affSColin Finck static HRESULT WINAPI ControlSite_ShowPropertyFrame(IOleControlSite *iface)
504c2c66affSColin Finck {
505c2c66affSColin Finck     DocHost *This = impl_from_IOleControlSite(iface);
506c2c66affSColin Finck     FIXME("(%p)\n", This);
507c2c66affSColin Finck     return E_NOTIMPL;
508c2c66affSColin Finck }
509c2c66affSColin Finck 
510c2c66affSColin Finck static IOleControlSiteVtbl OleControlSiteVtbl = {
511c2c66affSColin Finck     ControlSite_QueryInterface,
512c2c66affSColin Finck     ControlSite_AddRef,
513c2c66affSColin Finck     ControlSite_Release,
514c2c66affSColin Finck     ControlSite_OnControlInfoChanged,
515c2c66affSColin Finck     ControlSite_LockInPlaceActive,
516c2c66affSColin Finck     ControlSite_GetExtendedControl,
517c2c66affSColin Finck     ControlSite_TransformCoords,
518c2c66affSColin Finck     ControlSite_TranslateAccelerator,
519c2c66affSColin Finck     ControlSite_OnFocus,
520c2c66affSColin Finck     ControlSite_ShowPropertyFrame
521c2c66affSColin Finck };
522c2c66affSColin Finck 
impl_from_IDispatch(IDispatch * iface)523c2c66affSColin Finck static inline DocHost *impl_from_IDispatch(IDispatch *iface)
524c2c66affSColin Finck {
525c2c66affSColin Finck     return CONTAINING_RECORD(iface, DocHost, IDispatch_iface);
526c2c66affSColin Finck }
527c2c66affSColin Finck 
ClDispatch_QueryInterface(IDispatch * iface,REFIID riid,void ** ppv)528c2c66affSColin Finck static HRESULT WINAPI ClDispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
529c2c66affSColin Finck {
530c2c66affSColin Finck     DocHost *This = impl_from_IDispatch(iface);
531c2c66affSColin Finck     return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
532c2c66affSColin Finck }
533c2c66affSColin Finck 
ClDispatch_AddRef(IDispatch * iface)534c2c66affSColin Finck static ULONG WINAPI ClDispatch_AddRef(IDispatch *iface)
535c2c66affSColin Finck {
536c2c66affSColin Finck     DocHost *This = impl_from_IDispatch(iface);
537c2c66affSColin Finck     return IOleClientSite_AddRef(&This->IOleClientSite_iface);
538c2c66affSColin Finck }
539c2c66affSColin Finck 
ClDispatch_Release(IDispatch * iface)540c2c66affSColin Finck static ULONG WINAPI ClDispatch_Release(IDispatch *iface)
541c2c66affSColin Finck {
542c2c66affSColin Finck     DocHost *This = impl_from_IDispatch(iface);
543c2c66affSColin Finck     return IOleClientSite_Release(&This->IOleClientSite_iface);
544c2c66affSColin Finck }
545c2c66affSColin Finck 
ClDispatch_GetTypeInfoCount(IDispatch * iface,UINT * pctinfo)546c2c66affSColin Finck static HRESULT WINAPI ClDispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
547c2c66affSColin Finck {
548c2c66affSColin Finck     DocHost *This = impl_from_IDispatch(iface);
549c2c66affSColin Finck 
550c2c66affSColin Finck     TRACE("(%p)->(%p)\n", This, pctinfo);
551c2c66affSColin Finck 
552c2c66affSColin Finck     return E_NOTIMPL;
553c2c66affSColin Finck }
554c2c66affSColin Finck 
ClDispatch_GetTypeInfo(IDispatch * iface,UINT iTInfo,LCID lcid,ITypeInfo ** ppTInfo)555c2c66affSColin Finck static HRESULT WINAPI ClDispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
556c2c66affSColin Finck                                              ITypeInfo **ppTInfo)
557c2c66affSColin Finck {
558c2c66affSColin Finck     DocHost *This = impl_from_IDispatch(iface);
559c2c66affSColin Finck 
560c2c66affSColin Finck     TRACE("(%p)->(%u %d %p)\n", This, iTInfo, lcid, ppTInfo);
561c2c66affSColin Finck 
562c2c66affSColin Finck     return E_NOTIMPL;
563c2c66affSColin Finck }
564c2c66affSColin Finck 
ClDispatch_GetIDsOfNames(IDispatch * iface,REFIID riid,LPOLESTR * rgszNames,UINT cNames,LCID lcid,DISPID * rgDispId)565c2c66affSColin Finck static HRESULT WINAPI ClDispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
566c2c66affSColin Finck                                                UINT cNames, LCID lcid, DISPID *rgDispId)
567c2c66affSColin Finck {
568c2c66affSColin Finck     DocHost *This = impl_from_IDispatch(iface);
569c2c66affSColin Finck 
570c2c66affSColin Finck     TRACE("(%p)->(%s %p %u %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
571c2c66affSColin Finck           lcid, rgDispId);
572c2c66affSColin Finck 
573c2c66affSColin Finck     return E_NOTIMPL;
574c2c66affSColin Finck }
575c2c66affSColin Finck 
debugstr_dispid(DISPID dispid)576c2c66affSColin Finck static const char *debugstr_dispid(DISPID dispid)
577c2c66affSColin Finck {
578c2c66affSColin Finck     static char buf[16];
579c2c66affSColin Finck 
580c2c66affSColin Finck #define CASE_DISPID(did) case did: return #did
581c2c66affSColin Finck     switch(dispid) {
582c2c66affSColin Finck         CASE_DISPID(DISPID_AMBIENT_USERMODE);
583c2c66affSColin Finck         CASE_DISPID(DISPID_AMBIENT_DLCONTROL);
584c2c66affSColin Finck         CASE_DISPID(DISPID_AMBIENT_USERAGENT);
585c2c66affSColin Finck         CASE_DISPID(DISPID_AMBIENT_PALETTE);
586c2c66affSColin Finck         CASE_DISPID(DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
587c2c66affSColin Finck         CASE_DISPID(DISPID_AMBIENT_SILENT);
588c2c66affSColin Finck     }
589c2c66affSColin Finck #undef CASE_DISPID
590c2c66affSColin Finck 
591c2c66affSColin Finck     sprintf(buf, "%d", dispid);
592c2c66affSColin Finck     return buf;
593c2c66affSColin Finck }
594c2c66affSColin Finck 
ClDispatch_Invoke(IDispatch * iface,DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS * pDispParams,VARIANT * pVarResult,EXCEPINFO * pExcepInfo,UINT * puArgErr)595c2c66affSColin Finck static HRESULT WINAPI ClDispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
596c2c66affSColin Finck                                         LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
597c2c66affSColin Finck                                         VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
598c2c66affSColin Finck {
599c2c66affSColin Finck     DocHost *This = impl_from_IDispatch(iface);
600c2c66affSColin Finck 
601c2c66affSColin Finck     TRACE("(%p)->(%s %s %d %04x %p %p %p %p)\n", This, debugstr_dispid(dispIdMember),
602c2c66affSColin Finck           debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
603c2c66affSColin Finck 
604c2c66affSColin Finck     switch(dispIdMember) {
605c2c66affSColin Finck     case DISPID_AMBIENT_USERMODE:
606c2c66affSColin Finck     case DISPID_AMBIENT_DLCONTROL:
607c2c66affSColin Finck     case DISPID_AMBIENT_USERAGENT:
608c2c66affSColin Finck     case DISPID_AMBIENT_PALETTE:
609c2c66affSColin Finck         if(!This->client_disp)
610c2c66affSColin Finck             return E_FAIL;
611c2c66affSColin Finck         return IDispatch_Invoke(This->client_disp, dispIdMember, riid, lcid, wFlags,
612c2c66affSColin Finck                                 pDispParams, pVarResult, pExcepInfo, puArgErr);
613c2c66affSColin Finck     case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
614c2c66affSColin Finck         V_VT(pVarResult) = VT_BOOL;
615c2c66affSColin Finck         V_BOOL(pVarResult) = This->offline;
616c2c66affSColin Finck         return S_OK;
617c2c66affSColin Finck     case DISPID_AMBIENT_SILENT:
618c2c66affSColin Finck         V_VT(pVarResult) = VT_BOOL;
619c2c66affSColin Finck         V_BOOL(pVarResult) = This->offline;
620c2c66affSColin Finck         return S_OK;
621c2c66affSColin Finck     }
622c2c66affSColin Finck 
623c2c66affSColin Finck     FIXME("unhandled dispid %d\n", dispIdMember);
624c2c66affSColin Finck     return E_NOTIMPL;
625c2c66affSColin Finck }
626c2c66affSColin Finck 
627c2c66affSColin Finck static const IDispatchVtbl DispatchVtbl = {
628c2c66affSColin Finck     ClDispatch_QueryInterface,
629c2c66affSColin Finck     ClDispatch_AddRef,
630c2c66affSColin Finck     ClDispatch_Release,
631c2c66affSColin Finck     ClDispatch_GetTypeInfoCount,
632c2c66affSColin Finck     ClDispatch_GetTypeInfo,
633c2c66affSColin Finck     ClDispatch_GetIDsOfNames,
634c2c66affSColin Finck     ClDispatch_Invoke
635c2c66affSColin Finck };
636c2c66affSColin Finck 
impl_from_IServiceProvider(IServiceProvider * iface)637c2c66affSColin Finck static inline DocHost *impl_from_IServiceProvider(IServiceProvider *iface)
638c2c66affSColin Finck {
639c2c66affSColin Finck     return CONTAINING_RECORD(iface, DocHost, IServiceProvider_iface);
640c2c66affSColin Finck }
641c2c66affSColin Finck 
ClServiceProvider_QueryInterface(IServiceProvider * iface,REFIID riid,void ** ppv)642c2c66affSColin Finck static HRESULT WINAPI ClServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid,
643c2c66affSColin Finck                                                        void **ppv)
644c2c66affSColin Finck {
645c2c66affSColin Finck     DocHost *This = impl_from_IServiceProvider(iface);
646c2c66affSColin Finck     return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
647c2c66affSColin Finck }
648c2c66affSColin Finck 
ClServiceProvider_AddRef(IServiceProvider * iface)649c2c66affSColin Finck static ULONG WINAPI ClServiceProvider_AddRef(IServiceProvider *iface)
650c2c66affSColin Finck {
651c2c66affSColin Finck     DocHost *This = impl_from_IServiceProvider(iface);
652c2c66affSColin Finck     return IOleClientSite_AddRef(&This->IOleClientSite_iface);
653c2c66affSColin Finck }
654c2c66affSColin Finck 
ClServiceProvider_Release(IServiceProvider * iface)655c2c66affSColin Finck static ULONG WINAPI ClServiceProvider_Release(IServiceProvider *iface)
656c2c66affSColin Finck {
657c2c66affSColin Finck     DocHost *This = impl_from_IServiceProvider(iface);
658c2c66affSColin Finck     return IOleClientSite_Release(&This->IOleClientSite_iface);
659c2c66affSColin Finck }
660c2c66affSColin Finck 
ClServiceProvider_QueryService(IServiceProvider * iface,REFGUID guidService,REFIID riid,void ** ppv)661c2c66affSColin Finck static HRESULT WINAPI ClServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
662c2c66affSColin Finck                                                      REFIID riid, void **ppv)
663c2c66affSColin Finck {
664c2c66affSColin Finck     DocHost *This = impl_from_IServiceProvider(iface);
665c2c66affSColin Finck 
666c2c66affSColin Finck     if(IsEqualGUID(&IID_IHlinkFrame, guidService)) {
667c2c66affSColin Finck         TRACE("(%p)->(IID_IHlinkFrame %s %p)\n", This, debugstr_guid(riid), ppv);
668c2c66affSColin Finck         return IWebBrowser2_QueryInterface(This->wb, riid, ppv);
669c2c66affSColin Finck     }
670c2c66affSColin Finck 
671c2c66affSColin Finck     if(IsEqualGUID(&IID_ITargetFrame, guidService)) {
672c2c66affSColin Finck         TRACE("(%p)->(IID_ITargetFrame %s %p)\n", This, debugstr_guid(riid), ppv);
673c2c66affSColin Finck         return IWebBrowser2_QueryInterface(This->wb, riid, ppv);
674c2c66affSColin Finck     }
675c2c66affSColin Finck 
676c2c66affSColin Finck     if(IsEqualGUID(&IID_IWebBrowserApp, guidService)) {
677c2c66affSColin Finck         TRACE("IWebBrowserApp service\n");
678c2c66affSColin Finck         return IWebBrowser2_QueryInterface(This->wb, riid, ppv);
679c2c66affSColin Finck     }
680c2c66affSColin Finck 
681c2c66affSColin Finck     if(IsEqualGUID(&IID_IShellBrowser, guidService)) {
682c2c66affSColin Finck         TRACE("(%p)->(IID_IShellBrowser %s %p)\n", This, debugstr_guid(riid), ppv);
683c2c66affSColin Finck 
684c2c66affSColin Finck         if(!This->browser_service) {
685c2c66affSColin Finck             HRESULT hres;
686c2c66affSColin Finck 
687c2c66affSColin Finck             hres = create_browser_service(This, &This->browser_service);
688c2c66affSColin Finck             if(FAILED(hres))
689c2c66affSColin Finck                 return hres;
690c2c66affSColin Finck         }
691c2c66affSColin Finck 
692c2c66affSColin Finck         return IShellBrowser_QueryInterface(&This->browser_service->IShellBrowser_iface, riid, ppv);
693c2c66affSColin Finck     }
694c2c66affSColin Finck 
695c2c66affSColin Finck     if(IsEqualGUID(&SID_SNewWindowManager, guidService)) {
696c2c66affSColin Finck         TRACE("SID_SNewWindowManager service\n");
697c2c66affSColin Finck         return INewWindowManager_QueryInterface(&This->nwm.INewWindowManager_iface, riid, ppv);
698c2c66affSColin Finck     }
699c2c66affSColin Finck 
700c2c66affSColin Finck     FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
701c2c66affSColin Finck 
702c2c66affSColin Finck     return E_NOINTERFACE;
703c2c66affSColin Finck }
704c2c66affSColin Finck 
705c2c66affSColin Finck static const IServiceProviderVtbl ServiceProviderVtbl = {
706c2c66affSColin Finck     ClServiceProvider_QueryInterface,
707c2c66affSColin Finck     ClServiceProvider_AddRef,
708c2c66affSColin Finck     ClServiceProvider_Release,
709c2c66affSColin Finck     ClServiceProvider_QueryService
710c2c66affSColin Finck };
711c2c66affSColin Finck 
DocHost_ClientSite_Init(DocHost * This)712c2c66affSColin Finck void DocHost_ClientSite_Init(DocHost *This)
713c2c66affSColin Finck {
714c2c66affSColin Finck     This->IOleClientSite_iface.lpVtbl    = &OleClientSiteVtbl;
715c2c66affSColin Finck     This->IOleInPlaceSiteEx_iface.lpVtbl = &OleInPlaceSiteExVtbl;
716c2c66affSColin Finck     This->IOleDocumentSite_iface.lpVtbl  = &OleDocumentSiteVtbl;
717c2c66affSColin Finck     This->IOleControlSite_iface.lpVtbl   = &OleControlSiteVtbl;
718c2c66affSColin Finck     This->IDispatch_iface.lpVtbl         = &DispatchVtbl;
719c2c66affSColin Finck     This->IServiceProvider_iface.lpVtbl  = &ServiceProviderVtbl;
720c2c66affSColin Finck }
721c2c66affSColin Finck 
DocHost_ClientSite_Release(DocHost * This)722c2c66affSColin Finck void DocHost_ClientSite_Release(DocHost *This)
723c2c66affSColin Finck {
724c2c66affSColin Finck     if(This->browser_service)
725c2c66affSColin Finck         detach_browser_service(This->browser_service);
726c2c66affSColin Finck     if(This->view)
727c2c66affSColin Finck         IOleDocumentView_Release(This->view);
728c2c66affSColin Finck }
729