Commit 6d54716f authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

- More implementation of view

- Added IOleInPlaceActiveObject
parent 9117e1c4
...@@ -76,6 +76,9 @@ static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID ...@@ -76,6 +76,9 @@ static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID
}else if(IsEqualGUID(&IID_IOleDocumentView, riid)) { }else if(IsEqualGUID(&IID_IOleDocumentView, riid)) {
TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This, ppvObject); TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This, ppvObject);
*ppvObject = DOCVIEW(This); *ppvObject = DOCVIEW(This);
}else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This, ppvObject);
*ppvObject = ACTOBJ(This);
} }
if(*ppvObject) { if(*ppvObject) {
...@@ -107,6 +110,8 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface) ...@@ -107,6 +110,8 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
IOleClientSite_Release(This->client); IOleClientSite_Release(This->client);
if(This->ipsite) if(This->ipsite)
IOleInPlaceSite_Release(This->ipsite); IOleInPlaceSite_Release(This->ipsite);
if(This->frame)
IOleInPlaceFrame_Release(This->frame);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
......
...@@ -17,30 +17,33 @@ ...@@ -17,30 +17,33 @@
*/ */
typedef struct { typedef struct {
IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl; IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
IPersistMonikerVtbl *lpPersistMonikerVtbl; IPersistMonikerVtbl *lpPersistMonikerVtbl;
IPersistFileVtbl *lpPersistFileVtbl; IPersistFileVtbl *lpPersistFileVtbl;
IMonikerPropVtbl *lpMonikerPropVtbl; IMonikerPropVtbl *lpMonikerPropVtbl;
IOleObjectVtbl *lpOleObjectVtbl; IOleObjectVtbl *lpOleObjectVtbl;
IOleDocumentVtbl *lpOleDocumentVtbl; IOleDocumentVtbl *lpOleDocumentVtbl;
IOleDocumentViewVtbl*lpOleDocumentViewVtbl; IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
ULONG ref; ULONG ref;
IOleClientSite *client; IOleClientSite *client;
IOleInPlaceSite *ipsite; IOleInPlaceSite *ipsite;
IOleInPlaceFrame *frame;
HWND hwnd; HWND hwnd;
} HTMLDocument; } HTMLDocument;
#define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl) #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
#define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl) #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
#define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl) #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
#define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl) #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
#define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl) #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
#define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl) #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
#define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl) #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
#define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl) #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
#define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**); HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
......
...@@ -374,10 +374,104 @@ static IOleDocumentVtbl OleDocumentVtbl = { ...@@ -374,10 +374,104 @@ static IOleDocumentVtbl OleDocumentVtbl = {
OleDocument_EnumViews 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) void HTMLDocument_OleObj_Init(HTMLDocument *This)
{ {
This->lpOleObjectVtbl = &OleObjectVtbl; This->lpOleObjectVtbl = &OleObjectVtbl;
This->lpOleDocumentVtbl = &OleDocumentVtbl; This->lpOleDocumentVtbl = &OleDocumentVtbl;
This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl;
This->client = NULL; This->client = NULL;
} }
...@@ -40,6 +40,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); ...@@ -40,6 +40,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
static const WCHAR wszInternetExplorer_Server[] = 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}; {'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; static ATOM serverwnd_class = 0;
...@@ -206,8 +208,12 @@ static HRESULT WINAPI OleDocumentView_SetRectComplex(IOleDocumentView *iface, LP ...@@ -206,8 +208,12 @@ static HRESULT WINAPI OleDocumentView_SetRectComplex(IOleDocumentView *iface, LP
static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow) static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow)
{ {
DOCVIEW_THIS DOCVIEW_THIS
FIXME("(%p)->(%x)\n", This, fShow); TRACE("(%p)->(%x)\n", This, fShow);
return E_NOTIMPL;
if(This->hwnd)
ShowWindow(This->hwnd, fShow);
return S_OK;
} }
static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL fUIActivate) static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL fUIActivate)
...@@ -244,8 +250,6 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f ...@@ -244,8 +250,6 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f
WARN("GetWindowContext failed: %08lx\n", hres); WARN("GetWindowContext failed: %08lx\n", hres);
return hres; return hres;
} }
if(pIPFrame)
IOleInPlaceFrame_Release(pIPFrame);
if(pIPWnd) if(pIPWnd)
IOleInPlaceUIWindow_Release(pIPWnd); IOleInPlaceUIWindow_Release(pIPWnd);
TRACE("got window context: %p %p {%ld %ld %ld %ld} {%ld %ld %ld %ld} {%d %x %p %p %d}\n", 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 ...@@ -283,16 +287,23 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f
hres = IOleInPlaceSite_OnUIActivate(This->ipsite); hres = IOleInPlaceSite_OnUIActivate(This->ipsite);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
/* IOleInPlaceFrame_SetActiveObject(pIPFrame, ACTOBJ(This->pDoc), wszHTMLDocument); */ IOleInPlaceFrame_SetActiveObject(pIPFrame, ACTOBJ(This), wszHTML_Document);
}else { }else {
FIXME("OnUIActivate failed: %08lx\n", hres); FIXME("OnUIActivate failed: %08lx\n", hres);
DestroyWindow(hwnd); DestroyWindow(hwnd);
return hres; return hres;
} }
if(This->frame)
IOleInPlaceFrame_Release(This->frame);
This->frame = pIPFrame;
This->hwnd = hwnd; This->hwnd = hwnd;
}else { }else {
FIXME("deactivating is not supported\n"); static const WCHAR wszEmpty[] = {0};
return E_NOTIMPL;
if(This->frame)
IOleInPlaceFrame_SetActiveObject(This->frame, NULL, wszEmpty);
if(This->ipsite)
IOleInPlaceSite_OnUIDeactivate(This->ipsite, FALSE);
} }
return S_OK; return S_OK;
} }
...@@ -307,8 +318,19 @@ static HRESULT WINAPI OleDocumentView_Open(IOleDocumentView *iface) ...@@ -307,8 +318,19 @@ static HRESULT WINAPI OleDocumentView_Open(IOleDocumentView *iface)
static HRESULT WINAPI OleDocumentView_CloseView(IOleDocumentView *iface, DWORD dwReserved) static HRESULT WINAPI OleDocumentView_CloseView(IOleDocumentView *iface, DWORD dwReserved)
{ {
DOCVIEW_THIS DOCVIEW_THIS
FIXME("(%p)->(%lx)\n", This, dwReserved); TRACE("(%p)->(%lx)\n", This, dwReserved);
return E_NOTIMPL;
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) static HRESULT WINAPI OleDocumentView_SaveViewState(IOleDocumentView *iface, LPSTREAM pstm)
...@@ -357,5 +379,6 @@ void HTMLDocument_View_Init(HTMLDocument *This) ...@@ -357,5 +379,6 @@ void HTMLDocument_View_Init(HTMLDocument *This)
This->lpOleDocumentViewVtbl = &OleDocumentViewVtbl; This->lpOleDocumentViewVtbl = &OleDocumentViewVtbl;
This->ipsite = NULL; This->ipsite = NULL;
This->frame = NULL;
This->hwnd = NULL; This->hwnd = NULL;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment