Source code of Windows XP (NT5)
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.

118 lines
3.5 KiB

  1. /*
  2. * _OLS.H
  3. *
  4. * Purpose:
  5. * COls Line Services object class used to connect RichEdit with
  6. * Line Services.
  7. *
  8. * Authors:
  9. * Original RichEdit LineServices code: Rick Sailor
  10. * Murray Sargent
  11. *
  12. * Copyright (c) 1997-1998, Microsoft Corporation. All rights reserved.
  13. */
  14. #ifndef _OLS_H
  15. #define _OLS_H
  16. #include "_common.h"
  17. #include "_ls.h"
  18. #include "_cfpf.h"
  19. #include "usp10.h"
  20. #define CP_BULLET 0x80000000
  21. // =============================== CLsrun =====================================
  22. // CLsrun - LineServices run structure
  23. struct CLsrun
  24. {
  25. LONG _cp; // the starting cp of the run
  26. const CCharFormat* _pCF; // pointer to the character formatting
  27. struct CLsrun* _pNext; // next linked (shaped together) run
  28. SCRIPT_ANALYSIS _a; // run's analysis (will be 0 if non-complex script)
  29. private:
  30. BYTE _fSelected:1; // Is this run selected?
  31. BYTE _fFallback:1; // Is font fallback applied?
  32. public:
  33. void SetSelected(BOOL fSelected) {_fSelected = fSelected;}
  34. BOOL IsSelected();
  35. BOOL IsBullet() {return _cp & CP_BULLET;}
  36. void SetFallback(BOOL fFallback) {_fFallback = fFallback;}
  37. BOOL IsFallback() {return _fFallback;}
  38. };
  39. // =============================== CLsrunChunk =====================================
  40. // CLsrunChunk - Manages a chunk of PLSRUNs
  41. class CLsrunChunk
  42. {
  43. public:
  44. PLSRUN _prglsrun;
  45. int _cel;
  46. };
  47. // =============================== COls =====================================
  48. // COls - LineServices object class
  49. class CTxtEdit;
  50. class CMeasurer;
  51. class CDispDim;
  52. struct COls
  53. {
  54. public:
  55. CMeasurer *_pme; // Active CMeasurer or CRenderer
  56. PLSLINE _plsline; // Line cache
  57. LONG _cp; // cpMin for _plsline
  58. const CDisplay *_pdp; // Current Display object, used to determine if display
  59. // object changed without receiving focus messages
  60. LONG _xWidth; // Width of line to be formatted
  61. BOOL _fCheckFit; // See if the line will fit, but formatting left justified
  62. // into an infinitely long line.
  63. CArray<long> _rgcp; // Array for CP mapping
  64. CArray<CLsrunChunk> _rglsrunChunk; // Array of ClsrunChunks
  65. // Note: might be better to alloc the following only if needed
  66. LSTBD _rgTab[MAX_TAB_STOPS]; // Buffer used by pfnFetchTabs
  67. WCHAR _szAnm[CCHMAXNUMTOSTR + 4];//numbering + braces + space + end character
  68. WCHAR _rgchTemp[64]; // Temporary buffer for passwords and allcaps, etc.
  69. int _cchAnm; // cch in use
  70. CCharFormat _CFBullet; // Character formatting for anm run
  71. LONG _cEmit; // Brace emitting protection (0 - balance)
  72. COls() {}
  73. ~COls();
  74. //CP matching, reverser brace support
  75. LONG GetCpLsFromCpRe(LONG cpRe);
  76. LONG GetCpReFromCpLs(LONG cpLs);
  77. LONG BracesBeforeCp(LONG cpLs);
  78. BOOL AddBraceCp(LONG cpLs);
  79. PLSRUN CreatePlsrun(void);
  80. BOOL SetLsChp(DWORD dwObjId, PLSRUN plsrun, PLSCHP plschp);
  81. BOOL SetRun(PLSRUN plsrun);
  82. PLSRUN GetPlsrun(LONG cp, const CCharFormat *pCF, BOOL fAutoNumber);
  83. LSERR WINAPI FetchAnmRun(long cp, LPCWSTR *plpwchRun, DWORD *pcchRun,
  84. BOOL *pfHidden, PLSCHP plsChp, PLSRUN *pplsrun);
  85. void CchFromXpos(POINT pt, CDispDim *pdispdim, LONG *pcpActual);
  86. void CreateOrGetLine();
  87. void DestroyLine(CDisplay *pdp);
  88. HRESULT Init(CMeasurer *pme);
  89. BOOL MeasureLine(LONG xWidth, CLine *pliTarget);
  90. LONG MeasureText(LONG cch, UINT taMode, CDispDim *pdispdim);
  91. BOOL RenderLine(CLine &li);
  92. CMeasurer * GetMeasurer() {return _pme;}
  93. CRenderer * GetRenderer() {return (CRenderer*) _pme;}
  94. void SetMeasurer(CMeasurer *pme) {_pme = pme;}
  95. };
  96. extern COls* g_pols;
  97. extern const LSIMETHODS vlsimethodsOle;
  98. extern CLineServices *g_plsc; // LineServices Context
  99. #endif