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.

116 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 "_cfpf.h"
  18. #ifndef NOCOMPLEXSCRIPTS
  19. #include "usp10.h"
  20. #endif
  21. #define CP_BULLET 0x80000000
  22. // =============================== CLsrun =====================================
  23. // CLsrun - LineServices run structure
  24. struct CLsrun
  25. {
  26. LONG _cp; // the starting cp of the run
  27. const CCharFormat* _pCF; // pointer to the character formatting
  28. struct CLsrun* _pNext; // next linked (shaped together) run
  29. #ifndef NOCOMPLEXSCRIPTS
  30. SCRIPT_ANALYSIS _a; // run's analysis (will be 0 if non-complex script)
  31. #endif
  32. private:
  33. BYTE _fSelected:1; // Is this run selected?
  34. BYTE _fFallback:1; // Is font fallback applied?
  35. public:
  36. void SetSelected(BOOL fSelected) {_fSelected = fSelected;}
  37. BOOL IsSelected();
  38. BOOL IsBullet() {return _cp & CP_BULLET;}
  39. void SetFallback(BOOL fFallback) {_fFallback = fFallback;}
  40. BOOL IsFallback() {return _fFallback;}
  41. };
  42. // =============================== CLsrunChunk =====================================
  43. // CLsrunChunk - Manages a chunk of PLSRUNs
  44. class CLsrunChunk
  45. {
  46. public:
  47. PLSRUN _prglsrun;
  48. int _cel;
  49. };
  50. // =============================== COls =====================================
  51. // COls - LineServices object class
  52. class CTxtEdit;
  53. class CMeasurer;
  54. class CDispDim;
  55. struct COls
  56. {
  57. public:
  58. CMeasurer *_pme; // Active CMeasurer or CRenderer
  59. PLSLINE _plsline; // Line cache
  60. LONG _cp; // cpMin for _plsline
  61. const CDisplay *_pdp; // Current Display object, used to determine if display
  62. // object changed without receiving focus messages
  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. void QueryLineInfo(LSLINFO &lslinfo, LONG *pupStart, LONG *pdupWidth);
  81. BOOL SetLsChp(DWORD dwObjId, PLSRUN plsrun, PLSCHP plschp);
  82. BOOL SetRun(PLSRUN plsrun);
  83. PLSRUN GetPlsrun(LONG cp, const CCharFormat *pCF, BOOL fAutoNumber);
  84. LSERR WINAPI FetchAnmRun(long cp, LPCWSTR *plpwchRun, DWORD *pcchRun,
  85. BOOL *pfHidden, PLSCHP plsChp, PLSRUN *pplsrun);
  86. void CchFromUp(POINTUV pt, CDispDim *pdispdim, LONG *pcpActual);
  87. void CreateOrGetLine();
  88. void DestroyLine(CDisplay *pdp);
  89. HRESULT Init(CMeasurer *pme);
  90. BOOL MeasureLine(CLine *pliTarget);
  91. LONG MeasureText(LONG cch, UINT taMode, CDispDim *pdispdim);
  92. BOOL RenderLine(CLine &li, BOOL fLastLine);
  93. CMeasurer * GetMeasurer() {return _pme;}
  94. CRenderer * GetRenderer() {return (CRenderer*) _pme;}
  95. };
  96. extern COls* g_pols;
  97. extern const LSIMETHODS vlsimethodsOle;
  98. extern CLineServices *g_plsc; // LineServices Context
  99. #endif