Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygeneditstr.h
Go to the documentation of this file.
00001 /* 00002 * RichEdit - structures and constant 00003 * 00004 * Copyright 2004 by Krzysztof Foltman 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00019 */ 00020 00021 #ifndef __EDITSTR_H 00022 #define __EDITSTR_H 00023 00024 #ifndef _WIN32_IE 00025 #define _WIN32_IE 0x0400 00026 #endif 00027 00028 #include <assert.h> 00029 #include <stdarg.h> 00030 #include <stdio.h> 00031 #include <stdlib.h> 00032 #include <limits.h> 00033 00034 #define COBJMACROS 00035 #define NONAMELESSUNION 00036 #define NONAMELESSSTRUCT 00037 00038 #include <windef.h> 00039 #include <winbase.h> 00040 #include <winnls.h> 00041 #include <winnt.h> 00042 #include <wingdi.h> 00043 #include <winuser.h> 00044 #include <richedit.h> 00045 #include <commctrl.h> 00046 #include <ole2.h> 00047 #include <richole.h> 00048 #include "imm.h" 00049 #include <textserv.h> 00050 00051 #include "wine/debug.h" 00052 00053 #ifdef __i386__ 00054 extern const struct ITextHostVtbl itextHostStdcallVtbl; 00055 #endif /* __i386__ */ 00056 00057 typedef struct tagME_String 00058 { 00059 WCHAR *szData; 00060 int nLen, nBuffer; 00061 } ME_String; 00062 00063 typedef struct tagME_Style 00064 { 00065 CHARFORMAT2W fmt; 00066 00067 HFONT hFont; /* cached font for the style */ 00068 TEXTMETRICW tm; /* cached font metrics for the style */ 00069 int nRefs; /* reference count */ 00070 int nSequence; /* incremented when cache needs to be rebuilt, ie. every screen redraw */ 00071 } ME_Style; 00072 00073 typedef enum { 00074 diInvalid, 00075 diTextStart, /* start of the text buffer */ 00076 diParagraph, /* paragraph start */ 00077 diCell, /* cell start */ 00078 diRun, /* run (sequence of chars with the same character format) */ 00079 diStartRow, /* start of the row (line of text on the screen) */ 00080 diTextEnd, /* end of the text buffer */ 00081 00082 /********************* these below are meant for finding only *********************/ 00083 diStartRowOrParagraph, /* 7 */ 00084 diStartRowOrParagraphOrEnd, 00085 diRunOrParagraph, 00086 diRunOrStartRow, 00087 diParagraphOrEnd, 00088 diRunOrParagraphOrEnd, /* 12 */ 00089 00090 diUndoInsertRun, /* 13 */ 00091 diUndoDeleteRun, /* 14 */ 00092 diUndoJoinParagraphs, /* 15 */ 00093 diUndoSplitParagraph, /* 16 */ 00094 diUndoSetParagraphFormat, /* 17 */ 00095 diUndoSetCharFormat, /* 18 */ 00096 diUndoEndTransaction, /* 19 - marks the end of a group of changes for undo */ 00097 diUndoPotentialEndTransaction, /* 20 - allows grouping typed chars for undo */ 00098 } ME_DIType; 00099 00100 #define SELECTIONBAR_WIDTH 8 00101 00102 /******************************** run flags *************************/ 00103 #define MERF_STYLEFLAGS 0x0FFF 00104 /* run contains non-text content, which has its own rules for wrapping, sizing etc */ 00105 #define MERF_GRAPHICS 0x001 00106 /* run is a tab (or, in future, any kind of content whose size is dependent on run position) */ 00107 #define MERF_TAB 0x002 00108 /* run is a cell boundary */ 00109 #define MERF_ENDCELL 0x004 /* v4.1 */ 00110 00111 #define MERF_NONTEXT (MERF_GRAPHICS | MERF_TAB | MERF_ENDCELL) 00112 00113 /* run is splittable (contains white spaces in the middle or end) */ 00114 #define MERF_SPLITTABLE 0x001000 00115 /* run starts with whitespaces */ 00116 #define MERF_STARTWHITE 0x002000 00117 /* run ends with whitespaces */ 00118 #define MERF_ENDWHITE 0x004000 00119 /* run is completely made of whitespaces */ 00120 #define MERF_WHITESPACE 0x008000 00121 /* the "end of paragraph" run, contains 1 character */ 00122 #define MERF_ENDPARA 0x100000 00123 /* forcing the "end of row" run, contains 1 character */ 00124 #define MERF_ENDROW 0x200000 00125 /* run is hidden */ 00126 #define MERF_HIDDEN 0x400000 00127 /* start of a table row has an empty paragraph that should be skipped over. */ 00128 #define MERF_TABLESTART 0x800000 /* v4.1 */ 00129 00130 /* runs with any of these flags set cannot be joined */ 00131 #define MERF_NOJOIN (MERF_GRAPHICS|MERF_TAB|MERF_ENDPARA|MERF_ENDROW) 00132 /* runs that don't contain real text */ 00133 #define MERF_NOTEXT (MERF_GRAPHICS|MERF_TAB|MERF_ENDPARA|MERF_ENDROW) 00134 00135 /* those flags are kept when the row is split */ 00136 #define MERF_SPLITMASK (~(0)) 00137 00138 /******************************** para flags *************************/ 00139 00140 /* this paragraph was already wrapped and hasn't changed, every change resets that flag */ 00141 #define MEPF_REWRAP 0x01 00142 #define MEPF_REPAINT 0x02 00143 /* v4.1 */ 00144 #define MEPF_CELL 0x04 /* The paragraph is nested in a cell */ 00145 #define MEPF_ROWSTART 0x08 /* Hidden empty paragraph at the start of the row */ 00146 #define MEPF_ROWEND 0x10 /* Visible empty paragraph at the end of the row */ 00147 00148 /******************************** structures *************************/ 00149 00150 struct tagME_DisplayItem; 00151 00152 typedef struct tagME_Run 00153 { 00154 ME_String *strText; 00155 ME_Style *style; 00156 int nCharOfs; /* relative to para's offset */ 00157 int nWidth; /* width of full run, width of leading&trailing ws */ 00158 int nFlags; 00159 int nAscent, nDescent; /* pixels above/below baseline */ 00160 POINT pt; /* relative to para's position */ 00161 REOBJECT *ole_obj; /* FIXME: should be a union with strText (at least) */ 00162 } ME_Run; 00163 00164 typedef struct tagME_Border 00165 { 00166 int width; 00167 COLORREF colorRef; 00168 } ME_Border; 00169 00170 typedef struct tagME_BorderRect 00171 { 00172 ME_Border top; 00173 ME_Border left; 00174 ME_Border bottom; 00175 ME_Border right; 00176 } ME_BorderRect; 00177 00178 typedef struct tagME_Paragraph 00179 { 00180 PARAFORMAT2 *pFmt; 00181 00182 struct tagME_DisplayItem *pCell; /* v4.1 */ 00183 ME_BorderRect border; 00184 00185 int nCharOfs; 00186 int nFlags; 00187 POINT pt; 00188 int nHeight, nWidth; 00189 int nLastPaintYPos, nLastPaintHeight; 00190 int nRows; 00191 struct tagME_DisplayItem *prev_para, *next_para; 00192 } ME_Paragraph; 00193 00194 typedef struct tagME_Cell /* v4.1 */ 00195 { 00196 int nNestingLevel; /* 0 for normal cells, and greater for nested cells */ 00197 int nRightBoundary; 00198 ME_BorderRect border; 00199 POINT pt; 00200 int nHeight, nWidth; 00201 int yTextOffset; /* The text offset is caused by the largest top border. */ 00202 struct tagME_DisplayItem *prev_cell, *next_cell, *parent_cell; 00203 } ME_Cell; 00204 00205 typedef struct tagME_Row 00206 { 00207 int nHeight; 00208 int nBaseline; 00209 int nWidth; 00210 int nLMargin; 00211 int nRMargin; 00212 POINT pt; 00213 } ME_Row; 00214 00215 /* the display item list layout is like this: 00216 * - the document consists of paragraphs 00217 * - each paragraph contains at least one run, the last run in the paragraph 00218 * is an end-of-paragraph run 00219 * - each formatted paragraph contains at least one row, which corresponds 00220 * to a screen line (that's why there are no rows in an unformatted 00221 * paragraph 00222 * - the paragraphs contain "shortcut" pointers to the previous and the next 00223 * paragraph, that makes iteration over paragraphs faster 00224 * - the list starts with diTextStart and ends with diTextEnd 00225 */ 00226 00227 typedef struct tagME_DisplayItem 00228 { 00229 ME_DIType type; 00230 struct tagME_DisplayItem *prev, *next; 00231 union { 00232 ME_Run run; 00233 ME_Row row; 00234 ME_Cell cell; 00235 ME_Paragraph para; 00236 ME_Style *ustyle; /* used by diUndoSetCharFormat */ 00237 } member; 00238 } ME_DisplayItem; 00239 00240 typedef struct tagME_UndoItem 00241 { 00242 ME_DisplayItem di; 00243 int nStart, nLen; 00244 ME_String *eol_str; /* used by diUndoSplitParagraph */ 00245 } ME_UndoItem; 00246 00247 typedef struct tagME_TextBuffer 00248 { 00249 ME_DisplayItem *pFirst, *pLast; 00250 ME_Style *pCharStyle; 00251 ME_Style *pDefaultStyle; 00252 } ME_TextBuffer; 00253 00254 typedef struct tagME_Cursor 00255 { 00256 ME_DisplayItem *pPara; 00257 ME_DisplayItem *pRun; 00258 int nOffset; 00259 } ME_Cursor; 00260 00261 typedef enum { 00262 umAddToUndo, 00263 umAddToRedo, 00264 umIgnore, 00265 umAddBackToUndo 00266 } ME_UndoMode; 00267 00268 typedef enum { 00269 stPosition = 0, 00270 stWord, 00271 stLine, 00272 stParagraph, 00273 stDocument 00274 } ME_SelectionType; 00275 00276 typedef struct tagME_FontTableItem { 00277 BYTE bCharSet; 00278 WCHAR *szFaceName; 00279 } ME_FontTableItem; 00280 00281 00282 #define STREAMIN_BUFFER_SIZE 4096 /* M$ compatibility */ 00283 00284 struct tagME_InStream { 00285 EDITSTREAM *editstream; 00286 DWORD dwSize; 00287 DWORD dwUsed; 00288 char buffer[STREAMIN_BUFFER_SIZE]; 00289 }; 00290 typedef struct tagME_InStream ME_InStream; 00291 00292 00293 #define STREAMOUT_BUFFER_SIZE 4096 00294 #define STREAMOUT_FONTTBL_SIZE 8192 00295 #define STREAMOUT_COLORTBL_SIZE 1024 00296 00297 typedef struct tagME_OutStream { 00298 EDITSTREAM *stream; 00299 char buffer[STREAMOUT_BUFFER_SIZE]; 00300 UINT pos, written; 00301 UINT nCodePage; 00302 UINT nFontTblLen; 00303 ME_FontTableItem fonttbl[STREAMOUT_FONTTBL_SIZE]; 00304 UINT nColorTblLen; 00305 COLORREF colortbl[STREAMOUT_COLORTBL_SIZE]; 00306 UINT nDefaultFont; 00307 UINT nDefaultCodePage; 00308 /* nNestingLevel = 0 means we aren't in a cell, 1 means we are in a cell, 00309 * an greater numbers mean we are in a cell nested within a cell. */ 00310 UINT nNestingLevel; 00311 } ME_OutStream; 00312 00313 typedef struct tagME_FontCacheItem 00314 { 00315 LOGFONTW lfSpecs; 00316 HFONT hFont; 00317 int nRefs; 00318 int nAge; 00319 } ME_FontCacheItem; 00320 00321 #define HFONT_CACHE_SIZE 10 00322 00323 typedef struct tagME_TextEditor 00324 { 00325 HWND hWnd, hwndParent; 00326 ITextHost *texthost; 00327 BOOL bEmulateVersion10; 00328 ME_TextBuffer *pBuffer; 00329 ME_Cursor *pCursors; 00330 DWORD styleFlags; 00331 DWORD exStyleFlags; 00332 int nCursors; 00333 SIZE sizeWindow; 00334 int nTotalLength, nLastTotalLength; 00335 int nTotalWidth, nLastTotalWidth; 00336 int nAvailWidth; /* 0 = wrap to client area, else wrap width in twips */ 00337 int nUDArrowX; 00338 int nSequence; 00339 COLORREF rgbBackColor; 00340 HBRUSH hbrBackground; 00341 BOOL bCaretAtEnd; 00342 int nEventMask; 00343 int nModifyStep; 00344 ME_DisplayItem *pUndoStack, *pRedoStack, *pUndoStackBottom; 00345 int nUndoStackSize; 00346 int nUndoLimit; 00347 ME_UndoMode nUndoMode; 00348 int nParagraphs; 00349 int nLastSelStart, nLastSelEnd; 00350 ME_DisplayItem *pLastSelStartPara, *pLastSelEndPara; 00351 ME_FontCacheItem pFontCache[HFONT_CACHE_SIZE]; 00352 int nZoomNumerator, nZoomDenominator; 00353 RECT prevClientRect; 00354 RECT rcFormat; 00355 BOOL bDefaultFormatRect; 00356 BOOL bWordWrap; 00357 int nTextLimit; 00358 EDITWORDBREAKPROCW pfnWordBreak; 00359 LPRICHEDITOLECALLBACK lpOleCallback; 00360 /*TEXTMODE variable; contains only one of each of the following options: 00361 *TM_RICHTEXT or TM_PLAINTEXT 00362 *TM_SINGLELEVELUNDO or TM_MULTILEVELUNDO 00363 *TM_SINGLECODEPAGE or TM_MULTICODEPAGE*/ 00364 int mode; 00365 BOOL bHideSelection; 00366 BOOL AutoURLDetect_bEnable; 00367 WCHAR cPasswordMask; 00368 BOOL bHaveFocus; 00369 BOOL bDialogMode; /* Indicates that we are inside a dialog window */ 00370 /*for IME */ 00371 int imeStartIndex; 00372 DWORD selofs; /* The size of the selection bar on the left side of control */ 00373 ME_SelectionType nSelectionType; 00374 00375 /* Track previous notified selection */ 00376 CHARRANGE notified_cr; 00377 00378 /* Cache previously set scrollbar info */ 00379 SCROLLINFO vert_si, horz_si; 00380 00381 BOOL bMouseCaptured; 00382 } ME_TextEditor; 00383 00384 typedef struct tagME_Context 00385 { 00386 HDC hDC; 00387 POINT pt; 00388 POINT ptRowOffset; 00389 RECT rcView; 00390 HBRUSH hbrMargin; 00391 SIZE dpi; 00392 int nAvailWidth; 00393 00394 /* those are valid inside ME_WrapTextParagraph and related */ 00395 POINT ptFirstRun; 00396 ME_TextEditor *editor; 00397 int nSequence; 00398 } ME_Context; 00399 00400 typedef struct tagME_WrapContext 00401 { 00402 ME_Style *style; 00403 ME_Context *context; 00404 int nLeftMargin, nRightMargin, nFirstMargin; 00405 int nAvailWidth; 00406 int nRow; 00407 POINT pt; 00408 BOOL bOverflown, bWordWrap; 00409 ME_DisplayItem *pPara; 00410 ME_DisplayItem *pRowStart; 00411 00412 ME_DisplayItem *pLastSplittableRun; 00413 } ME_WrapContext; 00414 00415 #endif Generated on Sat May 26 2012 04:24:30 for ReactOS by
1.7.6.1
|