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.

186 lines
5.1 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996-2000.
  5. //
  6. // File: Scope.hxx
  7. //
  8. // Contents: Used to manage catalog(s) state
  9. //
  10. // History: 27-Nov-1996 KyleP Created
  11. //
  12. //--------------------------------------------------------------------------
  13. #pragma once
  14. #include <ciares.h>
  15. #include <dataobj.hxx>
  16. #include <tgrow.hxx>
  17. #include <dbcmdtre.hxx>
  18. #include <params.hxx>
  19. #include <lgplist.hxx>
  20. #include <fsciexps.hxx>
  21. class CListViewHeader;
  22. class CCachedProperty : INHERIT_VIRTUAL_UNWIND, public PCIObjectType
  23. {
  24. INLINE_UNWIND( CCachedProperty )
  25. public:
  26. CCachedProperty( CCatalog & cat,
  27. GUID & guidPropSet,
  28. PROPSPEC & psProperty,
  29. ULONG vt,
  30. ULONGLONG cbAllocation,
  31. DWORD dwStoreLevel,
  32. VARIANT_BOOL fModifiable,
  33. BOOL fIsNew = FALSE );
  34. CCachedProperty( CCachedProperty const & prop );
  35. ~CCachedProperty();
  36. CCachedProperty & operator =( CCachedProperty const & prop );
  37. static void InitHeader( CListViewHeader & Header );
  38. void GetDisplayInfo( RESULTDATAITEM * item );
  39. void SetResultHandle( HRESULTITEM id ) { _idResult = id; }
  40. BOOL IsAddedToResult() const { return (0 != _idResult); }
  41. WCHAR const * GetFName() const { return _xwcsFName.Get(); }
  42. WCHAR const * GetPropSet() const { return _wcsPropSet; }
  43. WCHAR const * GetProperty() const { return _xwcsProperty.Get(); }
  44. WCHAR const * GetDatatype() const { return _wcsDatatype; }
  45. WCHAR const * GetAllocation() const { return _wcsAllocation; }
  46. BOOL const IsModifiable() const { return VARIANT_TRUE == _fModifiable; }
  47. WCHAR const * GetStoreLevel() const
  48. {
  49. //
  50. // It should be primary or secondary if it is cached. Otherwise,
  51. // it should be invalid_store_level.
  52. //
  53. if (PRIMARY_STORE == _dwStoreLevel)
  54. {
  55. return STRINGRESOURCE(srPrimaryStore);
  56. }
  57. else if (SECONDARY_STORE == _dwStoreLevel)
  58. {
  59. return STRINGRESOURCE(srSecondaryStore);
  60. }
  61. else
  62. {
  63. Win4Assert( INVALID_STORE_LEVEL == _dwStoreLevel );
  64. // Don't display anything!
  65. return L"";
  66. }
  67. }
  68. ULONG const GetVT() const { return _vt; }
  69. void SetVT( ULONG vt );
  70. // A property is not cached if it has an invalid store level. A cached property
  71. // should always have a valid store level (primary or secondary)
  72. BOOL const IsCached() const { return (_cb > 0); }
  73. BOOL const IsFixed() const { return _fFixed; }
  74. ULONG const Allocation() const { return _cb; }
  75. void SetAllocation( ULONG cb ) { _cb = cb; SetVT( _vt ); }
  76. DWORD const StoreLevel() const { return _dwStoreLevel; }
  77. void SetStoreLevel( DWORD sl ) { _dwStoreLevel = sl; }
  78. FULLPROPSPEC const * GetFullPropspec() const { return &_fps; }
  79. HRESULTITEM ResultHandle() const { return _idResult; }
  80. //
  81. // Typing
  82. //
  83. PCIObjectType::OType Type() const { return PCIObjectType::Property; }
  84. //
  85. // Misc.
  86. //
  87. CCatalog & GetCatalog() { return _cat; }
  88. void Zombify() { _fZombie = TRUE; }
  89. BOOL IsZombie() { return _fZombie; }
  90. void MakeOld() { _fNew = FALSE; }
  91. BOOL IsNew() { return _fNew; }
  92. BOOL IsUnappliedChange() { return _fUnapplied; }
  93. void MakeUnappliedChange() { _fUnapplied = TRUE; }
  94. void ClearUnappliedChange() { _fUnapplied = FALSE; }
  95. //
  96. // type and size as known in the property list. this is used to
  97. // suggest a starting type and size. The user can override this!
  98. //
  99. DBTYPE GetDefaultType() { return _dbtDefaultType; }
  100. UINT GetDefaultSize() { return _uiDefaultSize; }
  101. private:
  102. HRESULTITEM _idResult;
  103. enum { ccStringizedGuid = 36 };
  104. WCHAR _wcsPropSet[ ccStringizedGuid + 1 ];
  105. WCHAR _wcsDatatype[ 100 ]; // Safe for all known datatypes
  106. WCHAR _wcsAllocation[ 7 ]; // Max: 65,535
  107. XGrowable<WCHAR> _xwcsProperty;
  108. XGrowable<WCHAR> _xwcsFName;
  109. ULONG _vt;
  110. ULONG _cb;
  111. BOOL _fZombie;
  112. BOOL _fNew;
  113. BOOL _fFixed;
  114. BOOL _fUnapplied;
  115. CCatalog & _cat;
  116. FULLPROPSPEC _fps;
  117. DWORD _dwStoreLevel;
  118. VARIANT_BOOL _fModifiable;
  119. CDefColumnRegEntry _regEntry;
  120. static BOOL _fFirstTime;
  121. XInterface<CLocalGlobalPropertyList> _xPropList; // For friendly names
  122. // type and size as known to the property list
  123. DBTYPE _dbtDefaultType;
  124. UINT _uiDefaultSize;
  125. };
  126. //
  127. // Datatype names
  128. //
  129. extern WCHAR * awcsType[];
  130. unsigned const cType = VT_CLSID + 1;
  131. extern ULONG aulTypeIndex[];
  132. unsigned const cTypeIndex = 26;
  133. //
  134. //
  135. // Property columns
  136. //
  137. struct SPropertyColumn
  138. {
  139. WCHAR const * (CCachedProperty::*pfGet)() const;
  140. StringResource srTitle;
  141. ULONG justify;
  142. };
  143. extern SPropertyColumn coldefProps[];