1999-02-20 16:48:53 +00:00
|
|
|
/*
|
|
|
|
* OLE Font encapsulation implementation
|
|
|
|
*
|
|
|
|
* This file contains an implementation of the IFont
|
|
|
|
* interface and the OleCreateFontIndirect API call.
|
|
|
|
*
|
|
|
|
* Copyright 1999 Francis Beaudet
|
2006-07-20 01:06:14 +00:00
|
|
|
* Copyright 2006 (Google) Benjamin Arai
|
2002-03-09 23:29:33 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1999-02-20 16:48:53 +00:00
|
|
|
*/
|
|
|
|
#include <assert.h>
|
2003-09-05 23:08:26 +00:00
|
|
|
#include <stdarg.h>
|
1999-02-28 12:27:56 +00:00
|
|
|
#include <string.h>
|
2003-01-07 20:36:20 +00:00
|
|
|
|
2004-08-11 19:43:45 +00:00
|
|
|
#define COBJMACROS
|
2003-01-07 20:36:20 +00:00
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
2004-08-11 19:43:45 +00:00
|
|
|
|
1999-02-20 16:48:53 +00:00
|
|
|
#include "winerror.h"
|
2003-09-05 23:08:26 +00:00
|
|
|
#include "windef.h"
|
2000-09-26 00:00:55 +00:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
2000-11-30 01:31:28 +00:00
|
|
|
#include "winuser.h"
|
2007-02-19 21:45:12 +00:00
|
|
|
#include "wine/list.h"
|
2000-08-14 14:41:19 +00:00
|
|
|
#include "wine/unicode.h"
|
2002-12-05 20:33:07 +00:00
|
|
|
#include "objbase.h"
|
2004-08-22 21:38:46 +00:00
|
|
|
#include "oleauto.h" /* for SysAllocString(....) */
|
2000-11-30 01:31:28 +00:00
|
|
|
#include "ole2.h"
|
1999-02-20 16:48:53 +00:00
|
|
|
#include "olectl.h"
|
2002-03-09 23:29:33 +00:00
|
|
|
#include "wine/debug.h"
|
2000-07-28 20:17:21 +00:00
|
|
|
#include "connpt.h" /* for CreateConnectionPoint */
|
2006-02-10 13:50:26 +00:00
|
|
|
#include "oaidl.h"
|
1999-02-20 16:48:53 +00:00
|
|
|
|
2002-03-09 23:29:33 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
1999-04-19 14:56:29 +00:00
|
|
|
|
1999-02-20 16:48:53 +00:00
|
|
|
/***********************************************************************
|
1999-03-13 17:59:07 +00:00
|
|
|
* Declaration of constants used when serializing the font object.
|
|
|
|
*/
|
|
|
|
#define FONTPERSIST_ITALIC 0x02
|
|
|
|
#define FONTPERSIST_UNDERLINE 0x04
|
|
|
|
#define FONTPERSIST_STRIKETHROUGH 0x08
|
|
|
|
|
2010-02-02 10:20:50 +00:00
|
|
|
static HDC olefont_hdc;
|
2007-02-19 21:45:12 +00:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* List of the HFONTs it has given out, with each one having a separate
|
|
|
|
* ref count.
|
|
|
|
*/
|
|
|
|
typedef struct _HFONTItem
|
|
|
|
{
|
|
|
|
struct list entry;
|
|
|
|
|
2010-02-01 14:09:52 +00:00
|
|
|
/* Reference count of any IFont objects that own this hfont */
|
|
|
|
LONG int_refs;
|
|
|
|
|
|
|
|
/* Total reference count of any refs held by the application obtained by AddRefHfont plus any internal refs */
|
|
|
|
LONG total_refs;
|
2007-02-19 21:45:12 +00:00
|
|
|
|
2010-02-01 14:09:52 +00:00
|
|
|
/* The font associated with this object. */
|
2007-02-19 21:45:12 +00:00
|
|
|
HFONT gdiFont;
|
|
|
|
|
|
|
|
} HFONTItem, *PHFONTItem;
|
|
|
|
|
|
|
|
static struct list OLEFontImpl_hFontList = LIST_INIT(OLEFontImpl_hFontList);
|
|
|
|
|
|
|
|
/* Counts how many fonts contain at least one lock */
|
|
|
|
static LONG ifont_cnt = 0;
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* Critical section for OLEFontImpl_hFontList
|
|
|
|
*/
|
|
|
|
static CRITICAL_SECTION OLEFontImpl_csHFONTLIST;
|
|
|
|
static CRITICAL_SECTION_DEBUG OLEFontImpl_csHFONTLIST_debug =
|
|
|
|
{
|
|
|
|
0, 0, &OLEFontImpl_csHFONTLIST,
|
|
|
|
{ &OLEFontImpl_csHFONTLIST_debug.ProcessLocksList,
|
|
|
|
&OLEFontImpl_csHFONTLIST_debug.ProcessLocksList },
|
|
|
|
0, 0, { (DWORD_PTR)(__FILE__ ": OLEFontImpl_csHFONTLIST") }
|
|
|
|
};
|
|
|
|
static CRITICAL_SECTION OLEFontImpl_csHFONTLIST = { &OLEFontImpl_csHFONTLIST_debug, -1, 0, 0, 0, 0 };
|
|
|
|
|
2010-02-02 10:20:50 +00:00
|
|
|
static HDC get_dc(void)
|
|
|
|
{
|
|
|
|
HDC hdc;
|
|
|
|
EnterCriticalSection(&OLEFontImpl_csHFONTLIST);
|
|
|
|
if(!olefont_hdc)
|
|
|
|
olefont_hdc = CreateCompatibleDC(NULL);
|
|
|
|
hdc = olefont_hdc;
|
|
|
|
LeaveCriticalSection(&OLEFontImpl_csHFONTLIST);
|
|
|
|
return hdc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void delete_dc(void)
|
|
|
|
{
|
|
|
|
EnterCriticalSection(&OLEFontImpl_csHFONTLIST);
|
|
|
|
if(olefont_hdc)
|
|
|
|
{
|
|
|
|
DeleteDC(olefont_hdc);
|
|
|
|
olefont_hdc = NULL;
|
|
|
|
}
|
|
|
|
LeaveCriticalSection(&OLEFontImpl_csHFONTLIST);
|
|
|
|
}
|
|
|
|
|
2007-02-19 21:45:12 +00:00
|
|
|
static void HFONTItem_Delete(PHFONTItem item)
|
|
|
|
{
|
|
|
|
DeleteObject(item->gdiFont);
|
|
|
|
list_remove(&item->entry);
|
|
|
|
HeapFree(GetProcessHeap(), 0, item);
|
|
|
|
}
|
|
|
|
|
2010-02-01 14:09:52 +00:00
|
|
|
/* Find hfont item entry in the list. Should be called while holding the crit sect */
|
|
|
|
static HFONTItem *find_hfontitem(HFONT hfont)
|
|
|
|
{
|
|
|
|
HFONTItem *item;
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY(item, &OLEFontImpl_hFontList, HFONTItem, entry)
|
|
|
|
{
|
|
|
|
if (item->gdiFont == hfont)
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-02-02 10:15:39 +00:00
|
|
|
/* Add an item to the list with one internal reference */
|
|
|
|
static HRESULT add_hfontitem(HFONT hfont)
|
|
|
|
{
|
|
|
|
HFONTItem *new_item = HeapAlloc(GetProcessHeap(), 0, sizeof(*new_item));
|
|
|
|
|
|
|
|
if(!new_item) return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
new_item->int_refs = 1;
|
|
|
|
new_item->total_refs = 1;
|
|
|
|
new_item->gdiFont = hfont;
|
|
|
|
EnterCriticalSection(&OLEFontImpl_csHFONTLIST);
|
|
|
|
list_add_tail(&OLEFontImpl_hFontList,&new_item->entry);
|
|
|
|
LeaveCriticalSection(&OLEFontImpl_csHFONTLIST);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-02-01 14:09:52 +00:00
|
|
|
static HRESULT inc_int_ref(HFONT hfont)
|
|
|
|
{
|
|
|
|
HFONTItem *item;
|
|
|
|
HRESULT hr = S_FALSE;
|
|
|
|
|
|
|
|
EnterCriticalSection(&OLEFontImpl_csHFONTLIST);
|
|
|
|
item = find_hfontitem(hfont);
|
|
|
|
|
|
|
|
if(item)
|
|
|
|
{
|
|
|
|
item->int_refs++;
|
|
|
|
item->total_refs++;
|
|
|
|
hr = S_OK;
|
|
|
|
}
|
|
|
|
LeaveCriticalSection(&OLEFontImpl_csHFONTLIST);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* decrements the internal ref of a hfont item. If both refs are zero it'll
|
|
|
|
remove the item from the list and delete the hfont */
|
|
|
|
static HRESULT dec_int_ref(HFONT hfont)
|
|
|
|
{
|
|
|
|
HFONTItem *item;
|
|
|
|
HRESULT hr = S_FALSE;
|
|
|
|
|
|
|
|
EnterCriticalSection(&OLEFontImpl_csHFONTLIST);
|
|
|
|
item = find_hfontitem(hfont);
|
|
|
|
|
|
|
|
if(item)
|
|
|
|
{
|
|
|
|
item->int_refs--;
|
|
|
|
item->total_refs--;
|
|
|
|
if(item->int_refs == 0 && item->total_refs == 0)
|
|
|
|
HFONTItem_Delete(item);
|
|
|
|
hr = S_OK;
|
|
|
|
}
|
|
|
|
LeaveCriticalSection(&OLEFontImpl_csHFONTLIST);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT inc_ext_ref(HFONT hfont)
|
|
|
|
{
|
|
|
|
HFONTItem *item;
|
|
|
|
HRESULT hr = S_FALSE;
|
|
|
|
|
|
|
|
EnterCriticalSection(&OLEFontImpl_csHFONTLIST);
|
|
|
|
|
|
|
|
item = find_hfontitem(hfont);
|
|
|
|
if(item)
|
|
|
|
{
|
|
|
|
item->total_refs++;
|
|
|
|
hr = S_OK;
|
|
|
|
}
|
|
|
|
LeaveCriticalSection(&OLEFontImpl_csHFONTLIST);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT dec_ext_ref(HFONT hfont)
|
|
|
|
{
|
|
|
|
HFONTItem *item;
|
|
|
|
HRESULT hr = S_FALSE;
|
|
|
|
|
|
|
|
EnterCriticalSection(&OLEFontImpl_csHFONTLIST);
|
|
|
|
|
|
|
|
item = find_hfontitem(hfont);
|
|
|
|
if(item)
|
|
|
|
{
|
|
|
|
if(--item->total_refs >= 0) hr = S_OK;
|
|
|
|
}
|
|
|
|
LeaveCriticalSection(&OLEFontImpl_csHFONTLIST);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2010-02-02 10:20:50 +00:00
|
|
|
static WCHAR *strdupW(const WCHAR* str)
|
|
|
|
{
|
|
|
|
WCHAR *ret;
|
|
|
|
DWORD size = (strlenW(str) + 1) * sizeof(WCHAR);
|
|
|
|
|
|
|
|
ret = HeapAlloc(GetProcessHeap(), 0, size);
|
|
|
|
if(ret)
|
|
|
|
memcpy(ret, str, size);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
1999-03-13 17:59:07 +00:00
|
|
|
/***********************************************************************
|
|
|
|
* Declaration of the implementation class for the IFont interface
|
1999-02-20 16:48:53 +00:00
|
|
|
*/
|
|
|
|
typedef struct OLEFontImpl OLEFontImpl;
|
|
|
|
|
|
|
|
struct OLEFontImpl
|
|
|
|
{
|
|
|
|
/*
|
2002-05-31 23:06:46 +00:00
|
|
|
* This class supports many interfaces. IUnknown, IFont,
|
2000-07-28 20:17:21 +00:00
|
|
|
* IDispatch, IDispFont IPersistStream and IConnectionPointContainer.
|
|
|
|
* The first two are supported by the first vtable, the next two are
|
|
|
|
* supported by the second table and the last two have their own.
|
1999-02-20 16:48:53 +00:00
|
|
|
*/
|
2010-12-16 00:04:22 +00:00
|
|
|
IFont IFont_iface;
|
|
|
|
IDispatch IDispatch_iface;
|
|
|
|
IPersistStream IPersistStream_iface;
|
|
|
|
IConnectionPointContainer IConnectionPointContainer_iface;
|
|
|
|
IPersistPropertyBag IPersistPropertyBag_iface;
|
|
|
|
IPersistStreamInit IPersistStreamInit_iface;
|
1999-02-20 16:48:53 +00:00
|
|
|
/*
|
|
|
|
* Reference count for that instance of the class.
|
|
|
|
*/
|
2005-07-11 10:25:19 +00:00
|
|
|
LONG ref;
|
1999-02-20 16:48:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This structure contains the description of the class.
|
|
|
|
*/
|
|
|
|
FONTDESC description;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Contain the font associated with this object.
|
|
|
|
*/
|
|
|
|
HFONT gdiFont;
|
2010-02-02 10:15:39 +00:00
|
|
|
BOOL dirty;
|
1999-03-13 17:59:07 +00:00
|
|
|
/*
|
|
|
|
* Size ratio
|
|
|
|
*/
|
2009-07-03 11:48:54 +00:00
|
|
|
LONG cyLogical;
|
|
|
|
LONG cyHimetric;
|
2000-07-28 20:17:21 +00:00
|
|
|
|
2011-03-08 00:44:38 +00:00
|
|
|
/*
|
|
|
|
* Stash realized height (pixels) from TEXTMETRIC - used in get_Size()
|
|
|
|
*/
|
|
|
|
LONG nRealHeight;
|
|
|
|
|
2006-02-10 13:50:26 +00:00
|
|
|
IConnectionPoint *pPropertyNotifyCP;
|
|
|
|
IConnectionPoint *pFontEventsCP;
|
1999-02-20 16:48:53 +00:00
|
|
|
};
|
|
|
|
|
2010-12-16 00:04:22 +00:00
|
|
|
static inline OLEFontImpl *impl_from_IFont(IFont *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, OLEFontImpl, IFont_iface);
|
|
|
|
}
|
|
|
|
|
2005-07-27 15:14:18 +00:00
|
|
|
static inline OLEFontImpl *impl_from_IDispatch( IDispatch *iface )
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
return CONTAINING_RECORD(iface, OLEFontImpl, IDispatch_iface);
|
2005-07-27 15:14:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline OLEFontImpl *impl_from_IPersistStream( IPersistStream *iface )
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
return CONTAINING_RECORD(iface, OLEFontImpl, IPersistStream_iface);
|
2005-07-27 15:14:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline OLEFontImpl *impl_from_IConnectionPointContainer( IConnectionPointContainer *iface )
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
return CONTAINING_RECORD(iface, OLEFontImpl, IConnectionPointContainer_iface);
|
2005-07-27 15:14:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline OLEFontImpl *impl_from_IPersistPropertyBag( IPersistPropertyBag *iface )
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
return CONTAINING_RECORD(iface, OLEFontImpl, IPersistPropertyBag_iface);
|
2005-07-27 15:14:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline OLEFontImpl *impl_from_IPersistStreamInit( IPersistStreamInit *iface )
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
return CONTAINING_RECORD(iface, OLEFontImpl, IPersistStreamInit_iface);
|
2005-07-27 15:14:18 +00:00
|
|
|
}
|
2000-07-28 20:17:21 +00:00
|
|
|
|
1999-02-20 16:48:53 +00:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* Prototypes for the implementation functions for the IFont
|
|
|
|
* interface
|
|
|
|
*/
|
2007-07-02 20:14:59 +00:00
|
|
|
static OLEFontImpl* OLEFontImpl_Construct(const FONTDESC *fontDesc);
|
1999-02-20 16:48:53 +00:00
|
|
|
static void OLEFontImpl_Destroy(OLEFontImpl* fontDesc);
|
1999-02-21 18:16:08 +00:00
|
|
|
static ULONG WINAPI OLEFontImpl_AddRef(IFont* iface);
|
2005-06-06 19:50:35 +00:00
|
|
|
|
1999-02-20 16:48:53 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* OleCreateFontIndirect [OLEAUT32.420]
|
|
|
|
*/
|
2000-02-07 16:27:33 +00:00
|
|
|
HRESULT WINAPI OleCreateFontIndirect(
|
1999-02-20 16:48:53 +00:00
|
|
|
LPFONTDESC lpFontDesc,
|
|
|
|
REFIID riid,
|
2000-02-07 16:27:33 +00:00
|
|
|
LPVOID* ppvObj)
|
1999-02-20 16:48:53 +00:00
|
|
|
{
|
2011-08-21 08:16:28 +00:00
|
|
|
OLEFontImpl* newFont;
|
|
|
|
HRESULT hr;
|
2011-03-04 09:43:42 +00:00
|
|
|
FONTDESC fd;
|
1999-02-20 16:48:53 +00:00
|
|
|
|
2000-07-28 20:17:21 +00:00
|
|
|
TRACE("(%p, %s, %p)\n", lpFontDesc, debugstr_guid(riid), ppvObj);
|
2011-08-21 08:16:28 +00:00
|
|
|
|
|
|
|
if (!ppvObj) return E_POINTER;
|
1999-02-20 16:48:53 +00:00
|
|
|
|
|
|
|
*ppvObj = 0;
|
|
|
|
|
2003-06-24 19:21:20 +00:00
|
|
|
if (!lpFontDesc) {
|
2006-09-21 20:25:39 +00:00
|
|
|
static WCHAR fname[] = { 'S','y','s','t','e','m',0 };
|
2003-06-24 19:21:20 +00:00
|
|
|
|
|
|
|
fd.cbSizeofstruct = sizeof(fd);
|
2006-09-21 20:25:39 +00:00
|
|
|
fd.lpstrName = fname;
|
2003-06-24 19:21:20 +00:00
|
|
|
fd.cySize.s.Lo = 80000;
|
|
|
|
fd.cySize.s.Hi = 0;
|
|
|
|
fd.sWeight = 0;
|
|
|
|
fd.sCharset = 0;
|
|
|
|
fd.fItalic = 0;
|
|
|
|
fd.fUnderline = 0;
|
|
|
|
fd.fStrikethrough = 0;
|
|
|
|
lpFontDesc = &fd;
|
|
|
|
}
|
2002-01-15 20:23:57 +00:00
|
|
|
|
1999-02-20 16:48:53 +00:00
|
|
|
newFont = OLEFontImpl_Construct(lpFontDesc);
|
2011-08-21 08:16:28 +00:00
|
|
|
if (!newFont) return E_OUTOFMEMORY;
|
1999-02-20 16:48:53 +00:00
|
|
|
|
2010-12-16 00:04:22 +00:00
|
|
|
hr = IFont_QueryInterface(&newFont->IFont_iface, riid, ppvObj);
|
|
|
|
IFont_Release(&newFont->IFont_iface);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* Implementation of the OLEFontImpl class.
|
|
|
|
*/
|
|
|
|
|
2000-07-28 20:17:21 +00:00
|
|
|
/***********************************************************************
|
|
|
|
* OLEFont_SendNotify (internal)
|
|
|
|
*
|
|
|
|
* Sends notification messages of changed properties to any interested
|
|
|
|
* connections.
|
|
|
|
*/
|
|
|
|
static void OLEFont_SendNotify(OLEFontImpl* this, DISPID dispID)
|
|
|
|
{
|
2006-02-10 13:50:26 +00:00
|
|
|
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
|
|
|
|
};
|
|
|
|
|
2000-07-28 20:17:21 +00:00
|
|
|
IEnumConnections *pEnum;
|
|
|
|
CONNECTDATA CD;
|
2003-01-23 01:23:59 +00:00
|
|
|
HRESULT hres;
|
2000-07-28 20:17:21 +00:00
|
|
|
|
2010-02-02 10:15:39 +00:00
|
|
|
this->dirty = TRUE;
|
|
|
|
|
2006-02-10 13:50:26 +00:00
|
|
|
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]);
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2006-02-10 13:50:26 +00:00
|
|
|
dispparams.cArgs = 1;
|
|
|
|
dispparams.cNamedArgs = 0;
|
|
|
|
dispparams.rgdispidNamedArgs = NULL;
|
|
|
|
dispparams.rgvarg = &vararg;
|
2000-07-28 20:17:21 +00:00
|
|
|
|
2006-02-10 13:50:26 +00:00
|
|
|
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);
|
2000-07-28 20:17:21 +00:00
|
|
|
}
|
|
|
|
}
|
2002-05-31 23:06:46 +00:00
|
|
|
|
1999-02-20 16:48:53 +00:00
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_QueryInterface (IUnknown)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IUnknown methods.
|
|
|
|
*/
|
2008-12-02 14:24:59 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_QueryInterface(
|
1999-02-20 16:48:53 +00:00
|
|
|
IFont* iface,
|
|
|
|
REFIID riid,
|
|
|
|
void** ppvObject)
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2011-08-21 08:16:28 +00:00
|
|
|
|
2000-07-28 20:17:21 +00:00
|
|
|
TRACE("(%p)->(%s, %p)\n", this, debugstr_guid(riid), ppvObject);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
|
|
|
*ppvObject = 0;
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2011-08-21 08:27:53 +00:00
|
|
|
if (IsEqualGUID(&IID_IUnknown, riid) ||
|
|
|
|
IsEqualGUID(&IID_IFont, riid))
|
|
|
|
{
|
2009-02-09 08:45:52 +00:00
|
|
|
*ppvObject = this;
|
2011-08-21 08:27:53 +00:00
|
|
|
}
|
|
|
|
else if (IsEqualGUID(&IID_IDispatch, riid) ||
|
|
|
|
IsEqualGUID(&IID_IFontDisp, riid))
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
*ppvObject = &this->IDispatch_iface;
|
2011-08-21 08:27:53 +00:00
|
|
|
}
|
|
|
|
else if (IsEqualGUID(&IID_IPersist, riid) ||
|
|
|
|
IsEqualGUID(&IID_IPersistStream, riid))
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
*ppvObject = &this->IPersistStream_iface;
|
2011-08-21 08:27:53 +00:00
|
|
|
}
|
|
|
|
else if (IsEqualGUID(&IID_IConnectionPointContainer, riid))
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
*ppvObject = &this->IConnectionPointContainer_iface;
|
2011-08-21 08:27:53 +00:00
|
|
|
}
|
|
|
|
else if (IsEqualGUID(&IID_IPersistPropertyBag, riid))
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
*ppvObject = &this->IPersistPropertyBag_iface;
|
2011-08-21 08:27:53 +00:00
|
|
|
}
|
|
|
|
else if (IsEqualGUID(&IID_IPersistStreamInit, riid))
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
*ppvObject = &this->IPersistStreamInit_iface;
|
2011-08-21 08:27:53 +00:00
|
|
|
}
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2011-08-21 08:27:53 +00:00
|
|
|
if (!*ppvObject)
|
1999-03-13 17:59:07 +00:00
|
|
|
{
|
2011-08-21 08:27:53 +00:00
|
|
|
FIXME("() : asking for unsupported interface %s\n", debugstr_guid(riid));
|
1999-02-20 16:48:53 +00:00
|
|
|
return E_NOINTERFACE;
|
1999-03-13 17:59:07 +00:00
|
|
|
}
|
2011-08-21 08:27:53 +00:00
|
|
|
|
|
|
|
IFont_AddRef(iface);
|
|
|
|
|
2002-05-31 23:06:46 +00:00
|
|
|
return S_OK;
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
2002-05-31 23:06:46 +00:00
|
|
|
|
1999-02-20 16:48:53 +00:00
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_AddRef (IUnknown)
|
|
|
|
*/
|
2008-12-02 14:24:59 +00:00
|
|
|
static ULONG WINAPI OLEFontImpl_AddRef(
|
1999-02-20 16:48:53 +00:00
|
|
|
IFont* iface)
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2006-10-12 18:57:10 +00:00
|
|
|
TRACE("(%p)->(ref=%d)\n", this, this->ref);
|
2004-09-21 00:25:03 +00:00
|
|
|
return InterlockedIncrement(&this->ref);
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
2002-05-31 23:06:46 +00:00
|
|
|
|
1999-02-20 16:48:53 +00:00
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_Release (IUnknown)
|
|
|
|
*/
|
2011-08-21 08:16:28 +00:00
|
|
|
static ULONG WINAPI OLEFontImpl_Release(IFont* iface)
|
1999-02-20 16:48:53 +00:00
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2011-08-21 08:16:28 +00:00
|
|
|
ULONG ref;
|
|
|
|
|
2006-10-12 18:57:10 +00:00
|
|
|
TRACE("(%p)->(ref=%d)\n", this, this->ref);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
2011-08-21 08:16:28 +00:00
|
|
|
ref = InterlockedDecrement(&this->ref);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
2011-08-21 08:16:28 +00:00
|
|
|
if (ref == 0)
|
2007-02-19 21:45:12 +00:00
|
|
|
{
|
|
|
|
ULONG fontlist_refs = InterlockedDecrement(&ifont_cnt);
|
2010-02-01 14:09:52 +00:00
|
|
|
|
|
|
|
/* Final IFont object so destroy font cache */
|
2007-02-19 21:45:12 +00:00
|
|
|
if (fontlist_refs == 0)
|
|
|
|
{
|
2010-02-01 14:09:52 +00:00
|
|
|
HFONTItem *item, *cursor2;
|
|
|
|
|
2007-02-19 21:45:12 +00:00
|
|
|
EnterCriticalSection(&OLEFontImpl_csHFONTLIST);
|
2010-02-01 14:09:52 +00:00
|
|
|
LIST_FOR_EACH_ENTRY_SAFE(item, cursor2, &OLEFontImpl_hFontList, HFONTItem, entry)
|
|
|
|
HFONTItem_Delete(item);
|
2007-02-19 21:45:12 +00:00
|
|
|
LeaveCriticalSection(&OLEFontImpl_csHFONTLIST);
|
2010-02-02 10:20:50 +00:00
|
|
|
delete_dc();
|
2007-02-19 21:45:12 +00:00
|
|
|
}
|
2010-02-01 14:09:52 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
dec_int_ref(this->gdiFont);
|
|
|
|
}
|
2007-02-19 21:45:12 +00:00
|
|
|
OLEFontImpl_Destroy(this);
|
|
|
|
}
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2011-08-21 08:16:28 +00:00
|
|
|
return ref;
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2010-02-02 10:20:50 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
short orig_cs;
|
|
|
|
short avail_cs;
|
|
|
|
} enum_data;
|
|
|
|
|
|
|
|
static int CALLBACK font_enum_proc(const LOGFONTW *elf, const TEXTMETRICW *ntm, DWORD type, LPARAM lp)
|
|
|
|
{
|
|
|
|
enum_data *data = (enum_data*)lp;
|
|
|
|
|
|
|
|
if(elf->lfCharSet == data->orig_cs)
|
|
|
|
{
|
|
|
|
data->avail_cs = data->orig_cs;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if(data->avail_cs == -1) data->avail_cs = elf->lfCharSet;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-02-02 10:15:39 +00:00
|
|
|
static void realize_font(OLEFontImpl *This)
|
|
|
|
{
|
2011-08-21 09:40:32 +00:00
|
|
|
LOGFONTW logFont;
|
|
|
|
INT fontHeight;
|
|
|
|
WCHAR text_face[LF_FACESIZE];
|
|
|
|
HDC hdc = get_dc();
|
|
|
|
HFONT old_font;
|
|
|
|
TEXTMETRICW tm;
|
|
|
|
|
|
|
|
if (!This->dirty) return;
|
|
|
|
|
|
|
|
text_face[0] = 0;
|
|
|
|
|
|
|
|
if(This->gdiFont)
|
2010-02-02 10:15:39 +00:00
|
|
|
{
|
2011-08-21 09:40:32 +00:00
|
|
|
old_font = SelectObject(hdc, This->gdiFont);
|
2010-02-02 10:20:50 +00:00
|
|
|
GetTextFaceW(hdc, sizeof(text_face) / sizeof(text_face[0]), text_face);
|
|
|
|
SelectObject(hdc, old_font);
|
2011-08-21 09:40:32 +00:00
|
|
|
dec_int_ref(This->gdiFont);
|
|
|
|
This->gdiFont = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(&logFont, 0, sizeof(LOGFONTW));
|
|
|
|
|
|
|
|
lstrcpynW(logFont.lfFaceName, This->description.lpstrName, LF_FACESIZE);
|
|
|
|
logFont.lfCharSet = This->description.sCharset;
|
|
|
|
|
|
|
|
/* If the font name has been changed then enumerate all charsets
|
|
|
|
and pick one that'll result in the font specified being selected */
|
|
|
|
if(text_face[0] && lstrcmpiW(text_face, This->description.lpstrName))
|
|
|
|
{
|
|
|
|
enum_data data;
|
|
|
|
data.orig_cs = This->description.sCharset;
|
|
|
|
data.avail_cs = -1;
|
|
|
|
logFont.lfCharSet = DEFAULT_CHARSET;
|
|
|
|
EnumFontFamiliesExW(get_dc(), &logFont, font_enum_proc, (LPARAM)&data, 0);
|
|
|
|
if(data.avail_cs != -1) logFont.lfCharSet = data.avail_cs;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The height of the font returned by the get_Size property is the
|
|
|
|
* height of the font in points multiplied by 10000... Using some
|
|
|
|
* simple conversions and the ratio given by the application, it can
|
|
|
|
* be converted to a height in pixels.
|
|
|
|
*
|
|
|
|
* Standard ratio is 72 / 2540, or 18 / 635 in lowest terms.
|
|
|
|
* Ratio is applied here relative to the standard.
|
|
|
|
*/
|
|
|
|
|
|
|
|
fontHeight = MulDiv( This->description.cySize.s.Lo, This->cyLogical*635, This->cyHimetric*18 );
|
|
|
|
|
|
|
|
logFont.lfHeight = ((fontHeight%10000L)>5000L) ? (-fontHeight/10000L) - 1 :
|
|
|
|
(-fontHeight/10000L);
|
|
|
|
logFont.lfItalic = This->description.fItalic;
|
|
|
|
logFont.lfUnderline = This->description.fUnderline;
|
|
|
|
logFont.lfStrikeOut = This->description.fStrikethrough;
|
|
|
|
logFont.lfWeight = This->description.sWeight;
|
|
|
|
logFont.lfOutPrecision = OUT_CHARACTER_PRECIS;
|
|
|
|
logFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
|
|
|
logFont.lfQuality = DEFAULT_QUALITY;
|
|
|
|
logFont.lfPitchAndFamily = DEFAULT_PITCH;
|
|
|
|
|
|
|
|
This->gdiFont = CreateFontIndirectW(&logFont);
|
|
|
|
This->dirty = FALSE;
|
|
|
|
|
|
|
|
add_hfontitem(This->gdiFont);
|
|
|
|
|
|
|
|
/* Fixup the name and charset properties so that they match the
|
|
|
|
selected font */
|
|
|
|
old_font = SelectObject(get_dc(), This->gdiFont);
|
|
|
|
GetTextFaceW(hdc, sizeof(text_face) / sizeof(text_face[0]), text_face);
|
|
|
|
if(lstrcmpiW(text_face, This->description.lpstrName))
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, This->description.lpstrName);
|
|
|
|
This->description.lpstrName = strdupW(text_face);
|
2010-02-02 10:15:39 +00:00
|
|
|
}
|
2011-08-21 09:40:32 +00:00
|
|
|
GetTextMetricsW(hdc, &tm);
|
|
|
|
This->description.sCharset = tm.tmCharSet;
|
|
|
|
/* While we have it handy, stash the realized font height for use by get_Size() */
|
|
|
|
This->nRealHeight = tm.tmHeight - tm.tmInternalLeading; /* corresponds to LOGFONT lfHeight */
|
|
|
|
SelectObject(hdc, old_font);
|
2010-02-02 10:15:39 +00:00
|
|
|
}
|
|
|
|
|
1999-02-20 16:48:53 +00:00
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_get_Name (IFont)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IFont methods.
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_get_Name(
|
2002-05-31 23:06:46 +00:00
|
|
|
IFont* iface,
|
1999-02-26 11:11:13 +00:00
|
|
|
BSTR* pname)
|
1999-02-20 16:48:53 +00:00
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
TRACE("(%p)->(%p)\n", this, pname);
|
2011-08-21 08:16:28 +00:00
|
|
|
|
1999-02-20 16:48:53 +00:00
|
|
|
if (pname==0)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2011-08-21 09:40:32 +00:00
|
|
|
realize_font(this);
|
2010-02-02 10:15:39 +00:00
|
|
|
|
1999-02-20 16:48:53 +00:00
|
|
|
if (this->description.lpstrName!=0)
|
1999-02-26 11:11:13 +00:00
|
|
|
*pname = SysAllocString(this->description.lpstrName);
|
1999-02-20 16:48:53 +00:00
|
|
|
else
|
|
|
|
*pname = 0;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_put_Name (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_put_Name(
|
2002-05-31 23:06:46 +00:00
|
|
|
IFont* iface,
|
1999-02-26 11:11:13 +00:00
|
|
|
BSTR name)
|
1999-02-20 16:48:53 +00:00
|
|
|
{
|
2011-08-21 14:13:47 +00:00
|
|
|
OLEFontImpl *This = impl_from_IFont(iface);
|
|
|
|
TRACE("(%p)->(%p)\n", This, name);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
2010-01-24 19:14:48 +00:00
|
|
|
if (!name)
|
|
|
|
return CTL_E_INVALIDPROPERTYVALUE;
|
|
|
|
|
2011-08-21 14:13:47 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, This->description.lpstrName);
|
|
|
|
This->description.lpstrName = strdupW(name);
|
|
|
|
if (!This->description.lpstrName) return E_OUTOFMEMORY;
|
1999-02-20 16:48:53 +00:00
|
|
|
|
2011-08-21 14:13:47 +00:00
|
|
|
TRACE("new name %s\n", debugstr_w(This->description.lpstrName));
|
|
|
|
OLEFont_SendNotify(This, DISPID_FONT_NAME);
|
1999-02-20 16:48:53 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_get_Size (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_get_Size(
|
2002-05-31 23:06:46 +00:00
|
|
|
IFont* iface,
|
1999-02-20 16:48:53 +00:00
|
|
|
CY* psize)
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
TRACE("(%p)->(%p)\n", this, psize);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
2011-08-21 08:16:28 +00:00
|
|
|
if (!psize) return E_POINTER;
|
1999-02-20 16:48:53 +00:00
|
|
|
|
2011-08-21 09:40:32 +00:00
|
|
|
realize_font(this);
|
2010-02-02 10:15:39 +00:00
|
|
|
|
2011-03-08 00:44:38 +00:00
|
|
|
/*
|
|
|
|
* Convert realized font height in pixels to points descaled by current
|
|
|
|
* scaling ratio then scaled up by 10000.
|
|
|
|
*/
|
|
|
|
psize->s.Lo = MulDiv(this->nRealHeight,
|
|
|
|
this->cyHimetric * 72 * 10000,
|
|
|
|
this->cyLogical * 2540);
|
1999-09-19 14:20:33 +00:00
|
|
|
psize->s.Hi = 0;
|
1999-02-20 16:48:53 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_put_Size (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_put_Size(
|
2002-05-31 23:06:46 +00:00
|
|
|
IFont* iface,
|
1999-02-20 16:48:53 +00:00
|
|
|
CY size)
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2006-10-12 18:57:10 +00:00
|
|
|
TRACE("(%p)->(%d)\n", this, size.s.Lo);
|
1999-09-19 14:20:33 +00:00
|
|
|
this->description.cySize.s.Hi = 0;
|
2000-07-28 20:17:21 +00:00
|
|
|
this->description.cySize.s.Lo = size.s.Lo;
|
|
|
|
OLEFont_SendNotify(this, DISPID_FONT_SIZE);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_get_Bold (IFont)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IFont methods.
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_get_Bold(
|
2002-05-31 23:06:46 +00:00
|
|
|
IFont* iface,
|
1999-02-26 11:11:13 +00:00
|
|
|
BOOL* pbold)
|
1999-02-20 16:48:53 +00:00
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
TRACE("(%p)->(%p)\n", this, pbold);
|
2011-08-21 08:16:28 +00:00
|
|
|
|
|
|
|
if (!pbold) return E_POINTER;
|
2000-07-28 20:17:21 +00:00
|
|
|
|
2011-08-21 09:40:32 +00:00
|
|
|
realize_font(this);
|
2010-02-02 10:15:39 +00:00
|
|
|
|
2000-07-28 20:17:21 +00:00
|
|
|
*pbold = this->description.sWeight > 550;
|
|
|
|
|
|
|
|
return S_OK;
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_put_Bold (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_put_Bold(
|
1999-02-20 16:48:53 +00:00
|
|
|
IFont* iface,
|
1999-02-26 11:11:13 +00:00
|
|
|
BOOL bold)
|
1999-02-20 16:48:53 +00:00
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
TRACE("(%p)->(%d)\n", this, bold);
|
|
|
|
this->description.sWeight = bold ? FW_BOLD : FW_NORMAL;
|
|
|
|
OLEFont_SendNotify(this, DISPID_FONT_BOLD);
|
|
|
|
|
|
|
|
return S_OK;
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_get_Italic (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_get_Italic(
|
2002-05-31 23:06:46 +00:00
|
|
|
IFont* iface,
|
1999-02-26 11:11:13 +00:00
|
|
|
BOOL* pitalic)
|
1999-02-20 16:48:53 +00:00
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
TRACE("(%p)->(%p)\n", this, pitalic);
|
2011-08-21 08:16:28 +00:00
|
|
|
|
1999-02-20 16:48:53 +00:00
|
|
|
if (pitalic==0)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2011-08-21 09:40:32 +00:00
|
|
|
realize_font(this);
|
2010-02-02 10:15:39 +00:00
|
|
|
|
1999-02-20 16:48:53 +00:00
|
|
|
*pitalic = this->description.fItalic;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_put_Italic (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_put_Italic(
|
2002-05-31 23:06:46 +00:00
|
|
|
IFont* iface,
|
1999-02-26 11:11:13 +00:00
|
|
|
BOOL italic)
|
1999-02-20 16:48:53 +00:00
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
TRACE("(%p)->(%d)\n", this, italic);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
|
|
|
this->description.fItalic = italic;
|
|
|
|
|
2000-07-28 20:17:21 +00:00
|
|
|
OLEFont_SendNotify(this, DISPID_FONT_ITALIC);
|
1999-02-20 16:48:53 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_get_Underline (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_get_Underline(
|
2002-05-31 23:06:46 +00:00
|
|
|
IFont* iface,
|
1999-02-26 11:11:13 +00:00
|
|
|
BOOL* punderline)
|
1999-02-20 16:48:53 +00:00
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
TRACE("(%p)->(%p)\n", this, punderline);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
|
|
|
if (punderline==0)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2011-08-21 09:40:32 +00:00
|
|
|
realize_font(this);
|
2010-02-02 10:15:39 +00:00
|
|
|
|
1999-02-20 16:48:53 +00:00
|
|
|
*punderline = this->description.fUnderline;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_put_Underline (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_put_Underline(
|
1999-02-20 16:48:53 +00:00
|
|
|
IFont* iface,
|
1999-02-26 11:11:13 +00:00
|
|
|
BOOL underline)
|
1999-02-20 16:48:53 +00:00
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
TRACE("(%p)->(%d)\n", this, underline);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
|
|
|
this->description.fUnderline = underline;
|
|
|
|
|
2000-07-28 20:17:21 +00:00
|
|
|
OLEFont_SendNotify(this, DISPID_FONT_UNDER);
|
1999-02-20 16:48:53 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_get_Strikethrough (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_get_Strikethrough(
|
2002-05-31 23:06:46 +00:00
|
|
|
IFont* iface,
|
1999-02-26 11:11:13 +00:00
|
|
|
BOOL* pstrikethrough)
|
1999-02-20 16:48:53 +00:00
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
TRACE("(%p)->(%p)\n", this, pstrikethrough);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
|
|
|
if (pstrikethrough==0)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2011-08-21 09:40:32 +00:00
|
|
|
realize_font(this);
|
2010-02-02 10:15:39 +00:00
|
|
|
|
1999-03-14 13:47:00 +00:00
|
|
|
*pstrikethrough = this->description.fStrikethrough;
|
1999-02-20 16:48:53 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_put_Strikethrough (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_put_Strikethrough(
|
2002-05-31 23:06:46 +00:00
|
|
|
IFont* iface,
|
1999-02-26 11:11:13 +00:00
|
|
|
BOOL strikethrough)
|
1999-02-20 16:48:53 +00:00
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
TRACE("(%p)->(%d)\n", this, strikethrough);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
1999-03-14 13:47:00 +00:00
|
|
|
this->description.fStrikethrough = strikethrough;
|
2000-07-28 20:17:21 +00:00
|
|
|
OLEFont_SendNotify(this, DISPID_FONT_STRIKE);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_get_Weight (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_get_Weight(
|
2002-05-31 23:06:46 +00:00
|
|
|
IFont* iface,
|
1999-02-20 16:48:53 +00:00
|
|
|
short* pweight)
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
TRACE("(%p)->(%p)\n", this, pweight);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
|
|
|
if (pweight==0)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2011-08-21 09:40:32 +00:00
|
|
|
realize_font(this);
|
2010-02-02 10:15:39 +00:00
|
|
|
|
1999-02-20 16:48:53 +00:00
|
|
|
*pweight = this->description.sWeight;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_put_Weight (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_put_Weight(
|
2002-05-31 23:06:46 +00:00
|
|
|
IFont* iface,
|
1999-02-20 16:48:53 +00:00
|
|
|
short weight)
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
TRACE("(%p)->(%d)\n", this, weight);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
|
|
|
this->description.sWeight = weight;
|
|
|
|
|
2000-07-28 20:17:21 +00:00
|
|
|
OLEFont_SendNotify(this, DISPID_FONT_WEIGHT);
|
1999-02-20 16:48:53 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_get_Charset (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_get_Charset(
|
2002-05-31 23:06:46 +00:00
|
|
|
IFont* iface,
|
1999-02-20 16:48:53 +00:00
|
|
|
short* pcharset)
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
TRACE("(%p)->(%p)\n", this, pcharset);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
|
|
|
if (pcharset==0)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2011-08-21 09:40:32 +00:00
|
|
|
realize_font(this);
|
2010-02-02 10:15:39 +00:00
|
|
|
|
1999-02-20 16:48:53 +00:00
|
|
|
*pcharset = this->description.sCharset;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_put_Charset (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_put_Charset(
|
2002-05-31 23:06:46 +00:00
|
|
|
IFont* iface,
|
1999-02-20 16:48:53 +00:00
|
|
|
short charset)
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
TRACE("(%p)->(%d)\n", this, charset);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
|
|
|
this->description.sCharset = charset;
|
2000-07-28 20:17:21 +00:00
|
|
|
OLEFont_SendNotify(this, DISPID_FONT_CHARSET);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_get_hFont (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_get_hFont(
|
1999-02-20 16:48:53 +00:00
|
|
|
IFont* iface,
|
1999-02-26 11:11:13 +00:00
|
|
|
HFONT* phfont)
|
1999-02-20 16:48:53 +00:00
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
TRACE("(%p)->(%p)\n", this, phfont);
|
1999-03-13 17:59:07 +00:00
|
|
|
if (phfont==NULL)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2011-08-21 09:40:32 +00:00
|
|
|
realize_font(this);
|
1999-03-13 17:59:07 +00:00
|
|
|
|
|
|
|
*phfont = this->gdiFont;
|
2002-10-25 03:12:50 +00:00
|
|
|
TRACE("Returning %p\n", *phfont);
|
1999-03-13 17:59:07 +00:00
|
|
|
return S_OK;
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_Clone (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_Clone(
|
1999-02-20 16:48:53 +00:00
|
|
|
IFont* iface,
|
|
|
|
IFont** ppfont)
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2011-08-21 08:16:28 +00:00
|
|
|
OLEFontImpl* newObject;
|
2010-02-01 14:09:52 +00:00
|
|
|
|
2000-07-28 20:17:21 +00:00
|
|
|
TRACE("(%p)->(%p)\n", this, ppfont);
|
1999-03-13 17:59:07 +00:00
|
|
|
|
|
|
|
if (ppfont == NULL)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
*ppfont = NULL;
|
|
|
|
|
|
|
|
newObject = HeapAlloc(GetProcessHeap(), 0, sizeof(OLEFontImpl));
|
|
|
|
if (newObject==NULL)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
*newObject = *this;
|
2011-08-21 14:13:47 +00:00
|
|
|
/* allocate separate buffer */
|
|
|
|
newObject->description.lpstrName = strdupW(this->description.lpstrName);
|
2001-08-20 17:59:10 +00:00
|
|
|
|
2010-02-01 14:09:52 +00:00
|
|
|
/* Increment internal ref in hfont item list */
|
|
|
|
if(newObject->gdiFont) inc_int_ref(newObject->gdiFont);
|
2001-08-20 17:59:10 +00:00
|
|
|
|
2007-02-19 21:45:12 +00:00
|
|
|
InterlockedIncrement(&ifont_cnt);
|
|
|
|
|
2006-02-23 19:01:02 +00:00
|
|
|
newObject->pPropertyNotifyCP = NULL;
|
|
|
|
newObject->pFontEventsCP = NULL;
|
|
|
|
CreateConnectionPoint((IUnknown*)newObject, &IID_IPropertyNotifySink, &newObject->pPropertyNotifyCP);
|
|
|
|
CreateConnectionPoint((IUnknown*)newObject, &IID_IFontEventsDisp, &newObject->pFontEventsCP);
|
|
|
|
|
|
|
|
if (!newObject->pPropertyNotifyCP || !newObject->pFontEventsCP)
|
|
|
|
{
|
|
|
|
OLEFontImpl_Destroy(newObject);
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
2001-08-20 17:59:10 +00:00
|
|
|
|
|
|
|
/* The cloned object starts with a reference count of 1 */
|
2011-08-21 08:16:28 +00:00
|
|
|
newObject->ref = 1;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2010-12-16 00:04:22 +00:00
|
|
|
*ppfont = &newObject->IFont_iface;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
|
|
|
return S_OK;
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_IsEqual (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_IsEqual(
|
2002-05-31 23:06:46 +00:00
|
|
|
IFont* iface,
|
1999-02-20 16:48:53 +00:00
|
|
|
IFont* pFontOther)
|
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *left = impl_from_IFont(iface);
|
|
|
|
OLEFontImpl *right = impl_from_IFont(pFontOther);
|
2008-02-27 16:48:00 +00:00
|
|
|
INT ret;
|
2006-08-02 23:47:48 +00:00
|
|
|
INT left_len,right_len;
|
|
|
|
|
2010-10-23 19:23:07 +00:00
|
|
|
if(pFontOther == NULL)
|
2006-08-02 23:47:48 +00:00
|
|
|
return E_POINTER;
|
|
|
|
else if (left->description.cySize.s.Lo != right->description.cySize.s.Lo)
|
|
|
|
return S_FALSE;
|
|
|
|
else if (left->description.cySize.s.Hi != right->description.cySize.s.Hi)
|
|
|
|
return S_FALSE;
|
|
|
|
else if (left->description.sWeight != right->description.sWeight)
|
|
|
|
return S_FALSE;
|
|
|
|
else if (left->description.sCharset != right->description.sCharset)
|
|
|
|
return S_FALSE;
|
|
|
|
else if (left->description.fItalic != right->description.fItalic)
|
|
|
|
return S_FALSE;
|
|
|
|
else if (left->description.fUnderline != right->description.fUnderline)
|
|
|
|
return S_FALSE;
|
|
|
|
else if (left->description.fStrikethrough != right->description.fStrikethrough)
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
/* Check from string */
|
|
|
|
left_len = strlenW(left->description.lpstrName);
|
|
|
|
right_len = strlenW(right->description.lpstrName);
|
2008-02-27 16:48:00 +00:00
|
|
|
ret = CompareStringW(0,0,left->description.lpstrName, left_len,
|
2006-08-02 23:47:48 +00:00
|
|
|
right->description.lpstrName, right_len);
|
2008-02-27 16:48:00 +00:00
|
|
|
if (ret != CSTR_EQUAL)
|
2006-08-02 23:47:48 +00:00
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
return S_OK;
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_SetRatio (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_SetRatio(
|
1999-02-20 16:48:53 +00:00
|
|
|
IFont* iface,
|
2004-10-18 22:39:21 +00:00
|
|
|
LONG cyLogical,
|
|
|
|
LONG cyHimetric)
|
1999-02-20 16:48:53 +00:00
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2006-10-12 18:57:10 +00:00
|
|
|
TRACE("(%p)->(%d, %d)\n", this, cyLogical, cyHimetric);
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-03-08 00:44:38 +00:00
|
|
|
if(cyLogical == 0 || cyHimetric == 0)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
1999-03-13 17:59:07 +00:00
|
|
|
this->cyLogical = cyLogical;
|
|
|
|
this->cyHimetric = cyHimetric;
|
2011-03-08 00:44:38 +00:00
|
|
|
this->dirty = TRUE;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
|
|
|
return S_OK;
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_QueryTextMetrics (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_QueryTextMetrics(
|
2002-05-31 23:06:46 +00:00
|
|
|
IFont* iface,
|
1999-02-20 16:48:53 +00:00
|
|
|
TEXTMETRICOLE* ptm)
|
|
|
|
{
|
2005-02-18 12:51:23 +00:00
|
|
|
HDC hdcRef;
|
|
|
|
HFONT hOldFont, hNewFont;
|
|
|
|
|
|
|
|
hdcRef = GetDC(0);
|
2011-08-21 08:27:53 +00:00
|
|
|
IFont_get_hFont(iface, &hNewFont);
|
2005-02-18 12:51:23 +00:00
|
|
|
hOldFont = SelectObject(hdcRef, hNewFont);
|
|
|
|
GetTextMetricsW(hdcRef, ptm);
|
|
|
|
SelectObject(hdcRef, hOldFont);
|
|
|
|
ReleaseDC(0, hdcRef);
|
|
|
|
return S_OK;
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_AddRefHfont (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_AddRefHfont(
|
2002-05-31 23:06:46 +00:00
|
|
|
IFont* iface,
|
1999-02-26 11:11:13 +00:00
|
|
|
HFONT hfont)
|
1999-02-20 16:48:53 +00:00
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2010-02-01 14:09:52 +00:00
|
|
|
TRACE("(%p)->(%p)\n", this, hfont);
|
2007-02-19 21:45:12 +00:00
|
|
|
|
2010-02-01 14:09:52 +00:00
|
|
|
if (!hfont) return E_INVALIDARG;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2010-02-01 14:09:52 +00:00
|
|
|
return inc_ext_ref(hfont);
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_ReleaseHfont (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_ReleaseHfont(
|
1999-02-20 16:48:53 +00:00
|
|
|
IFont* iface,
|
1999-02-26 11:11:13 +00:00
|
|
|
HFONT hfont)
|
1999-02-20 16:48:53 +00:00
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2010-02-01 14:09:52 +00:00
|
|
|
TRACE("(%p)->(%p)\n", this, hfont);
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2010-02-01 14:09:52 +00:00
|
|
|
if (!hfont) return E_INVALIDARG;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2010-02-01 14:09:52 +00:00
|
|
|
return dec_ext_ref(hfont);
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_SetHdc (IFont)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_SetHdc(
|
1999-02-20 16:48:53 +00:00
|
|
|
IFont* iface,
|
1999-02-26 11:11:13 +00:00
|
|
|
HDC hdc)
|
1999-02-20 16:48:53 +00:00
|
|
|
{
|
2010-12-16 00:04:22 +00:00
|
|
|
OLEFontImpl *this = impl_from_IFont(iface);
|
2002-10-25 03:12:50 +00:00
|
|
|
FIXME("(%p)->(%p): Stub\n", this, hdc);
|
1999-02-20 16:48:53 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2007-02-19 21:47:02 +00:00
|
|
|
static const IFontVtbl OLEFontImpl_VTable =
|
|
|
|
{
|
|
|
|
OLEFontImpl_QueryInterface,
|
|
|
|
OLEFontImpl_AddRef,
|
|
|
|
OLEFontImpl_Release,
|
|
|
|
OLEFontImpl_get_Name,
|
|
|
|
OLEFontImpl_put_Name,
|
|
|
|
OLEFontImpl_get_Size,
|
|
|
|
OLEFontImpl_put_Size,
|
|
|
|
OLEFontImpl_get_Bold,
|
|
|
|
OLEFontImpl_put_Bold,
|
|
|
|
OLEFontImpl_get_Italic,
|
|
|
|
OLEFontImpl_put_Italic,
|
|
|
|
OLEFontImpl_get_Underline,
|
|
|
|
OLEFontImpl_put_Underline,
|
|
|
|
OLEFontImpl_get_Strikethrough,
|
|
|
|
OLEFontImpl_put_Strikethrough,
|
|
|
|
OLEFontImpl_get_Weight,
|
|
|
|
OLEFontImpl_put_Weight,
|
|
|
|
OLEFontImpl_get_Charset,
|
|
|
|
OLEFontImpl_put_Charset,
|
|
|
|
OLEFontImpl_get_hFont,
|
|
|
|
OLEFontImpl_Clone,
|
|
|
|
OLEFontImpl_IsEqual,
|
|
|
|
OLEFontImpl_SetRatio,
|
|
|
|
OLEFontImpl_QueryTextMetrics,
|
|
|
|
OLEFontImpl_AddRefHfont,
|
|
|
|
OLEFontImpl_ReleaseHfont,
|
|
|
|
OLEFontImpl_SetHdc
|
|
|
|
};
|
|
|
|
|
1999-02-20 16:48:53 +00:00
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_IDispatch_QueryInterface (IUnknown)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_IDispatch_QueryInterface(
|
1999-02-20 16:48:53 +00:00
|
|
|
IDispatch* iface,
|
|
|
|
REFIID riid,
|
|
|
|
VOID** ppvoid)
|
|
|
|
{
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IDispatch(iface);
|
2010-12-16 00:04:22 +00:00
|
|
|
return IFont_QueryInterface(&this->IFont_iface, riid, ppvoid);
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_IDispatch_Release (IUnknown)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static ULONG WINAPI OLEFontImpl_IDispatch_Release(
|
1999-02-20 16:48:53 +00:00
|
|
|
IDispatch* iface)
|
|
|
|
{
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IDispatch(iface);
|
2010-12-16 00:04:22 +00:00
|
|
|
return IFont_Release(&this->IFont_iface);
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_IDispatch_AddRef (IUnknown)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static ULONG WINAPI OLEFontImpl_IDispatch_AddRef(
|
1999-02-20 16:48:53 +00:00
|
|
|
IDispatch* iface)
|
|
|
|
{
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IDispatch(iface);
|
2010-12-16 00:04:22 +00:00
|
|
|
return IFont_AddRef(&this->IFont_iface);
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_GetTypeInfoCount (IDispatch)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_GetTypeInfoCount(
|
2002-05-31 23:06:46 +00:00
|
|
|
IDispatch* iface,
|
1999-02-20 16:48:53 +00:00
|
|
|
unsigned int* pctinfo)
|
|
|
|
{
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IDispatch(iface);
|
2006-07-28 00:26:01 +00:00
|
|
|
TRACE("(%p)->(%p)\n", this, pctinfo);
|
|
|
|
*pctinfo = 1;
|
1999-02-20 16:48:53 +00:00
|
|
|
|
2006-07-28 00:26:01 +00:00
|
|
|
return S_OK;
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_GetTypeInfo (IDispatch)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_GetTypeInfo(
|
2002-05-31 23:06:46 +00:00
|
|
|
IDispatch* iface,
|
1999-02-26 11:11:13 +00:00
|
|
|
UINT iTInfo,
|
2002-05-31 23:06:46 +00:00
|
|
|
LCID lcid,
|
1999-02-20 16:48:53 +00:00
|
|
|
ITypeInfo** ppTInfo)
|
|
|
|
{
|
2005-09-13 10:36:54 +00:00
|
|
|
static const WCHAR stdole2tlb[] = {'s','t','d','o','l','e','2','.','t','l','b',0};
|
2003-01-23 01:23:59 +00:00
|
|
|
ITypeLib *tl;
|
|
|
|
HRESULT hres;
|
1999-02-20 16:48:53 +00:00
|
|
|
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IDispatch(iface);
|
2004-11-06 03:49:18 +00:00
|
|
|
TRACE("(%p, iTInfo=%d, lcid=%04x, %p)\n", this, iTInfo, (int)lcid, ppTInfo);
|
2003-01-23 01:23:59 +00:00
|
|
|
if (iTInfo != 0)
|
|
|
|
return E_FAIL;
|
2005-09-13 10:36:54 +00:00
|
|
|
hres = LoadTypeLib(stdole2tlb, &tl);
|
2003-01-23 01:23:59 +00:00
|
|
|
if (FAILED(hres)) {
|
2005-09-13 10:36:54 +00:00
|
|
|
ERR("Could not load the stdole2.tlb?\n");
|
2003-01-23 01:23:59 +00:00
|
|
|
return hres;
|
|
|
|
}
|
2005-09-13 10:36:54 +00:00
|
|
|
hres = ITypeLib_GetTypeInfoOfGuid(tl, &IID_IFontDisp, ppTInfo);
|
2008-01-31 14:45:35 +00:00
|
|
|
ITypeLib_Release(tl);
|
2003-01-23 01:23:59 +00:00
|
|
|
if (FAILED(hres)) {
|
2006-10-12 18:57:10 +00:00
|
|
|
FIXME("Did not IDispatch typeinfo from typelib, hres %x\n",hres);
|
2003-01-23 01:23:59 +00:00
|
|
|
}
|
|
|
|
return hres;
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_GetIDsOfNames (IDispatch)
|
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_GetIDsOfNames(
|
1999-02-20 16:48:53 +00:00
|
|
|
IDispatch* iface,
|
2002-05-31 23:06:46 +00:00
|
|
|
REFIID riid,
|
|
|
|
LPOLESTR* rgszNames,
|
|
|
|
UINT cNames,
|
1999-02-20 16:48:53 +00:00
|
|
|
LCID lcid,
|
|
|
|
DISPID* rgDispId)
|
|
|
|
{
|
2006-07-20 01:06:14 +00:00
|
|
|
ITypeInfo * pTInfo;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IDispatch(iface);
|
2006-07-20 01:06:14 +00:00
|
|
|
|
|
|
|
TRACE("(%p,%s,%p,cNames=%d,lcid=%04x,%p)\n", this, debugstr_guid(riid),
|
|
|
|
rgszNames, cNames, (int)lcid, rgDispId);
|
|
|
|
|
2011-08-21 08:16:28 +00:00
|
|
|
if (cNames == 0) return E_INVALIDARG;
|
|
|
|
|
2011-08-21 08:27:53 +00:00
|
|
|
hres = IDispatch_GetTypeInfo(iface, 0, lcid, &pTInfo);
|
2011-08-21 08:16:28 +00:00
|
|
|
if (FAILED(hres))
|
2006-07-20 01:06:14 +00:00
|
|
|
{
|
2011-08-21 08:16:28 +00:00
|
|
|
ERR("GetTypeInfo failed.\n");
|
|
|
|
return hres;
|
2006-07-20 01:06:14 +00:00
|
|
|
}
|
|
|
|
|
2011-08-21 08:16:28 +00:00
|
|
|
/* convert names to DISPIDs */
|
|
|
|
hres = DispGetIDsOfNames (pTInfo, rgszNames, cNames, rgDispId);
|
|
|
|
ITypeInfo_Release(pTInfo);
|
2006-07-20 01:06:14 +00:00
|
|
|
|
2011-08-21 08:16:28 +00:00
|
|
|
return hres;
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_Invoke (IDispatch)
|
2003-01-23 01:23:59 +00:00
|
|
|
*
|
|
|
|
* Note: Do not call _put_Xxx methods, since setting things here
|
|
|
|
* should not call notify functions as I found out debugging the generic
|
|
|
|
* MS VB5 installer.
|
1999-02-20 16:48:53 +00:00
|
|
|
*/
|
1999-02-21 18:16:08 +00:00
|
|
|
static HRESULT WINAPI OLEFontImpl_Invoke(
|
1999-02-20 16:48:53 +00:00
|
|
|
IDispatch* iface,
|
2002-05-31 23:06:46 +00:00
|
|
|
DISPID dispIdMember,
|
|
|
|
REFIID riid,
|
|
|
|
LCID lcid,
|
1999-02-20 16:48:53 +00:00
|
|
|
WORD wFlags,
|
|
|
|
DISPPARAMS* pDispParams,
|
2002-05-31 23:06:46 +00:00
|
|
|
VARIANT* pVarResult,
|
1999-02-20 16:48:53 +00:00
|
|
|
EXCEPINFO* pExepInfo,
|
1999-02-26 11:11:13 +00:00
|
|
|
UINT* puArgErr)
|
1999-02-20 16:48:53 +00:00
|
|
|
{
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IDispatch(iface);
|
2006-07-26 14:02:18 +00:00
|
|
|
HRESULT hr;
|
2003-01-23 01:23:59 +00:00
|
|
|
|
2006-10-12 18:57:10 +00:00
|
|
|
TRACE("%p->(%d,%s,0x%x,0x%x,%p,%p,%p,%p)\n", this, dispIdMember,
|
2006-07-28 00:21:28 +00:00
|
|
|
debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExepInfo,
|
|
|
|
puArgErr);
|
|
|
|
|
2006-07-26 14:02:04 +00:00
|
|
|
/* validate parameters */
|
|
|
|
|
|
|
|
if (!IsEqualIID(riid, &IID_NULL))
|
|
|
|
{
|
|
|
|
ERR("riid was %s instead of IID_NULL\n", debugstr_guid(riid));
|
|
|
|
return DISP_E_UNKNOWNINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wFlags & DISPATCH_PROPERTYGET)
|
|
|
|
{
|
|
|
|
if (!pVarResult)
|
|
|
|
{
|
|
|
|
ERR("null pVarResult not allowed when DISPATCH_PROPERTYGET specified\n");
|
|
|
|
return DISP_E_PARAMNOTOPTIONAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (wFlags & DISPATCH_PROPERTYPUT)
|
|
|
|
{
|
|
|
|
if (!pDispParams)
|
|
|
|
{
|
|
|
|
ERR("null pDispParams not allowed when DISPATCH_PROPERTYPUT specified\n");
|
|
|
|
return DISP_E_PARAMNOTOPTIONAL;
|
|
|
|
}
|
|
|
|
if (pDispParams->cArgs != 1)
|
|
|
|
{
|
2006-07-27 10:03:33 +00:00
|
|
|
ERR("param count for DISPATCH_PROPERTYPUT was %d instead of 1\n", pDispParams->cArgs);
|
2006-07-26 14:02:04 +00:00
|
|
|
return DISP_E_BADPARAMCOUNT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("one of DISPATCH_PROPERTYGET or DISPATCH_PROPERTYPUT must be specified\n");
|
|
|
|
return DISP_E_MEMBERNOTFOUND;
|
|
|
|
}
|
|
|
|
|
2003-01-23 01:23:59 +00:00
|
|
|
switch (dispIdMember) {
|
|
|
|
case DISPID_FONT_NAME:
|
2006-07-26 14:02:18 +00:00
|
|
|
if (wFlags & DISPATCH_PROPERTYGET) {
|
2003-01-23 01:23:59 +00:00
|
|
|
V_VT(pVarResult) = VT_BSTR;
|
2010-12-16 00:04:22 +00:00
|
|
|
return IFont_get_Name(&this->IFont_iface, &V_BSTR(pVarResult));
|
2006-07-26 14:02:18 +00:00
|
|
|
} else {
|
|
|
|
VARIANTARG vararg;
|
|
|
|
|
|
|
|
VariantInit(&vararg);
|
|
|
|
hr = VariantChangeTypeEx(&vararg, &pDispParams->rgvarg[0], lcid, 0, VT_BSTR);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2010-12-16 00:04:22 +00:00
|
|
|
hr = IFont_put_Name(&this->IFont_iface, V_BSTR(&vararg));
|
2006-07-26 14:02:18 +00:00
|
|
|
|
|
|
|
VariantClear(&vararg);
|
|
|
|
return hr;
|
2003-01-23 01:23:59 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DISPID_FONT_BOLD:
|
2006-07-26 14:02:18 +00:00
|
|
|
if (wFlags & DISPATCH_PROPERTYGET) {
|
|
|
|
BOOL value;
|
2010-12-16 00:04:22 +00:00
|
|
|
hr = IFont_get_Bold(&this->IFont_iface, &value);
|
2003-01-23 01:23:59 +00:00
|
|
|
V_VT(pVarResult) = VT_BOOL;
|
2006-07-26 14:02:18 +00:00
|
|
|
V_BOOL(pVarResult) = value ? VARIANT_TRUE : VARIANT_FALSE;
|
|
|
|
return hr;
|
|
|
|
} else {
|
|
|
|
VARIANTARG vararg;
|
|
|
|
|
|
|
|
VariantInit(&vararg);
|
|
|
|
hr = VariantChangeTypeEx(&vararg, &pDispParams->rgvarg[0], lcid, 0, VT_BOOL);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2010-12-16 00:04:22 +00:00
|
|
|
hr = IFont_put_Bold(&this->IFont_iface, V_BOOL(&vararg));
|
2006-07-26 14:02:18 +00:00
|
|
|
|
|
|
|
VariantClear(&vararg);
|
|
|
|
return hr;
|
2003-01-23 01:23:59 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DISPID_FONT_ITALIC:
|
2006-07-26 14:02:18 +00:00
|
|
|
if (wFlags & DISPATCH_PROPERTYGET) {
|
|
|
|
BOOL value;
|
2010-12-16 00:04:22 +00:00
|
|
|
hr = IFont_get_Italic(&this->IFont_iface, &value);
|
2003-01-23 01:23:59 +00:00
|
|
|
V_VT(pVarResult) = VT_BOOL;
|
2006-07-26 14:02:18 +00:00
|
|
|
V_BOOL(pVarResult) = value ? VARIANT_TRUE : VARIANT_FALSE;
|
|
|
|
return hr;
|
|
|
|
} else {
|
|
|
|
VARIANTARG vararg;
|
|
|
|
|
|
|
|
VariantInit(&vararg);
|
|
|
|
hr = VariantChangeTypeEx(&vararg, &pDispParams->rgvarg[0], lcid, 0, VT_BOOL);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2010-12-16 00:04:22 +00:00
|
|
|
hr = IFont_put_Italic(&this->IFont_iface, V_BOOL(&vararg));
|
2006-07-26 14:02:18 +00:00
|
|
|
|
|
|
|
VariantClear(&vararg);
|
|
|
|
return hr;
|
2003-01-23 01:23:59 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DISPID_FONT_UNDER:
|
2006-07-26 14:02:18 +00:00
|
|
|
if (wFlags & DISPATCH_PROPERTYGET) {
|
|
|
|
BOOL value;
|
2010-12-16 00:04:22 +00:00
|
|
|
hr = IFont_get_Underline(&this->IFont_iface, &value);
|
2003-01-23 01:23:59 +00:00
|
|
|
V_VT(pVarResult) = VT_BOOL;
|
2006-07-26 14:02:18 +00:00
|
|
|
V_BOOL(pVarResult) = value ? VARIANT_TRUE : VARIANT_FALSE;
|
|
|
|
return hr;
|
|
|
|
} else {
|
|
|
|
VARIANTARG vararg;
|
|
|
|
|
|
|
|
VariantInit(&vararg);
|
|
|
|
hr = VariantChangeTypeEx(&vararg, &pDispParams->rgvarg[0], lcid, 0, VT_BOOL);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2010-12-16 00:04:22 +00:00
|
|
|
hr = IFont_put_Underline(&this->IFont_iface, V_BOOL(&vararg));
|
2006-07-26 14:02:18 +00:00
|
|
|
|
|
|
|
VariantClear(&vararg);
|
|
|
|
return hr;
|
2003-01-23 01:23:59 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DISPID_FONT_STRIKE:
|
2006-07-26 14:02:18 +00:00
|
|
|
if (wFlags & DISPATCH_PROPERTYGET) {
|
|
|
|
BOOL value;
|
2010-12-16 00:04:22 +00:00
|
|
|
hr = IFont_get_Strikethrough(&this->IFont_iface, &value);
|
2003-01-23 01:23:59 +00:00
|
|
|
V_VT(pVarResult) = VT_BOOL;
|
2006-07-26 14:02:18 +00:00
|
|
|
V_BOOL(pVarResult) = value ? VARIANT_TRUE : VARIANT_FALSE;
|
|
|
|
return hr;
|
|
|
|
} else {
|
|
|
|
VARIANTARG vararg;
|
|
|
|
|
|
|
|
VariantInit(&vararg);
|
|
|
|
hr = VariantChangeTypeEx(&vararg, &pDispParams->rgvarg[0], lcid, 0, VT_BOOL);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2010-12-16 00:04:22 +00:00
|
|
|
hr = IFont_put_Strikethrough(&this->IFont_iface, V_BOOL(&vararg));
|
2006-07-26 14:02:18 +00:00
|
|
|
|
|
|
|
VariantClear(&vararg);
|
|
|
|
return hr;
|
2003-01-23 01:23:59 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DISPID_FONT_SIZE:
|
2006-07-26 14:02:18 +00:00
|
|
|
if (wFlags & DISPATCH_PROPERTYGET) {
|
2003-01-23 01:23:59 +00:00
|
|
|
V_VT(pVarResult) = VT_CY;
|
2011-08-21 08:27:53 +00:00
|
|
|
return IFont_get_Size(&this->IFont_iface, &V_CY(pVarResult));
|
2006-07-26 14:02:18 +00:00
|
|
|
} else {
|
|
|
|
VARIANTARG vararg;
|
|
|
|
|
|
|
|
VariantInit(&vararg);
|
|
|
|
hr = VariantChangeTypeEx(&vararg, &pDispParams->rgvarg[0], lcid, 0, VT_CY);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2010-12-16 00:04:22 +00:00
|
|
|
hr = IFont_put_Size(&this->IFont_iface, V_CY(&vararg));
|
2006-07-26 14:02:18 +00:00
|
|
|
|
|
|
|
VariantClear(&vararg);
|
|
|
|
return hr;
|
2003-01-23 01:23:59 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-07-28 00:20:17 +00:00
|
|
|
case DISPID_FONT_WEIGHT:
|
|
|
|
if (wFlags & DISPATCH_PROPERTYGET) {
|
|
|
|
V_VT(pVarResult) = VT_I2;
|
2011-08-21 08:27:53 +00:00
|
|
|
return IFont_get_Weight(&this->IFont_iface, &V_I2(pVarResult));
|
2006-07-28 00:20:17 +00:00
|
|
|
} else {
|
|
|
|
VARIANTARG vararg;
|
|
|
|
|
|
|
|
VariantInit(&vararg);
|
|
|
|
hr = VariantChangeTypeEx(&vararg, &pDispParams->rgvarg[0], lcid, 0, VT_I2);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2010-12-16 00:04:22 +00:00
|
|
|
hr = IFont_put_Weight(&this->IFont_iface, V_I2(&vararg));
|
2006-07-28 00:20:17 +00:00
|
|
|
|
|
|
|
VariantClear(&vararg);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
break;
|
2003-01-23 01:23:59 +00:00
|
|
|
case DISPID_FONT_CHARSET:
|
2006-07-26 14:02:18 +00:00
|
|
|
if (wFlags & DISPATCH_PROPERTYGET) {
|
2003-01-23 01:23:59 +00:00
|
|
|
V_VT(pVarResult) = VT_I2;
|
2010-12-16 00:04:22 +00:00
|
|
|
return OLEFontImpl_get_Charset(&this->IFont_iface, &V_I2(pVarResult));
|
2006-07-26 14:02:18 +00:00
|
|
|
} else {
|
|
|
|
VARIANTARG vararg;
|
|
|
|
|
|
|
|
VariantInit(&vararg);
|
|
|
|
hr = VariantChangeTypeEx(&vararg, &pDispParams->rgvarg[0], lcid, 0, VT_I2);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2010-12-16 00:04:22 +00:00
|
|
|
hr = IFont_put_Charset(&this->IFont_iface, V_I2(&vararg));
|
2006-07-26 14:02:18 +00:00
|
|
|
|
|
|
|
VariantClear(&vararg);
|
|
|
|
return hr;
|
2003-01-23 01:23:59 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-07-28 00:21:28 +00:00
|
|
|
default:
|
2006-10-12 18:57:10 +00:00
|
|
|
ERR("member not found for dispid 0x%x\n", dispIdMember);
|
2006-07-28 00:21:28 +00:00
|
|
|
return DISP_E_MEMBERNOTFOUND;
|
2003-01-23 01:23:59 +00:00
|
|
|
}
|
1999-02-20 16:48:53 +00:00
|
|
|
}
|
|
|
|
|
2007-02-19 21:47:02 +00:00
|
|
|
static const IDispatchVtbl OLEFontImpl_IDispatch_VTable =
|
|
|
|
{
|
|
|
|
OLEFontImpl_IDispatch_QueryInterface,
|
|
|
|
OLEFontImpl_IDispatch_AddRef,
|
|
|
|
OLEFontImpl_IDispatch_Release,
|
|
|
|
OLEFontImpl_GetTypeInfoCount,
|
|
|
|
OLEFontImpl_GetTypeInfo,
|
|
|
|
OLEFontImpl_GetIDsOfNames,
|
|
|
|
OLEFontImpl_Invoke
|
|
|
|
};
|
|
|
|
|
1999-03-13 17:59:07 +00:00
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_IPersistStream_QueryInterface (IUnknown)
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI OLEFontImpl_IPersistStream_QueryInterface(
|
|
|
|
IPersistStream* iface,
|
|
|
|
REFIID riid,
|
|
|
|
VOID** ppvoid)
|
|
|
|
{
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IPersistStream(iface);
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2010-12-16 00:04:22 +00:00
|
|
|
return IFont_QueryInterface(&this->IFont_iface, riid, ppvoid);
|
1999-03-13 17:59:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_IPersistStream_Release (IUnknown)
|
|
|
|
*/
|
|
|
|
static ULONG WINAPI OLEFontImpl_IPersistStream_Release(
|
|
|
|
IPersistStream* iface)
|
|
|
|
{
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IPersistStream(iface);
|
1999-02-20 16:48:53 +00:00
|
|
|
|
2010-12-16 00:04:22 +00:00
|
|
|
return IFont_Release(&this->IFont_iface);
|
1999-03-13 17:59:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_IPersistStream_AddRef (IUnknown)
|
|
|
|
*/
|
|
|
|
static ULONG WINAPI OLEFontImpl_IPersistStream_AddRef(
|
|
|
|
IPersistStream* iface)
|
|
|
|
{
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IPersistStream(iface);
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2010-12-16 00:04:22 +00:00
|
|
|
return IFont_AddRef(&this->IFont_iface);
|
1999-03-13 17:59:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_GetClassID (IPersistStream)
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI OLEFontImpl_GetClassID(
|
2002-05-31 23:06:46 +00:00
|
|
|
IPersistStream* iface,
|
1999-03-13 17:59:07 +00:00
|
|
|
CLSID* pClassID)
|
|
|
|
{
|
2003-01-23 01:23:59 +00:00
|
|
|
TRACE("(%p,%p)\n",iface,pClassID);
|
1999-03-13 17:59:07 +00:00
|
|
|
if (pClassID==0)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2008-03-11 20:55:17 +00:00
|
|
|
*pClassID = CLSID_StdFont;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_IsDirty (IPersistStream)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IPersistStream methods.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI OLEFontImpl_IsDirty(
|
|
|
|
IPersistStream* iface)
|
|
|
|
{
|
2003-01-23 01:23:59 +00:00
|
|
|
TRACE("(%p)\n",iface);
|
1999-03-13 17:59:07 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_Load (IPersistStream)
|
|
|
|
*
|
|
|
|
* See Windows documentation for more details on IPersistStream methods.
|
|
|
|
*
|
|
|
|
* This is the format of the standard font serialization as far as I
|
|
|
|
* know
|
|
|
|
*
|
|
|
|
* Offset Type Value Comment
|
|
|
|
* 0x0000 Byte Unknown Probably a version number, contains 0x01
|
|
|
|
* 0x0001 Short Charset Charset value from the FONTDESC structure
|
|
|
|
* 0x0003 Byte Attributes Flags defined as follows:
|
|
|
|
* 00000010 - Italic
|
|
|
|
* 00000100 - Underline
|
|
|
|
* 00001000 - Strikethrough
|
|
|
|
* 0x0004 Short Weight Weight value from FONTDESC structure
|
|
|
|
* 0x0006 DWORD size "Low" portion of the cySize member of the FONTDESC
|
|
|
|
* structure/
|
|
|
|
* 0x000A Byte name length Length of the font name string (no null character)
|
|
|
|
* 0x000B String name Name of the font (ASCII, no nul character)
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI OLEFontImpl_Load(
|
|
|
|
IPersistStream* iface,
|
|
|
|
IStream* pLoadStream)
|
|
|
|
{
|
2011-08-21 14:44:54 +00:00
|
|
|
OLEFontImpl *this = impl_from_IPersistStream(iface);
|
|
|
|
BYTE version, attributes, string_size;
|
|
|
|
char readBuffer[0x100];
|
1999-03-13 17:59:07 +00:00
|
|
|
ULONG cbRead;
|
2002-01-01 00:24:30 +00:00
|
|
|
INT len;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
/* Version */
|
|
|
|
IStream_Read(pLoadStream, &version, sizeof(BYTE), &cbRead);
|
|
|
|
if ((cbRead != sizeof(BYTE)) || (version != 0x01)) return E_FAIL;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
/* Charset */
|
|
|
|
IStream_Read(pLoadStream, &this->description.sCharset, sizeof(WORD), &cbRead);
|
|
|
|
if (cbRead != sizeof(WORD)) return E_FAIL;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
/* Attributes */
|
|
|
|
IStream_Read(pLoadStream, &attributes, sizeof(BYTE), &cbRead);
|
|
|
|
if (cbRead != sizeof(BYTE)) return E_FAIL;
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
this->description.fItalic = (attributes & FONTPERSIST_ITALIC) != 0;
|
|
|
|
this->description.fStrikethrough = (attributes & FONTPERSIST_STRIKETHROUGH) != 0;
|
|
|
|
this->description.fUnderline = (attributes & FONTPERSIST_UNDERLINE) != 0;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
/* Weight */
|
|
|
|
IStream_Read(pLoadStream, &this->description.sWeight, sizeof(WORD), &cbRead);
|
|
|
|
if (cbRead != sizeof(WORD)) return E_FAIL;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
/* Size */
|
|
|
|
IStream_Read(pLoadStream, &this->description.cySize.s.Lo, sizeof(DWORD), &cbRead);
|
|
|
|
if (cbRead != sizeof(DWORD)) return E_FAIL;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
1999-09-19 14:20:33 +00:00
|
|
|
this->description.cySize.s.Hi = 0;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
/* Name */
|
|
|
|
IStream_Read(pLoadStream, &string_size, sizeof(BYTE), &cbRead);
|
|
|
|
if (cbRead != sizeof(BYTE)) return E_FAIL;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
IStream_Read(pLoadStream, readBuffer, string_size, &cbRead);
|
|
|
|
if (cbRead != string_size) return E_FAIL;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2004-12-23 17:06:43 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, this->description.lpstrName);
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
len = MultiByteToWideChar( CP_ACP, 0, readBuffer, string_size, NULL, 0 );
|
2002-01-01 00:24:30 +00:00
|
|
|
this->description.lpstrName = HeapAlloc( GetProcessHeap(), 0, (len+1) * sizeof(WCHAR) );
|
2011-08-21 14:44:54 +00:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, readBuffer, string_size, this->description.lpstrName, len );
|
2002-01-01 00:24:30 +00:00
|
|
|
this->description.lpstrName[len] = 0;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2010-05-10 14:01:03 +00:00
|
|
|
/* Ensure use of this font causes a new one to be created */
|
2010-02-01 14:09:52 +00:00
|
|
|
dec_int_ref(this->gdiFont);
|
2002-06-25 02:54:06 +00:00
|
|
|
this->gdiFont = 0;
|
2010-05-10 14:01:03 +00:00
|
|
|
this->dirty = TRUE;
|
2002-06-25 02:54:06 +00:00
|
|
|
|
1999-03-13 17:59:07 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_Save (IPersistStream)
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI OLEFontImpl_Save(
|
|
|
|
IPersistStream* iface,
|
|
|
|
IStream* pOutStream,
|
|
|
|
BOOL fClearDirty)
|
|
|
|
{
|
2011-08-21 14:44:54 +00:00
|
|
|
OLEFontImpl *this = impl_from_IPersistStream(iface);
|
|
|
|
BYTE attributes, string_size;
|
|
|
|
const BYTE version = 0x01;
|
1999-03-13 17:59:07 +00:00
|
|
|
char* writeBuffer = NULL;
|
2011-08-21 14:44:54 +00:00
|
|
|
ULONG written;
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
TRACE("(%p)->(%p %d)\n", this, pOutStream, fClearDirty);
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
/* Version */
|
|
|
|
IStream_Write(pOutStream, &version, sizeof(BYTE), &written);
|
|
|
|
if (written != sizeof(BYTE)) return E_FAIL;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
/* Charset */
|
|
|
|
IStream_Write(pOutStream, &this->description.sCharset, sizeof(WORD), &written);
|
|
|
|
if (written != sizeof(WORD)) return E_FAIL;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
/* Attributes */
|
|
|
|
attributes = 0;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
|
|
|
if (this->description.fItalic)
|
2011-08-21 14:44:54 +00:00
|
|
|
attributes |= FONTPERSIST_ITALIC;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
1999-03-14 13:47:00 +00:00
|
|
|
if (this->description.fStrikethrough)
|
2011-08-21 14:44:54 +00:00
|
|
|
attributes |= FONTPERSIST_STRIKETHROUGH;
|
2002-05-31 23:06:46 +00:00
|
|
|
|
1999-03-13 17:59:07 +00:00
|
|
|
if (this->description.fUnderline)
|
2011-08-21 14:44:54 +00:00
|
|
|
attributes |= FONTPERSIST_UNDERLINE;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
IStream_Write(pOutStream, &attributes, sizeof(BYTE), &written);
|
|
|
|
if (written != sizeof(BYTE)) return E_FAIL;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
/* Weight */
|
|
|
|
IStream_Write(pOutStream, &this->description.sWeight, sizeof(WORD), &written);
|
|
|
|
if (written != sizeof(WORD)) return E_FAIL;
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
/* Size */
|
|
|
|
IStream_Write(pOutStream, &this->description.cySize.s.Lo, sizeof(DWORD), &written);
|
|
|
|
if (written != sizeof(DWORD)) return E_FAIL;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
/* FontName */
|
|
|
|
if (this->description.lpstrName)
|
|
|
|
string_size = WideCharToMultiByte( CP_ACP, 0, this->description.lpstrName,
|
2002-01-01 00:24:30 +00:00
|
|
|
strlenW(this->description.lpstrName), NULL, 0, NULL, NULL );
|
1999-03-13 17:59:07 +00:00
|
|
|
else
|
2011-08-21 14:44:54 +00:00
|
|
|
string_size = 0;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
IStream_Write(pOutStream, &string_size, sizeof(BYTE), &written);
|
|
|
|
if (written != sizeof(BYTE)) return E_FAIL;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
if (string_size)
|
1999-03-13 17:59:07 +00:00
|
|
|
{
|
2011-08-21 14:44:54 +00:00
|
|
|
if (!(writeBuffer = HeapAlloc( GetProcessHeap(), 0, string_size ))) return E_OUTOFMEMORY;
|
2002-01-01 00:24:30 +00:00
|
|
|
WideCharToMultiByte( CP_ACP, 0, this->description.lpstrName,
|
|
|
|
strlenW(this->description.lpstrName),
|
2011-08-21 14:44:54 +00:00
|
|
|
writeBuffer, string_size, NULL, NULL );
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
IStream_Write(pOutStream, writeBuffer, string_size, &written);
|
|
|
|
HeapFree(GetProcessHeap(), 0, writeBuffer);
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2011-08-21 14:44:54 +00:00
|
|
|
if (written != string_size) return E_FAIL;
|
1999-03-13 17:59:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_GetSizeMax (IPersistStream)
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI OLEFontImpl_GetSizeMax(
|
|
|
|
IPersistStream* iface,
|
|
|
|
ULARGE_INTEGER* pcbSize)
|
|
|
|
{
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IPersistStream(iface);
|
1999-03-13 17:59:07 +00:00
|
|
|
|
|
|
|
if (pcbSize==NULL)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2004-01-23 01:51:33 +00:00
|
|
|
pcbSize->u.HighPart = 0;
|
|
|
|
pcbSize->u.LowPart = 0;
|
1999-03-13 17:59:07 +00:00
|
|
|
|
2004-01-23 01:51:33 +00:00
|
|
|
pcbSize->u.LowPart += sizeof(BYTE); /* Version */
|
|
|
|
pcbSize->u.LowPart += sizeof(WORD); /* Lang code */
|
|
|
|
pcbSize->u.LowPart += sizeof(BYTE); /* Flags */
|
|
|
|
pcbSize->u.LowPart += sizeof(WORD); /* Weight */
|
|
|
|
pcbSize->u.LowPart += sizeof(DWORD); /* Size */
|
|
|
|
pcbSize->u.LowPart += sizeof(BYTE); /* StrLength */
|
1999-03-13 17:59:07 +00:00
|
|
|
|
|
|
|
if (this->description.lpstrName!=0)
|
2008-02-27 16:48:13 +00:00
|
|
|
pcbSize->u.LowPart += WideCharToMultiByte( CP_ACP, 0, this->description.lpstrName,
|
|
|
|
strlenW(this->description.lpstrName),
|
|
|
|
NULL, 0, NULL, NULL );
|
1999-03-13 17:59:07 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
2000-07-28 20:17:21 +00:00
|
|
|
|
2007-02-19 21:47:02 +00:00
|
|
|
static const IPersistStreamVtbl OLEFontImpl_IPersistStream_VTable =
|
|
|
|
{
|
|
|
|
OLEFontImpl_IPersistStream_QueryInterface,
|
|
|
|
OLEFontImpl_IPersistStream_AddRef,
|
|
|
|
OLEFontImpl_IPersistStream_Release,
|
|
|
|
OLEFontImpl_GetClassID,
|
|
|
|
OLEFontImpl_IsDirty,
|
|
|
|
OLEFontImpl_Load,
|
|
|
|
OLEFontImpl_Save,
|
|
|
|
OLEFontImpl_GetSizeMax
|
|
|
|
};
|
|
|
|
|
2000-07-28 20:17:21 +00:00
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_IConnectionPointContainer_QueryInterface (IUnknown)
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI OLEFontImpl_IConnectionPointContainer_QueryInterface(
|
|
|
|
IConnectionPointContainer* iface,
|
|
|
|
REFIID riid,
|
|
|
|
VOID** ppvoid)
|
|
|
|
{
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IConnectionPointContainer(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
|
2010-12-16 00:04:22 +00:00
|
|
|
return IFont_QueryInterface(&this->IFont_iface, riid, ppvoid);
|
2000-07-28 20:17:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_IConnectionPointContainer_Release (IUnknown)
|
|
|
|
*/
|
|
|
|
static ULONG WINAPI OLEFontImpl_IConnectionPointContainer_Release(
|
|
|
|
IConnectionPointContainer* iface)
|
|
|
|
{
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IConnectionPointContainer(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
|
2010-12-16 00:04:22 +00:00
|
|
|
return IFont_Release(&this->IFont_iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_IConnectionPointContainer_AddRef (IUnknown)
|
|
|
|
*/
|
|
|
|
static ULONG WINAPI OLEFontImpl_IConnectionPointContainer_AddRef(
|
|
|
|
IConnectionPointContainer* iface)
|
|
|
|
{
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IConnectionPointContainer(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
|
2010-12-16 00:04:22 +00:00
|
|
|
return IFont_AddRef(&this->IFont_iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_EnumConnectionPoints (IConnectionPointContainer)
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI OLEFontImpl_EnumConnectionPoints(
|
|
|
|
IConnectionPointContainer* iface,
|
|
|
|
IEnumConnectionPoints **ppEnum)
|
|
|
|
{
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IConnectionPointContainer(iface);
|
2000-07-28 20:17:21 +00:00
|
|
|
|
|
|
|
FIXME("(%p)->(%p): stub\n", this, ppEnum);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_FindConnectionPoint (IConnectionPointContainer)
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI OLEFontImpl_FindConnectionPoint(
|
|
|
|
IConnectionPointContainer* iface,
|
|
|
|
REFIID riid,
|
|
|
|
IConnectionPoint **ppCp)
|
|
|
|
{
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IConnectionPointContainer(iface);
|
2006-08-11 01:48:37 +00:00
|
|
|
TRACE("(%p)->(%s, %p)\n", this, debugstr_guid(riid), ppCp);
|
2000-07-28 20:17:21 +00:00
|
|
|
|
2006-02-10 13:50:26 +00:00
|
|
|
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);
|
2000-07-28 20:17:21 +00:00
|
|
|
} else {
|
2006-02-10 13:51:30 +00:00
|
|
|
FIXME("no connection point for %s\n", debugstr_guid(riid));
|
|
|
|
return CONNECT_E_NOCONNECTION;
|
2000-07-28 20:17:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-19 21:47:02 +00:00
|
|
|
static const IConnectionPointContainerVtbl
|
|
|
|
OLEFontImpl_IConnectionPointContainer_VTable =
|
|
|
|
{
|
|
|
|
OLEFontImpl_IConnectionPointContainer_QueryInterface,
|
|
|
|
OLEFontImpl_IConnectionPointContainer_AddRef,
|
|
|
|
OLEFontImpl_IConnectionPointContainer_Release,
|
|
|
|
OLEFontImpl_EnumConnectionPoints,
|
|
|
|
OLEFontImpl_FindConnectionPoint
|
|
|
|
};
|
|
|
|
|
2003-01-23 01:23:59 +00:00
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl implementation of IPersistPropertyBag.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_QueryInterface(
|
|
|
|
IPersistPropertyBag *iface, REFIID riid, LPVOID *ppvObj
|
|
|
|
) {
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IPersistPropertyBag(iface);
|
2010-12-16 00:04:22 +00:00
|
|
|
return IFont_QueryInterface(&this->IFont_iface,riid,ppvObj);
|
2003-01-23 01:23:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OLEFontImpl_IPersistPropertyBag_AddRef(
|
|
|
|
IPersistPropertyBag *iface
|
|
|
|
) {
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IPersistPropertyBag(iface);
|
2010-12-16 00:04:22 +00:00
|
|
|
return IFont_AddRef(&this->IFont_iface);
|
2003-01-23 01:23:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OLEFontImpl_IPersistPropertyBag_Release(
|
|
|
|
IPersistPropertyBag *iface
|
|
|
|
) {
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IPersistPropertyBag(iface);
|
2010-12-16 00:04:22 +00:00
|
|
|
return IFont_Release(&this->IFont_iface);
|
2003-01-23 01:23:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_GetClassID(
|
|
|
|
IPersistPropertyBag *iface, CLSID *classid
|
|
|
|
) {
|
|
|
|
FIXME("(%p,%p), stub!\n", iface, classid);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_InitNew(
|
|
|
|
IPersistPropertyBag *iface
|
|
|
|
) {
|
|
|
|
FIXME("(%p), stub!\n", iface);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Load(
|
|
|
|
IPersistPropertyBag *iface, IPropertyBag* pPropBag, IErrorLog* pErrorLog
|
|
|
|
) {
|
2004-08-20 19:58:46 +00:00
|
|
|
/* (from Visual Basic 6 property bag)
|
|
|
|
Name = "MS Sans Serif"
|
|
|
|
Size = 13.8
|
|
|
|
Charset = 0
|
|
|
|
Weight = 400
|
|
|
|
Underline = 0 'False
|
|
|
|
Italic = 0 'False
|
|
|
|
Strikethrough = 0 'False
|
|
|
|
*/
|
|
|
|
static const WCHAR sAttrName[] = {'N','a','m','e',0};
|
|
|
|
static const WCHAR sAttrSize[] = {'S','i','z','e',0};
|
|
|
|
static const WCHAR sAttrCharset[] = {'C','h','a','r','s','e','t',0};
|
|
|
|
static const WCHAR sAttrWeight[] = {'W','e','i','g','h','t',0};
|
|
|
|
static const WCHAR sAttrUnderline[] = {'U','n','d','e','r','l','i','n','e',0};
|
|
|
|
static const WCHAR sAttrItalic[] = {'I','t','a','l','i','c',0};
|
|
|
|
static const WCHAR sAttrStrikethrough[] = {'S','t','r','i','k','e','t','h','r','o','u','g','h',0};
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IPersistPropertyBag(iface);
|
2010-10-23 20:06:19 +00:00
|
|
|
VARIANT value;
|
|
|
|
HRESULT iRes;
|
2004-08-20 19:58:46 +00:00
|
|
|
|
2010-10-23 20:06:19 +00:00
|
|
|
VariantInit(&value);
|
2004-08-20 19:58:46 +00:00
|
|
|
|
2010-10-23 20:06:19 +00:00
|
|
|
iRes = IPropertyBag_Read(pPropBag, sAttrName, &value, pErrorLog);
|
|
|
|
if (iRes == S_OK)
|
|
|
|
{
|
|
|
|
iRes = VariantChangeType(&value, &value, 0, VT_BSTR);
|
2004-08-20 19:58:46 +00:00
|
|
|
if (iRes == S_OK)
|
2010-12-16 00:04:22 +00:00
|
|
|
iRes = IFont_put_Name(&this->IFont_iface, V_BSTR(&value));
|
2004-08-20 19:58:46 +00:00
|
|
|
}
|
2010-10-23 20:06:19 +00:00
|
|
|
else if (iRes == E_INVALIDARG)
|
|
|
|
iRes = S_OK;
|
|
|
|
|
|
|
|
VariantClear(&value);
|
2004-08-20 19:58:46 +00:00
|
|
|
|
|
|
|
if (iRes == S_OK) {
|
2010-10-23 20:06:19 +00:00
|
|
|
iRes = IPropertyBag_Read(pPropBag, sAttrSize, &value, pErrorLog);
|
2004-08-20 19:58:46 +00:00
|
|
|
if (iRes == S_OK)
|
|
|
|
{
|
2010-10-23 20:06:19 +00:00
|
|
|
iRes = VariantChangeType(&value, &value, 0, VT_CY);
|
2004-08-20 19:58:46 +00:00
|
|
|
if (iRes == S_OK)
|
2010-12-16 00:04:22 +00:00
|
|
|
iRes = IFont_put_Size(&this->IFont_iface, V_CY(&value));
|
2004-08-20 19:58:46 +00:00
|
|
|
}
|
|
|
|
else if (iRes == E_INVALIDARG)
|
|
|
|
iRes = S_OK;
|
2010-10-23 20:06:19 +00:00
|
|
|
|
|
|
|
VariantClear(&value);
|
2004-08-20 19:58:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (iRes == S_OK) {
|
2010-10-23 20:06:19 +00:00
|
|
|
iRes = IPropertyBag_Read(pPropBag, sAttrCharset, &value, pErrorLog);
|
2004-08-20 19:58:46 +00:00
|
|
|
if (iRes == S_OK)
|
|
|
|
{
|
2010-10-23 20:06:19 +00:00
|
|
|
iRes = VariantChangeType(&value, &value, 0, VT_I2);
|
2004-08-20 19:58:46 +00:00
|
|
|
if (iRes == S_OK)
|
2010-12-16 00:04:22 +00:00
|
|
|
iRes = IFont_put_Charset(&this->IFont_iface, V_I2(&value));
|
2004-08-20 19:58:46 +00:00
|
|
|
}
|
|
|
|
else if (iRes == E_INVALIDARG)
|
|
|
|
iRes = S_OK;
|
2010-10-23 20:06:19 +00:00
|
|
|
|
|
|
|
VariantClear(&value);
|
2004-08-20 19:58:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (iRes == S_OK) {
|
2010-10-23 20:06:19 +00:00
|
|
|
iRes = IPropertyBag_Read(pPropBag, sAttrWeight, &value, pErrorLog);
|
2004-08-20 19:58:46 +00:00
|
|
|
if (iRes == S_OK)
|
|
|
|
{
|
2010-10-23 20:06:19 +00:00
|
|
|
iRes = VariantChangeType(&value, &value, 0, VT_I2);
|
2004-08-20 19:58:46 +00:00
|
|
|
if (iRes == S_OK)
|
2010-12-16 00:04:22 +00:00
|
|
|
iRes = IFont_put_Weight(&this->IFont_iface, V_I2(&value));
|
2004-08-20 19:58:46 +00:00
|
|
|
}
|
|
|
|
else if (iRes == E_INVALIDARG)
|
|
|
|
iRes = S_OK;
|
|
|
|
|
2010-10-23 20:06:19 +00:00
|
|
|
VariantClear(&value);
|
2004-08-20 19:58:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (iRes == S_OK) {
|
2010-10-23 20:06:19 +00:00
|
|
|
iRes = IPropertyBag_Read(pPropBag, sAttrUnderline, &value, pErrorLog);
|
2004-08-20 19:58:46 +00:00
|
|
|
if (iRes == S_OK)
|
|
|
|
{
|
2010-10-23 20:06:19 +00:00
|
|
|
iRes = VariantChangeType(&value, &value, 0, VT_BOOL);
|
2004-08-20 19:58:46 +00:00
|
|
|
if (iRes == S_OK)
|
2010-12-16 00:04:22 +00:00
|
|
|
iRes = IFont_put_Underline(&this->IFont_iface, V_BOOL(&value));
|
2004-08-20 19:58:46 +00:00
|
|
|
}
|
|
|
|
else if (iRes == E_INVALIDARG)
|
|
|
|
iRes = S_OK;
|
2010-10-23 20:06:19 +00:00
|
|
|
|
|
|
|
VariantClear(&value);
|
2004-08-20 19:58:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (iRes == S_OK) {
|
2010-10-23 20:06:19 +00:00
|
|
|
iRes = IPropertyBag_Read(pPropBag, sAttrItalic, &value, pErrorLog);
|
2004-08-20 19:58:46 +00:00
|
|
|
if (iRes == S_OK)
|
|
|
|
{
|
2010-10-23 20:06:19 +00:00
|
|
|
iRes = VariantChangeType(&value, &value, 0, VT_BOOL);
|
2004-08-20 19:58:46 +00:00
|
|
|
if (iRes == S_OK)
|
2010-12-16 00:04:22 +00:00
|
|
|
iRes = IFont_put_Italic(&this->IFont_iface, V_BOOL(&value));
|
2004-08-20 19:58:46 +00:00
|
|
|
}
|
|
|
|
else if (iRes == E_INVALIDARG)
|
|
|
|
iRes = S_OK;
|
2010-10-23 20:06:19 +00:00
|
|
|
|
|
|
|
VariantClear(&value);
|
2004-08-20 19:58:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (iRes == S_OK) {
|
2010-10-23 20:06:19 +00:00
|
|
|
iRes = IPropertyBag_Read(pPropBag, sAttrStrikethrough, &value, pErrorLog);
|
2004-08-20 19:58:46 +00:00
|
|
|
if (iRes == S_OK)
|
|
|
|
{
|
2010-10-23 20:06:19 +00:00
|
|
|
iRes = VariantChangeType(&value, &value, 0, VT_BOOL);
|
2004-08-20 19:58:46 +00:00
|
|
|
if (iRes == S_OK)
|
2010-12-16 00:04:22 +00:00
|
|
|
IFont_put_Strikethrough(&this->IFont_iface, V_BOOL(&value));
|
2004-08-20 19:58:46 +00:00
|
|
|
}
|
|
|
|
else if (iRes == E_INVALIDARG)
|
|
|
|
iRes = S_OK;
|
2010-10-23 20:06:19 +00:00
|
|
|
|
|
|
|
VariantClear(&value);
|
2004-08-20 19:58:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (FAILED(iRes))
|
2006-10-12 18:57:10 +00:00
|
|
|
WARN("-- 0x%08x\n", iRes);
|
2004-08-20 19:58:46 +00:00
|
|
|
return iRes;
|
2003-01-23 01:23:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Save(
|
|
|
|
IPersistPropertyBag *iface, IPropertyBag* pPropBag, BOOL fClearDirty,
|
|
|
|
BOOL fSaveAllProperties
|
|
|
|
) {
|
|
|
|
FIXME("(%p,%p,%d,%d), stub!\n", iface, pPropBag, fClearDirty, fSaveAllProperties);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2005-06-06 19:50:35 +00:00
|
|
|
static const IPersistPropertyBagVtbl OLEFontImpl_IPersistPropertyBag_VTable =
|
2003-01-23 01:23:59 +00:00
|
|
|
{
|
|
|
|
OLEFontImpl_IPersistPropertyBag_QueryInterface,
|
|
|
|
OLEFontImpl_IPersistPropertyBag_AddRef,
|
|
|
|
OLEFontImpl_IPersistPropertyBag_Release,
|
|
|
|
|
|
|
|
OLEFontImpl_IPersistPropertyBag_GetClassID,
|
|
|
|
OLEFontImpl_IPersistPropertyBag_InitNew,
|
|
|
|
OLEFontImpl_IPersistPropertyBag_Load,
|
|
|
|
OLEFontImpl_IPersistPropertyBag_Save
|
|
|
|
};
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl implementation of IPersistStreamInit.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_QueryInterface(
|
|
|
|
IPersistStreamInit *iface, REFIID riid, LPVOID *ppvObj
|
|
|
|
) {
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IPersistStreamInit(iface);
|
2010-12-16 00:04:22 +00:00
|
|
|
return IFont_QueryInterface(&this->IFont_iface,riid,ppvObj);
|
2003-01-23 01:23:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OLEFontImpl_IPersistStreamInit_AddRef(
|
|
|
|
IPersistStreamInit *iface
|
|
|
|
) {
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IPersistStreamInit(iface);
|
2010-12-16 00:04:22 +00:00
|
|
|
return IFont_AddRef(&this->IFont_iface);
|
2003-01-23 01:23:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OLEFontImpl_IPersistStreamInit_Release(
|
|
|
|
IPersistStreamInit *iface
|
|
|
|
) {
|
2005-07-27 15:14:18 +00:00
|
|
|
OLEFontImpl *this = impl_from_IPersistStreamInit(iface);
|
2010-12-16 00:04:22 +00:00
|
|
|
return IFont_Release(&this->IFont_iface);
|
2003-01-23 01:23:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_GetClassID(
|
|
|
|
IPersistStreamInit *iface, CLSID *classid
|
|
|
|
) {
|
|
|
|
FIXME("(%p,%p), stub!\n", iface, classid);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_IsDirty(
|
|
|
|
IPersistStreamInit *iface
|
|
|
|
) {
|
|
|
|
FIXME("(%p), stub!\n", iface);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_Load(
|
|
|
|
IPersistStreamInit *iface, LPSTREAM pStm
|
|
|
|
) {
|
|
|
|
FIXME("(%p,%p), stub!\n", iface, pStm);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_Save(
|
|
|
|
IPersistStreamInit *iface, LPSTREAM pStm, BOOL fClearDirty
|
|
|
|
) {
|
|
|
|
FIXME("(%p,%p,%d), stub!\n", iface, pStm, fClearDirty);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_GetSizeMax(
|
|
|
|
IPersistStreamInit *iface, ULARGE_INTEGER *pcbSize
|
|
|
|
) {
|
|
|
|
FIXME("(%p,%p), stub!\n", iface, pcbSize);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_InitNew(
|
|
|
|
IPersistStreamInit *iface
|
|
|
|
) {
|
|
|
|
FIXME("(%p), stub!\n", iface);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-06-06 19:50:35 +00:00
|
|
|
static const IPersistStreamInitVtbl OLEFontImpl_IPersistStreamInit_VTable =
|
2003-01-23 01:23:59 +00:00
|
|
|
{
|
|
|
|
OLEFontImpl_IPersistStreamInit_QueryInterface,
|
|
|
|
OLEFontImpl_IPersistStreamInit_AddRef,
|
|
|
|
OLEFontImpl_IPersistStreamInit_Release,
|
|
|
|
|
|
|
|
OLEFontImpl_IPersistStreamInit_GetClassID,
|
|
|
|
OLEFontImpl_IPersistStreamInit_IsDirty,
|
|
|
|
OLEFontImpl_IPersistStreamInit_Load,
|
|
|
|
OLEFontImpl_IPersistStreamInit_Save,
|
|
|
|
OLEFontImpl_IPersistStreamInit_GetSizeMax,
|
|
|
|
OLEFontImpl_IPersistStreamInit_InitNew
|
|
|
|
};
|
|
|
|
|
2007-02-19 21:47:02 +00:00
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_Construct
|
|
|
|
*
|
|
|
|
* This method will construct a new instance of the OLEFontImpl
|
|
|
|
* class.
|
|
|
|
*
|
|
|
|
* The caller of this method must release the object when it's
|
|
|
|
* done with it.
|
|
|
|
*/
|
2007-07-02 20:14:59 +00:00
|
|
|
static OLEFontImpl* OLEFontImpl_Construct(const FONTDESC *fontDesc)
|
2007-02-19 21:47:02 +00:00
|
|
|
{
|
2011-08-21 08:16:28 +00:00
|
|
|
OLEFontImpl* newObject;
|
2007-02-19 21:47:02 +00:00
|
|
|
|
|
|
|
newObject = HeapAlloc(GetProcessHeap(), 0, sizeof(OLEFontImpl));
|
|
|
|
|
|
|
|
if (newObject==0)
|
|
|
|
return newObject;
|
|
|
|
|
2010-12-16 00:04:22 +00:00
|
|
|
newObject->IFont_iface.lpVtbl = &OLEFontImpl_VTable;
|
|
|
|
newObject->IDispatch_iface.lpVtbl = &OLEFontImpl_IDispatch_VTable;
|
|
|
|
newObject->IPersistStream_iface.lpVtbl = &OLEFontImpl_IPersistStream_VTable;
|
|
|
|
newObject->IConnectionPointContainer_iface.lpVtbl = &OLEFontImpl_IConnectionPointContainer_VTable;
|
|
|
|
newObject->IPersistPropertyBag_iface.lpVtbl = &OLEFontImpl_IPersistPropertyBag_VTable;
|
|
|
|
newObject->IPersistStreamInit_iface.lpVtbl = &OLEFontImpl_IPersistStreamInit_VTable;
|
2007-02-19 21:47:02 +00:00
|
|
|
|
|
|
|
newObject->ref = 1;
|
|
|
|
|
|
|
|
newObject->description.cbSizeofstruct = sizeof(FONTDESC);
|
2011-08-21 14:13:47 +00:00
|
|
|
newObject->description.lpstrName = strdupW(fontDesc->lpstrName);
|
2007-02-19 21:47:02 +00:00
|
|
|
newObject->description.cySize = fontDesc->cySize;
|
|
|
|
newObject->description.sWeight = fontDesc->sWeight;
|
|
|
|
newObject->description.sCharset = fontDesc->sCharset;
|
|
|
|
newObject->description.fItalic = fontDesc->fItalic;
|
|
|
|
newObject->description.fUnderline = fontDesc->fUnderline;
|
|
|
|
newObject->description.fStrikethrough = fontDesc->fStrikethrough;
|
|
|
|
|
|
|
|
newObject->gdiFont = 0;
|
2010-02-02 10:15:39 +00:00
|
|
|
newObject->dirty = TRUE;
|
2011-03-08 00:44:38 +00:00
|
|
|
newObject->cyLogical = GetDeviceCaps(get_dc(), LOGPIXELSY);
|
2007-02-19 21:47:02 +00:00
|
|
|
newObject->cyHimetric = 2540L;
|
|
|
|
newObject->pPropertyNotifyCP = NULL;
|
|
|
|
newObject->pFontEventsCP = NULL;
|
|
|
|
|
2011-08-21 14:13:47 +00:00
|
|
|
CreateConnectionPoint((IUnknown*)&newObject->IFont_iface, &IID_IPropertyNotifySink, &newObject->pPropertyNotifyCP);
|
|
|
|
CreateConnectionPoint((IUnknown*)&newObject->IFont_iface, &IID_IFontEventsDisp, &newObject->pFontEventsCP);
|
2007-02-19 21:47:02 +00:00
|
|
|
|
|
|
|
if (!newObject->pPropertyNotifyCP || !newObject->pFontEventsCP)
|
|
|
|
{
|
|
|
|
OLEFontImpl_Destroy(newObject);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
InterlockedIncrement(&ifont_cnt);
|
|
|
|
|
|
|
|
TRACE("returning %p\n", newObject);
|
|
|
|
return newObject;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* OLEFontImpl_Destroy
|
|
|
|
*
|
|
|
|
* This method is called by the Release method when the reference
|
|
|
|
* count goes down to 0. It will free all resources used by
|
|
|
|
* this object.
|
|
|
|
*/
|
|
|
|
static void OLEFontImpl_Destroy(OLEFontImpl* fontDesc)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", fontDesc);
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, fontDesc->description.lpstrName);
|
|
|
|
|
|
|
|
if (fontDesc->pPropertyNotifyCP)
|
|
|
|
IConnectionPoint_Release(fontDesc->pPropertyNotifyCP);
|
|
|
|
if (fontDesc->pFontEventsCP)
|
|
|
|
IConnectionPoint_Release(fontDesc->pFontEventsCP);
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, fontDesc);
|
|
|
|
}
|
|
|
|
|
2001-07-24 00:59:28 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
* StdFont ClassFactory
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/* IUnknown fields */
|
2010-12-05 14:16:55 +00:00
|
|
|
IClassFactory IClassFactory_iface;
|
|
|
|
LONG ref;
|
2001-07-24 00:59:28 +00:00
|
|
|
} IClassFactoryImpl;
|
|
|
|
|
2010-12-05 14:16:55 +00:00
|
|
|
static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
|
|
|
|
}
|
|
|
|
|
2002-05-31 23:06:46 +00:00
|
|
|
static HRESULT WINAPI
|
2001-07-24 00:59:28 +00:00
|
|
|
SFCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
2010-12-05 14:16:55 +00:00
|
|
|
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
2001-07-24 00:59:28 +00:00
|
|
|
|
|
|
|
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI
|
|
|
|
SFCF_AddRef(LPCLASSFACTORY iface) {
|
2010-12-05 14:16:55 +00:00
|
|
|
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
2004-09-21 00:25:03 +00:00
|
|
|
return InterlockedIncrement(&This->ref);
|
2001-07-24 00:59:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI SFCF_Release(LPCLASSFACTORY iface) {
|
2010-12-05 14:16:55 +00:00
|
|
|
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
2001-07-24 00:59:28 +00:00
|
|
|
/* static class, won't be freed */
|
2004-09-21 00:25:03 +00:00
|
|
|
return InterlockedDecrement(&This->ref);
|
2001-07-24 00:59:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI SFCF_CreateInstance(
|
|
|
|
LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
|
|
|
|
) {
|
2003-06-24 19:21:20 +00:00
|
|
|
return OleCreateFontIndirect(NULL,riid,ppobj);
|
2001-07-24 00:59:28 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI SFCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
2010-12-05 14:16:55 +00:00
|
|
|
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
2001-07-24 00:59:28 +00:00
|
|
|
FIXME("(%p)->(%d),stub!\n",This,dolock);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-06-06 19:50:35 +00:00
|
|
|
static const IClassFactoryVtbl SFCF_Vtbl = {
|
2001-07-24 00:59:28 +00:00
|
|
|
SFCF_QueryInterface,
|
|
|
|
SFCF_AddRef,
|
|
|
|
SFCF_Release,
|
|
|
|
SFCF_CreateInstance,
|
|
|
|
SFCF_LockServer
|
|
|
|
};
|
2010-12-05 14:16:55 +00:00
|
|
|
static IClassFactoryImpl STDFONT_CF = {{&SFCF_Vtbl}, 1 };
|
2001-07-24 00:59:28 +00:00
|
|
|
|
2009-02-09 08:45:52 +00:00
|
|
|
void _get_STDFONT_CF(LPVOID *ppv) { *ppv = &STDFONT_CF; }
|