- More implementation of view

- Added IOleInPlaceActiveObject
This commit is contained in:
Jacek Caban 2005-04-15 16:12:45 +00:00 committed by Alexandre Julliard
parent 9117e1c463
commit 6d54716f17
4 changed files with 149 additions and 24 deletions

View File

@ -76,6 +76,9 @@ static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID
}else if(IsEqualGUID(&IID_IOleDocumentView, riid)) {
TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This, ppvObject);
*ppvObject = DOCVIEW(This);
}else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This, ppvObject);
*ppvObject = ACTOBJ(This);
}
if(*ppvObject) {
@ -107,6 +110,8 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
IOleClientSite_Release(This->client);
if(This->ipsite)
IOleInPlaceSite_Release(This->ipsite);
if(This->frame)
IOleInPlaceFrame_Release(This->frame);
HeapFree(GetProcessHeap(), 0, This);
}

View File

@ -23,12 +23,14 @@ typedef struct {
IMonikerPropVtbl *lpMonikerPropVtbl;
IOleObjectVtbl *lpOleObjectVtbl;
IOleDocumentVtbl *lpOleDocumentVtbl;
IOleDocumentViewVtbl*lpOleDocumentViewVtbl;
IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
ULONG ref;
IOleClientSite *client;
IOleInPlaceSite *ipsite;
IOleInPlaceFrame *frame;
HWND hwnd;
} HTMLDocument;
@ -41,6 +43,7 @@ typedef struct {
#define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
#define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
#define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
#define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);

View File

@ -374,10 +374,104 @@ static IOleDocumentVtbl OleDocumentVtbl = {
OleDocument_EnumViews
};
/**********************************************************
* IOleInPlaceActiveObject implementation
*/
#define ACTOBJ_THIS \
HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpOleInPlaceActiveObjectVtbl));
static HRESULT WINAPI OleInPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject *iface, REFIID riid, void **ppvObject)
{
ACTOBJ_THIS
return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
}
static ULONG WINAPI OleInPlaceActiveObject_AddRef(IOleInPlaceActiveObject *iface)
{
ACTOBJ_THIS
return IHTMLDocument2_AddRef(HTMLDOC(This));
}
static ULONG WINAPI OleInPlaceActiveObject_Release(IOleInPlaceActiveObject *iface)
{
ACTOBJ_THIS
return IHTMLDocument2_Release(HTMLDOC(This));
}
static HRESULT WINAPI OleInPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *iface, HWND *phwnd)
{
ACTOBJ_THIS
TRACE("(%p)->(%p)\n", This, phwnd);
if(!phwnd)
return E_INVALIDARG;
*phwnd = This->hwnd;
return S_OK;
}
static HRESULT WINAPI OleInPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject *iface, BOOL fEnterMode)
{
ACTOBJ_THIS
FIXME("(%p)->(%x)\n", This, fEnterMode);
return E_NOTIMPL;
}
static HRESULT WINAPI OleInPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject *iface, LPMSG lpmsg)
{
ACTOBJ_THIS
FIXME("(%p)->(%p)\n", This, lpmsg);
return E_NOTIMPL;
}
static HRESULT WINAPI OleInPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject *iface, BOOL fActivate)
{
ACTOBJ_THIS
FIXME("(%p)->(%x)\n", This, fActivate);
return E_NOTIMPL;
}
static HRESULT WINAPI OleInPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject *iface, BOOL fActivate)
{
ACTOBJ_THIS
FIXME("(%p)->(%x)\n", This, fActivate);
return E_NOTIMPL;
}
static HRESULT WINAPI OleInPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject *iface, LPCRECT prcBorder,
IOleInPlaceUIWindow *pUIWindow, BOOL fFrameWindow)
{
ACTOBJ_THIS
FIXME("(%p)->(%p %p %x)\n", This, prcBorder, pUIWindow, fFrameWindow);
return E_NOTIMPL;
}
static HRESULT WINAPI OleInPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject *iface, BOOL fEnable)
{
ACTOBJ_THIS
FIXME("(%p)->(%x)\n", This, fEnable);
return E_NOTIMPL;
}
static IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl = {
OleInPlaceActiveObject_QueryInterface,
OleInPlaceActiveObject_AddRef,
OleInPlaceActiveObject_Release,
OleInPlaceActiveObject_GetWindow,
OleInPlaceActiveObject_ContextSensitiveHelp,
OleInPlaceActiveObject_TranslateAccelerator,
OleInPlaceActiveObject_OnFrameWindowActivate,
OleInPlaceActiveObject_OnDocWindowActivate,
OleInPlaceActiveObject_ResizeBorder,
OleInPlaceActiveObject_EnableModeless
};
void HTMLDocument_OleObj_Init(HTMLDocument *This)
{
This->lpOleObjectVtbl = &OleObjectVtbl;
This->lpOleDocumentVtbl = &OleDocumentVtbl;
This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl;
This->client = NULL;
}

