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;
62 static const ITextServicesVtbl textservices_Vtbl;
64 /******************************************************************
65 * CreateTextServices (RICHED20.4)
67 HRESULT WINAPI CreateTextServices(IUnknown * pUnkOuter,
68 ITextHost * pITextHost,
71 ITextServicesImpl *ITextImpl;
72 TRACE("%p %p --> %p\n", pUnkOuter, pITextHost, ppUnk);
73 if (pITextHost == NULL)
76 ITextImpl = CoTaskMemAlloc(sizeof(*ITextImpl));
77 if (ITextImpl == NULL)
79 InitializeCriticalSection(&ITextImpl->csTxtSrv);
80 ITextImpl->csTxtSrv.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ITextServicesImpl.csTxtSrv");
82 ITextHost_AddRef(pITextHost);
83 ITextImpl->pMyHost = pITextHost;
84 ITextImpl->lpVtbl = &textservices_Vtbl;
88 FIXME("Support aggregation\n");
89 return CLASS_E_NOAGGREGATION;
92 *ppUnk = (IUnknown *)ITextImpl;
96 #define ICOM_THIS_MULTI(impl,field,iface) \
97 impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
99 static HRESULT WINAPI fnTextSrv_QueryInterface(ITextServices * iface,
103 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
104 TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppv);
106 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_ITextServices))
111 IUnknown_AddRef((IUnknown *)(*ppv));
112 TRACE ("-- Interface = %p\n", *ppv);
115 FIXME("Unknown interface: %s\n", debugstr_guid(riid));
116 return E_NOINTERFACE;
119 static ULONG WINAPI fnTextSrv_AddRef(ITextServices *iface)
121 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
122 DWORD ref = InterlockedIncrement(&This->ref);
124 TRACE("(%p/%p)->() AddRef from %d\n", This, iface, ref - 1);
128 static ULONG WINAPI fnTextSrv_Release(ITextServices *iface)
130 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
131 DWORD ref = InterlockedDecrement(&This->ref);
133 TRACE("(%p/%p)->() Release from %d\n", This, iface, ref + 1);
137 ITextHost_Release(This->pMyHost);
138 This->csTxtSrv.DebugInfo->Spare[0] = 0;
139 DeleteCriticalSection(&This->csTxtSrv);
145 HRESULT WINAPI fnTextSrv_TxSendMessage(ITextServices *iface,
151 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
153 FIXME("%p: STUB\n", This);
157 HRESULT WINAPI fnTextSrv_TxDraw(ITextServices *iface,
165 LPCRECTL lprcWBounds,
167 BOOL (CALLBACK * pfnContinue)(DWORD),
171 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
173 FIXME("%p: STUB\n", This);
177 HRESULT WINAPI fnTextSrv_TxGetHScroll(ITextServices *iface,
184 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
186 FIXME("%p: STUB\n", This);
190 HRESULT WINAPI fnTextSrv_TxGetVScroll(ITextServices *iface,
197 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
199 FIXME("%p: STUB\n", This);
203 HRESULT WINAPI fnTextSrv_OnTxSetCursor(ITextServices *iface,
213 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
215 FIXME("%p: STUB\n", This);
219 HRESULT WINAPI fnTextSrv_TxQueryHitPoint(ITextServices *iface,
230 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
232 FIXME("%p: STUB\n", This);
236 HRESULT WINAPI fnTextSrv_OnTxInplaceActivate(ITextServices *iface,
239 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
241 FIXME("%p: STUB\n", This);
245 HRESULT WINAPI fnTextSrv_OnTxInplaceDeactivate(ITextServices *iface)
247 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
249 FIXME("%p: STUB\n", This);
253 HRESULT WINAPI fnTextSrv_OnTxUIActivate(ITextServices *iface)
255 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
257 FIXME("%p: STUB\n", This);
261 HRESULT WINAPI fnTextSrv_OnTxUIDeactivate(ITextServices *iface)
263 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
265 FIXME("%p: STUB\n", This);
269 HRESULT WINAPI fnTextSrv_TxGetText(ITextServices *iface,
272 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
274 FIXME("%p: STUB\n", This);
278 HRESULT WINAPI fnTextSrv_TxSetText(ITextServices *iface,
281 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
283 FIXME("%p: STUB\n", This);
287 HRESULT WINAPI fnTextSrv_TxGetCurrentTargetX(ITextServices *iface,
290 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
292 FIXME("%p: STUB\n", This);
296 HRESULT WINAPI fnTextSrv_TxGetBaseLinePos(ITextServices *iface,
299 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
301 FIXME("%p: STUB\n", This);
305 HRESULT WINAPI fnTextSrv_TxGetNaturalSize(ITextServices *iface,
311 const SIZEL* psizelExtent,
315 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
317 FIXME("%p: STUB\n", This);
321 HRESULT WINAPI fnTextSrv_TxGetDropTarget(ITextServices *iface,
322 IDropTarget** ppDropTarget)
324 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
326 FIXME("%p: STUB\n", This);
330 HRESULT WINAPI fnTextSrv_OnTxPropertyBitsChange(ITextServices *iface,
334 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
336 FIXME("%p: STUB\n", This);
340 HRESULT WINAPI fnTextSrv_TxGetCachedSize(ITextServices *iface,
344 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
346 FIXME("%p: STUB\n", This);
350 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxSendMessage)
351 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxDraw)
352 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetHScroll)
353 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetVScroll)
354 DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxSetCursor)
355 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxQueryHitPoint)
356 DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxInplaceActivate)
357 DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxInplaceDeactivate)
358 DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxUIActivate)
359 DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxUIDeactivate)
360 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetText)
361 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxSetText)
362 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCurrentTargetX)
363 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetBaseLinePos)
364 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetNaturalSize)
365 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetDropTarget)
366 DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxPropertyBitsChange)
367 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCachedSize)
369 static const ITextServicesVtbl textservices_Vtbl =
371 fnTextSrv_QueryInterface,
374 THISCALL(fnTextSrv_TxSendMessage),
375 THISCALL(fnTextSrv_TxDraw),
376 THISCALL(fnTextSrv_TxGetHScroll),
377 THISCALL(fnTextSrv_TxGetVScroll),
378 THISCALL(fnTextSrv_OnTxSetCursor),
379 THISCALL(fnTextSrv_TxQueryHitPoint),
380 THISCALL(fnTextSrv_OnTxInplaceActivate),
381 THISCALL(fnTextSrv_OnTxInplaceDeactivate),
382 THISCALL(fnTextSrv_OnTxUIActivate),
383 THISCALL(fnTextSrv_OnTxUIDeactivate),
384 THISCALL(fnTextSrv_TxGetText),
385 THISCALL(fnTextSrv_TxSetText),
386 THISCALL(fnTextSrv_TxGetCurrentTargetX),
387 THISCALL(fnTextSrv_TxGetBaseLinePos),
388 THISCALL(fnTextSrv_TxGetNaturalSize),
389 THISCALL(fnTextSrv_TxGetDropTarget),
390 THISCALL(fnTextSrv_OnTxPropertyBitsChange),
391 THISCALL(fnTextSrv_TxGetCachedSize)