Jacek Caban : shdocvw: Store IOleInPlaceSite in WebBrowser object.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Apr 14 12:46:31 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 80dcc8b813b3fa0eea1fa038245e911aa5bf53b2
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=80dcc8b813b3fa0eea1fa038245e911aa5bf53b2

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Apr 14 14:42:14 2006 +0200

shdocvw: Store IOleInPlaceSite in WebBrowser object.

---

 dlls/shdocvw/oleobject.c |   34 +++++++++++++++++++++-------------
 dlls/shdocvw/shdocvw.h   |    1 +
 2 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/dlls/shdocvw/oleobject.c b/dlls/shdocvw/oleobject.c
index 2ab2d8d..217c549 100644
--- a/dlls/shdocvw/oleobject.c
+++ b/dlls/shdocvw/oleobject.c
@@ -142,6 +142,11 @@ static HRESULT WINAPI OleObject_SetClien
         This->shell_embedding_hwnd = NULL;
     }
 
+    if(This->inplace) {
+        IOleInPlaceSite_Release(This->inplace);
+        This->inplace = NULL;
+    }
+
     if(This->hostui)
         IDocHostUIHandler_Release(This->hostui);
     if(This->client)
@@ -243,40 +248,43 @@ static HRESULT WINAPI OleObject_DoVerb(I
     switch (iVerb)
     {
     case OLEIVERB_SHOW:
-    case OLEIVERB_INPLACEACTIVATE: {
-        IOleInPlaceSite *inplace;
-
+    case OLEIVERB_INPLACEACTIVATE:
         TRACE("OLEIVERB_INPLACEACTIVATE\n");
 
         if(!pActiveSite)
             return E_INVALIDARG;
 
-        hres = IOleClientSite_QueryInterface(pActiveSite, &IID_IOleInPlaceSite, (void**)&inplace);
+        if(This->inplace) {
+            IOleInPlaceSite_Release(This->inplace);
+            This->inplace = NULL;
+        }
+
+        hres = IOleClientSite_QueryInterface(pActiveSite, &IID_IOleInPlaceSite, (void**)&This->inplace);
         if(FAILED(hres)) {
             WARN("Could not get IOleInPlaceSite\n");
             return hres;
         }
 
-        hres = IOleInPlaceSite_CanInPlaceActivate(inplace);
+        hres = IOleInPlaceSite_CanInPlaceActivate(This->inplace);
         if(hres != S_OK) {
             WARN("CanInPlaceActivate returned: %08lx\n", hres);
-            IOleInPlaceSite_Release(inplace);
+            IOleInPlaceSite_Release(This->inplace);
             return E_FAIL;
         }
 
-        hres = IOleInPlaceSite_GetWindow(inplace, &This->iphwnd);
+        hres = IOleInPlaceSite_GetWindow(This->inplace, &This->iphwnd);
         if(FAILED(hres))
             This->iphwnd = hwndParent;
 
-        IOleInPlaceSite_OnInPlaceActivate(inplace);
+        IOleInPlaceSite_OnInPlaceActivate(This->inplace);
 
-        IOleInPlaceSite_GetWindowContext(inplace, &This->frame, &This->uiwindow,
+        IOleInPlaceSite_GetWindowContext(This->inplace, &This->frame, &This->uiwindow,
                                          &This->pos_rect, &This->clip_rect,
                                          &This->frameinfo);
 
 
         if(iVerb == OLEIVERB_INPLACEACTIVATE)
-            IOleInPlaceSite_Release(inplace);
+            IOleInPlaceSite_Release(This->inplace);
 
         SetWindowPos(This->shell_embedding_hwnd, NULL,
                      This->pos_rect.left, This->pos_rect.top,
@@ -297,8 +305,8 @@ static HRESULT WINAPI OleObject_DoVerb(I
 
         TRACE("OLEIVERB_SHOW\n");
 
-        IOleInPlaceSite_OnUIActivate(inplace);
-        IOleInPlaceSite_Release(inplace);
+        IOleInPlaceSite_OnUIActivate(This->inplace);
+        IOleInPlaceSite_Release(This->inplace);
 
         if(This->frame)
             IOleInPlaceFrame_SetActiveObject(This->frame, ACTIVEOBJ(This), wszitem);
@@ -310,7 +318,6 @@ static HRESULT WINAPI OleObject_DoVerb(I
          */
 
         return S_OK;
-    }
     default:
         FIXME("stub for %ld\n", iVerb);
         break;
@@ -760,6 +767,7 @@ void WebBrowser_OleObject_Init(WebBrowse
     This->lpWBOleCommandTargetVtbl     = &OleCommandTargetVtbl;
 
     This->client = NULL;
+    This->inplace = NULL;
     This->container = NULL;
     This->iphwnd = NULL;
     This->frame_hwnd = NULL;
diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h
index b1b436b..d6fcf35 100644
--- a/dlls/shdocvw/shdocvw.h
+++ b/dlls/shdocvw/shdocvw.h
@@ -89,6 +89,7 @@ typedef struct {
     IOleContainer *container;
     IOleDocumentView *view;
     IDocHostUIHandler *hostui;
+    IOleInPlaceSite *inplace;
 
     LPOLESTR url;
 




More information about the wine-cvs mailing list