shdocvw: Store IOleInPlaceSite in WebBrowser object.

This commit is contained in:
Jacek Caban 2006-04-14 14:42:14 +02:00 committed by Alexandre Julliard
parent 1e0f378c30
commit 80dcc8b813
2 changed files with 22 additions and 13 deletions

View File

@ -142,6 +142,11 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE
This->shell_embedding_hwnd = NULL; This->shell_embedding_hwnd = NULL;
} }
if(This->inplace) {
IOleInPlaceSite_Release(This->inplace);
This->inplace = NULL;
}
if(This->hostui) if(This->hostui)
IDocHostUIHandler_Release(This->hostui); IDocHostUIHandler_Release(This->hostui);
if(This->client) if(This->client)
@ -243,40 +248,43 @@ static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, struct tag
switch (iVerb) switch (iVerb)
{ {
case OLEIVERB_SHOW: case OLEIVERB_SHOW:
case OLEIVERB_INPLACEACTIVATE: { case OLEIVERB_INPLACEACTIVATE:
IOleInPlaceSite *inplace;
TRACE("OLEIVERB_INPLACEACTIVATE\n"); TRACE("OLEIVERB_INPLACEACTIVATE\n");
if(!pActiveSite) if(!pActiveSite)
return E_INVALIDARG; 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)) { if(FAILED(hres)) {
WARN("Could not get IOleInPlaceSite\n"); WARN("Could not get IOleInPlaceSite\n");
return hres; return hres;
} }
hres = IOleInPlaceSite_CanInPlaceActivate(inplace); hres = IOleInPlaceSite_CanInPlaceActivate(This->inplace);
if(hres != S_OK) { if(hres != S_OK) {
WARN("CanInPlaceActivate returned: %08lx\n", hres); WARN("CanInPlaceActivate returned: %08lx\n", hres);
IOleInPlaceSite_Release(inplace); IOleInPlaceSite_Release(This->inplace);
return E_FAIL; return E_FAIL;
} }
hres = IOleInPlaceSite_GetWindow(inplace, &This->iphwnd); hres = IOleInPlaceSite_GetWindow(This->inplace, &This->iphwnd);
if(FAILED(hres)) if(FAILED(hres))
This->iphwnd = hwndParent; 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->pos_rect, &This->clip_rect,
&This->frameinfo); &This->frameinfo);
if(iVerb == OLEIVERB_INPLACEACTIVATE) if(iVerb == OLEIVERB_INPLACEACTIVATE)
IOleInPlaceSite_Release(inplace); IOleInPlaceSite_Release(This->inplace);
SetWindowPos(This->shell_embedding_hwnd, NULL, SetWindowPos(This->shell_embedding_hwnd, NULL,
This->pos_rect.left, This->pos_rect.top, This->pos_rect.left, This->pos_rect.top,
@ -297,8 +305,8 @@ static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, struct tag
TRACE("OLEIVERB_SHOW\n"); TRACE("OLEIVERB_SHOW\n");
IOleInPlaceSite_OnUIActivate(inplace); IOleInPlaceSite_OnUIActivate(This->inplace);
IOleInPlaceSite_Release(inplace); IOleInPlaceSite_Release(This->inplace);
if(This->frame) if(This->frame)
IOleInPlaceFrame_SetActiveObject(This->frame, ACTIVEOBJ(This), wszitem); IOleInPlaceFrame_SetActiveObject(This->frame, ACTIVEOBJ(This), wszitem);
@ -310,7 +318,6 @@ static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, struct tag
*/ */
return S_OK; return S_OK;
}
default: default:
FIXME("stub for %ld\n", iVerb); FIXME("stub for %ld\n", iVerb);
break; break;
@ -760,6 +767,7 @@ void WebBrowser_OleObject_Init(WebBrowser *This)
This->lpWBOleCommandTargetVtbl = &OleCommandTargetVtbl; This->lpWBOleCommandTargetVtbl = &OleCommandTargetVtbl;
This->client = NULL; This->client = NULL;
This->inplace = NULL;
This->container = NULL; This->container = NULL;
This->iphwnd = NULL; This->iphwnd = NULL;
This->frame_hwnd = NULL; This->frame_hwnd = NULL;

View File

@ -89,6 +89,7 @@ typedef struct {
IOleContainer *container; IOleContainer *container;
IOleDocumentView *view; IOleDocumentView *view;
IDocHostUIHandler *hostui; IDocHostUIHandler *hostui;
IOleInPlaceSite *inplace;
LPOLESTR url; LPOLESTR url;