Added OLEIVERB_INPLACEACTIVATE implementation in IOleObject::DoVerb.

This commit is contained in:
Jacek Caban 2005-11-16 11:46:56 +00:00 committed by Alexandre Julliard
parent 6bd1625f57
commit a34eaa3c21
3 changed files with 85 additions and 9 deletions

View File

@ -138,15 +138,58 @@ static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, struct tag
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(WebBrowser *This)
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);
}

View File

@ -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**);
/**********************************************************************

View File

@ -121,12 +121,11 @@ static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
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();
}