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.

91 lines
2.4 KiB

  1. //
  2. // dispattr.h
  3. //
  4. #ifndef DISPATTR_H
  5. #define DISPATTR_H
  6. #include "strary.h"
  7. #include "ctffunc.h"
  8. typedef struct tagDISPATTRPROP {
  9. GUID guid;
  10. } DISPATTRPROP;
  11. class CDispAttrPropCache
  12. {
  13. public:
  14. CDispAttrPropCache() {}
  15. void Add(REFGUID rguid)
  16. {
  17. if (!FindGuid(rguid))
  18. {
  19. int i = Count();
  20. if (_rgDispAttrProp.Insert(i, 1))
  21. {
  22. DISPATTRPROP *pProp = _rgDispAttrProp.GetPtr(i);
  23. pProp->guid = rguid;
  24. }
  25. }
  26. }
  27. void Remove(REFGUID rguid)
  28. {
  29. int nCnt = _rgDispAttrProp.Count();
  30. int i;
  31. for (i = 0; i < nCnt; i++)
  32. {
  33. DISPATTRPROP *pProp = _rgDispAttrProp.GetPtr(i);
  34. if (IsEqualGUID(pProp->guid, rguid))
  35. {
  36. _rgDispAttrProp.Remove(i, 1);
  37. return;
  38. }
  39. }
  40. }
  41. BOOL FindGuid(REFGUID rguid)
  42. {
  43. int nCnt = _rgDispAttrProp.Count();
  44. int i;
  45. for (i = 0; i < nCnt; i++)
  46. {
  47. DISPATTRPROP *pProp = _rgDispAttrProp.GetPtr(i);
  48. if (IsEqualGUID(pProp->guid, rguid))
  49. {
  50. return TRUE;
  51. }
  52. }
  53. return FALSE;
  54. }
  55. int Count()
  56. {
  57. return _rgDispAttrProp.Count();
  58. }
  59. GUID *GetPropTable()
  60. {
  61. return (GUID *)_rgDispAttrProp.GetPtr(0);
  62. }
  63. CStructArray<DISPATTRPROP> _rgDispAttrProp;
  64. };
  65. ITfDisplayAttributeMgr *GetDAMLib(LIBTHREAD *plt);
  66. HRESULT InitDisplayAttrbuteLib(LIBTHREAD *plt);
  67. HRESULT UninitDisplayAttrbuteLib(LIBTHREAD *plt);
  68. HRESULT GetDisplayAttributeTrackPropertyRange(TfEditCookie ec, ITfContext *pic, ITfRange *pRange, ITfReadOnlyProperty **ppProp, IEnumTfRanges **ppEnum, ULONG *pulNumProp);
  69. HRESULT GetDisplayAttributeData(LIBTHREAD *plt, TfEditCookie ec, ITfReadOnlyProperty *pProp, ITfRange *pRange, TF_DISPLAYATTRIBUTE *pda, TfClientId *pguid, ULONG ulNumProp);
  70. HRESULT GetReconversionFromDisplayAttribute(LIBTHREAD *plt, TfEditCookie ec, ITfThreadMgr *ptim, ITfContext *pic, ITfRange *pRange, ITfFnReconversion **ppReconv, ITfDisplayAttributeMgr *pDAM);
  71. HRESULT GetAttributeColor(TF_DA_COLOR *pdac, COLORREF *pcr);
  72. HRESULT SetAttributeColor(TF_DA_COLOR *pdac, COLORREF cr);
  73. HRESULT SetAttributeSysColor(TF_DA_COLOR *pdac, int nIndex);
  74. HRESULT ClearAttributeColor(TF_DA_COLOR *pdac);
  75. #endif // DISPATTR_H