ReactOS 0.4.16-dev-838-g27bb510
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/heap.h"
50#include "wine/list.h"
51#include "wine/rbtree.h"
52
53typedef struct tagME_String
54{
57 void (*free)(struct tagME_String *);
59
60typedef struct tagME_FontCacheItem
61{
64 int nRefs;
65 int nAge;
67
68#define HFONT_CACHE_SIZE 10
69
70typedef struct tagME_Style
71{
73
74 ME_FontCacheItem *font_cache; /* cached font for the style */
75 TEXTMETRICW tm; /* cached font metrics for the style */
76 int nRefs; /* reference count */
78 struct list entry;
80
81typedef enum {
83 diTextStart, /* start of the text buffer */
84 diParagraph, /* paragraph start */
85 diCell, /* cell start */
86 diRun, /* run (sequence of chars with the same character format) */
87 diStartRow, /* start of the row (line of text on the screen) */
88 diTextEnd, /* end of the text buffer */
89
90 /********************* these below are meant for finding only *********************/
97} ME_DIType;
98
99#define SELECTIONBAR_WIDTH 8
100
101/******************************** run flags *************************/
102#define MERF_STYLEFLAGS 0x0FFF
103/* run contains non-text content, which has its own rules for wrapping, sizing etc */
104#define MERF_GRAPHICS 0x001
105/* run is a tab (or, in future, any kind of content whose size is dependent on run position) */
106#define MERF_TAB 0x002
107/* run is a cell boundary */
108#define MERF_ENDCELL 0x004 /* v4.1 */
109
110#define MERF_NONTEXT (MERF_GRAPHICS | MERF_TAB | MERF_ENDCELL)
111
112/* run is splittable (contains white spaces in the middle or end) */
113#define MERF_SPLITTABLE 0x001000
114/* run starts with whitespaces */
115#define MERF_STARTWHITE 0x002000
116/* run ends with whitespaces */
117#define MERF_ENDWHITE 0x004000
118/* run is completely made of whitespaces */
119#define MERF_WHITESPACE 0x008000
120/* the "end of paragraph" run, contains 1 character */
121#define MERF_ENDPARA 0x100000
122/* forcing the "end of row" run, contains 1 character */
123#define MERF_ENDROW 0x200000
124/* run is hidden */
125#define MERF_HIDDEN 0x400000
126/* start of a table row has an empty paragraph that should be skipped over. */
127#define MERF_TABLESTART 0x800000 /* v4.1 */
128
129/* runs with any of these flags set cannot be joined */
130#define MERF_NOJOIN (MERF_GRAPHICS|MERF_TAB|MERF_ENDPARA|MERF_ENDROW)
131/* runs that don't contain real text */
132#define MERF_NOTEXT (MERF_GRAPHICS|MERF_TAB|MERF_ENDPARA|MERF_ENDROW)
133
134/* those flags are kept when the row is split */
135#define MERF_SPLITMASK (~(0))
136
137/******************************** para flags *************************/
138
139/* this paragraph was already wrapped and hasn't changed, every change resets that flag */
140#define MEPF_REWRAP 0x01
141/* v4.1 */
142#define MEPF_CELL 0x04 /* The paragraph is nested in a cell */
143#define MEPF_ROWSTART 0x08 /* Hidden empty paragraph at the start of the row */
144#define MEPF_ROWEND 0x10 /* Visible empty paragraph at the end of the row */
145#define MEPF_COMPLEX 0x20 /* Use uniscribe */
146
147/******************************** structures *************************/
148
149struct tagME_DisplayItem;
150
152{
153 struct list entry;
155};
156
157typedef struct tagME_Run
158{
160 struct tagME_Paragraph *para; /* ptr to the run's paragraph */
161 int nCharOfs; /* relative to para's offset */
162 int len; /* length of run's text */
163 int nWidth; /* width of full run, width of leading&trailing ws */
165 int nAscent, nDescent; /* pixels above/below baseline */
166 POINT pt; /* relative to para's position */
167 struct re_object *reobj; /* FIXME: should be a union with strText (at least) */
168
178
179typedef struct tagME_Border
180{
181 int width;
184
185typedef struct tagME_BorderRect
186{
192
194{
199};
200
201typedef struct tagME_Paragraph
202{
205
206 struct tagME_Cell *cell; /* v4.1 */
208
213 int nRows;
215 ME_Run *eop_run; /* ptr to the end-of-para run */
219
220typedef struct tagME_Cell /* v4.1 */
221{
222 int nNestingLevel; /* 0 for normal cells, and greater for nested cells */
227 int yTextOffset; /* The text offset is caused by the largest top border. */
230
231typedef struct tagME_Row
232{
240
241/* the display item list layout is like this:
242 * - the document consists of paragraphs
243 * - each paragraph contains at least one run, the last run in the paragraph
244 * is an end-of-paragraph run
245 * - each formatted paragraph contains at least one row, which corresponds
246 * to a screen line (that's why there are no rows in an unformatted
247 * paragraph
248 * - the paragraphs contain "shortcut" pointers to the previous and the next
249 * paragraph, that makes iteration over paragraphs faster
250 * - the list starts with diTextStart and ends with diTextEnd
251 */
252
253typedef struct tagME_DisplayItem
254{
257 union {
264
265typedef struct tagME_TextBuffer
266{
271
272typedef struct tagME_Cursor
273{
278
279typedef enum {
285
287{
294 undo_end_transaction, /* marks the end of a group of changes for undo */
295 undo_potential_end_transaction /* allows grouping typed chars for undo */
297
299{
300 int pos, len;
304};
305
307{
308 int pos, len;
309};
310
312{
313 int pos;
314};
315
317{
318 int pos;
325};
326
328{
329 int pos;
332};
333
335{
336 int pos, len;
338};
339
341{
342 struct list entry;
344 union
345 {
352 } u;
353};
354
355typedef enum {
362
363typedef struct tagME_FontTableItem {
367
368
369#define STREAMIN_BUFFER_SIZE 4096 /* M$ compatibility */
370
376};
378
379typedef struct tagME_TextEditor
380{
381#ifdef __REACTOS__
383#endif
384 ITextHost2 *texthost;
385 unsigned int bEmulateVersion10 : 1;
386 unsigned int in_place_active : 1;
387 unsigned int have_texthost2 : 1;
390#ifdef __REACTOS__
391 DWORD styleFlags;
392#endif
399 int nAvailWidth; /* 0 = wrap to client area, else wrap width in twips */
419 LPRICHEDITOLECALLBACK lpOleCallback;
420 /*TEXTMODE variable; contains only one of each of the following options:
421 *TM_RICHTEXT or TM_PLAINTEXT
422 *TM_SINGLELEVELUNDO or TM_MULTILEVELUNDO
423 *TM_SINGLECODEPAGE or TM_MULTICODEPAGE*/
424 int mode;
429#ifndef __REACTOS__
430 /*for IME */
432#endif
433 DWORD selofs; /* The size of the selection bar on the left side of control */
435
436 /* Track previous notified selection */
438
439 /* Cache previously set scrollbar info */
441 unsigned int vert_sb_enabled : 1;
442 unsigned int horz_sb_enabled : 1;
443
453
454typedef struct tagME_Context
455{
463
464 /* those are valid inside ME_WrapTextParagraph and related */
467
469{
472
474};
475
477{
479 ITextServices ITextServices_iface;
488 char spare[256]; /* for bug #12179 */
489};
490
491#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:68
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:81
@ diStartRow
Definition: editstr.h:87
@ diTextEnd
Definition: editstr.h:88
@ diRunOrParagraphOrEnd
Definition: editstr.h:96
@ diCell
Definition: editstr.h:85
@ diInvalid
Definition: editstr.h:82
@ diParagraphOrEnd
Definition: editstr.h:95
@ diRun
Definition: editstr.h:86
@ diStartRowOrParagraphOrEnd
Definition: editstr.h:92
@ diRunOrParagraph
Definition: editstr.h:93
@ diTextStart
Definition: editstr.h:83
@ diRunOrStartRow
Definition: editstr.h:94
@ diStartRowOrParagraph
Definition: editstr.h:91
@ diParagraph
Definition: editstr.h:84
#define STREAMIN_BUFFER_SIZE
Definition: editstr.h:369
ME_UndoMode
Definition: editstr.h:279
@ umAddBackToUndo
Definition: editstr.h:283
@ umAddToUndo
Definition: editstr.h:280
@ umAddToRedo
Definition: editstr.h:281
@ umIgnore
Definition: editstr.h:282
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:355
@ stWord
Definition: editstr.h:357
@ stParagraph
Definition: editstr.h:359
@ stPosition
Definition: editstr.h:356
@ stLine
Definition: editstr.h:358
@ stDocument
Definition: editstr.h:360
struct tagME_String ME_String
undo_type
Definition: editstr.h:287
@ undo_split_para
Definition: editstr.h:291
@ undo_join_paras
Definition: editstr.h:290
@ undo_set_char_fmt
Definition: editstr.h:293
@ undo_set_para_fmt
Definition: editstr.h:292
@ undo_end_transaction
Definition: editstr.h:294
@ undo_potential_end_transaction
Definition: editstr.h:295
@ undo_insert_run
Definition: editstr.h:288
@ undo_delete_run
Definition: editstr.h:289
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
ME_Style * style
Definition: editstr.h:302
WCHAR * str
Definition: editstr.h:301
POINT pt
Definition: editstr.h:198
ME_Style * style
Definition: editstr.h:195
ME_String * text
Definition: editstr.h:196
INT width
Definition: editstr.h:197
struct list entry
Definition: editstr.h:153
REOBJECT obj
Definition: editstr.h:154
CHARFORMAT2W fmt
Definition: editstr.h:337
ME_BorderRect border
Definition: editstr.h:331
PARAFORMAT2 fmt
Definition: editstr.h:330
int cell_right_boundary
Definition: editstr.h:324
ME_String * eol_str
Definition: editstr.h:321
ME_BorderRect cell_border
Definition: editstr.h:323
ME_BorderRect border
Definition: editstr.h:320
PARAFORMAT2 fmt
Definition: editstr.h:319
ME_Border bottom
Definition: editstr.h:189
ME_Border right
Definition: editstr.h:190
ME_Border left
Definition: editstr.h:188
ME_Border top
Definition: editstr.h:187
COLORREF colorRef
Definition: editstr.h:182
struct tagME_Cell * parent_cell
Definition: editstr.h:228
POINT pt
Definition: editstr.h:225
int nHeight
Definition: editstr.h:226
struct tagME_Cell * next_cell
Definition: editstr.h:228
int nRightBoundary
Definition: editstr.h:223
struct tagME_Cell * prev_cell
Definition: editstr.h:228
ME_BorderRect border
Definition: editstr.h:224
int nNestingLevel
Definition: editstr.h:222
int yTextOffset
Definition: editstr.h:227
int nWidth
Definition: editstr.h:226
ME_Style * current_style
Definition: editstr.h:461
HFONT orig_font
Definition: editstr.h:462
RECT rcView
Definition: editstr.h:458
int nAvailWidth
Definition: editstr.h:460
POINT pt
Definition: editstr.h:457
ME_TextEditor * editor
Definition: editstr.h:465
ME_Paragraph * para
Definition: editstr.h:274
int nOffset
Definition: editstr.h:276
ME_Run * run
Definition: editstr.h:275
ME_DIType type
Definition: editstr.h:255
struct tagME_DisplayItem * prev
Definition: editstr.h:256
ME_Cell cell
Definition: editstr.h:260
union tagME_DisplayItem::@555 member
struct tagME_DisplayItem * next
Definition: editstr.h:256
ME_Paragraph para
Definition: editstr.h:261
LOGFONTW lfSpecs
Definition: editstr.h:62
WCHAR * szFaceName
Definition: editstr.h:365
EDITSTREAM * editstream
Definition: editstr.h:372
DWORD dwUsed
Definition: editstr.h:374
DWORD dwSize
Definition: editstr.h:373
struct tagME_DisplayItem * next_para
Definition: editstr.h:216
ME_String * text
Definition: editstr.h:204
struct tagME_Cell * cell
Definition: editstr.h:206
struct wine_rb_entry marked_entry
Definition: editstr.h:217
ME_BorderRect border
Definition: editstr.h:207
struct tagME_DisplayItem * prev_para
Definition: editstr.h:216
PARAFORMAT2 fmt
Definition: editstr.h:203
ME_Run * eop_run
Definition: editstr.h:215
int nWidth
Definition: editstr.h:235
int nRMargin
Definition: editstr.h:237
int nBaseline
Definition: editstr.h:234
POINT pt
Definition: editstr.h:238
int nLMargin
Definition: editstr.h:236
int nHeight
Definition: editstr.h:233
int nAscent
Definition: editstr.h:165
int num_glyphs
Definition: editstr.h:170
POINT pt
Definition: editstr.h:166
GOFFSET * offsets
Definition: editstr.h:174
int nCharOfs
Definition: editstr.h:161
int nDescent
Definition: editstr.h:165
SCRIPT_VISATTR * vis_attrs
Definition: editstr.h:172
int max_clusters
Definition: editstr.h:175
struct tagME_Paragraph * para
Definition: editstr.h:160
int * advances
Definition: editstr.h:173
WORD * glyphs
Definition: editstr.h:171
ME_Style * style
Definition: editstr.h:159
SCRIPT_ANALYSIS script_analysis
Definition: editstr.h:169
int nWidth
Definition: editstr.h:163
struct re_object * reobj
Definition: editstr.h:167
int max_glyphs
Definition: editstr.h:170
int nFlags
Definition: editstr.h:164
int len
Definition: editstr.h:162
WORD * clusters
Definition: editstr.h:176
WCHAR * szData
Definition: editstr.h:55
int nLen
Definition: editstr.h:56
int nBuffer
Definition: editstr.h:56
void(* free)(struct tagME_String *)
Definition: editstr.h:57
CHARFORMAT2W fmt
Definition: editstr.h:72
struct list entry
Definition: editstr.h:78
SCRIPT_CACHE script_cache
Definition: editstr.h:77
ME_FontCacheItem * font_cache
Definition: editstr.h:74
int nRefs
Definition: editstr.h:76
TEXTMETRICW tm
Definition: editstr.h:75
ME_DisplayItem * pFirst
Definition: editstr.h:267
ME_Style * pDefaultStyle
Definition: editstr.h:269
ME_Style * pCharStyle
Definition: editstr.h:268
ME_DisplayItem * pLast
Definition: editstr.h:267
unsigned int horz_sb_enabled
Definition: editstr.h:442
unsigned int have_texthost2
Definition: editstr.h:387
EDITWORDBREAKPROCW pfnWordBreak
Definition: editstr.h:417
ME_FontCacheItem pFontCache[HFONT_CACHE_SIZE]
Definition: editstr.h:412
struct list redo_stack
Definition: editstr.h:405
int nZoomNumerator
Definition: editstr.h:413
unsigned int vert_sb_enabled
Definition: editstr.h:441
SCROLLINFO vert_si
Definition: editstr.h:440
ME_Paragraph * last_sel_end_para
Definition: editstr.h:411
int nLastTotalWidth
Definition: editstr.h:398
int nUndoStackSize
Definition: editstr.h:406
DWORD scrollbars
Definition: editstr.h:394
ME_UndoMode nUndoMode
Definition: editstr.h:408
ITextHost2 * texthost
Definition: editstr.h:384
TXTBACKSTYLE back_style
Definition: editstr.h:448
ME_Paragraph * last_sel_start_para
Definition: editstr.h:411
struct list reobj_list
Definition: editstr.h:450
ME_SelectionType nSelectionType
Definition: editstr.h:434
BOOL AutoURLDetect_bEnable
Definition: editstr.h:426
ME_Cursor * pCursors
Definition: editstr.h:389
LPRICHEDITOLECALLBACK lpOleCallback
Definition: editstr.h:419
SCROLLINFO horz_si
Definition: editstr.h:440
ME_TextBuffer * pBuffer
Definition: editstr.h:388
int nZoomDenominator
Definition: editstr.h:413
WCHAR password_char
Definition: editstr.h:427
CHARRANGE notified_cr
Definition: editstr.h:437
IRichEditOle * richole
Definition: editstr.h:418
struct list style_list
Definition: editstr.h:449
BOOL caret_hidden
Definition: editstr.h:445
BOOL bMouseCaptured
Definition: editstr.h:446
struct wine_rb_tree marked_paras
Definition: editstr.h:451
unsigned int bEmulateVersion10
Definition: editstr.h:385
struct list undo_stack
Definition: editstr.h:404
unsigned int in_place_active
Definition: editstr.h:386
int nLastTotalLength
Definition: editstr.h:397
BOOL bHideSelection
Definition: editstr.h:425
ITextSelection ITextSelection_iface
Definition: editstr.h:470
struct text_services * services
Definition: editstr.h:473
IUnknown IUnknown_inner
Definition: editstr.h:478
ME_TextEditor * editor
Definition: editstr.h:484
ITextDocument2Old ITextDocument2Old_iface
Definition: editstr.h:481
IUnknown * outer_unk
Definition: editstr.h:482
char spare[256]
Definition: editstr.h:488
struct list clientsites
Definition: editstr.h:487
struct text_selection * text_selection
Definition: editstr.h:485
struct list rangelist
Definition: editstr.h:486
IRichEditOle IRichEditOle_iface
Definition: editstr.h:480
ITextServices ITextServices_iface
Definition: editstr.h:479
struct delete_run_item delete_run
Definition: editstr.h:347
struct set_para_fmt_item set_para_fmt
Definition: editstr.h:350
struct split_para_item split_para
Definition: editstr.h:349
struct list entry
Definition: editstr.h:342
struct join_paras_item join_paras
Definition: editstr.h:348
enum undo_type type
Definition: editstr.h:343
struct insert_run_item insert_run
Definition: editstr.h:346
struct set_char_fmt_item set_char_fmt
Definition: editstr.h:351
union undo_item::@556 u
Definition: rbtree.h:36
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:2908
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: xxhash.c:193