wine/dlls/shdocvw webbrowser.c shdocvw.h oleob ...

Alexandre Julliard julliard at wine.codeweavers.com
Wed Nov 16 05:46:57 CST 2005


ChangeSet ID:	21298
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/16 05:46:56

Modified files:
	dlls/shdocvw   : webbrowser.c shdocvw.h oleobject.c 

Log message:
	Jacek Caban <jacek at codeweavers.com>
	Added OLEIVERB_INPLACEACTIVATE implementation in IOleObject::DoVerb.

Patch: http://cvs.winehq.org/patch.py?id=21298

Old revision  New revision  Changes     Path
 1.22          1.23          +2 -3       wine/dlls/shdocvw/webbrowser.c
 1.27          1.28          +13 -0      wine/dlls/shdocvw/shdocvw.h
 1.17          1.18          +70 -6      wine/dlls/shdocvw/oleobject.c

Index: wine/dlls/shdocvw/webbrowser.c
diff -u -p wine/dlls/shdocvw/webbrowser.c:1.22 wine/dlls/shdocvw/webbrowser.c:1.23
--- wine/dlls/shdocvw/webbrowser.c:1.22	16 Nov 2005 11:46:56 -0000
+++ wine/dlls/shdocvw/webbrowser.c	16 Nov 2005 11:46:56 -0000
@@ -121,12 +121,11 @@ static ULONG WINAPI WebBrowser_Release(I
     TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
-        if(This->client)
-            IOleClientSite_Release(This->client);
-
         if(This->document)
             IUnknown_Release(This->document);
 
+        WebBrowser_OleObject_Destroy(This);
+
         HeapFree(GetProcessHeap(), 0, This);
         SHDOCVW_UnlockModule();
     }
Index: wine/dlls/shdocvw/shdocvw.h
diff -u -p wine/dlls/shdocvw/shdocvw.h:1.27 wine/dlls/shdocvw/shdocvw.h:1.28
--- wine/dlls/shdocvw/shdocvw.h:1.27	16 Nov 2005 11:46:56 -0000
+++ wine/dlls/shdocvw/shdocvw.h	16 Nov 2005 11:46:56 -0000
@@ -81,6 +81,17 @@ typedef struct {
     IUnknown *document;
 
     IOleClientSite *client;
+    IOleContainer *container;
+
+    /* window context */
+
+    HWND iphwnd;
+    HWND frame_hwnd;
+    IOleInPlaceFrame *frame;
+    IOleInPlaceUIWindow *uiwindow;
+    RECT pos_rect;
+    RECT clip_rect;
+    OLEINPLACEFRAMEINFO frameinfo;
 } WebBrowser;
 
 #define WEBBROWSER(x)   ((IWebBrowser*)                 &(x)->lpWebBrowser2Vtbl)
@@ -108,6 +119,8 @@ void WebBrowser_Events_Init(WebBrowser*)
 
 void WebBrowser_ClientSite_Init(WebBrowser*);
 
+void WebBrowser_OleObject_Destroy(WebBrowser*);
+
 HRESULT WebBrowser_Create(IUnknown*,REFIID,void**);
 
 /**********************************************************************
Index: wine/dlls/shdocvw/oleobject.c
diff -u -p wine/dlls/shdocvw/oleobject.c:1.17 wine/dlls/shdocvw/oleobject.c:1.18
--- wine/dlls/shdocvw/oleobject.c:1.17	16 Nov 2005 11:46:56 -0000
+++ wine/dlls/shdocvw/oleobject.c	16 Nov 2005 11:46:56 -0000
@@ -138,15 +138,58 @@ static HRESULT WINAPI OleObject_DoVerb(I
         LPOLECLIENTSITE pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
 {
     WebBrowser *This = OLEOBJ_THIS(iface);
-    FIXME("(%p)->(%ld %p %p %ld %p %p)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent,
+    HRESULT hres;
+
+    TRACE("(%p)->(%ld %p %p %ld %p %p)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent,
             lprcPosRect);
+
     switch (iVerb)
     {
-    case OLEIVERB_INPLACEACTIVATE:
-        FIXME ("stub for OLEIVERB_INPLACEACTIVATE\n");
-        break;
-    case OLEIVERB_HIDE:
-        FIXME ("stub for OLEIVERB_HIDE\n");
+    case OLEIVERB_INPLACEACTIVATE: {
+        IOleInPlaceSite *inplace;
+
+        TRACE("OLEIVERB_INPLACEACTIVATE\n");
+
+        if(!pActiveSite)
+            return E_INVALIDARG;
+
+        hres = IOleClientSite_QueryInterface(pActiveSite, &IID_IOleInPlaceSite, (void**)&inplace);
+        if(FAILED(hres)) {
+            WARN("Could not get IOleInPlaceSite\n");
+            return hres;
+        }
+
+        hres = IOleInPlaceSite_CanInPlaceActivate(inplace);
+        if(hres != S_OK) {
+            WARN("CanInPlaceActivate returned: %08lx\n", hres);
+            IOleInPlaceSite_Release(inplace);
+            return E_FAIL;
+        }
+
+        hres = IOleInPlaceSite_GetWindow(inplace, &This->iphwnd);
+        if(FAILED(hres))
+            This->iphwnd = hwndParent;
+
+        IOleInPlaceSite_OnInPlaceActivate(inplace);
+
+        IOleInPlaceSite_GetWindowContext(inplace, &This->frame, &This->uiwindow,
+                                         &This->pos_rect, &This->clip_rect,
+                                         &This->frameinfo);
+
+        IOleInPlaceSite_Release(inplace);
+
+        if(This->client) {
+            IOleClientSite_ShowObject(This->client);
+            IOleClientSite_GetContainer(This->client, &This->container);
+        }
+
+        if(This->frame)
+            IOleInPlaceFrame_GetWindow(This->frame, &This->frame_hwnd);
+
+        return S_OK;
+    }
+    default:
+        FIXME("stub for %ld\n", iVerb);
         break;
     }
 
@@ -450,4 +493,25 @@ void WebBrowser_OleObject_Init(WebBrowse
     This->lpOleControlVtbl       = &OleControlVtbl;
 
     This->client = NULL;
+    This->container = NULL;
+    This->iphwnd = NULL;
+    This->frame_hwnd = NULL;
+    This->frame = NULL;
+    This->uiwindow = NULL;
+
+    memset(&This->pos_rect, 0, sizeof(RECT));
+    memset(&This->clip_rect, 0, sizeof(RECT));
+    memset(&This->frameinfo, 0, sizeof(OLEINPLACEFRAMEINFO));
+}
+
+void WebBrowser_OleObject_Destroy(WebBrowser *This)
+{
+    if(This->client)
+        IOleClientSite_Release(This->client);
+    if(This->container)
+        IOleContainer_Release(This->container);
+    if(This->frame)
+        IOleInPlaceFrame_Release(This->frame);
+    if(This->uiwindow)
+        IOleInPlaceUIWindow_Release(This->uiwindow);
 }



More information about the wine-cvs mailing list