- Added stub implementation of IOleCommandTarget.

- Store IDocHostUIHandler in HTMLDocument.
- ActivateMe should be called even if GetContainer failed.
This commit is contained in:
Jacek Caban 2005-07-12 17:00:58 +00:00 committed by Alexandre Julliard
parent 1e6fe17958
commit 4f619626b8
8 changed files with 72 additions and 4 deletions

View File

@ -30,7 +30,7 @@
#include "docobj.h"
#include "mshtml.h"
#include "mshtmdid.h"
#include "mshtmhst.h"
#include "wine/debug.h"
@ -97,6 +97,9 @@ static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID
}else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
TRACE("(%p)->(IID_IServiceProvider, %p)\n", This, ppvObject);
*ppvObject = SERVPROV(This);
}else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
TRACE("(%p)->(IID_IOleCommandTarget, %p)\n", This, ppvObject);
*ppvObject = CMDTARGET(This);
}
if(*ppvObject) {
@ -126,6 +129,8 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
if(!ref) {
if(This->client)
IOleClientSite_Release(This->client);
if(This->hostui)
IDocHostUIHandler_Release(This->hostui);
if(This->ipsite)
IOleInPlaceSite_Release(This->ipsite);
if(This->frame)

View File

@ -28,10 +28,12 @@ typedef struct {
const IViewObject2Vtbl *lpViewObject2Vtbl;
const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
const IServiceProviderVtbl *lpServiceProviderVtbl;
const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
LONG ref;
IOleClientSite *client;
IDocHostUIHandler *hostui;
IOleInPlaceSite *ipsite;
IOleInPlaceFrame *frame;
@ -53,6 +55,7 @@ typedef struct {
#define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
#define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
#define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
#define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
#define DEFINE_THIS(cls,ifc) cls* const This=(cls*)((char*)(iface)-offsetof(cls,lp ## ifc ## Vtbl));

View File

@ -65,7 +65,7 @@ static ULONG WINAPI OleObject_Release(IOleObject *iface)
static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite *pClientSite)
{
HTMLDocument *This = OLEOBJ_THIS(iface);
IDocHostUIHandler *pDocHostUIHandler;
IDocHostUIHandler *pDocHostUIHandler = NULL;
HRESULT hres;
TRACE("(%p)->(%p)\n", This, pClientSite);
@ -73,6 +73,9 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
if(This->client)
IOleClientSite_Release(This->client);
if(This->hostui)
IDocHostUIHandler_Release(This->hostui);
if(!pClientSite) {
This->client = NULL;
return S_OK;
@ -110,6 +113,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
IOleClientSite_AddRef(pClientSite);
This->client = pClientSite;
This->hostui = pDocHostUIHandler;
return S_OK;
}
@ -196,10 +200,10 @@ static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, LPMSG lpms
hres = IOleClientSite_GetContainer(pActiveSite, &pContainer);
if(SUCCEEDED(hres)) {
IOleContainer_LockContainer(pContainer, TRUE);
/* FIXME: Create new IOleDocumentView. See CreateView for more info. */
hres = IOleDocumentSite_ActivateMe(pDocSite, DOCVIEW(This));
IOleContainer_Release(pContainer);
}
/* FIXME: Create new IOleDocumentView. See CreateView for more info. */
hres = IOleDocumentSite_ActivateMe(pDocSite, DOCVIEW(This));
IOleDocumentSite_Release(pDocSite);
}else {
hres = IOleDocumentView_UIActivate(DOCVIEW(This), TRUE);
@ -417,10 +421,61 @@ static const IOleDocumentVtbl OleDocumentVtbl = {
OleDocument_EnumViews
};
/**********************************************************
* IOleCommandTarget implementation
*/
#define CMDTARGET_THIS(iface) (HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpOleCommandTargetVtbl))
static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface, REFIID riid, void **ppv)
{
HTMLDocument *This = CMDTARGET_THIS(iface);
return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
}
static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface)
{
HTMLDocument *This = CMDTARGET_THIS(iface);
return IHTMLDocument2_AddRef(HTMLDOC(This));
}
static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface)
{
HTMLDocument *This = CMDTARGET_THIS(iface);
return IHTMLDocument_Release(HTMLDOC(This));
}
static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
{
HTMLDocument *This = CMDTARGET_THIS(iface);
FIXME("(%p)->(%s %ld %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
return E_NOTIMPL;
}
static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
{
HTMLDocument *This = CMDTARGET_THIS(iface);
FIXME("(%p)->(%s %ld %ld %p %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt,
pvaIn, pvaOut);
return E_NOTIMPL;
}
static const IOleCommandTargetVtbl OleCommandTargetVtbl = {
OleCommandTarget_QueryInterface,
OleCommandTarget_AddRef,
OleCommandTarget_Release,
OleCommandTarget_QueryStatus,
OleCommandTarget_Exec
};
void HTMLDocument_OleObj_Init(HTMLDocument *This)
{
This->lpOleObjectVtbl = &OleObjectVtbl;
This->lpOleDocumentVtbl = &OleDocumentVtbl;
This->lpOleCommandTargetVtbl = &OleCommandTargetVtbl;
This->client = NULL;
This->hostui = NULL;
}

View File

@ -30,6 +30,7 @@
#include "docobj.h"
#include "mshtml.h"
#include "mshtmhst.h"
#include "wine/debug.h"

View File

@ -30,6 +30,7 @@
#include "docobj.h"
#include "mshtml.h"
#include "mshtmhst.h"
#include "wine/debug.h"

View File

@ -30,6 +30,7 @@
#include "docobj.h"
#include "mshtml.h"
#include "mshtmhst.h"
#include "wine/debug.h"
#include "wine/unicode.h"

View File

@ -30,6 +30,7 @@
#include "docobj.h"
#include "mshtml.h"
#include "mshtmhst.h"
#include "wine/debug.h"

View File

@ -31,6 +31,7 @@
#include "docobj.h"
#include "mshtml.h"
#include "mshtmhst.h"
#include "wine/debug.h"