oleaut32: Use ifaces instead of vtbl pointers in OLEFontImpl.

This commit is contained in:
Michael Stefaniuc 2010-12-16 01:04:22 +01:00 committed by Alexandre Julliard
parent 53af9f2b1e
commit 1fdece9b82
1 changed files with 97 additions and 92 deletions

View File

@ -251,12 +251,12 @@ struct OLEFontImpl
* The first two are supported by the first vtable, the next two are * 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. * supported by the second table and the last two have their own.
*/ */
const IFontVtbl* lpVtbl; IFont IFont_iface;
const IDispatchVtbl* lpvtblIDispatch; IDispatch IDispatch_iface;
const IPersistStreamVtbl* lpvtblIPersistStream; IPersistStream IPersistStream_iface;
const IConnectionPointContainerVtbl* lpvtblIConnectionPointContainer; IConnectionPointContainer IConnectionPointContainer_iface;
const IPersistPropertyBagVtbl* lpvtblIPersistPropertyBag; IPersistPropertyBag IPersistPropertyBag_iface;
const IPersistStreamInitVtbl* lpvtblIPersistStreamInit; IPersistStreamInit IPersistStreamInit_iface;
/* /*
* Reference count for that instance of the class. * Reference count for that instance of the class.
*/ */
@ -289,29 +289,34 @@ struct OLEFontImpl
* by this object. * by this object.
*/ */
static inline OLEFontImpl *impl_from_IFont(IFont *iface)
{
return CONTAINING_RECORD(iface, OLEFontImpl, IFont_iface);
}
static inline OLEFontImpl *impl_from_IDispatch( IDispatch *iface ) static inline OLEFontImpl *impl_from_IDispatch( IDispatch *iface )
{ {
return (OLEFontImpl *)((char*)iface - FIELD_OFFSET(OLEFontImpl, lpvtblIDispatch)); return CONTAINING_RECORD(iface, OLEFontImpl, IDispatch_iface);
} }
static inline OLEFontImpl *impl_from_IPersistStream( IPersistStream *iface ) static inline OLEFontImpl *impl_from_IPersistStream( IPersistStream *iface )
{ {
return (OLEFontImpl *)((char*)iface - FIELD_OFFSET(OLEFontImpl, lpvtblIPersistStream)); return CONTAINING_RECORD(iface, OLEFontImpl, IPersistStream_iface);
} }
static inline OLEFontImpl *impl_from_IConnectionPointContainer( IConnectionPointContainer *iface ) static inline OLEFontImpl *impl_from_IConnectionPointContainer( IConnectionPointContainer *iface )
{ {
return (OLEFontImpl *)((char*)iface - FIELD_OFFSET(OLEFontImpl, lpvtblIConnectionPointContainer)); return CONTAINING_RECORD(iface, OLEFontImpl, IConnectionPointContainer_iface);
} }
static inline OLEFontImpl *impl_from_IPersistPropertyBag( IPersistPropertyBag *iface ) static inline OLEFontImpl *impl_from_IPersistPropertyBag( IPersistPropertyBag *iface )
{ {
return (OLEFontImpl *)((char*)iface - FIELD_OFFSET(OLEFontImpl, lpvtblIPersistPropertyBag)); return CONTAINING_RECORD(iface, OLEFontImpl, IPersistPropertyBag_iface);
} }
static inline OLEFontImpl *impl_from_IPersistStreamInit( IPersistStreamInit *iface ) static inline OLEFontImpl *impl_from_IPersistStreamInit( IPersistStreamInit *iface )
{ {
return (OLEFontImpl *)((char*)iface - FIELD_OFFSET(OLEFontImpl, lpvtblIPersistStreamInit)); return CONTAINING_RECORD(iface, OLEFontImpl, IPersistStreamInit_iface);
} }
@ -371,13 +376,13 @@ HRESULT WINAPI OleCreateFontIndirect(
/* /*
* Make sure it supports the interface required by the caller. * Make sure it supports the interface required by the caller.
*/ */
hr = IFont_QueryInterface((IFont*)newFont, riid, ppvObj); hr = IFont_QueryInterface(&newFont->IFont_iface, riid, ppvObj);
/* /*
* Release the reference obtained in the constructor. If * Release the reference obtained in the constructor. If
* the QueryInterface was unsuccessful, it will free the class. * the QueryInterface was unsuccessful, it will free the class.
*/ */
IFont_Release((IFont*)newFont); IFont_Release(&newFont->IFont_iface);
return hr; return hr;
} }
@ -477,7 +482,7 @@ static HRESULT WINAPI OLEFontImpl_QueryInterface(
REFIID riid, REFIID riid,
void** ppvObject) void** ppvObject)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%s, %p)\n", this, debugstr_guid(riid), ppvObject); TRACE("(%p)->(%s, %p)\n", this, debugstr_guid(riid), ppvObject);
*ppvObject = 0; *ppvObject = 0;
@ -490,17 +495,17 @@ static HRESULT WINAPI OLEFontImpl_QueryInterface(
if (IsEqualGUID(&IID_IFont, riid)) if (IsEqualGUID(&IID_IFont, riid))
*ppvObject = this; *ppvObject = this;
if (IsEqualGUID(&IID_IDispatch, riid)) if (IsEqualGUID(&IID_IDispatch, riid))
*ppvObject = &this->lpvtblIDispatch; *ppvObject = &this->IDispatch_iface;
if (IsEqualGUID(&IID_IFontDisp, riid)) if (IsEqualGUID(&IID_IFontDisp, riid))
*ppvObject = &this->lpvtblIDispatch; *ppvObject = &this->IDispatch_iface;
if (IsEqualIID(&IID_IPersist, riid) || IsEqualGUID(&IID_IPersistStream, riid)) if (IsEqualIID(&IID_IPersist, riid) || IsEqualGUID(&IID_IPersistStream, riid))
*ppvObject = &this->lpvtblIPersistStream; *ppvObject = &this->IPersistStream_iface;
if (IsEqualGUID(&IID_IConnectionPointContainer, riid)) if (IsEqualGUID(&IID_IConnectionPointContainer, riid))
*ppvObject = &this->lpvtblIConnectionPointContainer; *ppvObject = &this->IConnectionPointContainer_iface;
if (IsEqualGUID(&IID_IPersistPropertyBag, riid)) if (IsEqualGUID(&IID_IPersistPropertyBag, riid))
*ppvObject = &this->lpvtblIPersistPropertyBag; *ppvObject = &this->IPersistPropertyBag_iface;
if (IsEqualGUID(&IID_IPersistStreamInit, riid)) if (IsEqualGUID(&IID_IPersistStreamInit, riid))
*ppvObject = &this->lpvtblIPersistStreamInit; *ppvObject = &this->IPersistStreamInit_iface;
/* /*
* Check that we obtained an interface. * Check that we obtained an interface.
@ -510,7 +515,7 @@ static HRESULT WINAPI OLEFontImpl_QueryInterface(
FIXME("() : asking for unsupported interface %s\n",debugstr_guid(riid)); FIXME("() : asking for unsupported interface %s\n",debugstr_guid(riid));
return E_NOINTERFACE; return E_NOINTERFACE;
} }
OLEFontImpl_AddRef((IFont*)this); OLEFontImpl_AddRef(&this->IFont_iface);
return S_OK; return S_OK;
} }
@ -522,7 +527,7 @@ static HRESULT WINAPI OLEFontImpl_QueryInterface(
static ULONG WINAPI OLEFontImpl_AddRef( static ULONG WINAPI OLEFontImpl_AddRef(
IFont* iface) IFont* iface)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(ref=%d)\n", this, this->ref); TRACE("(%p)->(ref=%d)\n", this, this->ref);
return InterlockedIncrement(&this->ref); return InterlockedIncrement(&this->ref);
} }
@ -535,7 +540,7 @@ static ULONG WINAPI OLEFontImpl_AddRef(
static ULONG WINAPI OLEFontImpl_Release( static ULONG WINAPI OLEFontImpl_Release(
IFont* iface) IFont* iface)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
ULONG ret; ULONG ret;
TRACE("(%p)->(ref=%d)\n", this, this->ref); TRACE("(%p)->(ref=%d)\n", this, this->ref);
@ -680,7 +685,7 @@ static HRESULT WINAPI OLEFontImpl_get_Name(
IFont* iface, IFont* iface,
BSTR* pname) BSTR* pname)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%p)\n", this, pname); TRACE("(%p)->(%p)\n", this, pname);
/* /*
* Sanity check. * Sanity check.
@ -707,7 +712,7 @@ static HRESULT WINAPI OLEFontImpl_put_Name(
IFont* iface, IFont* iface,
BSTR name) BSTR name)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%p)\n", this, name); TRACE("(%p)->(%p)\n", this, name);
if (!name) if (!name)
@ -745,7 +750,7 @@ static HRESULT WINAPI OLEFontImpl_get_Size(
IFont* iface, IFont* iface,
CY* psize) CY* psize)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%p)\n", this, psize); TRACE("(%p)->(%p)\n", this, psize);
/* /*
@ -771,7 +776,7 @@ static HRESULT WINAPI OLEFontImpl_put_Size(
IFont* iface, IFont* iface,
CY size) CY size)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%d)\n", this, size.s.Lo); TRACE("(%p)->(%d)\n", this, size.s.Lo);
this->description.cySize.s.Hi = 0; this->description.cySize.s.Hi = 0;
this->description.cySize.s.Lo = size.s.Lo; this->description.cySize.s.Lo = size.s.Lo;
@ -789,7 +794,7 @@ static HRESULT WINAPI OLEFontImpl_get_Bold(
IFont* iface, IFont* iface,
BOOL* pbold) BOOL* pbold)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%p)\n", this, pbold); TRACE("(%p)->(%p)\n", this, pbold);
/* /*
* Sanity check * Sanity check
@ -813,7 +818,7 @@ static HRESULT WINAPI OLEFontImpl_put_Bold(
IFont* iface, IFont* iface,
BOOL bold) BOOL bold)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%d)\n", this, bold); TRACE("(%p)->(%d)\n", this, bold);
this->description.sWeight = bold ? FW_BOLD : FW_NORMAL; this->description.sWeight = bold ? FW_BOLD : FW_NORMAL;
OLEFont_SendNotify(this, DISPID_FONT_BOLD); OLEFont_SendNotify(this, DISPID_FONT_BOLD);
@ -830,7 +835,7 @@ static HRESULT WINAPI OLEFontImpl_get_Italic(
IFont* iface, IFont* iface,
BOOL* pitalic) BOOL* pitalic)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%p)\n", this, pitalic); TRACE("(%p)->(%p)\n", this, pitalic);
/* /*
* Sanity check * Sanity check
@ -854,7 +859,7 @@ static HRESULT WINAPI OLEFontImpl_put_Italic(
IFont* iface, IFont* iface,
BOOL italic) BOOL italic)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%d)\n", this, italic); TRACE("(%p)->(%d)\n", this, italic);
this->description.fItalic = italic; this->description.fItalic = italic;
@ -872,7 +877,7 @@ static HRESULT WINAPI OLEFontImpl_get_Underline(
IFont* iface, IFont* iface,
BOOL* punderline) BOOL* punderline)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%p)\n", this, punderline); TRACE("(%p)->(%p)\n", this, punderline);
/* /*
@ -897,7 +902,7 @@ static HRESULT WINAPI OLEFontImpl_put_Underline(
IFont* iface, IFont* iface,
BOOL underline) BOOL underline)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%d)\n", this, underline); TRACE("(%p)->(%d)\n", this, underline);
this->description.fUnderline = underline; this->description.fUnderline = underline;
@ -915,7 +920,7 @@ static HRESULT WINAPI OLEFontImpl_get_Strikethrough(
IFont* iface, IFont* iface,
BOOL* pstrikethrough) BOOL* pstrikethrough)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%p)\n", this, pstrikethrough); TRACE("(%p)->(%p)\n", this, pstrikethrough);
/* /*
@ -940,7 +945,7 @@ static HRESULT WINAPI OLEFontImpl_put_Strikethrough(
IFont* iface, IFont* iface,
BOOL strikethrough) BOOL strikethrough)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%d)\n", this, strikethrough); TRACE("(%p)->(%d)\n", this, strikethrough);
this->description.fStrikethrough = strikethrough; this->description.fStrikethrough = strikethrough;
@ -958,7 +963,7 @@ static HRESULT WINAPI OLEFontImpl_get_Weight(
IFont* iface, IFont* iface,
short* pweight) short* pweight)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%p)\n", this, pweight); TRACE("(%p)->(%p)\n", this, pweight);
/* /*
@ -983,7 +988,7 @@ static HRESULT WINAPI OLEFontImpl_put_Weight(
IFont* iface, IFont* iface,
short weight) short weight)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%d)\n", this, weight); TRACE("(%p)->(%d)\n", this, weight);
this->description.sWeight = weight; this->description.sWeight = weight;
@ -1001,7 +1006,7 @@ static HRESULT WINAPI OLEFontImpl_get_Charset(
IFont* iface, IFont* iface,
short* pcharset) short* pcharset)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%p)\n", this, pcharset); TRACE("(%p)->(%p)\n", this, pcharset);
/* /*
@ -1026,7 +1031,7 @@ static HRESULT WINAPI OLEFontImpl_put_Charset(
IFont* iface, IFont* iface,
short charset) short charset)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%d)\n", this, charset); TRACE("(%p)->(%d)\n", this, charset);
this->description.sCharset = charset; this->description.sCharset = charset;
@ -1044,7 +1049,7 @@ static HRESULT WINAPI OLEFontImpl_get_hFont(
IFont* iface, IFont* iface,
HFONT* phfont) HFONT* phfont)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%p)\n", this, phfont); TRACE("(%p)->(%p)\n", this, phfont);
if (phfont==NULL) if (phfont==NULL)
return E_POINTER; return E_POINTER;
@ -1066,7 +1071,7 @@ static HRESULT WINAPI OLEFontImpl_Clone(
IFont** ppfont) IFont** ppfont)
{ {
OLEFontImpl* newObject = 0; OLEFontImpl* newObject = 0;
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%p)\n", this, ppfont); TRACE("(%p)->(%p)\n", this, ppfont);
@ -1115,7 +1120,7 @@ static HRESULT WINAPI OLEFontImpl_Clone(
/* The cloned object starts with a reference count of 1 */ /* The cloned object starts with a reference count of 1 */
newObject->ref = 1; newObject->ref = 1;
*ppfont = (IFont*)newObject; *ppfont = &newObject->IFont_iface;
return S_OK; return S_OK;
} }
@ -1129,8 +1134,8 @@ static HRESULT WINAPI OLEFontImpl_IsEqual(
IFont* iface, IFont* iface,
IFont* pFontOther) IFont* pFontOther)
{ {
OLEFontImpl *left = (OLEFontImpl *)iface; OLEFontImpl *left = impl_from_IFont(iface);
OLEFontImpl *right = (OLEFontImpl *)pFontOther; OLEFontImpl *right = impl_from_IFont(pFontOther);
INT ret; INT ret;
INT left_len,right_len; INT left_len,right_len;
@ -1172,7 +1177,7 @@ static HRESULT WINAPI OLEFontImpl_SetRatio(
LONG cyLogical, LONG cyLogical,
LONG cyHimetric) LONG cyHimetric)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%d, %d)\n", this, cyLogical, cyHimetric); TRACE("(%p)->(%d, %d)\n", this, cyLogical, cyHimetric);
this->cyLogical = cyLogical; this->cyLogical = cyLogical;
@ -1211,7 +1216,7 @@ static HRESULT WINAPI OLEFontImpl_AddRefHfont(
IFont* iface, IFont* iface,
HFONT hfont) HFONT hfont)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%p)\n", this, hfont); TRACE("(%p)->(%p)\n", this, hfont);
@ -1229,7 +1234,7 @@ static HRESULT WINAPI OLEFontImpl_ReleaseHfont(
IFont* iface, IFont* iface,
HFONT hfont) HFONT hfont)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
TRACE("(%p)->(%p)\n", this, hfont); TRACE("(%p)->(%p)\n", this, hfont);
@ -1247,7 +1252,7 @@ static HRESULT WINAPI OLEFontImpl_SetHdc(
IFont* iface, IFont* iface,
HDC hdc) HDC hdc)
{ {
OLEFontImpl *this = (OLEFontImpl *)iface; OLEFontImpl *this = impl_from_IFont(iface);
FIXME("(%p)->(%p): Stub\n", this, hdc); FIXME("(%p)->(%p): Stub\n", this, hdc);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -1298,7 +1303,7 @@ static HRESULT WINAPI OLEFontImpl_IDispatch_QueryInterface(
{ {
OLEFontImpl *this = impl_from_IDispatch(iface); OLEFontImpl *this = impl_from_IDispatch(iface);
return IFont_QueryInterface((IFont *)this, riid, ppvoid); return IFont_QueryInterface(&this->IFont_iface, riid, ppvoid);
} }
/************************************************************************ /************************************************************************
@ -1311,7 +1316,7 @@ static ULONG WINAPI OLEFontImpl_IDispatch_Release(
{ {
OLEFontImpl *this = impl_from_IDispatch(iface); OLEFontImpl *this = impl_from_IDispatch(iface);
return IFont_Release((IFont *)this); return IFont_Release(&this->IFont_iface);
} }
/************************************************************************ /************************************************************************
@ -1324,7 +1329,7 @@ static ULONG WINAPI OLEFontImpl_IDispatch_AddRef(
{ {
OLEFontImpl *this = impl_from_IDispatch(iface); OLEFontImpl *this = impl_from_IDispatch(iface);
return IFont_AddRef((IFont *)this); return IFont_AddRef(&this->IFont_iface);
} }
/************************************************************************ /************************************************************************
@ -1485,7 +1490,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
case DISPID_FONT_NAME: case DISPID_FONT_NAME:
if (wFlags & DISPATCH_PROPERTYGET) { if (wFlags & DISPATCH_PROPERTYGET) {
V_VT(pVarResult) = VT_BSTR; V_VT(pVarResult) = VT_BSTR;
return IFont_get_Name((IFont *)this, &V_BSTR(pVarResult)); return IFont_get_Name(&this->IFont_iface, &V_BSTR(pVarResult));
} else { } else {
VARIANTARG vararg; VARIANTARG vararg;
@ -1494,7 +1499,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
hr = IFont_put_Name((IFont *)this, V_BSTR(&vararg)); hr = IFont_put_Name(&this->IFont_iface, V_BSTR(&vararg));
VariantClear(&vararg); VariantClear(&vararg);
return hr; return hr;
@ -1503,7 +1508,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
case DISPID_FONT_BOLD: case DISPID_FONT_BOLD:
if (wFlags & DISPATCH_PROPERTYGET) { if (wFlags & DISPATCH_PROPERTYGET) {
BOOL value; BOOL value;
hr = IFont_get_Bold((IFont *)this, &value); hr = IFont_get_Bold(&this->IFont_iface, &value);
V_VT(pVarResult) = VT_BOOL; V_VT(pVarResult) = VT_BOOL;
V_BOOL(pVarResult) = value ? VARIANT_TRUE : VARIANT_FALSE; V_BOOL(pVarResult) = value ? VARIANT_TRUE : VARIANT_FALSE;
return hr; return hr;
@ -1515,7 +1520,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
hr = IFont_put_Bold((IFont *)this, V_BOOL(&vararg)); hr = IFont_put_Bold(&this->IFont_iface, V_BOOL(&vararg));
VariantClear(&vararg); VariantClear(&vararg);
return hr; return hr;
@ -1524,7 +1529,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
case DISPID_FONT_ITALIC: case DISPID_FONT_ITALIC:
if (wFlags & DISPATCH_PROPERTYGET) { if (wFlags & DISPATCH_PROPERTYGET) {
BOOL value; BOOL value;
hr = IFont_get_Italic((IFont *)this, &value); hr = IFont_get_Italic(&this->IFont_iface, &value);
V_VT(pVarResult) = VT_BOOL; V_VT(pVarResult) = VT_BOOL;
V_BOOL(pVarResult) = value ? VARIANT_TRUE : VARIANT_FALSE; V_BOOL(pVarResult) = value ? VARIANT_TRUE : VARIANT_FALSE;
return hr; return hr;
@ -1536,7 +1541,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
hr = IFont_put_Italic((IFont *)this, V_BOOL(&vararg)); hr = IFont_put_Italic(&this->IFont_iface, V_BOOL(&vararg));
VariantClear(&vararg); VariantClear(&vararg);
return hr; return hr;
@ -1545,7 +1550,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
case DISPID_FONT_UNDER: case DISPID_FONT_UNDER:
if (wFlags & DISPATCH_PROPERTYGET) { if (wFlags & DISPATCH_PROPERTYGET) {
BOOL value; BOOL value;
hr = IFont_get_Underline((IFont *)this, &value); hr = IFont_get_Underline(&this->IFont_iface, &value);
V_VT(pVarResult) = VT_BOOL; V_VT(pVarResult) = VT_BOOL;
V_BOOL(pVarResult) = value ? VARIANT_TRUE : VARIANT_FALSE; V_BOOL(pVarResult) = value ? VARIANT_TRUE : VARIANT_FALSE;
return hr; return hr;
@ -1557,7 +1562,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
hr = IFont_put_Underline((IFont *)this, V_BOOL(&vararg)); hr = IFont_put_Underline(&this->IFont_iface, V_BOOL(&vararg));
VariantClear(&vararg); VariantClear(&vararg);
return hr; return hr;
@ -1566,7 +1571,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
case DISPID_FONT_STRIKE: case DISPID_FONT_STRIKE:
if (wFlags & DISPATCH_PROPERTYGET) { if (wFlags & DISPATCH_PROPERTYGET) {
BOOL value; BOOL value;
hr = IFont_get_Strikethrough((IFont *)this, &value); hr = IFont_get_Strikethrough(&this->IFont_iface, &value);
V_VT(pVarResult) = VT_BOOL; V_VT(pVarResult) = VT_BOOL;
V_BOOL(pVarResult) = value ? VARIANT_TRUE : VARIANT_FALSE; V_BOOL(pVarResult) = value ? VARIANT_TRUE : VARIANT_FALSE;
return hr; return hr;
@ -1578,7 +1583,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
hr = IFont_put_Strikethrough((IFont *)this, V_BOOL(&vararg)); hr = IFont_put_Strikethrough(&this->IFont_iface, V_BOOL(&vararg));
VariantClear(&vararg); VariantClear(&vararg);
return hr; return hr;
@ -1587,7 +1592,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
case DISPID_FONT_SIZE: case DISPID_FONT_SIZE:
if (wFlags & DISPATCH_PROPERTYGET) { if (wFlags & DISPATCH_PROPERTYGET) {
V_VT(pVarResult) = VT_CY; V_VT(pVarResult) = VT_CY;
return OLEFontImpl_get_Size((IFont *)this, &V_CY(pVarResult)); return OLEFontImpl_get_Size(&this->IFont_iface, &V_CY(pVarResult));
} else { } else {
VARIANTARG vararg; VARIANTARG vararg;
@ -1596,7 +1601,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
hr = IFont_put_Size((IFont *)this, V_CY(&vararg)); hr = IFont_put_Size(&this->IFont_iface, V_CY(&vararg));
VariantClear(&vararg); VariantClear(&vararg);
return hr; return hr;
@ -1605,7 +1610,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
case DISPID_FONT_WEIGHT: case DISPID_FONT_WEIGHT:
if (wFlags & DISPATCH_PROPERTYGET) { if (wFlags & DISPATCH_PROPERTYGET) {
V_VT(pVarResult) = VT_I2; V_VT(pVarResult) = VT_I2;
return OLEFontImpl_get_Weight((IFont *)this, &V_I2(pVarResult)); return OLEFontImpl_get_Weight(&this->IFont_iface, &V_I2(pVarResult));
} else { } else {
VARIANTARG vararg; VARIANTARG vararg;
@ -1614,7 +1619,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
hr = IFont_put_Weight((IFont *)this, V_I2(&vararg)); hr = IFont_put_Weight(&this->IFont_iface, V_I2(&vararg));
VariantClear(&vararg); VariantClear(&vararg);
return hr; return hr;
@ -1623,7 +1628,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
case DISPID_FONT_CHARSET: case DISPID_FONT_CHARSET:
if (wFlags & DISPATCH_PROPERTYGET) { if (wFlags & DISPATCH_PROPERTYGET) {
V_VT(pVarResult) = VT_I2; V_VT(pVarResult) = VT_I2;
return OLEFontImpl_get_Charset((IFont *)this, &V_I2(pVarResult)); return OLEFontImpl_get_Charset(&this->IFont_iface, &V_I2(pVarResult));
} else { } else {
VARIANTARG vararg; VARIANTARG vararg;
@ -1632,7 +1637,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
hr = IFont_put_Charset((IFont *)this, V_I2(&vararg)); hr = IFont_put_Charset(&this->IFont_iface, V_I2(&vararg));
VariantClear(&vararg); VariantClear(&vararg);
return hr; return hr;
@ -1667,7 +1672,7 @@ static HRESULT WINAPI OLEFontImpl_IPersistStream_QueryInterface(
{ {
OLEFontImpl *this = impl_from_IPersistStream(iface); OLEFontImpl *this = impl_from_IPersistStream(iface);
return IFont_QueryInterface((IFont *)this, riid, ppvoid); return IFont_QueryInterface(&this->IFont_iface, riid, ppvoid);
} }
/************************************************************************ /************************************************************************
@ -1680,7 +1685,7 @@ static ULONG WINAPI OLEFontImpl_IPersistStream_Release(
{ {
OLEFontImpl *this = impl_from_IPersistStream(iface); OLEFontImpl *this = impl_from_IPersistStream(iface);
return IFont_Release((IFont *)this); return IFont_Release(&this->IFont_iface);
} }
/************************************************************************ /************************************************************************
@ -1693,7 +1698,7 @@ static ULONG WINAPI OLEFontImpl_IPersistStream_AddRef(
{ {
OLEFontImpl *this = impl_from_IPersistStream(iface); OLEFontImpl *this = impl_from_IPersistStream(iface);
return IFont_AddRef((IFont *)this); return IFont_AddRef(&this->IFont_iface);
} }
/************************************************************************ /************************************************************************
@ -1991,7 +1996,7 @@ static HRESULT WINAPI OLEFontImpl_IConnectionPointContainer_QueryInterface(
{ {
OLEFontImpl *this = impl_from_IConnectionPointContainer(iface); OLEFontImpl *this = impl_from_IConnectionPointContainer(iface);
return IFont_QueryInterface((IFont*)this, riid, ppvoid); return IFont_QueryInterface(&this->IFont_iface, riid, ppvoid);
} }
/************************************************************************ /************************************************************************
@ -2004,7 +2009,7 @@ static ULONG WINAPI OLEFontImpl_IConnectionPointContainer_Release(
{ {
OLEFontImpl *this = impl_from_IConnectionPointContainer(iface); OLEFontImpl *this = impl_from_IConnectionPointContainer(iface);
return IFont_Release((IFont*)this); return IFont_Release(&this->IFont_iface);
} }
/************************************************************************ /************************************************************************
@ -2017,7 +2022,7 @@ static ULONG WINAPI OLEFontImpl_IConnectionPointContainer_AddRef(
{ {
OLEFontImpl *this = impl_from_IConnectionPointContainer(iface); OLEFontImpl *this = impl_from_IConnectionPointContainer(iface);
return IFont_AddRef((IFont*)this); return IFont_AddRef(&this->IFont_iface);
} }
/************************************************************************ /************************************************************************
@ -2081,21 +2086,21 @@ static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_QueryInterface(
IPersistPropertyBag *iface, REFIID riid, LPVOID *ppvObj IPersistPropertyBag *iface, REFIID riid, LPVOID *ppvObj
) { ) {
OLEFontImpl *this = impl_from_IPersistPropertyBag(iface); OLEFontImpl *this = impl_from_IPersistPropertyBag(iface);
return IFont_QueryInterface((IFont *)this,riid,ppvObj); return IFont_QueryInterface(&this->IFont_iface,riid,ppvObj);
} }
static ULONG WINAPI OLEFontImpl_IPersistPropertyBag_AddRef( static ULONG WINAPI OLEFontImpl_IPersistPropertyBag_AddRef(
IPersistPropertyBag *iface IPersistPropertyBag *iface
) { ) {
OLEFontImpl *this = impl_from_IPersistPropertyBag(iface); OLEFontImpl *this = impl_from_IPersistPropertyBag(iface);
return IFont_AddRef((IFont *)this); return IFont_AddRef(&this->IFont_iface);
} }
static ULONG WINAPI OLEFontImpl_IPersistPropertyBag_Release( static ULONG WINAPI OLEFontImpl_IPersistPropertyBag_Release(
IPersistPropertyBag *iface IPersistPropertyBag *iface
) { ) {
OLEFontImpl *this = impl_from_IPersistPropertyBag(iface); OLEFontImpl *this = impl_from_IPersistPropertyBag(iface);
return IFont_Release((IFont *)this); return IFont_Release(&this->IFont_iface);
} }
static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_GetClassID( static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_GetClassID(
@ -2142,7 +2147,7 @@ static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Load(
{ {
iRes = VariantChangeType(&value, &value, 0, VT_BSTR); iRes = VariantChangeType(&value, &value, 0, VT_BSTR);
if (iRes == S_OK) if (iRes == S_OK)
iRes = IFont_put_Name((IFont *)this, V_BSTR(&value)); iRes = IFont_put_Name(&this->IFont_iface, V_BSTR(&value));
} }
else if (iRes == E_INVALIDARG) else if (iRes == E_INVALIDARG)
iRes = S_OK; iRes = S_OK;
@ -2155,7 +2160,7 @@ static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Load(
{ {
iRes = VariantChangeType(&value, &value, 0, VT_CY); iRes = VariantChangeType(&value, &value, 0, VT_CY);
if (iRes == S_OK) if (iRes == S_OK)
iRes = IFont_put_Size((IFont *)this, V_CY(&value)); iRes = IFont_put_Size(&this->IFont_iface, V_CY(&value));
} }
else if (iRes == E_INVALIDARG) else if (iRes == E_INVALIDARG)
iRes = S_OK; iRes = S_OK;
@ -2169,7 +2174,7 @@ static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Load(
{ {
iRes = VariantChangeType(&value, &value, 0, VT_I2); iRes = VariantChangeType(&value, &value, 0, VT_I2);
if (iRes == S_OK) if (iRes == S_OK)
iRes = IFont_put_Charset((IFont *)this, V_I2(&value)); iRes = IFont_put_Charset(&this->IFont_iface, V_I2(&value));
} }
else if (iRes == E_INVALIDARG) else if (iRes == E_INVALIDARG)
iRes = S_OK; iRes = S_OK;
@ -2183,7 +2188,7 @@ static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Load(
{ {
iRes = VariantChangeType(&value, &value, 0, VT_I2); iRes = VariantChangeType(&value, &value, 0, VT_I2);
if (iRes == S_OK) if (iRes == S_OK)
iRes = IFont_put_Weight((IFont *)this, V_I2(&value)); iRes = IFont_put_Weight(&this->IFont_iface, V_I2(&value));
} }
else if (iRes == E_INVALIDARG) else if (iRes == E_INVALIDARG)
iRes = S_OK; iRes = S_OK;
@ -2197,7 +2202,7 @@ static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Load(
{ {
iRes = VariantChangeType(&value, &value, 0, VT_BOOL); iRes = VariantChangeType(&value, &value, 0, VT_BOOL);
if (iRes == S_OK) if (iRes == S_OK)
iRes = IFont_put_Underline((IFont *)this, V_BOOL(&value)); iRes = IFont_put_Underline(&this->IFont_iface, V_BOOL(&value));
} }
else if (iRes == E_INVALIDARG) else if (iRes == E_INVALIDARG)
iRes = S_OK; iRes = S_OK;
@ -2211,7 +2216,7 @@ static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Load(
{ {
iRes = VariantChangeType(&value, &value, 0, VT_BOOL); iRes = VariantChangeType(&value, &value, 0, VT_BOOL);
if (iRes == S_OK) if (iRes == S_OK)
iRes = IFont_put_Italic((IFont *)this, V_BOOL(&value)); iRes = IFont_put_Italic(&this->IFont_iface, V_BOOL(&value));
} }
else if (iRes == E_INVALIDARG) else if (iRes == E_INVALIDARG)
iRes = S_OK; iRes = S_OK;
@ -2225,7 +2230,7 @@ static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Load(
{ {
iRes = VariantChangeType(&value, &value, 0, VT_BOOL); iRes = VariantChangeType(&value, &value, 0, VT_BOOL);
if (iRes == S_OK) if (iRes == S_OK)
IFont_put_Strikethrough((IFont *)this, V_BOOL(&value)); IFont_put_Strikethrough(&this->IFont_iface, V_BOOL(&value));
} }
else if (iRes == E_INVALIDARG) else if (iRes == E_INVALIDARG)
iRes = S_OK; iRes = S_OK;
@ -2265,21 +2270,21 @@ static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_QueryInterface(
IPersistStreamInit *iface, REFIID riid, LPVOID *ppvObj IPersistStreamInit *iface, REFIID riid, LPVOID *ppvObj
) { ) {
OLEFontImpl *this = impl_from_IPersistStreamInit(iface); OLEFontImpl *this = impl_from_IPersistStreamInit(iface);
return IFont_QueryInterface((IFont *)this,riid,ppvObj); return IFont_QueryInterface(&this->IFont_iface,riid,ppvObj);
} }
static ULONG WINAPI OLEFontImpl_IPersistStreamInit_AddRef( static ULONG WINAPI OLEFontImpl_IPersistStreamInit_AddRef(
IPersistStreamInit *iface IPersistStreamInit *iface
) { ) {
OLEFontImpl *this = impl_from_IPersistStreamInit(iface); OLEFontImpl *this = impl_from_IPersistStreamInit(iface);
return IFont_AddRef((IFont *)this); return IFont_AddRef(&this->IFont_iface);
} }
static ULONG WINAPI OLEFontImpl_IPersistStreamInit_Release( static ULONG WINAPI OLEFontImpl_IPersistStreamInit_Release(
IPersistStreamInit *iface IPersistStreamInit *iface
) { ) {
OLEFontImpl *this = impl_from_IPersistStreamInit(iface); OLEFontImpl *this = impl_from_IPersistStreamInit(iface);
return IFont_Release((IFont *)this); return IFont_Release(&this->IFont_iface);
} }
static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_GetClassID( static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_GetClassID(
@ -2362,12 +2367,12 @@ static OLEFontImpl* OLEFontImpl_Construct(const FONTDESC *fontDesc)
/* /*
* Initialize the virtual function table. * Initialize the virtual function table.
*/ */
newObject->lpVtbl = &OLEFontImpl_VTable; newObject->IFont_iface.lpVtbl = &OLEFontImpl_VTable;
newObject->lpvtblIDispatch = &OLEFontImpl_IDispatch_VTable; newObject->IDispatch_iface.lpVtbl = &OLEFontImpl_IDispatch_VTable;
newObject->lpvtblIPersistStream = &OLEFontImpl_IPersistStream_VTable; newObject->IPersistStream_iface.lpVtbl = &OLEFontImpl_IPersistStream_VTable;
newObject->lpvtblIConnectionPointContainer = &OLEFontImpl_IConnectionPointContainer_VTable; newObject->IConnectionPointContainer_iface.lpVtbl = &OLEFontImpl_IConnectionPointContainer_VTable;
newObject->lpvtblIPersistPropertyBag = &OLEFontImpl_IPersistPropertyBag_VTable; newObject->IPersistPropertyBag_iface.lpVtbl = &OLEFontImpl_IPersistPropertyBag_VTable;
newObject->lpvtblIPersistStreamInit = &OLEFontImpl_IPersistStreamInit_VTable; newObject->IPersistStreamInit_iface.lpVtbl = &OLEFontImpl_IPersistStreamInit_VTable;
/* /*
* Start with one reference count. The caller of this function * Start with one reference count. The caller of this function