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

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

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

~ [ 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.