msscript: Implement SetAdvise/GetAdvise.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
21ea9f0efb
commit
f0b76aec0c
|
@ -83,6 +83,10 @@ struct ScriptControl {
|
||||||
ConnectionPoint cp_scsource;
|
ConnectionPoint cp_scsource;
|
||||||
ConnectionPoint cp_propnotif;
|
ConnectionPoint cp_propnotif;
|
||||||
|
|
||||||
|
/* IViewObject sink */
|
||||||
|
IAdviseSink *view_sink;
|
||||||
|
DWORD view_sink_flags;
|
||||||
|
|
||||||
ScriptHost *host;
|
ScriptHost *host;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1327,22 +1331,42 @@ static HRESULT WINAPI ViewObject_Unfreeze(IViewObjectEx *iface, DWORD freeze)
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI ViewObject_SetAdvise(IViewObjectEx *iface, DWORD aspects, DWORD advf, IAdviseSink *sink)
|
static HRESULT WINAPI ViewObject_SetAdvise(IViewObjectEx *iface, DWORD aspects, DWORD flags, IAdviseSink *sink)
|
||||||
{
|
{
|
||||||
ScriptControl *This = impl_from_IViewObjectEx(iface);
|
ScriptControl *This = impl_from_IViewObjectEx(iface);
|
||||||
|
|
||||||
FIXME("(%p)->(%d %d %p)\n", This, aspects, advf, sink);
|
TRACE("(%p)->(%d %#x %p)\n", This, aspects, flags, sink);
|
||||||
|
|
||||||
return E_NOTIMPL;
|
if (aspects != DVASPECT_CONTENT)
|
||||||
|
return DV_E_DVASPECT;
|
||||||
|
|
||||||
|
This->view_sink_flags = flags;
|
||||||
|
if (This->view_sink)
|
||||||
|
IAdviseSink_Release(This->view_sink);
|
||||||
|
This->view_sink = sink;
|
||||||
|
if (This->view_sink)
|
||||||
|
IAdviseSink_AddRef(This->view_sink);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI ViewObject_GetAdvise(IViewObjectEx *iface, DWORD *aspects, DWORD *advf, IAdviseSink **sink)
|
static HRESULT WINAPI ViewObject_GetAdvise(IViewObjectEx *iface, DWORD *aspects, DWORD *flags, IAdviseSink **sink)
|
||||||
{
|
{
|
||||||
ScriptControl *This = impl_from_IViewObjectEx(iface);
|
ScriptControl *This = impl_from_IViewObjectEx(iface);
|
||||||
|
|
||||||
FIXME("(%p)->(%p %p %p)\n", This, aspects, advf, sink);
|
TRACE("(%p)->(%p %p %p)\n", This, aspects, flags, sink);
|
||||||
|
|
||||||
return E_NOTIMPL;
|
if (aspects)
|
||||||
|
*aspects = DVASPECT_CONTENT;
|
||||||
|
if (flags)
|
||||||
|
*flags = This->view_sink_flags;
|
||||||
|
if (sink) {
|
||||||
|
*sink = This->view_sink;
|
||||||
|
if (*sink)
|
||||||
|
IAdviseSink_AddRef(*sink);
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI ViewObject_GetExtent(IViewObjectEx *iface, DWORD draw_aspect, LONG index,
|
static HRESULT WINAPI ViewObject_GetExtent(IViewObjectEx *iface, DWORD draw_aspect, LONG index,
|
||||||
|
@ -1676,6 +1700,8 @@ static HRESULT WINAPI ScriptControl_CreateInstance(IClassFactory *iface, IUnknow
|
||||||
script_control->cp_list = NULL;
|
script_control->cp_list = NULL;
|
||||||
script_control->host = NULL;
|
script_control->host = NULL;
|
||||||
script_control->timeout = 10000;
|
script_control->timeout = 10000;
|
||||||
|
script_control->view_sink_flags = 0;
|
||||||
|
script_control->view_sink = NULL;
|
||||||
|
|
||||||
ConnectionPoint_Init(&script_control->cp_scsource, script_control, &DIID_DScriptControlSource);
|
ConnectionPoint_Init(&script_control->cp_scsource, script_control, &DIID_DScriptControlSource);
|
||||||
ConnectionPoint_Init(&script_control->cp_propnotif, script_control, &IID_IPropertyNotifySink);
|
ConnectionPoint_Init(&script_control->cp_propnotif, script_control, &IID_IPropertyNotifySink);
|
||||||
|
|
|
@ -860,10 +860,11 @@ static void test_quickactivate(void)
|
||||||
|
|
||||||
static void test_viewobject(void)
|
static void test_viewobject(void)
|
||||||
{
|
{
|
||||||
|
DWORD status, aspect, flags;
|
||||||
IViewObjectEx *viewex;
|
IViewObjectEx *viewex;
|
||||||
IScriptControl *sc;
|
IScriptControl *sc;
|
||||||
IViewObject *view;
|
IViewObject *view;
|
||||||
DWORD status;
|
IAdviseSink *sink;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
hr = CoCreateInstance(&CLSID_ScriptControl, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
hr = CoCreateInstance(&CLSID_ScriptControl, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
||||||
|
@ -876,6 +877,33 @@ static void test_viewobject(void)
|
||||||
|
|
||||||
hr = IScriptControl_QueryInterface(sc, &IID_IViewObject2, (void**)&view);
|
hr = IScriptControl_QueryInterface(sc, &IID_IViewObject2, (void**)&view);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
|
sink = (IAdviseSink*)0xdeadbeef;
|
||||||
|
hr = IViewObject_GetAdvise(view, &aspect, &flags, &sink);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
ok(aspect == DVASPECT_CONTENT, "got %u\n", aspect);
|
||||||
|
ok(flags == 0, "got %#x\n", flags);
|
||||||
|
ok(sink == NULL, "got %p\n", sink);
|
||||||
|
|
||||||
|
hr = IViewObject_SetAdvise(view, DVASPECT_CONTENT, 0, NULL);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
|
hr = IViewObject_SetAdvise(view, DVASPECT_THUMBNAIL, 0, NULL);
|
||||||
|
ok(hr == DV_E_DVASPECT, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
|
hr = IViewObject_SetAdvise(view, DVASPECT_ICON, 0, NULL);
|
||||||
|
ok(hr == DV_E_DVASPECT, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
|
hr = IViewObject_SetAdvise(view, DVASPECT_DOCPRINT, 0, NULL);
|
||||||
|
ok(hr == DV_E_DVASPECT, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
|
sink = (IAdviseSink*)0xdeadbeef;
|
||||||
|
hr = IViewObject_GetAdvise(view, &aspect, &flags, &sink);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
ok(aspect == DVASPECT_CONTENT, "got %u\n", aspect);
|
||||||
|
ok(flags == 0, "got %#x\n", flags);
|
||||||
|
ok(sink == NULL, "got %p\n", sink);
|
||||||
|
|
||||||
IViewObject_Release(view);
|
IViewObject_Release(view);
|
||||||
|
|
||||||
hr = IScriptControl_QueryInterface(sc, &IID_IViewObjectEx, (void**)&viewex);
|
hr = IScriptControl_QueryInterface(sc, &IID_IViewObjectEx, (void**)&viewex);
|
||||||
|
|
Loading…
Reference in New Issue