~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/riched20/editstr.h

Version: ~ [ wine-1.5.4 ] ~ [ wine-1.5.3 ] ~ [ wine-1.5.2 ] ~ [ wine-1.5.1 ] ~ [ wine-1.5.0 ] ~ [ wine-1.4 ] ~ [ wine-1.4-rc6 ] ~ [ wine-1.4-rc5 ] ~ [ wine-1.4-rc4 ] ~ [ wine-1.4-rc3 ] ~ [ wine-1.4-rc2 ] ~ [ wine-1.4-rc1 ] ~ [ wine-1.3.37 ] ~ [ wine-1.3.36 ] ~ [ wine-1.3.35 ] ~ [ wine-1.3.34 ] ~ [ wine-1.3.33 ] ~ [ wine-1.3.32 ] ~ [ wine-1.3.31 ] ~ [ wine-1.3.30 ] ~ [ wine-1.3.29 ] ~ [ wine-1.3.28 ] ~ [ wine-1.3.27 ] ~ [ wine-1.3.26 ] ~ [ wine-1.3.25 ] ~ [ wine-1.3.24 ] ~ [ wine-1.3.23 ] ~ [ wine-1.3.22 ] ~ [ wine-1.3.21 ] ~ [ wine-1.3.20 ] ~ [ wine-1.3.19 ] ~ [ wine-1.3.18 ] ~ [ wine-1.2.3 ] ~ [ wine-1.3.17 ] ~ [ wine-1.3.16 ] ~ [ wine-1.3.15 ] ~ [ wine-1.3.14 ] ~ [ wine-1.3.13 ] ~ [ wine-1.3.12 ] ~ [ wine-1.3.11 ] ~ [ wine-1.3.10 ] ~ [ wine-1.3.9 ] ~ [ wine-1.2.2 ] ~ [ wine-1.3.8 ] ~ [ wine-1.3.7 ] ~ [ wine-1.3.6 ] ~ [ wine-1.3.5 ] ~ [ wine-1.2.1 ] ~ [ wine-1.3.4 ] ~ [ wine-1.3.3 ] ~ [ wine-1.3.2 ] ~ [ wine-1.3.1 ] ~ [ wine-1.3.0 ] ~ [ wine-1.2 ] ~ [ wine-1.2-rc7 ] ~ [ wine-1.2-rc6 ] ~ [ wine-1.2-rc5 ] ~ [ wine-1.2-rc4 ] ~ [ wine-1.2-rc3 ] ~ [ wine-1.2-rc2 ] ~ [ wine-1.2-rc1 ] ~ [ wine-1.1.44 ] ~ [ wine-1.1.43 ] ~ [ wine-1.1.42 ] ~ [ wine-1.1.41 ] ~ [ wine-1.1.40 ] ~ [ wine-1.1.39 ] ~ [ wine-1.1.38 ] ~ [ wine-1.1.37 ] ~ [ wine-1.1.36 ] ~ [ wine-1.1.35 ] ~ [ wine-1.1.34 ] ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  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 #ifndef _WIN32_IE
 25 #define _WIN32_IE 0x0400
 26 #endif
 27 
 28 #include <assert.h>
 29 #include <stdarg.h>
 30 #include <stdio.h>
 31 #include <stdlib.h>
 32 #include <limits.h>
 33 
 34 #define COBJMACROS
 35 #define NONAMELESSUNION
 36 #define NONAMELESSSTRUCT
 37 
 38 #include <windef.h>
 39 #include <winbase.h>
 40 #include <winnls.h>
 41 #include <winnt.h>
 42 #include <wingdi.h>
 43 #include <winuser.h>
 44 #include <richedit.h>
 45 #include <commctrl.h>
 46 #include <ole2.h>
 47 #include <richole.h>
 48 #include "imm.h"
 49 #include <textserv.h>
 50 
 51 #include "wine/debug.h"
 52 
 53 #ifdef __i386__
 54 extern const struct ITextHostVtbl itextHostStdcallVtbl;
 55 #endif /* __i386__ */
 56 
 57 typedef struct tagME_String
 58 {
 59   WCHAR *szData;
 60   int nLen, nBuffer;
 61 } ME_String;
 62 
 63 typedef struct tagME_Style
 64 {
 65   CHARFORMAT2W fmt;
 66 
 67   HFONT hFont; /* cached font for the style */
 68   TEXTMETRICW tm; /* cached font metrics for the style */
 69   int nRefs; /* reference count */
 70   int nSequence; /* incremented when cache needs to be rebuilt, ie. every screen redraw */
 71 } ME_Style;
 72 
 73 typedef enum {
 74   diInvalid,
 75   diTextStart, /* start of the text buffer */
 76   diParagraph, /* paragraph start */
 77   diCell, /* cell start */
 78   diRun, /* run (sequence of chars with the same character format) */
 79   diStartRow, /* start of the row (line of text on the screen) */
 80   diTextEnd, /* end of the text buffer */
 81   
 82   /********************* these below are meant for finding only *********************/
 83   diStartRowOrParagraph, /* 7 */
 84   diStartRowOrParagraphOrEnd,
 85   diRunOrParagraph,
 86   diRunOrStartRow,
 87   diParagraphOrEnd,
 88   diRunOrParagraphOrEnd, /* 12 */
 89   
 90   diUndoInsertRun, /* 13 */
 91   diUndoDeleteRun, /* 14 */
 92   diUndoJoinParagraphs, /* 15 */
 93   diUndoSplitParagraph, /* 16 */
 94   diUndoSetParagraphFormat, /* 17 */
 95   diUndoSetCharFormat, /* 18 */
 96   diUndoEndTransaction, /* 19 - marks the end of a group of changes for undo */
 97   diUndoPotentialEndTransaction, /* 20 - allows grouping typed chars for undo */
 98 } ME_DIType;
 99 
100 #define SELECTIONBAR_WIDTH 8
101 
102 /******************************** run flags *************************/
103 #define MERF_STYLEFLAGS 0x0FFF
104 /* run contains non-text content, which has its own rules for wrapping, sizing etc */
105 #define MERF_GRAPHICS   0x001
106 /* run is a tab (or, in future, any kind of content whose size is dependent on run position) */
107 #define MERF_TAB        0x002
108 /* run is a cell boundary */
109 #define MERF_ENDCELL    0x004 /* v4.1 */
110 
111 #define MERF_NONTEXT (MERF_GRAPHICS | MERF_TAB | MERF_ENDCELL)
112 
113 /* run is splittable (contains white spaces in the middle or end) */
114 #define MERF_SPLITTABLE 0x001000
115 /* run starts with whitespaces */
116 #define MERF_STARTWHITE 0x002000
117 /* run ends with whitespaces */
118 #define MERF_ENDWHITE   0x004000
119 /* run is completely made of whitespaces */
120 #define MERF_WHITESPACE 0x008000
121 /* the "end of paragraph" run, contains 1 character */
122 #define MERF_ENDPARA    0x100000
123 /* forcing the "end of row" run, contains 1 character */
124 #define MERF_ENDROW     0x200000
125 /* run is hidden */
126 #define MERF_HIDDEN     0x400000
127 /* start of a table row has an empty paragraph that should be skipped over. */
128 #define MERF_TABLESTART 0x800000 /* v4.1 */
129 
130 /* runs with any of these flags set cannot be joined */
131 #define MERF_NOJOIN (MERF_GRAPHICS|MERF_TAB|MERF_ENDPARA|MERF_ENDROW)
132 /* runs that don't contain real text */
133 #define MERF_NOTEXT (MERF_GRAPHICS|MERF_TAB|MERF_ENDPARA|MERF_ENDROW)
134 
135 /* those flags are kept when the row is split */
136 #define MERF_SPLITMASK (~(0))
137 
138 /******************************** para flags *************************/
139 
140 /* this paragraph was already wrapped and hasn't changed, every change resets that flag */
141 #define MEPF_REWRAP   0x01
142 #define MEPF_REPAINT  0x02
143 /* v4.1 */
144 #define MEPF_CELL     0x04 /* The paragraph is nested in a cell */
145 #define MEPF_ROWSTART 0x08 /* Hidden empty paragraph at the start of the row */
146 #define MEPF_ROWEND   0x10 /* Visible empty paragraph at the end of the row */
147 
148 /******************************** structures *************************/
149 
150 struct tagME_DisplayItem;
151 
152 typedef struct tagME_Run
153 {
154   ME_String *strText;
155   ME_Style *style;
156   int nCharOfs; /* relative to para's offset */
157   int nWidth; /* width of full run, width of leading&trailing ws */
158   int nFlags;
159   int nAscent, nDescent; /* pixels above/below baseline */
160   POINT pt; /* relative to para's position */
161   REOBJECT *ole_obj; /* FIXME: should be a union with strText (at least) */
162 } ME_Run;
163 
164 typedef struct tagME_Border
165 {
166   int width;
167   COLORREF colorRef;
168 } ME_Border;
169 
170 typedef struct tagME_BorderRect
171 {
172   ME_Border top;
173   ME_Border left;
174   ME_Border bottom;
175   ME_Border right;
176 } ME_BorderRect;
177 
178 typedef struct tagME_Paragraph
179 {
180   PARAFORMAT2 *pFmt;
181 
182   struct tagME_DisplayItem *pCell; /* v4.1 */
183   ME_BorderRect border;
184 
185   int nCharOfs;
186   int nFlags;
187   POINT pt;
188   int nHeight, nWidth;
189   int nLastPaintYPos, nLastPaintHeight;
190   int nRows;
191   struct tagME_DisplayItem *prev_para, *next_para;
192 } ME_Paragraph;
193 
194 typedef struct tagME_Cell /* v4.1 */
195 {
196   int nNestingLevel; /* 0 for normal cells, and greater for nested cells */
197   int nRightBoundary;
198   ME_BorderRect border;
199   POINT pt;
200   int nHeight, nWidth;
201   int yTextOffset; /* The text offset is caused by the largest top border. */
202   struct tagME_DisplayItem *prev_cell, *next_cell, *parent_cell;
203 } ME_Cell;
204 
205 typedef struct tagME_Row
206 {
207   int nHeight;
208   int nBaseline;
209   int nWidth;
210   int nLMargin;
211   int nRMargin;
212   POINT pt;
213 } ME_Row;
214 
215 /* the display item list layout is like this:
216  * - the document consists of paragraphs
217  * - each paragraph contains at least one run, the last run in the paragraph
218  *   is an end-of-paragraph run
219  * - each formatted paragraph contains at least one row, which corresponds
220  *   to a screen line (that's why there are no rows in an unformatted
221  *   paragraph
222  * - the paragraphs contain "shortcut" pointers to the previous and the next
223  *   paragraph, that makes iteration over paragraphs faster 
224  * - the list starts with diTextStart and ends with diTextEnd
225  */
226 
227 typedef struct tagME_DisplayItem
228 {
229   ME_DIType type;
230   struct tagME_DisplayItem *prev, *next;
231   union {
232     ME_Run run;
233     ME_Row row;
234     ME_Cell cell;
235     ME_Paragraph para;
236     ME_Style *ustyle; /* used by diUndoSetCharFormat */
237   } member;
238 } ME_DisplayItem;
239 
240 typedef struct tagME_UndoItem
241 {
242   ME_DisplayItem di;
243   int nStart, nLen;
244   ME_String *eol_str; /* used by diUndoSplitParagraph */
245 } ME_UndoItem;
246 
247 typedef struct tagME_TextBuffer
248 {
249   ME_DisplayItem *pFirst, *pLast;
250   ME_Style *pCharStyle;
251   ME_Style *pDefaultStyle;
252 } ME_TextBuffer;
253 
254 typedef struct tagME_Cursor
255 {
256   ME_DisplayItem *pPara;
257   ME_DisplayItem *pRun;
258   int nOffset;
259 } ME_Cursor;
260 
261 typedef enum {
262   umAddToUndo,
263   umAddToRedo,
264   umIgnore,
265   umAddBackToUndo
266 } ME_UndoMode;
267 
268 typedef enum {
269   stPosition = 0,
270   stWord,
271   stLine,
272   stParagraph,
273   stDocument
274 } ME_SelectionType;
275 
276 typedef struct tagME_FontTableItem {
277   BYTE bCharSet;
278   WCHAR *szFaceName;
279 } ME_FontTableItem;
280 
281 
282 #define STREAMIN_BUFFER_SIZE 4096 /* M$ compatibility */
283 
284 struct tagME_InStream {
285   EDITSTREAM *editstream;
286   DWORD dwSize;
287   DWORD dwUsed;
288   char buffer[STREAMIN_BUFFER_SIZE];
289 };
290 typedef struct tagME_InStream ME_InStream;
291 
292 
293 #define STREAMOUT_BUFFER_SIZE 4096
294 #define STREAMOUT_FONTTBL_SIZE 8192
295 #define STREAMOUT_COLORTBL_SIZE 1024
296 
297 typedef struct tagME_OutStream {
298   EDITSTREAM *stream;
299   char buffer[STREAMOUT_BUFFER_SIZE];
300   UINT pos, written;
301   UINT nCodePage;
302   UINT nFontTblLen;
303   ME_FontTableItem fonttbl[STREAMOUT_FONTTBL_SIZE];
304   UINT nColorTblLen;
305   COLORREF colortbl[STREAMOUT_COLORTBL_SIZE];
306   UINT nDefaultFont;
307   UINT nDefaultCodePage;
308   /* nNestingLevel = 0 means we aren't in a cell, 1 means we are in a cell,
309    * an greater numbers mean we are in a cell nested within a cell. */
310   UINT nNestingLevel;
311 } ME_OutStream;
312 
313 typedef struct tagME_FontCacheItem
314 {
315   LOGFONTW lfSpecs;
316   HFONT hFont;
317   int nRefs;
318   int nAge;
319 } ME_FontCacheItem;
320 
321 #define HFONT_CACHE_SIZE 10
322 
323 typedef struct tagME_TextEditor
324 {
325   HWND hWnd, hwndParent;
326   ITextHost *texthost;
327   BOOL bEmulateVersion10;
328   ME_TextBuffer *pBuffer;
329   ME_Cursor *pCursors;
330   DWORD styleFlags;
331   DWORD exStyleFlags;
332   int nCursors;
333   SIZE sizeWindow;
334   int nTotalLength, nLastTotalLength;
335   int nTotalWidth, nLastTotalWidth;
336   int nAvailWidth; /* 0 = wrap to client area, else wrap width in twips */
337   int nUDArrowX;
338   int nSequence;
339   COLORREF rgbBackColor;
340   HBRUSH hbrBackground;
341   BOOL bCaretAtEnd;
342   int nEventMask;
343   int nModifyStep;
344   ME_DisplayItem *pUndoStack, *pRedoStack, *pUndoStackBottom;
345   int nUndoStackSize;
346   int nUndoLimit;
347   ME_UndoMode nUndoMode;
348   int nParagraphs;
349   int nLastSelStart, nLastSelEnd;
350   ME_DisplayItem *pLastSelStartPara, *pLastSelEndPara;
351   ME_FontCacheItem pFontCache[HFONT_CACHE_SIZE];
352   int nZoomNumerator, nZoomDenominator;
353   RECT prevClientRect;
354   RECT rcFormat;
355   BOOL bDefaultFormatRect;
356   BOOL bWordWrap;
357   int nTextLimit;
358   EDITWORDBREAKPROCW pfnWordBreak;
359   LPRICHEDITOLECALLBACK lpOleCallback;
360   /*TEXTMODE variable; contains only one of each of the following options:
361    *TM_RICHTEXT or TM_PLAINTEXT
362    *TM_SINGLELEVELUNDO or TM_MULTILEVELUNDO
363    *TM_SINGLECODEPAGE or TM_MULTICODEPAGE*/
364   int mode;
365   BOOL bHideSelection;
366   BOOL AutoURLDetect_bEnable;
367   WCHAR cPasswordMask;
368   BOOL bHaveFocus;
369   BOOL bDialogMode; /* Indicates that we are inside a dialog window */
370   /*for IME */
371   int imeStartIndex;
372   DWORD selofs; /* The size of the selection bar on the left side of control */
373   ME_SelectionType nSelectionType;
374 
375   /* Track previous notified selection */
376   CHARRANGE notified_cr;
377 
378   /* Cache previously set scrollbar info */
379   SCROLLINFO vert_si, horz_si;
380 
381   BOOL bMouseCaptured;
382 } ME_TextEditor;
383 
384 typedef struct tagME_Context
385 {
386   HDC hDC;
387   POINT pt;
388   POINT ptRowOffset;
389   RECT rcView;
390   HBRUSH hbrMargin;
391   SIZE dpi;
392   int nAvailWidth;
393 
394   /* those are valid inside ME_WrapTextParagraph and related */
395   POINT ptFirstRun;
396   ME_TextEditor *editor;
397   int nSequence;
398 } ME_Context;
399 
400 typedef struct tagME_WrapContext
401 {
402   ME_Style *style;
403   ME_Context *context;
404   int nLeftMargin, nRightMargin, nFirstMargin;
405   int nAvailWidth;
406   int nRow;
407   POINT pt;
408   BOOL bOverflown, bWordWrap;
409   ME_DisplayItem *pPara;
410   ME_DisplayItem *pRowStart;
411 
412   ME_DisplayItem *pLastSplittableRun;
413 } ME_WrapContext;
414 
415 #endif
416 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.