Jacek Caban : shdocvw: Added DocHost::Exec(OLECMDID_UPDATECOMMANDS) implementation.

Alexandre Julliard julliard at winehq.org
Fri Nov 12 11:22:38 CST 2010


Module: wine
Branch: master
Commit: f89ac6fa0d053bef5b7aa6f31fb8b87405ecc04b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f89ac6fa0d053bef5b7aa6f31fb8b87405ecc04b

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Nov 12 14:30:03 2010 +0100

shdocvw: Added DocHost::Exec(OLECMDID_UPDATECOMMANDS) implementation.

---

 dlls/shdocvw/dochost.c    |   10 ++++++++--
 dlls/shdocvw/iexplore.c   |    8 +++++++-
 dlls/shdocvw/shdocvw.h    |    1 +
 dlls/shdocvw/webbrowser.c |   37 ++++++++++++++++++++++++++++++++++++-
 4 files changed, 52 insertions(+), 4 deletions(-)

diff --git a/dlls/shdocvw/dochost.c b/dlls/shdocvw/dochost.c
index edf569e..f74d064 100644
--- a/dlls/shdocvw/dochost.c
+++ b/dlls/shdocvw/dochost.c
@@ -447,8 +447,14 @@ static HRESULT WINAPI ClOleCommandTarget_Exec(IOleCommandTarget *iface,
           nCmdexecopt, debugstr_variant(pvaIn), debugstr_variant(pvaOut));
 
     if(!pguidCmdGroup) {
-        FIXME("Unimplemented cmdid %d\n", nCmdID);
-        return E_NOTIMPL;
+        switch(nCmdID) {
+        case OLECMDID_UPDATECOMMANDS:
+            return This->container_vtbl->exec(This, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
+        default:
+            FIXME("Unimplemented cmdid %d\n", nCmdID);
+            return E_NOTIMPL;
+        }
+        return S_OK;
     }
 
     if(IsEqualGUID(pguidCmdGroup, &CGID_DocHostCmdPriv)) {
diff --git a/dlls/shdocvw/iexplore.c b/dlls/shdocvw/iexplore.c
index 3991f57..a0d2684 100644
--- a/dlls/shdocvw/iexplore.c
+++ b/dlls/shdocvw/iexplore.c
@@ -739,10 +739,16 @@ static void WINAPI DocHostContainer_SetURL(DocHost* This, LPCWSTR url)
     SendMessageW(This->frame_hwnd, WM_UPDATEADDRBAR, 0, (LPARAM)url);
 }
 
+static HRESULT DocHostContainer_exec(DocHost* This, const GUID *cmd_group, DWORD cmdid, DWORD execopt, VARIANT *in,
+        VARIANT *out)
+{
+    return S_OK;
+}
 static const IDocHostContainerVtbl DocHostContainerVtbl = {
     DocHostContainer_GetDocObjRect,
     DocHostContainer_SetStatusText,
-    DocHostContainer_SetURL
+    DocHostContainer_SetURL,
+    DocHostContainer_exec
 };
 
 HRESULT InternetExplorer_Create(IUnknown *pOuter, REFIID riid, void **ppv)
diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h
index 4f3425d..61dc63f 100644
--- a/dlls/shdocvw/shdocvw.h
+++ b/dlls/shdocvw/shdocvw.h
@@ -89,6 +89,7 @@ typedef struct _IDocHostContainerVtbl
     void (WINAPI* GetDocObjRect)(DocHost*,RECT*);
     HRESULT (WINAPI* SetStatusText)(DocHost*,LPCWSTR);
     void (WINAPI* SetURL)(DocHost*,LPCWSTR);
+    HRESULT (*exec)(DocHost*,const GUID*,DWORD,DWORD,VARIANT*,VARIANT*);
 } IDocHostContainerVtbl;
 
 struct DocHost {
diff --git a/dlls/shdocvw/webbrowser.c b/dlls/shdocvw/webbrowser.c
index ef46236..ac45d85 100644
--- a/dlls/shdocvw/webbrowser.c
+++ b/dlls/shdocvw/webbrowser.c
@@ -1135,6 +1135,8 @@ static const IServiceProviderVtbl ServiceProviderVtbl =
     WebBrowser_IServiceProvider_QueryService
 };
 
+#define DOCHOST_THIS(iface) DEFINE_THIS2(WebBrowser,doc_host,iface)
+
 static void WINAPI DocHostContainer_GetDocObjRect(DocHost* This, RECT* rc)
 {
     GetClientRect(This->frame_hwnd, rc);
@@ -1150,10 +1152,43 @@ static void WINAPI DocHostContainer_SetURL(DocHost* This, LPCWSTR url)
 
 }
 
+static HRESULT DocHostContainer_exec(DocHost *doc_host, const GUID *cmd_group, DWORD cmdid, DWORD execopt, VARIANT *in,
+        VARIANT *out)
+{
+    WebBrowser *This = DOCHOST_THIS(doc_host);
+    IOleCommandTarget *cmdtrg = NULL;
+    HRESULT hres;
+
+    if(This->client) {
+        hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&cmdtrg);
+        if(FAILED(hres))
+            cmdtrg = NULL;
+    }
+
+    if(!cmdtrg && This->container) {
+        hres = IOleContainer_QueryInterface(This->container, &IID_IOleCommandTarget, (void**)&cmdtrg);
+        if(FAILED(hres))
+            cmdtrg = NULL;
+    }
+
+    if(!cmdtrg)
+        return S_OK;
+
+    hres = IOleCommandTarget_Exec(cmdtrg, cmd_group, cmdid, execopt, in, out);
+    IOleCommandTarget_Release(cmdtrg);
+    if(FAILED(hres))
+        FIXME("Exec failed\n");
+
+    return hres;
+}
+
+#undef DOCHOST_THIS
+
 static const IDocHostContainerVtbl DocHostContainerVtbl = {
     DocHostContainer_GetDocObjRect,
     DocHostContainer_SetStatusText,
-    DocHostContainer_SetURL
+    DocHostContainer_SetURL,
+    DocHostContainer_exec
 };
 
 static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, void **ppv)




More information about the wine-cvs mailing list