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.

184 lines
4.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1993 - 2000.
  5. //
  6. // File: propfilt.hxx
  7. //
  8. // Contents: Definitions of classes to read property sets and properties
  9. // on docfile objects
  10. //
  11. // Classes: CPropertySetEnum
  12. // CPropertyEnum
  13. //
  14. // History: 93-Oct-18 DwightKr Created
  15. // 01-Nov-98 KLam Removed reference to ilock.hxx
  16. //
  17. //----------------------------------------------------------------------------
  18. #pragma once
  19. #include <ciintf.h>
  20. #include <ffenum.hxx>
  21. //+-------------------------------------------------------------------------
  22. //
  23. // Class: CPropertyEnum
  24. //
  25. // Synopsis: Enumerates properties on any object
  26. //
  27. // History: 93-Nov-27 DwightKr Created
  28. //
  29. //--------------------------------------------------------------------------
  30. class CPropertyEnum
  31. {
  32. public:
  33. CPropertyEnum() { END_CONSTRUCTION(CPropertyEnum); }
  34. virtual ~CPropertyEnum() {}
  35. virtual HRESULT GetPropertySetLocale(LCID & locale) = 0;
  36. virtual CStorageVariant const * Next( CFullPropSpec & ps ) = 0;
  37. };
  38. //+-------------------------------------------------------------------------
  39. //
  40. // Class: CDocStatPropertyEnum
  41. //
  42. // Synopsis: Enumerates system properties on a filename
  43. //
  44. // History: 93-Nov-27 DwightKr Created
  45. // 95-Feb-07 KyleP Rewrote
  46. //
  47. //--------------------------------------------------------------------------
  48. class CDocStatPropertyEnum : public CPropertyEnum
  49. {
  50. public:
  51. CDocStatPropertyEnum( ICiCOpenedDoc * Document );
  52. ~CDocStatPropertyEnum();
  53. CStorageVariant const * Next( CFullPropSpec & ps );
  54. HRESULT GetPropertySetLocale(LCID & locale);
  55. LONGLONG GetFileSize( void )
  56. {
  57. HRESULT hr = CacheVariant( PID_STG_SIZE );
  58. if (!SUCCEEDED( hr )) {
  59. return 0;
  60. } else {
  61. return _varCurrent.GetI8( ).QuadPart;
  62. }
  63. }
  64. BOOL GetFilterContents( BOOL fDirOk )
  65. {
  66. HRESULT hr = CacheVariant( PID_STG_ATTRIBUTES );
  67. if (!SUCCEEDED( hr )) {
  68. return TRUE;
  69. } else {
  70. return fDirOk ? TRUE : ((_varCurrent.GetUI4() & FILE_ATTRIBUTE_DIRECTORY) == 0);
  71. }
  72. }
  73. private:
  74. //
  75. // Load a specific property into the cache
  76. //
  77. HRESULT CacheVariant( PROPID propid );
  78. //
  79. // Variant wrapping current property
  80. //
  81. CStorageVariant _varCurrent;
  82. XInterface<IPropertyStorage> _PropertyStorage;
  83. XInterface<IEnumSTATPROPSTG> _PropertyEnum;
  84. };
  85. //+-------------------------------------------------------------------------
  86. //
  87. // Class: COLEPropertySetEnum
  88. //
  89. // Synopsis: Enumerates property sets on an OLE object
  90. //
  91. // History: 20-Dec-95 dlee created
  92. //
  93. //--------------------------------------------------------------------------
  94. class COLEPropertySetEnum
  95. {
  96. public:
  97. COLEPropertySetEnum( ICiCOpenedDoc * Document );
  98. GUID const * Next();
  99. XInterface<IPropertySetStorage> & GetPSS() { return _xPropSetStg; }
  100. BOOL IsStorage() const { return _fIsStorage; }
  101. enum { cMaxSetsCached = 5 };
  102. private:
  103. ULONG _cPropSets; // Number of propsets available
  104. ULONG _iPropSet; // Index of current propset.
  105. STATPROPSETSTG _aPropSets[ cMaxSetsCached ]; // Property set definitions
  106. XInterface<IPropertySetStorage> _xPropSetStg;
  107. XInterface<IEnumSTATPROPSETSTG> _xPropSetEnum;
  108. BOOL _fIsStorage;
  109. }; //COLEPropertySetEnum
  110. //+-------------------------------------------------------------------------
  111. //
  112. // Class: COLEPropertyEnum
  113. //
  114. // Synopsis: Enumerates OLE properties on a file
  115. //
  116. // History: 20-Dec-95 dlee created
  117. //
  118. //--------------------------------------------------------------------------
  119. class COLEPropertyEnum : public CPropertyEnum
  120. {
  121. public :
  122. COLEPropertyEnum( ICiCOpenedDoc *Document );
  123. ~COLEPropertyEnum() { FreeCache(); }
  124. CStorageVariant const * Next( CFullPropSpec & ps );
  125. HRESULT GetPropertySetLocale(LCID & locale);
  126. BOOL IsStorage() const { return _PropSetEnum.IsStorage(); }
  127. enum { cMaxValuesCached = 2 };
  128. private :
  129. BOOL FillCache();
  130. void FreeCache();
  131. ULONG _cValues;
  132. ULONG _iCurrent;
  133. COLEPropertySetEnum _PropSetEnum;
  134. CStorageVariant _aPropVals[ cMaxValuesCached ];
  135. PROPSPEC _aPropSpec[ cMaxValuesCached ];
  136. STATPROPSTG _aSPS[ cMaxValuesCached ];
  137. XInterface<IPropertyStorage> _xPropStorage;
  138. XInterface<IEnumSTATPROPSTG> _xPropEnum;
  139. XInterface<ICiCOpenedDoc> _xDocument;
  140. DWORD _Codepage;
  141. GUID const * _pguidCurrent;
  142. BOOL _fCustomOfficePropset;
  143. }; //COLEPropertyEnum
  144. HRESULT GetPropertySetLocale(IPropertyStorage *pPropStorage,
  145. LCID & locale);