2005-06-28 10:53:42 +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
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-06-28 10:53:42 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
#include "mshtml_private.h"
|
2005-08-26 08:46:37 +00:00
|
|
|
#include "resource.h"
|
2005-06-28 10:53:42 +00:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* IOleInPlaceActiveObject implementation
|
|
|
|
*/
|
|
|
|
|
2005-07-13 11:29:53 +00:00
|
|
|
#define ACTOBJ_THIS(iface) DEFINE_THIS(HTMLDocument, OleInPlaceActiveObject, iface)
|
2005-06-28 10:53:42 +00:00
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject *iface, REFIID riid, void **ppvObject)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = ACTOBJ_THIS(iface);
|
2005-06-28 10:53:42 +00:00
|
|
|
return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OleInPlaceActiveObject_AddRef(IOleInPlaceActiveObject *iface)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = ACTOBJ_THIS(iface);
|
2005-06-28 10:53:42 +00:00
|
|
|
return IHTMLDocument2_AddRef(HTMLDOC(This));
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OleInPlaceActiveObject_Release(IOleInPlaceActiveObject *iface)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = ACTOBJ_THIS(iface);
|
2005-06-28 10:53:42 +00:00
|
|
|
return IHTMLDocument2_Release(HTMLDOC(This));
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *iface, HWND *phwnd)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = ACTOBJ_THIS(iface);
|
|
|
|
|
2005-06-28 10:53:42 +00:00
|
|
|
TRACE("(%p)->(%p)\n", This, phwnd);
|
|
|
|
|
|
|
|
if(!phwnd)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2005-07-18 09:13:32 +00:00
|
|
|
if(!This->in_place_active) {
|
|
|
|
*phwnd = NULL;
|
2005-07-14 10:14:33 +00:00
|
|
|
return E_FAIL;
|
2005-07-18 09:13:32 +00:00
|
|
|
}
|
2005-07-14 10:14:33 +00:00
|
|
|
|
2005-06-28 10:53:42 +00:00
|
|
|
*phwnd = This->hwnd;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject *iface, BOOL fEnterMode)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = ACTOBJ_THIS(iface);
|
2005-06-28 10:53:42 +00:00
|
|
|
FIXME("(%p)->(%x)\n", This, fEnterMode);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject *iface, LPMSG lpmsg)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = ACTOBJ_THIS(iface);
|
2005-06-28 10:53:42 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, lpmsg);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2006-07-08 14:11:25 +00:00
|
|
|
static HRESULT WINAPI OleInPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject *iface,
|
|
|
|
BOOL fActivate)
|
2005-06-28 10:53:42 +00:00
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = ACTOBJ_THIS(iface);
|
2006-07-08 14:11:25 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%x)\n", This, fActivate);
|
|
|
|
|
|
|
|
if(This->hostui)
|
|
|
|
IDocHostUIHandler_OnFrameWindowActivate(This->hostui, fActivate);
|
|
|
|
|
|
|
|
return S_OK;
|
2005-06-28 10:53:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject *iface, BOOL fActivate)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = ACTOBJ_THIS(iface);
|
2005-06-28 10:53:42 +00:00
|
|
|
FIXME("(%p)->(%x)\n", This, fActivate);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject *iface, LPCRECT prcBorder,
|
|
|
|
IOleInPlaceUIWindow *pUIWindow, BOOL fFrameWindow)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = ACTOBJ_THIS(iface);
|
2005-06-28 10:53:42 +00:00
|
|
|
FIXME("(%p)->(%p %p %x)\n", This, prcBorder, pUIWindow, fFrameWindow);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject *iface, BOOL fEnable)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = ACTOBJ_THIS(iface);
|
2005-06-28 10:53:42 +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
|
|
|
|
};
|
|
|
|
|
|
|
|
#undef ACTOBJ_THIS
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* IOleInPlaceObjectWindowless implementation
|
|
|
|
*/
|
|
|
|
|
2005-07-13 11:29:53 +00:00
|
|
|
#define OLEINPLACEWND_THIS(iface) DEFINE_THIS(HTMLDocument, OleInPlaceObjectWindowless, iface)
|
2005-06-28 10:53:42 +00:00
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceObjectWindowless_QueryInterface(IOleInPlaceObjectWindowless *iface,
|
|
|
|
REFIID riid, void **ppvObject)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = OLEINPLACEWND_THIS(iface);
|
2005-06-28 10:53:42 +00:00
|
|
|
return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OleInPlaceObjectWindowless_AddRef(IOleInPlaceObjectWindowless *iface)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = OLEINPLACEWND_THIS(iface);
|
2005-06-28 10:53:42 +00:00
|
|
|
return IHTMLDocument2_AddRef(HTMLDOC(This));
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OleInPlaceObjectWindowless_Release(IOleInPlaceObjectWindowless *iface)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = OLEINPLACEWND_THIS(iface);
|
2005-06-28 10:53:42 +00:00
|
|
|
return IHTMLDocument2_Release(HTMLDOC(This));
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceObjectWindowless_GetWindow(IOleInPlaceObjectWindowless *iface,
|
|
|
|
HWND *phwnd)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = OLEINPLACEWND_THIS(iface);
|
2005-06-28 10:53:42 +00:00
|
|
|
return IOleWindow_GetWindow(OLEWIN(This), phwnd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceObjectWindowless_ContextSensitiveHelp(IOleInPlaceObjectWindowless *iface,
|
|
|
|
BOOL fEnterMode)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = OLEINPLACEWND_THIS(iface);
|
2005-06-28 10:53:42 +00:00
|
|
|
return IOleWindow_ContextSensitiveHelp(OLEWIN(This), fEnterMode);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceObjectWindowless *iface)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = OLEINPLACEWND_THIS(iface);
|
2005-07-14 10:14:33 +00:00
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
2005-08-16 11:13:01 +00:00
|
|
|
if(This->ui_active)
|
|
|
|
IOleDocumentView_UIActivate(DOCVIEW(This), FALSE);
|
|
|
|
This->window_active = FALSE;
|
|
|
|
|
2005-07-14 10:14:33 +00:00
|
|
|
if(!This->in_place_active)
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
if(This->frame)
|
|
|
|
IOleInPlaceFrame_Release(This->frame);
|
|
|
|
|
|
|
|
if(This->hwnd) {
|
|
|
|
ShowWindow(This->hwnd, SW_HIDE);
|
|
|
|
SetWindowPos(This->hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
|
|
|
|
}
|
|
|
|
|
|
|
|
This->in_place_active = FALSE;
|
|
|
|
if(This->ipsite)
|
|
|
|
IOleInPlaceSite_OnInPlaceDeactivate(This->ipsite);
|
|
|
|
|
|
|
|
return S_OK;
|
2005-06-28 10:53:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceObjectWindowless_UIDeactivate(IOleInPlaceObjectWindowless *iface)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = OLEINPLACEWND_THIS(iface);
|
2005-06-28 10:53:42 +00:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceObjectWindowless_SetObjectRects(IOleInPlaceObjectWindowless *iface,
|
|
|
|
LPCRECT lprcPosRect, LPCRECT lprcClipRect)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = OLEINPLACEWND_THIS(iface);
|
2005-06-28 10:53:42 +00:00
|
|
|
FIXME("(%p)->(%p %p)\n", This, lprcPosRect, lprcClipRect);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceObjectWindowless *iface)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = OLEINPLACEWND_THIS(iface);
|
2005-06-28 10:53:42 +00:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceObjectWindowless_OnWindowMessage(IOleInPlaceObjectWindowless *iface,
|
|
|
|
UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *lpResult)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = OLEINPLACEWND_THIS(iface);
|
2007-05-24 14:41:17 +00:00
|
|
|
FIXME("(%p)->(%u %lu %lu %p)\n", This, msg, wParam, lParam, lpResult);
|
2005-06-28 10:53:42 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleInPlaceObjectWindowless_GetDropTarget(IOleInPlaceObjectWindowless *iface,
|
|
|
|
IDropTarget **ppDropTarget)
|
|
|
|
{
|
2005-07-13 11:29:53 +00:00
|
|
|
HTMLDocument *This = OLEINPLACEWND_THIS(iface);
|
2005-06-28 10:53:42 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, ppDropTarget);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2005-09-02 11:18:17 +00:00
|
|
|
static const IOleInPlaceObjectWindowlessVtbl OleInPlaceObjectWindowlessVtbl = {
|
2005-06-28 10:53:42 +00:00
|
|
|
OleInPlaceObjectWindowless_QueryInterface,
|
|
|
|
OleInPlaceObjectWindowless_AddRef,
|
|
|
|
OleInPlaceObjectWindowless_Release,
|
|
|
|
OleInPlaceObjectWindowless_GetWindow,
|
|
|
|
OleInPlaceObjectWindowless_ContextSensitiveHelp,
|
|
|
|
OleInPlaceObjectWindowless_InPlaceDeactivate,
|
|
|
|
OleInPlaceObjectWindowless_UIDeactivate,
|
|
|
|
OleInPlaceObjectWindowless_SetObjectRects,
|
|
|
|
OleInPlaceObjectWindowless_ReactivateAndUndo,
|
|
|
|
OleInPlaceObjectWindowless_OnWindowMessage,
|
|
|
|
OleInPlaceObjectWindowless_GetDropTarget
|
|
|
|
};
|
|
|
|
|
|
|
|
#undef INPLACEWIN_THIS
|
|
|
|
|
2005-08-25 19:24:58 +00:00
|
|
|
void HTMLDocument_ShowContextMenu(HTMLDocument *This, DWORD dwID, POINT *ppt)
|
|
|
|
{
|
2005-08-26 08:46:37 +00:00
|
|
|
HMENU menu_res, menu;
|
2005-08-25 19:24:58 +00:00
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IDocHostUIHandler_ShowContextMenu(This->hostui, dwID, ppt,
|
|
|
|
(IUnknown*)CMDTARGET(This), (IDispatch*)HTMLDOC(This));
|
|
|
|
if(hres == S_OK)
|
|
|
|
return;
|
|
|
|
|
2006-11-09 22:54:09 +00:00
|
|
|
menu_res = LoadMenuW(get_shdoclc(), MAKEINTRESOURCEW(IDR_BROWSE_CONTEXT_MENU));
|
2005-08-26 08:46:37 +00:00
|
|
|
menu = GetSubMenu(menu_res, dwID);
|
|
|
|
|
|
|
|
TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD,
|
|
|
|
ppt->x, ppt->y, 0, This->hwnd, NULL);
|
|
|
|
|
|
|
|
DestroyMenu(menu_res);
|
2005-08-25 19:24:58 +00:00
|
|
|
}
|
|
|
|
|
2005-06-28 10:53:42 +00:00
|
|
|
void HTMLDocument_Window_Init(HTMLDocument *This)
|
|
|
|
{
|
|
|
|
This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl;
|
|
|
|
This->lpOleInPlaceObjectWindowlessVtbl = &OleInPlaceObjectWindowlessVtbl;
|
|
|
|
}
|