Commit c52c15ef authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

riched20: COM cleanup for the ITextServices iface.

parent e18ae213
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(richedit); WINE_DEFAULT_DEBUG_CHANNEL(richedit);
typedef struct ITextServicesImpl { typedef struct ITextServicesImpl {
const ITextServicesVtbl *lpVtbl; ITextServices ITextServices_iface;
ITextHost *pMyHost; ITextHost *pMyHost;
LONG ref; LONG ref;
CRITICAL_SECTION csTxtSrv; CRITICAL_SECTION csTxtSrv;
...@@ -85,7 +85,7 @@ HRESULT WINAPI CreateTextServices(IUnknown * pUnkOuter, ...@@ -85,7 +85,7 @@ HRESULT WINAPI CreateTextServices(IUnknown * pUnkOuter,
ITextImpl->ref = 1; ITextImpl->ref = 1;
ITextHost_AddRef(pITextHost); ITextHost_AddRef(pITextHost);
ITextImpl->pMyHost = pITextHost; ITextImpl->pMyHost = pITextHost;
ITextImpl->lpVtbl = &textservices_Vtbl; ITextImpl->ITextServices_iface.lpVtbl = &textservices_Vtbl;
ITextImpl->editor = ME_MakeEditor(pITextHost, FALSE); ITextImpl->editor = ME_MakeEditor(pITextHost, FALSE);
ITextImpl->editor->exStyleFlags = 0; ITextImpl->editor->exStyleFlags = 0;
ITextImpl->editor->rcFormat.left = 0; ITextImpl->editor->rcFormat.left = 0;
...@@ -101,18 +101,19 @@ HRESULT WINAPI CreateTextServices(IUnknown * pUnkOuter, ...@@ -101,18 +101,19 @@ HRESULT WINAPI CreateTextServices(IUnknown * pUnkOuter,
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
} }
*ppUnk = (IUnknown *)ITextImpl; *ppUnk = (IUnknown *)&ITextImpl->ITextServices_iface;
return S_OK; return S_OK;
} }
#define ICOM_THIS_MULTI(impl,field,iface) \ static inline ITextServicesImpl *impl_from_ITextServices(ITextServices *iface)
impl* const This=(impl*)((char*)(iface) - offsetof(impl,field)) {
return CONTAINING_RECORD(iface, ITextServicesImpl, ITextServices_iface);
}
static HRESULT WINAPI fnTextSrv_QueryInterface(ITextServices * iface, static HRESULT WINAPI fnTextSrv_QueryInterface(ITextServices *iface, REFIID riid, void **ppv)
REFIID riid,
LPVOID * ppv)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppv); TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppv);
*ppv = NULL; *ppv = NULL;
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_ITextServices)) if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_ITextServices))
...@@ -130,7 +131,7 @@ static HRESULT WINAPI fnTextSrv_QueryInterface(ITextServices * iface, ...@@ -130,7 +131,7 @@ static HRESULT WINAPI fnTextSrv_QueryInterface(ITextServices * iface,
static ULONG WINAPI fnTextSrv_AddRef(ITextServices *iface) static ULONG WINAPI fnTextSrv_AddRef(ITextServices *iface)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
DWORD ref = InterlockedIncrement(&This->ref); DWORD ref = InterlockedIncrement(&This->ref);
TRACE("(%p/%p)->() AddRef from %d\n", This, iface, ref - 1); TRACE("(%p/%p)->() AddRef from %d\n", This, iface, ref - 1);
...@@ -139,7 +140,7 @@ static ULONG WINAPI fnTextSrv_AddRef(ITextServices *iface) ...@@ -139,7 +140,7 @@ static ULONG WINAPI fnTextSrv_AddRef(ITextServices *iface)
static ULONG WINAPI fnTextSrv_Release(ITextServices *iface) static ULONG WINAPI fnTextSrv_Release(ITextServices *iface)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
DWORD ref = InterlockedDecrement(&This->ref); DWORD ref = InterlockedDecrement(&This->ref);
TRACE("(%p/%p)->() Release from %d\n", This, iface, ref + 1); TRACE("(%p/%p)->() Release from %d\n", This, iface, ref + 1);
...@@ -154,13 +155,10 @@ static ULONG WINAPI fnTextSrv_Release(ITextServices *iface) ...@@ -154,13 +155,10 @@ static ULONG WINAPI fnTextSrv_Release(ITextServices *iface)
return ref; return ref;
} }
HRESULT WINAPI fnTextSrv_TxSendMessage(ITextServices *iface, HRESULT WINAPI fnTextSrv_TxSendMessage(ITextServices *iface, UINT msg, WPARAM wparam,
UINT msg, LPARAM lparam, LRESULT *plresult)
WPARAM wparam,
LPARAM lparam,
LRESULT* plresult)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
HRESULT hresult; HRESULT hresult;
LRESULT lresult; LRESULT lresult;
...@@ -169,34 +167,22 @@ HRESULT WINAPI fnTextSrv_TxSendMessage(ITextServices *iface, ...@@ -169,34 +167,22 @@ HRESULT WINAPI fnTextSrv_TxSendMessage(ITextServices *iface,
return hresult; return hresult;
} }
HRESULT WINAPI fnTextSrv_TxDraw(ITextServices *iface, HRESULT WINAPI fnTextSrv_TxDraw(ITextServices *iface, DWORD dwDrawAspect, LONG lindex,
DWORD dwDrawAspect, void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcDraw, HDC hdcTargetDev,
LONG lindex, LPCRECTL lprcBounds, LPCRECTL lprcWBounds, LPRECT lprcUpdate,
void* pvAspect, BOOL (CALLBACK * pfnContinue)(DWORD), DWORD dwContinue,
DVTARGETDEVICE* ptd,
HDC hdcDraw,
HDC hdcTargetDev,
LPCRECTL lprcBounds,
LPCRECTL lprcWBounds,
LPRECT lprcUpdate,
BOOL (CALLBACK * pfnContinue)(DWORD),
DWORD dwContinue,
LONG lViewId) LONG lViewId)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This); FIXME("%p: STUB\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT WINAPI fnTextSrv_TxGetHScroll(ITextServices *iface, HRESULT WINAPI fnTextSrv_TxGetHScroll(ITextServices *iface, LONG *plMin, LONG *plMax, LONG *plPos,
LONG* plMin, LONG *plPage, BOOL *pfEnabled)
LONG* plMax,
LONG* plPos,
LONG* plPage,
BOOL* pfEnabled)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
*plMin = This->editor->horz_si.nMin; *plMin = This->editor->horz_si.nMin;
*plMax = This->editor->horz_si.nMax; *plMax = This->editor->horz_si.nMax;
...@@ -206,14 +192,10 @@ HRESULT WINAPI fnTextSrv_TxGetHScroll(ITextServices *iface, ...@@ -206,14 +192,10 @@ HRESULT WINAPI fnTextSrv_TxGetHScroll(ITextServices *iface,
return S_OK; return S_OK;
} }
HRESULT WINAPI fnTextSrv_TxGetVScroll(ITextServices *iface, HRESULT WINAPI fnTextSrv_TxGetVScroll(ITextServices *iface, LONG *plMin, LONG *plMax, LONG *plPos,
LONG* plMin, LONG *plPage, BOOL *pfEnabled)
LONG* plMax,
LONG* plPos,
LONG* plPage,
BOOL* pfEnabled)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
*plMin = This->editor->vert_si.nMin; *plMin = This->editor->vert_si.nMin;
*plMax = This->editor->vert_si.nMax; *plMax = This->editor->vert_si.nMax;
...@@ -223,43 +205,30 @@ HRESULT WINAPI fnTextSrv_TxGetVScroll(ITextServices *iface, ...@@ -223,43 +205,30 @@ HRESULT WINAPI fnTextSrv_TxGetVScroll(ITextServices *iface,
return S_OK; return S_OK;
} }
HRESULT WINAPI fnTextSrv_OnTxSetCursor(ITextServices *iface, HRESULT WINAPI fnTextSrv_OnTxSetCursor(ITextServices *iface, DWORD dwDrawAspect, LONG lindex,
DWORD dwDrawAspect, void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcDraw,
LONG lindex, HDC hicTargetDev, LPCRECT lprcClient, INT x, INT y)
void* pvAspect,
DVTARGETDEVICE* ptd,
HDC hdcDraw,
HDC hicTargetDev,
LPCRECT lprcClient,
INT x, INT y)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This); FIXME("%p: STUB\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT WINAPI fnTextSrv_TxQueryHitPoint(ITextServices *iface, HRESULT WINAPI fnTextSrv_TxQueryHitPoint(ITextServices *iface, DWORD dwDrawAspect, LONG lindex,
DWORD dwDrawAspect, void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcDraw,
LONG lindex, HDC hicTargetDev, LPCRECT lprcClient, INT x, INT y,
void* pvAspect, DWORD *pHitResult)
DVTARGETDEVICE* ptd,
HDC hdcDraw,
HDC hicTargetDev,
LPCRECT lprcClient,
INT x, INT y,
DWORD* pHitResult)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This); FIXME("%p: STUB\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT WINAPI fnTextSrv_OnTxInplaceActivate(ITextServices *iface, HRESULT WINAPI fnTextSrv_OnTxInplaceActivate(ITextServices *iface, LPCRECT prcClient)
LPCRECT prcClient)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This); FIXME("%p: STUB\n", This);
return E_NOTIMPL; return E_NOTIMPL;
...@@ -267,7 +236,7 @@ HRESULT WINAPI fnTextSrv_OnTxInplaceActivate(ITextServices *iface, ...@@ -267,7 +236,7 @@ HRESULT WINAPI fnTextSrv_OnTxInplaceActivate(ITextServices *iface,
HRESULT WINAPI fnTextSrv_OnTxInplaceDeactivate(ITextServices *iface) HRESULT WINAPI fnTextSrv_OnTxInplaceDeactivate(ITextServices *iface)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This); FIXME("%p: STUB\n", This);
return E_NOTIMPL; return E_NOTIMPL;
...@@ -275,7 +244,7 @@ HRESULT WINAPI fnTextSrv_OnTxInplaceDeactivate(ITextServices *iface) ...@@ -275,7 +244,7 @@ HRESULT WINAPI fnTextSrv_OnTxInplaceDeactivate(ITextServices *iface)
HRESULT WINAPI fnTextSrv_OnTxUIActivate(ITextServices *iface) HRESULT WINAPI fnTextSrv_OnTxUIActivate(ITextServices *iface)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This); FIXME("%p: STUB\n", This);
return E_NOTIMPL; return E_NOTIMPL;
...@@ -283,16 +252,15 @@ HRESULT WINAPI fnTextSrv_OnTxUIActivate(ITextServices *iface) ...@@ -283,16 +252,15 @@ HRESULT WINAPI fnTextSrv_OnTxUIActivate(ITextServices *iface)
HRESULT WINAPI fnTextSrv_OnTxUIDeactivate(ITextServices *iface) HRESULT WINAPI fnTextSrv_OnTxUIDeactivate(ITextServices *iface)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This); FIXME("%p: STUB\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT WINAPI fnTextSrv_TxGetText(ITextServices *iface, HRESULT WINAPI fnTextSrv_TxGetText(ITextServices *iface, BSTR *pbstrText)
BSTR* pbstrText)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
int length; int length;
length = ME_GetTextLength(This->editor); length = ME_GetTextLength(This->editor);
...@@ -314,10 +282,9 @@ HRESULT WINAPI fnTextSrv_TxGetText(ITextServices *iface, ...@@ -314,10 +282,9 @@ HRESULT WINAPI fnTextSrv_TxGetText(ITextServices *iface,
return S_OK; return S_OK;
} }
HRESULT WINAPI fnTextSrv_TxSetText(ITextServices *iface, HRESULT WINAPI fnTextSrv_TxSetText(ITextServices *iface, LPCWSTR pszText)
LPCWSTR pszText)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
ME_Cursor cursor; ME_Cursor cursor;
ME_SetCursorToStart(This->editor, &cursor); ME_SetCursorToStart(This->editor, &cursor);
...@@ -334,64 +301,51 @@ HRESULT WINAPI fnTextSrv_TxSetText(ITextServices *iface, ...@@ -334,64 +301,51 @@ HRESULT WINAPI fnTextSrv_TxSetText(ITextServices *iface,
return S_OK; return S_OK;
} }
HRESULT WINAPI fnTextSrv_TxGetCurrentTargetX(ITextServices *iface, HRESULT WINAPI fnTextSrv_TxGetCurrentTargetX(ITextServices *iface, LONG *x)
LONG* x)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This); FIXME("%p: STUB\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT WINAPI fnTextSrv_TxGetBaseLinePos(ITextServices *iface, HRESULT WINAPI fnTextSrv_TxGetBaseLinePos(ITextServices *iface, LONG *x)
LONG* x)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This); FIXME("%p: STUB\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT WINAPI fnTextSrv_TxGetNaturalSize(ITextServices *iface, HRESULT WINAPI fnTextSrv_TxGetNaturalSize(ITextServices *iface, DWORD dwAspect, HDC hdcDraw,
DWORD dwAspect, HDC hicTargetDev, DVTARGETDEVICE *ptd, DWORD dwMode,
HDC hdcDraw, const SIZEL *psizelExtent, LONG *pwidth, LONG *pheight)
HDC hicTargetDev,
DVTARGETDEVICE* ptd,
DWORD dwMode,
const SIZEL* psizelExtent,
LONG* pwidth,
LONG* pheight)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This); FIXME("%p: STUB\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT WINAPI fnTextSrv_TxGetDropTarget(ITextServices *iface, HRESULT WINAPI fnTextSrv_TxGetDropTarget(ITextServices *iface, IDropTarget **ppDropTarget)
IDropTarget** ppDropTarget)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This); FIXME("%p: STUB\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT WINAPI fnTextSrv_OnTxPropertyBitsChange(ITextServices *iface, HRESULT WINAPI fnTextSrv_OnTxPropertyBitsChange(ITextServices *iface, DWORD dwMask, DWORD dwBits)
DWORD dwMask,
DWORD dwBits)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This); FIXME("%p: STUB\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT WINAPI fnTextSrv_TxGetCachedSize(ITextServices *iface, HRESULT WINAPI fnTextSrv_TxGetCachedSize(ITextServices *iface, DWORD *pdwWidth, DWORD *pdwHeight)
DWORD* pdwWidth,
DWORD* pdwHeight)
{ {
ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface); ITextServicesImpl *This = impl_from_ITextServices(iface);
FIXME("%p: STUB\n", This); FIXME("%p: STUB\n", This);
return E_NOTIMPL; return E_NOTIMPL;
......
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