From 4f619626b837af340e8115893d1f556ea8e5df81 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 12 Jul 2005 17:00:58 +0000 Subject: [PATCH] - Added stub implementation of IOleCommandTarget. - Store IDocHostUIHandler in HTMLDocument. - ActivateMe should be called even if GetContainer failed. --- dlls/mshtml/htmldoc.c | 7 ++++- dlls/mshtml/mshtml_private.h | 3 ++ dlls/mshtml/oleobj.c | 61 ++++++++++++++++++++++++++++++++++-- dlls/mshtml/olewnd.c | 1 + dlls/mshtml/persist.c | 1 + dlls/mshtml/protocol.c | 1 + dlls/mshtml/service.c | 1 + dlls/mshtml/view.c | 1 + 8 files changed, 72 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 873b4f35945..08ecb406919 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -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) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 925dc9783c0..9809b76221d 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -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)); diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c index e71c51f8562..1a00130c062 100644 --- a/dlls/mshtml/oleobj.c +++ b/dlls/mshtml/oleobj.c @@ -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; } diff --git a/dlls/mshtml/olewnd.c b/dlls/mshtml/olewnd.c index f4d0733fce7..63bbc84b711 100644 --- a/dlls/mshtml/olewnd.c +++ b/dlls/mshtml/olewnd.c @@ -30,6 +30,7 @@ #include "docobj.h" #include "mshtml.h" +#include "mshtmhst.h" #include "wine/debug.h" diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index 2f78fbcb0d7..eff8d5ba949 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -30,6 +30,7 @@ #include "docobj.h" #include "mshtml.h" +#include "mshtmhst.h" #include "wine/debug.h" diff --git a/dlls/mshtml/protocol.c b/dlls/mshtml/protocol.c index 78b9bfbc1c4..2a0312ea407 100644 --- a/dlls/mshtml/protocol.c +++ b/dlls/mshtml/protocol.c @@ -30,6 +30,7 @@ #include "docobj.h" #include "mshtml.h" +#include "mshtmhst.h" #include "wine/debug.h" #include "wine/unicode.h" diff --git a/dlls/mshtml/service.c b/dlls/mshtml/service.c index 8b331664500..56d8da9ceb6 100644 --- a/dlls/mshtml/service.c +++ b/dlls/mshtml/service.c @@ -30,6 +30,7 @@ #include "docobj.h" #include "mshtml.h" +#include "mshtmhst.h" #include "wine/debug.h" diff --git a/dlls/mshtml/view.c b/dlls/mshtml/view.c index 7385b27d318..0c657665bc4 100644 --- a/dlls/mshtml/view.c +++ b/dlls/mshtml/view.c @@ -31,6 +31,7 @@ #include "docobj.h" #include "mshtml.h" +#include "mshtmhst.h" #include "wine/debug.h"