ReactOS 0.4.16-dev-1279-gc894716
editstr.h
Go to the documentation of this file.
1/*
2 * RichEdit - structures and constant
3 *
4 * Copyright 2004 by Krzysztof Foltman
5 *
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.
10 *
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.
15 *
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
19 */
20
21#ifndef __EDITSTR_H
22#define __EDITSTR_H
23
24#include <assert.h>
25#include <stdarg.h>
26#include <stdio.h>
27#include <stdlib.h>
28#include <limits.h>
29
30#define COBJMACROS
31
32#include <windef.h>
33#include <winbase.h>
34#include <winnls.h>
35#include <winnt.h>
36#include <wingdi.h>
37#include <winuser.h>
38#include <richedit.h>
39#include <commctrl.h>
40#include <ole2.h>
41#include <richole.h>
42#include "imm.h"
43#include <textserv.h>
44#include <tom.h>
45#include "usp10.h"
46
47#include "wine/asm.h"
48#include "wine/debug.h"
49#include "wine/list.h"
50#include "wine/rbtree.h"
51
52typedef struct tagME_String
53{
56 void (*free)(struct tagME_String *);
58
59typedef struct tagME_FontCacheItem
60{
63 int nRefs;
64 int nAge;
66
67#define HFONT_CACHE_SIZE 10
68
69typedef struct tagME_Style
70{
72
73 ME_FontCacheItem *font_cache; /* cached font for the style */
74 TEXTMETRICW tm; /* cached font metrics for the style */
75 int nRefs; /* reference count */
77 struct list entry;
79
80typedef enum {
82 diTextStart, /* start of the text buffer */
83 diParagraph, /* paragraph start */
84 diCell, /* cell start */
85 diRun, /* run (sequence of chars with the same character format) */
86 diStartRow, /* start of the row (line of text on the screen) */
87 diTextEnd, /* end of the text buffer */
88
89 /********************* these below are meant for finding only *********************/
96} ME_DIType;
97
98#define SELECTIONBAR_WIDTH 8
99
100/******************************** run flags *************************/
101#define MERF_STYLEFLAGS 0x0FFF
102/* run contains non-text content, which has its own rules for wrapping, sizing etc */
103#define MERF_GRAPHICS 0x001
104/* run is a tab (or, in future, any kind of content whose size is dependent on run position) */
105#define MERF_TAB 0x002
106/* run is a cell boundary */
107#define MERF_ENDCELL 0x004 /* v4.1 */
108
109#define MERF_NONTEXT (MERF_GRAPHICS | MERF_TAB | MERF_ENDCELL)
110
111/* run is splittable (contains white spaces in the middle or end) */
112#define MERF_SPLITTABLE 0x001000
113/* run starts with whitespaces */
114#define MERF_STARTWHITE 0x002000
115/* run ends with whitespaces */
116#define MERF_ENDWHITE 0x004000
117/* run is completely made of whitespaces */
118#define MERF_WHITESPACE 0x008000
119/* the "end of paragraph" run, contains 1 character */
120#define MERF_ENDPARA 0x100000
121/* forcing the "end of row" run, contains 1 character */
122#define MERF_ENDROW 0x200000
123/* run is hidden */
124#define MERF_HIDDEN 0x400000
125/* start of a table row has an empty paragraph that should be skipped over. */
126#define MERF_TABLESTART 0x800000 /* v4.1 */
127
128/* runs with any of these flags set cannot be joined */
129#define MERF_NOJOIN (MERF_GRAPHICS|MERF_TAB|MERF_ENDPARA|MERF_ENDROW)
130/* runs that don't contain real text */
131#define MERF_NOTEXT (MERF_GRAPHICS|MERF_TAB|MERF_ENDPARA|MERF_ENDROW)
132
133/* those flags are kept when the row is split */
134#define MERF_SPLITMASK (~(0))
135
136/******************************** para flags *************************/
137
138/* this paragraph was already wrapped and hasn't changed, every change resets that flag */
139#define MEPF_REWRAP 0x01
140/* v4.1 */
141#define MEPF_CELL 0x04 /* The paragraph is nested in a cell */
142#define MEPF_ROWSTART 0x08 /* Hidden empty paragraph at the start of the row */
143#define MEPF_ROWEND 0x10 /* Visible empty paragraph at the end of the row */
144#define MEPF_COMPLEX 0x20 /* Use uniscribe */
145
146/******************************** structures *************************/
147
148struct tagME_DisplayItem;
149struct tagME_Run;
150
152{
153 struct list entry;
155 struct tagME_Run *run; /* ptr to the reobj's run */
156};
157
158typedef struct tagME_Run
159{
161 struct tagME_Paragraph *para; /* ptr to the run's paragraph */
162 int nCharOfs; /* relative to para's offset */
163 int len; /* length of run's text */
164 int nWidth; /* width of full run, width of leading&trailing ws */
166 int nAscent, nDescent; /* pixels above/below baseline */
167 POINT pt; /* relative to para's position */
168 struct re_object *reobj; /* FIXME: should be a union with strText (at least) */
169
179
180typedef struct tagME_Border
181{
182 int width;
185
186typedef struct tagME_BorderRect
187{
193
195{
200};
201
202typedef struct tagME_Paragraph
203{
206
207 struct tagME_Cell *cell; /* v4.1 */
209
214 int nRows;
216 ME_Run *eop_run; /* ptr to the end-of-para run */
220
221typedef struct tagME_Cell /* v4.1 */
222{
223 int nNestingLevel; /* 0 for normal cells, and greater for nested cells */
228 int yTextOffset; /* The text offset is caused by the largest top border. */
231
232typedef struct tagME_Row
233{
241
242/* the display item list layout is like this:
243 * - the document consists of paragraphs
244 * - each paragraph contains at least one run, the last run in the paragraph
245 * is an end-of-paragraph run
246 * - each formatted paragraph contains at least one row, which corresponds
247 * to a screen line (that's why there are no rows in an unformatted
248 * paragraph
249 * - the paragraphs contain "shortcut" pointers to the previous and the next
250 * paragraph, that makes iteration over paragraphs faster
251 * - the list starts with diTextStart and ends with diTextEnd
252 */
253
254typedef struct tagME_DisplayItem
255{
258 union {
265
266typedef struct tagME_TextBuffer
267{
272
273typedef struct tagME_Cursor
274{
279
280typedef enum {
286
287typedef enum {
292
294{
301 undo_end_transaction, /* marks the end of a group of changes for undo */
302 undo_potential_end_transaction /* allows grouping typed chars for undo */
304
306{
307 int pos, len;
311};
312
314{
315 int pos, len;
316};
317
319{
320 int pos;
321};
322
324{
325 int pos;
332};
333
335{
336 int pos;
339};
340
342{
343 int pos, len;
345};
346
348{
349 struct list entry;
351 union
352 {
359 } u;
360};
361
362typedef enum {
369
370typedef struct tagME_FontTableItem {
374
375
376#define STREAMIN_BUFFER_SIZE 4096 /* M$ compatibility */
377
383};
385
386typedef struct tagME_TextEditor
387{
388#ifdef __REACTOS__
390#endif
391 ITextHost2 *texthost;
392 unsigned int bEmulateVersion10 : 1;
393 unsigned int in_place_active : 1;
394 unsigned int have_texthost2 : 1;
397#ifdef __REACTOS__
398 DWORD styleFlags;
399#endif
406 int nAvailWidth; /* 0 = wrap to client area, else wrap width in twips */
427 LPRICHEDITOLECALLBACK lpOleCallback;
428 /*TEXTMODE variable; contains only one of each of the following options:
429 *TM_RICHTEXT or TM_PLAINTEXT
430 *TM_SINGLELEVELUNDO or TM_MULTILEVELUNDO
431 *TM_SINGLECODEPAGE or TM_MULTICODEPAGE*/
432 int mode;
438#ifndef __REACTOS__
439 /*for IME */
441#endif
442 DWORD selofs; /* The size of the selection bar on the left side of control */
444
445 /* Track previous notified selection */
447
448 /* Cache previously set scrollbar info */
450 unsigned int vert_sb_enabled : 1;
451 unsigned int horz_sb_enabled : 1;
452
462
463typedef struct tagME_Context
464{
472
473 /* those are valid inside ME_WrapTextParagraph and related */
476
478{
481
483};
484
486{
488 ITextServices ITextServices_iface;
497 char spare[256]; /* for bug #12179 */
498};
499
500#endif
HWND hWnd
Definition: settings.c:17
Definition: list.h:37
static HWND hwndParent
Definition: cryptui.c:300
struct tagME_Context ME_Context
#define HFONT_CACHE_SIZE
Definition: editstr.h:67
struct tagME_FontCacheItem ME_FontCacheItem
struct tagME_TextEditor ME_TextEditor
struct tagME_Style ME_Style
struct tagME_Run ME_Run
struct tagME_TextBuffer ME_TextBuffer
struct tagME_Border ME_Border
struct tagME_FontTableItem ME_FontTableItem
struct tagME_Row ME_Row
ME_DIType
Definition: editstr.h:80
@ diStartRow
Definition: editstr.h:86
@ diTextEnd
Definition: editstr.h:87
@ diRunOrParagraphOrEnd
Definition: editstr.h:95
@ diCell
Definition: editstr.h:84
@ diInvalid
Definition: editstr.h:81
@ diParagraphOrEnd
Definition: editstr.h:94
@ diRun
Definition: editstr.h:85
@ diStartRowOrParagraphOrEnd
Definition: editstr.h:91
@ diRunOrParagraph
Definition: editstr.h:92
@ diTextStart
Definition: editstr.h:82
@ diRunOrStartRow
Definition: editstr.h:93
@ diStartRowOrParagraph
Definition: editstr.h:90
@ diParagraph
Definition: editstr.h:83
#define STREAMIN_BUFFER_SIZE
Definition: editstr.h:376
ME_UndoMode
Definition: editstr.h:280
@ umAddBackToUndo
Definition: editstr.h:284
@ umAddToUndo
Definition: editstr.h:281
@ umAddToRedo
Definition: editstr.h:282
@ umIgnore
Definition: editstr.h:283
ME_UndoControlState
Definition: editstr.h:287
@ undoSuspended
Definition: editstr.h:289
@ undoDisabled
Definition: editstr.h:290
@ undoActive
Definition: editstr.h:288
struct tagME_DisplayItem ME_DisplayItem
struct tagME_Paragraph ME_Paragraph
struct tagME_Cursor ME_Cursor
struct tagME_BorderRect ME_BorderRect
struct tagME_Cell ME_Cell
ME_SelectionType
Definition: editstr.h:362
@ stWord
Definition: editstr.h:364
@ stParagraph
Definition: editstr.h:366
@ stPosition
Definition: editstr.h:363
@ stLine
Definition: editstr.h:365
@ stDocument
Definition: editstr.h:367
struct tagME_String ME_String
undo_type
Definition: editstr.h:294
@ undo_split_para
Definition: editstr.h:298
@ undo_join_paras
Definition: editstr.h:297
@ undo_set_char_fmt
Definition: editstr.h:300
@ undo_set_para_fmt
Definition: editstr.h:299
@ undo_end_transaction
Definition: editstr.h:301
@ undo_potential_end_transaction
Definition: editstr.h:302
@ undo_insert_run
Definition: editstr.h:295
@ undo_delete_run
Definition: editstr.h:296
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint buffer
Definition: glext.h:5915
static HDC
Definition: imagelist.c:88
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
long LONG
Definition: pedump.c:60
#define wine_rb_entry
Definition: rbtree.h:404
#define wine_rb_tree
Definition: rbtree.h:405
ME_Style * style
Definition: editstr.h:309
WCHAR * str
Definition: editstr.h:308
POINT pt
Definition: editstr.h:199
ME_Style * style
Definition: editstr.h:196
ME_String * text
Definition: editstr.h:197
INT width
Definition: editstr.h:198
struct list entry
Definition: editstr.h:153
struct tagME_Run * run
Definition: editstr.h:155
REOBJECT obj
Definition: editstr.h:154
CHARFORMAT2W fmt
Definition: editstr.h:344
ME_BorderRect border
Definition: editstr.h:338
PARAFORMAT2 fmt
Definition: editstr.h:337
int cell_right_boundary
Definition: editstr.h:331
ME_String * eol_str
Definition: editstr.h:328
ME_BorderRect cell_border
Definition: editstr.h:330
ME_BorderRect border
Definition: editstr.h:327
PARAFORMAT2 fmt
Definition: editstr.h:326
ME_Border bottom
Definition: editstr.h:190
ME_Border right
Definition: editstr.h:191
ME_Border left
Definition: editstr.h:189
ME_Border top
Definition: editstr.h:188
COLORREF colorRef
Definition: editstr.h:183
struct tagME_Cell * parent_cell
Definition: editstr.h:229
POINT pt
Definition: editstr.h:226
int nHeight
Definition: editstr.h:227
struct tagME_Cell * next_cell
Definition: editstr.h:229
int nRightBoundary
Definition: editstr.h:224
struct tagME_Cell * prev_cell
Definition: editstr.h:229
ME_BorderRect border
Definition: editstr.h:225
int nNestingLevel
Definition: editstr.h:223
int yTextOffset
Definition: editstr.h:228
int nWidth
Definition: editstr.h:227
ME_Style * current_style
Definition: editstr.h:470
HFONT orig_font
Definition: editstr.h:471
RECT rcView
Definition: editstr.h:467
int nAvailWidth
Definition: editstr.h:469
POINT pt
Definition: editstr.h:466
ME_TextEditor * editor
Definition: editstr.h:474
ME_Paragraph * para
Definition: editstr.h:275
int nOffset
Definition: editstr.h:277
ME_Run * run
Definition: editstr.h:276
ME_DIType type
Definition: editstr.h:256
union tagME_DisplayItem::@595 member
struct tagME_DisplayItem * prev
Definition: editstr.h:257
ME_Cell cell
Definition: editstr.h:261
struct tagME_DisplayItem * next
Definition: editstr.h:257
ME_Paragraph para
Definition: editstr.h:262
LOGFONTW lfSpecs
Definition: editstr.h:61
WCHAR * szFaceName
Definition: editstr.h:372
EDITSTREAM * editstream
Definition: editstr.h:379
DWORD dwUsed
Definition: editstr.h:381
DWORD dwSize
Definition: editstr.h:380
struct tagME_DisplayItem * next_para
Definition: editstr.h:217
ME_String * text
Definition: editstr.h:205
struct tagME_Cell * cell
Definition: editstr.h:207
struct wine_rb_entry marked_entry
Definition: editstr.h:218
ME_BorderRect border
Definition: editstr.h:208
struct tagME_DisplayItem * prev_para
Definition: editstr.h:217
PARAFORMAT2 fmt
Definition: editstr.h:204
ME_Run * eop_run
Definition: editstr.h:216
int nWidth
Definition: editstr.h:236
int nRMargin
Definition: editstr.h:238
int nBaseline
Definition: editstr.h:235
POINT pt
Definition: editstr.h:239
int nLMargin
Definition: editstr.h:237
int nHeight
Definition: editstr.h:234
int nAscent
Definition: editstr.h:166
int num_glyphs
Definition: editstr.h:171
POINT pt
Definition: editstr.h:167
GOFFSET * offsets
Definition: editstr.h:175
int nCharOfs
Definition: editstr.h:162
int nDescent
Definition: editstr.h:166
SCRIPT_VISATTR * vis_attrs
Definition: editstr.h:173
int max_clusters
Definition: editstr.h:176
struct tagME_Paragraph * para
Definition: editstr.h:161
int * advances
Definition: editstr.h:174
WORD * glyphs
Definition: editstr.h:172
ME_Style * style
Definition: editstr.h:160
SCRIPT_ANALYSIS script_analysis
Definition: editstr.h:170
int nWidth
Definition: editstr.h:164
struct re_object * reobj
Definition: editstr.h:168
int max_glyphs
Definition: editstr.h:171
int nFlags
Definition: editstr.h:165
int len
Definition: editstr.h:163
WORD * clusters
Definition: editstr.h:177
WCHAR * szData
Definition: editstr.h:54
int nLen
Definition: editstr.h:55
int nBuffer
Definition: editstr.h:55
void(* free)(struct tagME_String *)
Definition: editstr.h:56
CHARFORMAT2W fmt
Definition: editstr.h:71
struct list entry
Definition: editstr.h:77
SCRIPT_CACHE script_cache
Definition: editstr.h:76
ME_FontCacheItem * font_cache
Definition: editstr.h:73
int nRefs
Definition: editstr.h:75
TEXTMETRICW tm
Definition: editstr.h:74
ME_DisplayItem * pFirst
Definition: editstr.h:268
ME_Style * pDefaultStyle
Definition: editstr.h:270
ME_Style * pCharStyle
Definition: editstr.h:269
ME_DisplayItem * pLast
Definition: editstr.h:268
unsigned int horz_sb_enabled
Definition: editstr.h:451
unsigned int have_texthost2
Definition: editstr.h:394
EDITWORDBREAKPROCW pfnWordBreak
Definition: editstr.h:425
ME_FontCacheItem pFontCache[HFONT_CACHE_SIZE]
Definition: editstr.h:420
struct list redo_stack
Definition: editstr.h:412
int nZoomNumerator
Definition: editstr.h:421
unsigned int vert_sb_enabled
Definition: editstr.h:450
SCROLLINFO vert_si
Definition: editstr.h:449
ME_Paragraph * last_sel_end_para
Definition: editstr.h:419
int nLastTotalWidth
Definition: editstr.h:405
int nUndoStackSize
Definition: editstr.h:413
ME_UndoControlState undo_ctl_state
Definition: editstr.h:416
DWORD scrollbars
Definition: editstr.h:401
ME_UndoMode nUndoMode
Definition: editstr.h:415
ITextHost2 * texthost
Definition: editstr.h:391
TXTBACKSTYLE back_style
Definition: editstr.h:457
DWORD freeze_count
Definition: editstr.h:437
ME_Paragraph * last_sel_start_para
Definition: editstr.h:419
struct list reobj_list
Definition: editstr.h:459
ME_SelectionType nSelectionType
Definition: editstr.h:443
BOOL AutoURLDetect_bEnable
Definition: editstr.h:434
ME_Cursor * pCursors
Definition: editstr.h:396
LONG nLastSelEnd
Definition: editstr.h:418
LPRICHEDITOLECALLBACK lpOleCallback
Definition: editstr.h:427
SCROLLINFO horz_si
Definition: editstr.h:449
ME_TextBuffer * pBuffer
Definition: editstr.h:395
int nZoomDenominator
Definition: editstr.h:421
WCHAR password_char
Definition: editstr.h:435
CHARRANGE notified_cr
Definition: editstr.h:446
IRichEditOle * richole
Definition: editstr.h:426
struct list style_list
Definition: editstr.h:458
BOOL caret_hidden
Definition: editstr.h:454
LONG nLastSelStart
Definition: editstr.h:418
BOOL bMouseCaptured
Definition: editstr.h:455
struct wine_rb_tree marked_paras
Definition: editstr.h:460
unsigned int bEmulateVersion10
Definition: editstr.h:392
struct list undo_stack
Definition: editstr.h:411
unsigned int in_place_active
Definition: editstr.h:393
int nLastTotalLength
Definition: editstr.h:404
BOOL bHideSelection
Definition: editstr.h:433
ITextSelection ITextSelection_iface
Definition: editstr.h:479
struct text_services * services
Definition: editstr.h:482
IUnknown IUnknown_inner
Definition: editstr.h:487
ME_TextEditor * editor
Definition: editstr.h:493
ITextDocument2Old ITextDocument2Old_iface
Definition: editstr.h:490
IUnknown * outer_unk
Definition: editstr.h:491
char spare[256]
Definition: editstr.h:497
struct list clientsites
Definition: editstr.h:496
struct text_selection * text_selection
Definition: editstr.h:494
struct list rangelist
Definition: editstr.h:495
IRichEditOle IRichEditOle_iface
Definition: editstr.h:489
ITextServices ITextServices_iface
Definition: editstr.h:488
struct delete_run_item delete_run
Definition: editstr.h:354
union undo_item::@596 u
struct set_para_fmt_item set_para_fmt
Definition: editstr.h:357
struct split_para_item split_para
Definition: editstr.h:356
struct list entry
Definition: editstr.h:349
struct join_paras_item join_paras
Definition: editstr.h:355
enum undo_type type
Definition: editstr.h:350
struct insert_run_item insert_run
Definition: editstr.h:353
struct set_char_fmt_item set_char_fmt
Definition: editstr.h:358
enum _TXTBACKSTYLE TXTBACKSTYLE
int32_t INT
Definition: typedefs.h:58
DWORD COLORREF
Definition: windef.h:300
int(CALLBACK * EDITWORDBREAKPROCW)(LPWSTR, int, int, int)
Definition: winuser.h:2981
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: xxhash.c:193