include: Added msftedit support in richedit.h.
[wine] / include / textserv.h
1 /*
2  * Copyright (C) 2005 Mike McCormack
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #ifndef _TEXTSERV_H
20 #define _TEXTSERV_H
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 DEFINE_GUID(IID_ITextServices,0x8d33f740,0xcf58,0x11ce,0xa8,0x9d,0x00,0xaa,0x00,0x6c,0xad,0xc5);
27 DEFINE_GUID(IID_ITextHost,    0xc5bdd8d0,0xd26e,0x11ce,0xa8,0x9e,0x00,0xaa,0x00,0x6c,0xad,0xc5);
28 DEFINE_GUID(IID_ITextHost2,   0xc5bdd8d0,0xd26e,0x11ce,0xa8,0x9e,0x00,0xaa,0x00,0x6c,0xad,0xc5);
29
30 /*****************************************************************************
31  * ITextServices interface
32  */
33 #define INTERFACE ITextServices
34 DECLARE_INTERFACE_(ITextServices,IUnknown)
35 {
36     /*** IUnknown methods ***/
37     STDMETHOD(QueryInterface)(THIS_
38         REFIID riid,
39         void** ppvObject) PURE;
40
41     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
42
43     STDMETHOD_(ULONG,Release)(THIS) PURE;
44
45     /*** ITextServices methods ***/
46
47     STDMETHOD(TxSendMessage)( THIS_
48         UINT msg, WPARAM wparam, LPARAM lparam, LRESULT* plresult) PURE;
49
50     STDMETHOD(TxDraw)( THIS_
51         DWORD dwDrawAspect,
52         LONG lindex,
53         void* pvAspect,
54         DVTARGETDEVICE* ptd,
55         HDC hdcDraw,
56         HDC hicTargetDev,
57         LPCRECTL lprcBounds,
58         LPCRECTL lprcWBounds,
59         LPRECT lprcUpdate,
60         BOOL (CALLBACK * pfnContinue)(DWORD),
61         DWORD dwContinue,
62         LONG lViewId) PURE;
63
64     STDMETHOD(TxGetHScroll)( THIS_
65         LONG* plMin,
66         LONG* plMax,
67         LONG* plPos,
68         LONG* plPage,
69         BOOL* pfEnabled) PURE;
70
71     STDMETHOD(TxGetVScroll)( THIS_
72         LONG* plMin,
73         LONG* plMax,
74         LONG* plPos,
75         LONG* plPage,
76         BOOL* pfEnabled) PURE;
77
78     STDMETHOD(OnTxSetCursor)( THIS_
79         DWORD dwDrawAspect,
80         LONG lindex,
81         void* pvAspect,
82         DVTARGETDEVICE* ptd,
83         HDC hdcDraw,
84         HDC hicTargetDev,
85         LPCRECT lprcClient,
86         INT x,
87         INT y) PURE;
88
89     STDMETHOD(TxQueryHitPoint)( THIS_
90         DWORD dwDrawAspect,
91         LONG lindex,
92         void* pvAspect,
93         DVTARGETDEVICE* ptd,
94         HDC hdcDraw,
95         HDC hicTargetDev,
96         LPCRECT lprcClient,
97         INT x,
98         INT y,
99         DWORD* pHitResult) PURE;
100
101     STDMETHOD(OnTxInplaceActivate)( THIS_
102         LPCRECT prcClient) PURE;
103
104     STDMETHOD(OnTxInplaceDeactivate)( THIS ) PURE;
105
106     STDMETHOD(OnTxUIActivate)( THIS ) PURE;
107
108     STDMETHOD(OnTxUIDeactivate)( THIS ) PURE;
109
110     STDMETHOD(TxGetText)( THIS_
111         BSTR* pbstrText) PURE;
112
113     STDMETHOD(TxSetText)( THIS_
114         LPCWSTR pszText) PURE;
115
116     STDMETHOD(TxGetCurrentTargetX)( THIS_
117         LONG* x) PURE;
118
119     STDMETHOD(TxGetBaseLinePos)( THIS_
120         LONG* x) PURE;
121
122     STDMETHOD(TxGetNaturalSize)( THIS_
123         DWORD dwAspect,
124         HDC hdcDraw,
125         HDC hicTargetDev,
126         DVTARGETDEVICE* ptd,
127         DWORD dwMode,
128         const SIZEL* psizelExtent,
129         LONG* pwidth,
130         LONG* pheight) PURE;
131
132     STDMETHOD(TxGetDropTarget)( THIS_
133         IDropTarget** ppDropTarget) PURE;
134
135     STDMETHOD(OnTxPropertyBitsChange)( THIS_
136         DWORD dwMask,
137         DWORD dwBits) PURE;
138
139     STDMETHOD(TxGetCachedSize)( THIS_
140         DWORD* pdwWidth,
141         DWORD* pdwHeight) PURE;
142
143 };
144
145 #ifdef COBJMACROS
146 /*** IUnknown methods ***/
147 #define ITextServices_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
148 #define ITextServices_AddRef(p) (p)->lpVtbl->AddRef(p)
149 #define ITextServices_Release(p) (p)->lpVtbl->Release(p)
150 /*** ITextServices methods ***/
151 #define ITextServices_TxSendMessage(p,a,b,c,d) (p)->lpVtbl->TxSendMessage(p,a,b,c,d)
152 #define ITextServices_TxDraw(p,a,b,c,d,e,f,g,h,i,j,k,l) (p)->lpVtbl->TxDraw(p,a,b,c,d,e,f,g,h,i,j,k,l)
153 #define ITextServices_TxGetHScroll(p,a,b,c,d,e) (p)->lpVtbl->TxGetHScroll(p,a,b,c,d,e)
154 #define ITextServices_TxGetVScroll(p,a,b,c,d,e) (p)->lpVtbl->TxGetVScroll(p,a,b,c,d,e)
155 #define ITextServices_OnTxSetCursor(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->OnTxSetCursor(p,a,b,c,d,e,f,g,h,i)
156 #define ITextServices_TxQueryHitPoint(p,a,b,c,d,e,f,g,h,i,j) (p)->lpVtbl->TxQueryHitPoint(p,a,b,c,d,e,f,g,h,i,j)
157 #define ITextServices_OnTxInplaceActivate(p,a) (p)->lpVtbl->OnTxInplaceActivate(p,a)
158 #define ITextServices_OnTxInplaceDeactivate(p) (p)->lpVtbl->OnTxInplaceDeactivate(p)
159 #define ITextServices_OnTxUIActivate(p) (p)->lpVtbl->OnTxUIActivate(p)
160 #define ITextServices_OnTxUIDeactivate(p) (p)->lpVtbl->OnTxUIDeactivate(p)
161 #define ITextServices_TxGetText(p,a) (p)->lpVtbl->TxGetText(p,a)
162 #define ITextServices_TxSetText(p,a) (p)->lpVtbl->TxSetText(p,a)
163 #define ITextServices_TxGetCurrentTargetX(p,a) (p)->lpVtbl->TxGetCurrentTargetX(p,a)
164 #define ITextServices_TxGetBaseLinePos(p,a) (p)->lpVtbl->TxGetBaseLinePos(p,a)
165 #define ITextServices_TxGetNaturalSize(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->TxGetNaturalSize(p,a,b,c,d,e,f,g,h)
166 #define ITextServices_TxGetDropTarget(p,a) (p)->lpVtbl->TxGetDropTarget(p,a)
167 #define ITextServices_OnTxPropertyBitsChange(p,a,b) (p)->lpVtbl->OnTxPropertyBitsChange(p,a,b)
168 #define ITextServices_TxGetCachedSize(p,a,b) (p)->lpVtbl->TxGetCachedSize(p,a,b)
169 #endif
170
171 #undef INTERFACE
172
173 typedef enum _TXTBACKSTYLE {
174     TXTBACK_TRANSPARENT = 0,
175     TXTBACK_OPAQUE
176 } TXTBACKSTYLE;
177
178 enum TXTHITRESULT {
179     TXTHITRESULT_NOHIT = 0,
180     TXTHITRESULT_TRANSPARENT = 1,
181     TXTHITRESULT_CLOSE = 2,
182     TXTHITRESULT_HIT = 3
183 };
184
185 enum TXTNATURALSIZE {
186     TXTNS_FITTOCONTENT = 1,
187     TXTNS_ROUNDTOLINE = 2
188 };
189
190 enum TXTVIEW {
191     TXTVIEW_ACTIVE = 0,
192     TXTVIEW_INACTIVE = 1
193 };
194
195 #define TXTBIT_RICHTEXT         0x000001
196 #define TXTBIT_MULTILINE        0x000002
197 #define TXTBIT_READONLY         0x000004
198 #define TXTBIT_SHOWACCELERATOR  0x000008
199 #define TXTBIT_USEPASSWORD      0x000010
200 #define TXTBIT_HIDESELECTION    0x000020
201 #define TXTBIT_SAVESELECTION    0x000040
202 #define TXTBIT_AUTOWORDSEL      0x000080
203 #define TXTBIT_VERTICAL         0x000100
204 #define TXTBIT_SELBARCHANGE     0x000200
205 #define TXTBIT_WORDWRAP         0x000400
206 #define TXTBIT_ALLOWBEEP        0x000800
207 #define TXTBIT_DISABLEDRAG      0x001000
208 #define TXTBIT_VIEWINSETCHANGE  0x002000
209 #define TXTBIT_BACKSTYLECHANGE  0x004000
210 #define TXTBIT_MAXLENGTHCHANGE  0x008000
211 #define TXTBIT_SCROLLBARCHANGE  0x010000
212 #define TXTBIT_CHARFORMATCHANGE 0x020000
213 #define TXTBIT_PARAFORMATCHANGE 0x040000
214 #define TXTBIT_EXTENTCHANGE     0x080000
215 #define TXTBIT_CLIENTRECTCHANGE 0x100000
216 #define TXTBIT_USECURRENTBKG    0x200000
217
218 /*****************************************************************************
219  * ITextHost interface
220  */
221 #define INTERFACE ITextHost
222 DECLARE_INTERFACE_(ITextHost,IUnknown)
223 {
224     /*** IUnknown methods ***/
225     STDMETHOD(QueryInterface)(THIS_
226         REFIID riid,
227         void** ppvObject) PURE;
228
229     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
230
231     STDMETHOD_(ULONG,Release)(THIS) PURE;
232
233     /*** ITextHost methods ***/
234     STDMETHOD_(HDC,TxGetDC)( THIS
235         ) PURE;
236
237     STDMETHOD_(INT,TxReleaseDC)( THIS_
238         HDC hdc) PURE;
239
240     STDMETHOD_(BOOL,TxShowScrollBar)( THIS_
241         INT fnBar,
242         BOOL fShow) PURE;
243
244     STDMETHOD_(BOOL,TxEnableScrollBar)( THIS_
245         INT fuSBFlags,
246         INT fuArrowflags) PURE;
247
248     STDMETHOD_(BOOL,TxSetScrollRange)( THIS_
249         INT fnBar,
250         LONG nMinPos,
251         INT nMaxPos,
252         BOOL fRedraw) PURE;
253
254     STDMETHOD_(BOOL,TxSetScrollPos)( THIS_
255         INT fnBar,
256         INT nPos,
257         BOOL fRedraw) PURE;
258
259     STDMETHOD_(void,TxInvalidateRect)( THIS_
260         LPCRECT prc,
261         BOOL fMode) PURE;
262
263     STDMETHOD_(void,TxViewChange)( THIS_
264         BOOL fUpdate) PURE;
265
266     STDMETHOD_(BOOL,TxCreateCaret)( THIS_
267         HBITMAP hbmp,
268         INT xWidth,
269         INT yHeight) PURE;
270
271     STDMETHOD_(BOOL,TxShowCaret)( THIS_
272         BOOL fShow) PURE;
273
274     STDMETHOD_(BOOL,TxSetCarentPos)( THIS_
275         INT x,
276         INT y) PURE;
277
278     STDMETHOD_(BOOL,TxSetTimer)( THIS_
279         UINT idTimer,
280         UINT uTimeout) PURE;
281
282     STDMETHOD_(void,TxKillTimer)( THIS_
283         UINT idTimer) PURE;
284
285     STDMETHOD_(void,TxScrollWindowEx)( THIS_
286         INT dx,
287         INT dy,
288         LPCRECT lprcScroll,
289         LPCRECT lprcClip,
290         HRGN hRgnUpdate,
291         LPRECT lprcUpdate,
292         UINT fuScroll) PURE;
293
294     STDMETHOD_(void,TxSetCapture)( THIS_
295         BOOL fCapture) PURE;
296
297     STDMETHOD_(void,TxSetFocus)( THIS
298         ) PURE;
299
300     STDMETHOD_(void,TxSetCursor)( THIS_
301         HCURSOR hcur,
302         BOOL fText) PURE;
303
304     STDMETHOD_(BOOL,TxScreenToClient)( THIS_
305         LPPOINT lppt) PURE;
306
307     STDMETHOD_(BOOL,TxClientToScreen)( THIS_
308         LPPOINT lppt) PURE;
309
310     STDMETHOD(TxActivate)( THIS_
311         LONG* plOldState) PURE;
312
313     STDMETHOD(TxDeactivate)( THIS_
314         LONG lNewState) PURE;
315
316     STDMETHOD(TxGetClientRect)( THIS_
317         LPRECT prc) PURE;
318
319     STDMETHOD(TxGetViewInset)( THIS_
320         LPRECT prc) PURE;
321
322     STDMETHOD(TxGetCharFormat)( THIS_
323         const CHARFORMATW** ppCF) PURE;
324
325     STDMETHOD(TxGetParaFormat)( THIS_
326         const PARAFORMAT** ppPF) PURE;
327
328     STDMETHOD_(COLORREF,TxGetSysColor)( THIS_
329         int nIndex) PURE;
330
331     STDMETHOD(TxGetBackStyle)( THIS_
332         TXTBACKSTYLE* pStyle) PURE;
333
334     STDMETHOD(TxGetMaxLength)( THIS_
335         DWORD* plength) PURE;
336
337     STDMETHOD(TxGetScrollbars)( THIS_
338         DWORD* pdwScrollBar) PURE;
339
340     STDMETHOD(TxGetPasswordChar)( THIS_
341         WCHAR* pch) PURE;
342
343     STDMETHOD(TxGetAcceleratorPos)( THIS_
344         LONG* pch) PURE;
345
346     STDMETHOD(TxGetExtent)( THIS_
347         LPSIZEL lpExtent) PURE;
348
349     STDMETHOD(OnTxCharFormatChange)( THIS_
350         const CHARFORMATW* pcf) PURE;
351
352     STDMETHOD(OnTxParaFormatChange)( THIS_
353         const PARAFORMAT* ppf) PURE;
354
355     STDMETHOD(TxGetPropertyBits)( THIS_
356         DWORD dwMask,
357         DWORD* pdwBits) PURE;
358
359     STDMETHOD(TxNotify)( THIS_
360         DWORD iNotify,
361         void* pv) PURE;
362
363     STDMETHOD_(HIMC,TxImmGetContext)( THIS
364         ) PURE;
365
366     STDMETHOD_(void,TxImmReleaseContext)( THIS_
367         HIMC himc) PURE;
368
369     STDMETHOD(TxGetSelectionBarWidth)( THIS_
370         LONG* lSelBarWidth) PURE;
371
372 };
373
374 #ifdef COBJMACROS
375 /*** IUnknown methods ***/
376 #define ITextHost_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
377 #define ITextHost_AddRef(p) (p)->lpVtbl->AddRef(p)
378 #define ITextHost_Release(p) (p)->lpVtbl->Release(p)
379 /*** ITextHost methods ***/
380 #define ITextHost_TxGetDC(p) (p)->lpVtbl->TxGetDC(p)
381 #define ITextHost_TxReleaseDC(p,a) (p)->lpVtbl->TxReleaseDC(p,a)
382 #define ITextHost_TxShowScrollBar(p,a,b) (p)->lpVtbl->TxShowScrollBar(p,a,b)
383 #define ITextHost_TxEnableScrollBar(p,a,b) (p)->lpVtbl->TxEnableScrollBar(p,a,b)
384 #define ITextHost_TxSetScrollRange(p,a,b,c,d) (p)->lpVtbl->TxSetScrollRange(p,a,b,c,d)
385 #define ITextHost_TxSetScrollPos(p,a,b,c) (p)->lpVtbl->TxSetScrollPos(p,a,b,c)
386 #define ITextHost_TxInvalidateRect(p,a,b) (p)->lpVtbl->TxInvalidateRect(p,a,b)
387 #define ITextHost_TxViewChange(p,a) (p)->lpVtbl->TxViewChange(p,a)
388 #define ITextHost_TxCreateCaret(p,a,b,c) (p)->lpVtbl->TxCreateCaret(p,a,b,c)
389 #define ITextHost_TxShowCaret(p,a) (p)->lpVtbl->TxShowCaret(p,a)
390 #define ITextHost_TxSetCarentPos(p,a,b) (p)->lpVtbl->TxSetCarentPos(p,a,b)
391 #define ITextHost_TxSetTimer(p,a,b) (p)->lpVtbl->TxSetTimer(p,a,b)
392 #define ITextHost_TxKillTimer(p,a) (p)->lpVtbl->TxKillTimer(p,a)
393 #define ITextHost_TxScrollWindowEx(p,a,b,c,d,e,f,g) (p)->lpVtbl->TxScrollWindowEx(p,a,b,c,d,e,f,g)
394 #define ITextHost_TxSetCapture(p,a) (p)->lpVtbl->TxSetCapture(p,a)
395 #define ITextHost_TxSetFocus(p) (p)->lpVtbl->TxSetFocus(p)
396 #define ITextHost_TxSetCursor(p,a,b) (p)->lpVtbl->TxSetCursor(p,a,b)
397 #define ITextHost_TxScreenToClient(p,a) (p)->lpVtbl->TxScreenToClient(p,a)
398 #define ITextHost_TxClientToScreen(p,a) (p)->lpVtbl->TxClientToScreen(p,a)
399 #define ITextHost_TxActivate(p,a) (p)->lpVtbl->TxActivate(p,a)
400 #define ITextHost_TxDeactivate(p,a) (p)->lpVtbl->TxDeactivate(p,a)
401 #define ITextHost_TxGetClientRect(p,a) (p)->lpVtbl->TxGetClientRect(p,a)
402 #define ITextHost_TxGetViewInset(p,a) (p)->lpVtbl->TxGetViewInset(p,a)
403 #define ITextHost_TxGetCharFormat(p,a) (p)->lpVtbl->TxGetCharFormat(p,a)
404 #define ITextHost_TxGetParaFormat(p,a) (p)->lpVtbl->TxGetParaFormat(p,a)
405 #define ITextHost_TxGetSysColor(p,a) (p)->lpVtbl->TxGetSysColor(p,a)
406 #define ITextHost_TxGetBackStyle(p,a) (p)->lpVtbl->TxGetBackStyle(p,a)
407 #define ITextHost_TxGetMaxLength(p,a) (p)->lpVtbl->TxGetMaxLength(p,a)
408 #define ITextHost_TxGetScrollbars(p,a) (p)->lpVtbl->TxGetScrollbars(p,a)
409 #define ITextHost_TxGetPasswordChar(p,a) (p)->lpVtbl->TxGetPasswordChar(p,a)
410 #define ITextHost_TxGetAcceleratorPos(p,a) (p)->lpVtbl->TxGetAcceleratorPos(p,a)
411 #define ITextHost_TxGetExtent(p,a) (p)->lpVtbl->TxGetExtent(p,a)
412 #define ITextHost_OnTxCharFormatChange(p,a) (p)->lpVtbl->OnTxCharFormatChange(p,a)
413 #define ITextHost_OnTxParaFormatChange(p,a) (p)->lpVtbl->OnTxParaFormatChange(p,a)
414 #define ITextHost_TxGetPropertyBits(p,a,b) (p)->lpVtbl->TxGetPropertyBits(p,a,b)
415 #define ITextHost_TxNotify(p,a,b) (p)->lpVtbl->TxNotify(p,a,b)
416 #define ITextHost_TxImmGetContext(p) (p)->lpVtbl->TxImmGetContext(p)
417 #define ITextHost_TxImmReleaseContext(p,a) (p)->lpVtbl->TxImmReleaseContext(p,a)
418 #define ITextHost_TxGetSelectionBarWidth(p,a) (p)->lpVtbl->TxGetSelectionBarWidth(p,a)
419 #endif
420
421 #undef INTERFACE
422
423 HRESULT WINAPI CreateTextServices(IUnknown*,ITextHost*,IUnknown**);
424
425 typedef HRESULT (WINAPI *PCreateTextServices)(IUnknown*,ITextHost*,IUnknown**);
426
427 #ifdef __cplusplus
428 }
429 #endif
430
431 #endif /* _TEXTSERV_H */