MSHTML: Added implementation of IOleCommandTarget

Jacek Caban jack at itma.pwr.wroc.pl
Tue Jul 12 03:41:00 CDT 2005


Changelog:
    - Added stub implementation of IOleCommandTarget
    - Store IDocHostUIHandler in HTMLDocument
    - ActivateMe should be called even if GetContainer failed
-------------- next part --------------
Index: dlls/mshtml/htmldoc.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/htmldoc.c,v
retrieving revision 1.10
diff -u -p -r1.10 htmldoc.c
--- dlls/mshtml/htmldoc.c	3 Jul 2005 11:22:23 -0000	1.10
+++ dlls/mshtml/htmldoc.c	12 Jul 2005 08:29:49 -0000
@@ -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_Query
     }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
     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)
Index: dlls/mshtml/mshtml_private.h
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/mshtml_private.h,v
retrieving revision 1.12
diff -u -p -r1.12 mshtml_private.h
--- dlls/mshtml/mshtml_private.h	6 Jul 2005 10:33:10 -0000	1.12
+++ dlls/mshtml/mshtml_private.h	12 Jul 2005 08:29:50 -0000
@@ -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));
 
Index: dlls/mshtml/oleobj.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/oleobj.c,v
retrieving revision 1.7
diff -u -p -r1.7 oleobj.c
--- dlls/mshtml/oleobj.c	11 Jul 2005 10:56:28 -0000	1.7
+++ dlls/mshtml/oleobj.c	12 Jul 2005 08:29:50 -0000
@@ -65,7 +65,7 @@ static ULONG WINAPI OleObject_Release(IO
 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_SetClien
     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_SetClien
 
     IOleClientSite_AddRef(pClientSite);
     This->client = pClientSite;
+    This->hostui = pDocHostUIHandler;
 
     return S_OK;
 }
@@ -196,10 +200,10 @@ static HRESULT WINAPI OleObject_DoVerb(I
         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 OleDocumen
     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;
 }
Index: dlls/mshtml/olewnd.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/olewnd.c,v
retrieving revision 1.1
diff -u -p -r1.1 olewnd.c
--- dlls/mshtml/olewnd.c	28 Jun 2005 10:53:42 -0000	1.1
+++ dlls/mshtml/olewnd.c	12 Jul 2005 08:29:50 -0000
@@ -30,6 +30,7 @@
 #include "docobj.h"
 
 #include "mshtml.h"
+#include "mshtmhst.h"
 
 #include "wine/debug.h"
 
Index: dlls/mshtml/persist.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/persist.c,v
retrieving revision 1.3
diff -u -p -r1.3 persist.c
--- dlls/mshtml/persist.c	1 Jun 2005 19:57:42 -0000	1.3
+++ dlls/mshtml/persist.c	12 Jul 2005 08:29:50 -0000
@@ -30,6 +30,7 @@
 #include "docobj.h"
 
 #include "mshtml.h"
+#include "mshtmhst.h"
 
 #include "wine/debug.h"
 
Index: dlls/mshtml/protocol.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/protocol.c,v
retrieving revision 1.4
diff -u -p -r1.4 protocol.c
--- dlls/mshtml/protocol.c	6 Jul 2005 10:33:10 -0000	1.4
+++ dlls/mshtml/protocol.c	12 Jul 2005 08:29:50 -0000
@@ -30,6 +30,7 @@
 #include "docobj.h"
 
 #include "mshtml.h"
+#include "mshtmhst.h"
 
 #include "wine/debug.h"
 #include "wine/unicode.h"
Index: dlls/mshtml/service.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/service.c,v
retrieving revision 1.1
diff -u -p -r1.1 service.c
--- dlls/mshtml/service.c	3 Jul 2005 11:22:23 -0000	1.1
+++ dlls/mshtml/service.c	12 Jul 2005 08:29:50 -0000
@@ -30,6 +30,7 @@
 #include "docobj.h"
 
 #include "mshtml.h"
+#include "mshtmhst.h"
 
 #include "wine/debug.h"
 
Index: dlls/mshtml/view.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/view.c,v
retrieving revision 1.6
diff -u -p -r1.6 view.c
--- dlls/mshtml/view.c	23 Jun 2005 16:44:43 -0000	1.6
+++ dlls/mshtml/view.c	12 Jul 2005 08:29:50 -0000
@@ -31,6 +31,7 @@
 #include "docobj.h"
 
 #include "mshtml.h"
+#include "mshtmhst.h"
 
 #include "wine/debug.h"
 


More information about the wine-patches mailing list