From a84741182ff36f01e3972fd8b075b008f4e2af5a Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 15 Feb 2010 16:03:25 +0100 Subject: [PATCH] mshtml: Added IViewObject::SetAdvise implementation. --- dlls/mshtml/htmldoc.c | 2 ++ dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/mutation.c | 2 ++ dlls/mshtml/nsevents.c | 3 +++ dlls/mshtml/view.c | 15 +++++++++++++-- 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index f99ab294926..935ec00764f 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -1992,6 +1992,8 @@ static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface) if(This->basedoc.advise_holder) IOleAdviseHolder_Release(This->basedoc.advise_holder); + if(This->view_sink) + IAdviseSink_Release(This->view_sink); if(This->client) IOleObject_SetClientSite(OLEOBJ(&This->basedoc), NULL); if(This->in_place_active) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 2fafdf0e330..c65bffa9f79 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -380,6 +380,7 @@ struct HTMLDocumentObj { IOleInPlaceSite *ipsite; IOleInPlaceFrame *frame; IOleInPlaceUIWindow *ip_window; + IAdviseSink *view_sink; DOCHOSTUIINFO hostinfo; diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c index 0adf87e7e58..61ceca83525 100644 --- a/dlls/mshtml/mutation.c +++ b/dlls/mshtml/mutation.c @@ -322,6 +322,8 @@ static void parse_complete_proc(task_t *task) init_editor(&doc->basedoc); call_explorer_69(doc); + if(doc->view_sink) + IAdviseSink_OnViewChange(doc->view_sink, DVASPECT_CONTENT, -1); call_property_onchanged(&doc->basedoc.cp_propnotif, 1005); call_explorer_69(doc); diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c index 2dd8248ce92..65bcae05c31 100644 --- a/dlls/mshtml/nsevents.c +++ b/dlls/mshtml/nsevents.c @@ -236,6 +236,9 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event set_ready_state(doc->basedoc.window, READYSTATE_COMPLETE); if(doc == doc_obj->basedoc.doc_node) { + if(doc_obj->view_sink) + IAdviseSink_OnViewChange(doc_obj->view_sink, DVASPECT_CONTENT, -1); + if(doc_obj->frame) { static const WCHAR wszDone[] = {'D','o','n','e',0}; IOleInPlaceFrame_SetStatusText(doc_obj->frame, wszDone); diff --git a/dlls/mshtml/view.c b/dlls/mshtml/view.c index f4c62a03d63..261e959b0ad 100644 --- a/dlls/mshtml/view.c +++ b/dlls/mshtml/view.c @@ -807,8 +807,19 @@ static HRESULT WINAPI ViewObject_Unfreeze(IViewObjectEx *iface, DWORD dwFreeze) static HRESULT WINAPI ViewObject_SetAdvise(IViewObjectEx *iface, DWORD aspects, DWORD advf, IAdviseSink *pAdvSink) { HTMLDocument *This = VIEWOBJ_THIS(iface); - FIXME("(%p)->(%d %d %p)\n", This, aspects, advf, pAdvSink); - return E_NOTIMPL; + + TRACE("(%p)->(%d %d %p)\n", This, aspects, advf, pAdvSink); + + if(aspects != DVASPECT_CONTENT || advf != ADVF_PRIMEFIRST) + FIXME("unsuported arguments\n"); + + if(This->doc_obj->view_sink) + IAdviseSink_Release(This->doc_obj->view_sink); + if(pAdvSink) + IAdviseSink_AddRef(pAdvSink); + + This->doc_obj->view_sink = pAdvSink; + return S_OK; } static HRESULT WINAPI ViewObject_GetAdvise(IViewObjectEx *iface, DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink)