Added IOleDocumentSite implementation.
This commit is contained in:
parent
225a9facd4
commit
13e3cad0d0
|
@ -272,8 +272,72 @@ static const IOleInPlaceSiteVtbl OleInPlaceSiteVtbl = {
|
||||||
InPlaceSite_OnPosRectChange
|
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)
|
void WebBrowser_ClientSite_Init(WebBrowser *This)
|
||||||
{
|
{
|
||||||
This->lpOleClientSiteVtbl = &OleClientSiteVtbl;
|
This->lpOleClientSiteVtbl = &OleClientSiteVtbl;
|
||||||
This->lpOleInPlaceSiteVtbl = &OleInPlaceSiteVtbl;
|
This->lpOleInPlaceSiteVtbl = &OleInPlaceSiteVtbl;
|
||||||
|
This->lpOleDocumentSiteVtbl = &OleDocumentSiteVtbl;
|
||||||
|
|
||||||
|
This->view = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebBrowser_ClientSite_Destroy(WebBrowser *This)
|
||||||
|
{
|
||||||
|
if(This->view)
|
||||||
|
IOleDocumentView_Release(This->view);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,7 @@ typedef struct {
|
||||||
const IOleClientSiteVtbl *lpOleClientSiteVtbl;
|
const IOleClientSiteVtbl *lpOleClientSiteVtbl;
|
||||||
const IOleInPlaceSiteVtbl *lpOleInPlaceSiteVtbl;
|
const IOleInPlaceSiteVtbl *lpOleInPlaceSiteVtbl;
|
||||||
const IDocHostUIHandler2Vtbl *lpDocHostUIHandlerVtbl;
|
const IDocHostUIHandler2Vtbl *lpDocHostUIHandlerVtbl;
|
||||||
|
const IOleDocumentSiteVtbl *lpOleDocumentSiteVtbl;
|
||||||
|
|
||||||
/* Interfaces of InPlaceFrame object */
|
/* Interfaces of InPlaceFrame object */
|
||||||
|
|
||||||
|
@ -88,6 +89,7 @@ typedef struct {
|
||||||
|
|
||||||
IOleClientSite *client;
|
IOleClientSite *client;
|
||||||
IOleContainer *container;
|
IOleContainer *container;
|
||||||
|
IOleDocumentView *view;
|
||||||
|
|
||||||
/* window context */
|
/* window context */
|
||||||
|
|
||||||
|
@ -126,6 +128,7 @@ typedef struct {
|
||||||
#define INPLACESITE(x) ((IOleInPlaceSite*) &(x)->lpOleInPlaceSiteVtbl)
|
#define INPLACESITE(x) ((IOleInPlaceSite*) &(x)->lpOleInPlaceSiteVtbl)
|
||||||
#define DOCHOSTUI(x) ((IDocHostUIHandler*) &(x)->lpDocHostUIHandlerVtbl)
|
#define DOCHOSTUI(x) ((IDocHostUIHandler*) &(x)->lpDocHostUIHandlerVtbl)
|
||||||
#define DOCHOSTUI2(x) ((IDocHostUIHandler2*) &(x)->lpDocHostUIHandlerVtbl)
|
#define DOCHOSTUI2(x) ((IDocHostUIHandler2*) &(x)->lpDocHostUIHandlerVtbl)
|
||||||
|
#define DOCSITE(x) ((IOleDocumentSite*) &(x)->lpOleDocumentSiteVtbl)
|
||||||
|
|
||||||
#define INPLACEFRAME(x) ((IOleInPlaceFrame*) &(x)->lpOleInPlaceFrameVtbl)
|
#define INPLACEFRAME(x) ((IOleInPlaceFrame*) &(x)->lpOleInPlaceFrameVtbl)
|
||||||
|
|
||||||
|
@ -143,6 +146,7 @@ void WebBrowser_Frame_Init(WebBrowser*);
|
||||||
|
|
||||||
void WebBrowser_OleObject_Destroy(WebBrowser*);
|
void WebBrowser_OleObject_Destroy(WebBrowser*);
|
||||||
void WebBrowser_Events_Destroy(WebBrowser*);
|
void WebBrowser_Events_Destroy(WebBrowser*);
|
||||||
|
void WebBrowser_ClientSite_Destroy(WebBrowser*);
|
||||||
|
|
||||||
HRESULT WebBrowser_Create(IUnknown*,REFIID,void**);
|
HRESULT WebBrowser_Create(IUnknown*,REFIID,void**);
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,7 @@ static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
|
||||||
|
|
||||||
WebBrowser_OleObject_Destroy(This);
|
WebBrowser_OleObject_Destroy(This);
|
||||||
WebBrowser_Events_Destroy(This);
|
WebBrowser_Events_Destroy(This);
|
||||||
|
WebBrowser_ClientSite_Destroy(This);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
SHDOCVW_UnlockModule();
|
SHDOCVW_UnlockModule();
|
||||||
|
|
Loading…
Reference in New Issue