1c2c66affSColin Finck /*
2c2c66affSColin Finck * RichEdit - functions and interfaces around CreateTextServices
3c2c66affSColin Finck *
4c2c66affSColin Finck * Copyright 2005, 2006, Maarten Lankhorst
5c2c66affSColin Finck *
6c2c66affSColin Finck * This library is free software; you can redistribute it and/or
7c2c66affSColin Finck * modify it under the terms of the GNU Lesser General Public
8c2c66affSColin Finck * License as published by the Free Software Foundation; either
9c2c66affSColin Finck * version 2.1 of the License, or (at your option) any later version.
10c2c66affSColin Finck *
11c2c66affSColin Finck * This library is distributed in the hope that it will be useful,
12c2c66affSColin Finck * but WITHOUT ANY WARRANTY; without even the implied warranty of
13c2c66affSColin Finck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14c2c66affSColin Finck * Lesser General Public License for more details.
15c2c66affSColin Finck *
16c2c66affSColin Finck * You should have received a copy of the GNU Lesser General Public
17c2c66affSColin Finck * License along with this library; if not, write to the Free Software
18c2c66affSColin Finck * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19c2c66affSColin Finck */
20c2c66affSColin Finck
21056bdefeSAmine Khaldi #define COBJMACROS
22056bdefeSAmine Khaldi
23056bdefeSAmine Khaldi #include "editor.h"
24056bdefeSAmine Khaldi #include "ole2.h"
25056bdefeSAmine Khaldi #include "oleauto.h"
26056bdefeSAmine Khaldi #include "richole.h"
27056bdefeSAmine Khaldi #include "tom.h"
28056bdefeSAmine Khaldi #include "imm.h"
29056bdefeSAmine Khaldi #include "textserv.h"
30661b8a2aSAmine Khaldi #include "wine/asm.h"
31056bdefeSAmine Khaldi #include "wine/debug.h"
32056bdefeSAmine Khaldi #include "editstr.h"
33c2c66affSColin Finck
34c2c66affSColin Finck WINE_DEFAULT_DEBUG_CHANNEL(richedit);
35c2c66affSColin Finck
36c2c66affSColin Finck typedef struct ITextServicesImpl {
37c2c66affSColin Finck IUnknown IUnknown_inner;
38c2c66affSColin Finck ITextServices ITextServices_iface;
39c2c66affSColin Finck IUnknown *outer_unk;
40c2c66affSColin Finck LONG ref;
41c2c66affSColin Finck ITextHost *pMyHost;
42c2c66affSColin Finck CRITICAL_SECTION csTxtSrv;
43c2c66affSColin Finck ME_TextEditor *editor;
44c2c66affSColin Finck char spare[256];
45c2c66affSColin Finck } ITextServicesImpl;
46c2c66affSColin Finck
impl_from_IUnknown(IUnknown * iface)47c2c66affSColin Finck static inline ITextServicesImpl *impl_from_IUnknown(IUnknown *iface)
48c2c66affSColin Finck {
49c2c66affSColin Finck return CONTAINING_RECORD(iface, ITextServicesImpl, IUnknown_inner);
50c2c66affSColin Finck }
51c2c66affSColin Finck
ITextServicesImpl_QueryInterface(IUnknown * iface,REFIID riid,void ** ppv)52c2c66affSColin Finck static HRESULT WINAPI ITextServicesImpl_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
53c2c66affSColin Finck {
54c2c66affSColin Finck ITextServicesImpl *This = impl_from_IUnknown(iface);
55c2c66affSColin Finck
56c2c66affSColin Finck TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
57c2c66affSColin Finck
58c2c66affSColin Finck if (IsEqualIID(riid, &IID_IUnknown))
59c2c66affSColin Finck *ppv = &This->IUnknown_inner;
60c2c66affSColin Finck else if (IsEqualIID(riid, &IID_ITextServices))
61c2c66affSColin Finck *ppv = &This->ITextServices_iface;
62dbfaf10dSAmine Khaldi else if (IsEqualIID(riid, &IID_IRichEditOle) || IsEqualIID(riid, &IID_ITextDocument) ||
63dbfaf10dSAmine Khaldi IsEqualIID(riid, &IID_ITextDocument2Old)) {
64c2c66affSColin Finck if (!This->editor->reOle)
65c2c66affSColin Finck if (!CreateIRichEditOle(This->outer_unk, This->editor, (void **)(&This->editor->reOle)))
66c2c66affSColin Finck return E_OUTOFMEMORY;
67661b8a2aSAmine Khaldi return IUnknown_QueryInterface(This->editor->reOle, riid, ppv);
68c2c66affSColin Finck } else {
69c2c66affSColin Finck *ppv = NULL;
70c2c66affSColin Finck FIXME("Unknown interface: %s\n", debugstr_guid(riid));
71c2c66affSColin Finck return E_NOINTERFACE;
72c2c66affSColin Finck }
73c2c66affSColin Finck
74c2c66affSColin Finck IUnknown_AddRef((IUnknown*)*ppv);
75c2c66affSColin Finck return S_OK;
76c2c66affSColin Finck }
77c2c66affSColin Finck
ITextServicesImpl_AddRef(IUnknown * iface)78c2c66affSColin Finck static ULONG WINAPI ITextServicesImpl_AddRef(IUnknown *iface)
79c2c66affSColin Finck {
80c2c66affSColin Finck ITextServicesImpl *This = impl_from_IUnknown(iface);
81c2c66affSColin Finck LONG ref = InterlockedIncrement(&This->ref);
82c2c66affSColin Finck
83c2c66affSColin Finck TRACE("(%p) ref=%d\n", This, ref);
84c2c66affSColin Finck
85c2c66affSColin Finck return ref;
86c2c66affSColin Finck }
87c2c66affSColin Finck
ITextServicesImpl_Release(IUnknown * iface)88c2c66affSColin Finck static ULONG WINAPI ITextServicesImpl_Release(IUnknown *iface)
89c2c66affSColin Finck {
90c2c66affSColin Finck ITextServicesImpl *This = impl_from_IUnknown(iface);
91c2c66affSColin Finck LONG ref = InterlockedDecrement(&This->ref);
92c2c66affSColin Finck
93c2c66affSColin Finck TRACE("(%p) ref=%d\n", This, ref);
94c2c66affSColin Finck
95c2c66affSColin Finck if (!ref)
96c2c66affSColin Finck {
97c2c66affSColin Finck ME_DestroyEditor(This->editor);
98c2c66affSColin Finck This->csTxtSrv.DebugInfo->Spare[0] = 0;
99c2c66affSColin Finck DeleteCriticalSection(&This->csTxtSrv);
100c2c66affSColin Finck CoTaskMemFree(This);
101c2c66affSColin Finck }
102c2c66affSColin Finck return ref;
103c2c66affSColin Finck }
104c2c66affSColin Finck
105c2c66affSColin Finck static const IUnknownVtbl textservices_inner_vtbl =
106c2c66affSColin Finck {
107c2c66affSColin Finck ITextServicesImpl_QueryInterface,
108c2c66affSColin Finck ITextServicesImpl_AddRef,
109c2c66affSColin Finck ITextServicesImpl_Release
110c2c66affSColin Finck };
111c2c66affSColin Finck
impl_from_ITextServices(ITextServices * iface)112c2c66affSColin Finck static inline ITextServicesImpl *impl_from_ITextServices(ITextServices *iface)
113c2c66affSColin Finck {
114c2c66affSColin Finck return CONTAINING_RECORD(iface, ITextServicesImpl, ITextServices_iface);
115c2c66affSColin Finck }
116c2c66affSColin Finck
fnTextSrv_QueryInterface(ITextServices * iface,REFIID riid,void ** ppv)117c2c66affSColin Finck static HRESULT WINAPI fnTextSrv_QueryInterface(ITextServices *iface, REFIID riid, void **ppv)
118c2c66affSColin Finck {
119c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
120c2c66affSColin Finck return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
121c2c66affSColin Finck }
122c2c66affSColin Finck
fnTextSrv_AddRef(ITextServices * iface)123c2c66affSColin Finck static ULONG WINAPI fnTextSrv_AddRef(ITextServices *iface)
124c2c66affSColin Finck {
125c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
126c2c66affSColin Finck return IUnknown_AddRef(This->outer_unk);
127c2c66affSColin Finck }
128c2c66affSColin Finck
fnTextSrv_Release(ITextServices * iface)129c2c66affSColin Finck static ULONG WINAPI fnTextSrv_Release(ITextServices *iface)
130c2c66affSColin Finck {
131c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
132c2c66affSColin Finck return IUnknown_Release(This->outer_unk);
133c2c66affSColin Finck }
134c2c66affSColin Finck
fnTextSrv_TxSendMessage(ITextServices * iface,UINT msg,WPARAM wparam,LPARAM lparam,LRESULT * plresult)135*c8b6ababSThomas Faber DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxSendMessage(ITextServices *iface, UINT msg, WPARAM wparam,
136c2c66affSColin Finck LPARAM lparam, LRESULT *plresult)
137c2c66affSColin Finck {
138c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
139c2c66affSColin Finck HRESULT hresult;
140c2c66affSColin Finck LRESULT lresult;
141c2c66affSColin Finck
142c2c66affSColin Finck lresult = ME_HandleMessage(This->editor, msg, wparam, lparam, TRUE, &hresult);
143c2c66affSColin Finck if (plresult) *plresult = lresult;
144c2c66affSColin Finck return hresult;
145c2c66affSColin Finck }
146c2c66affSColin Finck
fnTextSrv_TxDraw(ITextServices * iface,DWORD dwDrawAspect,LONG lindex,void * pvAspect,DVTARGETDEVICE * ptd,HDC hdcDraw,HDC hdcTargetDev,LPCRECTL lprcBounds,LPCRECTL lprcWBounds,LPRECT lprcUpdate,BOOL (CALLBACK * pfnContinue)(DWORD),DWORD dwContinue,LONG lViewId)147*c8b6ababSThomas Faber DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxDraw(ITextServices *iface, DWORD dwDrawAspect, LONG lindex,
148c2c66affSColin Finck void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcDraw, HDC hdcTargetDev,
149c2c66affSColin Finck LPCRECTL lprcBounds, LPCRECTL lprcWBounds, LPRECT lprcUpdate,
150c2c66affSColin Finck BOOL (CALLBACK * pfnContinue)(DWORD), DWORD dwContinue,
151c2c66affSColin Finck LONG lViewId)
152c2c66affSColin Finck {
153c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
154c2c66affSColin Finck
155c2c66affSColin Finck FIXME("%p: STUB\n", This);
156c2c66affSColin Finck return E_NOTIMPL;
157c2c66affSColin Finck }
158c2c66affSColin Finck
fnTextSrv_TxGetHScroll(ITextServices * iface,LONG * plMin,LONG * plMax,LONG * plPos,LONG * plPage,BOOL * pfEnabled)159*c8b6ababSThomas Faber DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetHScroll(ITextServices *iface, LONG *plMin, LONG *plMax, LONG *plPos,
160c2c66affSColin Finck LONG *plPage, BOOL *pfEnabled)
161c2c66affSColin Finck {
162c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
163c2c66affSColin Finck
164dbfaf10dSAmine Khaldi if (plMin)
165c2c66affSColin Finck *plMin = This->editor->horz_si.nMin;
166dbfaf10dSAmine Khaldi if (plMax)
167c2c66affSColin Finck *plMax = This->editor->horz_si.nMax;
168dbfaf10dSAmine Khaldi if (plPos)
169c2c66affSColin Finck *plPos = This->editor->horz_si.nPos;
170dbfaf10dSAmine Khaldi if (plPage)
171c2c66affSColin Finck *plPage = This->editor->horz_si.nPage;
172dbfaf10dSAmine Khaldi if (pfEnabled)
173c2c66affSColin Finck *pfEnabled = (This->editor->styleFlags & WS_HSCROLL) != 0;
174c2c66affSColin Finck return S_OK;
175c2c66affSColin Finck }
176c2c66affSColin Finck
fnTextSrv_TxGetVScroll(ITextServices * iface,LONG * plMin,LONG * plMax,LONG * plPos,LONG * plPage,BOOL * pfEnabled)177*c8b6ababSThomas Faber DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetVScroll(ITextServices *iface, LONG *plMin, LONG *plMax, LONG *plPos,
178c2c66affSColin Finck LONG *plPage, BOOL *pfEnabled)
179c2c66affSColin Finck {
180c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
181c2c66affSColin Finck
182dbfaf10dSAmine Khaldi if (plMin)
183c2c66affSColin Finck *plMin = This->editor->vert_si.nMin;
184dbfaf10dSAmine Khaldi if (plMax)
185c2c66affSColin Finck *plMax = This->editor->vert_si.nMax;
186dbfaf10dSAmine Khaldi if (plPos)
187c2c66affSColin Finck *plPos = This->editor->vert_si.nPos;
188dbfaf10dSAmine Khaldi if (plPage)
189c2c66affSColin Finck *plPage = This->editor->vert_si.nPage;
190dbfaf10dSAmine Khaldi if (pfEnabled)
191c2c66affSColin Finck *pfEnabled = (This->editor->styleFlags & WS_VSCROLL) != 0;
192c2c66affSColin Finck return S_OK;
193c2c66affSColin Finck }
194c2c66affSColin Finck
fnTextSrv_OnTxSetCursor(ITextServices * iface,DWORD dwDrawAspect,LONG lindex,void * pvAspect,DVTARGETDEVICE * ptd,HDC hdcDraw,HDC hicTargetDev,LPCRECT lprcClient,INT x,INT y)195*c8b6ababSThomas Faber DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxSetCursor(ITextServices *iface, DWORD dwDrawAspect, LONG lindex,
196c2c66affSColin Finck void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcDraw,
197c2c66affSColin Finck HDC hicTargetDev, LPCRECT lprcClient, INT x, INT y)
198c2c66affSColin Finck {
199c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
200c2c66affSColin Finck
201c2c66affSColin Finck FIXME("%p: STUB\n", This);
202c2c66affSColin Finck return E_NOTIMPL;
203c2c66affSColin Finck }
204c2c66affSColin Finck
fnTextSrv_TxQueryHitPoint(ITextServices * iface,DWORD dwDrawAspect,LONG lindex,void * pvAspect,DVTARGETDEVICE * ptd,HDC hdcDraw,HDC hicTargetDev,LPCRECT lprcClient,INT x,INT y,DWORD * pHitResult)205*c8b6ababSThomas Faber DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxQueryHitPoint(ITextServices *iface, DWORD dwDrawAspect, LONG lindex,
206c2c66affSColin Finck void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcDraw,
207c2c66affSColin Finck HDC hicTargetDev, LPCRECT lprcClient, INT x, INT y,
208c2c66affSColin Finck DWORD *pHitResult)
209c2c66affSColin Finck {
210c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
211c2c66affSColin Finck
212c2c66affSColin Finck FIXME("%p: STUB\n", This);
213c2c66affSColin Finck return E_NOTIMPL;
214c2c66affSColin Finck }
215c2c66affSColin Finck
fnTextSrv_OnTxInplaceActivate(ITextServices * iface,LPCRECT prcClient)216*c8b6ababSThomas Faber DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxInplaceActivate(ITextServices *iface, LPCRECT prcClient)
217c2c66affSColin Finck {
218c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
219c2c66affSColin Finck
220c2c66affSColin Finck FIXME("%p: STUB\n", This);
221c2c66affSColin Finck return E_NOTIMPL;
222c2c66affSColin Finck }
223c2c66affSColin Finck
fnTextSrv_OnTxInplaceDeactivate(ITextServices * iface)224*c8b6ababSThomas Faber DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxInplaceDeactivate(ITextServices *iface)
225c2c66affSColin Finck {
226c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
227c2c66affSColin Finck
228c2c66affSColin Finck FIXME("%p: STUB\n", This);
229c2c66affSColin Finck return E_NOTIMPL;
230c2c66affSColin Finck }
231c2c66affSColin Finck
fnTextSrv_OnTxUIActivate(ITextServices * iface)232*c8b6ababSThomas Faber DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxUIActivate(ITextServices *iface)
233c2c66affSColin Finck {
234c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
235c2c66affSColin Finck
236c2c66affSColin Finck FIXME("%p: STUB\n", This);
237c2c66affSColin Finck return E_NOTIMPL;
238c2c66affSColin Finck }
239c2c66affSColin Finck
fnTextSrv_OnTxUIDeactivate(ITextServices * iface)240*c8b6ababSThomas Faber DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxUIDeactivate(ITextServices *iface)
241c2c66affSColin Finck {
242c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
243c2c66affSColin Finck
244c2c66affSColin Finck FIXME("%p: STUB\n", This);
245c2c66affSColin Finck return E_NOTIMPL;
246c2c66affSColin Finck }
247c2c66affSColin Finck
fnTextSrv_TxGetText(ITextServices * iface,BSTR * pbstrText)248*c8b6ababSThomas Faber DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetText(ITextServices *iface, BSTR *pbstrText)
249c2c66affSColin Finck {
250c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
251c2c66affSColin Finck int length;
252c2c66affSColin Finck
253c2c66affSColin Finck length = ME_GetTextLength(This->editor);
254c2c66affSColin Finck if (length)
255c2c66affSColin Finck {
256c2c66affSColin Finck ME_Cursor start;
257c2c66affSColin Finck BSTR bstr;
258c2c66affSColin Finck bstr = SysAllocStringByteLen(NULL, length * sizeof(WCHAR));
259c2c66affSColin Finck if (bstr == NULL)
260c2c66affSColin Finck return E_OUTOFMEMORY;
261c2c66affSColin Finck
262c2c66affSColin Finck ME_CursorFromCharOfs(This->editor, 0, &start);
263c2c66affSColin Finck ME_GetTextW(This->editor, bstr, length, &start, INT_MAX, FALSE, FALSE);
264c2c66affSColin Finck *pbstrText = bstr;
265c2c66affSColin Finck } else {
266c2c66affSColin Finck *pbstrText = NULL;
267c2c66affSColin Finck }
268c2c66affSColin Finck
269c2c66affSColin Finck return S_OK;
270c2c66affSColin Finck }
271c2c66affSColin Finck
fnTextSrv_TxSetText(ITextServices * iface,LPCWSTR pszText)272*c8b6ababSThomas Faber DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxSetText(ITextServices *iface, LPCWSTR pszText)
273c2c66affSColin Finck {
274c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
275c2c66affSColin Finck ME_Cursor cursor;
276c2c66affSColin Finck
277c2c66affSColin Finck ME_SetCursorToStart(This->editor, &cursor);
278c2c66affSColin Finck ME_InternalDeleteText(This->editor, &cursor, ME_GetTextLength(This->editor), FALSE);
279c2c66affSColin Finck if(pszText)
280c2c66affSColin Finck ME_InsertTextFromCursor(This->editor, 0, pszText, -1, This->editor->pBuffer->pDefaultStyle);
281661b8a2aSAmine Khaldi set_selection_cursors(This->editor, 0, 0);
282c2c66affSColin Finck This->editor->nModifyStep = 0;
283c2c66affSColin Finck OleFlushClipboard();
284c2c66affSColin Finck ME_EmptyUndoStack(This->editor);
285c2c66affSColin Finck ME_UpdateRepaint(This->editor, FALSE);
286c2c66affSColin Finck
287c2c66affSColin Finck return S_OK;
288c2c66affSColin Finck }
289c2c66affSColin Finck
fnTextSrv_TxGetCurTargetX(ITextServices * iface,LONG * x)290*c8b6ababSThomas Faber DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetCurTargetX(ITextServices *iface, LONG *x)
291c2c66affSColin Finck {
292c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
293c2c66affSColin Finck
294c2c66affSColin Finck FIXME("%p: STUB\n", This);
295c2c66affSColin Finck return E_NOTIMPL;
296c2c66affSColin Finck }
297c2c66affSColin Finck
fnTextSrv_TxGetBaseLinePos(ITextServices * iface,LONG * x)298*c8b6ababSThomas Faber DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetBaseLinePos(ITextServices *iface, LONG *x)
299c2c66affSColin Finck {
300c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
301c2c66affSColin Finck
302c2c66affSColin Finck FIXME("%p: STUB\n", This);
303c2c66affSColin Finck return E_NOTIMPL;
304c2c66affSColin Finck }
305c2c66affSColin Finck
fnTextSrv_TxGetNaturalSize(ITextServices * iface,DWORD dwAspect,HDC hdcDraw,HDC hicTargetDev,DVTARGETDEVICE * ptd,DWORD dwMode,const SIZEL * psizelExtent,LONG * pwidth,LONG * pheight)306*c8b6ababSThomas Faber DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetNaturalSize(ITextServices *iface, DWORD dwAspect, HDC hdcDraw,
307c2c66affSColin Finck HDC hicTargetDev, DVTARGETDEVICE *ptd, DWORD dwMode,
308c2c66affSColin Finck const SIZEL *psizelExtent, LONG *pwidth, LONG *pheight)
309c2c66affSColin Finck {
310c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
311c2c66affSColin Finck
312c2c66affSColin Finck FIXME("%p: STUB\n", This);
313c2c66affSColin Finck return E_NOTIMPL;
314c2c66affSColin Finck }
315c2c66affSColin Finck
fnTextSrv_TxGetDropTarget(ITextServices * iface,IDropTarget ** ppDropTarget)316*c8b6ababSThomas Faber DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetDropTarget(ITextServices *iface, IDropTarget **ppDropTarget)
317c2c66affSColin Finck {
318c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
319c2c66affSColin Finck
320c2c66affSColin Finck FIXME("%p: STUB\n", This);
321c2c66affSColin Finck return E_NOTIMPL;
322c2c66affSColin Finck }
323c2c66affSColin Finck
fnTextSrv_OnTxPropertyBitsChange(ITextServices * iface,DWORD dwMask,DWORD dwBits)324*c8b6ababSThomas Faber DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxPropertyBitsChange(ITextServices *iface, DWORD dwMask, DWORD dwBits)
325c2c66affSColin Finck {
326c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
327c2c66affSColin Finck
328c2c66affSColin Finck FIXME("%p: STUB\n", This);
329c2c66affSColin Finck return E_NOTIMPL;
330c2c66affSColin Finck }
331c2c66affSColin Finck
fnTextSrv_TxGetCachedSize(ITextServices * iface,DWORD * pdwWidth,DWORD * pdwHeight)332*c8b6ababSThomas Faber DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetCachedSize(ITextServices *iface, DWORD *pdwWidth, DWORD *pdwHeight)
333c2c66affSColin Finck {
334c2c66affSColin Finck ITextServicesImpl *This = impl_from_ITextServices(iface);
335c2c66affSColin Finck
336c2c66affSColin Finck FIXME("%p: STUB\n", This);
337c2c66affSColin Finck return E_NOTIMPL;
338c2c66affSColin Finck }
339c2c66affSColin Finck
340c2c66affSColin Finck DEFINE_THISCALL_WRAPPER(fnTextSrv_TxSendMessage,20)
341c2c66affSColin Finck DEFINE_THISCALL_WRAPPER(fnTextSrv_TxDraw,52)
342c2c66affSColin Finck DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetHScroll,24)
343c2c66affSColin Finck DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetVScroll,24)
344c2c66affSColin Finck DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxSetCursor,40)
345c2c66affSColin Finck DEFINE_THISCALL_WRAPPER(fnTextSrv_TxQueryHitPoint,44)
346c2c66affSColin Finck DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxInplaceActivate,8)
347c2c66affSColin Finck DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxInplaceDeactivate,4)
348c2c66affSColin Finck DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxUIActivate,4)
349c2c66affSColin Finck DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxUIDeactivate,4)
350c2c66affSColin Finck DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetText,8)
351c2c66affSColin Finck DEFINE_THISCALL_WRAPPER(fnTextSrv_TxSetText,8)
352c2c66affSColin Finck DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCurTargetX,8)
353c2c66affSColin Finck DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetBaseLinePos,8)
354c2c66affSColin Finck DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetNaturalSize,36)
355c2c66affSColin Finck DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetDropTarget,8)
356c2c66affSColin Finck DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxPropertyBitsChange,12)
357c2c66affSColin Finck DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCachedSize,12)
358c2c66affSColin Finck
359c2c66affSColin Finck static const ITextServicesVtbl textservices_vtbl =
360c2c66affSColin Finck {
361c2c66affSColin Finck fnTextSrv_QueryInterface,
362c2c66affSColin Finck fnTextSrv_AddRef,
363c2c66affSColin Finck fnTextSrv_Release,
364c2c66affSColin Finck THISCALL(fnTextSrv_TxSendMessage),
365c2c66affSColin Finck THISCALL(fnTextSrv_TxDraw),
366c2c66affSColin Finck THISCALL(fnTextSrv_TxGetHScroll),
367c2c66affSColin Finck THISCALL(fnTextSrv_TxGetVScroll),
368c2c66affSColin Finck THISCALL(fnTextSrv_OnTxSetCursor),
369c2c66affSColin Finck THISCALL(fnTextSrv_TxQueryHitPoint),
370c2c66affSColin Finck THISCALL(fnTextSrv_OnTxInplaceActivate),
371c2c66affSColin Finck THISCALL(fnTextSrv_OnTxInplaceDeactivate),
372c2c66affSColin Finck THISCALL(fnTextSrv_OnTxUIActivate),
373c2c66affSColin Finck THISCALL(fnTextSrv_OnTxUIDeactivate),
374c2c66affSColin Finck THISCALL(fnTextSrv_TxGetText),
375c2c66affSColin Finck THISCALL(fnTextSrv_TxSetText),
376c2c66affSColin Finck THISCALL(fnTextSrv_TxGetCurTargetX),
377c2c66affSColin Finck THISCALL(fnTextSrv_TxGetBaseLinePos),
378c2c66affSColin Finck THISCALL(fnTextSrv_TxGetNaturalSize),
379c2c66affSColin Finck THISCALL(fnTextSrv_TxGetDropTarget),
380c2c66affSColin Finck THISCALL(fnTextSrv_OnTxPropertyBitsChange),
381c2c66affSColin Finck THISCALL(fnTextSrv_TxGetCachedSize)
382c2c66affSColin Finck };
383c2c66affSColin Finck
384c2c66affSColin Finck /******************************************************************
385c2c66affSColin Finck * CreateTextServices (RICHED20.4)
386c2c66affSColin Finck */
CreateTextServices(IUnknown * pUnkOuter,ITextHost * pITextHost,IUnknown ** ppUnk)387c2c66affSColin Finck HRESULT WINAPI CreateTextServices(IUnknown *pUnkOuter, ITextHost *pITextHost, IUnknown **ppUnk)
388c2c66affSColin Finck {
389c2c66affSColin Finck ITextServicesImpl *ITextImpl;
390c2c66affSColin Finck
391c2c66affSColin Finck TRACE("%p %p --> %p\n", pUnkOuter, pITextHost, ppUnk);
392c2c66affSColin Finck if (pITextHost == NULL)
393c2c66affSColin Finck return E_POINTER;
394c2c66affSColin Finck
395c2c66affSColin Finck ITextImpl = CoTaskMemAlloc(sizeof(*ITextImpl));
396c2c66affSColin Finck if (ITextImpl == NULL)
397c2c66affSColin Finck return E_OUTOFMEMORY;
398c2c66affSColin Finck InitializeCriticalSection(&ITextImpl->csTxtSrv);
399c2c66affSColin Finck ITextImpl->csTxtSrv.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ITextServicesImpl.csTxtSrv");
400c2c66affSColin Finck ITextImpl->ref = 1;
401c2c66affSColin Finck ITextHost_AddRef(pITextHost);
402c2c66affSColin Finck ITextImpl->pMyHost = pITextHost;
403c2c66affSColin Finck ITextImpl->IUnknown_inner.lpVtbl = &textservices_inner_vtbl;
404c2c66affSColin Finck ITextImpl->ITextServices_iface.lpVtbl = &textservices_vtbl;
405c2c66affSColin Finck ITextImpl->editor = ME_MakeEditor(pITextHost, FALSE);
406c2c66affSColin Finck
407c2c66affSColin Finck if (pUnkOuter)
408c2c66affSColin Finck ITextImpl->outer_unk = pUnkOuter;
409c2c66affSColin Finck else
410c2c66affSColin Finck ITextImpl->outer_unk = &ITextImpl->IUnknown_inner;
411c2c66affSColin Finck
412c2c66affSColin Finck *ppUnk = &ITextImpl->IUnknown_inner;
413c2c66affSColin Finck return S_OK;
414c2c66affSColin Finck }
415