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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "wine/port.h"
24 #define NONAMELESSSTRUCT
25 #define NONAMELESSUNION
34 #include "wine/debug.h"
37 #ifdef __i386__ /* thiscall functions are i386-specific */
39 #define THISCALL(func) __thiscall_ ## func
40 #define DEFINE_THISCALL_WRAPPER(func) \
41 extern typeof(func) THISCALL(func); \
42 __ASM_GLOBAL_FUNC(__thiscall_ ## func, \
46 "jmp " __ASM_NAME(#func) )
49 #define THISCALL(func) func
50 #define DEFINE_THISCALL_WRAPPER(func) /* nothing */
54 WINE_DEFAULT_DEBUG_CHANNEL(richedit);
56 typedef struct ITextServicesImpl {
57 const ITextServicesVtbl *lpVtbl;
60 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);
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 %ld\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 %ld\n", This, iface, ref + 1);
137 ITextHost_Release(This->pMyHost);
138 DeleteCriticalSection(&This->csTxtSrv);
144 HRESULT WINAPI fnTextSrv_TxSendMessage(ITextServices *iface,
150 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
152 FIXME("%p: STUB\n", This);
156 HRESULT WINAPI fnTextSrv_TxDraw(ITextServices *iface,
164 LPCRECTL lprcWBounds,
166 BOOL (CALLBACK * pfnContinue)(DWORD),
170 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
172 FIXME("%p: STUB\n", This);
176 HRESULT WINAPI fnTextSrv_TxGetHScroll(ITextServices *iface,
183 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
185 FIXME("%p: STUB\n", This);
189 HRESULT WINAPI fnTextSrv_TxGetVScroll(ITextServices *iface,
196 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
198 FIXME("%p: STUB\n", This);
202 HRESULT WINAPI fnTextSrv_OnTxSetCursor(ITextServices *iface,
212 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
214 FIXME("%p: STUB\n", This);
218 HRESULT WINAPI fnTextSrv_TxQueryHitPoint(ITextServices *iface,
229 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
231 FIXME("%p: STUB\n", This);
235 HRESULT WINAPI fnTextSrv_OnTxInplaceActivate(ITextServices *iface,
238 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
240 FIXME("%p: STUB\n", This);
244 HRESULT WINAPI fnTextSrv_OnTxInplaceDeactivate(ITextServices *iface)
246 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
248 FIXME("%p: STUB\n", This);
252 HRESULT WINAPI fnTextSrv_OnTxUIActivate(ITextServices *iface)
254 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
256 FIXME("%p: STUB\n", This);
260 HRESULT WINAPI fnTextSrv_OnTxUIDeactivate(ITextServices *iface)
262 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
264 FIXME("%p: STUB\n", This);
268 HRESULT WINAPI fnTextSrv_TxGetText(ITextServices *iface,
271 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
273 FIXME("%p: STUB\n", This);
277 HRESULT WINAPI fnTextSrv_TxSetText(ITextServices *iface,
280 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
282 FIXME("%p: STUB\n", This);
286 HRESULT WINAPI fnTextSrv_TxGetCurrentTargetX(ITextServices *iface,
289 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
291 FIXME("%p: STUB\n", This);
295 HRESULT WINAPI fnTextSrv_TxGetBaseLinePos(ITextServices *iface,
298 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
300 FIXME("%p: STUB\n", This);
304 HRESULT WINAPI fnTextSrv_TxGetNaturalSize(ITextServices *iface,
310 const SIZEL* psizelExtent,
314 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
316 FIXME("%p: STUB\n", This);
320 HRESULT WINAPI fnTextSrv_TxGetDropTarget(ITextServices *iface,
321 IDropTarget** ppDropTarget)
323 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
325 FIXME("%p: STUB\n", This);
329 HRESULT WINAPI fnTextSrv_OnTxPropertyBitsChange(ITextServices *iface,
333 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
335 FIXME("%p: STUB\n", This);
339 HRESULT WINAPI fnTextSrv_TxGetCachedSize(ITextServices *iface,
343 ICOM_THIS_MULTI(ITextServicesImpl, lpVtbl, iface);
345 FIXME("%p: STUB\n", This);
349 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxSendMessage);
350 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxDraw);
351 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetHScroll);
352 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetVScroll);
353 DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxSetCursor);
354 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxQueryHitPoint);
355 DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxInplaceActivate);
356 DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxInplaceDeactivate);
357 DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxUIActivate);
358 DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxUIDeactivate);
359 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetText);
360 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxSetText);
361 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCurrentTargetX);
362 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetBaseLinePos);
363 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetNaturalSize);
364 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetDropTarget);
365 DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxPropertyBitsChange);
366 DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCachedSize);
368 static const ITextServicesVtbl textservices_Vtbl =
370 fnTextSrv_QueryInterface,
373 THISCALL(fnTextSrv_TxSendMessage),
374 THISCALL(fnTextSrv_TxDraw),
375 THISCALL(fnTextSrv_TxGetHScroll),
376 THISCALL(fnTextSrv_TxGetVScroll),
377 THISCALL(fnTextSrv_OnTxSetCursor),
378 THISCALL(fnTextSrv_TxQueryHitPoint),
379 THISCALL(fnTextSrv_OnTxInplaceActivate),
380 THISCALL(fnTextSrv_OnTxInplaceDeactivate),
381 THISCALL(fnTextSrv_OnTxUIActivate),
382 THISCALL(fnTextSrv_OnTxUIDeactivate),
383 THISCALL(fnTextSrv_TxGetText),
384 THISCALL(fnTextSrv_TxSetText),
385 THISCALL(fnTextSrv_TxGetCurrentTargetX),
386 THISCALL(fnTextSrv_TxGetBaseLinePos),
387 THISCALL(fnTextSrv_TxGetNaturalSize),
388 THISCALL(fnTextSrv_TxGetDropTarget),
389 THISCALL(fnTextSrv_OnTxPropertyBitsChange),
390 THISCALL(fnTextSrv_TxGetCachedSize)