shdocvw: Use DocHost, not WebBrowser, in Shell DocObject View window.

This commit is contained in:
Jacek Caban 2006-04-18 00:42:45 +02:00 committed by Alexandre Julliard
parent 61560b8715
commit 00e3ac5b31
4 changed files with 27 additions and 27 deletions

View File

@ -25,7 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
static ATOM doc_view_atom = 0;
static void navigate_complete(WebBrowser *This)
static void navigate_complete(DocHost *This)
{
IDispatch *disp = NULL;
DISPPARAMS dispparams;
@ -33,7 +33,7 @@ static void navigate_complete(WebBrowser *This)
VARIANT url;
HRESULT hres;
hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IDispatch, (void**)&disp);
hres = IUnknown_QueryInterface(This->document, &IID_IDispatch, (void**)&disp);
if(FAILED(hres))
FIXME("Could not get IDispatch interface\n");
@ -51,26 +51,26 @@ static void navigate_complete(WebBrowser *This)
V_VT(&url) = VT_BSTR;
V_BSTR(&url) = This->url;
call_sink(This->doc_host.cp_wbe2, DISPID_NAVIGATECOMPLETE2, &dispparams);
call_sink(This->doc_host.cp_wbe2, DISPID_DOCUMENTCOMPLETE, &dispparams);
call_sink(This->cp_wbe2, DISPID_NAVIGATECOMPLETE2, &dispparams);
call_sink(This->cp_wbe2, DISPID_DOCUMENTCOMPLETE, &dispparams);
if(disp)
IDispatch_Release(disp);
}
static LRESULT navigate2(WebBrowser *This)
static LRESULT navigate2(DocHost *This)
{
IHlinkTarget *hlink;
HRESULT hres;
TRACE("(%p)\n", This);
if(!This->doc_host.document) {
if(!This->document) {
WARN("document == NULL\n");
return 0;
}
hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IHlinkTarget, (void**)&hlink);
hres = IUnknown_QueryInterface(This->document, &IID_IHlinkTarget, (void**)&hlink);
if(FAILED(hres)) {
FIXME("Could not get IHlinkTarget interface\n");
return 0;
@ -88,26 +88,26 @@ static LRESULT navigate2(WebBrowser *This)
return 0;
}
static LRESULT resize_document(WebBrowser *This, LONG width, LONG height)
static LRESULT resize_document(DocHost *This, LONG width, LONG height)
{
RECT rect = {0, 0, width, height};
TRACE("(%p)->(%ld %ld)\n", This, width, height);
if(This->doc_host.view)
IOleDocumentView_SetRect(This->doc_host.view, &rect);
if(This->view)
IOleDocumentView_SetRect(This->view, &rect);
return 0;
}
static LRESULT WINAPI doc_view_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
WebBrowser *This;
DocHost *This;
static const WCHAR wszTHIS[] = {'T','H','I','S',0};
if(msg == WM_CREATE) {
This = *(WebBrowser**)lParam;
This = *(DocHost**)lParam;
SetPropW(hwnd, wszTHIS, This);
}else {
This = GetPropW(hwnd, wszTHIS);
@ -123,7 +123,7 @@ static LRESULT WINAPI doc_view_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
return DefWindowProcW(hwnd, msg, wParam, lParam);
}
void create_doc_view_hwnd(WebBrowser *This)
void create_doc_view_hwnd(DocHost *This)
{
RECT rect;
@ -146,11 +146,11 @@ void create_doc_view_hwnd(WebBrowser *This)
doc_view_atom = RegisterClassExW(&wndclass);
}
GetClientRect(This->shell_embedding_hwnd, &rect);
This->doc_host.hwnd = CreateWindowExW(0, wszShell_DocObject_View,
GetClientRect(This->frame_hwnd, &rect); /* FIXME */
This->hwnd = CreateWindowExW(0, wszShell_DocObject_View,
wszShell_DocObject_View,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TABSTOP,
rect.left, rect.top, rect.right, rect.bottom, This->shell_embedding_hwnd,
rect.left, rect.top, rect.right, rect.bottom, This->frame_hwnd,
NULL, shdocvw_hinstance, This);
}

View File

@ -456,8 +456,8 @@ HRESULT navigate_url(WebBrowser *This, LPCWSTR url, PBYTE post_data, ULONG post_
return hres;
}
IMoniker_GetDisplayName(mon, NULL, NULL, &This->url);
TRACE("navigating to %s\n", debugstr_w(This->url));
IMoniker_GetDisplayName(mon, NULL, NULL, &This->doc_host.url);
TRACE("navigating to %s\n", debugstr_w(This->doc_host.url));
callback = create_callback(This, post_data, post_data_len, (LPWSTR)headers, &cancel);
CreateAsyncBindCtx(0, callback, 0, &bindctx);
@ -517,7 +517,7 @@ HRESULT navigate_hlink(WebBrowser *This, IMoniker *mon, IBindCtx *bindctx,
return S_OK;
}
This->url = url;
This->doc_host.url = url;
return navigate(This, mon, bindctx, callback);
}

View File

@ -74,6 +74,8 @@ typedef struct {
HWND hwnd;
HWND frame_hwnd;
LPOLESTR url;
/* Connection points */
ConnectionPoint *cp_wbe2;
@ -103,8 +105,6 @@ typedef struct WebBrowser {
IOleContainer *container;
IOleInPlaceSite *inplace;
LPOLESTR url;
/* window context */
HWND iphwnd;
@ -166,7 +166,7 @@ void DocHost_Events_Release(DocHost*);
HRESULT WebBrowser_Create(IUnknown*,REFIID,void**);
void create_doc_view_hwnd(WebBrowser *This);
void create_doc_view_hwnd(DocHost*);
void deactivate_document(DocHost*);
void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*);
HRESULT navigate_url(WebBrowser*,LPCWSTR,PBYTE,ULONG,LPWSTR);

View File

@ -132,7 +132,7 @@ static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
WebBrowser_OleObject_Destroy(This);
SysFreeString(This->url);
SysFreeString(This->doc_host.url);
HeapFree(GetProcessHeap(), 0, This);
SHDOCVW_UnlockModule();
}
@ -411,13 +411,13 @@ static HRESULT WINAPI WebBrowser_get_LocationURL(IWebBrowser2 *iface, BSTR *Loca
FIXME("(%p)->(%p)\n", This, LocationURL);
if(!This->url) {
if(!This->doc_host.url) {
static const WCHAR null_char = 0;
*LocationURL = SysAllocString(&null_char);
return S_FALSE;
}
*LocationURL = SysAllocString(This->url);
*LocationURL = SysAllocString(This->doc_host.url);
return S_OK;
}
@ -613,7 +613,7 @@ static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VA
}
if(!This->doc_host.hwnd)
create_doc_view_hwnd(This);
create_doc_view_hwnd(&This->doc_host);
hres = navigate_url(This, V_BSTR(URL), post_data, post_data_len, headers);
@ -844,7 +844,7 @@ HRESULT WebBrowser_Create(IUnknown *pOuter, REFIID riid, void **ppv)
ret->lpWebBrowser2Vtbl = &WebBrowser2Vtbl;
ret->ref = 0;
ret->url = NULL;
ret->doc_host.url = NULL;
ret->doc_host.disp = (IDispatch*)WEBBROWSER2(ret);
DocHost_Init(&ret->doc_host);