Commit 2bef3ad2 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

mshtml: Use an iface instead of a vtbl pointer in UndoManager.

parent 2c04cfdb
...@@ -35,27 +35,28 @@ ...@@ -35,27 +35,28 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml); WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
typedef struct { typedef struct {
const IOleUndoManagerVtbl *lpOleUndoManagerVtbl; IOleUndoManager IOleUndoManager_iface;
LONG ref; LONG ref;
} UndoManager; } UndoManager;
#define UNDOMGR(x) ((IOleUndoManager*) &(x)->lpOleUndoManagerVtbl) static inline UndoManager *impl_from_IOleUndoManager(IOleUndoManager *iface)
{
#define UNDOMGR_THIS(iface) DEFINE_THIS(UndoManager, OleUndoManager, iface) return CONTAINING_RECORD(iface, UndoManager, IOleUndoManager_iface);
}
static HRESULT WINAPI OleUndoManager_QueryInterface(IOleUndoManager *iface, REFIID riid, void **ppv) static HRESULT WINAPI OleUndoManager_QueryInterface(IOleUndoManager *iface, REFIID riid, void **ppv)
{ {
UndoManager *This = UNDOMGR_THIS(iface); UndoManager *This = impl_from_IOleUndoManager(iface);
*ppv = NULL; *ppv = NULL;
if(IsEqualGUID(riid, &IID_IUnknown)) { if(IsEqualGUID(riid, &IID_IUnknown)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
*ppv = UNDOMGR(This); *ppv = &This->IOleUndoManager_iface;
}else if(IsEqualGUID(riid, &IID_IOleUndoManager)) { }else if(IsEqualGUID(riid, &IID_IOleUndoManager)) {
TRACE("(%p)->(IID_IOleUndoManager %p)\n", This, ppv); TRACE("(%p)->(IID_IOleUndoManager %p)\n", This, ppv);
*ppv = UNDOMGR(This); *ppv = &This->IOleUndoManager_iface;
} }
...@@ -65,7 +66,7 @@ static HRESULT WINAPI OleUndoManager_QueryInterface(IOleUndoManager *iface, REFI ...@@ -65,7 +66,7 @@ static HRESULT WINAPI OleUndoManager_QueryInterface(IOleUndoManager *iface, REFI
static ULONG WINAPI OleUndoManager_AddRef(IOleUndoManager *iface) static ULONG WINAPI OleUndoManager_AddRef(IOleUndoManager *iface)
{ {
UndoManager *This = UNDOMGR_THIS(iface); UndoManager *This = impl_from_IOleUndoManager(iface);
LONG ref = InterlockedIncrement(&This->ref); LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref); TRACE("(%p) ref=%d\n", This, ref);
...@@ -75,7 +76,7 @@ static ULONG WINAPI OleUndoManager_AddRef(IOleUndoManager *iface) ...@@ -75,7 +76,7 @@ static ULONG WINAPI OleUndoManager_AddRef(IOleUndoManager *iface)
static ULONG WINAPI OleUndoManager_Release(IOleUndoManager *iface) static ULONG WINAPI OleUndoManager_Release(IOleUndoManager *iface)
{ {
UndoManager *This = UNDOMGR_THIS(iface); UndoManager *This = impl_from_IOleUndoManager(iface);
LONG ref = InterlockedDecrement(&This->ref); LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref); TRACE("(%p) ref=%d\n", This, ref);
...@@ -88,7 +89,7 @@ static ULONG WINAPI OleUndoManager_Release(IOleUndoManager *iface) ...@@ -88,7 +89,7 @@ static ULONG WINAPI OleUndoManager_Release(IOleUndoManager *iface)
static HRESULT WINAPI OleUndoManager_Open(IOleUndoManager *iface, IOleParentUndoUnit *pPUU) static HRESULT WINAPI OleUndoManager_Open(IOleUndoManager *iface, IOleParentUndoUnit *pPUU)
{ {
UndoManager *This = UNDOMGR_THIS(iface); UndoManager *This = impl_from_IOleUndoManager(iface);
FIXME("(%p)->(%p)\n", This, pPUU); FIXME("(%p)->(%p)\n", This, pPUU);
return E_NOTIMPL; return E_NOTIMPL;
} }
...@@ -96,42 +97,42 @@ static HRESULT WINAPI OleUndoManager_Open(IOleUndoManager *iface, IOleParentUndo ...@@ -96,42 +97,42 @@ static HRESULT WINAPI OleUndoManager_Open(IOleUndoManager *iface, IOleParentUndo
static HRESULT WINAPI OleUndoManager_Close(IOleUndoManager *iface, IOleParentUndoUnit *pPUU, static HRESULT WINAPI OleUndoManager_Close(IOleUndoManager *iface, IOleParentUndoUnit *pPUU,
BOOL fCommit) BOOL fCommit)
{ {
UndoManager *This = UNDOMGR_THIS(iface); UndoManager *This = impl_from_IOleUndoManager(iface);
FIXME("(%p)->(%p %x)\n", This, pPUU, fCommit); FIXME("(%p)->(%p %x)\n", This, pPUU, fCommit);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI OleUndoManager_Add(IOleUndoManager *iface, IOleUndoUnit *pUU) static HRESULT WINAPI OleUndoManager_Add(IOleUndoManager *iface, IOleUndoUnit *pUU)
{ {
UndoManager *This = UNDOMGR_THIS(iface); UndoManager *This = impl_from_IOleUndoManager(iface);
FIXME("(%p)->(%p)\n", This, pUU); FIXME("(%p)->(%p)\n", This, pUU);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI OleUndoManager_GetOpenParentState(IOleUndoManager *iface, DWORD *pdwState) static HRESULT WINAPI OleUndoManager_GetOpenParentState(IOleUndoManager *iface, DWORD *pdwState)
{ {
UndoManager *This = UNDOMGR_THIS(iface); UndoManager *This = impl_from_IOleUndoManager(iface);
FIXME("(%p)->(%p)\n", This, pdwState); FIXME("(%p)->(%p)\n", This, pdwState);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI OleUndoManager_DiscardFrom(IOleUndoManager *iface, IOleUndoUnit *pUU) static HRESULT WINAPI OleUndoManager_DiscardFrom(IOleUndoManager *iface, IOleUndoUnit *pUU)
{ {
UndoManager *This = UNDOMGR_THIS(iface); UndoManager *This = impl_from_IOleUndoManager(iface);
FIXME("(%p)->(%p)\n", This, pUU); FIXME("(%p)->(%p)\n", This, pUU);
return S_OK; return S_OK;
} }
static HRESULT WINAPI OleUndoManager_UndoTo(IOleUndoManager *iface, IOleUndoUnit *pUU) static HRESULT WINAPI OleUndoManager_UndoTo(IOleUndoManager *iface, IOleUndoUnit *pUU)
{ {
UndoManager *This = UNDOMGR_THIS(iface); UndoManager *This = impl_from_IOleUndoManager(iface);
FIXME("(%p)->(%p)\n", This, pUU); FIXME("(%p)->(%p)\n", This, pUU);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI OleUndoManager_RedoTo(IOleUndoManager *iface, IOleUndoUnit *pUU) static HRESULT WINAPI OleUndoManager_RedoTo(IOleUndoManager *iface, IOleUndoUnit *pUU)
{ {
UndoManager *This = UNDOMGR_THIS(iface); UndoManager *This = impl_from_IOleUndoManager(iface);
FIXME("(%p)->(%p)\n", This, pUU); FIXME("(%p)->(%p)\n", This, pUU);
return E_NOTIMPL; return E_NOTIMPL;
} }
...@@ -139,7 +140,7 @@ static HRESULT WINAPI OleUndoManager_RedoTo(IOleUndoManager *iface, IOleUndoUnit ...@@ -139,7 +140,7 @@ static HRESULT WINAPI OleUndoManager_RedoTo(IOleUndoManager *iface, IOleUndoUnit
static HRESULT WINAPI OleUndoManager_EnumUndoable(IOleUndoManager *iface, static HRESULT WINAPI OleUndoManager_EnumUndoable(IOleUndoManager *iface,
IEnumOleUndoUnits **ppEnum) IEnumOleUndoUnits **ppEnum)
{ {
UndoManager *This = UNDOMGR_THIS(iface); UndoManager *This = impl_from_IOleUndoManager(iface);
FIXME("(%p)->(%p)\n", This, ppEnum); FIXME("(%p)->(%p)\n", This, ppEnum);
return E_NOTIMPL; return E_NOTIMPL;
} }
...@@ -147,34 +148,32 @@ static HRESULT WINAPI OleUndoManager_EnumUndoable(IOleUndoManager *iface, ...@@ -147,34 +148,32 @@ static HRESULT WINAPI OleUndoManager_EnumUndoable(IOleUndoManager *iface,
static HRESULT WINAPI OleUndoManager_EnumRedoable(IOleUndoManager *iface, static HRESULT WINAPI OleUndoManager_EnumRedoable(IOleUndoManager *iface,
IEnumOleUndoUnits **ppEnum) IEnumOleUndoUnits **ppEnum)
{ {
UndoManager *This = UNDOMGR_THIS(iface); UndoManager *This = impl_from_IOleUndoManager(iface);
FIXME("(%p)->(%p)\n", This, ppEnum); FIXME("(%p)->(%p)\n", This, ppEnum);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI OleUndoManager_GetLastUndoDescription(IOleUndoManager *iface, BSTR *pBstr) static HRESULT WINAPI OleUndoManager_GetLastUndoDescription(IOleUndoManager *iface, BSTR *pBstr)
{ {
UndoManager *This = UNDOMGR_THIS(iface); UndoManager *This = impl_from_IOleUndoManager(iface);
FIXME("(%p)->(%p)\n", This, pBstr); FIXME("(%p)->(%p)\n", This, pBstr);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI OleUndoManager_GetLastRedoDescription(IOleUndoManager *iface, BSTR *pBstr) static HRESULT WINAPI OleUndoManager_GetLastRedoDescription(IOleUndoManager *iface, BSTR *pBstr)
{ {
UndoManager *This = UNDOMGR_THIS(iface); UndoManager *This = impl_from_IOleUndoManager(iface);
FIXME("(%p)->(%p)\n", This, pBstr); FIXME("(%p)->(%p)\n", This, pBstr);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI OleUndoManager_Enable(IOleUndoManager *iface, BOOL fEnable) static HRESULT WINAPI OleUndoManager_Enable(IOleUndoManager *iface, BOOL fEnable)
{ {
UndoManager *This = UNDOMGR_THIS(iface); UndoManager *This = impl_from_IOleUndoManager(iface);
FIXME("(%p)->(%x)\n", This, fEnable); FIXME("(%p)->(%x)\n", This, fEnable);
return E_NOTIMPL; return E_NOTIMPL;
} }
#undef UNDOMGR_THIS
static const IOleUndoManagerVtbl OleUndoManagerVtbl = { static const IOleUndoManagerVtbl OleUndoManagerVtbl = {
OleUndoManager_QueryInterface, OleUndoManager_QueryInterface,
OleUndoManager_AddRef, OleUndoManager_AddRef,
...@@ -197,10 +196,10 @@ static IOleUndoManager *create_undomgr(void) ...@@ -197,10 +196,10 @@ static IOleUndoManager *create_undomgr(void)
{ {
UndoManager *ret = heap_alloc(sizeof(UndoManager)); UndoManager *ret = heap_alloc(sizeof(UndoManager));
ret->lpOleUndoManagerVtbl = &OleUndoManagerVtbl; ret->IOleUndoManager_iface.lpVtbl = &OleUndoManagerVtbl;
ret->ref = 1; ret->ref = 1;
return UNDOMGR(ret); return &ret->IOleUndoManager_iface;
} }
/********************************************************** /**********************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment