From 4705790ee3631dc70c25728bc4e4ac9410129385 Mon Sep 17 00:00:00 2001 From: Vijay Kiran Kamuju Date: Wed, 10 Mar 2021 21:30:28 +0100 Subject: [PATCH] dhtmled.ocx: Implement IOleObject::SetExtent and IOleObject::GetExtent functions. This time without tests as the ocx file is not available from windows 7 & IE 8 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50697 Signed-off-by: Vijay Kiran Kamuju Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard (cherry picked from commit 6ca1a92684fcbaa1c569b60411a8036b6d11dc99) Signed-off-by: Michael Stefaniuc --- dlls/dhtmled.ocx/Makefile.in | 2 +- dlls/dhtmled.ocx/edit.c | 30 ++++++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/dlls/dhtmled.ocx/Makefile.in b/dlls/dhtmled.ocx/Makefile.in index 0a890a57d44..077a072e010 100644 --- a/dlls/dhtmled.ocx/Makefile.in +++ b/dlls/dhtmled.ocx/Makefile.in @@ -1,5 +1,5 @@ MODULE = dhtmled.ocx -IMPORTS = uuid ole32 +IMPORTS = uuid ole32 user32 gdi32 EXTRADLLFLAGS = -mno-cygwin diff --git a/dlls/dhtmled.ocx/edit.c b/dlls/dhtmled.ocx/edit.c index dfa300b9590..53dcdfc9ac6 100644 --- a/dlls/dhtmled.ocx/edit.c +++ b/dlls/dhtmled.ocx/edit.c @@ -1,5 +1,6 @@ /* * Copyright 2017 Alex Henrie + * Copyright 2021 Vijay Kiran Kamuju * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -30,6 +31,7 @@ typedef struct IOleObject IOleObject_iface; IPersistStreamInit IPersistStreamInit_iface; IOleClientSite *client_site; + SIZEL extent; LONG ref; } DHTMLEditImpl; @@ -700,15 +702,25 @@ static HRESULT WINAPI OleObject_GetUserType(IOleObject *iface, DWORD type_type, static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD aspect, SIZEL *size_limit) { DHTMLEditImpl *This = impl_from_IOleObject(iface); - FIXME("(%p)->(%u, %p) stub\n", This, aspect, size_limit); - return E_NOTIMPL; + TRACE("(%p)->(%u, %p)\n", This, aspect, size_limit); + + if(aspect != DVASPECT_CONTENT) + return DV_E_DVASPECT; + + This->extent = *size_limit; + return S_OK; } static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD aspect, SIZEL *size_limit) { DHTMLEditImpl *This = impl_from_IOleObject(iface); - FIXME("(%p)->(%u, %p) stub\n", This, aspect, size_limit); - return E_NOTIMPL; + TRACE("(%p)->(%u, %p)\n", This, aspect, size_limit); + + if(aspect != DVASPECT_CONTENT) + return E_FAIL; + + *size_limit = This->extent; + return S_OK; } static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *sink, DWORD *conn) @@ -849,6 +861,8 @@ static const IPersistStreamInitVtbl PersistStreamInitVtbl = { HRESULT dhtml_edit_create(REFIID iid, void **out) { DHTMLEditImpl *This; + DWORD dpi_x, dpi_y; + HDC hdc; HRESULT ret; TRACE("(%s, %p)\n", debugstr_guid(iid), out); @@ -863,6 +877,14 @@ HRESULT dhtml_edit_create(REFIID iid, void **out) This->client_site = NULL; This->ref = 1; + hdc = GetDC(0); + dpi_x = GetDeviceCaps(hdc, LOGPIXELSX); + dpi_y = GetDeviceCaps(hdc, LOGPIXELSY); + ReleaseDC(0, hdc); + + This->extent.cx = MulDiv(192, 2540, dpi_x); + This->extent.cy = MulDiv(192, 2540, dpi_y); + ret = IDHTMLEdit_QueryInterface(&This->IDHTMLEdit_iface, iid, out); IDHTMLEdit_Release(&This->IDHTMLEdit_iface); return ret;