Added IOleDocumentSite implementation.

This commit is contained in:
Jacek Caban 2005-11-28 11:24:49 +01:00 committed by Alexandre Julliard
parent 225a9facd4
commit 13e3cad0d0
3 changed files with 69 additions and 0 deletions

View File

@ -272,8 +272,72 @@ static const IOleInPlaceSiteVtbl OleInPlaceSiteVtbl = {
InPlaceSite_OnPosRectChange
};
#define DOCSITE_THIS(iface) DEFINE_THIS(WebBrowser, OleDocumentSite, iface)
static HRESULT WINAPI OleDocumentSite_QueryInterface(IOleDocumentSite *iface,
REFIID riid, void **ppv)
{
WebBrowser *This = DOCSITE_THIS(iface);
return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppv);
}
static ULONG WINAPI OleDocumentSite_AddRef(IOleDocumentSite *iface)
{
WebBrowser *This = DOCSITE_THIS(iface);
return IOleClientSite_AddRef(CLIENTSITE(This));
}
static ULONG WINAPI OleDocumentSite_Release(IOleDocumentSite *iface)
{
WebBrowser *This = DOCSITE_THIS(iface);
return IOleClientSite_Release(CLIENTSITE(This));
}
static HRESULT WINAPI OleDocumentSite_ActivateMe(IOleDocumentSite *iface,
IOleDocumentView *pViewToActivate)
{
WebBrowser *This = DOCSITE_THIS(iface);
IOleDocument *oledoc;
RECT rect;
HRESULT hres;
TRACE("(%p)->(%p)\n", This, pViewToActivate);
hres = IUnknown_QueryInterface(This->document, &IID_IOleDocument, (void**)&oledoc);
if(FAILED(hres))
return hres;
IOleDocument_CreateView(oledoc, INPLACESITE(This), NULL, 0, &This->view);
IOleDocument_Release(oledoc);
GetClientRect(This->doc_view_hwnd, &rect);
IOleDocumentView_SetRect(This->view, &rect);
hres = IOleDocumentView_Show(This->view, TRUE);
return hres;
}
#undef DOCSITE_THIS
static const IOleDocumentSiteVtbl OleDocumentSiteVtbl = {
OleDocumentSite_QueryInterface,
OleDocumentSite_AddRef,
OleDocumentSite_Release,
OleDocumentSite_ActivateMe
};
void WebBrowser_ClientSite_Init(WebBrowser *This)
{
This->lpOleClientSiteVtbl = &OleClientSiteVtbl;
This->lpOleInPlaceSiteVtbl = &OleInPlaceSiteVtbl;
This->lpOleDocumentSiteVtbl = &OleDocumentSiteVtbl;
This->view = NULL;
}
void WebBrowser_ClientSite_Destroy(WebBrowser *This)
{
if(This->view)
IOleDocumentView_Release(This->view);
}

View File

@ -77,6 +77,7 @@ typedef struct {
const IOleClientSiteVtbl *lpOleClientSiteVtbl;
const IOleInPlaceSiteVtbl *lpOleInPlaceSiteVtbl;
const IDocHostUIHandler2Vtbl *lpDocHostUIHandlerVtbl;
const IOleDocumentSiteVtbl *lpOleDocumentSiteVtbl;
/* Interfaces of InPlaceFrame object */
@ -88,6 +89,7 @@ typedef struct {
IOleClientSite *client;
IOleContainer *container;
IOleDocumentView *view;
/* window context */
@ -126,6 +128,7 @@ typedef struct {
#define INPLACESITE(x) ((IOleInPlaceSite*) &(x)->lpOleInPlaceSiteVtbl)
#define DOCHOSTUI(x) ((IDocHostUIHandler*) &(x)->lpDocHostUIHandlerVtbl)
#define DOCHOSTUI2(x) ((IDocHostUIHandler2*) &(x)->lpDocHostUIHandlerVtbl)
#define DOCSITE(x) ((IOleDocumentSite*) &(x)->lpOleDocumentSiteVtbl)
#define INPLACEFRAME(x) ((IOleInPlaceFrame*) &(x)->lpOleInPlaceFrameVtbl)
@ -143,6 +146,7 @@ void WebBrowser_Frame_Init(WebBrowser*);
void WebBrowser_OleObject_Destroy(WebBrowser*);
void WebBrowser_Events_Destroy(WebBrowser*);
void WebBrowser_ClientSite_Destroy(WebBrowser*);
HRESULT WebBrowser_Create(IUnknown*,REFIID,void**);

View File

@ -126,6 +126,7 @@ static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
WebBrowser_OleObject_Destroy(This);
WebBrowser_Events_Destroy(This);
WebBrowser_ClientSite_Destroy(This);
HeapFree(GetProcessHeap(), 0, This);
SHDOCVW_UnlockModule();