2002-05-05 21:40:57 +02:00
|
|
|
/*
|
2005-09-06 13:41:14 +02:00
|
|
|
* Implementation of IOleObject interfaces for WebBrowser control
|
2002-05-05 21:40:57 +02:00
|
|
|
*
|
|
|
|
* - IOleObject
|
|
|
|
* - IOleInPlaceObject
|
|
|
|
* - IOleControl
|
|
|
|
*
|
|
|
|
* Copyright 2001 John R. Sheets (for CodeWeavers)
|
2005-09-06 13:41:14 +02:00
|
|
|
* Copyright 2005 Jacek Caban
|
2002-05-05 21:40:57 +02:00
|
|
|
*
|
|
|
|
* 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 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-05-05 21:40:57 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
2011-07-27 14:46:48 +02:00
|
|
|
|
|
|
|
#include "ieframe.h"
|
|
|
|
|
2006-07-07 15:15:24 +02:00
|
|
|
#include "htiframe.h"
|
2006-11-05 17:40:37 +01:00
|
|
|
#include "idispids.h"
|
2009-06-22 08:39:20 +02:00
|
|
|
#include "mshtmdid.h"
|
2002-05-05 21:40:57 +02:00
|
|
|
|
2011-07-27 14:46:48 +02:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
2011-07-29 12:18:33 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ieframe);
|
2002-05-05 21:40:57 +02:00
|
|
|
|
2006-11-05 17:38:16 +01:00
|
|
|
/* shlwapi.dll */
|
|
|
|
HWND WINAPI SHSetParentHwnd(HWND hWnd, HWND hWndParent);
|
|
|
|
|
2005-11-22 12:59:57 +01:00
|
|
|
static ATOM shell_embedding_atom = 0;
|
|
|
|
|
2005-12-02 11:25:30 +01:00
|
|
|
static LRESULT resize_window(WebBrowser *This, LONG width, LONG height)
|
|
|
|
{
|
2006-04-18 00:26:47 +02:00
|
|
|
if(This->doc_host.hwnd)
|
|
|
|
SetWindowPos(This->doc_host.hwnd, NULL, 0, 0, width, height,
|
2005-12-02 11:25:30 +01:00
|
|
|
SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-11-22 12:59:57 +01:00
|
|
|
static LRESULT WINAPI shell_embedding_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2005-12-02 11:25:30 +01:00
|
|
|
WebBrowser *This;
|
|
|
|
|
|
|
|
static const WCHAR wszTHIS[] = {'T','H','I','S',0};
|
|
|
|
|
|
|
|
if(msg == WM_CREATE) {
|
|
|
|
This = *(WebBrowser**)lParam;
|
|
|
|
SetPropW(hwnd, wszTHIS, This);
|
|
|
|
}else {
|
|
|
|
This = GetPropW(hwnd, wszTHIS);
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(msg) {
|
|
|
|
case WM_SIZE:
|
|
|
|
return resize_window(This, LOWORD(lParam), HIWORD(lParam));
|
2008-01-18 21:53:25 +01:00
|
|
|
case WM_DOCHOSTTASK:
|
2011-05-26 17:01:42 +02:00
|
|
|
return process_dochost_tasks(&This->doc_host);
|
2005-12-02 11:25:30 +01:00
|
|
|
}
|
|
|
|
|
2006-04-14 14:40:33 +02:00
|
|
|
return DefWindowProcW(hwnd, msg, wParam, lParam);
|
2005-11-22 12:59:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void create_shell_embedding_hwnd(WebBrowser *This)
|
|
|
|
{
|
|
|
|
IOleInPlaceSite *inplace;
|
|
|
|
HWND parent = NULL;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
static const WCHAR wszShellEmbedding[] =
|
|
|
|
{'S','h','e','l','l',' ','E','m','b','e','d','d','i','n','g',0};
|
|
|
|
|
|
|
|
if(!shell_embedding_atom) {
|
|
|
|
static WNDCLASSEXW wndclass = {
|
|
|
|
sizeof(wndclass),
|
|
|
|
CS_DBLCLKS,
|
|
|
|
shell_embedding_proc,
|
|
|
|
0, 0 /* native uses 8 */, NULL, NULL, NULL,
|
2008-11-12 08:15:51 +01:00
|
|
|
(HBRUSH)(COLOR_WINDOW + 1), NULL,
|
2005-11-22 12:59:57 +01:00
|
|
|
wszShellEmbedding,
|
|
|
|
NULL
|
|
|
|
};
|
2011-07-27 14:46:48 +02:00
|
|
|
wndclass.hInstance = ieframe_instance;
|
2005-11-22 12:59:57 +01:00
|
|
|
|
|
|
|
RegisterClassExW(&wndclass);
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = IOleClientSite_QueryInterface(This->client, &IID_IOleInPlaceSite, (void**)&inplace);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
IOleInPlaceSite_GetWindow(inplace, &parent);
|
|
|
|
IOleInPlaceSite_Release(inplace);
|
|
|
|
}
|
|
|
|
|
2006-04-18 00:26:47 +02:00
|
|
|
This->doc_host.frame_hwnd = This->shell_embedding_hwnd = CreateWindowExW(
|
2006-04-14 14:40:33 +02:00
|
|
|
WS_EX_WINDOWEDGE,
|
|
|
|
wszShellEmbedding, wszShellEmbedding,
|
2006-10-21 22:54:38 +02:00
|
|
|
WS_CLIPSIBLINGS | WS_CLIPCHILDREN
|
|
|
|
| (parent ? WS_CHILD | WS_TABSTOP : WS_POPUP | WS_MAXIMIZEBOX),
|
2006-04-14 14:40:33 +02:00
|
|
|
0, 0, 0, 0, parent,
|
2011-07-27 14:46:48 +02:00
|
|
|
NULL, ieframe_instance, This);
|
2006-10-21 22:54:38 +02:00
|
|
|
|
|
|
|
TRACE("parent=%p hwnd=%p\n", parent, This->shell_embedding_hwnd);
|
2005-11-22 12:59:57 +01:00
|
|
|
}
|
|
|
|
|
2006-11-05 17:39:13 +01:00
|
|
|
static HRESULT activate_inplace(WebBrowser *This, IOleClientSite *active_site)
|
2006-05-23 20:04:56 +02:00
|
|
|
{
|
2006-11-05 17:39:13 +01:00
|
|
|
HWND parent_hwnd;
|
2006-05-23 20:04:56 +02:00
|
|
|
HRESULT hres;
|
|
|
|
|
2006-05-23 20:06:55 +02:00
|
|
|
if(This->inplace)
|
|
|
|
return S_OK;
|
|
|
|
|
2006-05-23 20:04:56 +02:00
|
|
|
if(!active_site)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
hres = IOleClientSite_QueryInterface(active_site, &IID_IOleInPlaceSite,
|
|
|
|
(void**)&This->inplace);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
WARN("Could not get IOleInPlaceSite\n");
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = IOleInPlaceSite_CanInPlaceActivate(This->inplace);
|
|
|
|
if(hres != S_OK) {
|
2006-10-05 23:49:39 +02:00
|
|
|
WARN("CanInPlaceActivate returned: %08x\n", hres);
|
2006-05-23 20:04:56 +02:00
|
|
|
IOleInPlaceSite_Release(This->inplace);
|
2011-08-01 12:28:34 +02:00
|
|
|
This->inplace = NULL;
|
2006-05-23 20:04:56 +02:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2006-11-05 17:38:16 +01:00
|
|
|
hres = IOleInPlaceSite_GetWindow(This->inplace, &parent_hwnd);
|
|
|
|
if(SUCCEEDED(hres))
|
|
|
|
SHSetParentHwnd(This->shell_embedding_hwnd, parent_hwnd);
|
2006-05-23 20:04:56 +02:00
|
|
|
|
|
|
|
IOleInPlaceSite_OnInPlaceActivate(This->inplace);
|
|
|
|
|
2011-03-16 15:14:19 +01:00
|
|
|
This->frameinfo.cb = sizeof(OLEINPLACEFRAMEINFO);
|
2007-03-09 16:56:02 +01:00
|
|
|
IOleInPlaceSite_GetWindowContext(This->inplace, &This->doc_host.frame, &This->uiwindow,
|
2006-05-23 20:04:56 +02:00
|
|
|
&This->pos_rect, &This->clip_rect,
|
|
|
|
&This->frameinfo);
|
|
|
|
|
|
|
|
SetWindowPos(This->shell_embedding_hwnd, NULL,
|
|
|
|
This->pos_rect.left, This->pos_rect.top,
|
|
|
|
This->pos_rect.right-This->pos_rect.left,
|
|
|
|
This->pos_rect.bottom-This->pos_rect.top,
|
|
|
|
SWP_NOZORDER | SWP_SHOWWINDOW);
|
|
|
|
|
|
|
|
if(This->client) {
|
2009-08-07 19:02:31 +02:00
|
|
|
IOleContainer *container;
|
|
|
|
|
2006-05-23 20:04:56 +02:00
|
|
|
IOleClientSite_ShowObject(This->client);
|
2009-08-07 19:02:31 +02:00
|
|
|
|
|
|
|
hres = IOleClientSite_GetContainer(This->client, &container);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
if(This->container)
|
|
|
|
IOleContainer_Release(This->container);
|
|
|
|
This->container = container;
|
|
|
|
}
|
2006-05-23 20:04:56 +02:00
|
|
|
}
|
|
|
|
|
2007-03-09 16:56:02 +01:00
|
|
|
if(This->doc_host.frame)
|
|
|
|
IOleInPlaceFrame_GetWindow(This->doc_host.frame, &This->frame_hwnd);
|
2006-05-23 20:04:56 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-11-05 17:39:13 +01:00
|
|
|
static HRESULT activate_ui(WebBrowser *This, IOleClientSite *active_site)
|
2006-05-23 20:05:58 +02:00
|
|
|
{
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
static const WCHAR wszitem[] = {'i','t','e','m',0};
|
|
|
|
|
2006-05-23 20:06:55 +02:00
|
|
|
if(This->inplace)
|
2008-01-06 20:06:44 +01:00
|
|
|
{
|
|
|
|
if(This->shell_embedding_hwnd)
|
|
|
|
ShowWindow(This->shell_embedding_hwnd, SW_SHOW);
|
2006-05-23 20:06:55 +02:00
|
|
|
return S_OK;
|
2008-01-06 20:06:44 +01:00
|
|
|
}
|
2006-05-23 20:06:55 +02:00
|
|
|
|
2006-11-05 17:39:13 +01:00
|
|
|
hres = activate_inplace(This, active_site);
|
2006-05-23 20:05:58 +02:00
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
IOleInPlaceSite_OnUIActivate(This->inplace);
|
|
|
|
|
2007-03-09 16:56:02 +01:00
|
|
|
if(This->doc_host.frame)
|
2010-11-13 17:47:31 +01:00
|
|
|
IOleInPlaceFrame_SetActiveObject(This->doc_host.frame, &This->IOleInPlaceActiveObject_iface, wszitem);
|
2006-05-23 20:05:58 +02:00
|
|
|
if(This->uiwindow)
|
2010-11-13 17:47:31 +01:00
|
|
|
IOleInPlaceUIWindow_SetActiveObject(This->uiwindow, &This->IOleInPlaceActiveObject_iface, wszitem);
|
2006-05-23 20:05:58 +02:00
|
|
|
|
2007-03-09 16:56:02 +01:00
|
|
|
if(This->doc_host.frame)
|
|
|
|
IOleInPlaceFrame_SetMenu(This->doc_host.frame, NULL, NULL, This->shell_embedding_hwnd);
|
2006-05-23 20:05:58 +02:00
|
|
|
|
2006-06-03 00:58:53 +02:00
|
|
|
SetFocus(This->shell_embedding_hwnd);
|
|
|
|
|
2006-05-23 20:05:58 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-11-05 17:40:37 +01:00
|
|
|
static HRESULT get_client_disp_property(IOleClientSite *client, DISPID dispid, VARIANT *res)
|
|
|
|
{
|
|
|
|
IDispatch *disp = NULL;
|
|
|
|
DISPPARAMS dispparams = {NULL, 0};
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
VariantInit(res);
|
|
|
|
|
|
|
|
if(!client)
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
hres = IOleClientSite_QueryInterface(client, &IID_IDispatch, (void**)&disp);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
TRACE("Could not get IDispatch\n");
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = IDispatch_Invoke(disp, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
|
|
|
|
DISPATCH_PROPERTYGET, &dispparams, res, NULL, NULL);
|
|
|
|
|
|
|
|
IDispatch_Release(disp);
|
|
|
|
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2006-11-05 17:46:54 +01:00
|
|
|
static HRESULT on_offlineconnected_change(WebBrowser *This)
|
|
|
|
{
|
|
|
|
VARIANT offline;
|
|
|
|
|
|
|
|
get_client_disp_property(This->client, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED, &offline);
|
|
|
|
|
|
|
|
if(V_VT(&offline) == VT_BOOL)
|
2010-11-13 17:47:05 +01:00
|
|
|
IWebBrowser2_put_Offline(&This->IWebBrowser2_iface, V_BOOL(&offline));
|
2006-11-05 17:46:54 +01:00
|
|
|
else if(V_VT(&offline) != VT_EMPTY)
|
|
|
|
WARN("wrong V_VT(silent) %d\n", V_VT(&offline));
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-11-05 17:40:37 +01:00
|
|
|
static HRESULT on_silent_change(WebBrowser *This)
|
|
|
|
{
|
|
|
|
VARIANT silent;
|
|
|
|
|
|
|
|
get_client_disp_property(This->client, DISPID_AMBIENT_SILENT, &silent);
|
|
|
|
|
|
|
|
if(V_VT(&silent) == VT_BOOL)
|
2010-11-13 17:47:05 +01:00
|
|
|
IWebBrowser2_put_Silent(&This->IWebBrowser2_iface, V_BOOL(&silent));
|
2006-11-05 17:40:37 +01:00
|
|
|
else if(V_VT(&silent) != VT_EMPTY)
|
|
|
|
WARN("wrong V_VT(silent) %d\n", V_VT(&silent));
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-01-22 17:12:57 +01:00
|
|
|
static void release_client_site(WebBrowser *This)
|
|
|
|
{
|
|
|
|
release_dochost_client(&This->doc_host);
|
|
|
|
|
|
|
|
if(This->shell_embedding_hwnd) {
|
|
|
|
DestroyWindow(This->shell_embedding_hwnd);
|
|
|
|
This->shell_embedding_hwnd = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(This->inplace) {
|
|
|
|
IOleInPlaceSite_Release(This->inplace);
|
|
|
|
This->inplace = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(This->container) {
|
|
|
|
IOleContainer_Release(This->container);
|
|
|
|
This->container = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(This->uiwindow) {
|
|
|
|
IOleInPlaceUIWindow_Release(This->uiwindow);
|
|
|
|
This->uiwindow = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(This->client) {
|
|
|
|
IOleClientSite_Release(This->client);
|
|
|
|
This->client = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-15 13:10:37 +01:00
|
|
|
typedef struct {
|
|
|
|
IEnumOLEVERB IEnumOLEVERB_iface;
|
|
|
|
|
|
|
|
LONG ref;
|
|
|
|
} EnumOLEVERB;
|
|
|
|
|
|
|
|
static inline EnumOLEVERB *impl_from_IEnumOLEVERB(IEnumOLEVERB *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, EnumOLEVERB, IEnumOLEVERB_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumOLEVERB_QueryInterface(IEnumOLEVERB *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
EnumOLEVERB *This = impl_from_IEnumOLEVERB(iface);
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
|
|
|
|
*ppv = &This->IEnumOLEVERB_iface;
|
|
|
|
}else if(IsEqualGUID(&IID_IEnumOLEVERB, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IEnumOLEVERB %p)\n", This, ppv);
|
|
|
|
*ppv = &This->IEnumOLEVERB_iface;
|
|
|
|
}else {
|
|
|
|
WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
|
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI EnumOLEVERB_AddRef(IEnumOLEVERB *iface)
|
|
|
|
{
|
|
|
|
EnumOLEVERB *This = impl_from_IEnumOLEVERB(iface);
|
|
|
|
LONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI EnumOLEVERB_Release(IEnumOLEVERB *iface)
|
|
|
|
{
|
|
|
|
EnumOLEVERB *This = impl_from_IEnumOLEVERB(iface);
|
|
|
|
LONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
|
|
|
|
|
|
|
if(!ref)
|
|
|
|
heap_free(This);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumOLEVERB_Next(IEnumOLEVERB *iface, ULONG celt, OLEVERB *rgelt, ULONG *pceltFetched)
|
|
|
|
{
|
|
|
|
EnumOLEVERB *This = impl_from_IEnumOLEVERB(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)->(%u %p %p)\n", This, celt, rgelt, pceltFetched);
|
|
|
|
|
|
|
|
if(pceltFetched)
|
|
|
|
*pceltFetched = 0;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumOLEVERB_Skip(IEnumOLEVERB *iface, ULONG celt)
|
|
|
|
{
|
|
|
|
EnumOLEVERB *This = impl_from_IEnumOLEVERB(iface);
|
|
|
|
TRACE("(%p)->(%u)\n", This, celt);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumOLEVERB_Reset(IEnumOLEVERB *iface)
|
|
|
|
{
|
|
|
|
EnumOLEVERB *This = impl_from_IEnumOLEVERB(iface);
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumOLEVERB_Clone(IEnumOLEVERB *iface, IEnumOLEVERB **ppenum)
|
|
|
|
{
|
|
|
|
EnumOLEVERB *This = impl_from_IEnumOLEVERB(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, ppenum);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IEnumOLEVERBVtbl EnumOLEVERBVtbl = {
|
|
|
|
EnumOLEVERB_QueryInterface,
|
|
|
|
EnumOLEVERB_AddRef,
|
|
|
|
EnumOLEVERB_Release,
|
|
|
|
EnumOLEVERB_Next,
|
|
|
|
EnumOLEVERB_Skip,
|
|
|
|
EnumOLEVERB_Reset,
|
|
|
|
EnumOLEVERB_Clone
|
|
|
|
};
|
|
|
|
|
2005-06-12 12:42:03 +02:00
|
|
|
/**********************************************************************
|
2005-09-06 13:41:14 +02:00
|
|
|
* Implement the IOleObject interface for the WebBrowser control
|
2005-06-12 12:42:03 +02:00
|
|
|
*/
|
|
|
|
|
2010-11-13 17:47:31 +01:00
|
|
|
static inline WebBrowser *impl_from_IOleObject(IOleObject *iface)
|
|
|
|
{
|
2010-11-24 14:06:38 +01:00
|
|
|
return CONTAINING_RECORD(iface, WebBrowser, IOleObject_iface);
|
2010-11-13 17:47:31 +01:00
|
|
|
}
|
2005-06-12 12:42:03 +02:00
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **ppv)
|
2005-06-12 12:42:03 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2010-11-13 17:47:05 +01:00
|
|
|
return IWebBrowser_QueryInterface(&This->IWebBrowser2_iface, riid, ppv);
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static ULONG WINAPI OleObject_AddRef(IOleObject *iface)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2010-11-13 17:47:05 +01:00
|
|
|
return IWebBrowser_AddRef(&This->IWebBrowser2_iface);
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static ULONG WINAPI OleObject_Release(IOleObject *iface)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2010-11-13 17:47:05 +01:00
|
|
|
return IWebBrowser_Release(&This->IWebBrowser2_iface);
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE pClientSite)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2009-11-17 21:32:22 +01:00
|
|
|
IDocHostUIHandler *hostui;
|
2006-07-07 15:15:24 +02:00
|
|
|
IOleContainer *container;
|
2009-11-17 21:32:22 +01:00
|
|
|
IDispatch *disp;
|
2006-01-25 13:14:57 +01:00
|
|
|
HRESULT hres;
|
2005-09-16 20:44:37 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, pClientSite);
|
|
|
|
|
|
|
|
if(This->client == pClientSite)
|
|
|
|
return S_OK;
|
|
|
|
|
2010-01-22 17:12:57 +01:00
|
|
|
release_client_site(This);
|
2007-03-09 16:54:26 +01:00
|
|
|
|
2006-01-18 13:22:52 +01:00
|
|
|
if(!pClientSite) {
|
2006-04-18 00:31:22 +02:00
|
|
|
if(This->doc_host.document)
|
2006-04-18 00:39:15 +02:00
|
|
|
deactivate_document(&This->doc_host);
|
2005-11-22 12:59:57 +01:00
|
|
|
return S_OK;
|
2006-01-18 13:22:52 +01:00
|
|
|
}
|
2005-12-01 11:36:52 +01:00
|
|
|
|
2005-11-22 12:59:57 +01:00
|
|
|
IOleClientSite_AddRef(pClientSite);
|
2010-01-22 17:12:57 +01:00
|
|
|
This->client = pClientSite;
|
2005-11-22 12:59:57 +01:00
|
|
|
|
2009-11-17 21:32:22 +01:00
|
|
|
hres = IOleClientSite_QueryInterface(This->client, &IID_IDispatch,
|
|
|
|
(void**)&disp);
|
|
|
|
if(SUCCEEDED(hres))
|
|
|
|
This->doc_host.client_disp = disp;
|
2007-03-09 16:50:01 +01:00
|
|
|
|
2009-11-17 21:32:22 +01:00
|
|
|
hres = IOleClientSite_QueryInterface(This->client, &IID_IDocHostUIHandler,
|
|
|
|
(void**)&hostui);
|
|
|
|
if(SUCCEEDED(hres))
|
|
|
|
This->doc_host.hostui = hostui;
|
2006-01-25 13:14:57 +01:00
|
|
|
|
2006-07-07 15:15:24 +02:00
|
|
|
hres = IOleClientSite_GetContainer(This->client, &container);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
ITargetContainer *target_container;
|
|
|
|
|
|
|
|
hres = IOleContainer_QueryInterface(container, &IID_ITargetContainer,
|
|
|
|
(void**)&target_container);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
FIXME("Unsupported ITargetContainer\n");
|
|
|
|
ITargetContainer_Release(target_container);
|
|
|
|
}
|
|
|
|
|
|
|
|
IOleContainer_Release(container);
|
|
|
|
}
|
|
|
|
|
2005-11-22 12:59:57 +01:00
|
|
|
create_shell_embedding_hwnd(This);
|
|
|
|
|
2006-11-05 17:47:52 +01:00
|
|
|
on_offlineconnected_change(This);
|
|
|
|
on_silent_change(This);
|
|
|
|
|
2005-09-16 20:44:37 +02:00
|
|
|
return S_OK;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_GetClientSite(IOleObject *iface, LPOLECLIENTSITE *ppClientSite)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2005-09-16 20:44:37 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, ppClientSite);
|
|
|
|
|
|
|
|
if(!ppClientSite)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
if(This->client)
|
|
|
|
IOleClientSite_AddRef(This->client);
|
|
|
|
*ppClientSite = This->client;
|
|
|
|
|
|
|
|
return S_OK;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR szContainerApp,
|
|
|
|
LPCOLESTR szContainerObj)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2007-12-12 02:01:11 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s, %s)\n", This, debugstr_w(szContainerApp), debugstr_w(szContainerObj));
|
|
|
|
|
|
|
|
/* We have nothing to do here. */
|
|
|
|
return S_OK;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2011-08-01 12:28:34 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%d)\n", This, dwSaveOption);
|
|
|
|
|
|
|
|
if(dwSaveOption != OLECLOSE_NOSAVE) {
|
|
|
|
FIXME("unimplemnted flag: %x\n", dwSaveOption);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(This->doc_host.frame)
|
|
|
|
IOleInPlaceFrame_SetActiveObject(This->doc_host.frame, NULL, NULL);
|
|
|
|
|
|
|
|
if(This->uiwindow)
|
|
|
|
IOleInPlaceUIWindow_SetActiveObject(This->uiwindow, NULL, NULL);
|
|
|
|
|
|
|
|
if(This->inplace) {
|
|
|
|
IOleInPlaceSite_OnUIDeactivate(This->inplace, FALSE);
|
|
|
|
IOleInPlaceSite_OnInPlaceDeactivate(This->inplace);
|
|
|
|
}
|
|
|
|
|
|
|
|
return IOleObject_SetClientSite(iface, NULL);
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker* pmk)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2006-10-05 23:49:39 +02:00
|
|
|
FIXME("(%p)->(%d, %p)\n", This, dwWhichMoniker, pmk);
|
2005-09-06 13:41:14 +02:00
|
|
|
return E_NOTIMPL;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_GetMoniker(IOleObject *iface, DWORD dwAssign,
|
|
|
|
DWORD dwWhichMoniker, LPMONIKER *ppmk)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2006-10-05 23:49:39 +02:00
|
|
|
FIXME("(%p)->(%d, %d, %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
|
2005-09-06 13:41:14 +02:00
|
|
|
return E_NOTIMPL;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_InitFromData(IOleObject *iface, LPDATAOBJECT pDataObject,
|
|
|
|
BOOL fCreation, DWORD dwReserved)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2006-10-05 23:49:39 +02:00
|
|
|
FIXME("(%p)->(%p, %d, %d)\n", This, pDataObject, fCreation, dwReserved);
|
2005-09-06 13:41:14 +02:00
|
|
|
return E_NOTIMPL;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_GetClipboardData(IOleObject *iface, DWORD dwReserved,
|
|
|
|
LPDATAOBJECT *ppDataObject)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2006-10-05 23:49:39 +02:00
|
|
|
FIXME("(%p)->(%d, %p)\n", This, dwReserved, ppDataObject);
|
2005-09-06 13:41:14 +02:00
|
|
|
return E_NOTIMPL;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, struct tagMSG* lpmsg,
|
|
|
|
LPOLECLIENTSITE pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2005-12-01 12:49:02 +01:00
|
|
|
|
2006-10-05 23:49:39 +02:00
|
|
|
TRACE("(%p)->(%d %p %p %d %p %p)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent,
|
2005-09-06 13:41:14 +02:00
|
|
|
lprcPosRect);
|
2005-11-16 12:46:56 +01:00
|
|
|
|
2002-05-05 21:40:57 +02:00
|
|
|
switch (iVerb)
|
|
|
|
{
|
2006-05-23 20:05:58 +02:00
|
|
|
case OLEIVERB_SHOW:
|
|
|
|
TRACE("OLEIVERB_SHOW\n");
|
2006-11-05 17:39:13 +01:00
|
|
|
return activate_ui(This, pActiveSite);
|
2006-05-23 20:07:45 +02:00
|
|
|
case OLEIVERB_UIACTIVATE:
|
|
|
|
TRACE("OLEIVERB_UIACTIVATE\n");
|
2006-11-05 17:39:13 +01:00
|
|
|
return activate_ui(This, pActiveSite);
|
2006-04-14 14:42:14 +02:00
|
|
|
case OLEIVERB_INPLACEACTIVATE:
|
2005-11-16 12:46:56 +01:00
|
|
|
TRACE("OLEIVERB_INPLACEACTIVATE\n");
|
2006-11-05 17:39:13 +01:00
|
|
|
return activate_inplace(This, pActiveSite);
|
2007-10-31 04:46:36 +01:00
|
|
|
case OLEIVERB_HIDE:
|
|
|
|
TRACE("OLEIVERB_HIDE\n");
|
2008-01-06 20:06:44 +01:00
|
|
|
if(This->shell_embedding_hwnd)
|
|
|
|
ShowWindow(This->shell_embedding_hwnd, SW_HIDE);
|
2007-10-31 04:46:36 +01:00
|
|
|
return S_OK;
|
2005-11-16 12:46:56 +01:00
|
|
|
default:
|
2006-10-05 23:49:39 +02:00
|
|
|
FIXME("stub for %d\n", iVerb);
|
2002-05-05 21:40:57 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
return E_NOTIMPL;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_EnumVerbs(IOleObject *iface, IEnumOLEVERB **ppEnumOleVerb)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2012-03-15 13:10:37 +01:00
|
|
|
EnumOLEVERB *ret;
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
TRACE("(%p)->(%p)\n", This, ppEnumOleVerb);
|
2012-03-15 13:10:37 +01:00
|
|
|
|
|
|
|
ret = heap_alloc(sizeof(*ret));
|
|
|
|
if(!ret)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
ret->IEnumOLEVERB_iface.lpVtbl = &EnumOLEVERBVtbl;
|
|
|
|
ret->ref = 1;
|
|
|
|
|
|
|
|
*ppEnumOleVerb = &ret->IEnumOLEVERB_iface;
|
|
|
|
return S_OK;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_Update(IOleObject *iface)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2005-09-06 13:41:14 +02:00
|
|
|
FIXME("(%p)\n", This);
|
2002-05-05 21:40:57 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_IsUpToDate(IOleObject *iface)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2005-09-06 13:41:14 +02:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_GetUserClassID(IOleObject *iface, CLSID* pClsid)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2005-09-06 13:41:14 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, pClsid);
|
|
|
|
return E_NOTIMPL;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_GetUserType(IOleObject *iface, DWORD dwFormOfType,
|
|
|
|
LPOLESTR* pszUserType)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2006-10-05 23:49:39 +02:00
|
|
|
TRACE("(%p, %d, %p)\n", This, dwFormOfType, pszUserType);
|
2002-05-05 21:40:57 +02:00
|
|
|
return OleRegGetUserType(&CLSID_WebBrowser, dwFormOfType, pszUserType);
|
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2006-07-31 13:22:32 +02:00
|
|
|
|
2006-10-05 23:49:39 +02:00
|
|
|
TRACE("(%p)->(%x %p)\n", This, dwDrawAspect, psizel);
|
2006-07-31 13:22:32 +02:00
|
|
|
|
|
|
|
/* Tests show that dwDrawAspect is ignored */
|
2008-03-17 22:36:56 +01:00
|
|
|
This->extent = *psizel;
|
2006-07-31 13:22:32 +02:00
|
|
|
return S_OK;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2006-07-31 13:22:32 +02:00
|
|
|
|
2006-10-05 23:49:39 +02:00
|
|
|
TRACE("(%p)->(%x, %p)\n", This, dwDrawAspect, psizel);
|
2006-07-31 13:22:32 +02:00
|
|
|
|
|
|
|
/* Tests show that dwDrawAspect is ignored */
|
2008-03-17 22:36:56 +01:00
|
|
|
*psizel = This->extent;
|
2006-07-31 13:22:32 +02:00
|
|
|
return S_OK;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *pAdvSink,
|
|
|
|
DWORD* pdwConnection)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2005-09-06 13:41:14 +02:00
|
|
|
FIXME("(%p)->(%p, %p)\n", This, pAdvSink, pdwConnection);
|
|
|
|
return E_NOTIMPL;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_Unadvise(IOleObject *iface, DWORD dwConnection)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2006-10-05 23:49:39 +02:00
|
|
|
FIXME("(%p)->(%d)\n", This, dwConnection);
|
2005-09-06 13:41:14 +02:00
|
|
|
return E_NOTIMPL;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_EnumAdvise(IOleObject *iface, IEnumSTATDATA **ppenumAdvise)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2005-09-06 13:41:14 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, ppenumAdvise);
|
2002-05-05 21:40:57 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_GetMiscStatus(IOleObject *iface, DWORD dwAspect, DWORD *pdwStatus)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2002-05-05 21:40:57 +02:00
|
|
|
|
2006-10-05 23:49:39 +02:00
|
|
|
TRACE("(%p)->(%x, %p)\n", This, dwAspect, pdwStatus);
|
2002-05-05 21:40:57 +02:00
|
|
|
|
2006-04-28 20:08:02 +02:00
|
|
|
*pdwStatus = OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|OLEMISC_INSIDEOUT
|
|
|
|
|OLEMISC_CANTLINKINSIDE|OLEMISC_RECOMPOSEONRESIZE;
|
2002-05-05 21:40:57 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static HRESULT WINAPI OleObject_SetColorScheme(IOleObject *iface, LOGPALETTE* pLogpal)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleObject(iface);
|
2005-09-06 13:41:14 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, pLogpal);
|
|
|
|
return E_NOTIMPL;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
static const IOleObjectVtbl OleObjectVtbl =
|
|
|
|
{
|
|
|
|
OleObject_QueryInterface,
|
|
|
|
OleObject_AddRef,
|
|
|
|
OleObject_Release,
|
|
|
|
OleObject_SetClientSite,
|
|
|
|
OleObject_GetClientSite,
|
|
|
|
OleObject_SetHostNames,
|
|
|
|
OleObject_Close,
|
|
|
|
OleObject_SetMoniker,
|
|
|
|
OleObject_GetMoniker,
|
|
|
|
OleObject_InitFromData,
|
|
|
|
OleObject_GetClipboardData,
|
|
|
|
OleObject_DoVerb,
|
|
|
|
OleObject_EnumVerbs,
|
|
|
|
OleObject_Update,
|
|
|
|
OleObject_IsUpToDate,
|
|
|
|
OleObject_GetUserClassID,
|
|
|
|
OleObject_GetUserType,
|
|
|
|
OleObject_SetExtent,
|
|
|
|
OleObject_GetExtent,
|
|
|
|
OleObject_Advise,
|
|
|
|
OleObject_Unadvise,
|
|
|
|
OleObject_EnumAdvise,
|
|
|
|
OleObject_GetMiscStatus,
|
|
|
|
OleObject_SetColorScheme
|
2002-05-05 21:40:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* Implement the IOleInPlaceObject interface
|
|
|
|
*/
|
|
|
|
|
2010-11-13 17:47:31 +01:00
|
|
|
static inline WebBrowser *impl_from_IOleInPlaceObject(IOleInPlaceObject *iface)
|
|
|
|
{
|
2010-11-24 14:06:38 +01:00
|
|
|
return CONTAINING_RECORD(iface, WebBrowser, IOleInPlaceObject_iface);
|
2010-11-13 17:47:31 +01:00
|
|
|
}
|
2002-05-05 21:40:57 +02:00
|
|
|
|
2005-09-07 11:23:47 +02:00
|
|
|
static HRESULT WINAPI OleInPlaceObject_QueryInterface(IOleInPlaceObject *iface,
|
|
|
|
REFIID riid, LPVOID *ppobj)
|
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceObject(iface);
|
2010-11-13 17:47:05 +01:00
|
|
|
return IWebBrowser_QueryInterface(&This->IWebBrowser2_iface, riid, ppobj);
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-07 11:23:47 +02:00
|
|
|
static ULONG WINAPI OleInPlaceObject_AddRef(IOleInPlaceObject *iface)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceObject(iface);
|
2010-11-13 17:47:05 +01:00
|
|
|
return IWebBrowser_AddRef(&This->IWebBrowser2_iface);
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-07 11:23:47 +02:00
|
|
|
static ULONG WINAPI OleInPlaceObject_Release(IOleInPlaceObject *iface)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceObject(iface);
|
2010-11-13 17:47:05 +01:00
|
|
|
return IWebBrowser_Release(&This->IWebBrowser2_iface);
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-07 11:23:47 +02:00
|
|
|
static HRESULT WINAPI OleInPlaceObject_GetWindow(IOleInPlaceObject *iface, HWND* phwnd)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceObject(iface);
|
2005-09-07 11:23:47 +02:00
|
|
|
|
2006-01-20 16:12:36 +01:00
|
|
|
TRACE("(%p)->(%p)\n", This, phwnd);
|
2002-05-05 21:40:57 +02:00
|
|
|
|
2006-01-20 16:12:36 +01:00
|
|
|
*phwnd = This->shell_embedding_hwnd;
|
2002-05-05 21:40:57 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-09-07 11:23:47 +02:00
|
|
|
static HRESULT WINAPI OleInPlaceObject_ContextSensitiveHelp(IOleInPlaceObject *iface,
|
|
|
|
BOOL fEnterMode)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceObject(iface);
|
2005-09-07 11:23:47 +02:00
|
|
|
FIXME("(%p)->(%x)\n", This, fEnterMode);
|
|
|
|
return E_NOTIMPL;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-07 11:23:47 +02:00
|
|
|
static HRESULT WINAPI OleInPlaceObject_InPlaceDeactivate(IOleInPlaceObject *iface)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceObject(iface);
|
2005-09-07 11:23:47 +02:00
|
|
|
FIXME("(%p)\n", This);
|
2009-08-12 07:52:35 +02:00
|
|
|
|
|
|
|
if(This->inplace) {
|
|
|
|
IOleInPlaceSite_Release(This->inplace);
|
|
|
|
This->inplace = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-07 11:23:47 +02:00
|
|
|
static HRESULT WINAPI OleInPlaceObject_UIDeactivate(IOleInPlaceObject *iface)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceObject(iface);
|
2005-09-07 11:23:47 +02:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-07 11:23:47 +02:00
|
|
|
static HRESULT WINAPI OleInPlaceObject_SetObjectRects(IOleInPlaceObject *iface,
|
|
|
|
LPCRECT lprcPosRect, LPCRECT lprcClipRect)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceObject(iface);
|
2005-12-01 11:11:22 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p %p)\n", This, lprcPosRect, lprcClipRect);
|
|
|
|
|
2008-03-17 22:36:56 +01:00
|
|
|
This->pos_rect = *lprcPosRect;
|
2006-04-14 14:42:47 +02:00
|
|
|
|
|
|
|
if(lprcClipRect)
|
2008-03-17 22:36:56 +01:00
|
|
|
This->clip_rect = *lprcClipRect;
|
2006-04-14 14:42:47 +02:00
|
|
|
|
2005-12-01 11:11:22 +01:00
|
|
|
if(This->shell_embedding_hwnd) {
|
|
|
|
SetWindowPos(This->shell_embedding_hwnd, NULL,
|
|
|
|
lprcPosRect->left, lprcPosRect->top,
|
|
|
|
lprcPosRect->right-lprcPosRect->left,
|
2005-12-02 11:25:30 +01:00
|
|
|
lprcPosRect->bottom-lprcPosRect->top,
|
2005-12-01 11:11:22 +01:00
|
|
|
SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-07 11:23:47 +02:00
|
|
|
static HRESULT WINAPI OleInPlaceObject_ReactivateAndUndo(IOleInPlaceObject *iface)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceObject(iface);
|
2005-09-07 11:23:47 +02:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-07 11:23:47 +02:00
|
|
|
static const IOleInPlaceObjectVtbl OleInPlaceObjectVtbl =
|
|
|
|
{
|
|
|
|
OleInPlaceObject_QueryInterface,
|
|
|
|
OleInPlaceObject_AddRef,
|
|
|
|
OleInPlaceObject_Release,
|
|
|
|
OleInPlaceObject_GetWindow,
|
|
|
|
OleInPlaceObject_ContextSensitiveHelp,
|
|
|
|
OleInPlaceObject_InPlaceDeactivate,
|
|
|
|
OleInPlaceObject_UIDeactivate,
|
|
|
|
OleInPlaceObject_SetObjectRects,
|
|
|
|
OleInPlaceObject_ReactivateAndUndo
|
2002-05-05 21:40:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* Implement the IOleControl interface
|
|
|
|
*/
|
|
|
|
|
2010-11-13 17:47:31 +01:00
|
|
|
static inline WebBrowser *impl_from_IOleControl(IOleControl *iface)
|
|
|
|
{
|
2010-11-24 14:06:38 +01:00
|
|
|
return CONTAINING_RECORD(iface, WebBrowser, IOleControl_iface);
|
2010-11-13 17:47:31 +01:00
|
|
|
}
|
2002-05-05 21:40:57 +02:00
|
|
|
|
2005-09-07 11:23:47 +02:00
|
|
|
static HRESULT WINAPI OleControl_QueryInterface(IOleControl *iface,
|
|
|
|
REFIID riid, LPVOID *ppobj)
|
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleControl(iface);
|
2010-11-13 17:47:05 +01:00
|
|
|
return IWebBrowser_QueryInterface(&This->IWebBrowser2_iface, riid, ppobj);
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-07 11:23:47 +02:00
|
|
|
static ULONG WINAPI OleControl_AddRef(IOleControl *iface)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleControl(iface);
|
2010-11-13 17:47:05 +01:00
|
|
|
return IWebBrowser_AddRef(&This->IWebBrowser2_iface);
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-07 11:23:47 +02:00
|
|
|
static ULONG WINAPI OleControl_Release(IOleControl *iface)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleControl(iface);
|
2010-11-13 17:47:05 +01:00
|
|
|
return IWebBrowser_Release(&This->IWebBrowser2_iface);
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-07 11:23:47 +02:00
|
|
|
static HRESULT WINAPI OleControl_GetControlInfo(IOleControl *iface, LPCONTROLINFO pCI)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleControl(iface);
|
2006-07-27 23:30:36 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, pCI);
|
|
|
|
|
|
|
|
/* Tests show that this function should be not implemented */
|
2005-09-07 11:23:47 +02:00
|
|
|
return E_NOTIMPL;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-07 11:23:47 +02:00
|
|
|
static HRESULT WINAPI OleControl_OnMnemonic(IOleControl *iface, struct tagMSG *pMsg)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleControl(iface);
|
2005-09-07 11:23:47 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, pMsg);
|
|
|
|
return E_NOTIMPL;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-07 11:23:47 +02:00
|
|
|
static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DISPID dispID)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleControl(iface);
|
2006-11-05 17:40:37 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%d)\n", This, dispID);
|
|
|
|
|
|
|
|
switch(dispID) {
|
2009-02-03 10:41:16 +01:00
|
|
|
case DISPID_UNKNOWN:
|
2009-02-04 01:51:59 +01:00
|
|
|
/* Unknown means multiple properties changed, so check them all.
|
2009-02-11 13:35:25 +01:00
|
|
|
* BUT the Webbrowser OleControl object doesn't appear to do this.
|
2009-02-04 01:51:59 +01:00
|
|
|
*/
|
2009-02-03 10:41:16 +01:00
|
|
|
return S_OK;
|
2009-06-22 08:39:20 +02:00
|
|
|
case DISPID_AMBIENT_DLCONTROL:
|
|
|
|
return S_OK;
|
2006-11-05 17:46:54 +01:00
|
|
|
case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
|
|
|
|
return on_offlineconnected_change(This);
|
2006-11-05 17:40:37 +01:00
|
|
|
case DISPID_AMBIENT_SILENT:
|
|
|
|
return on_silent_change(This);
|
|
|
|
}
|
|
|
|
|
|
|
|
FIXME("Unknown dispID %d\n", dispID);
|
2005-09-07 11:23:47 +02:00
|
|
|
return E_NOTIMPL;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-07 11:23:47 +02:00
|
|
|
static HRESULT WINAPI OleControl_FreezeEvents(IOleControl *iface, BOOL bFreeze)
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleControl(iface);
|
2005-09-07 11:23:47 +02:00
|
|
|
FIXME("(%p)->(%x)\n", This, bFreeze);
|
|
|
|
return E_NOTIMPL;
|
2002-05-05 21:40:57 +02:00
|
|
|
}
|
|
|
|
|
2005-09-07 11:23:47 +02:00
|
|
|
static const IOleControlVtbl OleControlVtbl =
|
2002-05-05 21:40:57 +02:00
|
|
|
{
|
2005-09-07 11:23:47 +02:00
|
|
|
OleControl_QueryInterface,
|
|
|
|
OleControl_AddRef,
|
|
|
|
OleControl_Release,
|
|
|
|
OleControl_GetControlInfo,
|
|
|
|
OleControl_OnMnemonic,
|
|
|
|
OleControl_OnAmbientPropertyChange,
|
|
|
|
OleControl_FreezeEvents
|
2002-05-05 21:40:57 +02:00
|
|
|
};
|
|
|
|
|
2010-11-13 17:47:31 +01:00
|
|
|
static inline WebBrowser *impl_from_IOleInPlaceActiveObject(IOleInPlaceActiveObject *iface)
|
|
|
|
{
|
2010-11-24 14:06:38 +01:00
|
|
|
return CONTAINING_RECORD(iface, WebBrowser, IOleInPlaceActiveObject_iface);
|
2010-11-13 17:47:31 +01:00
|
|
|
}
|
2005-12-01 11:36:52 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject *iface,
|
2010-11-13 17:47:31 +01:00
|
|
|
REFIID riid, void **ppv)
|
2005-12-01 11:36:52 +01:00
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceActiveObject(iface);
|
2010-11-13 17:47:05 +01:00
|
|
|
return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppv);
|
2005-12-01 11:36:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InPlaceActiveObject_AddRef(IOleInPlaceActiveObject *iface)
|
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceActiveObject(iface);
|
2010-11-13 17:47:05 +01:00
|
|
|
return IWebBrowser2_AddRef(&This->IWebBrowser2_iface);
|
2005-12-01 11:36:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InPlaceActiveObject_Release(IOleInPlaceActiveObject *iface)
|
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceActiveObject(iface);
|
2010-11-13 17:47:05 +01:00
|
|
|
return IWebBrowser2_Release(&This->IWebBrowser2_iface);
|
2005-12-01 11:36:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *iface,
|
|
|
|
HWND *phwnd)
|
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceActiveObject(iface);
|
|
|
|
return IOleInPlaceObject_GetWindow(&This->IOleInPlaceObject_iface, phwnd);
|
2005-12-01 11:36:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject *iface,
|
|
|
|
BOOL fEnterMode)
|
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceActiveObject(iface);
|
|
|
|
return IOleInPlaceObject_ContextSensitiveHelp(&This->IOleInPlaceObject_iface, fEnterMode);
|
2005-12-01 11:36:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject *iface,
|
|
|
|
LPMSG lpmsg)
|
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceActiveObject(iface);
|
2010-11-17 13:12:22 +01:00
|
|
|
IOleInPlaceActiveObject *activeobj;
|
|
|
|
HRESULT hr = S_FALSE;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, lpmsg);
|
|
|
|
|
|
|
|
if(This->doc_host.document) {
|
|
|
|
if(SUCCEEDED(IUnknown_QueryInterface(This->doc_host.document,
|
|
|
|
&IID_IOleInPlaceActiveObject,
|
|
|
|
(void**)&activeobj))) {
|
|
|
|
hr = IOleInPlaceActiveObject_TranslateAccelerator(activeobj, lpmsg);
|
|
|
|
IOleInPlaceActiveObject_Release(activeobj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(SUCCEEDED(hr))
|
|
|
|
return hr;
|
|
|
|
else
|
|
|
|
return S_FALSE;
|
2005-12-01 11:36:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject *iface,
|
|
|
|
BOOL fActivate)
|
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceActiveObject(iface);
|
2005-12-01 11:36:52 +01:00
|
|
|
FIXME("(%p)->(%x)\n", This, fActivate);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject *iface,
|
|
|
|
BOOL fActivate)
|
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceActiveObject(iface);
|
2005-12-01 11:36:52 +01:00
|
|
|
FIXME("(%p)->(%x)\n", This, fActivate);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject *iface,
|
|
|
|
LPCRECT lprcBorder, IOleInPlaceUIWindow *pUIWindow, BOOL fFrameWindow)
|
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceActiveObject(iface);
|
2005-12-01 11:36:52 +01:00
|
|
|
FIXME("(%p)->(%p %p %x)\n", This, lprcBorder, pUIWindow, fFrameWindow);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject *iface,
|
|
|
|
BOOL fEnable)
|
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleInPlaceActiveObject(iface);
|
2005-12-01 11:36:52 +01:00
|
|
|
FIXME("(%p)->(%x)\n", This, fEnable);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl = {
|
|
|
|
InPlaceActiveObject_QueryInterface,
|
|
|
|
InPlaceActiveObject_AddRef,
|
|
|
|
InPlaceActiveObject_Release,
|
|
|
|
InPlaceActiveObject_GetWindow,
|
|
|
|
InPlaceActiveObject_ContextSensitiveHelp,
|
|
|
|
InPlaceActiveObject_TranslateAccelerator,
|
|
|
|
InPlaceActiveObject_OnFrameWindowActivate,
|
|
|
|
InPlaceActiveObject_OnDocWindowActivate,
|
|
|
|
InPlaceActiveObject_ResizeBorder,
|
|
|
|
InPlaceActiveObject_EnableModeless
|
|
|
|
};
|
|
|
|
|
2010-11-13 17:47:31 +01:00
|
|
|
static inline WebBrowser *impl_from_IOleCommandTarget(IOleCommandTarget *iface)
|
|
|
|
{
|
2010-11-24 14:06:38 +01:00
|
|
|
return CONTAINING_RECORD(iface, WebBrowser, IOleCommandTarget_iface);
|
2010-11-13 17:47:31 +01:00
|
|
|
}
|
2006-01-26 13:29:35 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI WBOleCommandTarget_QueryInterface(IOleCommandTarget *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleCommandTarget(iface);
|
2010-11-13 17:47:05 +01:00
|
|
|
return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppv);
|
2006-01-26 13:29:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI WBOleCommandTarget_AddRef(IOleCommandTarget *iface)
|
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleCommandTarget(iface);
|
2010-11-13 17:47:05 +01:00
|
|
|
return IWebBrowser2_AddRef(&This->IWebBrowser2_iface);
|
2006-01-26 13:29:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI WBOleCommandTarget_Release(IOleCommandTarget *iface)
|
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleCommandTarget(iface);
|
2010-11-13 17:47:05 +01:00
|
|
|
return IWebBrowser2_Release(&This->IWebBrowser2_iface);
|
2006-01-26 13:29:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI WBOleCommandTarget_QueryStatus(IOleCommandTarget *iface,
|
|
|
|
const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
|
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleCommandTarget(iface);
|
2009-02-23 15:38:30 +01:00
|
|
|
IOleCommandTarget *cmdtrg;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s %u %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds,
|
2006-01-26 13:29:35 +01:00
|
|
|
pCmdText);
|
2009-02-23 15:38:30 +01:00
|
|
|
|
|
|
|
if(!This->doc_host.document)
|
|
|
|
return 0x80040104;
|
|
|
|
|
|
|
|
/* NOTE: There are probably some commands that we should handle here
|
|
|
|
* instead of forwarding to document object. */
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IOleCommandTarget, (void**)&cmdtrg);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
hres = IOleCommandTarget_QueryStatus(cmdtrg, pguidCmdGroup, cCmds, prgCmds, pCmdText);
|
|
|
|
IOleCommandTarget_Release(cmdtrg);
|
|
|
|
|
|
|
|
return hres;
|
2006-01-26 13:29:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI WBOleCommandTarget_Exec(IOleCommandTarget *iface,
|
|
|
|
const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn,
|
|
|
|
VARIANT *pvaOut)
|
|
|
|
{
|
2010-11-13 17:47:31 +01:00
|
|
|
WebBrowser *This = impl_from_IOleCommandTarget(iface);
|
2006-10-05 23:49:39 +02:00
|
|
|
FIXME("(%p)->(%s %d %d %p %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID,
|
2006-01-26 13:29:35 +01:00
|
|
|
nCmdexecopt, pvaIn, pvaOut);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IOleCommandTargetVtbl OleCommandTargetVtbl = {
|
|
|
|
WBOleCommandTarget_QueryInterface,
|
|
|
|
WBOleCommandTarget_AddRef,
|
|
|
|
WBOleCommandTarget_Release,
|
|
|
|
WBOleCommandTarget_QueryStatus,
|
|
|
|
WBOleCommandTarget_Exec
|
|
|
|
};
|
|
|
|
|
2005-09-06 13:41:14 +02:00
|
|
|
void WebBrowser_OleObject_Init(WebBrowser *This)
|
|
|
|
{
|
2008-11-19 05:33:38 +01:00
|
|
|
DWORD dpi_x;
|
|
|
|
DWORD dpi_y;
|
|
|
|
HDC hdc;
|
|
|
|
|
|
|
|
/* default aspect ratio is 96dpi / 96dpi */
|
|
|
|
hdc = GetDC(0);
|
|
|
|
dpi_x = GetDeviceCaps(hdc, LOGPIXELSX);
|
|
|
|
dpi_y = GetDeviceCaps(hdc, LOGPIXELSY);
|
|
|
|
ReleaseDC(0, hdc);
|
|
|
|
|
2010-11-13 17:47:31 +01:00
|
|
|
This->IOleObject_iface.lpVtbl = &OleObjectVtbl;
|
|
|
|
This->IOleInPlaceObject_iface.lpVtbl = &OleInPlaceObjectVtbl;
|
|
|
|
This->IOleControl_iface.lpVtbl = &OleControlVtbl;
|
|
|
|
This->IOleInPlaceActiveObject_iface.lpVtbl = &OleInPlaceActiveObjectVtbl;
|
|
|
|
This->IOleCommandTarget_iface.lpVtbl = &OleCommandTargetVtbl;
|
2005-09-16 20:44:37 +02:00
|
|
|
|
2008-11-21 17:07:21 +01:00
|
|
|
/* Default size is 50x20 pixels, in himetric units */
|
|
|
|
This->extent.cx = MulDiv( 50, 2540, dpi_x );
|
|
|
|
This->extent.cy = MulDiv( 20, 2540, dpi_y );
|
2005-11-16 12:46:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void WebBrowser_OleObject_Destroy(WebBrowser *This)
|
|
|
|
{
|
2010-01-22 17:12:57 +01:00
|
|
|
release_client_site(This);
|
2005-09-06 13:41:14 +02:00
|
|
|
}
|