Module: wine Branch: refs/heads/master Commit: d49e808be01c827e1394709839c82d6a4656979a URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=d49e808be01c827e13947098...
Author: Robert Shearman rob@codeweavers.com Date: Fri Feb 10 14:50:26 2006 +0100
oleaut: Implement IFontEventsDisp connection point for the standard font implementation.
---
dlls/oleaut32/olefont.c | 94 ++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 76 insertions(+), 18 deletions(-)
diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c index d2154d4..dfb0d3c 100644 --- a/dlls/oleaut32/olefont.c +++ b/dlls/oleaut32/olefont.c @@ -40,6 +40,7 @@ #include "olectl.h" #include "wine/debug.h" #include "connpt.h" /* for CreateConnectionPoint */ +#include "oaidl.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
@@ -95,7 +96,8 @@ struct OLEFontImpl long cyLogical; long cyHimetric;
- IConnectionPoint *pCP; + IConnectionPoint *pPropertyNotifyCP; + IConnectionPoint *pFontEventsCP; };
/* @@ -378,24 +380,74 @@ HRESULT WINAPI OleCreateFontIndirect( */ static void OLEFont_SendNotify(OLEFontImpl* this, DISPID dispID) { + static const WCHAR wszName[] = {'N','a','m','e',0}; + static const WCHAR wszSize[] = {'S','i','z','e',0}; + static const WCHAR wszBold[] = {'B','o','l','d',0}; + static const WCHAR wszItalic[] = {'I','t','a','l','i','c',0}; + static const WCHAR wszUnder[] = {'U','n','d','e','r','l','i','n','e',0}; + static const WCHAR wszStrike[] = {'S','t','r','i','k','e','t','h','r','o','u','g','h',0}; + static const WCHAR wszWeight[] = {'W','e','i','g','h','t',0}; + static const WCHAR wszCharset[] = {'C','h','a','r','s','s','e','t',0}; + static const LPCWSTR dispid_mapping[] = + { + wszName, + NULL, + wszSize, + wszBold, + wszItalic, + wszUnder, + wszStrike, + wszWeight, + wszCharset + }; + IEnumConnections *pEnum; CONNECTDATA CD; HRESULT hres;
- hres = IConnectionPoint_EnumConnections(this->pCP, &pEnum); - if (FAILED(hres)) /* When we have 0 connections. */ - return; - - while(IEnumConnections_Next(pEnum, 1, &CD, NULL) == S_OK) { - IPropertyNotifySink *sink; - - IUnknown_QueryInterface(CD.pUnk, &IID_IPropertyNotifySink, (LPVOID)&sink); - IPropertyNotifySink_OnChanged(sink, dispID); - IPropertyNotifySink_Release(sink); - IUnknown_Release(CD.pUnk); + hres = IConnectionPoint_EnumConnections(this->pPropertyNotifyCP, &pEnum); + if (SUCCEEDED(hres)) + { + while(IEnumConnections_Next(pEnum, 1, &CD, NULL) == S_OK) { + IPropertyNotifySink *sink; + + IUnknown_QueryInterface(CD.pUnk, &IID_IPropertyNotifySink, (LPVOID)&sink); + IPropertyNotifySink_OnChanged(sink, dispID); + IPropertyNotifySink_Release(sink); + IUnknown_Release(CD.pUnk); + } + IEnumConnections_Release(pEnum); + } + + hres = IConnectionPoint_EnumConnections(this->pFontEventsCP, &pEnum); + if (SUCCEEDED(hres)) + { + DISPPARAMS dispparams; + VARIANTARG vararg; + + VariantInit(&vararg); + V_VT(&vararg) = VT_BSTR; + V_BSTR(&vararg) = SysAllocString(dispid_mapping[dispID]); + + dispparams.cArgs = 1; + dispparams.cNamedArgs = 0; + dispparams.rgdispidNamedArgs = NULL; + dispparams.rgvarg = &vararg; + + while(IEnumConnections_Next(pEnum, 1, &CD, NULL) == S_OK) { + IFontEventsDisp *disp; + + IUnknown_QueryInterface(CD.pUnk, &IID_IFontEventsDisp, (LPVOID)&disp); + IDispatch_Invoke(disp, DISPID_FONT_CHANGED, &IID_NULL, + LOCALE_NEUTRAL, INVOKE_FUNC, &dispparams, NULL, + NULL, NULL); + + IDispatch_Release(disp); + IUnknown_Release(CD.pUnk); + } + VariantClear(&vararg); + IEnumConnections_Release(pEnum); } - IEnumConnections_Release(pEnum); - return; }
/************************************************************************ @@ -459,7 +511,8 @@ static OLEFontImpl* OLEFontImpl_Construc newObject->fontLock = 0; newObject->cyLogical = 72L; newObject->cyHimetric = 2540L; - CreateConnectionPoint((IUnknown*)newObject, &IID_IPropertyNotifySink, &newObject->pCP); + CreateConnectionPoint((IUnknown*)newObject, &IID_IPropertyNotifySink, &newObject->pPropertyNotifyCP); + CreateConnectionPoint((IUnknown*)newObject, &IID_IFontEventsDisp, &newObject->pFontEventsCP); TRACE("returning %p\n", newObject); return newObject; } @@ -1839,9 +1892,14 @@ static HRESULT WINAPI OLEFontImpl_FindCo OLEFontImpl *this = impl_from_IConnectionPointContainer(iface); TRACE("(%p)->(%s, %p): stub\n", this, debugstr_guid(riid), ppCp);
- if(memcmp(riid, &IID_IPropertyNotifySink, sizeof(IID_IPropertyNotifySink)) == 0) { - return IConnectionPoint_QueryInterface(this->pCP, &IID_IConnectionPoint, - (LPVOID)ppCp); + if(IsEqualIID(riid, &IID_IPropertyNotifySink)) { + return IConnectionPoint_QueryInterface(this->pPropertyNotifyCP, + &IID_IConnectionPoint, + (LPVOID)ppCp); + } else if(IsEqualIID(riid, &IID_IFontEventsDisp)) { + return IConnectionPoint_QueryInterface(this->pFontEventsCP, + &IID_IConnectionPoint, + (LPVOID)ppCp); } else { FIXME("Tried to find connection point on %s\n", debugstr_guid(riid)); return E_NOINTERFACE;