shdocvw: Move IOleInPlaceSite to DocHost object.

This commit is contained in:
Jacek Caban 2006-04-18 00:26:47 +02:00 committed by Alexandre Julliard
parent 2dab3d4c1b
commit 89da131352
6 changed files with 44 additions and 41 deletions

View File

@ -37,10 +37,10 @@ static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID ri
*ppv = CLIENTSITE(This);
}else if(IsEqualGUID(&IID_IOleWindow, riid)) {
TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
*ppv = INPLACESITE(This->wb);
*ppv = INPLACESITE(This);
}else if(IsEqualGUID(&IID_IOleInPlaceSite, riid)) {
TRACE("(%p)->(IID_IOleInPlaceSite %p)\n", This, ppv);
*ppv = INPLACESITE(This->wb);
*ppv = INPLACESITE(This);
}else if(IsEqualGUID(&IID_IDocHostUIHandler, riid)) {
TRACE("(%p)->(IID_IDocHostUIHandler %p)\n", This, ppv);
*ppv = DOCHOSTUI(This->wb);
@ -140,46 +140,46 @@ static const IOleClientSiteVtbl OleClientSiteVtbl = {
ClientSite_RequestNewObjectLayout
};
#define INPLACESITE_THIS(iface) DEFINE_THIS(WebBrowser, OleInPlaceSite, iface)
#define INPLACESITE_THIS(iface) DEFINE_THIS(DocHost, OleInPlaceSite, iface)
static HRESULT WINAPI InPlaceSite_QueryInterface(IOleInPlaceSite *iface, REFIID riid, void **ppv)
{
WebBrowser *This = INPLACESITE_THIS(iface);
return IOleClientSite_QueryInterface(CLIENTSITE(&This->doc_host), riid, ppv);
DocHost *This = INPLACESITE_THIS(iface);
return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppv);
}
static ULONG WINAPI InPlaceSite_AddRef(IOleInPlaceSite *iface)
{
WebBrowser *This = INPLACESITE_THIS(iface);
return IOleClientSite_AddRef(CLIENTSITE(&This->doc_host));
DocHost *This = INPLACESITE_THIS(iface);
return IOleClientSite_AddRef(CLIENTSITE(This));
}
static ULONG WINAPI InPlaceSite_Release(IOleInPlaceSite *iface)
{
WebBrowser *This = INPLACESITE_THIS(iface);
return IOleClientSite_Release(CLIENTSITE(&This->doc_host));
DocHost *This = INPLACESITE_THIS(iface);
return IOleClientSite_Release(CLIENTSITE(This));
}
static HRESULT WINAPI InPlaceSite_GetWindow(IOleInPlaceSite *iface, HWND *phwnd)
{
WebBrowser *This = INPLACESITE_THIS(iface);
DocHost *This = INPLACESITE_THIS(iface);
TRACE("(%p)->(%p)\n", This, phwnd);
*phwnd = This->doc_view_hwnd;
*phwnd = This->hwnd;
return S_OK;
}
static HRESULT WINAPI InPlaceSite_ContextSensitiveHelp(IOleInPlaceSite *iface, BOOL fEnterMode)
{
WebBrowser *This = INPLACESITE_THIS(iface);
DocHost *This = INPLACESITE_THIS(iface);
FIXME("(%p)->(%x)\n", This, fEnterMode);
return E_NOTIMPL;
}
static HRESULT WINAPI InPlaceSite_CanInPlaceActivate(IOleInPlaceSite *iface)
{
WebBrowser *This = INPLACESITE_THIS(iface);
DocHost *This = INPLACESITE_THIS(iface);
TRACE("(%p)\n", This);
@ -189,7 +189,7 @@ static HRESULT WINAPI InPlaceSite_CanInPlaceActivate(IOleInPlaceSite *iface)
static HRESULT WINAPI InPlaceSite_OnInPlaceActivate(IOleInPlaceSite *iface)
{
WebBrowser *This = INPLACESITE_THIS(iface);
DocHost *This = INPLACESITE_THIS(iface);
TRACE("(%p)\n", This);
@ -199,7 +199,7 @@ static HRESULT WINAPI InPlaceSite_OnInPlaceActivate(IOleInPlaceSite *iface)
static HRESULT WINAPI InPlaceSite_OnUIActivate(IOleInPlaceSite *iface)
{
WebBrowser *This = INPLACESITE_THIS(iface);
DocHost *This = INPLACESITE_THIS(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
}
@ -208,21 +208,21 @@ static HRESULT WINAPI InPlaceSite_GetWindowContext(IOleInPlaceSite *iface,
IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
{
WebBrowser *This = INPLACESITE_THIS(iface);
DocHost *This = INPLACESITE_THIS(iface);
TRACE("(%p)->(%p %p %p %p %p)\n", This, ppFrame, ppDoc, lprcPosRect,
lprcClipRect, lpFrameInfo);
IOleInPlaceFrame_AddRef(INPLACEFRAME(This));
*ppFrame = INPLACEFRAME(This);
IOleInPlaceFrame_AddRef(INPLACEFRAME(This->wb));
*ppFrame = INPLACEFRAME(This->wb);
*ppDoc = NULL;
GetClientRect(This->doc_view_hwnd, lprcPosRect);
GetClientRect(This->hwnd, lprcPosRect);
memcpy(lprcClipRect, lprcPosRect, sizeof(RECT));
lpFrameInfo->cb = sizeof(*lpFrameInfo);
lpFrameInfo->fMDIApp = FALSE;
lpFrameInfo->hwndFrame = This->shell_embedding_hwnd;
lpFrameInfo->hwndFrame = This->frame_hwnd;
lpFrameInfo->haccel = NULL;
lpFrameInfo->cAccelEntries = 0; /* FIXME: should be 5 */
@ -231,35 +231,35 @@ static HRESULT WINAPI InPlaceSite_GetWindowContext(IOleInPlaceSite *iface,
static HRESULT WINAPI InPlaceSite_Scroll(IOleInPlaceSite *iface, SIZE scrollExtent)
{
WebBrowser *This = INPLACESITE_THIS(iface);
DocHost *This = INPLACESITE_THIS(iface);
FIXME("(%p)->({%ld %ld})\n", This, scrollExtent.cx, scrollExtent.cy);
return E_NOTIMPL;
}
static HRESULT WINAPI InPlaceSite_OnUIDeactivate(IOleInPlaceSite *iface, BOOL fUndoable)
{
WebBrowser *This = INPLACESITE_THIS(iface);
DocHost *This = INPLACESITE_THIS(iface);
FIXME("(%p)->(%x)\n", This, fUndoable);
return E_NOTIMPL;
}
static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSite *iface)
{
WebBrowser *This = INPLACESITE_THIS(iface);
DocHost *This = INPLACESITE_THIS(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI InPlaceSite_DiscardUndoState(IOleInPlaceSite *iface)
{
WebBrowser *This = INPLACESITE_THIS(iface);
DocHost *This = INPLACESITE_THIS(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI InPlaceSite_DeactivateAndUndo(IOleInPlaceSite *iface)
{
WebBrowser *This = INPLACESITE_THIS(iface);
DocHost *This = INPLACESITE_THIS(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
}
@ -267,7 +267,7 @@ static HRESULT WINAPI InPlaceSite_DeactivateAndUndo(IOleInPlaceSite *iface)
static HRESULT WINAPI InPlaceSite_OnPosRectChange(IOleInPlaceSite *iface,
LPCRECT lprcPosRect)
{
WebBrowser *This = INPLACESITE_THIS(iface);
DocHost *This = INPLACESITE_THIS(iface);
FIXME("(%p)->(%p)\n", This, lprcPosRect);
return E_NOTIMPL;
}
@ -327,10 +327,10 @@ static HRESULT WINAPI OleDocumentSite_ActivateMe(IOleDocumentSite *iface,
if(FAILED(hres))
return hres;
IOleDocument_CreateView(oledoc, INPLACESITE(This), NULL, 0, &This->view);
IOleDocument_CreateView(oledoc, INPLACESITE(&This->doc_host), NULL, 0, &This->view);
IOleDocument_Release(oledoc);
GetClientRect(This->doc_view_hwnd, &rect);
GetClientRect(This->doc_host.hwnd, &rect);
IOleDocumentView_SetRect(This->view, &rect);
hres = IOleDocumentView_Show(This->view, TRUE);
@ -467,7 +467,7 @@ static const IServiceProviderVtbl ServiceProviderVtbl = {
void WebBrowser_ClientSite_Init(WebBrowser *This)
{
This->doc_host.lpOleClientSiteVtbl = &OleClientSiteVtbl;
This->lpOleInPlaceSiteVtbl = &OleInPlaceSiteVtbl;
This->doc_host.lpOleInPlaceSiteVtbl = &OleInPlaceSiteVtbl;
This->lpOleDocumentSiteVtbl = &OleDocumentSiteVtbl;
This->lpDispatchVtbl = &DispatchVtbl;
This->lpClServiceProviderVtbl = &ServiceProviderVtbl;

View File

@ -147,7 +147,7 @@ void create_doc_view_hwnd(WebBrowser *This)
}
GetClientRect(This->shell_embedding_hwnd, &rect);
This->doc_view_hwnd = CreateWindowExW(0, wszShell_DocObject_View,
This->doc_host.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,
@ -485,5 +485,6 @@ void WebBrowser_DocHost_Init(WebBrowser *This)
This->hostui = NULL;
This->doc_view_hwnd = NULL;
This->doc_host.hwnd = NULL;
This->doc_host.frame_hwnd = NULL;
}

View File

@ -435,7 +435,7 @@ static HRESULT navigate(WebBrowser *This, IMoniker *mon, IBindCtx *bindctx,
hres = IOleObject_SetClientSite(oleobj, CLIENTSITE(&This->doc_host));
IOleObject_Release(oleobj);
PostMessageW(This->doc_view_hwnd, WB_WM_NAVIGATE2, 0, 0);
PostMessageW(This->doc_host.hwnd, WB_WM_NAVIGATE2, 0, 0);
return hres;

View File

@ -33,8 +33,8 @@ static ATOM shell_embedding_atom = 0;
static LRESULT resize_window(WebBrowser *This, LONG width, LONG height)
{
if(This->doc_view_hwnd)
SetWindowPos(This->doc_view_hwnd, NULL, 0, 0, width, height,
if(This->doc_host.hwnd)
SetWindowPos(This->doc_host.hwnd, NULL, 0, 0, width, height,
SWP_NOZORDER | SWP_NOACTIVATE);
return 0;
@ -91,7 +91,7 @@ static void create_shell_embedding_hwnd(WebBrowser *This)
IOleInPlaceSite_Release(inplace);
}
This->shell_embedding_hwnd = CreateWindowExW(
This->doc_host.frame_hwnd = This->shell_embedding_hwnd = CreateWindowExW(
WS_EX_WINDOWEDGE,
wszShellEmbedding, wszShellEmbedding,
WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TABSTOP,
@ -133,9 +133,9 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE
if(This->client == pClientSite)
return S_OK;
if(This->doc_view_hwnd) {
DestroyWindow(This->doc_view_hwnd);
This->doc_view_hwnd = NULL;
if(This->doc_host.hwnd) {
DestroyWindow(This->doc_host.hwnd);
This->doc_host.hwnd = NULL;
}
if(This->shell_embedding_hwnd) {
DestroyWindow(This->shell_embedding_hwnd);

View File

@ -55,9 +55,13 @@ struct WebBrowser;
typedef struct {
const IOleClientSiteVtbl *lpOleClientSiteVtbl;
const IOleInPlaceSiteVtbl *lpOleInPlaceSiteVtbl;
IDispatch *disp;
HWND hwnd;
HWND frame_hwnd;
struct WebBrowser *wb; /* FIXME */
} DocHost;
@ -79,7 +83,6 @@ typedef struct WebBrowser {
/* Interfaces available for embeded document */
const IOleInPlaceSiteVtbl *lpOleInPlaceSiteVtbl;
const IDocHostUIHandler2Vtbl *lpDocHostUIHandlerVtbl;
const IOleDocumentSiteVtbl *lpOleDocumentSiteVtbl;
const IOleCommandTargetVtbl *lpClOleCommandTargetVtbl;
@ -112,7 +115,6 @@ typedef struct WebBrowser {
RECT clip_rect;
OLEINPLACEFRAMEINFO frameinfo;
HWND doc_view_hwnd;
HWND shell_embedding_hwnd;
/* Connection points */

View File

@ -612,7 +612,7 @@ static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VA
TRACE("Headers: %s\n", debugstr_w(headers));
}
if(!This->doc_view_hwnd)
if(!This->doc_host.hwnd)
create_doc_view_hwnd(This);
hres = navigate_url(This, V_BSTR(URL), post_data, post_data_len, headers);