2005-11-15 12:03:25 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2005 Jacek Caban for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-11-15 12:03:25 +00:00
|
|
|
*/
|
|
|
|
|
2007-03-09 15:49:21 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2005-11-15 12:03:25 +00:00
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "shdocvw.h"
|
2007-03-09 15:49:21 +00:00
|
|
|
#include "mshtmdid.h"
|
|
|
|
#include "idispids.h"
|
2005-11-15 12:03:25 +00:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
|
|
|
|
|
2010-11-13 16:47:58 +00:00
|
|
|
static inline DocHost *impl_from_IOleClientSite(IOleClientSite *iface)
|
|
|
|
{
|
|
|
|
return (DocHost*)((char*)iface - FIELD_OFFSET(DocHost, IOleClientSite_iface));
|
|
|
|
}
|
2005-11-15 12:03:25 +00:00
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2010-11-13 16:47:58 +00:00
|
|
|
DocHost *This = impl_from_IOleClientSite(iface);
|
2005-11-15 12:03:25 +00:00
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
|
2010-11-13 16:47:58 +00:00
|
|
|
*ppv = &This->IOleClientSite_iface;
|
2005-11-15 12:03:25 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IOleClientSite, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleClientSite %p)\n", This, ppv);
|
2010-11-13 16:47:58 +00:00
|
|
|
*ppv = &This->IOleClientSite_iface;
|
2005-11-16 11:21:00 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IOleWindow, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
|
2010-11-13 16:48:09 +00:00
|
|
|
*ppv = &This->IOleInPlaceSite_iface;
|
2005-11-16 11:21:00 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IOleInPlaceSite, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleInPlaceSite %p)\n", This, ppv);
|
2010-11-13 16:48:09 +00:00
|
|
|
*ppv = &This->IOleInPlaceSite_iface;
|
2005-11-17 11:03:53 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IDocHostUIHandler, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IDocHostUIHandler %p)\n", This, ppv);
|
2010-11-13 16:48:09 +00:00
|
|
|
*ppv = &This->IDocHostUIHandler2_iface;
|
2005-11-17 11:03:53 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IDocHostUIHandler2, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IDocHostUIHandler2 %p)\n", This, ppv);
|
2010-11-13 16:48:09 +00:00
|
|
|
*ppv = &This->IDocHostUIHandler2_iface;
|
2005-12-01 10:11:14 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IOleDocumentSite, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleDocumentSite %p)\n", This, ppv);
|
2010-11-13 16:48:09 +00:00
|
|
|
*ppv = &This->IOleDocumentSite_iface;
|
2006-04-17 22:24:59 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This, ppv);
|
2010-11-13 16:48:09 +00:00
|
|
|
*ppv = &This->IOleCommandTarget_iface;
|
2006-01-26 12:30:04 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
|
2010-11-13 16:48:09 +00:00
|
|
|
*ppv = &This->IDispatch_iface;
|
2009-08-29 23:00:06 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IPropertyNotifySink %p)\n", This, ppv);
|
2010-11-13 16:48:09 +00:00
|
|
|
*ppv = &This->IPropertyNotifySink_iface;
|
2006-02-15 10:53:31 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
|
2010-11-13 16:48:09 +00:00
|
|
|
*ppv = &This->IServiceProvider_iface;
|
2010-11-13 16:47:58 +00:00
|
|
|
}else {
|
|
|
|
*ppv = NULL;
|
|
|
|
WARN("Unsupported interface %s\n", debugstr_guid(riid));
|
|
|
|
return E_NOINTERFACE;
|
2005-11-15 12:03:25 +00:00
|
|
|
}
|
|
|
|
|
2010-11-13 16:47:58 +00:00
|
|
|
IOleClientSite_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
2005-11-15 12:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
|
|
|
|
{
|
2010-11-13 16:47:58 +00:00
|
|
|
DocHost *This = impl_from_IOleClientSite(iface);
|
2006-04-17 22:24:59 +00:00
|
|
|
return IDispatch_AddRef(This->disp);
|
2005-11-15 12:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
|
|
|
|
{
|
2010-11-13 16:47:58 +00:00
|
|
|
DocHost *This = impl_from_IOleClientSite(iface);
|
2006-04-17 22:24:59 +00:00
|
|
|
return IDispatch_Release(This->disp);
|
2005-11-15 12:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
|
|
|
|
{
|
2010-11-13 16:47:58 +00:00
|
|
|
DocHost *This = impl_from_IOleClientSite(iface);
|
2005-11-15 12:03:25 +00:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign,
|
|
|
|
DWORD dwWhichMoniker, IMoniker **ppmk)
|
|
|
|
{
|
2010-11-13 16:47:58 +00:00
|
|
|
DocHost *This = impl_from_IOleClientSite(iface);
|
2006-10-05 21:49:39 +00:00
|
|
|
FIXME("(%p)->(%d %d %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
|
2005-11-15 12:03:25 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
|
|
|
|
{
|
2010-11-13 16:47:58 +00:00
|
|
|
DocHost *This = impl_from_IOleClientSite(iface);
|
2005-11-15 12:03:25 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, ppContainer);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
|
|
|
|
{
|
2010-11-13 16:47:58 +00:00
|
|
|
DocHost *This = impl_from_IOleClientSite(iface);
|
2005-11-15 12:03:25 +00:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
|
|
|
|
{
|
2010-11-13 16:47:58 +00:00
|
|
|
DocHost *This = impl_from_IOleClientSite(iface);
|
2005-11-15 12:03:25 +00:00
|
|
|
FIXME("(%p)->(%x)\n", This, fShow);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
|
|
|
|
{
|
2010-11-13 16:47:58 +00:00
|
|
|
DocHost *This = impl_from_IOleClientSite(iface);
|
2005-11-15 12:03:25 +00:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IOleClientSiteVtbl OleClientSiteVtbl = {
|
|
|
|
ClientSite_QueryInterface,
|
|
|
|
ClientSite_AddRef,
|
|
|
|
ClientSite_Release,
|
|
|
|
ClientSite_SaveObject,
|
|
|
|
ClientSite_GetMoniker,
|
|
|
|
ClientSite_GetContainer,
|
|
|
|
ClientSite_ShowObject,
|
|
|
|
ClientSite_OnShowWindow,
|
|
|
|
ClientSite_RequestNewObjectLayout
|
|
|
|
};
|
|
|
|
|
2010-11-13 16:48:09 +00:00
|
|
|
static inline DocHost *impl_from_IOleInPlaceSite(IOleInPlaceSite *iface)
|
|
|
|
{
|
|
|
|
return (DocHost*)((char*)iface - FIELD_OFFSET(DocHost, IOleInPlaceSite_iface));
|
|
|
|
}
|
2005-11-16 11:21:00 +00:00
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_QueryInterface(IOleInPlaceSite *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleInPlaceSite(iface);
|
2010-11-13 16:47:58 +00:00
|
|
|
return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
|
2005-11-16 11:21:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InPlaceSite_AddRef(IOleInPlaceSite *iface)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleInPlaceSite(iface);
|
2010-11-13 16:47:58 +00:00
|
|
|
return IOleClientSite_AddRef(&This->IOleClientSite_iface);
|
2005-11-16 11:21:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InPlaceSite_Release(IOleInPlaceSite *iface)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleInPlaceSite(iface);
|
2010-11-13 16:47:58 +00:00
|
|
|
return IOleClientSite_Release(&This->IOleClientSite_iface);
|
2005-11-16 11:21:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_GetWindow(IOleInPlaceSite *iface, HWND *phwnd)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleInPlaceSite(iface);
|
2005-11-22 11:59:57 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, phwnd);
|
|
|
|
|
2006-04-17 22:26:47 +00:00
|
|
|
*phwnd = This->hwnd;
|
2005-11-22 11:59:57 +00:00
|
|
|
return S_OK;
|
2005-11-16 11:21:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_ContextSensitiveHelp(IOleInPlaceSite *iface, BOOL fEnterMode)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleInPlaceSite(iface);
|
2005-11-16 11:21:00 +00:00
|
|
|
FIXME("(%p)->(%x)\n", This, fEnterMode);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_CanInPlaceActivate(IOleInPlaceSite *iface)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleInPlaceSite(iface);
|
2005-12-01 10:11:14 +00:00
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
/* Nothing to do here */
|
|
|
|
return S_OK;
|
2005-11-16 11:21:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_OnInPlaceActivate(IOleInPlaceSite *iface)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleInPlaceSite(iface);
|
2005-12-01 10:11:14 +00:00
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
/* Nothing to do here */
|
|
|
|
return S_OK;
|
2005-11-16 11:21:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_OnUIActivate(IOleInPlaceSite *iface)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleInPlaceSite(iface);
|
2005-11-16 11:21:00 +00:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_GetWindowContext(IOleInPlaceSite *iface,
|
|
|
|
IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
|
|
|
|
LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleInPlaceSite(iface);
|
2005-11-28 10:01:17 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p %p %p %p %p)\n", This, ppFrame, ppDoc, lprcPosRect,
|
2005-11-16 11:21:00 +00:00
|
|
|
lprcClipRect, lpFrameInfo);
|
2005-11-28 10:01:17 +00:00
|
|
|
|
2010-11-13 16:48:34 +00:00
|
|
|
IOleInPlaceFrame_AddRef(&This->IOleInPlaceFrame_iface);
|
|
|
|
*ppFrame = &This->IOleInPlaceFrame_iface;
|
2005-11-28 10:01:17 +00:00
|
|
|
*ppDoc = NULL;
|
2005-12-01 10:11:14 +00:00
|
|
|
|
2006-04-17 22:26:47 +00:00
|
|
|
GetClientRect(This->hwnd, lprcPosRect);
|
2008-03-17 21:36:56 +00:00
|
|
|
*lprcClipRect = *lprcPosRect;
|
2005-11-28 10:01:17 +00:00
|
|
|
|
|
|
|
lpFrameInfo->cb = sizeof(*lpFrameInfo);
|
|
|
|
lpFrameInfo->fMDIApp = FALSE;
|
2006-04-17 22:26:47 +00:00
|
|
|
lpFrameInfo->hwndFrame = This->frame_hwnd;
|
2005-11-28 10:01:17 +00:00
|
|
|
lpFrameInfo->haccel = NULL;
|
|
|
|
lpFrameInfo->cAccelEntries = 0; /* FIXME: should be 5 */
|
|
|
|
|
|
|
|
return S_OK;
|
2005-11-16 11:21:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_Scroll(IOleInPlaceSite *iface, SIZE scrollExtent)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleInPlaceSite(iface);
|
2006-10-05 21:49:39 +00:00
|
|
|
FIXME("(%p)->({%d %d})\n", This, scrollExtent.cx, scrollExtent.cy);
|
2005-11-16 11:21:00 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_OnUIDeactivate(IOleInPlaceSite *iface, BOOL fUndoable)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleInPlaceSite(iface);
|
2005-11-16 11:21:00 +00:00
|
|
|
FIXME("(%p)->(%x)\n", This, fUndoable);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSite *iface)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleInPlaceSite(iface);
|
2006-05-18 20:43:01 +00:00
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
/* Nothing to do here */
|
|
|
|
return S_OK;
|
2005-11-16 11:21:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_DiscardUndoState(IOleInPlaceSite *iface)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleInPlaceSite(iface);
|
2005-11-16 11:21:00 +00:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_DeactivateAndUndo(IOleInPlaceSite *iface)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleInPlaceSite(iface);
|
2005-11-16 11:21:00 +00:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_OnPosRectChange(IOleInPlaceSite *iface,
|
|
|
|
LPCRECT lprcPosRect)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleInPlaceSite(iface);
|
2005-11-16 11:21:00 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, lprcPosRect);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IOleInPlaceSiteVtbl OleInPlaceSiteVtbl = {
|
|
|
|
InPlaceSite_QueryInterface,
|
|
|
|
InPlaceSite_AddRef,
|
|
|
|
InPlaceSite_Release,
|
|
|
|
InPlaceSite_GetWindow,
|
|
|
|
InPlaceSite_ContextSensitiveHelp,
|
|
|
|
InPlaceSite_CanInPlaceActivate,
|
|
|
|
InPlaceSite_OnInPlaceActivate,
|
|
|
|
InPlaceSite_OnUIActivate,
|
|
|
|
InPlaceSite_GetWindowContext,
|
|
|
|
InPlaceSite_Scroll,
|
|
|
|
InPlaceSite_OnUIDeactivate,
|
|
|
|
InPlaceSite_OnInPlaceDeactivate,
|
|
|
|
InPlaceSite_DiscardUndoState,
|
|
|
|
InPlaceSite_DeactivateAndUndo,
|
|
|
|
InPlaceSite_OnPosRectChange
|
|
|
|
};
|
|
|
|
|
2010-11-13 16:48:09 +00:00
|
|
|
static inline DocHost *impl_from_IOleDocumentSite(IOleDocumentSite *iface)
|
|
|
|
{
|
|
|
|
return (DocHost*)((char*)iface - FIELD_OFFSET(DocHost, IOleDocumentSite_iface));
|
|
|
|
}
|
2005-11-28 10:24:49 +00:00
|
|
|
|
|
|
|
static HRESULT WINAPI OleDocumentSite_QueryInterface(IOleDocumentSite *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleDocumentSite(iface);
|
2010-11-13 16:47:58 +00:00
|
|
|
return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
|
2005-11-28 10:24:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OleDocumentSite_AddRef(IOleDocumentSite *iface)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleDocumentSite(iface);
|
2010-11-13 16:47:58 +00:00
|
|
|
return IOleClientSite_AddRef(&This->IOleClientSite_iface);
|
2005-11-28 10:24:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OleDocumentSite_Release(IOleDocumentSite *iface)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleDocumentSite(iface);
|
2010-11-13 16:47:58 +00:00
|
|
|
return IOleClientSite_Release(&This->IOleClientSite_iface);
|
2005-11-28 10:24:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleDocumentSite_ActivateMe(IOleDocumentSite *iface,
|
|
|
|
IOleDocumentView *pViewToActivate)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IOleDocumentSite(iface);
|
2005-11-28 10:24:49 +00:00
|
|
|
IOleDocument *oledoc;
|
|
|
|
RECT rect;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, pViewToActivate);
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(This->document, &IID_IOleDocument, (void**)&oledoc);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
2010-11-13 16:48:09 +00:00
|
|
|
IOleDocument_CreateView(oledoc, &This->IOleInPlaceSite_iface, NULL, 0, &This->view);
|
2005-11-28 10:24:49 +00:00
|
|
|
IOleDocument_Release(oledoc);
|
|
|
|
|
2006-04-17 22:31:22 +00:00
|
|
|
GetClientRect(This->hwnd, &rect);
|
2005-11-28 10:24:49 +00:00
|
|
|
IOleDocumentView_SetRect(This->view, &rect);
|
|
|
|
|
|
|
|
hres = IOleDocumentView_Show(This->view, TRUE);
|
|
|
|
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IOleDocumentSiteVtbl OleDocumentSiteVtbl = {
|
|
|
|
OleDocumentSite_QueryInterface,
|
|
|
|
OleDocumentSite_AddRef,
|
|
|
|
OleDocumentSite_Release,
|
|
|
|
OleDocumentSite_ActivateMe
|
|
|
|
};
|
|
|
|
|
2010-11-13 16:48:09 +00:00
|
|
|
static inline DocHost *impl_from_IDispatch(IDispatch *iface)
|
|
|
|
{
|
|
|
|
return (DocHost*)((char*)iface - FIELD_OFFSET(DocHost, IDispatch_iface));
|
|
|
|
}
|
2006-01-26 12:30:04 +00:00
|
|
|
|
|
|
|
static HRESULT WINAPI ClDispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IDispatch(iface);
|
2010-11-13 16:47:58 +00:00
|
|
|
return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
|
2006-01-26 12:30:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClDispatch_AddRef(IDispatch *iface)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IDispatch(iface);
|
2010-11-13 16:47:58 +00:00
|
|
|
return IOleClientSite_AddRef(&This->IOleClientSite_iface);
|
2006-01-26 12:30:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClDispatch_Release(IDispatch *iface)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IDispatch(iface);
|
2010-11-13 16:47:58 +00:00
|
|
|
return IOleClientSite_Release(&This->IOleClientSite_iface);
|
2006-01-26 12:30:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClDispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IDispatch(iface);
|
2006-02-20 10:13:51 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, pctinfo);
|
|
|
|
|
2006-01-26 12:30:04 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClDispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
|
2006-02-15 10:53:31 +00:00
|
|
|
ITypeInfo **ppTInfo)
|
2006-01-26 12:30:04 +00:00
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IDispatch(iface);
|
2006-02-20 10:13:51 +00:00
|
|
|
|
2006-10-05 21:49:39 +00:00
|
|
|
TRACE("(%p)->(%u %d %p)\n", This, iTInfo, lcid, ppTInfo);
|
2006-02-20 10:13:51 +00:00
|
|
|
|
2006-01-26 12:30:04 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClDispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
|
2006-02-15 10:53:31 +00:00
|
|
|
UINT cNames, LCID lcid, DISPID *rgDispId)
|
2006-01-26 12:30:04 +00:00
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IDispatch(iface);
|
2006-02-20 10:13:51 +00:00
|
|
|
|
2006-10-05 21:49:39 +00:00
|
|
|
TRACE("(%p)->(%s %p %u %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
|
2006-01-26 12:30:04 +00:00
|
|
|
lcid, rgDispId);
|
2006-02-20 10:13:51 +00:00
|
|
|
|
2006-01-26 12:30:04 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2007-03-09 15:49:21 +00:00
|
|
|
static const char *debugstr_dispid(DISPID dispid)
|
|
|
|
{
|
|
|
|
static char buf[16];
|
|
|
|
|
|
|
|
#define CASE_DISPID(did) case did: return #did
|
|
|
|
switch(dispid) {
|
|
|
|
CASE_DISPID(DISPID_AMBIENT_USERMODE);
|
|
|
|
CASE_DISPID(DISPID_AMBIENT_DLCONTROL);
|
|
|
|
CASE_DISPID(DISPID_AMBIENT_USERAGENT);
|
|
|
|
CASE_DISPID(DISPID_AMBIENT_PALETTE);
|
|
|
|
CASE_DISPID(DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
|
|
|
|
CASE_DISPID(DISPID_AMBIENT_SILENT);
|
|
|
|
}
|
|
|
|
#undef CASE_DISPID
|
|
|
|
|
|
|
|
sprintf(buf, "%d", dispid);
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
2006-01-26 12:30:04 +00:00
|
|
|
static HRESULT WINAPI ClDispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
|
2006-02-15 10:53:31 +00:00
|
|
|
LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
2006-01-26 12:30:04 +00:00
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IDispatch(iface);
|
2007-03-09 15:49:21 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s %s %d %04x %p %p %p %p)\n", This, debugstr_dispid(dispIdMember),
|
|
|
|
debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
|
|
|
|
switch(dispIdMember) {
|
2007-03-09 15:50:01 +00:00
|
|
|
case DISPID_AMBIENT_USERMODE:
|
|
|
|
case DISPID_AMBIENT_DLCONTROL:
|
|
|
|
case DISPID_AMBIENT_USERAGENT:
|
|
|
|
case DISPID_AMBIENT_PALETTE:
|
|
|
|
if(!This->client_disp)
|
|
|
|
return E_FAIL;
|
|
|
|
return IDispatch_Invoke(This->client_disp, dispIdMember, riid, lcid, wFlags,
|
|
|
|
pDispParams, pVarResult, pExcepInfo, puArgErr);
|
2007-03-09 15:49:21 +00:00
|
|
|
case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
|
|
|
|
V_VT(pVarResult) = VT_BOOL;
|
|
|
|
V_BOOL(pVarResult) = This->offline;
|
|
|
|
return S_OK;
|
|
|
|
case DISPID_AMBIENT_SILENT:
|
|
|
|
V_VT(pVarResult) = VT_BOOL;
|
|
|
|
V_BOOL(pVarResult) = This->offline;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
FIXME("unhandled dispid %d\n", dispIdMember);
|
2006-01-26 12:30:04 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IDispatchVtbl DispatchVtbl = {
|
|
|
|
ClDispatch_QueryInterface,
|
|
|
|
ClDispatch_AddRef,
|
|
|
|
ClDispatch_Release,
|
|
|
|
ClDispatch_GetTypeInfoCount,
|
|
|
|
ClDispatch_GetTypeInfo,
|
|
|
|
ClDispatch_GetIDsOfNames,
|
|
|
|
ClDispatch_Invoke
|
|
|
|
};
|
|
|
|
|
2010-11-13 16:48:09 +00:00
|
|
|
static inline DocHost *impl_from_IServiceProvider(IServiceProvider *iface)
|
|
|
|
{
|
|
|
|
return (DocHost*)((char*)iface - FIELD_OFFSET(DocHost, IServiceProvider_iface));
|
|
|
|
}
|
2006-02-15 10:53:31 +00:00
|
|
|
|
|
|
|
static HRESULT WINAPI ClServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid,
|
|
|
|
void **ppv)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IServiceProvider(iface);
|
2010-11-13 16:47:58 +00:00
|
|
|
return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
|
2006-02-15 10:53:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClServiceProvider_AddRef(IServiceProvider *iface)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IServiceProvider(iface);
|
2010-11-13 16:47:58 +00:00
|
|
|
return IOleClientSite_AddRef(&This->IOleClientSite_iface);
|
2006-02-15 10:53:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClServiceProvider_Release(IServiceProvider *iface)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IServiceProvider(iface);
|
2010-11-13 16:47:58 +00:00
|
|
|
return IOleClientSite_Release(&This->IOleClientSite_iface);
|
2006-02-15 10:53:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2010-11-13 16:48:09 +00:00
|
|
|
DocHost *This = impl_from_IServiceProvider(iface);
|
2006-02-15 10:53:31 +00:00
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IHlinkFrame, guidService)) {
|
|
|
|
TRACE("(%p)->(IID_IHlinkFrame %s %p)\n", This, debugstr_guid(riid), ppv);
|
2006-04-17 22:35:16 +00:00
|
|
|
return IDispatch_QueryInterface(This->disp, riid, ppv);
|
2006-02-15 10:53:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IServiceProviderVtbl ServiceProviderVtbl = {
|
|
|
|
ClServiceProvider_QueryInterface,
|
|
|
|
ClServiceProvider_AddRef,
|
|
|
|
ClServiceProvider_Release,
|
|
|
|
ClServiceProvider_QueryService
|
|
|
|
};
|
|
|
|
|
2006-04-17 22:38:06 +00:00
|
|
|
void DocHost_ClientSite_Init(DocHost *This)
|
2005-11-15 12:03:25 +00:00
|
|
|
{
|
2010-11-13 16:47:58 +00:00
|
|
|
This->IOleClientSite_iface.lpVtbl = &OleClientSiteVtbl;
|
2010-11-13 16:48:09 +00:00
|
|
|
This->IOleInPlaceSite_iface.lpVtbl = &OleInPlaceSiteVtbl;
|
|
|
|
This->IOleDocumentSite_iface.lpVtbl = &OleDocumentSiteVtbl;
|
|
|
|
This->IDispatch_iface.lpVtbl = &DispatchVtbl;
|
|
|
|
This->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
|
2005-11-28 10:24:49 +00:00
|
|
|
}
|
|
|
|
|
2006-04-17 22:41:43 +00:00
|
|
|
void DocHost_ClientSite_Release(DocHost *This)
|
2005-11-28 10:24:49 +00:00
|
|
|
{
|
2006-04-17 22:41:43 +00:00
|
|
|
if(This->view)
|
|
|
|
IOleDocumentView_Release(This->view);
|
2005-11-15 12:03:25 +00:00
|
|
|
}
|