2 * Copyright 2005 Jacek Caban
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #define NONAMELESSUNION
26 #define NONAMELESSSTRUCT
35 #include "wine/debug.h"
36 #include "wine/unicode.h"
38 #include "mshtml_private.h"
39 #include "htmlevent.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
49 } download_proc_task_t
;
51 static BOOL
use_gecko_script(HTMLWindow
*window
)
56 static const WCHAR aboutW
[] = {'a','b','o','u','t',':'};
58 hres
= IInternetSecurityManager_MapUrlToZone(window
->secmgr
, window
->url
, &zone
, 0);
60 WARN("Could not map %s to zone: %08x\n", debugstr_w(window
->url
), hres
);
64 TRACE("zone %d\n", zone
);
65 return zone
!= URLZONE_LOCAL_MACHINE
&& zone
!= URLZONE_TRUSTED
66 && strncmpiW(aboutW
, window
->url
, sizeof(aboutW
)/sizeof(WCHAR
));
69 void set_current_mon(HTMLWindow
*This
, IMoniker
*mon
)
74 IMoniker_Release(This
->mon
);
79 CoTaskMemFree(This
->url
);
89 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &This
->url
);
91 WARN("GetDisplayName failed: %08x\n", hres
);
93 set_script_mode(This
, use_gecko_script(This
) ? SCRIPTMODE_GECKO
: SCRIPTMODE_ACTIVESCRIPT
);
96 static void set_progress_proc(task_t
*_task
)
98 docobj_task_t
*task
= (docobj_task_t
*)_task
;
99 IOleCommandTarget
*olecmd
= NULL
;
100 HTMLDocumentObj
*doc
= task
->doc
;
103 TRACE("(%p)\n", doc
);
106 IOleClientSite_QueryInterface(doc
->client
, &IID_IOleCommandTarget
, (void**)&olecmd
);
109 VARIANT progress_max
, progress
;
111 V_VT(&progress_max
) = VT_I4
;
112 V_I4(&progress_max
) = 0; /* FIXME */
113 IOleCommandTarget_Exec(olecmd
, NULL
, OLECMDID_SETPROGRESSMAX
, OLECMDEXECOPT_DONTPROMPTUSER
,
114 &progress_max
, NULL
);
116 V_VT(&progress
) = VT_I4
;
117 V_I4(&progress
) = 0; /* FIXME */
118 IOleCommandTarget_Exec(olecmd
, NULL
, OLECMDID_SETPROGRESSPOS
, OLECMDEXECOPT_DONTPROMPTUSER
,
120 IOleCommandTarget_Release(olecmd
);
123 if(doc
->usermode
== EDITMODE
&& doc
->hostui
) {
124 DOCHOSTUIINFO hostinfo
;
126 memset(&hostinfo
, 0, sizeof(DOCHOSTUIINFO
));
127 hostinfo
.cbSize
= sizeof(DOCHOSTUIINFO
);
128 hres
= IDocHostUIHandler_GetHostInfo(doc
->hostui
, &hostinfo
);
130 /* FIXME: use hostinfo */
131 TRACE("hostinfo = {%u %08x %08x %s %s}\n",
132 hostinfo
.cbSize
, hostinfo
.dwFlags
, hostinfo
.dwDoubleClick
,
133 debugstr_w(hostinfo
.pchHostCss
), debugstr_w(hostinfo
.pchHostNS
));
137 static void set_downloading_proc(task_t
*_task
)
139 download_proc_task_t
*task
= (download_proc_task_t
*)_task
;
140 HTMLDocumentObj
*doc
= task
->doc
;
141 IOleCommandTarget
*olecmd
;
144 TRACE("(%p)\n", doc
);
146 set_statustext(doc
, IDS_STATUS_DOWNLOADINGFROM
, task
->url
);
147 CoTaskMemFree(task
->url
);
152 if(task
->set_download
) {
153 hres
= IOleClientSite_QueryInterface(doc
->client
, &IID_IOleCommandTarget
, (void**)&olecmd
);
154 if(SUCCEEDED(hres
)) {
160 IOleCommandTarget_Exec(olecmd
, NULL
, OLECMDID_SETDOWNLOADSTATE
,
161 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
162 IOleCommandTarget_Release(olecmd
);
165 doc
->download_state
= 1;
169 IAdviseSink_OnViewChange(doc
->view_sink
, DVASPECT_CONTENT
, -1);
172 IDropTarget
*drop_target
= NULL
;
174 hres
= IDocHostUIHandler_GetDropTarget(doc
->hostui
, NULL
/* FIXME */, &drop_target
);
176 FIXME("Use IDropTarget\n");
177 IDropTarget_Release(drop_target
);
182 HRESULT
set_moniker(HTMLDocument
*This
, IMoniker
*mon
, IBindCtx
*pibc
, nsChannelBSC
*async_bsc
, BOOL set_download
)
184 nsChannelBSC
*bscallback
;
186 download_proc_task_t
*download_task
;
191 hres
= IMoniker_GetDisplayName(mon
, pibc
, NULL
, &url
);
193 WARN("GetDiaplayName failed: %08x\n", hres
);
197 TRACE("got url: %s\n", debugstr_w(url
));
199 if(This
->doc_obj
->client
) {
200 VARIANT silent
, offline
;
202 hres
= get_client_disp_property(This
->doc_obj
->client
, DISPID_AMBIENT_SILENT
, &silent
);
203 if(SUCCEEDED(hres
)) {
204 if(V_VT(&silent
) != VT_BOOL
)
205 WARN("V_VT(silent) = %d\n", V_VT(&silent
));
206 else if(V_BOOL(&silent
))
207 FIXME("silent == true\n");
210 hres
= get_client_disp_property(This
->doc_obj
->client
,
211 DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
, &offline
);
212 if(SUCCEEDED(hres
)) {
213 if(V_VT(&offline
) != VT_BOOL
)
214 WARN("V_VT(offline) = %d\n", V_VT(&offline
));
215 else if(V_BOOL(&offline
))
216 FIXME("offline == true\n");
220 if(This
->window
->mon
) {
221 update_doc(This
, UPDATE_TITLE
|UPDATE_UI
);
223 update_doc(This
, UPDATE_TITLE
);
224 set_current_mon(This
->window
, mon
);
227 set_ready_state(This
->window
, READYSTATE_LOADING
);
229 if(This
->doc_obj
->client
) {
230 IOleCommandTarget
*cmdtrg
= NULL
;
232 hres
= IOleClientSite_QueryInterface(This
->doc_obj
->client
, &IID_IOleCommandTarget
,
234 if(SUCCEEDED(hres
)) {
240 IOleCommandTarget_Exec(cmdtrg
, &CGID_ShellDocView
, 37, 0, &var
, NULL
);
242 V_VT(&var
) = VT_UNKNOWN
;
243 V_UNKNOWN(&var
) = (IUnknown
*)&This
->window
->IHTMLWindow2_iface
;
244 V_VT(&out
) = VT_EMPTY
;
245 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_ShellDocView
, 63, 0, &var
, &out
);
250 IOleCommandTarget_Release(cmdtrg
);
254 hres
= create_doc_uri(This
->window
, url
, &nsuri
);
259 bscallback
= async_bsc
;
261 hres
= create_channelbsc(mon
, NULL
, NULL
, 0, &bscallback
);
267 remove_target_tasks(This
->task_magic
);
268 abort_document_bindings(This
->doc_node
);
270 hres
= load_nsuri(This
->window
, nsuri
, bscallback
, LOAD_INITIAL_DOCUMENT_URI
);
271 nsISupports_Release((nsISupports
*)nsuri
); /* FIXME */
273 set_window_bscallback(This
->window
, bscallback
);
274 if(bscallback
!= async_bsc
)
275 IUnknown_Release((IUnknown
*)bscallback
);
284 HTMLDocument_LockContainer(This
->doc_obj
, TRUE
);
286 if(This
->doc_obj
->frame
) {
287 task
= heap_alloc(sizeof(docobj_task_t
));
288 task
->doc
= This
->doc_obj
;
289 push_task(&task
->header
, set_progress_proc
, This
->doc_obj
->basedoc
.task_magic
);
292 download_task
= heap_alloc(sizeof(download_proc_task_t
));
293 download_task
->doc
= This
->doc_obj
;
294 download_task
->set_download
= set_download
;
295 download_task
->url
= url
;
296 push_task(&download_task
->header
, set_downloading_proc
, This
->doc_obj
->basedoc
.task_magic
);
301 void set_ready_state(HTMLWindow
*window
, READYSTATE readystate
)
303 window
->readystate
= readystate
;
305 if(window
->doc_obj
&& window
->doc_obj
->basedoc
.window
== window
)
306 call_property_onchanged(&window
->doc_obj
->basedoc
.cp_propnotif
, DISPID_READYSTATE
);
308 fire_event(window
->doc
, EVENTID_READYSTATECHANGE
, FALSE
, window
->doc
->node
.nsnode
, NULL
);
310 if(window
->frame_element
)
311 fire_event(window
->frame_element
->element
.node
.doc
, EVENTID_READYSTATECHANGE
,
312 TRUE
, window
->frame_element
->element
.node
.nsnode
, NULL
);
315 static HRESULT
get_doc_string(HTMLDocumentNode
*This
, char **str
)
323 WARN("NULL nsdoc\n");
327 nsres
= nsIDOMHTMLDocument_QueryInterface(This
->nsdoc
, &IID_nsIDOMNode
, (void**)&nsnode
);
328 if(NS_FAILED(nsres
)) {
329 ERR("Could not get nsIDOMNode failed: %08x\n", nsres
);
333 nsAString_Init(&nsstr
, NULL
);
334 nsnode_to_nsstring(nsnode
, &nsstr
);
335 nsIDOMNode_Release(nsnode
);
337 nsAString_GetData(&nsstr
, &strw
);
338 TRACE("%s\n", debugstr_w(strw
));
340 *str
= heap_strdupWtoA(strw
);
342 nsAString_Finish(&nsstr
);
348 /**********************************************************
349 * IPersistMoniker implementation
352 static inline HTMLDocument
*impl_from_IPersistMoniker(IPersistMoniker
*iface
)
354 return CONTAINING_RECORD(iface
, HTMLDocument
, IPersistMoniker_iface
);
357 static HRESULT WINAPI
PersistMoniker_QueryInterface(IPersistMoniker
*iface
, REFIID riid
, void **ppv
)
359 HTMLDocument
*This
= impl_from_IPersistMoniker(iface
);
360 return htmldoc_query_interface(This
, riid
, ppv
);
363 static ULONG WINAPI
PersistMoniker_AddRef(IPersistMoniker
*iface
)
365 HTMLDocument
*This
= impl_from_IPersistMoniker(iface
);
366 return htmldoc_addref(This
);
369 static ULONG WINAPI
PersistMoniker_Release(IPersistMoniker
*iface
)
371 HTMLDocument
*This
= impl_from_IPersistMoniker(iface
);
372 return htmldoc_release(This
);
375 static HRESULT WINAPI
PersistMoniker_GetClassID(IPersistMoniker
*iface
, CLSID
*pClassID
)
377 HTMLDocument
*This
= impl_from_IPersistMoniker(iface
);
378 return IPersist_GetClassID(&This
->IPersistFile_iface
, pClassID
);
381 static HRESULT WINAPI
PersistMoniker_IsDirty(IPersistMoniker
*iface
)
383 HTMLDocument
*This
= impl_from_IPersistMoniker(iface
);
385 TRACE("(%p)\n", This
);
387 return IPersistStreamInit_IsDirty(&This
->IPersistStreamInit_iface
);
390 static HRESULT WINAPI
PersistMoniker_Load(IPersistMoniker
*iface
, BOOL fFullyAvailable
,
391 IMoniker
*pimkName
, LPBC pibc
, DWORD grfMode
)
393 HTMLDocument
*This
= impl_from_IPersistMoniker(iface
);
396 TRACE("(%p)->(%x %p %p %08x)\n", This
, fFullyAvailable
, pimkName
, pibc
, grfMode
);
399 IUnknown
*unk
= NULL
;
403 * "__PrecreatedObject"
404 * "BIND_CONTEXT_PARAM"
405 * "__HTMLLOADOPTIONS"
408 * "_ITransData_Object_"
412 IBindCtx_GetObjectParam(pibc
, (LPOLESTR
)SZ_HTML_CLIENTSITE_OBJECTPARAM
, &unk
);
414 IOleClientSite
*client
= NULL
;
416 hres
= IUnknown_QueryInterface(unk
, &IID_IOleClientSite
, (void**)&client
);
417 if(SUCCEEDED(hres
)) {
418 TRACE("Got client site %p\n", client
);
419 IOleObject_SetClientSite(&This
->IOleObject_iface
, client
);
420 IOleClientSite_Release(client
);
423 IUnknown_Release(unk
);
427 hres
= set_moniker(This
, pimkName
, pibc
, NULL
, TRUE
);
431 return start_binding(This
->window
, NULL
, (BSCallback
*)This
->window
->bscallback
, pibc
);
434 static HRESULT WINAPI
PersistMoniker_Save(IPersistMoniker
*iface
, IMoniker
*pimkName
,
435 LPBC pbc
, BOOL fRemember
)
437 HTMLDocument
*This
= impl_from_IPersistMoniker(iface
);
438 FIXME("(%p)->(%p %p %x)\n", This
, pimkName
, pbc
, fRemember
);
442 static HRESULT WINAPI
PersistMoniker_SaveCompleted(IPersistMoniker
*iface
, IMoniker
*pimkName
, LPBC pibc
)
444 HTMLDocument
*This
= impl_from_IPersistMoniker(iface
);
445 FIXME("(%p)->(%p %p)\n", This
, pimkName
, pibc
);
449 static HRESULT WINAPI
PersistMoniker_GetCurMoniker(IPersistMoniker
*iface
, IMoniker
**ppimkName
)
451 HTMLDocument
*This
= impl_from_IPersistMoniker(iface
);
453 TRACE("(%p)->(%p)\n", This
, ppimkName
);
455 if(!This
->window
|| !This
->window
->mon
)
458 IMoniker_AddRef(This
->window
->mon
);
459 *ppimkName
= This
->window
->mon
;
463 static const IPersistMonikerVtbl PersistMonikerVtbl
= {
464 PersistMoniker_QueryInterface
,
465 PersistMoniker_AddRef
,
466 PersistMoniker_Release
,
467 PersistMoniker_GetClassID
,
468 PersistMoniker_IsDirty
,
471 PersistMoniker_SaveCompleted
,
472 PersistMoniker_GetCurMoniker
475 /**********************************************************
476 * IMonikerProp implementation
479 static inline HTMLDocument
*impl_from_IMonikerProp(IMonikerProp
*iface
)
481 return CONTAINING_RECORD(iface
, HTMLDocument
, IMonikerProp_iface
);
484 static HRESULT WINAPI
MonikerProp_QueryInterface(IMonikerProp
*iface
, REFIID riid
, void **ppv
)
486 HTMLDocument
*This
= impl_from_IMonikerProp(iface
);
487 return htmldoc_query_interface(This
, riid
, ppv
);
490 static ULONG WINAPI
MonikerProp_AddRef(IMonikerProp
*iface
)
492 HTMLDocument
*This
= impl_from_IMonikerProp(iface
);
493 return htmldoc_addref(This
);
496 static ULONG WINAPI
MonikerProp_Release(IMonikerProp
*iface
)
498 HTMLDocument
*This
= impl_from_IMonikerProp(iface
);
499 return htmldoc_release(This
);
502 static HRESULT WINAPI
MonikerProp_PutProperty(IMonikerProp
*iface
, MONIKERPROPERTY mkp
, LPCWSTR val
)
504 HTMLDocument
*This
= impl_from_IMonikerProp(iface
);
506 TRACE("(%p)->(%d %s)\n", This
, mkp
, debugstr_w(val
));
510 heap_free(This
->doc_obj
->mime
);
511 This
->doc_obj
->mime
= heap_strdupW(val
);
518 FIXME("mkp %d\n", mkp
);
525 static const IMonikerPropVtbl MonikerPropVtbl
= {
526 MonikerProp_QueryInterface
,
529 MonikerProp_PutProperty
532 /**********************************************************
533 * IPersistFile implementation
536 static inline HTMLDocument
*impl_from_IPersistFile(IPersistFile
*iface
)
538 return CONTAINING_RECORD(iface
, HTMLDocument
, IPersistFile_iface
);
541 static HRESULT WINAPI
PersistFile_QueryInterface(IPersistFile
*iface
, REFIID riid
, void **ppv
)
543 HTMLDocument
*This
= impl_from_IPersistFile(iface
);
544 return htmldoc_query_interface(This
, riid
, ppv
);
547 static ULONG WINAPI
PersistFile_AddRef(IPersistFile
*iface
)
549 HTMLDocument
*This
= impl_from_IPersistFile(iface
);
550 return htmldoc_addref(This
);
553 static ULONG WINAPI
PersistFile_Release(IPersistFile
*iface
)
555 HTMLDocument
*This
= impl_from_IPersistFile(iface
);
556 return htmldoc_release(This
);
559 static HRESULT WINAPI
PersistFile_GetClassID(IPersistFile
*iface
, CLSID
*pClassID
)
561 HTMLDocument
*This
= impl_from_IPersistFile(iface
);
563 TRACE("(%p)->(%p)\n", This
, pClassID
);
568 *pClassID
= CLSID_HTMLDocument
;
572 static HRESULT WINAPI
PersistFile_IsDirty(IPersistFile
*iface
)
574 HTMLDocument
*This
= impl_from_IPersistFile(iface
);
576 TRACE("(%p)\n", This
);
578 return IPersistStreamInit_IsDirty(&This
->IPersistStreamInit_iface
);
581 static HRESULT WINAPI
PersistFile_Load(IPersistFile
*iface
, LPCOLESTR pszFileName
, DWORD dwMode
)
583 HTMLDocument
*This
= impl_from_IPersistFile(iface
);
584 FIXME("(%p)->(%s %08x)\n", This
, debugstr_w(pszFileName
), dwMode
);
588 static HRESULT WINAPI
PersistFile_Save(IPersistFile
*iface
, LPCOLESTR pszFileName
, BOOL fRemember
)
590 HTMLDocument
*This
= impl_from_IPersistFile(iface
);
596 TRACE("(%p)->(%s %x)\n", This
, debugstr_w(pszFileName
), fRemember
);
598 file
= CreateFileW(pszFileName
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
,
599 FILE_ATTRIBUTE_NORMAL
, NULL
);
600 if(file
== INVALID_HANDLE_VALUE
) {
601 WARN("Could not create file: %u\n", GetLastError());
605 hres
= get_doc_string(This
->doc_node
, &str
);
607 WriteFile(file
, str
, strlen(str
), &written
, NULL
);
613 static HRESULT WINAPI
PersistFile_SaveCompleted(IPersistFile
*iface
, LPCOLESTR pszFileName
)
615 HTMLDocument
*This
= impl_from_IPersistFile(iface
);
616 FIXME("(%p)->(%s)\n", This
, debugstr_w(pszFileName
));
620 static HRESULT WINAPI
PersistFile_GetCurFile(IPersistFile
*iface
, LPOLESTR
*pszFileName
)
622 HTMLDocument
*This
= impl_from_IPersistFile(iface
);
623 FIXME("(%p)->(%p)\n", This
, pszFileName
);
627 static const IPersistFileVtbl PersistFileVtbl
= {
628 PersistFile_QueryInterface
,
631 PersistFile_GetClassID
,
635 PersistFile_SaveCompleted
,
636 PersistFile_GetCurFile
639 static inline HTMLDocument
*impl_from_IPersistStreamInit(IPersistStreamInit
*iface
)
641 return CONTAINING_RECORD(iface
, HTMLDocument
, IPersistStreamInit_iface
);
644 static HRESULT WINAPI
PersistStreamInit_QueryInterface(IPersistStreamInit
*iface
,
645 REFIID riid
, void **ppv
)
647 HTMLDocument
*This
= impl_from_IPersistStreamInit(iface
);
648 return htmldoc_query_interface(This
, riid
, ppv
);
651 static ULONG WINAPI
PersistStreamInit_AddRef(IPersistStreamInit
*iface
)
653 HTMLDocument
*This
= impl_from_IPersistStreamInit(iface
);
654 return htmldoc_addref(This
);
657 static ULONG WINAPI
PersistStreamInit_Release(IPersistStreamInit
*iface
)
659 HTMLDocument
*This
= impl_from_IPersistStreamInit(iface
);
660 return htmldoc_release(This
);
663 static HRESULT WINAPI
PersistStreamInit_GetClassID(IPersistStreamInit
*iface
, CLSID
*pClassID
)
665 HTMLDocument
*This
= impl_from_IPersistStreamInit(iface
);
666 return IPersist_GetClassID(&This
->IPersistFile_iface
, pClassID
);
669 static HRESULT WINAPI
PersistStreamInit_IsDirty(IPersistStreamInit
*iface
)
671 HTMLDocument
*This
= impl_from_IPersistStreamInit(iface
);
673 TRACE("(%p)\n", This
);
675 if(This
->doc_obj
->usermode
== EDITMODE
)
676 return editor_is_dirty(This
);
681 static HRESULT WINAPI
PersistStreamInit_Load(IPersistStreamInit
*iface
, LPSTREAM pStm
)
683 HTMLDocument
*This
= impl_from_IPersistStreamInit(iface
);
687 static const WCHAR about_blankW
[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
689 TRACE("(%p)->(%p)\n", This
, pStm
);
691 hres
= CreateURLMoniker(NULL
, about_blankW
, &mon
);
693 WARN("CreateURLMoniker failed: %08x\n", hres
);
697 hres
= set_moniker(This
, mon
, NULL
, NULL
, TRUE
);
698 IMoniker_Release(mon
);
702 return channelbsc_load_stream(This
->window
->bscallback
, pStm
);
705 static HRESULT WINAPI
PersistStreamInit_Save(IPersistStreamInit
*iface
, LPSTREAM pStm
,
708 HTMLDocument
*This
= impl_from_IPersistStreamInit(iface
);
713 TRACE("(%p)->(%p %x)\n", This
, pStm
, fClearDirty
);
715 hres
= get_doc_string(This
->doc_node
, &str
);
719 hres
= IStream_Write(pStm
, str
, strlen(str
), &written
);
721 FIXME("Write failed: %08x\n", hres
);
726 set_dirty(This
, VARIANT_FALSE
);
731 static HRESULT WINAPI
PersistStreamInit_GetSizeMax(IPersistStreamInit
*iface
,
732 ULARGE_INTEGER
*pcbSize
)
734 HTMLDocument
*This
= impl_from_IPersistStreamInit(iface
);
735 FIXME("(%p)->(%p)\n", This
, pcbSize
);
739 static HRESULT WINAPI
PersistStreamInit_InitNew(IPersistStreamInit
*iface
)
741 HTMLDocument
*This
= impl_from_IPersistStreamInit(iface
);
745 static const WCHAR about_blankW
[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
747 TRACE("(%p)\n", This
);
749 hres
= CreateURLMoniker(NULL
, about_blankW
, &mon
);
751 WARN("CreateURLMoniker failed: %08x\n", hres
);
755 hres
= set_moniker(This
, mon
, NULL
, NULL
, FALSE
);
756 IMoniker_Release(mon
);
760 return channelbsc_load_stream(This
->window
->bscallback
, NULL
);
763 static const IPersistStreamInitVtbl PersistStreamInitVtbl
= {
764 PersistStreamInit_QueryInterface
,
765 PersistStreamInit_AddRef
,
766 PersistStreamInit_Release
,
767 PersistStreamInit_GetClassID
,
768 PersistStreamInit_IsDirty
,
769 PersistStreamInit_Load
,
770 PersistStreamInit_Save
,
771 PersistStreamInit_GetSizeMax
,
772 PersistStreamInit_InitNew
775 /**********************************************************
776 * IPersistHistory implementation
779 static inline HTMLDocument
*impl_from_IPersistHistory(IPersistHistory
*iface
)
781 return CONTAINING_RECORD(iface
, HTMLDocument
, IPersistHistory_iface
);
784 static HRESULT WINAPI
PersistHistory_QueryInterface(IPersistHistory
*iface
, REFIID riid
, void **ppv
)
786 HTMLDocument
*This
= impl_from_IPersistHistory(iface
);
787 return htmldoc_query_interface(This
, riid
, ppv
);
790 static ULONG WINAPI
PersistHistory_AddRef(IPersistHistory
*iface
)
792 HTMLDocument
*This
= impl_from_IPersistHistory(iface
);
793 return htmldoc_addref(This
);
796 static ULONG WINAPI
PersistHistory_Release(IPersistHistory
*iface
)
798 HTMLDocument
*This
= impl_from_IPersistHistory(iface
);
799 return htmldoc_release(This
);
802 static HRESULT WINAPI
PersistHistory_GetClassID(IPersistHistory
*iface
, CLSID
*pClassID
)
804 HTMLDocument
*This
= impl_from_IPersistHistory(iface
);
805 return IPersist_GetClassID(&This
->IPersistFile_iface
, pClassID
);
808 static HRESULT WINAPI
PersistHistory_LoadHistory(IPersistHistory
*iface
, IStream
*pStream
, IBindCtx
*pbc
)
810 HTMLDocument
*This
= impl_from_IPersistHistory(iface
);
811 FIXME("(%p)->(%p %p)\n", This
, pStream
, pbc
);
815 static HRESULT WINAPI
PersistHistory_SaveHistory(IPersistHistory
*iface
, IStream
*pStream
)
817 HTMLDocument
*This
= impl_from_IPersistHistory(iface
);
818 FIXME("(%p)->(%p)\n", This
, pStream
);
822 static HRESULT WINAPI
PersistHistory_SetPositionCookie(IPersistHistory
*iface
, DWORD dwPositioncookie
)
824 HTMLDocument
*This
= impl_from_IPersistHistory(iface
);
825 FIXME("(%p)->(%x)\n", This
, dwPositioncookie
);
829 static HRESULT WINAPI
PersistHistory_GetPositionCookie(IPersistHistory
*iface
, DWORD
*pdwPositioncookie
)
831 HTMLDocument
*This
= impl_from_IPersistHistory(iface
);
832 FIXME("(%p)->(%p)\n", This
, pdwPositioncookie
);
836 static const IPersistHistoryVtbl PersistHistoryVtbl
= {
837 PersistHistory_QueryInterface
,
838 PersistHistory_AddRef
,
839 PersistHistory_Release
,
840 PersistHistory_GetClassID
,
841 PersistHistory_LoadHistory
,
842 PersistHistory_SaveHistory
,
843 PersistHistory_SetPositionCookie
,
844 PersistHistory_GetPositionCookie
847 void HTMLDocument_Persist_Init(HTMLDocument
*This
)
849 This
->IPersistMoniker_iface
.lpVtbl
= &PersistMonikerVtbl
;
850 This
->IPersistFile_iface
.lpVtbl
= &PersistFileVtbl
;
851 This
->IMonikerProp_iface
.lpVtbl
= &MonikerPropVtbl
;
852 This
->IPersistStreamInit_iface
.lpVtbl
= &PersistStreamInitVtbl
;
853 This
->IPersistHistory_iface
.lpVtbl
= &PersistHistoryVtbl
;