msscript: Implement GetExtent().
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
859d880b66
commit
03b06fb76b
@ -1,7 +1,7 @@
|
|||||||
MODULE = msscript.ocx
|
MODULE = msscript.ocx
|
||||||
RC_SRCS = msscript.rc
|
RC_SRCS = msscript.rc
|
||||||
IDL_SRCS = msscript.idl
|
IDL_SRCS = msscript.idl
|
||||||
IMPORTS = ole32 oleaut32
|
IMPORTS = gdi32 user32 ole32 oleaut32
|
||||||
|
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
msscript.c
|
msscript.c
|
||||||
|
@ -35,6 +35,7 @@ struct ScriptControl {
|
|||||||
IOleObject IOleObject_iface;
|
IOleObject IOleObject_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
IOleClientSite *site;
|
IOleClientSite *site;
|
||||||
|
SIZEL extent;
|
||||||
};
|
};
|
||||||
|
|
||||||
static HINSTANCE msscript_instance;
|
static HINSTANCE msscript_instance;
|
||||||
@ -611,9 +612,13 @@ static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD aspect, SIZEL
|
|||||||
{
|
{
|
||||||
ScriptControl *This = impl_from_IOleObject(iface);
|
ScriptControl *This = impl_from_IOleObject(iface);
|
||||||
|
|
||||||
FIXME("(%p)->(%d %p)\n", This, aspect, size);
|
TRACE("(%p)->(%d %p)\n", This, aspect, size);
|
||||||
|
|
||||||
return E_NOTIMPL;
|
if (aspect != DVASPECT_CONTENT)
|
||||||
|
return DV_E_DVASPECT;
|
||||||
|
|
||||||
|
*size = This->extent;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *sink, DWORD *connection)
|
static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *sink, DWORD *connection)
|
||||||
@ -775,7 +780,9 @@ static const IPersistStreamInitVtbl PersistStreamInitVtbl = {
|
|||||||
static HRESULT WINAPI ScriptControl_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
|
static HRESULT WINAPI ScriptControl_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
|
||||||
{
|
{
|
||||||
ScriptControl *script_control;
|
ScriptControl *script_control;
|
||||||
|
DWORD dpi_x, dpi_y;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
HDC hdc;
|
||||||
|
|
||||||
TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv);
|
TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv);
|
||||||
|
|
||||||
@ -789,6 +796,14 @@ static HRESULT WINAPI ScriptControl_CreateInstance(IClassFactory *iface, IUnknow
|
|||||||
script_control->ref = 1;
|
script_control->ref = 1;
|
||||||
script_control->site = NULL;
|
script_control->site = NULL;
|
||||||
|
|
||||||
|
hdc = GetDC(0);
|
||||||
|
dpi_x = GetDeviceCaps(hdc, LOGPIXELSX);
|
||||||
|
dpi_y = GetDeviceCaps(hdc, LOGPIXELSY);
|
||||||
|
ReleaseDC(0, hdc);
|
||||||
|
|
||||||
|
script_control->extent.cx = MulDiv(38, 2540, dpi_x);
|
||||||
|
script_control->extent.cy = MulDiv(38, 2540, dpi_y);
|
||||||
|
|
||||||
hres = IScriptControl_QueryInterface(&script_control->IScriptControl_iface, riid, ppv);
|
hres = IScriptControl_QueryInterface(&script_control->IScriptControl_iface, riid, ppv);
|
||||||
IScriptControl_Release(&script_control->IScriptControl_iface);
|
IScriptControl_Release(&script_control->IScriptControl_iface);
|
||||||
return hres;
|
return hres;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
TESTDLL = msscript.ocx
|
TESTDLL = msscript.ocx
|
||||||
IMPORTS = ole32
|
IMPORTS = user32 gdi32 ole32
|
||||||
|
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
msscript.c
|
msscript.c
|
||||||
|
@ -96,10 +96,12 @@ static IOleClientSite testclientsite = { &OleClientSiteVtbl };
|
|||||||
|
|
||||||
static void test_oleobject(void)
|
static void test_oleobject(void)
|
||||||
{
|
{
|
||||||
|
DWORD status, dpi_x, dpi_y;
|
||||||
IOleClientSite *site;
|
IOleClientSite *site;
|
||||||
IOleObject *obj;
|
IOleObject *obj;
|
||||||
DWORD status;
|
SIZEL extent;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
HDC hdc;
|
||||||
|
|
||||||
hr = CoCreateInstance(&CLSID_ScriptControl, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
hr = CoCreateInstance(&CLSID_ScriptControl, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
||||||
&IID_IOleObject, (void**)&obj);
|
&IID_IOleObject, (void**)&obj);
|
||||||
@ -131,6 +133,36 @@ static void test_oleobject(void)
|
|||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
ok(site == NULL, "got %p\n", site);
|
ok(site == NULL, "got %p\n", site);
|
||||||
|
|
||||||
|
/* extents */
|
||||||
|
hdc = GetDC(0);
|
||||||
|
dpi_x = GetDeviceCaps(hdc, LOGPIXELSX);
|
||||||
|
dpi_y = GetDeviceCaps(hdc, LOGPIXELSY);
|
||||||
|
ReleaseDC(0, hdc);
|
||||||
|
|
||||||
|
memset(&extent, 0, sizeof(extent));
|
||||||
|
hr = IOleObject_GetExtent(obj, DVASPECT_CONTENT, &extent);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
ok(extent.cx == MulDiv(38, 2540, dpi_x), "got %d\n", extent.cx);
|
||||||
|
ok(extent.cy == MulDiv(38, 2540, dpi_y), "got %d\n", extent.cy);
|
||||||
|
|
||||||
|
extent.cx = extent.cy = 0xdeadbeef;
|
||||||
|
hr = IOleObject_GetExtent(obj, DVASPECT_THUMBNAIL, &extent);
|
||||||
|
ok(hr == DV_E_DVASPECT, "got 0x%08x\n", hr);
|
||||||
|
ok(extent.cx == 0xdeadbeef, "got %d\n", extent.cx);
|
||||||
|
ok(extent.cy == 0xdeadbeef, "got %d\n", extent.cy);
|
||||||
|
|
||||||
|
extent.cx = extent.cy = 0xdeadbeef;
|
||||||
|
hr = IOleObject_GetExtent(obj, DVASPECT_ICON, &extent);
|
||||||
|
ok(hr == DV_E_DVASPECT, "got 0x%08x\n", hr);
|
||||||
|
ok(extent.cx == 0xdeadbeef, "got %d\n", extent.cx);
|
||||||
|
ok(extent.cy == 0xdeadbeef, "got %d\n", extent.cy);
|
||||||
|
|
||||||
|
extent.cx = extent.cy = 0xdeadbeef;
|
||||||
|
hr = IOleObject_GetExtent(obj, DVASPECT_DOCPRINT, &extent);
|
||||||
|
ok(hr == DV_E_DVASPECT, "got 0x%08x\n", hr);
|
||||||
|
ok(extent.cx == 0xdeadbeef, "got %d\n", extent.cx);
|
||||||
|
ok(extent.cy == 0xdeadbeef, "got %d\n", extent.cy);
|
||||||
|
|
||||||
IOleObject_Release(obj);
|
IOleObject_Release(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user