2 * RichEdit - functions and interfaces around CreateTextServices
4 * Copyright 2005, 2006, Maarten Lankhorst
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/port.h"
24 #define NONAMELESSSTRUCT
25 #define NONAMELESSUNION
33 #include "wine/debug.h"
36 #ifdef __i386__ /* thiscall functions are i386-specific */
38 #define THISCALL(func) __thiscall_ ## func
39 #define DEFINE_THISCALL_WRAPPER(func) \
40 extern typeof(func) THISCALL(func); \
41 __ASM_GLOBAL_FUNC(__thiscall_ ## func, \
45 "jmp " __ASM_NAME(#func) )
48 #define THISCALL(func) func
49 #define DEFINE_THISCALL_WRAPPER(func) /* nothing */
53 WINE_DEFAULT_DEBUG_CHANNEL(richedit);
55 typedef struct ITextServicesImpl {
56 const ITextServicesVtbl *lpVtbl;
59 CRITICAL_SECTION csTxtSrv;
63 static const ITextServicesVtbl textservices_Vtbl;
65 /******************************************************************
66 * CreateTextServices (RICHED20.4)
68 HRESULT WINAPI CreateTextServices(IUnknown * pUnkOuter,
69 ITextHost * pITextHost,
72 ITextServicesImpl *ITextImpl;
73 TRACE("%p %p --> %p\n", pUnkOuter, pITextHost, ppUnk);
74 if (pITextHost == NULL)
77 ITextImpl = CoTaskMemAlloc(sizeof(*ITextImpl));
78 if (ITextImpl == NULL)
80 InitializeCriticalSection(&ITextImpl->csTxtSrv);
81 ITextImpl->csTxtSrv.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ITextServicesImpl.csTxtSrv");
83 ITextHost_AddRef(pITextHost);
84 ITextImpl->pMyHost = pITextHost;
85 ITextImpl->lpVtbl = &textservices_Vtbl;
89 FIXME("Support aggregation\n");
90 return CLASS_E_NOAGGREGATION;
93 *ppUnk = (IUnknown *)ITextImpl;
97 #define ICOM_THIS_MULTI(impl,field,iface) \
98 impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
100 static HRESULT WINAPI fnTextSrv_QueryInterface(ITextServices * iface,
104 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
105 TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppv);
107 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_ITextServices))
112 IUnknown_AddRef((IUnknown *)(*ppv));
113 TRACE ("-- Interface = %p\n", *ppv);
116 FIXME("Unknown interface: %s\n", debugstr_guid(riid));
117 return E_NOINTERFACE;
120 static ULONG WINAPI fnTextSrv_AddRef(ITextServices *iface)
122 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
123 DWORD ref = InterlockedIncrement(&This->ref);
125 TRACE("(%p/%p)->() AddRef from %d\n", This, iface, ref - 1);
129 static ULONG WINAPI fnTextSrv_Release(ITextServices *iface)
131 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
132 DWORD ref = InterlockedDecrement(&This->ref);
134 TRACE("(%p/%p)->() Release from %d\n", This, iface, ref + 1);
138 ITextHost_Release(This->pMyHost);
139 This->csTxtSrv.DebugInfo->Spare[0] = 0;
140 DeleteCriticalSection(&This->csTxtSrv);
146 HRESULT WINAPI fnTextSrv_TxSendMessage(ITextServices *iface,
152 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
154 FIXME("%p: STUB\n", This);
158 HRESULT WINAPI fnTextSrv_TxDraw(ITextServices *iface,
166 LPCRECTL lprcWBounds,
168 BOOL (CALLBACK * pfnContinue)(DWORD),
172 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
174 FIXME("%p: STUB\n", This);
178 HRESULT WINAPI fnTextSrv_TxGetHScroll(ITextServices *iface,
185 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
187 FIXME("%p: STUB\n", This);
191 HRESULT WINAPI fnTextSrv_TxGetVScroll(ITextServices *iface,
198 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
200 FIXME("%p: STUB\n", This);
204 HRESULT WINAPI fnTextSrv_OnTxSetCursor(ITextServices *iface,
214 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
216 FIXME("%p: STUB\n", This);
220 HRESULT WINAPI fnTextSrv_TxQueryHitPoint(ITextServices *iface,
231 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
233 FIXME("%p: STUB\n", This);
237 HRESULT WINAPI fnTextSrv_OnTxInplaceActivate(ITextServices *iface,
240 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
242 FIXME("%p: STUB\n", This);
246 HRESULT WINAPI fnTextSrv_OnTxInplaceDeactivate(ITextServices *iface)
248 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
250 FIXME("%p: STUB\n", This);
254 HRESULT WINAPI fnTextSrv_OnTxUIActivate(ITextServices *iface)
256 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
258 FIXME("%p: STUB\n", This);
262 HRESULT WINAPI fnTextSrv_OnTxUIDeactivate(ITextServices *iface)
264 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
266 FIXME("%p: STUB\n", This);
270 HRESULT WINAPI fnTextSrv_TxGetText(ITextServices *iface,
273 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
275 FIXME("%p: STUB\n", This);
279 HRESULT WINAPI fnTextSrv_TxSetText(ITextServices *iface,
282 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
284 FIXME("%p: STUB\n", This);
288 HRESULT WINAPI fnTextSrv_TxGetCurrentTargetX(ITextServices *iface,
291 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
293 FIXME("%p: STUB\n", This);
297 HRESULT WINAPI fnTextSrv_TxGetBaseLinePos(ITextServices *iface,
300 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
302 FIXME("%p: STUB\n", This);
306 HRESULT WINAPI fnTextSrv_TxGetNaturalSize(ITextServices *iface,
312 const SIZEL* psizelExtent,
316 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
318 FIXME("%p: STUB\n", This);
322 HRESULT WINAPI fnTextSrv_TxGetDropTarget(ITextServices *iface,
323 IDropTarget** ppDropTarget)
325 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
327 FIXME("%p: STUB\n", This);
331 HRESULT WINAPI fnTextSrv_OnTxPropertyBitsChange(ITextServices *iface,
335 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
337 FIXME("%p: STUB\n", This);
341 HRESULT WINAPI fnTextSrv_TxGetCachedSize(ITextServices *iface,
345 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
347 FIXME("%p: STUB\n", This);
351 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxSendMessage)
352 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxDraw)
353 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetHScroll)
354 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetVScroll)
355 DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxSetCursor)
356 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxQueryHitPoint)
357 DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxInplaceActivate)
358 DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxInplaceDeactivate)
359 DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxUIActivate)
360 DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxUIDeactivate)
361 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetText)
362 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxSetText)
363 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCurrentTargetX)
364 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetBaseLinePos)
365 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetNaturalSize)
366 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetDropTarget)
367 DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxPropertyBitsChange)
368 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCachedSize)
370 static const ITextServicesVtbl textservices_Vtbl =
372 fnTextSrv_QueryInterface,
375 THISCALL(fnTextSrv_TxSendMessage),
376 THISCALL(fnTextSrv_TxDraw),
377 THISCALL(fnTextSrv_TxGetHScroll),
378 THISCALL(fnTextSrv_TxGetVScroll),
379 THISCALL(fnTextSrv_OnTxSetCursor),
380 THISCALL(fnTextSrv_TxQueryHitPoint),
381 THISCALL(fnTextSrv_OnTxInplaceActivate),
382 THISCALL(fnTextSrv_OnTxInplaceDeactivate),
383 THISCALL(fnTextSrv_OnTxUIActivate),
384 THISCALL(fnTextSrv_OnTxUIDeactivate),
385 THISCALL(fnTextSrv_TxGetText),
386 THISCALL(fnTextSrv_TxSetText),
387 THISCALL(fnTextSrv_TxGetCurrentTargetX),
388 THISCALL(fnTextSrv_TxGetBaseLinePos),
389 THISCALL(fnTextSrv_TxGetNaturalSize),
390 THISCALL(fnTextSrv_TxGetDropTarget),
391 THISCALL(fnTextSrv_OnTxPropertyBitsChange),
392 THISCALL(fnTextSrv_TxGetCachedSize)