Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

479 lines
19 KiB

  1. /*
  2. * @doc
  3. *
  4. * @module _RANGE.H -- CTxtRange Class |
  5. *
  6. * This class implements the internal text range and the TOM ITextRange
  7. *
  8. * Authors: <nl>
  9. * Original RichEdit code: David R. Fulmer
  10. * Christian Fortini
  11. * Murray Sargent
  12. * Alex Gounares (floating ranges, etc.)
  13. *
  14. * Copyright (c) 1995-1997, Microsoft Corporation. All rights reserved.
  15. */
  16. #ifndef _RANGE_H
  17. #define _RANGE_H
  18. #include "_text.h"
  19. #include "_m_undo.h"
  20. #include "_rtext.h"
  21. #include "_edit.h"
  22. #include "_uspi.h"
  23. long FPPTS_TO_TWIPS(float x);
  24. #define TWIPS_TO_FPPTS(x) (((float)(x)) * (float)0.05)
  25. class CTxtEdit;
  26. class CTxtFont;
  27. /*
  28. * SELRR
  29. *
  30. * @enum flags used to control how ReplaceRange (RR) should generate
  31. * selection anti-events
  32. */
  33. enum SELRR
  34. {
  35. SELRR_IGNORE = 0,
  36. SELRR_REMEMBERRANGE = 1,
  37. SELRR_REMEMBERCPMIN = 2,
  38. SELRR_REMEMBERENDIP = 3
  39. };
  40. /*
  41. * FINDWORD_TYPE
  42. *
  43. * @enum defines the different cases for finding a word
  44. */
  45. enum FINDWORD_TYPE {
  46. FW_EXACT = 1, //@emem Finds the word exactly (no extra chars)
  47. FW_INCLUDE_TRAILING_WHITESPACE = 2, //@emem find the word plus the
  48. // following whitespace (ala double-clicking)
  49. };
  50. enum MOVES
  51. {
  52. MOVE_START = -1,
  53. MOVE_IP = 0,
  54. MOVE_END = 1,
  55. };
  56. enum MATCHES
  57. {
  58. MATCH_UNTIL = 0,
  59. MATCH_WHILE = 1
  60. };
  61. enum EOPADJUST
  62. {
  63. NONEWCHARS = 0,
  64. NEWCHARS = 1
  65. };
  66. // Substring's input flags
  67. #define SUBSTR_INSPANCHARSET 1
  68. #define SUBSTR_INSPANBLOCK 2
  69. // Substring's output charflags
  70. #define SUBSTR_OUTCCLTR 1
  71. #define SUBSTR_OUTCCRTL 2
  72. class CCharFlags
  73. {
  74. public:
  75. BYTE _bFirstStrong; // flag for first strong character
  76. BYTE _bContaining; // flags for all presented characters
  77. };
  78. #define SCF_IGNORESELAE 0x80000000
  79. #define SCF_IGNORENOTIFY 0x40000000 // use it with real caution! Caller must do it itself.
  80. /*
  81. * CTxtRange
  82. *
  83. * @class
  84. * The CTxtRange class implements RichEdit's text range, which is the
  85. * main conduit through which changes are made to the document.
  86. * The range inherits from the rich-text ptr, adding a signed length
  87. * insertion-point char-format index, and a ref count for use when
  88. * instantiated as a TOM ITextRange. The range object also contains
  89. * a flag that reveals whether the range is a selection (with associated
  90. * screen behavior) or just a simple range. This distinction is used
  91. * to simplify some of the code.
  92. *
  93. * Some methods are virtual to allow CTxtSelection objects to facilitate
  94. * UI features and selection updating.
  95. *
  96. * See tom.doc for lots of discussion on range and selection objects and
  97. * on all methods in ITextRange, ITextSelection, ITextFont, and ITextPara.
  98. */
  99. class CTxtRange : public ITextSelection, public CRchTxtPtr
  100. {
  101. friend CTxtFont;
  102. //@access Protected Data
  103. protected:
  104. LONG _cch; //@cmember # chars in range. _cch > 0 for active
  105. // end at range end (cpMost)
  106. LONG _cRefs; //@cmember ITextRange/ITextSelection ref count
  107. short _iFormat; //@cmember Character format for degenerate range
  108. union
  109. {
  110. WORD _wFlags; // All together now
  111. struct
  112. {
  113. WORD _fExtend :1; //@cmember True iff Advance methods should
  114. // leave "other" end unchanged
  115. WORD _fSel :1; //@cmember True iff this is a CTxtSelection
  116. WORD _fDragProtection :1; //@cmember True is this range should think
  117. // it's protected. Set by drag/drop code
  118. WORD _fDontUpdateFmt:1;//@cmember Don't update _iFormat
  119. WORD _fDualFontMode:1; //@cmember Set during dual font mode
  120. WORD _fUseiFormat:1; //@cmember Use iFormat when replacing
  121. // a non-degenerate range
  122. WORD _fMoveBack:1; //@cmember TRUE if last change moved backward
  123. WORD _fSelHasEOP:1; //@cmember TRUE if Sel has EOP
  124. WORD _fSelHasCell:1; //@cmember TRUE if Sel CELL found looking for EOP
  125. WORD _fUseBackwardPFFmt:1; //@cmember Use backward PF format
  126. };
  127. };
  128. //@access Public methods
  129. public:
  130. #ifdef DEBUG
  131. BOOL Invariant( void ) const;
  132. #endif // DEBUG
  133. CTxtRange(const CTxtRange &rg);
  134. CTxtRange(CTxtEdit *ped, LONG cp = 0, LONG cch = 0);
  135. CTxtRange(CRchTxtPtr &rtp, LONG cch = 0);
  136. virtual ~CTxtRange();
  137. virtual CRchTxtPtr& operator =(const CRchTxtPtr &rtp);
  138. virtual CTxtRange& operator =(const CTxtRange &rp);
  139. // ITxNotify methods
  140. //@cmember Handles notifications
  141. virtual void OnPreReplaceRange( // prior to ReplaceRange calls
  142. LONG cp, LONG cchDel, LONG cchNew,
  143. LONG cpFormatMin, LONG cpFormatMax);
  144. //@cmember Handles notifications for
  145. virtual void OnPostReplaceRange( // floating range and display updates
  146. LONG cp, LONG cchDel, LONG cchNew,
  147. LONG cpFormatMin, LONG cpFormatMax);
  148. virtual void Zombie(); //@cmember Convert range into zombie
  149. void SetIgnoreFormatUpdate(BOOL fUpdate) { _fDontUpdateFmt = fUpdate; }
  150. void SetDualFontMode(BOOL fDualFontMode) {_fDualFontMode = fDualFontMode; }
  151. // Internal cp/cch methods
  152. LONG GetCch (void) const //@cmember Get signed character count
  153. {return _cch;}
  154. BOOL IsSel() {return _fSel;}
  155. BOOL fHasCell() const {return _fSelHasCell;}
  156. BOOL fHasEOP() const {return _fSelHasEOP;}
  157. BOOL CpInRange (LONG cp) const; //@cmember Says if cp is in this range
  158. BOOL CheckTextLength (LONG cch, LONG *pcch = NULL); //@cmember Says if cch chars can fit
  159. LONG CheckChange(LONG cpSave); //@cmember Used after _cp change to set
  160. // selection-changed flag, choose _cch
  161. //@cmember In outline mode, maintain _fSelHasEOP
  162. BOOL CheckIfSelHasEOP(LONG cpSave, LONG cchSave);
  163. BOOL IsInputSequenceValid(WCHAR* pwch, LONG cch, BOOL fOver, BOOL* pfBaseChar = NULL);//@cmember TRUE for valid sequence
  164. // GetRange() is faster than calling GetCpMin() and GetCpMost();
  165. LONG GetCpMin () const; //@cmember Get cp of first char in range
  166. LONG GetCpMost () const; //@cmember Get cp just beyond last char in range
  167. //@cmember Get range ends and count
  168. LONG GetRange (LONG& cpMin, LONG& cpMost) const;
  169. BOOL Set(LONG cp, LONG cch);
  170. LONG SetCp(LONG cp);
  171. void SetExtend(unsigned f) {_fExtend = f;}
  172. LONG GetAdjustedTextLength() const
  173. {return GetPed()->GetAdjustedTextLength();}
  174. // Range specific methods
  175. LONG Advance(LONG cch);
  176. void Collapser(long fStart);
  177. void FlipRange();
  178. LONG CleanseAndReplaceRange (LONG cchS, WCHAR const *pchS, BOOL fTestLimit,
  179. IUndoBuilder *publdr, WCHAR *pchD = NULL, LONG* pcchMove = NULL, DWORD dwFlags = 0);
  180. LONG CheckLimitReplaceRange (LONG cch, WCHAR const *pch,
  181. BOOL fTestLimit, IUndoBuilder *publdr, DWORD dwCharFlags,
  182. LONG *pcchMove, LONG cpFirst, int iMatchCurrent, DWORD dwFlags);
  183. HRESULT HexToUnicode (IUndoBuilder *publdr);
  184. HRESULT UnicodeToHex (IUndoBuilder *publdr);
  185. void Delete(IUndoBuilder *publdr, SELRR selaemode);
  186. void DeleteTerminatingEOP(IUndoBuilder *publdr);
  187. BOOL AdjustEndEOP (EOPADJUST NewChars);
  188. // Outline management
  189. void CheckOutlineLevel(IUndoBuilder *publdr);
  190. HRESULT ExpandOutline (LONG Level, BOOL fWholeDocument);
  191. HRESULT OutlineExpander(LONG Level, BOOL fWholeDocument);
  192. HRESULT Promote (LPARAM lparam, IUndoBuilder *publdr);
  193. // ReplaceRange must be virtual since the callers of
  194. // CLightDTEngine::CutRangeToClipboard() cast CTxtSelection* to CTxtRange*
  195. virtual LONG ReplaceRange(LONG cchNew, TCHAR const *pch, IUndoBuilder *publdr,
  196. SELRR selaemode, LONG *pcchMove = NULL, DWORD dwFlags = 0);
  197. virtual BOOL Update(BOOL fScrollIntoView);
  198. // Rich-text methods
  199. enum { PROTECTED_YES, PROTECTED_NO, PROTECTED_ASK };
  200. // Get/Set Char/Para Format methods
  201. void Update_iFormat(LONG iFmtDefault);
  202. DWORD GetCharSetMask(BOOL fUseDocFormat = FALSE); //@cmember Get range charset mask
  203. LONG Get_iCF(); //@cmember Get range CF index
  204. LONG Get_iFormat() {return _iFormat;}//@cmember Get _iFormat for quick peek
  205. LONG GetiFormat() const;
  206. BOOL Set_iCF(LONG iFormat); //@cmember Set range CF index
  207. LONG Get_iPF(); //@cmember Get active end PF index
  208. int IsProtected(LONG iDirection); //@cmember Is range protected?
  209. BOOL IsZombie() {return !GetPed();} //@cmember Is range zombied?
  210. BOOL WriteAccessDenied ();
  211. DWORD GetCharFormat(CCharFormat *pCF, DWORD flags = 0) const;
  212. DWORD GetParaFormat(CParaFormat *pPF, DWORD flags = 0) const;
  213. void SetDragProtection(BOOL fSet) // Convinces range it's protected
  214. {_fDragProtection = fSet;} // w/o modifying backing store
  215. HRESULT CharFormatSetter (const CCharFormat *pCF, DWORD dwMask);
  216. HRESULT ParaFormatSetter (const CParaFormat *pPF, DWORD dwMask);
  217. HRESULT SetCharFormat(const CCharFormat *pCF, DWORD flags,
  218. IUndoBuilder *publdr, DWORD dwMask, DWORD dwMask2);
  219. HRESULT SetParaFormat(const CParaFormat *pPF,
  220. IUndoBuilder *publdr, DWORD dwMask);
  221. HRESULT SetParaStyle (const CParaFormat *pPF,
  222. IUndoBuilder *publdr, DWORD dwMask);
  223. //@cmember Format range CharSets
  224. // Complex script feature :- Itemization
  225. BOOL ItemizeRuns(IUndoBuilder *publdr, BOOL fUnicodeBiDi = FALSE, BOOL fUseCtxLevel = FALSE);
  226. HRESULT BiDiLevelFromFSM (const CBiDiFSM* pfsm);
  227. LONG GetRunsPF (CRchTxtPtr* prtp, CFormatRunPtr* prpPF, LONG& cchLeft);
  228. #ifdef DEBUG
  229. void DebugFont (void);
  230. #endif
  231. // Find enclosing unit methods
  232. HRESULT Expander (long Unit, BOOL fExtend, LONG *pDelta,
  233. LONG *pcpMin, LONG *pcpMost);
  234. void FindAttributes (LONG *pcpMin, LONG *pcpMost, LONG Unit) const;
  235. void FindCell (LONG *pcpMin, LONG *pcpMost) const;
  236. BOOL FindObject (LONG *pcpMin, LONG *pcpMost) const;
  237. void FindParagraph (LONG *pcpMin, LONG *pcpMost) const;
  238. void FindSentence (LONG *pcpMin, LONG *pcpMost) const;
  239. BOOL FindVisibleRange(LONG *pcpMin, LONG *pcpMost) const;
  240. void FindWord (LONG *pcpMin, LONG *pcpMost,
  241. FINDWORD_TYPE type)const;
  242. LONG AdvanceCRLF();
  243. LONG BackupCRLF(BOOL fDiacriticCheck = TRUE);
  244. LONG FindWordBreak(INT action);
  245. LONG SnapToCluster(INT iDirection = 0);
  246. void ValidateRange();
  247. void SetUseiFormat(BOOL fUseiFormat) {_fUseiFormat = fUseiFormat;}
  248. // IUnknown methods
  249. STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  250. STDMETHOD_(ULONG, AddRef)();
  251. STDMETHOD_(ULONG, Release)();
  252. // IDispatch methods
  253. STDMETHODIMP GetTypeInfoCount(UINT * pctinfo);
  254. STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo ** pptinfo);
  255. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR ** rgszNames, UINT cNames,
  256. LCID lcid, DISPID * rgdispid) ;
  257. STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags,
  258. DISPPARAMS * pdispparams, VARIANT * pvarResult,
  259. EXCEPINFO * pexcepinfo, UINT * puArgErr) ;
  260. // ITextRange methods
  261. STDMETHODIMP GetText (BSTR *pbstr);
  262. STDMETHODIMP SetText (BSTR bstr);
  263. STDMETHODIMP GetChar (long *pch);
  264. STDMETHODIMP SetChar (long ch);
  265. STDMETHODIMP GetDuplicate (ITextRange **ppRange);
  266. STDMETHODIMP GetFormattedText (ITextRange **ppRange);
  267. STDMETHODIMP SetFormattedText (ITextRange *pRange);
  268. STDMETHODIMP GetStart (long *pcpFirst);
  269. STDMETHODIMP SetStart (long cpFirst);
  270. STDMETHODIMP GetEnd (long *pcpLim);
  271. STDMETHODIMP SetEnd (long cpLim);
  272. STDMETHODIMP GetFont (ITextFont **pFont);
  273. STDMETHODIMP SetFont (ITextFont *pFont);
  274. STDMETHODIMP GetPara (ITextPara **pPara);
  275. STDMETHODIMP SetPara (ITextPara *pPara);
  276. STDMETHODIMP GetStoryLength (long *pcch);
  277. STDMETHODIMP GetStoryType (long *pValue);
  278. STDMETHODIMP Collapse (long bStart);
  279. STDMETHODIMP Expand (long Unit, long *pDelta);
  280. STDMETHODIMP GetIndex (long Unit, long *pIndex);
  281. STDMETHODIMP SetIndex (long Unit, long Index, long Extend);
  282. STDMETHODIMP SetRange (long cpActive, long cpOther);
  283. STDMETHODIMP InRange (ITextRange * pRange, long *pb);
  284. STDMETHODIMP InStory (ITextRange * pRange, long *pb);
  285. STDMETHODIMP IsEqual (ITextRange * pRange, long *pb);
  286. STDMETHODIMP Select ();
  287. STDMETHODIMP StartOf (long Unit, long Extend, long * pDelta);
  288. STDMETHODIMP EndOf (long Unit, long Extend, long * pDelta);
  289. STDMETHODIMP Move (long Unit, long Count, long * pDelta);
  290. STDMETHODIMP MoveStart (long Unit, long Count, long * pDelta);
  291. STDMETHODIMP MoveEnd (long Unit, long Count, long * pDelta);
  292. STDMETHODIMP MoveWhile (VARIANT * Cset, long Count, long * pDelta);
  293. STDMETHODIMP MoveStartWhile (VARIANT * Cset, long Count, long * pDelta);
  294. STDMETHODIMP MoveEndWhile (VARIANT * Cset, long Count, long * pDelta);
  295. STDMETHODIMP MoveUntil (VARIANT FAR* Cset, long Count, long * pDelta);
  296. STDMETHODIMP MoveStartUntil (VARIANT * Cset, long Count, long * pDelta);
  297. STDMETHODIMP MoveEndUntil (VARIANT * Cset, long Count, long * pDelta);
  298. STDMETHODIMP FindText (BSTR bstr, long cch, long Flags, long * pLength);
  299. STDMETHODIMP FindTextStart (BSTR bstr, long cch, long Flags, long * pLength);
  300. STDMETHODIMP FindTextEnd (BSTR bstr, long cch, long Flags, long * pLength);
  301. STDMETHODIMP Delete (long Unit, long Count, long * pDelta);
  302. STDMETHODIMP Cut (VARIANT * ppIDataObject);
  303. STDMETHODIMP Copy (VARIANT * ppIDataObject);
  304. STDMETHODIMP Paste (VARIANT * pIDataObject, long Format);
  305. STDMETHODIMP CanPaste (VARIANT * pIDataObject, long Format, long * pb);
  306. STDMETHODIMP CanEdit (long * pbCanEdit);
  307. STDMETHODIMP ChangeCase (long Type);
  308. STDMETHODIMP GetPoint (long Type, long * px, long * py);
  309. STDMETHODIMP SetPoint (long x, long y, long Type, long Extend);
  310. STDMETHODIMP ScrollIntoView (long Value);
  311. STDMETHODIMP GetEmbeddedObject (IUnknown ** ppv);
  312. // ITextSelection methods
  313. STDMETHODIMP GetFlags (long * pFlags) ;
  314. STDMETHODIMP SetFlags (long Flags) ;
  315. STDMETHODIMP GetType (long * pType) ;
  316. STDMETHODIMP MoveLeft (long Unit, long Count, long Extend,
  317. long *pDelta) ;
  318. STDMETHODIMP MoveRight(long pUnit, long Count, long Extend,
  319. long *pDelta) ;
  320. STDMETHODIMP MoveUp (long pUnit, long Count, long Extend,
  321. long *pDelta) ;
  322. STDMETHODIMP MoveDown (long pUnit, long Count, long Extend,
  323. long *pDelta) ;
  324. STDMETHODIMP HomeKey (long pUnit, long Extend, long *pDelta) ;
  325. STDMETHODIMP EndKey (long pUnit, long Extend, long *pDelta) ;
  326. STDMETHODIMP TypeText (BSTR bstr) ;
  327. //@access Private ITextRange helper methods
  328. private:
  329. void RangeValidateCp (LONG cp, LONG cch);
  330. LONG Comparer (ITextRange * pv);
  331. LONG SpanSubstring (CUniscribe* pusp, CFormatRunPtr* pcrp, WCHAR* pwchString,
  332. LONG cchString, WORD& uSubStrLevel, DWORD dwInFlags, CCharFlags* pCharflags,
  333. WORD& wBiDiLangId);
  334. HRESULT EndSetter(LONG cp, BOOL fOther);
  335. HRESULT Finder (BSTR bstr, long Count, long Flags, LONG *pDelta,
  336. MOVES Mode);
  337. HRESULT GetLong (LONG lValue, long *pLong);
  338. HRESULT IsTrue (BOOL f, long *pB);
  339. HRESULT Matcher (VARIANT *Cset, long Count, LONG *pDelta, MOVES Mode,
  340. MATCHES Match);
  341. HRESULT Mover (long Unit, long Count, LONG *pDelta, MOVES Mode);
  342. HRESULT Replacer (LONG cchNew, TCHAR const *pch, DWORD dwFlags = 0);
  343. LONG CalcTextLenNotInRange();
  344. };
  345. // Useful Unicode range definitions for use with MoveWhile/Until methods
  346. #define CodeRange(n, m) 0x8000000 | ((m) - (n)) << 16 | n
  347. #define CR_ASCII CodeRange(0x0, 0x7f)
  348. #define CR_ANSI CodeRange(0x0, 0xff)
  349. #define CR_ASCIIPrint CodeRange(0x20, 0x7e)
  350. #define CR_Latin1 CodeRange(0x20, 0xff)
  351. #define CR_Latin1Supp CodeRange(0xa0, 0xff)
  352. #define CR_LatinXA CodeRange(0x100, 0x17f)
  353. #define CR_LatinXB CodeRange(0x180, 0x24f)
  354. #define CR_IPAX CodeRange(0x250, 0x2af)
  355. #define CR_SpaceMod CodeRange(0x2b0, 0x2ff)
  356. #define CR_Combining CodeRange(0x300, 0x36f)
  357. #define CR_Greek CodeRange(0x370, 0x3ff)
  358. #define CR_BasicGreek CodeRange(0x370, 0x3cf)
  359. #define CR_GreekSymbols CodeRange(0x3d0, 0x3ff)
  360. #define CR_Cyrillic CodeRange(0x400, 0x4ff)
  361. #define CR_Armenian CodeRange(0x530, 0x58f)
  362. #define CR_Hebrew CodeRange(0x590, 0x5ff)
  363. #define CR_BasicHebrew CodeRange(0x5d0, 0x5ea)
  364. #define CR_HebrewXA CodeRange(0x590, 0x5cf)
  365. #define CR_HebrewXB CodeRange(0x5eb, 0x5ff)
  366. #define CR_Arabic CodeRange(0x600, 0x6ff)
  367. #define CR_BasicArabic CodeRange(0x600, 0x652)
  368. #define CR_ArabicX CodeRange(0x653, 0x6ff)
  369. #define CR_Devengari CodeRange(0x900, 0x97f)
  370. #define CR_Bengali CodeRange(0x980, 0x9ff)
  371. #define CR_Gurmukhi CodeRange(0xa00, 0xa7f)
  372. #define CR_Gujarati CodeRange(0xa80, 0xaff)
  373. #define CR_Oriya CodeRange(0xb00, 0xb7f)
  374. #define CR_Tamil CodeRange(0xb80, 0xbff)
  375. #define CR_Teluga CodeRange(0xc00, 0xc7f)
  376. #define CR_Kannada CodeRange(0xc80, 0xcff)
  377. #define CR_Malayalam CodeRange(0xd00, 0xd7f)
  378. #define CR_Thai CodeRange(0xe00, 0xe7f)
  379. #define CR_Lao CodeRange(0xe80, 0xeff)
  380. #define CR_GeorgianX CodeRange(0x10a0, 0xa0cf)
  381. #define CR_BascGeorgian CodeRange(0x10d0, 0x10ff)
  382. #define CR_Hanguljamo CodeRange(0x1100, 0x11ff)
  383. #define CR_LatinXAdd CodeRange(0x1e00, 0x1eff)
  384. #define CR_GreekX CodeRange(0x1f00, 0x1fff)
  385. #define CR_GenPunct CodeRange(0x2000, 0x206f)
  386. #define CR_SuperScript CodeRange(0x2070, 0x207f)
  387. #define CR_SubScript CodeRange(0x2080, 0x208f)
  388. #define CR_SubSuperScrp CodeRange(0x2070, 0x209f)
  389. #define CR_Currency CodeRange(0x20a0, 0x20cf)
  390. #define CR_CombMarkSym CodeRange(0x20d0, 0x20ff)
  391. #define CR_LetterLike CodeRange(0x2100, 0x214f)
  392. #define CR_NumberForms CodeRange(0x2150, 0x218f)
  393. #define CR_Arrows CodeRange(0x2190, 0x21ff)
  394. #define CR_MathOps CodeRange(0x2200, 0x22ff)
  395. #define CR_MiscTech CodeRange(0x2300, 0x23ff)
  396. #define CR_CtrlPictures CodeRange(0x2400, 0x243f)
  397. #define CR_OptCharRecog CodeRange(0x2440, 0x245f)
  398. #define CR_EnclAlphaNum CodeRange(0x2460, 0x24ff)
  399. #define CR_BoxDrawing CodeRange(0x2500, 0x257f)
  400. #define CR_BlockElement CodeRange(0x2580, 0x259f)
  401. #define CR_GeometShapes CodeRange(0x25a0, 0x25ff)
  402. #define CR_MiscSymbols CodeRange(0x2600, 0x26ff)
  403. #define CR_Dingbats CodeRange(0x2700, 0x27bf)
  404. #define CR_CJKSymPunct CodeRange(0x3000, 0x303f)
  405. #define CR_Hiragana CodeRange(0x3040, 0x309f)
  406. #define CR_Katakana CodeRange(0x30a0, 0x30ff)
  407. #define CR_Bopomofo CodeRange(0x3100, 0x312f)
  408. #define CR_HangulJamo CodeRange(0x3130, 0x318f)
  409. #define CR_CJLMisc CodeRange(0x3190, 0x319f)
  410. #define CR_EnclCJK CodeRange(0x3200, 0x32ff)
  411. #define CR_CJKCompatibl CodeRange(0x3300, 0x33ff)
  412. #define CR_Hangul CodeRange(0x3400, 0x3d2d)
  413. #define CR_HangulA CodeRange(0x3d2e, 0x44b7)
  414. #define CR_HangulB CodeRange(0x44b8, 0x4dff)
  415. #define CR_CJKIdeograph CodeRange(0x4e00, 0x9fff)
  416. #define CR_PrivateUse CodeRange(0xe000, 0xf800)
  417. #define CR_CJKCompIdeog CodeRange(0xf900, 0xfaff)
  418. #define CR_AlphaPres CodeRange(0xfb00, 0xfb4f)
  419. #define CR_ArabicPresA CodeRange(0xfb50, 0xfdff)
  420. #define CR_CombHalfMark CodeRange(0xfe20, 0xfe2f)
  421. #define CR_CJKCompForm CodeRange(0xfe30, 0xfe4f)
  422. #define CR_SmallFormVar CodeRange(0xfe50, 0xfe6f)
  423. #define CR_ArabicPresB CodeRange(0xfe70, 0xfefe)
  424. #define CR_HalfFullForm CodeRange(0xff00, 0xffef)
  425. #define CR_Specials CodeRange(0xfff0, 0xfffd)
  426. #endif