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
|
|
|
*/
|
|
|
|
|
2011-07-27 14:46:48 +02:00
|
|
|
#include "ieframe.h"
|
|
|
|
|
2005-11-28 20:57:04 +01:00
|
|
|
#include "exdispid.h"
|
2009-08-30 01:00:53 +02:00
|
|
|
#include "mshtml.h"
|
2013-04-02 17:39:45 +02:00
|
|
|
#include "perhist.h"
|
2010-03-13 16:43:24 +01:00
|
|
|
#include "initguid.h"
|
2005-11-17 12:03:53 +01: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);
|
2005-11-17 12:03:53 +01:00
|
|
|
|
2010-03-13 16:43:24 +01:00
|
|
|
DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
|
|
|
|
|
|
|
|
#define DOCHOST_DOCCANNAVIGATE 0
|
|
|
|
|
2012-01-20 15:16:10 +01:00
|
|
|
/* Undocumented notification, see mshtml tests */
|
|
|
|
#define CMDID_EXPLORER_UPDATEHISTORY 38
|
|
|
|
|
2005-11-28 11:17:28 +01:00
|
|
|
static ATOM doc_view_atom = 0;
|
|
|
|
|
2011-05-26 17:01:31 +02:00
|
|
|
void push_dochost_task(DocHost *This, task_header_t *task, task_proc_t proc, task_destr_t destr, BOOL send)
|
2008-01-18 21:53:25 +01:00
|
|
|
{
|
2011-05-26 17:01:42 +02:00
|
|
|
BOOL is_empty;
|
|
|
|
|
2008-01-18 21:53:25 +01:00
|
|
|
task->proc = proc;
|
2011-05-26 17:01:31 +02:00
|
|
|
task->destr = destr;
|
2008-01-18 21:53:25 +01:00
|
|
|
|
2011-05-26 17:01:42 +02:00
|
|
|
is_empty = list_empty(&This->task_queue);
|
|
|
|
list_add_tail(&This->task_queue, &task->entry);
|
|
|
|
|
2008-01-18 21:53:25 +01:00
|
|
|
if(send)
|
2011-05-26 17:01:42 +02:00
|
|
|
SendMessageW(This->frame_hwnd, WM_DOCHOSTTASK, 0, 0);
|
|
|
|
else if(is_empty)
|
|
|
|
PostMessageW(This->frame_hwnd, WM_DOCHOSTTASK, 0, 0);
|
2008-01-18 21:53:25 +01:00
|
|
|
}
|
|
|
|
|
2011-05-26 17:01:42 +02:00
|
|
|
LRESULT process_dochost_tasks(DocHost *This)
|
2008-01-18 21:53:25 +01:00
|
|
|
{
|
2011-05-26 17:01:42 +02:00
|
|
|
task_header_t *task;
|
2008-01-18 21:53:25 +01:00
|
|
|
|
2011-05-26 17:01:42 +02:00
|
|
|
while(!list_empty(&This->task_queue)) {
|
|
|
|
task = LIST_ENTRY(This->task_queue.next, task_header_t, entry);
|
|
|
|
list_remove(&task->entry);
|
2008-01-18 21:53:25 +01:00
|
|
|
|
2011-05-26 17:01:42 +02:00
|
|
|
task->proc(This, task);
|
2011-05-26 17:01:31 +02:00
|
|
|
task->destr(task);
|
2011-05-26 17:01:42 +02:00
|
|
|
}
|
|
|
|
|
2008-01-18 21:53:25 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-05-26 17:02:03 +02:00
|
|
|
void abort_dochost_tasks(DocHost *This, task_proc_t proc)
|
2011-05-26 17:01:51 +02:00
|
|
|
{
|
|
|
|
task_header_t *task, *cursor;
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY_SAFE(task, cursor, &This->task_queue, task_header_t, entry) {
|
2011-05-26 17:02:03 +02:00
|
|
|
if(proc && proc != task->proc)
|
|
|
|
continue;
|
|
|
|
|
2011-05-26 17:01:51 +02:00
|
|
|
list_remove(&task->entry);
|
|
|
|
task->destr(task);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-25 10:04:59 +01:00
|
|
|
void on_commandstate_change(DocHost *doc_host, LONG command, BOOL enable)
|
2015-08-18 14:01:01 +02:00
|
|
|
{
|
|
|
|
DISPPARAMS dispparams;
|
|
|
|
VARIANTARG params[2];
|
|
|
|
|
|
|
|
TRACE("command=%d enable=%d\n", command, enable);
|
|
|
|
|
|
|
|
dispparams.cArgs = 2;
|
|
|
|
dispparams.cNamedArgs = 0;
|
|
|
|
dispparams.rgdispidNamedArgs = NULL;
|
|
|
|
dispparams.rgvarg = params;
|
|
|
|
|
|
|
|
V_VT(params) = VT_BOOL;
|
2015-11-09 17:53:00 +01:00
|
|
|
V_BOOL(params) = enable ? VARIANT_TRUE : VARIANT_FALSE;
|
2015-08-18 14:01:01 +02:00
|
|
|
|
|
|
|
V_VT(params+1) = VT_I4;
|
|
|
|
V_I4(params+1) = command;
|
|
|
|
|
|
|
|
call_sink(doc_host->cps.wbe2, DISPID_COMMANDSTATECHANGE, &dispparams);
|
2015-11-09 17:53:00 +01:00
|
|
|
|
|
|
|
doc_host->container_vtbl->on_command_state_change(doc_host, command, enable);
|
2015-08-18 14:01:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void update_navigation_commands(DocHost *dochost)
|
|
|
|
{
|
|
|
|
unsigned pos = dochost->travellog.loading_pos == -1 ? dochost->travellog.position : dochost->travellog.loading_pos;
|
|
|
|
|
2015-11-09 17:53:00 +01:00
|
|
|
on_commandstate_change(dochost, CSC_NAVIGATEBACK, pos > 0);
|
|
|
|
on_commandstate_change(dochost, CSC_NAVIGATEFORWARD, pos < dochost->travellog.length);
|
2015-08-18 14:01:01 +02:00
|
|
|
}
|
|
|
|
|
2009-08-30 01:02:03 +02:00
|
|
|
static void notif_complete(DocHost *This, DISPID dispid)
|
2005-11-28 20:57:04 +01:00
|
|
|
{
|
|
|
|
DISPPARAMS dispparams;
|
|
|
|
VARIANTARG params[2];
|
|
|
|
VARIANT url;
|
|
|
|
|
|
|
|
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;
|
2012-01-09 17:56:05 +01:00
|
|
|
V_DISPATCH(params+1) = (IDispatch*)This->wb;
|
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
|
|
|
|
2009-08-30 01:02:03 +02:00
|
|
|
TRACE("%d >>>\n", dispid);
|
|
|
|
call_sink(This->cps.wbe2, dispid, &dispparams);
|
|
|
|
TRACE("%d <<<\n", dispid);
|
2005-11-28 20:57:04 +01:00
|
|
|
|
2006-10-17 16:56:21 +02:00
|
|
|
SysFreeString(V_BSTR(&url));
|
2005-11-28 20:57:04 +01:00
|
|
|
}
|
|
|
|
|
2009-08-30 01:00:53 +02:00
|
|
|
static 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);
|
2013-05-22 16:08:40 +02:00
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
hres = IHlinkTarget_Navigate(hlink, 0, NULL);
|
|
|
|
IHlinkTarget_Release(hlink);
|
|
|
|
if(FAILED(hres))
|
|
|
|
FIXME("Navigate failed\n");
|
|
|
|
}else {
|
|
|
|
IOleObject *ole_object;
|
|
|
|
RECT rect;
|
|
|
|
|
|
|
|
TRACE("No IHlink iface\n");
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(This->document, &IID_IOleObject, (void**)&ole_object);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
FIXME("Could not get IOleObject iface: %08x\n", hres);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetClientRect(This->hwnd, &rect);
|
|
|
|
hres = IOleObject_DoVerb(ole_object, OLEIVERB_SHOW, NULL, &This->IOleClientSite_iface, -1, This->hwnd, &rect);
|
|
|
|
IOleObject_Release(ole_object);
|
|
|
|
if(FAILED(hres))
|
|
|
|
FIXME("DoVerb failed: %08x\n", hres);
|
2005-11-28 20:57:04 +01:00
|
|
|
}
|
2009-08-30 01:02:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT get_doc_ready_state(DocHost *This, READYSTATE *ret)
|
|
|
|
{
|
|
|
|
DISPPARAMS dp = {NULL,NULL,0,0};
|
|
|
|
IDispatch *disp;
|
|
|
|
EXCEPINFO ei;
|
|
|
|
VARIANT var;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(This->document, &IID_IDispatch, (void**)&disp);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
hres = IDispatch_Invoke(disp, DISPID_READYSTATE, &IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET,
|
|
|
|
&dp, &var, &ei, NULL);
|
|
|
|
IDispatch_Release(disp);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
WARN("Invoke(DISPID_READYSTATE failed: %08x\n", hres);
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(V_VT(&var) != VT_I4) {
|
|
|
|
WARN("V_VT(var) = %d\n", V_VT(&var));
|
|
|
|
VariantClear(&var);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ret = V_I4(&var);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void advise_prop_notif(DocHost *This, BOOL set)
|
|
|
|
{
|
|
|
|
IConnectionPointContainer *cp_container;
|
|
|
|
IConnectionPoint *cp;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(This->document, &IID_IConnectionPointContainer, (void**)&cp_container);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return;
|
|
|
|
|
|
|
|
hres = IConnectionPointContainer_FindConnectionPoint(cp_container, &IID_IPropertyNotifySink, &cp);
|
|
|
|
IConnectionPointContainer_Release(cp_container);
|
|
|
|
if(FAILED(hres))
|
2008-01-18 21:53:25 +01:00
|
|
|
return;
|
2009-08-30 01:02:03 +02:00
|
|
|
|
|
|
|
if(set)
|
2010-11-13 17:48:09 +01:00
|
|
|
hres = IConnectionPoint_Advise(cp, (IUnknown*)&This->IPropertyNotifySink_iface, &This->prop_notif_cookie);
|
2009-08-30 01:02:03 +02:00
|
|
|
else
|
|
|
|
hres = IConnectionPoint_Unadvise(cp, This->prop_notif_cookie);
|
|
|
|
IConnectionPoint_Release(cp);
|
|
|
|
|
|
|
|
if(SUCCEEDED(hres))
|
|
|
|
This->is_prop_notif = set;
|
|
|
|
}
|
|
|
|
|
2010-03-13 16:43:48 +01:00
|
|
|
void set_doc_state(DocHost *This, READYSTATE doc_state)
|
|
|
|
{
|
|
|
|
This->doc_state = doc_state;
|
|
|
|
if(doc_state > This->ready_state)
|
|
|
|
This->ready_state = doc_state;
|
|
|
|
}
|
|
|
|
|
2009-08-30 01:02:03 +02:00
|
|
|
static void update_ready_state(DocHost *This, READYSTATE ready_state)
|
|
|
|
{
|
2013-04-02 17:39:21 +02:00
|
|
|
if(ready_state > READYSTATE_LOADING && This->travellog.loading_pos != -1) {
|
|
|
|
WARN("histupdate not notified\n");
|
|
|
|
This->travellog.position = This->travellog.loading_pos;
|
|
|
|
This->travellog.loading_pos = -1;
|
|
|
|
}
|
|
|
|
|
2011-11-15 13:29:59 +01:00
|
|
|
if(ready_state > READYSTATE_LOADING && This->doc_state <= READYSTATE_LOADING && !This->browser_service /* FIXME */)
|
2009-08-30 01:02:03 +02:00
|
|
|
notif_complete(This, DISPID_NAVIGATECOMPLETE2);
|
2005-11-28 20:57:04 +01:00
|
|
|
|
2010-03-13 16:43:48 +01:00
|
|
|
if(ready_state == READYSTATE_COMPLETE && This->doc_state < READYSTATE_COMPLETE) {
|
|
|
|
set_doc_state(This, READYSTATE_COMPLETE);
|
2011-11-15 13:29:59 +01:00
|
|
|
if(!This->browser_service) /* FIXME: Not fully correct */
|
|
|
|
notif_complete(This, DISPID_DOCUMENTCOMPLETE);
|
2010-03-13 16:43:48 +01:00
|
|
|
}else {
|
|
|
|
set_doc_state(This, ready_state);
|
2009-08-30 01:02:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
task_header_t header;
|
|
|
|
IUnknown *doc;
|
|
|
|
READYSTATE ready_state;
|
|
|
|
} ready_state_task_t;
|
|
|
|
|
2011-05-26 17:01:31 +02:00
|
|
|
static void ready_state_task_destr(task_header_t *_task)
|
|
|
|
{
|
|
|
|
ready_state_task_t *task = (ready_state_task_t*)_task;
|
|
|
|
|
|
|
|
IUnknown_Release(task->doc);
|
|
|
|
heap_free(task);
|
|
|
|
}
|
|
|
|
|
2009-08-30 01:02:03 +02:00
|
|
|
static void ready_state_proc(DocHost *This, task_header_t *_task)
|
|
|
|
{
|
|
|
|
ready_state_task_t *task = (ready_state_task_t*)_task;
|
|
|
|
|
|
|
|
if(task->doc == This->document)
|
|
|
|
update_ready_state(This, task->ready_state);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void push_ready_state_task(DocHost *This, READYSTATE ready_state)
|
|
|
|
{
|
|
|
|
ready_state_task_t *task = heap_alloc(sizeof(ready_state_task_t));
|
|
|
|
|
|
|
|
IUnknown_AddRef(This->document);
|
|
|
|
task->doc = This->document;
|
|
|
|
task->ready_state = ready_state;
|
|
|
|
|
2011-05-26 17:01:31 +02:00
|
|
|
push_dochost_task(This, &task->header, ready_state_proc, ready_state_task_destr, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void object_available_task_destr(task_header_t *task)
|
|
|
|
{
|
|
|
|
heap_free(task);
|
2009-08-30 01:00:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void object_available_proc(DocHost *This, task_header_t *task)
|
|
|
|
{
|
|
|
|
object_available(This);
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT dochost_object_available(DocHost *This, IUnknown *doc)
|
|
|
|
{
|
2009-08-30 01:02:03 +02:00
|
|
|
READYSTATE ready_state;
|
2009-08-30 01:00:53 +02:00
|
|
|
task_header_t *task;
|
|
|
|
IOleObject *oleobj;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
IUnknown_AddRef(doc);
|
|
|
|
This->document = doc;
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
CLSID clsid;
|
|
|
|
|
|
|
|
hres = IOleObject_GetUserClassID(oleobj, &clsid);
|
|
|
|
if(SUCCEEDED(hres))
|
|
|
|
TRACE("Got clsid %s\n",
|
|
|
|
IsEqualGUID(&clsid, &CLSID_HTMLDocument) ? "CLSID_HTMLDocument" : debugstr_guid(&clsid));
|
|
|
|
|
2010-11-13 17:47:58 +01:00
|
|
|
hres = IOleObject_SetClientSite(oleobj, &This->IOleClientSite_iface);
|
2009-08-30 01:00:53 +02:00
|
|
|
if(FAILED(hres))
|
|
|
|
FIXME("SetClientSite failed: %08x\n", hres);
|
|
|
|
|
|
|
|
IOleObject_Release(oleobj);
|
|
|
|
}else {
|
|
|
|
FIXME("Could not get IOleObject iface: %08x\n", hres);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: Call SetAdvise */
|
|
|
|
|
|
|
|
task = heap_alloc(sizeof(*task));
|
2011-05-26 17:01:31 +02:00
|
|
|
push_dochost_task(This, task, object_available_proc, object_available_task_destr, FALSE);
|
2005-11-28 20:57:04 +01:00
|
|
|
|
2009-08-30 01:02:03 +02:00
|
|
|
hres = get_doc_ready_state(This, &ready_state);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
if(ready_state == READYSTATE_COMPLETE)
|
|
|
|
push_ready_state_task(This, READYSTATE_COMPLETE);
|
2010-03-13 16:44:24 +01:00
|
|
|
if(ready_state != READYSTATE_COMPLETE || This->doc_navigate)
|
2009-08-30 01:02:03 +02:00
|
|
|
advise_prop_notif(This, TRUE);
|
2013-05-22 16:08:54 +02:00
|
|
|
}else if(!This->doc_navigate) {
|
|
|
|
/* If we can't get document's ready state, there is not much we can do.
|
|
|
|
* Assume that document is complete at this point. */
|
|
|
|
push_ready_state_task(This, READYSTATE_COMPLETE);
|
2009-08-30 01:02:03 +02:00
|
|
|
}
|
|
|
|
|
2009-08-30 01:00:53 +02:00
|
|
|
return S_OK;
|
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
|
|
|
}
|
|
|
|
|
2013-04-02 17:39:34 +02:00
|
|
|
static void free_travellog_entry(travellog_entry_t *entry)
|
|
|
|
{
|
2013-04-02 17:39:45 +02:00
|
|
|
if(entry->stream)
|
|
|
|
IStream_Release(entry->stream);
|
2013-04-02 17:39:34 +02:00
|
|
|
heap_free(entry->url);
|
|
|
|
}
|
|
|
|
|
2013-04-02 17:39:45 +02:00
|
|
|
static IStream *get_travellog_stream(DocHost *This)
|
|
|
|
{
|
|
|
|
IPersistHistory *persist_history;
|
|
|
|
IStream *stream;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(This->document, &IID_IPersistHistory, (void**)&persist_history);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
hres = CreateStreamOnHGlobal(NULL, TRUE, &stream);
|
|
|
|
if(SUCCEEDED(hres))
|
|
|
|
hres = IPersistHistory_SaveHistory(persist_history, stream);
|
|
|
|
IPersistHistory_Release(persist_history);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
IStream_Release(stream);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2013-04-03 16:07:44 +02:00
|
|
|
static void dump_travellog(DocHost *This)
|
2013-04-02 17:39:57 +02:00
|
|
|
{
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
for(i=0; i < This->travellog.length; i++)
|
|
|
|
TRACE("%d: %s %s\n", i, i == This->travellog.position ? "=>" : " ", debugstr_w(This->travellog.log[i].url));
|
|
|
|
if(i == This->travellog.position)
|
|
|
|
TRACE("%d: =>\n", i);
|
|
|
|
}
|
|
|
|
|
2012-01-20 15:16:10 +01:00
|
|
|
static void update_travellog(DocHost *This)
|
|
|
|
{
|
|
|
|
travellog_entry_t *new_entry;
|
|
|
|
|
2015-08-18 14:00:47 +02:00
|
|
|
static const WCHAR about_schemeW[] = {'a','b','o','u','t',':'};
|
|
|
|
|
2019-06-05 08:39:04 +02:00
|
|
|
if(This->url && !wcsnicmp(This->url, about_schemeW, ARRAY_SIZE(about_schemeW))) {
|
2015-08-18 14:00:47 +02:00
|
|
|
TRACE("Skipping about URL\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-07-20 14:01:13 +02:00
|
|
|
if(!This->travellog.log) {
|
|
|
|
This->travellog.log = heap_alloc(4 * sizeof(*This->travellog.log));
|
|
|
|
if(!This->travellog.log)
|
|
|
|
return;
|
2012-01-20 15:16:10 +01:00
|
|
|
|
2015-07-20 14:01:13 +02:00
|
|
|
This->travellog.size = 4;
|
|
|
|
}else if(This->travellog.size < This->travellog.position+1) {
|
|
|
|
travellog_entry_t *new_travellog;
|
2012-01-20 15:16:10 +01:00
|
|
|
|
2015-07-20 14:01:13 +02:00
|
|
|
new_travellog = heap_realloc(This->travellog.log, This->travellog.size*2*sizeof(*This->travellog.log));
|
|
|
|
if(!new_travellog)
|
|
|
|
return;
|
2012-01-20 15:16:10 +01:00
|
|
|
|
2015-07-20 14:01:13 +02:00
|
|
|
This->travellog.log = new_travellog;
|
|
|
|
This->travellog.size *= 2;
|
|
|
|
}
|
2012-01-20 15:16:10 +01:00
|
|
|
|
2015-07-20 14:01:13 +02:00
|
|
|
if(This->travellog.loading_pos == -1) {
|
|
|
|
/* Clear forward history. */
|
2013-04-02 17:39:21 +02:00
|
|
|
while(This->travellog.length > This->travellog.position)
|
2013-04-02 17:39:34 +02:00
|
|
|
free_travellog_entry(This->travellog.log + --This->travellog.length);
|
2013-04-02 17:39:21 +02:00
|
|
|
}
|
2012-01-20 15:16:10 +01:00
|
|
|
|
2013-04-02 17:39:07 +02:00
|
|
|
new_entry = This->travellog.log + This->travellog.position;
|
2012-01-20 15:16:10 +01:00
|
|
|
|
|
|
|
new_entry->url = heap_strdupW(This->url);
|
2013-04-02 17:39:45 +02:00
|
|
|
TRACE("Adding %s at %d\n", debugstr_w(This->url), This->travellog.position);
|
2012-01-20 15:16:10 +01:00
|
|
|
if(!new_entry->url)
|
|
|
|
return;
|
|
|
|
|
2013-04-02 17:39:45 +02:00
|
|
|
new_entry->stream = get_travellog_stream(This);
|
|
|
|
|
2013-04-02 17:39:21 +02:00
|
|
|
if(This->travellog.loading_pos == -1) {
|
|
|
|
This->travellog.position++;
|
|
|
|
}else {
|
|
|
|
This->travellog.position = This->travellog.loading_pos;
|
|
|
|
This->travellog.loading_pos = -1;
|
|
|
|
}
|
|
|
|
if(This->travellog.position > This->travellog.length)
|
|
|
|
This->travellog.length = This->travellog.position;
|
2013-04-02 17:39:57 +02:00
|
|
|
|
|
|
|
dump_travellog(This);
|
2012-01-20 15:16:10 +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,
|
2008-11-12 08:15:51 +01:00
|
|
|
(HBRUSH)(COLOR_WINDOW + 1), NULL,
|
2005-11-28 11:17:28 +01:00
|
|
|
wszShell_DocObject_View,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2011-07-27 14:46:48 +02:00
|
|
|
wndclass.hInstance = ieframe_instance;
|
2005-11-28 11:17:28 +01:00
|
|
|
|
|
|
|
doc_view_atom = RegisterClassExW(&wndclass);
|
|
|
|
}
|
|
|
|
|
2015-11-09 17:53:11 +01:00
|
|
|
This->container_vtbl->get_docobj_rect(This, &rect);
|
2006-04-18 00:42:45 +02:00
|
|
|
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,
|
2011-07-27 14:46:48 +02:00
|
|
|
NULL, ieframe_instance, This);
|
2005-11-28 11:17:28 +01:00
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
2011-05-11 20:18:54 +02:00
|
|
|
if(!This->document) return;
|
|
|
|
|
2010-03-13 16:43:24 +01:00
|
|
|
if(This->doc_navigate) {
|
|
|
|
IUnknown_Release(This->doc_navigate);
|
|
|
|
This->doc_navigate = NULL;
|
|
|
|
}
|
|
|
|
|
2009-08-30 01:02:03 +02:00
|
|
|
if(This->is_prop_notif)
|
|
|
|
advise_prop_notif(This, FALSE);
|
|
|
|
|
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) {
|
2010-11-13 17:47:58 +01:00
|
|
|
if(client_site == &This->IOleClientSite_iface)
|
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
|
|
|
}
|
|
|
|
|
2014-09-25 13:38:24 +02:00
|
|
|
HRESULT refresh_document(DocHost *This, const VARIANT *level)
|
2012-11-12 12:59:20 +01:00
|
|
|
{
|
|
|
|
IOleCommandTarget *cmdtrg;
|
|
|
|
VARIANT vin, vout;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2014-09-25 13:38:24 +02:00
|
|
|
if(level && (V_VT(level) != VT_I4 || V_I4(level) != REFRESH_NORMAL))
|
|
|
|
FIXME("Unsupported refresh level %s\n", debugstr_variant(level));
|
|
|
|
|
2012-11-12 12:59:20 +01:00
|
|
|
if(!This->document) {
|
|
|
|
FIXME("no document\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(This->document, &IID_IOleCommandTarget, (void**)&cmdtrg);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
V_VT(&vin) = VT_EMPTY;
|
|
|
|
V_VT(&vout) = VT_EMPTY;
|
|
|
|
hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_REFRESH, OLECMDEXECOPT_PROMPTUSER, &vin, &vout);
|
|
|
|
IOleCommandTarget_Release(cmdtrg);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
VariantClear(&vout);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-08-14 09:04:03 +02:00
|
|
|
void activate_document(DocHost *This)
|
|
|
|
{
|
|
|
|
IOleObject *oleobj;
|
|
|
|
IHlinkTarget *hlink;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
if(!This->document) return;
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(This->document, &IID_IHlinkTarget, (void**)&hlink);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
IHlinkTarget_Navigate(hlink, 0, NULL);
|
|
|
|
IHlinkTarget_Release(hlink);
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(This->document, &IID_IOleObject, (void**)&oleobj);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, NULL, -1, 0, NULL);
|
|
|
|
IOleObject_Release(oleobj);
|
|
|
|
}
|
|
|
|
|
|
|
|
refresh_document(This, NULL);
|
|
|
|
|
|
|
|
if(This->view)
|
|
|
|
IOleDocumentView_UIActivate(This->view, TRUE);
|
|
|
|
}
|
|
|
|
|
2010-01-22 17:12:26 +01:00
|
|
|
void release_dochost_client(DocHost *This)
|
|
|
|
{
|
|
|
|
if(This->hwnd) {
|
|
|
|
DestroyWindow(This->hwnd);
|
|
|
|
This->hwnd = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(This->hostui) {
|
|
|
|
IDocHostUIHandler_Release(This->hostui);
|
|
|
|
This->hostui = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(This->client_disp) {
|
|
|
|
IDispatch_Release(This->client_disp);
|
|
|
|
This->client_disp = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(This->frame) {
|
|
|
|
IOleInPlaceFrame_Release(This->frame);
|
|
|
|
This->frame = NULL;
|
|
|
|
}
|
2015-08-14 16:30:45 +02:00
|
|
|
|
|
|
|
if(This->olecmd) {
|
|
|
|
IOleCommandTarget_Release(This->olecmd);
|
|
|
|
This->olecmd = NULL;
|
|
|
|
}
|
2010-01-22 17:12:26 +01:00
|
|
|
}
|
|
|
|
|
2010-11-13 17:48:09 +01:00
|
|
|
static inline DocHost *impl_from_IOleCommandTarget(IOleCommandTarget *iface)
|
|
|
|
{
|
2010-11-24 14:06:38 +01:00
|
|
|
return CONTAINING_RECORD(iface, DocHost, IOleCommandTarget_iface);
|
2010-11-13 17:48:09 +01:00
|
|
|
}
|
2006-01-26 13:28:43 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI ClOleCommandTarget_QueryInterface(IOleCommandTarget *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IOleCommandTarget(iface);
|
2010-11-13 17:47:58 +01:00
|
|
|
return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
|
2006-01-26 13:28:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClOleCommandTarget_AddRef(IOleCommandTarget *iface)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IOleCommandTarget(iface);
|
2010-11-13 17:47:58 +01:00
|
|
|
return IOleClientSite_AddRef(&This->IOleClientSite_iface);
|
2006-01-26 13:28:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClOleCommandTarget_Release(IOleCommandTarget *iface)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IOleCommandTarget(iface);
|
2010-11-13 17:47:58 +01:00
|
|
|
return IOleClientSite_Release(&This->IOleClientSite_iface);
|
2006-01-26 13:28:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClOleCommandTarget_QueryStatus(IOleCommandTarget *iface,
|
|
|
|
const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IOleCommandTarget(iface);
|
2015-11-27 11:50:12 +01:00
|
|
|
ULONG i;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s %u %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds,
|
2006-01-26 13:28:43 +01:00
|
|
|
pCmdText);
|
2015-11-27 11:50:12 +01:00
|
|
|
for(i=0; prgCmds && i < cCmds; i++)
|
|
|
|
TRACE("unsupported command %u (%x)\n", prgCmds[i].cmdID, prgCmds[i].cmdf);
|
|
|
|
|
2006-01-26 13:28:43 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClOleCommandTarget_Exec(IOleCommandTarget *iface,
|
|
|
|
const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn,
|
|
|
|
VARIANT *pvaOut)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IOleCommandTarget(iface);
|
2010-03-13 16:43:24 +01:00
|
|
|
|
2012-03-21 23:36:19 +01:00
|
|
|
TRACE("(%p)->(%s %d %d %s %s)\n", This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt,
|
|
|
|
debugstr_variant(pvaIn), debugstr_variant(pvaOut));
|
2010-03-13 16:43:24 +01:00
|
|
|
|
|
|
|
if(!pguidCmdGroup) {
|
2010-11-12 14:30:03 +01:00
|
|
|
switch(nCmdID) {
|
|
|
|
case OLECMDID_UPDATECOMMANDS:
|
2015-08-14 16:30:50 +02:00
|
|
|
if(!This->olecmd)
|
|
|
|
return E_NOTIMPL;
|
|
|
|
return IOleCommandTarget_Exec(This->olecmd, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
|
2012-11-12 12:59:06 +01:00
|
|
|
case OLECMDID_SETDOWNLOADSTATE:
|
2019-05-29 20:06:27 +02:00
|
|
|
if(pvaIn && V_VT(pvaIn) == VT_I4)
|
|
|
|
This->busy = V_I4(pvaIn) ? VARIANT_TRUE : VARIANT_FALSE;
|
2015-08-14 16:30:50 +02:00
|
|
|
if(This->olecmd)
|
|
|
|
return IOleCommandTarget_Exec(This->olecmd, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
|
|
|
|
|
2015-08-14 16:30:57 +02:00
|
|
|
if(!pvaIn || V_VT(pvaIn) != VT_I4)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
notify_download_state(This, V_I4(pvaIn));
|
|
|
|
return S_OK;
|
2010-11-12 14:30:03 +01:00
|
|
|
default:
|
2015-11-27 11:50:12 +01:00
|
|
|
TRACE("Unimplemented cmdid %d\n", nCmdID);
|
2010-11-12 14:30:03 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
2010-03-13 16:43:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(IsEqualGUID(pguidCmdGroup, &CGID_DocHostCmdPriv)) {
|
|
|
|
switch(nCmdID) {
|
|
|
|
case DOCHOST_DOCCANNAVIGATE:
|
|
|
|
if(!pvaIn || V_VT(pvaIn) != VT_UNKNOWN)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
if(This->doc_navigate)
|
|
|
|
IUnknown_Release(This->doc_navigate);
|
|
|
|
IUnknown_AddRef(V_UNKNOWN(pvaIn));
|
|
|
|
This->doc_navigate = V_UNKNOWN(pvaIn);
|
|
|
|
return S_OK;
|
|
|
|
|
2011-03-14 17:49:27 +01:00
|
|
|
case 1: {
|
|
|
|
IHTMLWindow2 *win2;
|
|
|
|
SAFEARRAY *sa = V_ARRAY(pvaIn);
|
|
|
|
VARIANT status_code, url, htmlwindow;
|
|
|
|
LONG ind;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2011-05-07 20:36:20 +02:00
|
|
|
if(V_VT(pvaIn) != VT_ARRAY || !sa || (SafeArrayGetDim(sa) != 1))
|
2011-03-14 17:49:27 +01:00
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
ind = 0;
|
|
|
|
hres = SafeArrayGetElement(sa, &ind, &status_code);
|
|
|
|
if(FAILED(hres) || V_VT(&status_code)!=VT_I4)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
ind = 1;
|
|
|
|
hres = SafeArrayGetElement(sa, &ind, &url);
|
|
|
|
if(FAILED(hres) || V_VT(&url)!=VT_BSTR)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
ind = 3;
|
|
|
|
hres = SafeArrayGetElement(sa, &ind, &htmlwindow);
|
|
|
|
if(FAILED(hres) || V_VT(&htmlwindow)!=VT_UNKNOWN || !V_UNKNOWN(&htmlwindow))
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(V_UNKNOWN(&htmlwindow), &IID_IHTMLWindow2, (void**)&win2);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
handle_navigation_error(This, V_I4(&status_code), V_BSTR(&url), win2);
|
|
|
|
IHTMLWindow2_Release(win2);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-03-13 16:43:24 +01:00
|
|
|
default:
|
2015-11-27 11:50:12 +01:00
|
|
|
TRACE("unsupported command %d of CGID_DocHostCmdPriv\n", nCmdID);
|
2010-03-13 16:43:24 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-20 15:16:10 +01:00
|
|
|
if(IsEqualGUID(pguidCmdGroup, &CGID_Explorer)) {
|
|
|
|
switch(nCmdID) {
|
|
|
|
case CMDID_EXPLORER_UPDATEHISTORY:
|
|
|
|
update_travellog(This);
|
2015-08-18 14:01:08 +02:00
|
|
|
update_navigation_commands(This);
|
2012-01-25 00:00:12 +01:00
|
|
|
return S_OK;
|
|
|
|
|
2012-01-20 15:16:10 +01:00
|
|
|
default:
|
2015-11-27 11:50:12 +01:00
|
|
|
TRACE("Unimplemented cmdid %d of CGID_Explorer\n", nCmdID);
|
2012-01-25 00:00:12 +01:00
|
|
|
return E_NOTIMPL;
|
2012-01-20 15:16:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-28 13:51:24 +02:00
|
|
|
if(IsEqualGUID(pguidCmdGroup, &CGID_ShellDocView)) {
|
|
|
|
switch(nCmdID) {
|
|
|
|
default:
|
2015-11-27 11:50:12 +01:00
|
|
|
TRACE("Unimplemented cmdid %d of CGID_ShellDocView\n", nCmdID);
|
2012-09-28 13:51:24 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-14 16:30:50 +02:00
|
|
|
if(IsEqualGUID(&CGID_DocHostCommandHandler, pguidCmdGroup)) {
|
|
|
|
if(!This->olecmd)
|
|
|
|
return E_NOTIMPL;
|
|
|
|
return IOleCommandTarget_Exec(This->olecmd, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
|
|
|
|
}
|
2012-11-12 12:59:06 +01:00
|
|
|
|
2015-11-27 11:50:12 +01:00
|
|
|
TRACE("Unimplemented cmdid %d of group %s\n", nCmdID, debugstr_guid(pguidCmdGroup));
|
2006-01-26 13:28:43 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IOleCommandTargetVtbl OleCommandTargetVtbl = {
|
|
|
|
ClOleCommandTarget_QueryInterface,
|
|
|
|
ClOleCommandTarget_AddRef,
|
|
|
|
ClOleCommandTarget_Release,
|
|
|
|
ClOleCommandTarget_QueryStatus,
|
|
|
|
ClOleCommandTarget_Exec
|
|
|
|
};
|
|
|
|
|
2010-11-13 17:48:09 +01:00
|
|
|
static inline DocHost *impl_from_IDocHostUIHandler2(IDocHostUIHandler2 *iface)
|
|
|
|
{
|
2010-11-24 14:06:38 +01:00
|
|
|
return CONTAINING_RECORD(iface, DocHost, IDocHostUIHandler2_iface);
|
2010-11-13 17:48:09 +01:00
|
|
|
}
|
2005-11-17 12:03:53 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(iface);
|
2010-11-13 17:47:58 +01:00
|
|
|
return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
|
2005-11-17 12:03:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(iface);
|
2010-11-13 17:47:58 +01:00
|
|
|
return IOleClientSite_AddRef(&This->IOleClientSite_iface);
|
2005-11-17 12:03:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(iface);
|
2010-11-13 17:47:58 +01:00
|
|
|
return IOleClientSite_Release(&This->IOleClientSite_iface);
|
2005-11-17 12:03:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface,
|
|
|
|
DWORD dwID, POINT *ppt, IUnknown *pcmdtReserved, IDispatch *pdispReserved)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(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)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(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)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(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)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(iface);
|
2005-11-17 12:03:53 +01:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(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)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(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)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(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)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(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)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(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)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(iface);
|
2010-11-17 13:12:19 +01:00
|
|
|
HRESULT hr = S_FALSE;
|
|
|
|
TRACE("(%p)->(%p %p %d)\n", This, lpMsg, pguidCmdGroup, nCmdID);
|
|
|
|
|
|
|
|
if(This->hostui)
|
|
|
|
hr = IDocHostUIHandler_TranslateAccelerator(This->hostui, lpMsg, pguidCmdGroup, nCmdID);
|
|
|
|
|
|
|
|
return hr;
|
2005-11-17 12:03:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
|
|
|
|
LPOLESTR *pchKey, DWORD dw)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(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)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(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)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(iface);
|
2007-08-01 01:00:27 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, ppDispatch);
|
|
|
|
|
|
|
|
if(This->hostui)
|
|
|
|
return IDocHostUIHandler_GetExternal(This->hostui, ppDispatch);
|
|
|
|
|
2012-05-16 13:21:02 +02:00
|
|
|
if(!This->shell_ui_helper) {
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = create_shell_ui_helper(&This->shell_ui_helper);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ppDispatch = (IDispatch*)This->shell_ui_helper;
|
|
|
|
IDispatch_AddRef(*ppDispatch);
|
|
|
|
return S_OK;
|
2005-11-17 12:03:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface,
|
|
|
|
DWORD dwTranslate, OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(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)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(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)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IDocHostUIHandler2(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
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
};
|
|
|
|
|
2010-11-13 17:48:09 +01:00
|
|
|
static inline DocHost *impl_from_IPropertyNotifySink(IPropertyNotifySink *iface)
|
|
|
|
{
|
2010-11-24 14:06:38 +01:00
|
|
|
return CONTAINING_RECORD(iface, DocHost, IPropertyNotifySink_iface);
|
2010-11-13 17:48:09 +01:00
|
|
|
}
|
2009-08-30 01:00:06 +02:00
|
|
|
|
|
|
|
static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IPropertyNotifySink(iface);
|
2010-11-13 17:47:58 +01:00
|
|
|
return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
|
2009-08-30 01:00:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IPropertyNotifySink(iface);
|
2010-11-13 17:47:58 +01:00
|
|
|
return IOleClientSite_AddRef(&This->IOleClientSite_iface);
|
2009-08-30 01:00:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IPropertyNotifySink(iface);
|
2010-11-13 17:47:58 +01:00
|
|
|
return IOleClientSite_Release(&This->IOleClientSite_iface);
|
2009-08-30 01:00:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IPropertyNotifySink(iface);
|
2009-08-30 01:02:03 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%d)\n", This, dispID);
|
|
|
|
|
|
|
|
switch(dispID) {
|
|
|
|
case DISPID_READYSTATE: {
|
|
|
|
READYSTATE ready_state;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = get_doc_ready_state(This, &ready_state);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
2010-03-13 16:44:24 +01:00
|
|
|
if(ready_state == READYSTATE_COMPLETE && !This->doc_navigate)
|
2009-08-30 01:02:03 +02:00
|
|
|
advise_prop_notif(This, FALSE);
|
|
|
|
|
2011-11-15 13:29:59 +01:00
|
|
|
update_ready_state(This, ready_state);
|
2009-08-30 01:02:03 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
FIXME("unimplemented dispid %d\n", dispID);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2009-08-30 01:00:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
|
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
DocHost *This = impl_from_IPropertyNotifySink(iface);
|
2009-08-30 01:00:06 +02:00
|
|
|
FIXME("(%p)->(%d)\n", This, dispID);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
|
|
|
|
PropertyNotifySink_QueryInterface,
|
|
|
|
PropertyNotifySink_AddRef,
|
|
|
|
PropertyNotifySink_Release,
|
|
|
|
PropertyNotifySink_OnChanged,
|
|
|
|
PropertyNotifySink_OnRequestEdit
|
|
|
|
};
|
|
|
|
|
2012-01-09 17:56:05 +01:00
|
|
|
void DocHost_Init(DocHost *This, IWebBrowser2 *wb, const IDocHostContainerVtbl* container)
|
2005-11-17 12:03:53 +01:00
|
|
|
{
|
2010-11-13 17:48:09 +01:00
|
|
|
This->IDocHostUIHandler2_iface.lpVtbl = &DocHostUIHandler2Vtbl;
|
|
|
|
This->IOleCommandTarget_iface.lpVtbl = &OleCommandTargetVtbl;
|
|
|
|
This->IPropertyNotifySink_iface.lpVtbl = &PropertyNotifySinkVtbl;
|
2005-11-28 11:17:28 +01:00
|
|
|
|
2012-01-09 17:56:05 +01:00
|
|
|
This->wb = wb;
|
2010-07-29 10:28:02 +02:00
|
|
|
This->container_vtbl = container;
|
|
|
|
|
2009-08-30 01:02:03 +02:00
|
|
|
This->ready_state = READYSTATE_UNINITIALIZED;
|
2011-05-26 17:01:42 +02:00
|
|
|
list_init(&This->task_queue);
|
2009-08-30 01:02:03 +02:00
|
|
|
|
2013-04-02 17:39:21 +02:00
|
|
|
This->travellog.loading_pos = -1;
|
|
|
|
|
2006-04-18 00:38:06 +02:00
|
|
|
DocHost_ClientSite_Init(This);
|
|
|
|
DocHost_Frame_Init(This);
|
2006-05-17 18:26:30 +02:00
|
|
|
|
2012-01-09 17:56:05 +01:00
|
|
|
ConnectionPointContainer_Init(&This->cps, (IUnknown*)wb);
|
2012-01-06 12:59:58 +01:00
|
|
|
IEHTMLWindow_Init(This);
|
2012-01-06 13:00:22 +01:00
|
|
|
NewWindowManager_Init(This);
|
2006-04-18 00:41:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void DocHost_Release(DocHost *This)
|
|
|
|
{
|
2012-05-16 13:21:02 +02:00
|
|
|
if(This->shell_ui_helper)
|
|
|
|
IShellUIHelper2_Release(This->shell_ui_helper);
|
|
|
|
|
2011-05-26 17:02:03 +02:00
|
|
|
abort_dochost_tasks(This, NULL);
|
2010-01-22 17:12:26 +01:00
|
|
|
release_dochost_client(This);
|
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
|
|
|
|
2013-04-02 17:39:07 +02:00
|
|
|
while(This->travellog.length)
|
2013-04-02 17:39:34 +02:00
|
|
|
free_travellog_entry(This->travellog.log + --This->travellog.length);
|
2013-04-02 17:39:07 +02:00
|
|
|
heap_free(This->travellog.log);
|
2012-01-20 15:16:10 +01:00
|
|
|
|
2010-06-29 21:03:22 +02:00
|
|
|
heap_free(This->url);
|
2005-11-17 12:03:53 +01:00
|
|
|
}
|