View File

@ -40,6 +40,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
static const WCHAR wszInternetExplorer_Server[] =
{'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','_','S','e','r','v','e','r',0};
static const WCHAR wszHTML_Document[] =
{'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
static ATOM serverwnd_class = 0;
@ -206,8 +208,12 @@ static HRESULT WINAPI OleDocumentView_SetRectComplex(IOleDocumentView *iface, LP
static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow)
{
DOCVIEW_THIS
FIXME("(%p)->(%x)\n", This, fShow);
return E_NOTIMPL;
TRACE("(%p)->(%x)\n", This, fShow);
if(This->hwnd)
ShowWindow(This->hwnd, fShow);
return S_OK;
}
static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL fUIActivate)
@ -244,8 +250,6 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f
WARN("GetWindowContext failed: %08lx\n", hres);
return hres;
}
if(pIPFrame)
IOleInPlaceFrame_Release(pIPFrame);
if(pIPWnd)
IOleInPlaceUIWindow_Release(pIPWnd);
TRACE("got window context: %p %p {%ld %ld %ld %ld} {%ld %ld %ld %ld} {%d %x %p %p %d}\n",
@ -283,16 +287,23 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f
hres = IOleInPlaceSite_OnUIActivate(This->ipsite);
if(SUCCEEDED(hres)) {
/* IOleInPlaceFrame_SetActiveObject(pIPFrame, ACTOBJ(This->pDoc), wszHTMLDocument); */
IOleInPlaceFrame_SetActiveObject(pIPFrame, ACTOBJ(This), wszHTML_Document);
}else {
FIXME("OnUIActivate failed: %08lx\n", hres);
DestroyWindow(hwnd);
return hres;
}
if(This->frame)
IOleInPlaceFrame_Release(This->frame);
This->frame = pIPFrame;
This->hwnd = hwnd;
}else {
FIXME("deactivating is not supported\n");
return E_NOTIMPL;
static const WCHAR wszEmpty[] = {0};
if(This->frame)
IOleInPlaceFrame_SetActiveObject(This->frame, NULL, wszEmpty);
if(This->ipsite)
IOleInPlaceSite_OnUIDeactivate(This->ipsite, FALSE);
}
return S_OK;
}
@ -307,8 +318,19 @@ static HRESULT WINAPI OleDocumentView_Open(IOleDocumentView *iface)
static HRESULT WINAPI OleDocumentView_CloseView(IOleDocumentView *iface, DWORD dwReserved)
{
DOCVIEW_THIS
FIXME("(%p)->(%lx)\n", This, dwReserved);
return E_NOTIMPL;
TRACE("(%p)->(%lx)\n", This, dwReserved);
if(dwReserved)
WARN("dwReserved = %ld\n", dwReserved);
/* NOTE:
* Windows implementation calls QueryInterface(IID_IOleCommandTarget),
* QueryInterface(IID_IOleControlSite) and KillTimer
*/
IOleDocumentView_Show(iface, FALSE);
return S_OK;
}
static HRESULT WINAPI OleDocumentView_SaveViewState(IOleDocumentView *iface, LPSTREAM pstm)
@ -357,5 +379,6 @@ void HTMLDocument_View_Init(HTMLDocument *This)
This->lpOleDocumentViewVtbl = &OleDocumentViewVtbl;
This->ipsite = NULL;
This->frame = NULL;
This->hwnd = NULL;
}