OleFont::IDispatch::Invoke stub can just return S_OK.
[wine.git] / dlls / oleaut32 / olefont.c
blob9a5b30a9ff39c47233f549bc15bfa20d8bb88dc0
1 /*
2 * OLE Font encapsulation implementation
4 * This file contains an implementation of the IFont
5 * interface and the OleCreateFontIndirect API call.
7 * Copyright 1999 Francis Beaudet
8 */
9 #include <assert.h>
10 #include <string.h>
11 #include "winerror.h"
12 #include "winbase.h"
13 #include "wingdi.h"
14 #include "winuser.h"
15 #include "wine/unicode.h"
16 #include "oleauto.h" /* for SysAllocString(....) */
17 #include "wine/obj_olefont.h"
18 #include "wine/obj_storage.h"
19 #include "ole2.h"
20 #include "olectl.h"
21 #include "debugtools.h"
22 #include "heap.h"
23 #include "connpt.h" /* for CreateConnectionPoint */
25 DEFAULT_DEBUG_CHANNEL(ole);
27 /***********************************************************************
28 * Declaration of constants used when serializing the font object.
30 #define FONTPERSIST_ITALIC 0x02
31 #define FONTPERSIST_UNDERLINE 0x04
32 #define FONTPERSIST_STRIKETHROUGH 0x08
34 /***********************************************************************
35 * Declaration of the implementation class for the IFont interface
37 typedef struct OLEFontImpl OLEFontImpl;
39 struct OLEFontImpl
42 * This class supports many interfaces. IUnknown, IFont,
43 * IDispatch, IDispFont IPersistStream and IConnectionPointContainer.
44 * The first two are supported by the first vtable, the next two are
45 * supported by the second table and the last two have their own.
47 ICOM_VTABLE(IFont)* lpvtbl1;
48 ICOM_VTABLE(IDispatch)* lpvtbl2;
49 ICOM_VTABLE(IPersistStream)* lpvtbl3;
50 ICOM_VTABLE(IConnectionPointContainer)* lpvtbl4;
52 * Reference count for that instance of the class.
54 ULONG ref;
57 * This structure contains the description of the class.
59 FONTDESC description;
62 * Contain the font associated with this object.
64 HFONT gdiFont;
67 * Font lock count.
69 DWORD fontLock;
72 * Size ratio
74 long cyLogical;
75 long cyHimetric;
77 IConnectionPoint *pCP;
81 * Here, I define utility macros to help with the casting of the
82 * "this" parameter.
83 * There is a version to accomodate all of the VTables implemented
84 * by this object.
86 #define _ICOM_THIS(class,name) class* this = (class*)name;
87 #define _ICOM_THIS_From_IDispatch(class, name) class* this = (class*)(((char*)name)-sizeof(void*));
88 #define _ICOM_THIS_From_IPersistStream(class, name) class* this = (class*)(((char*)name)-2*sizeof(void*));
89 #define _ICOM_THIS_From_IConnectionPointContainer(class, name) class* this = (class*)(((char*)name)-3*sizeof(void*));
92 /***********************************************************************
93 * Prototypes for the implementation functions for the IFont
94 * interface
96 static OLEFontImpl* OLEFontImpl_Construct(LPFONTDESC fontDesc);
97 static void OLEFontImpl_Destroy(OLEFontImpl* fontDesc);
98 static HRESULT WINAPI OLEFontImpl_QueryInterface(IFont* iface, REFIID riid, VOID** ppvoid);
99 static ULONG WINAPI OLEFontImpl_AddRef(IFont* iface);
100 static ULONG WINAPI OLEFontImpl_Release(IFont* iface);
101 static HRESULT WINAPI OLEFontImpl_get_Name(IFont* iface, BSTR* pname);
102 static HRESULT WINAPI OLEFontImpl_put_Name(IFont* iface, BSTR name);
103 static HRESULT WINAPI OLEFontImpl_get_Size(IFont* iface, CY* psize);
104 static HRESULT WINAPI OLEFontImpl_put_Size(IFont* iface, CY size);
105 static HRESULT WINAPI OLEFontImpl_get_Bold(IFont* iface, BOOL* pbold);
106 static HRESULT WINAPI OLEFontImpl_put_Bold(IFont* iface, BOOL bold);
107 static HRESULT WINAPI OLEFontImpl_get_Italic(IFont* iface, BOOL* pitalic);
108 static HRESULT WINAPI OLEFontImpl_put_Italic(IFont* iface, BOOL italic);
109 static HRESULT WINAPI OLEFontImpl_get_Underline(IFont* iface, BOOL* punderline);
110 static HRESULT WINAPI OLEFontImpl_put_Underline(IFont* iface, BOOL underline);
111 static HRESULT WINAPI OLEFontImpl_get_Strikethrough(IFont* iface, BOOL* pstrikethrough);
112 static HRESULT WINAPI OLEFontImpl_put_Strikethrough(IFont* iface, BOOL strikethrough);
113 static HRESULT WINAPI OLEFontImpl_get_Weight(IFont* iface, short* pweight);
114 static HRESULT WINAPI OLEFontImpl_put_Weight(IFont* iface, short weight);
115 static HRESULT WINAPI OLEFontImpl_get_Charset(IFont* iface, short* pcharset);
116 static HRESULT WINAPI OLEFontImpl_put_Charset(IFont* iface, short charset);
117 static HRESULT WINAPI OLEFontImpl_get_hFont(IFont* iface, HFONT* phfont);
118 static HRESULT WINAPI OLEFontImpl_Clone(IFont* iface, IFont** ppfont);
119 static HRESULT WINAPI OLEFontImpl_IsEqual(IFont* iface, IFont* pFontOther);
120 static HRESULT WINAPI OLEFontImpl_SetRatio(IFont* iface, long cyLogical, long cyHimetric);
121 static HRESULT WINAPI OLEFontImpl_QueryTextMetrics(IFont* iface, TEXTMETRICOLE* ptm);
122 static HRESULT WINAPI OLEFontImpl_AddRefHfont(IFont* iface, HFONT hfont);
123 static HRESULT WINAPI OLEFontImpl_ReleaseHfont(IFont* iface, HFONT hfont);
124 static HRESULT WINAPI OLEFontImpl_SetHdc(IFont* iface, HDC hdc);
126 /***********************************************************************
127 * Prototypes for the implementation functions for the IDispatch
128 * interface
130 static HRESULT WINAPI OLEFontImpl_IDispatch_QueryInterface(IDispatch* iface,
131 REFIID riid,
132 VOID** ppvoid);
133 static ULONG WINAPI OLEFontImpl_IDispatch_AddRef(IDispatch* iface);
134 static ULONG WINAPI OLEFontImpl_IDispatch_Release(IDispatch* iface);
135 static HRESULT WINAPI OLEFontImpl_GetTypeInfoCount(IDispatch* iface,
136 unsigned int* pctinfo);
137 static HRESULT WINAPI OLEFontImpl_GetTypeInfo(IDispatch* iface,
138 UINT iTInfo,
139 LCID lcid,
140 ITypeInfo** ppTInfo);
141 static HRESULT WINAPI OLEFontImpl_GetIDsOfNames(IDispatch* iface,
142 REFIID riid,
143 LPOLESTR* rgszNames,
144 UINT cNames,
145 LCID lcid,
146 DISPID* rgDispId);
147 static HRESULT WINAPI OLEFontImpl_Invoke(IDispatch* iface,
148 DISPID dispIdMember,
149 REFIID riid,
150 LCID lcid,
151 WORD wFlags,
152 DISPPARAMS* pDispParams,
153 VARIANT* pVarResult,
154 EXCEPINFO* pExepInfo,
155 UINT* puArgErr);
157 /***********************************************************************
158 * Prototypes for the implementation functions for the IPersistStream
159 * interface
161 static HRESULT WINAPI OLEFontImpl_IPersistStream_QueryInterface(IPersistStream* iface,
162 REFIID riid,
163 VOID** ppvoid);
164 static ULONG WINAPI OLEFontImpl_IPersistStream_AddRef(IPersistStream* iface);
165 static ULONG WINAPI OLEFontImpl_IPersistStream_Release(IPersistStream* iface);
166 static HRESULT WINAPI OLEFontImpl_GetClassID(IPersistStream* iface,
167 CLSID* pClassID);
168 static HRESULT WINAPI OLEFontImpl_IsDirty(IPersistStream* iface);
169 static HRESULT WINAPI OLEFontImpl_Load(IPersistStream* iface,
170 IStream* pLoadStream);
171 static HRESULT WINAPI OLEFontImpl_Save(IPersistStream* iface,
172 IStream* pOutStream,
173 BOOL fClearDirty);
174 static HRESULT WINAPI OLEFontImpl_GetSizeMax(IPersistStream* iface,
175 ULARGE_INTEGER* pcbSize);
177 /***********************************************************************
178 * Prototypes for the implementation functions for the
179 * IConnectionPointContainer interface
181 static HRESULT WINAPI OLEFontImpl_IConnectionPointContainer_QueryInterface(
182 IConnectionPointContainer* iface,
183 REFIID riid,
184 VOID** ppvoid);
185 static ULONG WINAPI OLEFontImpl_IConnectionPointContainer_AddRef(
186 IConnectionPointContainer* iface);
187 static ULONG WINAPI OLEFontImpl_IConnectionPointContainer_Release(
188 IConnectionPointContainer* iface);
189 static HRESULT WINAPI OLEFontImpl_EnumConnectionPoints(
190 IConnectionPointContainer* iface,
191 IEnumConnectionPoints **ppEnum);
192 static HRESULT WINAPI OLEFontImpl_FindConnectionPoint(
193 IConnectionPointContainer* iface,
194 REFIID riid,
195 IConnectionPoint **ppCp);
198 * Virtual function tables for the OLEFontImpl class.
200 static ICOM_VTABLE(IFont) OLEFontImpl_VTable =
202 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
203 OLEFontImpl_QueryInterface,
204 OLEFontImpl_AddRef,
205 OLEFontImpl_Release,
206 OLEFontImpl_get_Name,
207 OLEFontImpl_put_Name,
208 OLEFontImpl_get_Size,
209 OLEFontImpl_put_Size,
210 OLEFontImpl_get_Bold,
211 OLEFontImpl_put_Bold,
212 OLEFontImpl_get_Italic,
213 OLEFontImpl_put_Italic,
214 OLEFontImpl_get_Underline,
215 OLEFontImpl_put_Underline,
216 OLEFontImpl_get_Strikethrough,
217 OLEFontImpl_put_Strikethrough,
218 OLEFontImpl_get_Weight,
219 OLEFontImpl_put_Weight,
220 OLEFontImpl_get_Charset,
221 OLEFontImpl_put_Charset,
222 OLEFontImpl_get_hFont,
223 OLEFontImpl_Clone,
224 OLEFontImpl_IsEqual,
225 OLEFontImpl_SetRatio,
226 OLEFontImpl_QueryTextMetrics,
227 OLEFontImpl_AddRefHfont,
228 OLEFontImpl_ReleaseHfont,
229 OLEFontImpl_SetHdc
232 static ICOM_VTABLE(IDispatch) OLEFontImpl_IDispatch_VTable =
234 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
235 OLEFontImpl_IDispatch_QueryInterface,
236 OLEFontImpl_IDispatch_AddRef,
237 OLEFontImpl_IDispatch_Release,
238 OLEFontImpl_GetTypeInfoCount,
239 OLEFontImpl_GetTypeInfo,
240 OLEFontImpl_GetIDsOfNames,
241 OLEFontImpl_Invoke
244 static ICOM_VTABLE(IPersistStream) OLEFontImpl_IPersistStream_VTable =
246 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
247 OLEFontImpl_IPersistStream_QueryInterface,
248 OLEFontImpl_IPersistStream_AddRef,
249 OLEFontImpl_IPersistStream_Release,
250 OLEFontImpl_GetClassID,
251 OLEFontImpl_IsDirty,
252 OLEFontImpl_Load,
253 OLEFontImpl_Save,
254 OLEFontImpl_GetSizeMax
257 static ICOM_VTABLE(IConnectionPointContainer)
258 OLEFontImpl_IConnectionPointContainer_VTable =
260 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
261 OLEFontImpl_IConnectionPointContainer_QueryInterface,
262 OLEFontImpl_IConnectionPointContainer_AddRef,
263 OLEFontImpl_IConnectionPointContainer_Release,
264 OLEFontImpl_EnumConnectionPoints,
265 OLEFontImpl_FindConnectionPoint
268 /******************************************************************************
269 * OleCreateFontIndirect [OLEAUT32.420]
271 HRESULT WINAPI OleCreateFontIndirect(
272 LPFONTDESC lpFontDesc,
273 REFIID riid,
274 LPVOID* ppvObj)
276 OLEFontImpl* newFont = 0;
277 HRESULT hr = S_OK;
279 TRACE("(%p, %s, %p)\n", lpFontDesc, debugstr_guid(riid), ppvObj);
281 * Sanity check
283 if (ppvObj==0)
284 return E_POINTER;
286 *ppvObj = 0;
289 * Try to construct a new instance of the class.
291 newFont = OLEFontImpl_Construct(lpFontDesc);
293 if (newFont == 0)
294 return E_OUTOFMEMORY;
297 * Make sure it supports the interface required by the caller.
299 hr = IFont_QueryInterface((IFont*)newFont, riid, ppvObj);
302 * Release the reference obtained in the constructor. If
303 * the QueryInterface was unsuccessful, it will free the class.
305 IFont_Release((IFont*)newFont);
307 return hr;
311 /***********************************************************************
312 * Implementation of the OLEFontImpl class.
315 /***********************************************************************
316 * OLEFont_SendNotify (internal)
318 * Sends notification messages of changed properties to any interested
319 * connections.
321 static void OLEFont_SendNotify(OLEFontImpl* this, DISPID dispID)
323 IEnumConnections *pEnum;
324 CONNECTDATA CD;
326 IConnectionPoint_EnumConnections(this->pCP, &pEnum);
328 while(IEnumConnections_Next(pEnum, 1, &CD, NULL) == S_OK) {
329 IPropertyNotifySink *sink;
331 IUnknown_QueryInterface(CD.pUnk, &IID_IPropertyNotifySink, (LPVOID)&sink);
332 IPropertyNotifySink_OnChanged(sink, dispID);
333 IPropertyNotifySink_Release(sink);
334 IUnknown_Release(CD.pUnk);
336 IEnumConnections_Release(pEnum);
337 return;
340 /************************************************************************
341 * OLEFontImpl_Construct
343 * This method will construct a new instance of the OLEFontImpl
344 * class.
346 * The caller of this method must release the object when it's
347 * done with it.
349 static OLEFontImpl* OLEFontImpl_Construct(LPFONTDESC fontDesc)
351 OLEFontImpl* newObject = 0;
354 * Allocate space for the object.
356 newObject = HeapAlloc(GetProcessHeap(), 0, sizeof(OLEFontImpl));
358 if (newObject==0)
359 return newObject;
362 * Initialize the virtual function table.
364 newObject->lpvtbl1 = &OLEFontImpl_VTable;
365 newObject->lpvtbl2 = &OLEFontImpl_IDispatch_VTable;
366 newObject->lpvtbl3 = &OLEFontImpl_IPersistStream_VTable;
367 newObject->lpvtbl4 = &OLEFontImpl_IConnectionPointContainer_VTable;
370 * Start with one reference count. The caller of this function
371 * must release the interface pointer when it is done.
373 newObject->ref = 1;
376 * Copy the description of the font in the object.
378 assert(fontDesc->cbSizeofstruct >= sizeof(FONTDESC));
380 newObject->description.cbSizeofstruct = sizeof(FONTDESC);
381 newObject->description.lpstrName = HeapAlloc(GetProcessHeap(),
383 (lstrlenW(fontDesc->lpstrName)+1) * sizeof(WCHAR));
384 strcpyW(newObject->description.lpstrName, fontDesc->lpstrName);
385 newObject->description.cySize = fontDesc->cySize;
386 newObject->description.sWeight = fontDesc->sWeight;
387 newObject->description.sCharset = fontDesc->sCharset;
388 newObject->description.fItalic = fontDesc->fItalic;
389 newObject->description.fUnderline = fontDesc->fUnderline;
390 newObject->description.fStrikethrough = fontDesc->fStrikethrough;
393 * Initializing all the other members.
395 newObject->gdiFont = 0;
396 newObject->fontLock = 0;
397 newObject->cyHimetric = 1;
398 newObject->cyLogical = 1;
400 CreateConnectionPoint((IUnknown*)newObject, &IID_IPropertyNotifySink, &newObject->pCP);
402 TRACE("returning %p\n", newObject);
403 return newObject;
406 /************************************************************************
407 * OLEFontImpl_Destroy
409 * This method is called by the Release method when the reference
410 * count goes down to 0. It will free all resources used by
411 * this object.
413 static void OLEFontImpl_Destroy(OLEFontImpl* fontDesc)
415 TRACE("(%p)\n", fontDesc);
417 if (fontDesc->description.lpstrName!=0)
418 HeapFree(GetProcessHeap(), 0, fontDesc->description.lpstrName);
420 if (fontDesc->gdiFont!=0)
421 DeleteObject(fontDesc->gdiFont);
423 HeapFree(GetProcessHeap(), 0, fontDesc);
426 /************************************************************************
427 * OLEFontImpl_QueryInterface (IUnknown)
429 * See Windows documentation for more details on IUnknown methods.
431 HRESULT WINAPI OLEFontImpl_QueryInterface(
432 IFont* iface,
433 REFIID riid,
434 void** ppvObject)
436 _ICOM_THIS(OLEFontImpl, iface);
437 TRACE("(%p)->(%s, %p)\n", this, debugstr_guid(riid), ppvObject);
440 * Perform a sanity check on the parameters.
442 if ( (this==0) || (ppvObject==0) )
443 return E_INVALIDARG;
446 * Initialize the return parameter.
448 *ppvObject = 0;
451 * Compare the riid with the interface IDs implemented by this object.
453 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
455 *ppvObject = (IFont*)this;
457 else if (memcmp(&IID_IFont, riid, sizeof(IID_IFont)) == 0)
459 *ppvObject = (IFont*)this;
461 else if (memcmp(&IID_IDispatch, riid, sizeof(IID_IDispatch)) == 0)
463 *ppvObject = (IDispatch*)&(this->lpvtbl2);
465 else if (memcmp(&IID_IFontDisp, riid, sizeof(IID_IFontDisp)) == 0)
467 *ppvObject = (IDispatch*)&(this->lpvtbl2);
469 else if (memcmp(&IID_IPersistStream, riid, sizeof(IID_IPersistStream)) == 0)
471 *ppvObject = (IPersistStream*)&(this->lpvtbl3);
473 else if (memcmp(&IID_IConnectionPointContainer, riid,
474 sizeof(IID_IConnectionPointContainer)) == 0)
476 *ppvObject = (IPersistStream*)&(this->lpvtbl4);
480 * Check that we obtained an interface.
482 if ((*ppvObject)==0)
484 FIXME("() : asking for un supported interface %s\n",debugstr_guid(riid));
485 return E_NOINTERFACE;
489 * Query Interface always increases the reference count by one when it is
490 * successful
492 OLEFontImpl_AddRef((IFont*)this);
494 return S_OK;;
497 /************************************************************************
498 * OLEFontImpl_AddRef (IUnknown)
500 * See Windows documentation for more details on IUnknown methods.
502 ULONG WINAPI OLEFontImpl_AddRef(
503 IFont* iface)
505 _ICOM_THIS(OLEFontImpl, iface);
506 TRACE("(%p)->(ref=%ld)\n", this, this->ref);
507 this->ref++;
509 return this->ref;
512 /************************************************************************
513 * OLEFontImpl_Release (IUnknown)
515 * See Windows documentation for more details on IUnknown methods.
517 ULONG WINAPI OLEFontImpl_Release(
518 IFont* iface)
520 _ICOM_THIS(OLEFontImpl, iface);
521 TRACE("(%p)->(ref=%ld)\n", this, this->ref);
524 * Decrease the reference count on this object.
526 this->ref--;
529 * If the reference count goes down to 0, perform suicide.
531 if (this->ref==0)
533 OLEFontImpl_Destroy(this);
535 return 0;
538 return this->ref;
541 /************************************************************************
542 * OLEFontImpl_get_Name (IFont)
544 * See Windows documentation for more details on IFont methods.
546 static HRESULT WINAPI OLEFontImpl_get_Name(
547 IFont* iface,
548 BSTR* pname)
550 _ICOM_THIS(OLEFontImpl, iface);
551 TRACE("(%p)->(%p)\n", this, pname);
553 * Sanity check.
555 if (pname==0)
556 return E_POINTER;
558 if (this->description.lpstrName!=0)
559 *pname = SysAllocString(this->description.lpstrName);
560 else
561 *pname = 0;
563 return S_OK;
566 /************************************************************************
567 * OLEFontImpl_put_Name (IFont)
569 * See Windows documentation for more details on IFont methods.
571 static HRESULT WINAPI OLEFontImpl_put_Name(
572 IFont* iface,
573 BSTR name)
575 _ICOM_THIS(OLEFontImpl, iface);
576 TRACE("(%p)->(%p)\n", this, name);
578 if (this->description.lpstrName==0)
580 this->description.lpstrName = HeapAlloc(GetProcessHeap(),
582 (lstrlenW(name)+1) * sizeof(WCHAR));
584 else
586 this->description.lpstrName = HeapReAlloc(GetProcessHeap(),
588 this->description.lpstrName,
589 (lstrlenW(name)+1) * sizeof(WCHAR));
592 if (this->description.lpstrName==0)
593 return E_OUTOFMEMORY;
595 strcpyW(this->description.lpstrName, name);
596 TRACE("new name %s\n", debugstr_w(this->description.lpstrName));
597 OLEFont_SendNotify(this, DISPID_FONT_NAME);
598 return S_OK;
601 /************************************************************************
602 * OLEFontImpl_get_Size (IFont)
604 * See Windows documentation for more details on IFont methods.
606 static HRESULT WINAPI OLEFontImpl_get_Size(
607 IFont* iface,
608 CY* psize)
610 _ICOM_THIS(OLEFontImpl, iface);
611 TRACE("(%p)->(%p)\n", this, psize);
614 * Sanity check
616 if (psize==0)
617 return E_POINTER;
619 psize->s.Hi = 0;
620 psize->s.Lo = this->description.cySize.s.Lo;
622 return S_OK;
625 /************************************************************************
626 * OLEFontImpl_put_Size (IFont)
628 * See Windows documentation for more details on IFont methods.
630 static HRESULT WINAPI OLEFontImpl_put_Size(
631 IFont* iface,
632 CY size)
634 _ICOM_THIS(OLEFontImpl, iface);
635 TRACE("(%p)->(%ld)\n", this, size.s.Lo);
636 this->description.cySize.s.Hi = 0;
637 this->description.cySize.s.Lo = size.s.Lo;
638 OLEFont_SendNotify(this, DISPID_FONT_SIZE);
640 return S_OK;
643 /************************************************************************
644 * OLEFontImpl_get_Bold (IFont)
646 * See Windows documentation for more details on IFont methods.
648 static HRESULT WINAPI OLEFontImpl_get_Bold(
649 IFont* iface,
650 BOOL* pbold)
652 _ICOM_THIS(OLEFontImpl, iface);
653 TRACE("(%p)->(%p)\n", this, pbold);
655 * Sanity check
657 if (pbold==0)
658 return E_POINTER;
660 *pbold = this->description.sWeight > 550;
662 return S_OK;
665 /************************************************************************
666 * OLEFontImpl_put_Bold (IFont)
668 * See Windows documentation for more details on IFont methods.
670 static HRESULT WINAPI OLEFontImpl_put_Bold(
671 IFont* iface,
672 BOOL bold)
674 _ICOM_THIS(OLEFontImpl, iface);
675 TRACE("(%p)->(%d)\n", this, bold);
676 this->description.sWeight = bold ? FW_BOLD : FW_NORMAL;
677 OLEFont_SendNotify(this, DISPID_FONT_BOLD);
679 return S_OK;
682 /************************************************************************
683 * OLEFontImpl_get_Italic (IFont)
685 * See Windows documentation for more details on IFont methods.
687 static HRESULT WINAPI OLEFontImpl_get_Italic(
688 IFont* iface,
689 BOOL* pitalic)
691 _ICOM_THIS(OLEFontImpl, iface);
692 TRACE("(%p)->(%p)\n", this, pitalic);
694 * Sanity check
696 if (pitalic==0)
697 return E_POINTER;
699 *pitalic = this->description.fItalic;
701 return S_OK;
704 /************************************************************************
705 * OLEFontImpl_put_Italic (IFont)
707 * See Windows documentation for more details on IFont methods.
709 static HRESULT WINAPI OLEFontImpl_put_Italic(
710 IFont* iface,
711 BOOL italic)
713 _ICOM_THIS(OLEFontImpl, iface);
714 TRACE("(%p)->(%d)\n", this, italic);
716 this->description.fItalic = italic;
718 OLEFont_SendNotify(this, DISPID_FONT_ITALIC);
719 return S_OK;
722 /************************************************************************
723 * OLEFontImpl_get_Underline (IFont)
725 * See Windows documentation for more details on IFont methods.
727 static HRESULT WINAPI OLEFontImpl_get_Underline(
728 IFont* iface,
729 BOOL* punderline)
731 _ICOM_THIS(OLEFontImpl, iface);
732 TRACE("(%p)->(%p)\n", this, punderline);
735 * Sanity check
737 if (punderline==0)
738 return E_POINTER;
740 *punderline = this->description.fUnderline;
742 return S_OK;
745 /************************************************************************
746 * OLEFontImpl_put_Underline (IFont)
748 * See Windows documentation for more details on IFont methods.
750 static HRESULT WINAPI OLEFontImpl_put_Underline(
751 IFont* iface,
752 BOOL underline)
754 _ICOM_THIS(OLEFontImpl, iface);
755 TRACE("(%p)->(%d)\n", this, underline);
757 this->description.fUnderline = underline;
759 OLEFont_SendNotify(this, DISPID_FONT_UNDER);
760 return S_OK;
763 /************************************************************************
764 * OLEFontImpl_get_Strikethrough (IFont)
766 * See Windows documentation for more details on IFont methods.
768 static HRESULT WINAPI OLEFontImpl_get_Strikethrough(
769 IFont* iface,
770 BOOL* pstrikethrough)
772 _ICOM_THIS(OLEFontImpl, iface);
773 TRACE("(%p)->(%p)\n", this, pstrikethrough);
776 * Sanity check
778 if (pstrikethrough==0)
779 return E_POINTER;
781 *pstrikethrough = this->description.fStrikethrough;
783 return S_OK;
786 /************************************************************************
787 * OLEFontImpl_put_Strikethrough (IFont)
789 * See Windows documentation for more details on IFont methods.
791 static HRESULT WINAPI OLEFontImpl_put_Strikethrough(
792 IFont* iface,
793 BOOL strikethrough)
795 _ICOM_THIS(OLEFontImpl, iface);
796 TRACE("(%p)->(%d)\n", this, strikethrough);
798 this->description.fStrikethrough = strikethrough;
799 OLEFont_SendNotify(this, DISPID_FONT_STRIKE);
801 return S_OK;
804 /************************************************************************
805 * OLEFontImpl_get_Weight (IFont)
807 * See Windows documentation for more details on IFont methods.
809 static HRESULT WINAPI OLEFontImpl_get_Weight(
810 IFont* iface,
811 short* pweight)
813 _ICOM_THIS(OLEFontImpl, iface);
814 TRACE("(%p)->(%p)\n", this, pweight);
817 * Sanity check
819 if (pweight==0)
820 return E_POINTER;
822 *pweight = this->description.sWeight;
824 return S_OK;
827 /************************************************************************
828 * OLEFontImpl_put_Weight (IFont)
830 * See Windows documentation for more details on IFont methods.
832 static HRESULT WINAPI OLEFontImpl_put_Weight(
833 IFont* iface,
834 short weight)
836 _ICOM_THIS(OLEFontImpl, iface);
837 TRACE("(%p)->(%d)\n", this, weight);
839 this->description.sWeight = weight;
841 OLEFont_SendNotify(this, DISPID_FONT_WEIGHT);
842 return S_OK;
845 /************************************************************************
846 * OLEFontImpl_get_Charset (IFont)
848 * See Windows documentation for more details on IFont methods.
850 static HRESULT WINAPI OLEFontImpl_get_Charset(
851 IFont* iface,
852 short* pcharset)
854 _ICOM_THIS(OLEFontImpl, iface);
855 TRACE("(%p)->(%p)\n", this, pcharset);
858 * Sanity check
860 if (pcharset==0)
861 return E_POINTER;
863 *pcharset = this->description.sCharset;
865 return S_OK;
868 /************************************************************************
869 * OLEFontImpl_put_Charset (IFont)
871 * See Windows documentation for more details on IFont methods.
873 static HRESULT WINAPI OLEFontImpl_put_Charset(
874 IFont* iface,
875 short charset)
877 _ICOM_THIS(OLEFontImpl, iface);
878 TRACE("(%p)->(%d)\n", this, charset);
880 this->description.sCharset = charset;
881 OLEFont_SendNotify(this, DISPID_FONT_CHARSET);
883 return S_OK;
886 /************************************************************************
887 * OLEFontImpl_get_hFont (IFont)
889 * See Windows documentation for more details on IFont methods.
891 static HRESULT WINAPI OLEFontImpl_get_hFont(
892 IFont* iface,
893 HFONT* phfont)
895 _ICOM_THIS(OLEFontImpl, iface);
896 TRACE("(%p)->(%p)\n", this, phfont);
897 if (phfont==NULL)
898 return E_POINTER;
901 * Realize the font if necessary
903 if (this->gdiFont==0)
905 LOGFONTW logFont;
906 INT fontHeight;
907 CY cySize;
910 * The height of the font returned by the get_Size property is the
911 * height of the font in points multiplied by 10000... Using some
912 * simple conversions and the ratio given by the application, it can
913 * be converted to a height in pixels.
915 IFont_get_Size(iface, &cySize);
917 fontHeight = MulDiv(cySize.s.Lo, 2540L, 72L);
918 fontHeight = MulDiv(fontHeight, this->cyLogical,this->cyHimetric);
920 memset(&logFont, 0, sizeof(LOGFONTW));
922 logFont.lfHeight = ((fontHeight%10000L)>5000L) ? (-fontHeight/10000L)-1 :
923 (-fontHeight/10000L);
924 logFont.lfItalic = this->description.fItalic;
925 logFont.lfUnderline = this->description.fUnderline;
926 logFont.lfStrikeOut = this->description.fStrikethrough;
927 logFont.lfWeight = this->description.sWeight;
928 logFont.lfCharSet = this->description.sCharset;
929 logFont.lfOutPrecision = OUT_CHARACTER_PRECIS;
930 logFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
931 logFont.lfQuality = DEFAULT_QUALITY;
932 logFont.lfPitchAndFamily = DEFAULT_PITCH;
933 strcpyW(logFont.lfFaceName,this->description.lpstrName);
935 this->gdiFont = CreateFontIndirectW(&logFont);
938 *phfont = this->gdiFont;
939 TRACE("Returning %08x\n", *phfont);
940 return S_OK;
943 /************************************************************************
944 * OLEFontImpl_Clone (IFont)
946 * See Windows documentation for more details on IFont methods.
948 static HRESULT WINAPI OLEFontImpl_Clone(
949 IFont* iface,
950 IFont** ppfont)
952 OLEFontImpl* newObject = 0;
953 _ICOM_THIS(OLEFontImpl, iface);
954 TRACE("(%p)->(%p)\n", this, ppfont);
956 if (ppfont == NULL)
957 return E_POINTER;
959 *ppfont = NULL;
962 * Allocate space for the object.
964 newObject = HeapAlloc(GetProcessHeap(), 0, sizeof(OLEFontImpl));
966 if (newObject==NULL)
967 return E_OUTOFMEMORY;
969 *newObject = *this;
972 * That new object starts with a reference count of 1
974 newObject->ref = 1;
976 *ppfont = (IFont*)newObject;
978 return S_OK;
981 /************************************************************************
982 * OLEFontImpl_IsEqual (IFont)
984 * See Windows documentation for more details on IFont methods.
986 static HRESULT WINAPI OLEFontImpl_IsEqual(
987 IFont* iface,
988 IFont* pFontOther)
990 FIXME("():Stub\n");
991 return E_NOTIMPL;
994 /************************************************************************
995 * OLEFontImpl_SetRatio (IFont)
997 * See Windows documentation for more details on IFont methods.
999 static HRESULT WINAPI OLEFontImpl_SetRatio(
1000 IFont* iface,
1001 long cyLogical,
1002 long cyHimetric)
1004 _ICOM_THIS(OLEFontImpl, iface);
1005 TRACE("(%p)->(%ld, %ld)\n", this, cyLogical, cyHimetric);
1007 this->cyLogical = cyLogical;
1008 this->cyHimetric = cyHimetric;
1010 return S_OK;
1013 /************************************************************************
1014 * OLEFontImpl_QueryTextMetrics (IFont)
1016 * See Windows documentation for more details on IFont methods.
1018 static HRESULT WINAPI OLEFontImpl_QueryTextMetrics(
1019 IFont* iface,
1020 TEXTMETRICOLE* ptm)
1022 FIXME("():Stub\n");
1023 return E_NOTIMPL;
1026 /************************************************************************
1027 * OLEFontImpl_AddRefHfont (IFont)
1029 * See Windows documentation for more details on IFont methods.
1031 static HRESULT WINAPI OLEFontImpl_AddRefHfont(
1032 IFont* iface,
1033 HFONT hfont)
1035 _ICOM_THIS(OLEFontImpl, iface);
1036 TRACE("(%p)->(%08x) (lock=%ld)\n", this, hfont, this->fontLock);
1038 if ( (hfont == 0) ||
1039 (hfont != this->gdiFont) )
1040 return E_INVALIDARG;
1042 this->fontLock++;
1044 return S_OK;
1047 /************************************************************************
1048 * OLEFontImpl_ReleaseHfont (IFont)
1050 * See Windows documentation for more details on IFont methods.
1052 static HRESULT WINAPI OLEFontImpl_ReleaseHfont(
1053 IFont* iface,
1054 HFONT hfont)
1056 _ICOM_THIS(OLEFontImpl, iface);
1057 TRACE("(%p)->(%08x) (lock=%ld)\n", this, hfont, this->fontLock);
1059 if ( (hfont == 0) ||
1060 (hfont != this->gdiFont) )
1061 return E_INVALIDARG;
1063 this->fontLock--;
1066 * If we just released our last font reference, destroy it.
1068 if (this->fontLock==0)
1070 DeleteObject(this->gdiFont);
1071 this->gdiFont = 0;
1074 return S_OK;
1077 /************************************************************************
1078 * OLEFontImpl_SetHdc (IFont)
1080 * See Windows documentation for more details on IFont methods.
1082 static HRESULT WINAPI OLEFontImpl_SetHdc(
1083 IFont* iface,
1084 HDC hdc)
1086 _ICOM_THIS(OLEFontImpl, iface);
1087 FIXME("(%p)->(%08x): Stub\n", this, hdc);
1088 return E_NOTIMPL;
1091 /************************************************************************
1092 * OLEFontImpl_IDispatch_QueryInterface (IUnknown)
1094 * See Windows documentation for more details on IUnknown methods.
1096 static HRESULT WINAPI OLEFontImpl_IDispatch_QueryInterface(
1097 IDispatch* iface,
1098 REFIID riid,
1099 VOID** ppvoid)
1101 _ICOM_THIS_From_IDispatch(IFont, iface);
1103 return IFont_QueryInterface(this, riid, ppvoid);
1106 /************************************************************************
1107 * OLEFontImpl_IDispatch_Release (IUnknown)
1109 * See Windows documentation for more details on IUnknown methods.
1111 static ULONG WINAPI OLEFontImpl_IDispatch_Release(
1112 IDispatch* iface)
1114 _ICOM_THIS_From_IDispatch(IFont, iface);
1116 return IFont_Release(this);
1119 /************************************************************************
1120 * OLEFontImpl_IDispatch_AddRef (IUnknown)
1122 * See Windows documentation for more details on IUnknown methods.
1124 static ULONG WINAPI OLEFontImpl_IDispatch_AddRef(
1125 IDispatch* iface)
1127 _ICOM_THIS_From_IDispatch(IFont, iface);
1129 return IFont_AddRef(this);
1132 /************************************************************************
1133 * OLEFontImpl_GetTypeInfoCount (IDispatch)
1135 * See Windows documentation for more details on IDispatch methods.
1137 static HRESULT WINAPI OLEFontImpl_GetTypeInfoCount(
1138 IDispatch* iface,
1139 unsigned int* pctinfo)
1141 _ICOM_THIS_From_IDispatch(IFont, iface);
1142 FIXME("(%p)->(%p): Stub\n", this, pctinfo);
1144 return E_NOTIMPL;
1147 /************************************************************************
1148 * OLEFontImpl_GetTypeInfo (IDispatch)
1150 * See Windows documentation for more details on IDispatch methods.
1152 static HRESULT WINAPI OLEFontImpl_GetTypeInfo(
1153 IDispatch* iface,
1154 UINT iTInfo,
1155 LCID lcid,
1156 ITypeInfo** ppTInfo)
1158 _ICOM_THIS_From_IDispatch(IFont, iface);
1159 FIXME("(%p):Stub\n", this);
1161 return E_NOTIMPL;
1164 /************************************************************************
1165 * OLEFontImpl_GetIDsOfNames (IDispatch)
1167 * See Windows documentation for more details on IDispatch methods.
1169 static HRESULT WINAPI OLEFontImpl_GetIDsOfNames(
1170 IDispatch* iface,
1171 REFIID riid,
1172 LPOLESTR* rgszNames,
1173 UINT cNames,
1174 LCID lcid,
1175 DISPID* rgDispId)
1177 _ICOM_THIS_From_IDispatch(IFont, iface);
1178 FIXME("(%p):Stub\n", this);
1180 return E_NOTIMPL;
1183 /************************************************************************
1184 * OLEFontImpl_Invoke (IDispatch)
1186 * See Windows documentation for more details on IDispatch methods.
1188 static HRESULT WINAPI OLEFontImpl_Invoke(
1189 IDispatch* iface,
1190 DISPID dispIdMember,
1191 REFIID riid,
1192 LCID lcid,
1193 WORD wFlags,
1194 DISPPARAMS* pDispParams,
1195 VARIANT* pVarResult,
1196 EXCEPINFO* pExepInfo,
1197 UINT* puArgErr)
1199 _ICOM_THIS_From_IDispatch(IFont, iface);
1200 FIXME("%p->(%ld,%s,%lx,%x), stub!\n", this,dispIdMember,debugstr_guid(riid),lcid,
1201 wFlags
1203 return S_OK;
1206 /************************************************************************
1207 * OLEFontImpl_IPersistStream_QueryInterface (IUnknown)
1209 * See Windows documentation for more details on IUnknown methods.
1211 static HRESULT WINAPI OLEFontImpl_IPersistStream_QueryInterface(
1212 IPersistStream* iface,
1213 REFIID riid,
1214 VOID** ppvoid)
1216 _ICOM_THIS_From_IPersistStream(IFont, iface);
1218 return IFont_QueryInterface(this, riid, ppvoid);
1221 /************************************************************************
1222 * OLEFontImpl_IPersistStream_Release (IUnknown)
1224 * See Windows documentation for more details on IUnknown methods.
1226 static ULONG WINAPI OLEFontImpl_IPersistStream_Release(
1227 IPersistStream* iface)
1229 _ICOM_THIS_From_IPersistStream(IFont, iface);
1231 return IFont_Release(this);
1234 /************************************************************************
1235 * OLEFontImpl_IPersistStream_AddRef (IUnknown)
1237 * See Windows documentation for more details on IUnknown methods.
1239 static ULONG WINAPI OLEFontImpl_IPersistStream_AddRef(
1240 IPersistStream* iface)
1242 _ICOM_THIS_From_IPersistStream(IFont, iface);
1244 return IFont_AddRef(this);
1247 /************************************************************************
1248 * OLEFontImpl_GetClassID (IPersistStream)
1250 * See Windows documentation for more details on IPersistStream methods.
1252 static HRESULT WINAPI OLEFontImpl_GetClassID(
1253 IPersistStream* iface,
1254 CLSID* pClassID)
1256 if (pClassID==0)
1257 return E_POINTER;
1259 memcpy(pClassID, &CLSID_StdFont, sizeof(CLSID_StdFont));
1261 return S_OK;
1264 /************************************************************************
1265 * OLEFontImpl_IsDirty (IPersistStream)
1267 * See Windows documentation for more details on IPersistStream methods.
1269 static HRESULT WINAPI OLEFontImpl_IsDirty(
1270 IPersistStream* iface)
1272 return S_OK;
1275 /************************************************************************
1276 * OLEFontImpl_Load (IPersistStream)
1278 * See Windows documentation for more details on IPersistStream methods.
1280 * This is the format of the standard font serialization as far as I
1281 * know
1283 * Offset Type Value Comment
1284 * 0x0000 Byte Unknown Probably a version number, contains 0x01
1285 * 0x0001 Short Charset Charset value from the FONTDESC structure
1286 * 0x0003 Byte Attributes Flags defined as follows:
1287 * 00000010 - Italic
1288 * 00000100 - Underline
1289 * 00001000 - Strikethrough
1290 * 0x0004 Short Weight Weight value from FONTDESC structure
1291 * 0x0006 DWORD size "Low" portion of the cySize member of the FONTDESC
1292 * structure/
1293 * 0x000A Byte name length Length of the font name string (no null character)
1294 * 0x000B String name Name of the font (ASCII, no nul character)
1296 static HRESULT WINAPI OLEFontImpl_Load(
1297 IPersistStream* iface,
1298 IStream* pLoadStream)
1300 char readBuffer[0x100];
1301 ULONG cbRead;
1302 BYTE bVersion;
1303 BYTE bAttributes;
1304 BYTE bStringSize;
1306 _ICOM_THIS_From_IPersistStream(OLEFontImpl, iface);
1309 * Read the version byte
1311 IStream_Read(pLoadStream, &bVersion, 1, &cbRead);
1313 if ( (cbRead!=1) ||
1314 (bVersion!=0x01) )
1315 return E_FAIL;
1318 * Charset
1320 IStream_Read(pLoadStream, &this->description.sCharset, 2, &cbRead);
1322 if (cbRead!=2)
1323 return E_FAIL;
1326 * Attributes
1328 IStream_Read(pLoadStream, &bAttributes, 1, &cbRead);
1330 if (cbRead!=1)
1331 return E_FAIL;
1333 this->description.fItalic = (bAttributes & FONTPERSIST_ITALIC) != 0;
1334 this->description.fStrikethrough = (bAttributes & FONTPERSIST_STRIKETHROUGH) != 0;
1335 this->description.fUnderline = (bAttributes & FONTPERSIST_UNDERLINE) != 0;
1338 * Weight
1340 IStream_Read(pLoadStream, &this->description.sWeight, 2, &cbRead);
1342 if (cbRead!=2)
1343 return E_FAIL;
1346 * Size
1348 IStream_Read(pLoadStream, &this->description.cySize.s.Lo, 4, &cbRead);
1350 if (cbRead!=4)
1351 return E_FAIL;
1353 this->description.cySize.s.Hi = 0;
1356 * FontName
1358 IStream_Read(pLoadStream, &bStringSize, 1, &cbRead);
1360 if (cbRead!=1)
1361 return E_FAIL;
1363 memset(readBuffer, 0, 0x100);
1364 IStream_Read(pLoadStream, readBuffer, bStringSize, &cbRead);
1366 if (cbRead!=bStringSize)
1367 return E_FAIL;
1369 if (this->description.lpstrName!=0)
1370 HeapFree(GetProcessHeap(), 0, this->description.lpstrName);
1372 this->description.lpstrName = HEAP_strdupAtoW(GetProcessHeap(),
1373 HEAP_ZERO_MEMORY,
1374 readBuffer);
1376 return S_OK;
1379 /************************************************************************
1380 * OLEFontImpl_Save (IPersistStream)
1382 * See Windows documentation for more details on IPersistStream methods.
1384 static HRESULT WINAPI OLEFontImpl_Save(
1385 IPersistStream* iface,
1386 IStream* pOutStream,
1387 BOOL fClearDirty)
1389 char* writeBuffer = NULL;
1390 ULONG cbWritten;
1391 BYTE bVersion = 0x01;
1392 BYTE bAttributes;
1393 BYTE bStringSize;
1395 _ICOM_THIS_From_IPersistStream(OLEFontImpl, iface);
1398 * Read the version byte
1400 IStream_Write(pOutStream, &bVersion, 1, &cbWritten);
1402 if (cbWritten!=1)
1403 return E_FAIL;
1406 * Charset
1408 IStream_Write(pOutStream, &this->description.sCharset, 2, &cbWritten);
1410 if (cbWritten!=2)
1411 return E_FAIL;
1414 * Attributes
1416 bAttributes = 0;
1418 if (this->description.fItalic)
1419 bAttributes |= FONTPERSIST_ITALIC;
1421 if (this->description.fStrikethrough)
1422 bAttributes |= FONTPERSIST_STRIKETHROUGH;
1424 if (this->description.fUnderline)
1425 bAttributes |= FONTPERSIST_UNDERLINE;
1427 IStream_Write(pOutStream, &bAttributes, 1, &cbWritten);
1429 if (cbWritten!=1)
1430 return E_FAIL;
1433 * Weight
1435 IStream_Write(pOutStream, &this->description.sWeight, 2, &cbWritten);
1437 if (cbWritten!=2)
1438 return E_FAIL;
1441 * Size
1443 IStream_Write(pOutStream, &this->description.cySize.s.Lo, 4, &cbWritten);
1445 if (cbWritten!=4)
1446 return E_FAIL;
1449 * FontName
1451 if (this->description.lpstrName!=0)
1452 bStringSize = lstrlenW(this->description.lpstrName);
1453 else
1454 bStringSize = 0;
1456 IStream_Write(pOutStream, &bStringSize, 1, &cbWritten);
1458 if (cbWritten!=1)
1459 return E_FAIL;
1461 if (bStringSize!=0)
1463 writeBuffer = HEAP_strdupWtoA(GetProcessHeap(),
1464 HEAP_ZERO_MEMORY,
1465 this->description.lpstrName);
1467 if (writeBuffer==0)
1468 return E_OUTOFMEMORY;
1470 IStream_Write(pOutStream, writeBuffer, bStringSize, &cbWritten);
1472 HeapFree(GetProcessHeap(), 0, writeBuffer);
1474 if (cbWritten!=bStringSize)
1475 return E_FAIL;
1478 return S_OK;
1481 /************************************************************************
1482 * OLEFontImpl_GetSizeMax (IPersistStream)
1484 * See Windows documentation for more details on IPersistStream methods.
1486 static HRESULT WINAPI OLEFontImpl_GetSizeMax(
1487 IPersistStream* iface,
1488 ULARGE_INTEGER* pcbSize)
1490 _ICOM_THIS_From_IPersistStream(OLEFontImpl, iface);
1492 if (pcbSize==NULL)
1493 return E_POINTER;
1495 pcbSize->s.HighPart = 0;
1496 pcbSize->s.LowPart = 0;
1498 pcbSize->s.LowPart += sizeof(BYTE); /* Version */
1499 pcbSize->s.LowPart += sizeof(WORD); /* Lang code */
1500 pcbSize->s.LowPart += sizeof(BYTE); /* Flags */
1501 pcbSize->s.LowPart += sizeof(WORD); /* Weight */
1502 pcbSize->s.LowPart += sizeof(DWORD); /* Size */
1503 pcbSize->s.LowPart += sizeof(BYTE); /* StrLength */
1505 if (this->description.lpstrName!=0)
1506 pcbSize->s.LowPart += lstrlenW(this->description.lpstrName);
1508 return S_OK;
1511 /************************************************************************
1512 * OLEFontImpl_IConnectionPointContainer_QueryInterface (IUnknown)
1514 * See Windows documentation for more details on IUnknown methods.
1516 static HRESULT WINAPI OLEFontImpl_IConnectionPointContainer_QueryInterface(
1517 IConnectionPointContainer* iface,
1518 REFIID riid,
1519 VOID** ppvoid)
1521 _ICOM_THIS_From_IConnectionPointContainer(OLEFontImpl, iface);
1523 return IFont_QueryInterface((IFont*)this, riid, ppvoid);
1526 /************************************************************************
1527 * OLEFontImpl_IConnectionPointContainer_Release (IUnknown)
1529 * See Windows documentation for more details on IUnknown methods.
1531 static ULONG WINAPI OLEFontImpl_IConnectionPointContainer_Release(
1532 IConnectionPointContainer* iface)
1534 _ICOM_THIS_From_IConnectionPointContainer(OLEFontImpl, iface);
1536 return IFont_Release((IFont*)this);
1539 /************************************************************************
1540 * OLEFontImpl_IConnectionPointContainer_AddRef (IUnknown)
1542 * See Windows documentation for more details on IUnknown methods.
1544 static ULONG WINAPI OLEFontImpl_IConnectionPointContainer_AddRef(
1545 IConnectionPointContainer* iface)
1547 _ICOM_THIS_From_IConnectionPointContainer(OLEFontImpl, iface);
1549 return IFont_AddRef((IFont*)this);
1552 /************************************************************************
1553 * OLEFontImpl_EnumConnectionPoints (IConnectionPointContainer)
1555 * See Windows documentation for more details on IConnectionPointContainer
1556 * methods.
1558 static HRESULT WINAPI OLEFontImpl_EnumConnectionPoints(
1559 IConnectionPointContainer* iface,
1560 IEnumConnectionPoints **ppEnum)
1562 _ICOM_THIS_From_IConnectionPointContainer(OLEFontImpl, iface);
1564 FIXME("(%p)->(%p): stub\n", this, ppEnum);
1565 return E_NOTIMPL;
1568 /************************************************************************
1569 * OLEFontImpl_FindConnectionPoint (IConnectionPointContainer)
1571 * See Windows documentation for more details on IConnectionPointContainer
1572 * methods.
1574 static HRESULT WINAPI OLEFontImpl_FindConnectionPoint(
1575 IConnectionPointContainer* iface,
1576 REFIID riid,
1577 IConnectionPoint **ppCp)
1579 _ICOM_THIS_From_IConnectionPointContainer(OLEFontImpl, iface);
1580 TRACE("(%p)->(%s, %p): stub\n", this, debugstr_guid(riid), ppCp);
1582 if(memcmp(riid, &IID_IPropertyNotifySink, sizeof(IID_IPropertyNotifySink)) == 0) {
1583 return IConnectionPoint_QueryInterface(this->pCP, &IID_IConnectionPoint,
1584 (LPVOID)ppCp);
1585 } else {
1586 FIXME("Tried to find connection point on %s\n", debugstr_guid(riid));
1587 return E_NOINTERFACE;