Jacek Caban : mshtml: Added ICustomDoc::SetUIHandler implementation.

Alexandre Julliard julliard at winehq.org
Mon Nov 29 13:38:34 CST 2010


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Nov 29 00:18:01 2010 +0100

mshtml: Added ICustomDoc::SetUIHandler implementation.

---

 dlls/mshtml/htmldoc.c        |   29 +++++++++++++++++++++++++++--
 dlls/mshtml/mshtml_private.h |    1 +
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index f0b7056..803ded3 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -2087,6 +2087,8 @@ static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
             IAdviseSink_Release(This->view_sink);
         if(This->client)
             IOleObject_SetClientSite(OLEOBJ(&This->basedoc), NULL);
+        if(This->hostui)
+            ICustomDoc_SetUIHandler(CUSTOMDOC(This), NULL);
         if(This->in_place_active)
             IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(&This->basedoc));
         if(This->ipsite)
@@ -2114,8 +2116,31 @@ static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
 static HRESULT WINAPI CustomDoc_SetUIHandler(ICustomDoc *iface, IDocHostUIHandler *pUIHandler)
 {
     HTMLDocumentObj *This = CUSTOMDOC_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, pUIHandler);
-    return E_NOTIMPL;
+    IOleCommandTarget *cmdtrg;
+    HRESULT hres;
+
+    TRACE("(%p)->(%p)\n", This, pUIHandler);
+
+    if(This->custom_hostui && This->hostui == pUIHandler)
+        return S_OK;
+
+    This->custom_hostui = TRUE;
+
+    if(This->hostui)
+        IDocHostUIHandler_Release(This->hostui);
+    if(pUIHandler)
+        IDocHostUIHandler_AddRef(pUIHandler);
+    This->hostui = pUIHandler;
+    if(!pUIHandler)
+        return S_OK;
+
+    hres = IDocHostUIHandler_QueryInterface(pUIHandler, &IID_IOleCommandTarget, (void**)&cmdtrg);
+    if(SUCCEEDED(hres)) {
+        FIXME("custom UI handler supports IOleCommandTarget\n");
+        IOleCommandTarget_Release(cmdtrg);
+    }
+
+    return S_OK;
 }
 
 #undef CUSTOMDOC_THIS
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 5af4247..a14ce01 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -411,6 +411,7 @@ struct HTMLDocumentObj {
 
     IOleClientSite *client;
     IDocHostUIHandler *hostui;
+    BOOL custom_hostui;
     IOleInPlaceSite *ipsite;
     IOleInPlaceFrame *frame;
     IOleInPlaceUIWindow *ip_window;




More information about the wine-cvs mailing list