riched20: COM cleanup for the IOleClientSite iface.

This commit is contained in:
Michael Stefaniuc 2011-05-18 23:45:15 +02:00 committed by Alexandre Julliard
parent 2706e4dbaf
commit b1ae962997
1 changed files with 33 additions and 35 deletions

View File

@ -72,7 +72,7 @@ struct ITextSelectionImpl {
}; };
struct IOleClientSiteImpl { struct IOleClientSiteImpl {
const IOleClientSiteVtbl *lpVtbl; IOleClientSite IOleClientSite_iface;
LONG ref; LONG ref;
IRichEditOleImpl *reOle; IRichEditOleImpl *reOle;
@ -135,7 +135,7 @@ IRichEditOle_fnRelease(IRichEditOle *me)
TRACE ("Destroying %p\n", This); TRACE ("Destroying %p\n", This);
This->txtSel->reOle = NULL; This->txtSel->reOle = NULL;
ITextSelection_Release(&This->txtSel->ITextSelection_iface); ITextSelection_Release(&This->txtSel->ITextSelection_iface);
IOleClientSite_Release((IOleClientSite *) This->clientSite); IOleClientSite_Release(&This->clientSite->IOleClientSite_iface);
heap_free(This); heap_free(This);
} }
return ref; return ref;
@ -166,6 +166,11 @@ IRichEditOle_fnConvertObject(IRichEditOle *me, LONG iob,
return E_NOTIMPL; return E_NOTIMPL;
} }
static inline IOleClientSiteImpl *impl_from_IOleClientSite(IOleClientSite *iface)
{
return CONTAINING_RECORD(iface, IOleClientSiteImpl, IOleClientSite_iface);
}
static HRESULT WINAPI static HRESULT WINAPI
IOleClientSite_fnQueryInterface(IOleClientSite *me, REFIID riid, LPVOID *ppvObj) IOleClientSite_fnQueryInterface(IOleClientSite *me, REFIID riid, LPVOID *ppvObj)
{ {
@ -185,88 +190,81 @@ IOleClientSite_fnQueryInterface(IOleClientSite *me, REFIID riid, LPVOID *ppvObj)
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI static ULONG WINAPI IOleClientSite_fnAddRef(IOleClientSite *iface)
IOleClientSite_fnAddRef(IOleClientSite *me)
{ {
IOleClientSiteImpl *This = (IOleClientSiteImpl *) me; IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
return InterlockedIncrement(&This->ref); return InterlockedIncrement(&This->ref);
} }
static ULONG WINAPI static ULONG WINAPI IOleClientSite_fnRelease(IOleClientSite *iface)
IOleClientSite_fnRelease(IOleClientSite *me)
{ {
IOleClientSiteImpl *This = (IOleClientSiteImpl *) me; IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&This->ref);
if (ref == 0) if (ref == 0)
heap_free(This); heap_free(This);
return ref; return ref;
} }
static HRESULT WINAPI static HRESULT WINAPI IOleClientSite_fnSaveObject(IOleClientSite *iface)
IOleClientSite_fnSaveObject(IOleClientSite *me)
{ {
IOleClientSiteImpl *This = (IOleClientSiteImpl *) me; IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
if (!This->reOle) if (!This->reOle)
return CO_E_RELEASED; return CO_E_RELEASED;
FIXME("stub %p\n",me); FIXME("stub %p\n", iface);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI static HRESULT WINAPI IOleClientSite_fnGetMoniker(IOleClientSite *iface, DWORD dwAssign,
IOleClientSite_fnGetMoniker(IOleClientSite *me, DWORD dwAssign, DWORD dwWhichMoniker, DWORD dwWhichMoniker, IMoniker **ppmk)
IMoniker **ppmk)
{ {
IOleClientSiteImpl *This = (IOleClientSiteImpl *) me; IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
if (!This->reOle) if (!This->reOle)
return CO_E_RELEASED; return CO_E_RELEASED;
FIXME("stub %p\n",me); FIXME("stub %p\n", iface);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI static HRESULT WINAPI IOleClientSite_fnGetContainer(IOleClientSite *iface,
IOleClientSite_fnGetContainer(IOleClientSite *me, IOleContainer **ppContainer) IOleContainer **ppContainer)
{ {
IOleClientSiteImpl *This = (IOleClientSiteImpl *) me; IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
if (!This->reOle) if (!This->reOle)
return CO_E_RELEASED; return CO_E_RELEASED;
FIXME("stub %p\n",me); FIXME("stub %p\n", iface);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI static HRESULT WINAPI IOleClientSite_fnShowObject(IOleClientSite *iface)
IOleClientSite_fnShowObject(IOleClientSite *me)
{ {
IOleClientSiteImpl *This = (IOleClientSiteImpl *) me; IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
if (!This->reOle) if (!This->reOle)
return CO_E_RELEASED; return CO_E_RELEASED;
FIXME("stub %p\n",me); FIXME("stub %p\n", iface);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI static HRESULT WINAPI IOleClientSite_fnOnShowWindow(IOleClientSite *iface, BOOL fShow)
IOleClientSite_fnOnShowWindow(IOleClientSite *me, BOOL fShow)
{ {
IOleClientSiteImpl *This = (IOleClientSiteImpl *) me; IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
if (!This->reOle) if (!This->reOle)
return CO_E_RELEASED; return CO_E_RELEASED;
FIXME("stub %p\n",me); FIXME("stub %p\n", iface);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI static HRESULT WINAPI IOleClientSite_fnRequestNewObjectLayout(IOleClientSite *iface)
IOleClientSite_fnRequestNewObjectLayout(IOleClientSite *me)
{ {
IOleClientSiteImpl *This = (IOleClientSiteImpl *) me; IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
if (!This->reOle) if (!This->reOle)
return CO_E_RELEASED; return CO_E_RELEASED;
FIXME("stub %p\n",me); FIXME("stub %p\n", iface);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -289,7 +287,7 @@ CreateOleClientSite(IRichEditOleImpl *reOle)
if (!clientSite) if (!clientSite)
return NULL; return NULL;
clientSite->lpVtbl = &ocst; clientSite->IOleClientSite_iface.lpVtbl = &ocst;
clientSite->ref = 1; clientSite->ref = 1;
clientSite->reOle = reOle; clientSite->reOle = reOle;
return clientSite; return clientSite;
@ -305,7 +303,7 @@ IRichEditOle_fnGetClientSite(IRichEditOle *me,
if(!lplpolesite) if(!lplpolesite)
return E_INVALIDARG; return E_INVALIDARG;
*lplpolesite = (IOleClientSite *) This->clientSite; *lplpolesite = &This->clientSite->IOleClientSite_iface;
IOleClientSite_fnAddRef(*lplpolesite); IOleClientSite_fnAddRef(*lplpolesite);
return S_OK; return S_OK;
} }