2005-11-17 12:03:53 +01:00
|
|
|
/*
|
2006-01-25 13:14:57 +01:00
|
|
|
* Copyright 2005-2006 Jacek Caban for CodeWeavers
|
2005-11-17 12:03:53 +01: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
|
2005-11-17 12:03:53 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "shdocvw.h"
|
2005-11-28 20:57:04 +01:00
|
|
|
#include "hlink.h"
|
|
|
|
#include "exdispid.h"
|
2005-11-17 12:03:53 +01:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
|
|
|
|
|
2005-11-28 11:17:28 +01:00
|
|
|
static ATOM doc_view_atom = 0;
|
|
|
|
|
2008-01-18 21:53:25 +01:00
|
|
|
void push_dochost_task(DocHost *This, task_header_t *task, task_proc_t proc, BOOL send)
|
|
|
|
{
|
|
|
|
task->proc = proc;
|
|
|
|
|
|
|
|
/* FIXME: Don't use lParam */
|
|
|
|
if(send)
|
|
|
|
SendMessageW(This->frame_hwnd, WM_DOCHOSTTASK, 0, (LPARAM)task);
|
|
|
|
else
|
|
|
|
PostMessageW(This->frame_hwnd, WM_DOCHOSTTASK, 0, (LPARAM)task);
|
|
|
|
}
|
|
|
|
|
|
|
|
LRESULT process_dochost_task(DocHost *This, LPARAM lparam)
|
|
|
|
{
|
|
|
|
task_header_t *task = (task_header_t*)lparam;
|
|
|
|
|
|
|
|
task->proc(This, task);
|
|
|
|
|
|
|
|
heap_free(task);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-04-18 00:42:45 +02:00
|
|
|
static void navigate_complete(DocHost *This)
|
2005-11-28 20:57:04 +01:00
|
|
|
{
|
2005-12-02 12:59:51 +01:00
|
|
|
IDispatch *disp = NULL;
|
2005-11-28 20:57:04 +01:00
|
|
|
DISPPARAMS dispparams;
|
|
|
|
VARIANTARG params[2];
|
|
|
|
VARIANT url;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2006-04-18 00:42:45 +02:00
|
|
|
hres = IUnknown_QueryInterface(This->document, &IID_IDispatch, (void**)&disp);
|
2005-11-28 20:57:04 +01:00
|
|
|
if(FAILED(hres))
|
|
|
|
FIXME("Could not get IDispatch interface\n");
|
|
|
|
|
|
|
|
dispparams.cArgs = 2;
|
|
|
|
dispparams.cNamedArgs = 0;
|
|
|
|
dispparams.rgdispidNamedArgs = NULL;
|
|
|
|
dispparams.rgvarg = params;
|
|
|
|
|
|
|
|
V_VT(params) = (VT_BYREF|VT_VARIANT);
|
|
|
|
V_BYREF(params) = &url;
|
|
|
|
|
|
|
|
V_VT(params+1) = VT_DISPATCH;
|
2005-12-02 12:59:51 +01:00
|
|
|
V_DISPATCH(params+1) = disp;
|
2005-11-28 20:57:04 +01:00
|
|
|
|
|
|
|
V_VT(&url) = VT_BSTR;
|
2006-10-17 16:56:21 +02:00
|
|
|
V_BSTR(&url) = SysAllocString(This->url);
|
2005-11-28 20:57:04 +01:00
|
|
|
|
2006-05-17 18:25:33 +02:00
|
|
|
call_sink(This->cps.wbe2, DISPID_NAVIGATECOMPLETE2, &dispparams);
|
|
|
|
call_sink(This->cps.wbe2, DISPID_DOCUMENTCOMPLETE, &dispparams);
|
2005-11-28 20:57:04 +01:00
|
|
|
|
2006-10-17 16:56:21 +02:00
|
|
|
SysFreeString(V_BSTR(&url));
|
2005-12-02 12:59:51 +01:00
|
|
|
if(disp)
|
|
|
|
IDispatch_Release(disp);
|
2008-03-13 13:16:41 +01:00
|
|
|
This->busy = VARIANT_FALSE;
|
2005-11-28 20:57:04 +01:00
|
|
|
}
|
|
|
|
|
2008-01-18 21:53:25 +01:00
|
|
|
void object_available(DocHost *This)
|
2005-11-28 20:57:04 +01:00
|
|
|
{
|
|
|
|
IHlinkTarget *hlink;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
2006-04-18 00:42:45 +02:00
|
|
|
if(!This->document) {
|
2005-11-28 20:57:04 +01:00
|
|
|
WARN("document == NULL\n");
|
2008-01-18 21:53:25 +01:00
|
|
|
return;
|
2005-11-28 20:57:04 +01:00
|
|
|
}
|
|
|
|
|
2006-04-18 00:42:45 +02:00
|
|
|
hres = IUnknown_QueryInterface(This->document, &IID_IHlinkTarget, (void**)&hlink);
|
2005-11-28 20:57:04 +01:00
|
|
|
if(FAILED(hres)) {
|
|
|
|
FIXME("Could not get IHlinkTarget interface\n");
|
2008-01-18 21:53:25 +01:00
|
|
|
return;
|
2005-11-28 20:57:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
hres = IHlinkTarget_Navigate(hlink, 0, NULL);
|
|
|
|
IHlinkTarget_Release(hlink);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
FIXME("Navigate failed\n");
|
2008-01-18 21:53:25 +01:00
|
|
|
return;
|
2005-11-28 20:57:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
navigate_complete(This);
|
|
|
|
|
2008-01-18 21:53:25 +01:00
|
|
|
return;
|
2005-11-28 20:57:04 +01:00
|
|
|
}
|
|
|
|
|
2006-04-18 00:42:45 +02:00
|
|
|
static LRESULT resize_document(DocHost *This, LONG width, LONG height)
|
2005-12-02 15:54:58 +01:00
|
|
|
{
|
|
|
|
RECT rect = {0, 0, width, height};
|
|
|
|
|
2006-10-05 23:49:39 +02:00
|
|
|
TRACE("(%p)->(%d %d)\n", This, width, height);
|
2005-12-02 15:54:58 +01:00
|
|
|
|
2006-04-18 00:42:45 +02:00
|
|
|
if(This->view)
|
|
|
|
IOleDocumentView_SetRect(This->view, &rect);
|
2005-12-02 15:54:58 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-11-28 11:17:28 +01:00
|
|
|
static LRESULT WINAPI doc_view_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2006-04-18 00:42:45 +02:00
|
|
|
DocHost *This;
|
2005-11-28 11:17:28 +01:00
|
|
|
|
|
|
|
static const WCHAR wszTHIS[] = {'T','H','I','S',0};
|
|
|
|
|
|
|
|
if(msg == WM_CREATE) {
|
2006-04-18 00:42:45 +02:00
|
|
|
This = *(DocHost**)lParam;
|
2005-11-28 11:17:28 +01:00
|
|
|
SetPropW(hwnd, wszTHIS, This);
|
|
|
|
}else {
|
|
|
|
This = GetPropW(hwnd, wszTHIS);
|
|
|
|
}
|
|
|
|
|
2005-11-28 20:57:04 +01:00
|
|
|
switch(msg) {
|
2005-12-02 15:54:58 +01:00
|
|
|
case WM_SIZE:
|
|
|
|
return resize_document(This, LOWORD(lParam), HIWORD(lParam));
|
2005-11-28 20:57:04 +01:00
|
|
|
}
|
|
|
|
|
2006-04-14 14:40:33 +02:00
|
|
|
return DefWindowProcW(hwnd, msg, wParam, lParam);
|
2005-11-28 11:17:28 +01:00
|
|
|
}
|
|
|
|
|
2006-04-18 00:42:45 +02:00
|
|
|
void create_doc_view_hwnd(DocHost *This)
|
2005-11-28 11:17:28 +01:00
|
|
|
{
|
|
|
|
RECT rect;
|
|
|
|
|
|
|
|
static const WCHAR wszShell_DocObject_View[] =
|
|
|
|
{'S','h','e','l','l',' ','D','o','c','O','b','j','e','c','t',' ','V','i','e','w',0};
|
|
|
|
|
|
|
|
if(!doc_view_atom) {
|
|
|
|
static WNDCLASSEXW wndclass = {
|
|
|
|
sizeof(wndclass),
|
|
|
|
CS_PARENTDC,
|
|
|
|
doc_view_proc,
|
|
|
|
0, 0 /* native uses 4*/, NULL, NULL, NULL,
|
|
|
|
(HBRUSH)COLOR_WINDOWFRAME, NULL,
|
|
|
|
wszShell_DocObject_View,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
wndclass.hInstance = shdocvw_hinstance;
|
|
|
|
|
|
|
|
doc_view_atom = RegisterClassExW(&wndclass);
|
|
|
|
}
|
|
|
|
|
2006-04-18 00:42:45 +02:00
|
|
|
GetClientRect(This->frame_hwnd, &rect); /* FIXME */
|
|
|
|
This->hwnd = CreateWindowExW(0, wszShell_DocObject_View,
|
2005-11-28 11:17:28 +01:00
|
|
|
wszShell_DocObject_View,
|
2006-04-14 14:40:33 +02:00
|
|
|
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TABSTOP,
|
2006-04-18 00:42:45 +02:00
|
|
|
rect.left, rect.top, rect.right, rect.bottom, This->frame_hwnd,
|
2005-11-28 11:17:28 +01:00
|
|
|
NULL, shdocvw_hinstance, This);
|
|
|
|
}
|
|
|
|
|
2006-04-18 00:39:15 +02:00
|
|
|
void deactivate_document(DocHost *This)
|
2006-01-18 13:22:52 +01:00
|
|
|
{
|
|
|
|
IOleInPlaceObjectWindowless *winobj;
|
|
|
|
IOleObject *oleobj = NULL;
|
|
|
|
IHlinkTarget *hlink = NULL;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2006-04-18 00:39:15 +02:00
|
|
|
if(This->view)
|
|
|
|
IOleDocumentView_UIActivate(This->view, FALSE);
|
2006-01-18 13:22:52 +01:00
|
|
|
|
2006-04-18 00:39:15 +02:00
|
|
|
hres = IUnknown_QueryInterface(This->document, &IID_IOleInPlaceObjectWindowless,
|
2006-01-18 13:22:52 +01:00
|
|
|
(void**)&winobj);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
IOleInPlaceObjectWindowless_InPlaceDeactivate(winobj);
|
|
|
|
IOleInPlaceObjectWindowless_Release(winobj);
|
|
|
|
}
|
|
|
|
|
2006-04-18 00:39:15 +02:00
|
|
|
if(This->view) {
|
|
|
|
IOleDocumentView_Show(This->view, FALSE);
|
|
|
|
IOleDocumentView_CloseView(This->view, 0);
|
|
|
|
IOleDocumentView_SetInPlaceSite(This->view, NULL);
|
|
|
|
IOleDocumentView_Release(This->view);
|
|
|
|
This->view = NULL;
|
2006-01-18 13:22:52 +01:00
|
|
|
}
|
|
|
|
|
2006-04-18 00:39:15 +02:00
|
|
|
hres = IUnknown_QueryInterface(This->document, &IID_IOleObject, (void**)&oleobj);
|
2006-01-18 13:22:52 +01:00
|
|
|
if(SUCCEEDED(hres))
|
|
|
|
IOleObject_Close(oleobj, OLECLOSE_NOSAVE);
|
|
|
|
|
2006-04-18 00:39:15 +02:00
|
|
|
hres = IUnknown_QueryInterface(This->document, &IID_IHlinkTarget, (void**)&hlink);
|
2006-01-18 13:22:52 +01:00
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
IHlinkTarget_SetBrowseContext(hlink, NULL);
|
|
|
|
IHlinkTarget_Release(hlink);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(oleobj) {
|
|
|
|
IOleClientSite *client_site = NULL;
|
|
|
|
|
|
|
|
IOleObject_GetClientSite(oleobj, &client_site);
|
|
|
|
if(client_site) {
|
2006-04-18 00:39:15 +02:00
|
|
|
if(client_site == CLIENTSITE(This))
|
2006-01-18 13:22:52 +01:00
|
|
|
IOleObject_SetClientSite(oleobj, NULL);
|
|
|
|
IOleClientSite_Release(client_site);
|
|
|
|
}
|
|
|
|
|
|
|
|
IOleObject_Release(oleobj);
|
|
|
|
}
|
|
|
|
|
2006-04-18 00:39:15 +02:00
|
|
|
IUnknown_Release(This->document);
|
|
|
|
This->document = NULL;
|
2006-01-18 13:22:52 +01:00
|
|
|
}
|
|
|
|
|
2006-04-18 00:32:43 +02:00
|
|
|
#define OLECMD_THIS(iface) DEFINE_THIS(DocHost, OleCommandTarget, iface)
|
2006-01-26 13:28:43 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI ClOleCommandTarget_QueryInterface(IOleCommandTarget *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2006-04-18 00:32:43 +02:00
|
|
|
DocHost *This = OLECMD_THIS(iface);
|
|
|
|
return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppv);
|
2006-01-26 13:28:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClOleCommandTarget_AddRef(IOleCommandTarget *iface)
|
|
|
|
{
|
2006-04-18 00:32:43 +02:00
|
|
|
DocHost *This = OLECMD_THIS(iface);
|
|
|
|
return IOleClientSite_AddRef(CLIENTSITE(This));
|
2006-01-26 13:28:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClOleCommandTarget_Release(IOleCommandTarget *iface)
|
|
|
|
{
|
2006-04-18 00:32:43 +02:00
|
|
|
DocHost *This = OLECMD_THIS(iface);
|
|
|
|
return IOleClientSite_Release(CLIENTSITE(This));
|
2006-01-26 13:28:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClOleCommandTarget_QueryStatus(IOleCommandTarget *iface,
|
|
|
|
const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
|
|
|
|
{
|
2006-04-18 00:32:43 +02:00
|
|
|
DocHost *This = OLECMD_THIS(iface);
|
2006-10-05 23:49:39 +02:00
|
|
|
FIXME("(%p)->(%s %u %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds,
|
2006-01-26 13:28:43 +01:00
|
|
|
pCmdText);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClOleCommandTarget_Exec(IOleCommandTarget *iface,
|
|
|
|
const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn,
|
|
|
|
VARIANT *pvaOut)
|
|
|
|
{
|
2006-04-18 00:32:43 +02:00
|
|
|
DocHost *This = OLECMD_THIS(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:28:43 +01:00
|
|
|
nCmdexecopt, pvaIn, pvaOut);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef OLECMD_THIS
|
|
|
|
|
|
|
|
static const IOleCommandTargetVtbl OleCommandTargetVtbl = {
|
|
|
|
ClOleCommandTarget_QueryInterface,
|
|
|
|
ClOleCommandTarget_AddRef,
|
|
|
|
ClOleCommandTarget_Release,
|
|
|
|
ClOleCommandTarget_QueryStatus,
|
|
|
|
ClOleCommandTarget_Exec
|
|
|
|
};
|
|
|
|
|
2006-04-18 00:28:37 +02:00
|
|
|
#define DOCHOSTUI_THIS(iface) DEFINE_THIS(DocHost, DocHostUIHandler, iface)
|
2005-11-17 12:03:53 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
|
|
|
return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppv);
|
2005-11-17 12:03:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
|
|
|
return IOleClientSite_AddRef(CLIENTSITE(This));
|
2005-11-17 12:03:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
|
|
|
return IOleClientSite_Release(CLIENTSITE(This));
|
2005-11-17 12:03:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface,
|
|
|
|
DWORD dwID, POINT *ppt, IUnknown *pcmdtReserved, IDispatch *pdispReserved)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
2006-03-05 22:28:37 +01:00
|
|
|
HRESULT hres;
|
|
|
|
|
2006-10-05 23:49:39 +02:00
|
|
|
TRACE("(%p)->(%d %p %p %p)\n", This, dwID, ppt, pcmdtReserved, pdispReserved);
|
2006-03-05 22:28:37 +01:00
|
|
|
|
|
|
|
if(This->hostui) {
|
|
|
|
hres = IDocHostUIHandler_ShowContextMenu(This->hostui, dwID, ppt, pcmdtReserved,
|
|
|
|
pdispReserved);
|
|
|
|
if(hres == S_OK)
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
FIXME("default action not implemented\n");
|
2005-11-17 12:03:53 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface,
|
|
|
|
DOCHOSTUIINFO *pInfo)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
2005-11-21 12:59:39 +01:00
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, pInfo);
|
|
|
|
|
2006-01-25 13:14:57 +01:00
|
|
|
if(This->hostui) {
|
|
|
|
hres = IDocHostUIHandler_GetHostInfo(This->hostui, pInfo);
|
|
|
|
if(SUCCEEDED(hres))
|
|
|
|
return hres;
|
2005-11-21 12:59:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_OPENNEWWIN
|
|
|
|
| DOCHOSTUIFLAG_URL_ENCODING_ENABLE_UTF8 | DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
|
|
|
|
| DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION;
|
|
|
|
return S_OK;
|
2005-11-17 12:03:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
|
|
|
|
IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
|
|
|
|
IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
2006-10-05 23:49:39 +02:00
|
|
|
FIXME("(%p)->(%d %p %p %p %p)\n", This, dwID, pActiveObject, pCommandTarget,
|
2005-11-17 12:03:53 +01:00
|
|
|
pFrame, pDoc);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
2005-11-17 12:03:53 +01:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
2007-09-09 20:11:03 +02:00
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
if(!This->hostui)
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
return IDocHostUIHandler_UpdateUI(This->hostui);
|
2005-11-17 12:03:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface,
|
|
|
|
BOOL fEnable)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
2005-11-17 12:03:53 +01:00
|
|
|
FIXME("(%p)->(%x)\n", This, fEnable);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface,
|
|
|
|
BOOL fActivate)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
2005-11-17 12:03:53 +01:00
|
|
|
FIXME("(%p)->(%x)\n", This, fActivate);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface,
|
|
|
|
BOOL fActivate)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
2005-11-17 12:03:53 +01:00
|
|
|
FIXME("(%p)->(%x)\n", This, fActivate);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface,
|
|
|
|
LPCRECT prcBorder, IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
2005-11-17 12:03:53 +01:00
|
|
|
FIXME("(%p)->(%p %p %X)\n", This, prcBorder, pUIWindow, fRameWindow);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface,
|
|
|
|
LPMSG lpMsg, const GUID *pguidCmdGroup, DWORD nCmdID)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
2006-10-05 23:49:39 +02:00
|
|
|
FIXME("(%p)->(%p %p %d)\n", This, lpMsg, pguidCmdGroup, nCmdID);
|
2005-11-17 12:03:53 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
|
|
|
|
LPOLESTR *pchKey, DWORD dw)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
2005-11-28 17:30:21 +01:00
|
|
|
|
2006-10-05 23:49:39 +02:00
|
|
|
TRACE("(%p)->(%p %d)\n", This, pchKey, dw);
|
2005-11-28 17:30:21 +01:00
|
|
|
|
2006-01-25 13:14:57 +01:00
|
|
|
if(This->hostui)
|
|
|
|
return IDocHostUIHandler_GetOptionKeyPath(This->hostui, pchKey, dw);
|
2005-11-28 17:30:21 +01:00
|
|
|
|
|
|
|
return S_OK;
|
2005-11-17 12:03:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
|
|
|
|
IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
2005-11-17 12:03:53 +01:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface,
|
|
|
|
IDispatch **ppDispatch)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
2007-08-01 01:00:27 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, ppDispatch);
|
|
|
|
|
|
|
|
if(This->hostui)
|
|
|
|
return IDocHostUIHandler_GetExternal(This->hostui, ppDispatch);
|
|
|
|
|
|
|
|
FIXME("default action not implemented\n");
|
2005-11-17 12:03:53 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface,
|
|
|
|
DWORD dwTranslate, OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
2006-01-25 13:15:12 +01:00
|
|
|
|
2006-10-05 23:49:39 +02:00
|
|
|
TRACE("(%p)->(%d %s %p)\n", This, dwTranslate, debugstr_w(pchURLIn), ppchURLOut);
|
2006-01-25 13:15:12 +01:00
|
|
|
|
|
|
|
if(This->hostui)
|
|
|
|
return IDocHostUIHandler_TranslateUrl(This->hostui, dwTranslate,
|
|
|
|
pchURLIn, ppchURLOut);
|
|
|
|
|
|
|
|
return S_FALSE;
|
2005-11-17 12:03:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface,
|
|
|
|
IDataObject *pDO, IDataObject **ppDORet)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
2005-11-17 12:03:53 +01:00
|
|
|
FIXME("(%p)->(%p %p)\n", This, pDO, ppDORet);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
|
|
|
|
LPOLESTR *pchKey, DWORD dw)
|
|
|
|
{
|
2006-04-18 00:28:37 +02:00
|
|
|
DocHost *This = DOCHOSTUI_THIS(iface);
|
2005-11-28 17:30:21 +01:00
|
|
|
IDocHostUIHandler2 *handler;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2006-10-05 23:49:39 +02:00
|
|
|
TRACE("(%p)->(%p %d)\n", This, pchKey, dw);
|
2005-11-28 17:30:21 +01:00
|
|
|
|
2006-04-18 00:28:37 +02:00
|
|
|
if(!This->hostui)
|
2005-11-28 17:30:21 +01:00
|
|
|
return S_OK;
|
|
|
|
|
2006-04-18 00:28:37 +02:00
|
|
|
hres = IDocHostUIHandler_QueryInterface(This->hostui, &IID_IDocHostUIHandler2,
|
|
|
|
(void**)&handler);
|
2005-11-28 17:30:21 +01:00
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
hres = IDocHostUIHandler2_GetOverrideKeyPath(handler, pchKey, dw);
|
|
|
|
IDocHostUIHandler2_Release(handler);
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2005-11-17 12:03:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#undef DOCHOSTUI_THIS
|
|
|
|
|
|
|
|
static const IDocHostUIHandler2Vtbl DocHostUIHandler2Vtbl = {
|
|
|
|
DocHostUIHandler_QueryInterface,
|
|
|
|
DocHostUIHandler_AddRef,
|
|
|
|
DocHostUIHandler_Release,
|
|
|
|
DocHostUIHandler_ShowContextMenu,
|
|
|
|
DocHostUIHandler_GetHostInfo,
|
|
|
|
DocHostUIHandler_ShowUI,
|
|
|
|
DocHostUIHandler_HideUI,
|
|
|
|
DocHostUIHandler_UpdateUI,
|
|
|
|
DocHostUIHandler_EnableModeless,
|
|
|
|
DocHostUIHandler_OnDocWindowActivate,
|
|
|
|
DocHostUIHandler_OnFrameWindowActivate,
|
|
|
|
DocHostUIHandler_ResizeBorder,
|
|
|
|
DocHostUIHandler_TranslateAccelerator,
|
|
|
|
DocHostUIHandler_GetOptionKeyPath,
|
|
|
|
DocHostUIHandler_GetDropTarget,
|
|
|
|
DocHostUIHandler_GetExternal,
|
|
|
|
DocHostUIHandler_TranslateUrl,
|
|
|
|
DocHostUIHandler_FilterDataObject,
|
|
|
|
DocHostUIHandler_GetOverrideKeyPath
|
|
|
|
};
|
|
|
|
|
2006-04-19 20:31:11 +02:00
|
|
|
void DocHost_Init(DocHost *This, IDispatch *disp)
|
2005-11-17 12:03:53 +01:00
|
|
|
{
|
2006-04-18 00:38:06 +02:00
|
|
|
This->lpDocHostUIHandlerVtbl = &DocHostUIHandler2Vtbl;
|
|
|
|
This->lpOleCommandTargetVtbl = &OleCommandTargetVtbl;
|
2005-11-28 11:17:28 +01:00
|
|
|
|
2006-04-19 20:31:11 +02:00
|
|
|
This->disp = disp;
|
|
|
|
|
2007-03-09 16:50:01 +01:00
|
|
|
This->client_disp = NULL;
|
|
|
|
|
2006-04-18 00:38:06 +02:00
|
|
|
This->document = NULL;
|
|
|
|
This->hostui = NULL;
|
2007-03-09 16:56:02 +01:00
|
|
|
This->frame = NULL;
|
2006-04-18 00:38:06 +02:00
|
|
|
|
|
|
|
This->hwnd = NULL;
|
|
|
|
This->frame_hwnd = NULL;
|
2006-04-19 20:31:11 +02:00
|
|
|
This->url = NULL;
|
2006-01-25 13:14:57 +01:00
|
|
|
|
2007-03-09 16:52:16 +01:00
|
|
|
This->silent = VARIANT_FALSE;
|
|
|
|
This->offline = VARIANT_FALSE;
|
|
|
|
|
2006-04-18 00:38:06 +02:00
|
|
|
DocHost_ClientSite_Init(This);
|
|
|
|
DocHost_Frame_Init(This);
|
2006-05-17 18:26:30 +02:00
|
|
|
|
|
|
|
ConnectionPointContainer_Init(&This->cps, (IUnknown*)disp);
|
2006-04-18 00:41:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void DocHost_Release(DocHost *This)
|
|
|
|
{
|
2007-03-09 16:50:01 +01:00
|
|
|
if(This->client_disp)
|
|
|
|
IDispatch_Release(This->client_disp);
|
2007-03-09 16:56:02 +01:00
|
|
|
if(This->frame)
|
|
|
|
IOleInPlaceFrame_Release(This->frame);
|
2007-03-09 16:50:01 +01:00
|
|
|
|
2006-04-18 00:41:43 +02:00
|
|
|
DocHost_ClientSite_Release(This);
|
2006-05-17 18:26:30 +02:00
|
|
|
|
|
|
|
ConnectionPointContainer_Destroy(&This->cps);
|
2006-04-19 20:31:11 +02:00
|
|
|
|
|
|
|
SysFreeString(This->url);
|
2005-11-17 12:03:53 +01:00
|
|
|
}
|