2005-11-15 13:03:25 +01: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 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-11-15 13:03:25 +01:00
|
|
|
*/
|
|
|
|
|
2007-03-09 16:49:21 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2005-11-15 13:03:25 +01:00
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "shdocvw.h"
|
2007-03-09 16:49:21 +01:00
|
|
|
#include "mshtmdid.h"
|
|
|
|
#include "idispids.h"
|
2005-11-15 13:03:25 +01:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
|
|
|
|
|
2006-04-18 00:24:59 +02:00
|
|
|
#define CLIENTSITE_THIS(iface) DEFINE_THIS(DocHost, OleClientSite, iface)
|
2005-11-15 13:03:25 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2006-04-18 00:24:59 +02:00
|
|
|
DocHost *This = CLIENTSITE_THIS(iface);
|
2005-11-15 13:03:25 +01:00
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
|
|
|
|
*ppv = CLIENTSITE(This);
|
|
|
|
}else if(IsEqualGUID(&IID_IOleClientSite, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleClientSite %p)\n", This, ppv);
|
|
|
|
*ppv = CLIENTSITE(This);
|
2005-11-16 12:21:00 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IOleWindow, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
|
2006-04-18 00:26:47 +02:00
|
|
|
*ppv = INPLACESITE(This);
|
2005-11-16 12:21:00 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IOleInPlaceSite, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleInPlaceSite %p)\n", This, ppv);
|
2006-04-18 00:26:47 +02:00
|
|
|
*ppv = INPLACESITE(This);
|
2005-11-17 12:03:53 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IDocHostUIHandler, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IDocHostUIHandler %p)\n", This, ppv);
|
2006-04-18 00:28:37 +02:00
|
|
|
*ppv = DOCHOSTUI(This);
|
2005-11-17 12:03:53 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IDocHostUIHandler2, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IDocHostUIHandler2 %p)\n", This, ppv);
|
2006-04-18 00:28:37 +02:00
|
|
|
*ppv = DOCHOSTUI2(This);
|
2005-12-01 11:11:14 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IOleDocumentSite, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleDocumentSite %p)\n", This, ppv);
|
2006-04-18 00:31:22 +02:00
|
|
|
*ppv = DOCSITE(This);
|
2006-04-18 00:24:59 +02:00
|
|
|
}else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This, ppv);
|
2006-05-17 18:28:13 +02:00
|
|
|
*ppv = OLECMD(This);
|
2006-01-26 13:30:04 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
|
2006-04-18 00:34:21 +02:00
|
|
|
*ppv = CLDISP(This);
|
2009-08-30 01:00:06 +02:00
|
|
|
}else if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IPropertyNotifySink %p)\n", This, ppv);
|
|
|
|
*ppv = PROPNOTIF(This);
|
2006-02-15 11:53:31 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
|
2006-04-18 00:35:16 +02:00
|
|
|
*ppv = SERVPROV(This);
|
2005-11-15 13:03:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(*ppv) {
|
2006-04-18 00:24:59 +02:00
|
|
|
IOleClientSite_AddRef(CLIENTSITE(This));
|
2005-11-15 13:03:25 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-02-28 19:59:30 +01:00
|
|
|
WARN("Unsupported interface %s\n", debugstr_guid(riid));
|
2005-11-15 13:03:25 +01:00
|
|
|
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
|
|
|
|
{
|
2006-04-18 00:24:59 +02:00
|
|
|
DocHost *This = CLIENTSITE_THIS(iface);
|
|
|
|
return IDispatch_AddRef(This->disp);
|
2005-11-15 13:03:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
|
|
|
|
{
|
2006-04-18 00:24:59 +02:00
|
|
|
DocHost *This = CLIENTSITE_THIS(iface);
|
|
|
|
return IDispatch_Release(This->disp);
|
2005-11-15 13:03:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
|
|
|
|
{
|
2006-04-18 00:24:59 +02:00
|
|
|
DocHost *This = CLIENTSITE_THIS(iface);
|
2005-11-15 13:03:25 +01:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign,
|
|
|
|
DWORD dwWhichMoniker, IMoniker **ppmk)
|
|
|
|
{
|
2006-04-18 00:24:59 +02:00
|
|
|
DocHost *This = CLIENTSITE_THIS(iface);
|
2006-10-05 23:49:39 +02:00
|
|
|
FIXME("(%p)->(%d %d %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
|
2005-11-15 13:03:25 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
|
|
|
|
{
|
2006-04-18 00:24:59 +02:00
|
|
|
DocHost *This = CLIENTSITE_THIS(iface);
|
2005-11-15 13:03:25 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, ppContainer);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
|
|
|
|
{
|
2006-04-18 00:24:59 +02:00
|
|
|
DocHost *This = CLIENTSITE_THIS(iface);
|
2005-11-15 13:03:25 +01:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
|
|
|
|
{
|
2006-04-18 00:24:59 +02:00
|
|
|
DocHost *This = CLIENTSITE_THIS(iface);
|
2005-11-15 13:03:25 +01:00
|
|
|
FIXME("(%p)->(%x)\n", This, fShow);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
|
|
|
|
{
|
2006-04-18 00:24:59 +02:00
|
|
|
DocHost *This = CLIENTSITE_THIS(iface);
|
2005-11-15 13:03:25 +01:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef CLIENTSITE_THIS
|
|
|
|
|
|
|
|
static const IOleClientSiteVtbl OleClientSiteVtbl = {
|
|
|
|
ClientSite_QueryInterface,
|
|
|
|
ClientSite_AddRef,
|
|
|
|
ClientSite_Release,
|
|
|
|
ClientSite_SaveObject,
|
|
|
|
ClientSite_GetMoniker,
|
|
|
|
ClientSite_GetContainer,
|
|
|
|
ClientSite_ShowObject,
|
|
|
|
ClientSite_OnShowWindow,
|
|
|
|
ClientSite_RequestNewObjectLayout
|
|
|
|
};
|
|
|
|
|
2006-04-18 00:26:47 +02:00
|
|
|
#define INPLACESITE_THIS(iface) DEFINE_THIS(DocHost, OleInPlaceSite, iface)
|
2005-11-16 12:21:00 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_QueryInterface(IOleInPlaceSite *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2006-04-18 00:26:47 +02:00
|
|
|
DocHost *This = INPLACESITE_THIS(iface);
|
|
|
|
return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppv);
|
2005-11-16 12:21:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InPlaceSite_AddRef(IOleInPlaceSite *iface)
|
|
|
|
{
|
2006-04-18 00:26:47 +02:00
|
|
|
DocHost *This = INPLACESITE_THIS(iface);
|
|
|
|
return IOleClientSite_AddRef(CLIENTSITE(This));
|
2005-11-16 12:21:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InPlaceSite_Release(IOleInPlaceSite *iface)
|
|
|
|
{
|
2006-04-18 00:26:47 +02:00
|
|
|
DocHost *This = INPLACESITE_THIS(iface);
|
|
|
|
return IOleClientSite_Release(CLIENTSITE(This));
|
2005-11-16 12:21:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_GetWindow(IOleInPlaceSite *iface, HWND *phwnd)
|
|
|
|
{
|
2006-04-18 00:26:47 +02:00
|
|
|
DocHost *This = INPLACESITE_THIS(iface);
|
2005-11-22 12:59:57 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, phwnd);
|
|
|
|
|
2006-04-18 00:26:47 +02:00
|
|
|
*phwnd = This->hwnd;
|
2005-11-22 12:59:57 +01:00
|
|
|
return S_OK;
|
2005-11-16 12:21:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_ContextSensitiveHelp(IOleInPlaceSite *iface, BOOL fEnterMode)
|
|
|
|
{
|
2006-04-18 00:26:47 +02:00
|
|
|
DocHost *This = INPLACESITE_THIS(iface);
|
2005-11-16 12:21:00 +01:00
|
|
|
FIXME("(%p)->(%x)\n", This, fEnterMode);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_CanInPlaceActivate(IOleInPlaceSite *iface)
|
|
|
|
{
|
2006-04-18 00:26:47 +02:00
|
|
|
DocHost *This = INPLACESITE_THIS(iface);
|
2005-12-01 11:11:14 +01:00
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
/* Nothing to do here */
|
|
|
|
return S_OK;
|
2005-11-16 12:21:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_OnInPlaceActivate(IOleInPlaceSite *iface)
|
|
|
|
{
|
2006-04-18 00:26:47 +02:00
|
|
|
DocHost *This = INPLACESITE_THIS(iface);
|
2005-12-01 11:11:14 +01:00
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
/* Nothing to do here */
|
|
|
|
return S_OK;
|
2005-11-16 12:21:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_OnUIActivate(IOleInPlaceSite *iface)
|
|
|
|
{
|
2006-04-18 00:26:47 +02:00
|
|
|
DocHost *This = INPLACESITE_THIS(iface);
|
2005-11-16 12:21:00 +01: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)
|
|
|
|
{
|
2006-04-18 00:26:47 +02:00
|
|
|
DocHost *This = INPLACESITE_THIS(iface);
|
2005-11-28 11:01:17 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p %p %p %p %p)\n", This, ppFrame, ppDoc, lprcPosRect,
|
2005-11-16 12:21:00 +01:00
|
|
|
lprcClipRect, lpFrameInfo);
|
2005-11-28 11:01:17 +01:00
|
|
|
|
2006-04-18 00:36:09 +02:00
|
|
|
IOleInPlaceFrame_AddRef(INPLACEFRAME(This));
|
|
|
|
*ppFrame = INPLACEFRAME(This);
|
2005-11-28 11:01:17 +01:00
|
|
|
*ppDoc = NULL;
|
2005-12-01 11:11:14 +01:00
|
|
|
|
2006-04-18 00:26:47 +02:00
|
|
|
GetClientRect(This->hwnd, lprcPosRect);
|
2008-03-17 22:36:56 +01:00
|
|
|
*lprcClipRect = *lprcPosRect;
|
2005-11-28 11:01:17 +01:00
|
|
|
|
|
|
|
lpFrameInfo->cb = sizeof(*lpFrameInfo);
|
|
|
|
lpFrameInfo->fMDIApp = FALSE;
|
2006-04-18 00:26:47 +02:00
|
|
|
lpFrameInfo->hwndFrame = This->frame_hwnd;
|
2005-11-28 11:01:17 +01:00
|
|
|
lpFrameInfo->haccel = NULL;
|
|
|
|
lpFrameInfo->cAccelEntries = 0; /* FIXME: should be 5 */
|
|
|
|
|
|
|
|
return S_OK;
|
2005-11-16 12:21:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_Scroll(IOleInPlaceSite *iface, SIZE scrollExtent)
|
|
|
|
{
|
2006-04-18 00:26:47 +02:00
|
|
|
DocHost *This = INPLACESITE_THIS(iface);
|
2006-10-05 23:49:39 +02:00
|
|
|
FIXME("(%p)->({%d %d})\n", This, scrollExtent.cx, scrollExtent.cy);
|
2005-11-16 12:21:00 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_OnUIDeactivate(IOleInPlaceSite *iface, BOOL fUndoable)
|
|
|
|
{
|
2006-04-18 00:26:47 +02:00
|
|
|
DocHost *This = INPLACESITE_THIS(iface);
|
2005-11-16 12:21:00 +01:00
|
|
|
FIXME("(%p)->(%x)\n", This, fUndoable);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSite *iface)
|
|
|
|
{
|
2006-04-18 00:26:47 +02:00
|
|
|
DocHost *This = INPLACESITE_THIS(iface);
|
2006-05-18 22:43:01 +02:00
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
/* Nothing to do here */
|
|
|
|
return S_OK;
|
2005-11-16 12:21:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_DiscardUndoState(IOleInPlaceSite *iface)
|
|
|
|
{
|
2006-04-18 00:26:47 +02:00
|
|
|
DocHost *This = INPLACESITE_THIS(iface);
|
2005-11-16 12:21:00 +01:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_DeactivateAndUndo(IOleInPlaceSite *iface)
|
|
|
|
{
|
2006-04-18 00:26:47 +02:00
|
|
|
DocHost *This = INPLACESITE_THIS(iface);
|
2005-11-16 12:21:00 +01:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_OnPosRectChange(IOleInPlaceSite *iface,
|
|
|
|
LPCRECT lprcPosRect)
|
|
|
|
{
|
2006-04-18 00:26:47 +02:00
|
|
|
DocHost *This = INPLACESITE_THIS(iface);
|
2005-11-16 12:21:00 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, lprcPosRect);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef INPLACESITE_THIS
|
|
|
|
|
|
|
|
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
|
|
|
|
};
|
|
|
|
|
2006-04-18 00:31:22 +02:00
|
|
|
#define DOCSITE_THIS(iface) DEFINE_THIS(DocHost, OleDocumentSite, iface)
|
2005-11-28 11:24:49 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI OleDocumentSite_QueryInterface(IOleDocumentSite *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2006-04-18 00:31:22 +02:00
|
|
|
DocHost *This = DOCSITE_THIS(iface);
|
|
|
|
return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppv);
|
2005-11-28 11:24:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OleDocumentSite_AddRef(IOleDocumentSite *iface)
|
|
|
|
{
|
2006-04-18 00:31:22 +02:00
|
|
|
DocHost *This = DOCSITE_THIS(iface);
|
|
|
|
return IOleClientSite_AddRef(CLIENTSITE(This));
|
2005-11-28 11:24:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OleDocumentSite_Release(IOleDocumentSite *iface)
|
|
|
|
{
|
2006-04-18 00:31:22 +02:00
|
|
|
DocHost *This = DOCSITE_THIS(iface);
|
|
|
|
return IOleClientSite_Release(CLIENTSITE(This));
|
2005-11-28 11:24:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleDocumentSite_ActivateMe(IOleDocumentSite *iface,
|
|
|
|
IOleDocumentView *pViewToActivate)
|
|
|
|
{
|
2006-04-18 00:31:22 +02:00
|
|
|
DocHost *This = DOCSITE_THIS(iface);
|
2005-11-28 11:24:49 +01: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;
|
|
|
|
|
2006-04-18 00:31:22 +02:00
|
|
|
IOleDocument_CreateView(oledoc, INPLACESITE(This), NULL, 0, &This->view);
|
2005-11-28 11:24:49 +01:00
|
|
|
IOleDocument_Release(oledoc);
|
|
|
|
|
2006-04-18 00:31:22 +02:00
|
|
|
GetClientRect(This->hwnd, &rect);
|
2005-11-28 11:24:49 +01:00
|
|
|
IOleDocumentView_SetRect(This->view, &rect);
|
|
|
|
|
|
|
|
hres = IOleDocumentView_Show(This->view, TRUE);
|
|
|
|
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef DOCSITE_THIS
|
|
|
|
|
|
|
|
static const IOleDocumentSiteVtbl OleDocumentSiteVtbl = {
|
|
|
|
OleDocumentSite_QueryInterface,
|
|
|
|
OleDocumentSite_AddRef,
|
|
|
|
OleDocumentSite_Release,
|
|
|
|
OleDocumentSite_ActivateMe
|
|
|
|
};
|
|
|
|
|
2006-04-18 00:34:21 +02:00
|
|
|
#define DISP_THIS(iface) DEFINE_THIS(DocHost, Dispatch, iface)
|
2006-01-26 13:30:04 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI ClDispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2006-04-18 00:34:21 +02:00
|
|
|
DocHost *This = DISP_THIS(iface);
|
|
|
|
return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppv);
|
2006-01-26 13:30:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClDispatch_AddRef(IDispatch *iface)
|
|
|
|
{
|
2006-04-18 00:34:21 +02:00
|
|
|
DocHost *This = DISP_THIS(iface);
|
|
|
|
return IOleClientSite_AddRef(CLIENTSITE(This));
|
2006-01-26 13:30:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClDispatch_Release(IDispatch *iface)
|
|
|
|
{
|
2006-04-18 00:34:21 +02:00
|
|
|
DocHost *This = DISP_THIS(iface);
|
|
|
|
return IOleClientSite_Release(CLIENTSITE(This));
|
2006-01-26 13:30:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClDispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
|
|
|
|
{
|
2006-04-18 00:34:21 +02:00
|
|
|
DocHost *This = DISP_THIS(iface);
|
2006-02-20 11:13:51 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, pctinfo);
|
|
|
|
|
2006-01-26 13:30:04 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClDispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
|
2006-02-15 11:53:31 +01:00
|
|
|
ITypeInfo **ppTInfo)
|
2006-01-26 13:30:04 +01:00
|
|
|
{
|
2006-04-18 00:34:21 +02:00
|
|
|
DocHost *This = DISP_THIS(iface);
|
2006-02-20 11:13:51 +01:00
|
|
|
|
2006-10-05 23:49:39 +02:00
|
|
|
TRACE("(%p)->(%u %d %p)\n", This, iTInfo, lcid, ppTInfo);
|
2006-02-20 11:13:51 +01:00
|
|
|
|
2006-01-26 13:30:04 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClDispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
|
2006-02-15 11:53:31 +01:00
|
|
|
UINT cNames, LCID lcid, DISPID *rgDispId)
|
2006-01-26 13:30:04 +01:00
|
|
|
{
|
2006-04-18 00:34:21 +02:00
|
|
|
DocHost *This = DISP_THIS(iface);
|
2006-02-20 11:13:51 +01:00
|
|
|
|
2006-10-05 23:49:39 +02:00
|
|
|
TRACE("(%p)->(%s %p %u %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
|
2006-01-26 13:30:04 +01:00
|
|
|
lcid, rgDispId);
|
2006-02-20 11:13:51 +01:00
|
|
|
|
2006-01-26 13:30:04 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2007-03-09 16:49:21 +01: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 13:30:04 +01:00
|
|
|
static HRESULT WINAPI ClDispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
|
2006-02-15 11:53:31 +01:00
|
|
|
LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
2006-01-26 13:30:04 +01:00
|
|
|
{
|
2006-04-18 00:34:21 +02:00
|
|
|
DocHost *This = DISP_THIS(iface);
|
2007-03-09 16:49:21 +01: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 16:50:01 +01: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 16:49:21 +01: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 13:30:04 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef DISP_THIS
|
|
|
|
|
|
|
|
static const IDispatchVtbl DispatchVtbl = {
|
|
|
|
ClDispatch_QueryInterface,
|
|
|
|
ClDispatch_AddRef,
|
|
|
|
ClDispatch_Release,
|
|
|
|
ClDispatch_GetTypeInfoCount,
|
|
|
|
ClDispatch_GetTypeInfo,
|
|
|
|
ClDispatch_GetIDsOfNames,
|
|
|
|
ClDispatch_Invoke
|
|
|
|
};
|
|
|
|
|
2006-04-18 00:35:16 +02:00
|
|
|
#define SERVPROV_THIS(iface) DEFINE_THIS(DocHost, ServiceProvider, iface)
|
2006-02-15 11:53:31 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI ClServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid,
|
|
|
|
void **ppv)
|
|
|
|
{
|
2006-04-18 00:35:16 +02:00
|
|
|
DocHost *This = SERVPROV_THIS(iface);
|
|
|
|
return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppv);
|
2006-02-15 11:53:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClServiceProvider_AddRef(IServiceProvider *iface)
|
|
|
|
{
|
2006-04-18 00:35:16 +02:00
|
|
|
DocHost *This = SERVPROV_THIS(iface);
|
|
|
|
return IOleClientSite_AddRef(CLIENTSITE(This));
|
2006-02-15 11:53:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClServiceProvider_Release(IServiceProvider *iface)
|
|
|
|
{
|
2006-04-18 00:35:16 +02:00
|
|
|
DocHost *This = SERVPROV_THIS(iface);
|
|
|
|
return IOleClientSite_Release(CLIENTSITE(This));
|
2006-02-15 11:53:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2006-04-18 00:35:16 +02:00
|
|
|
DocHost *This = SERVPROV_THIS(iface);
|
2006-02-15 11:53:31 +01:00
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IHlinkFrame, guidService)) {
|
|
|
|
TRACE("(%p)->(IID_IHlinkFrame %s %p)\n", This, debugstr_guid(riid), ppv);
|
2006-04-18 00:35:16 +02:00
|
|
|
return IDispatch_QueryInterface(This->disp, riid, ppv);
|
2006-02-15 11:53:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef SERVPROV_THIS
|
|
|
|
|
|
|
|
static const IServiceProviderVtbl ServiceProviderVtbl = {
|
|
|
|
ClServiceProvider_QueryInterface,
|
|
|
|
ClServiceProvider_AddRef,
|
|
|
|
ClServiceProvider_Release,
|
|
|
|
ClServiceProvider_QueryService
|
|
|
|
};
|
|
|
|
|
2006-04-18 00:38:06 +02:00
|
|
|
void DocHost_ClientSite_Init(DocHost *This)
|
2005-11-15 13:03:25 +01:00
|
|
|
{
|
2006-04-18 00:38:06 +02:00
|
|
|
This->lpOleClientSiteVtbl = &OleClientSiteVtbl;
|
|
|
|
This->lpOleInPlaceSiteVtbl = &OleInPlaceSiteVtbl;
|
|
|
|
This->lpOleDocumentSiteVtbl = &OleDocumentSiteVtbl;
|
|
|
|
This->lpDispatchVtbl = &DispatchVtbl;
|
|
|
|
This->lpServiceProviderVtbl = &ServiceProviderVtbl;
|
2005-11-28 11:24:49 +01:00
|
|
|
|
2006-04-18 00:38:06 +02:00
|
|
|
This->view = NULL;
|
2005-11-28 11:24:49 +01:00
|
|
|
}
|
|
|
|
|
2006-04-18 00:41:43 +02:00
|
|
|
void DocHost_ClientSite_Release(DocHost *This)
|
2005-11-28 11:24:49 +01:00
|
|
|
{
|
2006-04-18 00:41:43 +02:00
|
|
|
if(This->view)
|
|
|
|
IOleDocumentView_Release(This->view);
|
2005-11-15 13:03:25 +01:00
|
|
|
}
|