2008-04-11 12:45:31 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2005 Jacek Caban
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "mshtml_private.h"
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* IOleInPlaceActiveObject implementation
|
|
|
|
*/
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
static inline HTMLDocument *impl_from_IOleInPlaceActiveObject(IOleInPlaceActiveObject *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDocument, IOleInPlaceActiveObject_iface);
|
|
|
|
}
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
static HRESULT WINAPI OleInPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject *iface, REFIID riid, void **ppv)
|
2008-04-11 12:45:31 +00:00
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
|
|
|
|
return htmldoc_query_interface(This, riid, ppv);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OleInPlaceActiveObject_AddRef(IOleInPlaceActiveObject *iface)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
|
|
|
|
return htmldoc_addref(This);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OleInPlaceActiveObject_Release(IOleInPlaceActiveObject *iface)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
|
|
|
|
return htmldoc_release(This);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *iface, HWND *phwnd)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, phwnd);
|
|
|
|
|
|
|
|
if(!phwnd)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
if(!This->doc_obj->in_place_active) {
|
2008-04-11 12:45:31 +00:00
|
|
|
*phwnd = NULL;
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
*phwnd = This->doc_obj->hwnd;
|
2008-04-11 12:45:31 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject *iface, BOOL fEnterMode)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
FIXME("(%p)->(%x)\n", This, fEnterMode);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject *iface, LPMSG lpmsg)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, lpmsg);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject *iface,
|
|
|
|
BOOL fActivate)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%x)\n", This, fActivate);
|
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
if(This->doc_obj->hostui)
|
|
|
|
IDocHostUIHandler_OnFrameWindowActivate(This->doc_obj->hostui, fActivate);
|
2008-04-11 12:45:31 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject *iface, BOOL fActivate)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
FIXME("(%p)->(%x)\n", This, fActivate);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject *iface, LPCRECT prcBorder,
|
|
|
|
IOleInPlaceUIWindow *pUIWindow, BOOL fFrameWindow)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
FIXME("(%p)->(%p %p %x)\n", This, prcBorder, pUIWindow, fFrameWindow);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject *iface, BOOL fEnable)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
FIXME("(%p)->(%x)\n", This, fEnable);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl = {
|
|
|
|
OleInPlaceActiveObject_QueryInterface,
|
|
|
|
OleInPlaceActiveObject_AddRef,
|
|
|
|
OleInPlaceActiveObject_Release,
|
|
|
|
OleInPlaceActiveObject_GetWindow,
|
|
|
|
OleInPlaceActiveObject_ContextSensitiveHelp,
|
|
|
|
OleInPlaceActiveObject_TranslateAccelerator,
|
|
|
|
OleInPlaceActiveObject_OnFrameWindowActivate,
|
|
|
|
OleInPlaceActiveObject_OnDocWindowActivate,
|
|
|
|
OleInPlaceActiveObject_ResizeBorder,
|
|
|
|
OleInPlaceActiveObject_EnableModeless
|
|
|
|
};
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* IOleInPlaceObjectWindowless implementation
|
|
|
|
*/
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
static inline HTMLDocument *impl_from_IOleInPlaceObjectWindowless(IOleInPlaceObjectWindowless *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDocument, IOleInPlaceObjectWindowless_iface);
|
|
|
|
}
|
2008-04-11 12:45:31 +00:00
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceObjectWindowless_QueryInterface(IOleInPlaceObjectWindowless *iface,
|
2013-05-19 21:21:20 +00:00
|
|
|
REFIID riid, void **ppv)
|
2008-04-11 12:45:31 +00:00
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
|
|
|
|
return htmldoc_query_interface(This, riid, ppv);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OleInPlaceObjectWindowless_AddRef(IOleInPlaceObjectWindowless *iface)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
|
|
|
|
return htmldoc_addref(This);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OleInPlaceObjectWindowless_Release(IOleInPlaceObjectWindowless *iface)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
|
|
|
|
return htmldoc_release(This);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceObjectWindowless_GetWindow(IOleInPlaceObjectWindowless *iface,
|
|
|
|
HWND *phwnd)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
|
|
|
|
return IOleInPlaceActiveObject_GetWindow(&This->IOleInPlaceActiveObject_iface, phwnd);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceObjectWindowless_ContextSensitiveHelp(IOleInPlaceObjectWindowless *iface,
|
|
|
|
BOOL fEnterMode)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
|
|
|
|
return IOleInPlaceActiveObject_ContextSensitiveHelp(&This->IOleInPlaceActiveObject_iface, fEnterMode);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceObjectWindowless *iface)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
if(This->doc_obj->ui_active)
|
2013-05-19 21:21:20 +00:00
|
|
|
IOleDocumentView_UIActivate(&This->IOleDocumentView_iface, FALSE);
|
2009-10-20 19:28:02 +00:00
|
|
|
This->doc_obj->window_active = FALSE;
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
if(!This->doc_obj->in_place_active)
|
2008-04-11 12:45:31 +00:00
|
|
|
return S_OK;
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
if(This->doc_obj->frame) {
|
2009-10-20 19:28:02 +00:00
|
|
|
IOleInPlaceFrame_Release(This->doc_obj->frame);
|
2013-05-19 21:21:20 +00:00
|
|
|
This->doc_obj->frame = NULL;
|
|
|
|
}
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
if(This->doc_obj->hwnd) {
|
|
|
|
ShowWindow(This->doc_obj->hwnd, SW_HIDE);
|
|
|
|
SetWindowPos(This->doc_obj->hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
This->doc_obj->focus = FALSE;
|
|
|
|
notif_focus(This->doc_obj);
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
This->doc_obj->in_place_active = FALSE;
|
|
|
|
if(This->doc_obj->ipsite) {
|
2008-04-11 12:45:31 +00:00
|
|
|
IOleInPlaceSiteEx *ipsiteex;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
hres = IOleInPlaceSite_QueryInterface(This->doc_obj->ipsite, &IID_IOleInPlaceSiteEx, (void**)&ipsiteex);
|
2008-04-11 12:45:31 +00:00
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
IOleInPlaceSiteEx_OnInPlaceDeactivateEx(ipsiteex, TRUE);
|
|
|
|
IOleInPlaceSiteEx_Release(ipsiteex);
|
|
|
|
}else {
|
2009-10-20 19:28:02 +00:00
|
|
|
IOleInPlaceSite_OnInPlaceDeactivate(This->doc_obj->ipsite);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceObjectWindowless_UIDeactivate(IOleInPlaceObjectWindowless *iface)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceObjectWindowless_SetObjectRects(IOleInPlaceObjectWindowless *iface,
|
|
|
|
LPCRECT lprcPosRect, LPCRECT lprcClipRect)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
FIXME("(%p)->(%p %p)\n", This, lprcPosRect, lprcClipRect);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceObjectWindowless *iface)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceObjectWindowless_OnWindowMessage(IOleInPlaceObjectWindowless *iface,
|
|
|
|
UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *lpResult)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
FIXME("(%p)->(%u %lu %lu %p)\n", This, msg, wParam, lParam, lpResult);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceObjectWindowless_GetDropTarget(IOleInPlaceObjectWindowless *iface,
|
|
|
|
IDropTarget **ppDropTarget)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, ppDropTarget);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IOleInPlaceObjectWindowlessVtbl OleInPlaceObjectWindowlessVtbl = {
|
|
|
|
OleInPlaceObjectWindowless_QueryInterface,
|
|
|
|
OleInPlaceObjectWindowless_AddRef,
|
|
|
|
OleInPlaceObjectWindowless_Release,
|
|
|
|
OleInPlaceObjectWindowless_GetWindow,
|
|
|
|
OleInPlaceObjectWindowless_ContextSensitiveHelp,
|
|
|
|
OleInPlaceObjectWindowless_InPlaceDeactivate,
|
|
|
|
OleInPlaceObjectWindowless_UIDeactivate,
|
|
|
|
OleInPlaceObjectWindowless_SetObjectRects,
|
|
|
|
OleInPlaceObjectWindowless_ReactivateAndUndo,
|
|
|
|
OleInPlaceObjectWindowless_OnWindowMessage,
|
|
|
|
OleInPlaceObjectWindowless_GetDropTarget
|
|
|
|
};
|
|
|
|
|
|
|
|
void HTMLDocument_Window_Init(HTMLDocument *This)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
This->IOleInPlaceActiveObject_iface.lpVtbl = &OleInPlaceActiveObjectVtbl;
|
|
|
|
This->IOleInPlaceObjectWindowless_iface.lpVtbl = &OleInPlaceObjectWindowlessVtbl;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|