2005-04-11 18:11:52 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2005 Jacek Caban
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-04-11 18:11:52 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
2005-08-11 20:36:48 +02:00
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
2005-04-11 18:11:52 +02:00
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "ole2.h"
|
2005-08-25 17:19:19 +02:00
|
|
|
#include "shlguid.h"
|
2006-11-02 17:30:27 +01:00
|
|
|
#include "idispids.h"
|
2005-04-11 18:11:52 +02:00
|
|
|
|
2011-11-10 14:35:50 +01:00
|
|
|
#define NO_SHLWAPI_REG
|
|
|
|
#include "shlwapi.h"
|
|
|
|
|
2005-04-11 18:11:52 +02:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
#include "mshtml_private.h"
|
2009-11-30 18:02:44 +01:00
|
|
|
#include "htmlevent.h"
|
2011-07-23 12:50:11 +02:00
|
|
|
#include "binding.h"
|
2010-07-30 21:56:05 +02:00
|
|
|
#include "resource.h"
|
2005-04-11 18:11:52 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|
|
|
|
2012-01-20 15:11:06 +01:00
|
|
|
/* Undocumented notification, see tests */
|
|
|
|
#define CMDID_EXPLORER_UPDATEHISTORY 38
|
|
|
|
|
2009-12-07 14:51:52 +01:00
|
|
|
typedef struct {
|
|
|
|
task_t header;
|
|
|
|
HTMLDocumentObj *doc;
|
|
|
|
BOOL set_download;
|
2010-07-30 21:56:05 +02:00
|
|
|
LPOLESTR url;
|
2009-12-07 14:51:52 +01:00
|
|
|
} download_proc_task_t;
|
|
|
|
|
2012-06-25 14:04:59 +02:00
|
|
|
static BOOL use_gecko_script(HTMLOuterWindow *window)
|
2008-09-24 18:19:46 +02:00
|
|
|
{
|
2012-03-27 13:40:01 +02:00
|
|
|
DWORD zone;
|
2011-03-29 12:51:21 +02:00
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IInternetSecurityManager_MapUrlToZone(window->secmgr, window->url, &zone, 0);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
WARN("Could not map %s to zone: %08x\n", debugstr_w(window->url), hres);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("zone %d\n", zone);
|
2012-03-27 13:40:01 +02:00
|
|
|
return zone == URLZONE_UNTRUSTED;
|
2008-09-24 18:19:46 +02:00
|
|
|
}
|
|
|
|
|
2012-01-20 15:11:06 +01:00
|
|
|
static void notify_travellog_update(HTMLDocumentObj *doc)
|
|
|
|
{
|
|
|
|
IOleCommandTarget *cmdtrg;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
if(!doc->is_webbrowser)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Don't notify if we were in about: page */
|
|
|
|
if(doc->basedoc.window->uri) {
|
|
|
|
DWORD scheme;
|
|
|
|
|
|
|
|
hres = IUri_GetScheme(doc->basedoc.window->uri, &scheme);
|
|
|
|
if(SUCCEEDED(hres) && scheme == URL_SCHEME_ABOUT)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&cmdtrg);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
VARIANT vin;
|
|
|
|
|
|
|
|
V_VT(&vin) = VT_I4;
|
|
|
|
V_I4(&vin) = 0;
|
|
|
|
|
|
|
|
IOleCommandTarget_Exec(cmdtrg, &CGID_Explorer, CMDID_EXPLORER_UPDATEHISTORY, 0, &vin, NULL);
|
|
|
|
IOleCommandTarget_Release(cmdtrg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-25 14:04:59 +02:00
|
|
|
void set_current_uri(HTMLOuterWindow *window, IUri *uri)
|
2011-11-15 13:30:12 +01:00
|
|
|
{
|
|
|
|
if(window->uri) {
|
|
|
|
IUri_Release(window->uri);
|
|
|
|
window->uri = NULL;
|
|
|
|
}
|
|
|
|
|
2012-01-16 00:16:26 +01:00
|
|
|
SysFreeString(window->url);
|
|
|
|
window->url = NULL;
|
2011-11-15 13:30:12 +01:00
|
|
|
|
|
|
|
if(!uri)
|
|
|
|
return;
|
|
|
|
|
|
|
|
IUri_AddRef(uri);
|
|
|
|
window->uri = uri;
|
|
|
|
|
|
|
|
IUri_GetDisplayUri(uri, &window->url);
|
|
|
|
}
|
|
|
|
|
2012-06-25 14:04:59 +02:00
|
|
|
void set_current_mon(HTMLOuterWindow *This, IMoniker *mon)
|
2007-06-11 17:27:19 +02:00
|
|
|
{
|
2011-11-10 14:35:41 +01:00
|
|
|
IUriContainer *uri_container;
|
2011-11-15 13:30:12 +01:00
|
|
|
IUri *uri = NULL;
|
2007-06-11 17:37:20 +02:00
|
|
|
HRESULT hres;
|
|
|
|
|
2009-10-26 23:04:28 +01:00
|
|
|
if(This->mon) {
|
2012-01-20 15:11:06 +01:00
|
|
|
if(This->doc_obj)
|
|
|
|
notify_travellog_update(This->doc_obj);
|
2009-10-26 23:04:28 +01:00
|
|
|
IMoniker_Release(This->mon);
|
|
|
|
This->mon = NULL;
|
2007-06-11 17:37:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(!mon)
|
|
|
|
return;
|
|
|
|
|
|
|
|
IMoniker_AddRef(mon);
|
2009-10-26 23:04:28 +01:00
|
|
|
This->mon = mon;
|
2007-06-11 17:37:20 +02:00
|
|
|
|
2011-11-10 14:35:41 +01:00
|
|
|
hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
|
2011-11-10 14:35:11 +01:00
|
|
|
if(SUCCEEDED(hres)) {
|
2011-11-15 13:30:12 +01:00
|
|
|
hres = IUriContainer_GetIUri(uri_container, &uri);
|
2011-11-10 14:35:41 +01:00
|
|
|
IUriContainer_Release(uri_container);
|
|
|
|
if(hres != S_OK) {
|
|
|
|
WARN("GetIUri failed: %08x\n", hres);
|
2011-11-15 13:30:12 +01:00
|
|
|
uri = NULL;
|
2011-11-10 14:35:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-15 13:30:12 +01:00
|
|
|
if(!uri) {
|
2011-11-10 14:35:41 +01:00
|
|
|
WCHAR *url;
|
|
|
|
|
|
|
|
hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
|
|
|
|
if(SUCCEEDED(hres)) {
|
2011-11-15 13:30:12 +01:00
|
|
|
hres = CreateUri(url, 0, 0, &uri);
|
2011-11-10 14:35:41 +01:00
|
|
|
if(FAILED(hres)) {
|
|
|
|
WARN("CrateUri failed: %08x\n", hres);
|
2011-11-15 13:30:12 +01:00
|
|
|
set_current_uri(This, NULL);
|
2011-11-10 14:35:41 +01:00
|
|
|
This->url = SysAllocString(url);
|
2011-11-15 13:30:12 +01:00
|
|
|
CoTaskMemFree(url);
|
|
|
|
return;
|
2011-11-10 14:35:41 +01:00
|
|
|
}
|
|
|
|
CoTaskMemFree(url);
|
|
|
|
}else {
|
|
|
|
WARN("GetDisplayName failed: %08x\n", hres);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-15 13:30:12 +01:00
|
|
|
set_current_uri(This, uri);
|
|
|
|
if(uri)
|
|
|
|
IUri_Release(uri);
|
2011-03-29 12:51:21 +02:00
|
|
|
set_script_mode(This, use_gecko_script(This) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT);
|
2007-06-11 17:27:19 +02:00
|
|
|
}
|
|
|
|
|
2012-06-25 14:04:59 +02:00
|
|
|
HRESULT create_relative_uri(HTMLOuterWindow *window, const WCHAR *rel_uri, IUri **uri)
|
2012-01-27 15:55:46 +01:00
|
|
|
{
|
|
|
|
return window->uri
|
|
|
|
? CoInternetCombineUrlEx(window->uri, rel_uri, URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO, uri, 0)
|
|
|
|
: CreateUri(rel_uri, 0, 0, uri);
|
|
|
|
}
|
|
|
|
|
2011-07-23 12:50:49 +02:00
|
|
|
void set_download_state(HTMLDocumentObj *doc, int state)
|
|
|
|
{
|
|
|
|
if(doc->client) {
|
|
|
|
IOleCommandTarget *olecmd;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
VARIANT var;
|
|
|
|
|
|
|
|
V_VT(&var) = VT_I4;
|
|
|
|
V_I4(&var) = state;
|
|
|
|
|
|
|
|
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETDOWNLOADSTATE,
|
|
|
|
OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
|
|
|
|
IOleCommandTarget_Release(olecmd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
doc->download_state = state;
|
|
|
|
}
|
|
|
|
|
2009-10-26 23:05:10 +01:00
|
|
|
static void set_progress_proc(task_t *_task)
|
|
|
|
{
|
|
|
|
docobj_task_t *task = (docobj_task_t*)_task;
|
|
|
|
IOleCommandTarget *olecmd = NULL;
|
|
|
|
HTMLDocumentObj *doc = task->doc;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", doc);
|
|
|
|
|
|
|
|
if(doc->client)
|
|
|
|
IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
|
|
|
|
|
|
|
|
if(olecmd) {
|
|
|
|
VARIANT progress_max, progress;
|
|
|
|
|
|
|
|
V_VT(&progress_max) = VT_I4;
|
|
|
|
V_I4(&progress_max) = 0; /* FIXME */
|
|
|
|
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETPROGRESSMAX, OLECMDEXECOPT_DONTPROMPTUSER,
|
|
|
|
&progress_max, NULL);
|
|
|
|
|
|
|
|
V_VT(&progress) = VT_I4;
|
|
|
|
V_I4(&progress) = 0; /* FIXME */
|
|
|
|
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETPROGRESSPOS, OLECMDEXECOPT_DONTPROMPTUSER,
|
|
|
|
&progress, NULL);
|
2010-03-13 16:42:25 +01:00
|
|
|
IOleCommandTarget_Release(olecmd);
|
2009-10-26 23:05:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(doc->usermode == EDITMODE && doc->hostui) {
|
|
|
|
DOCHOSTUIINFO hostinfo;
|
|
|
|
|
|
|
|
memset(&hostinfo, 0, sizeof(DOCHOSTUIINFO));
|
|
|
|
hostinfo.cbSize = sizeof(DOCHOSTUIINFO);
|
|
|
|
hres = IDocHostUIHandler_GetHostInfo(doc->hostui, &hostinfo);
|
|
|
|
if(SUCCEEDED(hres))
|
|
|
|
/* FIXME: use hostinfo */
|
|
|
|
TRACE("hostinfo = {%u %08x %08x %s %s}\n",
|
|
|
|
hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
|
|
|
|
debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void set_downloading_proc(task_t *_task)
|
|
|
|
{
|
2009-12-07 14:51:52 +01:00
|
|
|
download_proc_task_t *task = (download_proc_task_t*)_task;
|
|
|
|
HTMLDocumentObj *doc = task->doc;
|
2009-10-26 23:05:10 +01:00
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", doc);
|
|
|
|
|
2010-07-30 21:56:05 +02:00
|
|
|
set_statustext(doc, IDS_STATUS_DOWNLOADINGFROM, task->url);
|
2009-10-26 23:05:10 +01:00
|
|
|
|
2011-07-23 12:50:49 +02:00
|
|
|
if(task->set_download)
|
|
|
|
set_download_state(doc, 1);
|
|
|
|
|
2009-10-26 23:05:10 +01:00
|
|
|
if(!doc->client)
|
|
|
|
return;
|
|
|
|
|
2010-03-03 14:55:43 +01:00
|
|
|
if(doc->view_sink)
|
|
|
|
IAdviseSink_OnViewChange(doc->view_sink, DVASPECT_CONTENT, -1);
|
|
|
|
|
2009-10-26 23:05:10 +01:00
|
|
|
if(doc->hostui) {
|
|
|
|
IDropTarget *drop_target = NULL;
|
|
|
|
|
|
|
|
hres = IDocHostUIHandler_GetDropTarget(doc->hostui, NULL /* FIXME */, &drop_target);
|
2012-02-10 19:40:59 +01:00
|
|
|
if(SUCCEEDED(hres) && drop_target) {
|
2009-10-26 23:05:10 +01:00
|
|
|
FIXME("Use IDropTarget\n");
|
|
|
|
IDropTarget_Release(drop_target);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:36:41 +02:00
|
|
|
static void set_downloading_task_destr(task_t *_task)
|
|
|
|
{
|
|
|
|
download_proc_task_t *task = (download_proc_task_t*)_task;
|
|
|
|
|
|
|
|
CoTaskMemFree(task->url);
|
|
|
|
heap_free(task);
|
|
|
|
}
|
|
|
|
|
2011-11-12 14:33:39 +01:00
|
|
|
void prepare_for_binding(HTMLDocument *This, IMoniker *mon, BOOL navigated_binding)
|
2005-04-11 18:11:52 +02:00
|
|
|
{
|
2005-08-01 12:59:45 +02:00
|
|
|
HRESULT hres;
|
|
|
|
|
2009-09-16 22:10:03 +02:00
|
|
|
if(This->doc_obj->client) {
|
2006-11-02 17:30:27 +01:00
|
|
|
VARIANT silent, offline;
|
|
|
|
|
2009-09-16 22:10:03 +02:00
|
|
|
hres = get_client_disp_property(This->doc_obj->client, DISPID_AMBIENT_SILENT, &silent);
|
2006-11-02 17:30:27 +01:00
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
if(V_VT(&silent) != VT_BOOL)
|
2012-03-28 14:27:20 +02:00
|
|
|
WARN("silent = %s\n", debugstr_variant(&silent));
|
2006-11-02 17:30:27 +01:00
|
|
|
else if(V_BOOL(&silent))
|
|
|
|
FIXME("silent == true\n");
|
|
|
|
}
|
|
|
|
|
2009-09-16 22:10:03 +02:00
|
|
|
hres = get_client_disp_property(This->doc_obj->client,
|
2006-11-02 17:30:27 +01:00
|
|
|
DISPID_AMBIENT_OFFLINEIFNOTCONNECTED, &offline);
|
|
|
|
if(SUCCEEDED(hres)) {
|
2011-02-16 02:22:58 +01:00
|
|
|
if(V_VT(&offline) != VT_BOOL)
|
2012-03-28 14:27:20 +02:00
|
|
|
WARN("offline = %s\n", debugstr_variant(&offline));
|
2011-02-16 02:22:58 +01:00
|
|
|
else if(V_BOOL(&offline))
|
2006-11-02 17:30:27 +01:00
|
|
|
FIXME("offline == true\n");
|
|
|
|
}
|
2010-03-03 14:56:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(This->window->mon) {
|
|
|
|
update_doc(This, UPDATE_TITLE|UPDATE_UI);
|
|
|
|
}else {
|
|
|
|
update_doc(This, UPDATE_TITLE);
|
|
|
|
set_current_mon(This->window, mon);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(This->doc_obj->client) {
|
|
|
|
IOleCommandTarget *cmdtrg = NULL;
|
2007-06-11 17:26:31 +02:00
|
|
|
|
2009-09-16 22:10:03 +02:00
|
|
|
hres = IOleClientSite_QueryInterface(This->doc_obj->client, &IID_IOleCommandTarget,
|
2007-06-11 17:26:31 +02:00
|
|
|
(void**)&cmdtrg);
|
|
|
|
if(SUCCEEDED(hres)) {
|
2010-03-03 14:56:21 +01:00
|
|
|
VARIANT var, out;
|
|
|
|
|
2011-07-23 12:51:38 +02:00
|
|
|
if(!navigated_binding) {
|
2010-03-03 14:56:21 +01:00
|
|
|
V_VT(&var) = VT_I4;
|
|
|
|
V_I4(&var) = 0;
|
|
|
|
IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 37, 0, &var, NULL);
|
|
|
|
}else {
|
|
|
|
V_VT(&var) = VT_UNKNOWN;
|
2012-06-25 14:04:59 +02:00
|
|
|
V_UNKNOWN(&var) = (IUnknown*)&This->window->base.IHTMLWindow2_iface;
|
2010-03-03 14:56:21 +01:00
|
|
|
V_VT(&out) = VT_EMPTY;
|
|
|
|
hres = IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 63, 0, &var, &out);
|
|
|
|
if(SUCCEEDED(hres))
|
|
|
|
VariantClear(&out);
|
|
|
|
}
|
2007-06-11 17:26:31 +02:00
|
|
|
|
|
|
|
IOleCommandTarget_Release(cmdtrg);
|
|
|
|
}
|
2006-11-02 17:30:27 +01:00
|
|
|
}
|
2011-07-23 12:51:38 +02:00
|
|
|
}
|
2006-11-02 17:30:27 +01:00
|
|
|
|
2011-07-23 12:51:38 +02:00
|
|
|
HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, nsChannelBSC *async_bsc, BOOL set_download)
|
|
|
|
{
|
|
|
|
download_proc_task_t *download_task;
|
|
|
|
nsChannelBSC *bscallback;
|
|
|
|
nsWineURI *nsuri;
|
|
|
|
LPOLESTR url;
|
|
|
|
HRESULT hres;
|
2010-01-04 00:38:57 +01:00
|
|
|
|
2011-07-23 12:51:38 +02:00
|
|
|
hres = IMoniker_GetDisplayName(mon, pibc, NULL, &url);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
WARN("GetDiaplayName failed: %08x\n", hres);
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("got url: %s\n", debugstr_w(url));
|
|
|
|
|
|
|
|
set_ready_state(This->window, READYSTATE_LOADING);
|
|
|
|
|
|
|
|
hres = create_doc_uri(This->window, url, &nsuri);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
if(async_bsc)
|
2010-07-30 21:56:05 +02:00
|
|
|
bscallback = async_bsc;
|
2011-07-23 12:51:38 +02:00
|
|
|
else
|
2012-07-12 14:26:13 +02:00
|
|
|
hres = create_channelbsc(mon, NULL, NULL, 0, TRUE, &bscallback);
|
2010-03-03 14:56:21 +01:00
|
|
|
}
|
2006-06-03 00:39:39 +02:00
|
|
|
|
2011-07-23 12:51:38 +02:00
|
|
|
if(SUCCEEDED(hres)) {
|
2011-01-31 20:28:23 +01:00
|
|
|
remove_target_tasks(This->task_magic);
|
2012-07-11 13:51:00 +02:00
|
|
|
abort_window_bindings(This->window->base.inner_window);
|
2011-01-31 20:28:23 +01:00
|
|
|
|
2011-07-23 12:51:38 +02:00
|
|
|
hres = load_nsuri(This->window, nsuri, bscallback, 0/*LOAD_INITIAL_DOCUMENT_URI*/);
|
2010-07-30 21:56:05 +02:00
|
|
|
nsISupports_Release((nsISupports*)nsuri); /* FIXME */
|
|
|
|
if(SUCCEEDED(hres))
|
2012-07-12 14:25:43 +02:00
|
|
|
hres = create_pending_window(This->window, bscallback);
|
2010-07-30 21:56:05 +02:00
|
|
|
if(bscallback != async_bsc)
|
2012-07-26 11:37:48 +02:00
|
|
|
IBindStatusCallback_Release(&bscallback->bsc.IBindStatusCallback_iface);
|
2010-07-30 21:56:05 +02:00
|
|
|
}
|
|
|
|
|
2011-07-23 12:51:38 +02:00
|
|
|
if(FAILED(hres)) {
|
2010-07-30 21:56:05 +02:00
|
|
|
CoTaskMemFree(url);
|
2010-01-04 00:38:57 +01:00
|
|
|
return hres;
|
2010-07-30 21:56:05 +02:00
|
|
|
}
|
2010-01-04 00:38:57 +01:00
|
|
|
|
2010-03-03 14:56:01 +01:00
|
|
|
HTMLDocument_LockContainer(This->doc_obj, TRUE);
|
|
|
|
|
2009-09-16 22:10:03 +02:00
|
|
|
if(This->doc_obj->frame) {
|
2011-07-23 12:51:38 +02:00
|
|
|
docobj_task_t *task;
|
|
|
|
|
2009-10-26 23:05:10 +01:00
|
|
|
task = heap_alloc(sizeof(docobj_task_t));
|
|
|
|
task->doc = This->doc_obj;
|
2011-08-03 12:34:34 +02:00
|
|
|
push_task(&task->header, set_progress_proc, NULL, This->doc_obj->basedoc.task_magic);
|
2006-11-02 17:34:01 +01:00
|
|
|
}
|
|
|
|
|
2009-12-07 14:51:52 +01:00
|
|
|
download_task = heap_alloc(sizeof(download_proc_task_t));
|
|
|
|
download_task->doc = This->doc_obj;
|
|
|
|
download_task->set_download = set_download;
|
2010-07-30 21:56:05 +02:00
|
|
|
download_task->url = url;
|
2011-08-03 12:36:41 +02:00
|
|
|
push_task(&download_task->header, set_downloading_proc, set_downloading_task_destr, This->doc_obj->basedoc.task_magic);
|
2006-09-24 23:12:06 +02:00
|
|
|
|
2007-05-11 13:16:15 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2012-06-25 14:04:59 +02:00
|
|
|
void set_ready_state(HTMLOuterWindow *window, READYSTATE readystate)
|
2009-11-01 19:24:19 +01:00
|
|
|
{
|
2009-11-01 19:25:13 +01:00
|
|
|
window->readystate = readystate;
|
2010-03-18 01:04:45 +01:00
|
|
|
|
2009-11-30 18:02:44 +01:00
|
|
|
if(window->doc_obj && window->doc_obj->basedoc.window == window)
|
2009-11-01 19:24:19 +01:00
|
|
|
call_property_onchanged(&window->doc_obj->basedoc.cp_propnotif, DISPID_READYSTATE);
|
2010-03-18 01:04:45 +01:00
|
|
|
|
2012-06-25 14:05:17 +02:00
|
|
|
fire_event(window->base.inner_window->doc, EVENTID_READYSTATECHANGE, FALSE, window->base.inner_window->doc->node.nsnode, NULL);
|
2010-03-18 01:04:45 +01:00
|
|
|
|
2009-11-30 18:02:44 +01:00
|
|
|
if(window->frame_element)
|
|
|
|
fire_event(window->frame_element->element.node.doc, EVENTID_READYSTATECHANGE,
|
2010-03-18 01:04:45 +01:00
|
|
|
TRUE, window->frame_element->element.node.nsnode, NULL);
|
2009-11-01 19:24:19 +01:00
|
|
|
}
|
|
|
|
|
2009-10-21 21:27:42 +02:00
|
|
|
static HRESULT get_doc_string(HTMLDocumentNode *This, char **str)
|
2007-05-11 13:16:15 +02:00
|
|
|
{
|
|
|
|
nsIDOMNode *nsnode;
|
|
|
|
LPCWSTR strw;
|
|
|
|
nsAString nsstr;
|
|
|
|
nsresult nsres;
|
2011-08-04 14:05:37 +02:00
|
|
|
HRESULT hres;
|
2007-05-11 13:16:15 +02:00
|
|
|
|
2008-10-08 20:27:59 +02:00
|
|
|
if(!This->nsdoc) {
|
|
|
|
WARN("NULL nsdoc\n");
|
|
|
|
return E_UNEXPECTED;
|
2007-05-11 13:16:15 +02:00
|
|
|
}
|
|
|
|
|
2008-10-08 20:27:59 +02:00
|
|
|
nsres = nsIDOMHTMLDocument_QueryInterface(This->nsdoc, &IID_nsIDOMNode, (void**)&nsnode);
|
2007-05-11 13:16:15 +02:00
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("Could not get nsIDOMNode failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAString_Init(&nsstr, NULL);
|
2011-08-04 14:05:37 +02:00
|
|
|
hres = nsnode_to_nsstring(nsnode, &nsstr);
|
2007-05-11 13:16:15 +02:00
|
|
|
nsIDOMNode_Release(nsnode);
|
2011-08-04 14:05:37 +02:00
|
|
|
if(FAILED(hres)) {
|
|
|
|
nsAString_Finish(&nsstr);
|
|
|
|
return hres;
|
|
|
|
}
|
2007-05-11 13:16:15 +02:00
|
|
|
|
2007-12-17 01:38:30 +01:00
|
|
|
nsAString_GetData(&nsstr, &strw);
|
2007-05-11 13:16:15 +02:00
|
|
|
TRACE("%s\n", debugstr_w(strw));
|
|
|
|
|
2009-08-11 19:15:59 +02:00
|
|
|
*str = heap_strdupWtoA(strw);
|
2007-05-11 13:16:15 +02:00
|
|
|
|
|
|
|
nsAString_Finish(&nsstr);
|
|
|
|
|
2011-08-04 14:05:37 +02:00
|
|
|
if(!*str)
|
|
|
|
return E_OUTOFMEMORY;
|
2007-05-11 13:16:15 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* IPersistMoniker implementation
|
|
|
|
*/
|
|
|
|
|
2010-12-22 10:48:41 +01:00
|
|
|
static inline HTMLDocument *impl_from_IPersistMoniker(IPersistMoniker *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDocument, IPersistMoniker_iface);
|
|
|
|
}
|
2007-05-11 13:16:15 +02:00
|
|
|
|
2010-12-16 14:59:51 +01:00
|
|
|
static HRESULT WINAPI PersistMoniker_QueryInterface(IPersistMoniker *iface, REFIID riid, void **ppv)
|
2007-05-11 13:16:15 +02:00
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistMoniker(iface);
|
2010-12-16 14:59:51 +01:00
|
|
|
return htmldoc_query_interface(This, riid, ppv);
|
2007-05-11 13:16:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI PersistMoniker_AddRef(IPersistMoniker *iface)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistMoniker(iface);
|
2010-12-16 14:59:51 +01:00
|
|
|
return htmldoc_addref(This);
|
2007-05-11 13:16:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI PersistMoniker_Release(IPersistMoniker *iface)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistMoniker(iface);
|
2010-12-16 14:59:51 +01:00
|
|
|
return htmldoc_release(This);
|
2007-05-11 13:16:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistMoniker_GetClassID(IPersistMoniker *iface, CLSID *pClassID)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistMoniker(iface);
|
2012-07-26 11:37:48 +02:00
|
|
|
return IPersistFile_GetClassID(&This->IPersistFile_iface, pClassID);
|
2007-05-11 13:16:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistMoniker_IsDirty(IPersistMoniker *iface)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistMoniker(iface);
|
2007-06-10 11:35:55 +02:00
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
2010-12-22 10:48:41 +01:00
|
|
|
return IPersistStreamInit_IsDirty(&This->IPersistStreamInit_iface);
|
2007-05-11 13:16:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAvailable,
|
|
|
|
IMoniker *pimkName, LPBC pibc, DWORD grfMode)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistMoniker(iface);
|
2007-05-11 13:16:15 +02:00
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%x %p %p %08x)\n", This, fFullyAvailable, pimkName, pibc, grfMode);
|
|
|
|
|
2010-03-03 14:55:24 +01:00
|
|
|
if(pibc) {
|
|
|
|
IUnknown *unk = NULL;
|
|
|
|
|
|
|
|
/* FIXME:
|
|
|
|
* Use params:
|
|
|
|
* "__PrecreatedObject"
|
|
|
|
* "BIND_CONTEXT_PARAM"
|
|
|
|
* "__HTMLLOADOPTIONS"
|
|
|
|
* "__DWNBINDINFO"
|
|
|
|
* "URL Context"
|
|
|
|
* "_ITransData_Object_"
|
|
|
|
* "_EnumFORMATETC_"
|
|
|
|
*/
|
|
|
|
|
|
|
|
IBindCtx_GetObjectParam(pibc, (LPOLESTR)SZ_HTML_CLIENTSITE_OBJECTPARAM, &unk);
|
|
|
|
if(unk) {
|
|
|
|
IOleClientSite *client = NULL;
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(unk, &IID_IOleClientSite, (void**)&client);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
TRACE("Got client site %p\n", client);
|
2010-12-23 02:16:00 +01:00
|
|
|
IOleObject_SetClientSite(&This->IOleObject_iface, client);
|
2010-03-03 14:55:24 +01:00
|
|
|
IOleClientSite_Release(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
IUnknown_Release(unk);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-12 14:33:39 +01:00
|
|
|
prepare_for_binding(This, pimkName, FALSE);
|
2012-05-29 14:38:04 +02:00
|
|
|
call_docview_84(This->doc_obj);
|
2010-03-03 14:56:21 +01:00
|
|
|
hres = set_moniker(This, pimkName, pibc, NULL, TRUE);
|
2007-05-11 13:16:15 +02:00
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
2012-07-12 14:26:13 +02:00
|
|
|
return start_binding(This->window->pending_window, (BSCallback*)This->window->pending_window->bscallback, pibc);
|
2005-04-11 18:11:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistMoniker_Save(IPersistMoniker *iface, IMoniker *pimkName,
|
|
|
|
LPBC pbc, BOOL fRemember)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistMoniker(iface);
|
2005-08-09 22:46:05 +02:00
|
|
|
FIXME("(%p)->(%p %p %x)\n", This, pimkName, pbc, fRemember);
|
2005-04-11 18:11:52 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistMoniker_SaveCompleted(IPersistMoniker *iface, IMoniker *pimkName, LPBC pibc)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistMoniker(iface);
|
2005-08-09 22:46:05 +02:00
|
|
|
FIXME("(%p)->(%p %p)\n", This, pimkName, pibc);
|
2005-04-11 18:11:52 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistMoniker_GetCurMoniker(IPersistMoniker *iface, IMoniker **ppimkName)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistMoniker(iface);
|
2007-06-11 17:29:13 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, ppimkName);
|
|
|
|
|
2009-10-26 23:04:28 +01:00
|
|
|
if(!This->window || !This->window->mon)
|
2007-06-11 17:29:13 +02:00
|
|
|
return E_UNEXPECTED;
|
|
|
|
|
2009-10-26 23:04:28 +01:00
|
|
|
IMoniker_AddRef(This->window->mon);
|
|
|
|
*ppimkName = This->window->mon;
|
2007-06-11 17:29:13 +02:00
|
|
|
return S_OK;
|
2005-04-11 18:11:52 +02:00
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IPersistMonikerVtbl PersistMonikerVtbl = {
|
2005-04-11 18:11:52 +02:00
|
|
|
PersistMoniker_QueryInterface,
|
|
|
|
PersistMoniker_AddRef,
|
|
|
|
PersistMoniker_Release,
|
|
|
|
PersistMoniker_GetClassID,
|
|
|
|
PersistMoniker_IsDirty,
|
|
|
|
PersistMoniker_Load,
|
|
|
|
PersistMoniker_Save,
|
|
|
|
PersistMoniker_SaveCompleted,
|
|
|
|
PersistMoniker_GetCurMoniker
|
|
|
|
};
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* IMonikerProp implementation
|
|
|
|
*/
|
|
|
|
|
2010-12-23 02:12:25 +01:00
|
|
|
static inline HTMLDocument *impl_from_IMonikerProp(IMonikerProp *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDocument, IMonikerProp_iface);
|
|
|
|
}
|
2005-04-11 18:11:52 +02:00
|
|
|
|
2010-12-16 14:59:51 +01:00
|
|
|
static HRESULT WINAPI MonikerProp_QueryInterface(IMonikerProp *iface, REFIID riid, void **ppv)
|
2005-04-11 18:11:52 +02:00
|
|
|
{
|
2010-12-23 02:12:25 +01:00
|
|
|
HTMLDocument *This = impl_from_IMonikerProp(iface);
|
2010-12-16 14:59:51 +01:00
|
|
|
return htmldoc_query_interface(This, riid, ppv);
|
2005-04-11 18:11:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI MonikerProp_AddRef(IMonikerProp *iface)
|
|
|
|
{
|
2010-12-23 02:12:25 +01:00
|
|
|
HTMLDocument *This = impl_from_IMonikerProp(iface);
|
2010-12-16 14:59:51 +01:00
|
|
|
return htmldoc_addref(This);
|
2005-04-11 18:11:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI MonikerProp_Release(IMonikerProp *iface)
|
|
|
|
{
|
2010-12-23 02:12:25 +01:00
|
|
|
HTMLDocument *This = impl_from_IMonikerProp(iface);
|
2010-12-16 14:59:51 +01:00
|
|
|
return htmldoc_release(This);
|
2005-04-11 18:11:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MonikerProp_PutProperty(IMonikerProp *iface, MONIKERPROPERTY mkp, LPCWSTR val)
|
|
|
|
{
|
2010-12-23 02:12:25 +01:00
|
|
|
HTMLDocument *This = impl_from_IMonikerProp(iface);
|
2007-12-31 01:32:48 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%d %s)\n", This, mkp, debugstr_w(val));
|
|
|
|
|
|
|
|
switch(mkp) {
|
|
|
|
case MIMETYPEPROP:
|
2009-09-16 22:12:56 +02:00
|
|
|
heap_free(This->doc_obj->mime);
|
|
|
|
This->doc_obj->mime = heap_strdupW(val);
|
2007-12-31 01:32:48 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CLASSIDPROP:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
FIXME("mkp %d\n", mkp);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2005-04-11 18:11:52 +02:00
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IMonikerPropVtbl MonikerPropVtbl = {
|
2005-04-11 18:11:52 +02:00
|
|
|
MonikerProp_QueryInterface,
|
|
|
|
MonikerProp_AddRef,
|
|
|
|
MonikerProp_Release,
|
|
|
|
MonikerProp_PutProperty
|
|
|
|
};
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
* IPersistFile implementation
|
|
|
|
*/
|
|
|
|
|
2010-12-22 10:48:41 +01:00
|
|
|
static inline HTMLDocument *impl_from_IPersistFile(IPersistFile *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDocument, IPersistFile_iface);
|
|
|
|
}
|
2005-04-11 18:11:52 +02:00
|
|
|
|
2010-12-16 14:59:51 +01:00
|
|
|
static HRESULT WINAPI PersistFile_QueryInterface(IPersistFile *iface, REFIID riid, void **ppv)
|
2005-04-11 18:11:52 +02:00
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistFile(iface);
|
2010-12-16 14:59:51 +01:00
|
|
|
return htmldoc_query_interface(This, riid, ppv);
|
2005-04-11 18:11:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI PersistFile_AddRef(IPersistFile *iface)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistFile(iface);
|
2010-12-16 14:59:51 +01:00
|
|
|
return htmldoc_addref(This);
|
2005-04-11 18:11:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI PersistFile_Release(IPersistFile *iface)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistFile(iface);
|
2010-12-16 14:59:51 +01:00
|
|
|
return htmldoc_release(This);
|
2005-04-11 18:11:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistFile_GetClassID(IPersistFile *iface, CLSID *pClassID)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistFile(iface);
|
2005-08-09 22:46:05 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, pClassID);
|
2005-04-11 18:11:52 +02:00
|
|
|
|
|
|
|
if(!pClassID)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2008-03-05 22:35:16 +01:00
|
|
|
*pClassID = CLSID_HTMLDocument;
|
2005-04-11 18:11:52 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistFile_IsDirty(IPersistFile *iface)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistFile(iface);
|
2007-06-10 11:35:55 +02:00
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
2010-12-22 10:48:41 +01:00
|
|
|
return IPersistStreamInit_IsDirty(&This->IPersistStreamInit_iface);
|
2005-04-11 18:11:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistFile_Load(IPersistFile *iface, LPCOLESTR pszFileName, DWORD dwMode)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistFile(iface);
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("(%p)->(%s %08x)\n", This, debugstr_w(pszFileName), dwMode);
|
2005-04-11 18:11:52 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistFile_Save(IPersistFile *iface, LPCOLESTR pszFileName, BOOL fRemember)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistFile(iface);
|
2007-04-12 21:26:17 +02:00
|
|
|
char *str;
|
2009-08-11 19:15:59 +02:00
|
|
|
DWORD written=0;
|
2007-04-12 21:26:17 +02:00
|
|
|
HANDLE file;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s %x)\n", This, debugstr_w(pszFileName), fRemember);
|
|
|
|
|
|
|
|
file = CreateFileW(pszFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
|
|
|
|
FILE_ATTRIBUTE_NORMAL, NULL);
|
|
|
|
if(file == INVALID_HANDLE_VALUE) {
|
|
|
|
WARN("Could not create file: %u\n", GetLastError());
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2009-10-21 21:27:42 +02:00
|
|
|
hres = get_doc_string(This->doc_node, &str);
|
2008-10-08 20:27:59 +02:00
|
|
|
if(SUCCEEDED(hres))
|
2009-08-11 19:15:59 +02:00
|
|
|
WriteFile(file, str, strlen(str), &written, NULL);
|
2007-04-12 21:26:17 +02:00
|
|
|
|
|
|
|
CloseHandle(file);
|
2008-10-08 20:27:59 +02:00
|
|
|
return hres;
|
2005-04-11 18:11:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistFile_SaveCompleted(IPersistFile *iface, LPCOLESTR pszFileName)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistFile(iface);
|
2005-08-09 22:46:05 +02:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(pszFileName));
|
2005-04-11 18:11:52 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistFile_GetCurFile(IPersistFile *iface, LPOLESTR *pszFileName)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistFile(iface);
|
2005-08-09 22:46:05 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, pszFileName);
|
2005-04-11 18:11:52 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IPersistFileVtbl PersistFileVtbl = {
|
2005-04-11 18:11:52 +02:00
|
|
|
PersistFile_QueryInterface,
|
|
|
|
PersistFile_AddRef,
|
|
|
|
PersistFile_Release,
|
|
|
|
PersistFile_GetClassID,
|
|
|
|
PersistFile_IsDirty,
|
|
|
|
PersistFile_Load,
|
|
|
|
PersistFile_Save,
|
|
|
|
PersistFile_SaveCompleted,
|
|
|
|
PersistFile_GetCurFile
|
|
|
|
};
|
|
|
|
|
2010-12-22 10:48:41 +01:00
|
|
|
static inline HTMLDocument *impl_from_IPersistStreamInit(IPersistStreamInit *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDocument, IPersistStreamInit_iface);
|
|
|
|
}
|
2006-05-23 22:16:26 +02:00
|
|
|
|
|
|
|
static HRESULT WINAPI PersistStreamInit_QueryInterface(IPersistStreamInit *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistStreamInit(iface);
|
2010-12-16 14:59:51 +01:00
|
|
|
return htmldoc_query_interface(This, riid, ppv);
|
2006-05-23 22:16:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI PersistStreamInit_AddRef(IPersistStreamInit *iface)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistStreamInit(iface);
|
2010-12-16 14:59:51 +01:00
|
|
|
return htmldoc_addref(This);
|
2006-05-23 22:16:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI PersistStreamInit_Release(IPersistStreamInit *iface)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistStreamInit(iface);
|
2010-12-16 14:59:51 +01:00
|
|
|
return htmldoc_release(This);
|
2006-05-23 22:16:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistStreamInit_GetClassID(IPersistStreamInit *iface, CLSID *pClassID)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistStreamInit(iface);
|
2012-07-26 11:37:48 +02:00
|
|
|
return IPersistFile_GetClassID(&This->IPersistFile_iface, pClassID);
|
2006-05-23 22:16:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistStreamInit_IsDirty(IPersistStreamInit *iface)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistStreamInit(iface);
|
2007-06-11 00:21:14 +02:00
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
2009-09-16 22:12:25 +02:00
|
|
|
if(This->doc_obj->usermode == EDITMODE)
|
2007-09-12 11:42:01 +02:00
|
|
|
return editor_is_dirty(This);
|
2007-06-11 00:21:14 +02:00
|
|
|
|
|
|
|
return S_FALSE;
|
2006-05-23 22:16:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, LPSTREAM pStm)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistStreamInit(iface);
|
2007-05-11 13:17:41 +02:00
|
|
|
IMoniker *mon;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, pStm);
|
|
|
|
|
|
|
|
hres = CreateURLMoniker(NULL, about_blankW, &mon);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
WARN("CreateURLMoniker failed: %08x\n", hres);
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2011-11-12 14:33:39 +01:00
|
|
|
prepare_for_binding(This, mon, FALSE);
|
2010-03-03 14:56:21 +01:00
|
|
|
hres = set_moniker(This, mon, NULL, NULL, TRUE);
|
2007-05-11 13:17:41 +02:00
|
|
|
IMoniker_Release(mon);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
2012-07-12 14:25:43 +02:00
|
|
|
return channelbsc_load_stream(This->window->pending_window, pStm);
|
2006-05-23 22:16:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, LPSTREAM pStm,
|
|
|
|
BOOL fClearDirty)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistStreamInit(iface);
|
2006-10-02 20:33:08 +02:00
|
|
|
char *str;
|
2009-08-11 19:15:59 +02:00
|
|
|
DWORD written=0;
|
2006-10-02 20:33:08 +02:00
|
|
|
HRESULT hres;
|
|
|
|
|
2008-01-10 12:53:38 +01:00
|
|
|
TRACE("(%p)->(%p %x)\n", This, pStm, fClearDirty);
|
2006-10-02 20:33:08 +02:00
|
|
|
|
2009-10-21 21:27:42 +02:00
|
|
|
hres = get_doc_string(This->doc_node, &str);
|
2007-04-12 21:26:17 +02:00
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
2006-10-02 20:33:08 +02:00
|
|
|
|
2009-08-11 19:15:59 +02:00
|
|
|
hres = IStream_Write(pStm, str, strlen(str), &written);
|
2006-10-02 20:33:08 +02:00
|
|
|
if(FAILED(hres))
|
2006-10-05 23:50:39 +02:00
|
|
|
FIXME("Write failed: %08x\n", hres);
|
2006-10-02 20:33:08 +02:00
|
|
|
|
2007-12-05 21:52:31 +01:00
|
|
|
heap_free(str);
|
2008-01-10 12:53:38 +01:00
|
|
|
|
|
|
|
if(fClearDirty)
|
|
|
|
set_dirty(This, VARIANT_FALSE);
|
|
|
|
|
2006-10-02 20:33:08 +02:00
|
|
|
return S_OK;
|
2006-05-23 22:16:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistStreamInit_GetSizeMax(IPersistStreamInit *iface,
|
|
|
|
ULARGE_INTEGER *pcbSize)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistStreamInit(iface);
|
2006-05-23 22:16:26 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, pcbSize);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistStreamInit(iface);
|
2009-12-07 14:51:52 +01:00
|
|
|
IMoniker *mon;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
|
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
hres = CreateURLMoniker(NULL, about_blankW, &mon);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
WARN("CreateURLMoniker failed: %08x\n", hres);
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2011-11-12 14:33:39 +01:00
|
|
|
prepare_for_binding(This, mon, FALSE);
|
2010-03-03 14:56:21 +01:00
|
|
|
hres = set_moniker(This, mon, NULL, NULL, FALSE);
|
2009-12-07 14:51:52 +01:00
|
|
|
IMoniker_Release(mon);
|
2010-03-03 14:55:00 +01:00
|
|
|
if(FAILED(hres))
|
2009-12-07 14:51:52 +01:00
|
|
|
return hres;
|
|
|
|
|
2012-07-12 14:25:43 +02:00
|
|
|
return channelbsc_load_stream(This->window->pending_window, NULL);
|
2006-05-23 22:16:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IPersistStreamInitVtbl PersistStreamInitVtbl = {
|
|
|
|
PersistStreamInit_QueryInterface,
|
|
|
|
PersistStreamInit_AddRef,
|
|
|
|
PersistStreamInit_Release,
|
|
|
|
PersistStreamInit_GetClassID,
|
|
|
|
PersistStreamInit_IsDirty,
|
|
|
|
PersistStreamInit_Load,
|
|
|
|
PersistStreamInit_Save,
|
|
|
|
PersistStreamInit_GetSizeMax,
|
|
|
|
PersistStreamInit_InitNew
|
|
|
|
};
|
|
|
|
|
2009-04-15 19:58:05 +02:00
|
|
|
/**********************************************************
|
|
|
|
* IPersistHistory implementation
|
|
|
|
*/
|
|
|
|
|
2010-12-22 10:48:41 +01:00
|
|
|
static inline HTMLDocument *impl_from_IPersistHistory(IPersistHistory *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDocument, IPersistHistory_iface);
|
|
|
|
}
|
2009-04-15 19:58:05 +02:00
|
|
|
|
2010-12-16 14:59:51 +01:00
|
|
|
static HRESULT WINAPI PersistHistory_QueryInterface(IPersistHistory *iface, REFIID riid, void **ppv)
|
2009-04-15 19:58:05 +02:00
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistHistory(iface);
|
2010-12-16 14:59:51 +01:00
|
|
|
return htmldoc_query_interface(This, riid, ppv);
|
2009-04-15 19:58:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI PersistHistory_AddRef(IPersistHistory *iface)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistHistory(iface);
|
2010-12-16 14:59:51 +01:00
|
|
|
return htmldoc_addref(This);
|
2009-04-15 19:58:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI PersistHistory_Release(IPersistHistory *iface)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistHistory(iface);
|
2010-12-16 14:59:51 +01:00
|
|
|
return htmldoc_release(This);
|
2009-04-15 19:58:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistHistory_GetClassID(IPersistHistory *iface, CLSID *pClassID)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistHistory(iface);
|
2012-07-26 11:37:48 +02:00
|
|
|
return IPersistFile_GetClassID(&This->IPersistFile_iface, pClassID);
|
2009-04-15 19:58:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistHistory_LoadHistory(IPersistHistory *iface, IStream *pStream, IBindCtx *pbc)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistHistory(iface);
|
2009-04-15 19:58:05 +02:00
|
|
|
FIXME("(%p)->(%p %p)\n", This, pStream, pbc);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistHistory_SaveHistory(IPersistHistory *iface, IStream *pStream)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistHistory(iface);
|
2009-04-15 19:58:05 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, pStream);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistHistory_SetPositionCookie(IPersistHistory *iface, DWORD dwPositioncookie)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistHistory(iface);
|
2009-04-15 19:58:05 +02:00
|
|
|
FIXME("(%p)->(%x)\n", This, dwPositioncookie);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PersistHistory_GetPositionCookie(IPersistHistory *iface, DWORD *pdwPositioncookie)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
HTMLDocument *This = impl_from_IPersistHistory(iface);
|
2009-04-15 19:58:05 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, pdwPositioncookie);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IPersistHistoryVtbl PersistHistoryVtbl = {
|
|
|
|
PersistHistory_QueryInterface,
|
|
|
|
PersistHistory_AddRef,
|
|
|
|
PersistHistory_Release,
|
|
|
|
PersistHistory_GetClassID,
|
|
|
|
PersistHistory_LoadHistory,
|
|
|
|
PersistHistory_SaveHistory,
|
|
|
|
PersistHistory_SetPositionCookie,
|
|
|
|
PersistHistory_GetPositionCookie
|
|
|
|
};
|
|
|
|
|
2005-04-11 18:11:52 +02:00
|
|
|
void HTMLDocument_Persist_Init(HTMLDocument *This)
|
|
|
|
{
|
2010-12-22 10:48:41 +01:00
|
|
|
This->IPersistMoniker_iface.lpVtbl = &PersistMonikerVtbl;
|
|
|
|
This->IPersistFile_iface.lpVtbl = &PersistFileVtbl;
|
2010-12-23 02:12:25 +01:00
|
|
|
This->IMonikerProp_iface.lpVtbl = &MonikerPropVtbl;
|
2010-12-22 10:48:41 +01:00
|
|
|
This->IPersistStreamInit_iface.lpVtbl = &PersistStreamInitVtbl;
|
|
|
|
This->IPersistHistory_iface.lpVtbl = &PersistHistoryVtbl;
|
2005-04-11 18:11:52 +02:00
|
|
|
}
|