shdocvw: Use Dochost, not WebBrowser, in deactivate_document.

This commit is contained in:
Jacek Caban 2006-04-18 00:39:15 +02:00 committed by Alexandre Julliard
parent 6470c5ca0a
commit 22b6d5485c
4 changed files with 18 additions and 18 deletions

View File

@ -154,36 +154,36 @@ void create_doc_view_hwnd(WebBrowser *This)
NULL, shdocvw_hinstance, This);
}
void deactivate_document(WebBrowser *This)
void deactivate_document(DocHost *This)
{
IOleInPlaceObjectWindowless *winobj;
IOleObject *oleobj = NULL;
IHlinkTarget *hlink = NULL;
HRESULT hres;
if(This->doc_host.view)
IOleDocumentView_UIActivate(This->doc_host.view, FALSE);
if(This->view)
IOleDocumentView_UIActivate(This->view, FALSE);
hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IOleInPlaceObjectWindowless,
hres = IUnknown_QueryInterface(This->document, &IID_IOleInPlaceObjectWindowless,
(void**)&winobj);
if(SUCCEEDED(hres)) {
IOleInPlaceObjectWindowless_InPlaceDeactivate(winobj);
IOleInPlaceObjectWindowless_Release(winobj);
}
if(This->doc_host.view) {
IOleDocumentView_Show(This->doc_host.view, FALSE);
IOleDocumentView_CloseView(This->doc_host.view, 0);
IOleDocumentView_SetInPlaceSite(This->doc_host.view, NULL);
IOleDocumentView_Release(This->doc_host.view);
This->doc_host.view = NULL;
if(This->view) {
IOleDocumentView_Show(This->view, FALSE);
IOleDocumentView_CloseView(This->view, 0);
IOleDocumentView_SetInPlaceSite(This->view, NULL);
IOleDocumentView_Release(This->view);
This->view = NULL;
}
hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IOleObject, (void**)&oleobj);
hres = IUnknown_QueryInterface(This->document, &IID_IOleObject, (void**)&oleobj);
if(SUCCEEDED(hres))
IOleObject_Close(oleobj, OLECLOSE_NOSAVE);
hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IHlinkTarget, (void**)&hlink);
hres = IUnknown_QueryInterface(This->document, &IID_IHlinkTarget, (void**)&hlink);
if(SUCCEEDED(hres)) {
IHlinkTarget_SetBrowseContext(hlink, NULL);
IHlinkTarget_Release(hlink);
@ -194,7 +194,7 @@ void deactivate_document(WebBrowser *This)
IOleObject_GetClientSite(oleobj, &client_site);
if(client_site) {
if(client_site == CLIENTSITE(&This->doc_host))
if(client_site == CLIENTSITE(This))
IOleObject_SetClientSite(oleobj, NULL);
IOleClientSite_Release(client_site);
}
@ -202,8 +202,8 @@ void deactivate_document(WebBrowser *This)
IOleObject_Release(oleobj);
}
IUnknown_Release(This->doc_host.document);
This->doc_host.document = NULL;
IUnknown_Release(This->document);
This->document = NULL;
}
#define OLECMD_THIS(iface) DEFINE_THIS(DocHost, OleCommandTarget, iface)

View File

@ -401,7 +401,7 @@ static HRESULT navigate(WebBrowser *This, IMoniker *mon, IBindCtx *bindctx,
*/
if(This->doc_host.document)
deactivate_document(This);
deactivate_document(&This->doc_host);
hres = CoCreateInstance(&CLSID_HTMLDocument, NULL,
CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,

View File

@ -154,7 +154,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE
if(!pClientSite) {
if(This->doc_host.document)
deactivate_document(This);
deactivate_document(&This->doc_host);
This->client = NULL;
return S_OK;
}

View File

@ -165,7 +165,7 @@ void WebBrowser_ClientSite_Destroy(WebBrowser*);
HRESULT WebBrowser_Create(IUnknown*,REFIID,void**);
void create_doc_view_hwnd(WebBrowser *This);
void deactivate_document(WebBrowser*);
void deactivate_document(DocHost*);
void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*);
HRESULT navigate_url(WebBrowser*,LPCWSTR,PBYTE,ULONG,LPWSTR);