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.

136 lines
3.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 2000.
  5. //
  6. // File: addprop.cxx
  7. //
  8. // Contents: A class to add properties from a document to the search
  9. // data repository.
  10. //
  11. // History: 7-23-96 srikants Created
  12. //
  13. //----------------------------------------------------------------------------
  14. #include <pch.cxx>
  15. #pragma hdrstop
  16. #include <ciole.hxx>
  17. #include <drep.hxx>
  18. #include <propspec.hxx>
  19. #include <propfilt.hxx>
  20. #include "addprop.hxx"
  21. static GUID guidNull = { 0x00000000,
  22. 0x0000,
  23. 0x0000,
  24. { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
  25. static CFullPropSpec psPath( guidStorage, PID_STG_PATH);
  26. //+---------------------------------------------------------------------------
  27. //
  28. // Member: CSearchAddProp::DoIt
  29. //
  30. // Synopsis: Adds properties to the data repository by iterating over
  31. // the properties.
  32. //
  33. // History: 7-23-96 srikants Created
  34. //
  35. //----------------------------------------------------------------------------
  36. void CSearchAddProp::DoIt()
  37. {
  38. //
  39. // Add Stat properties. Do so for both directories and files.
  40. //
  41. {
  42. CDocStatPropertyEnum CPEProp( &_openedDoc);
  43. AddProperties( CPEProp );
  44. }
  45. //
  46. // If there are ole properties, we must add the ole properties also.
  47. //
  48. if ( _fAddOleProps )
  49. {
  50. COLEPropertyEnum oleProp( &_openedDoc );
  51. AddProperties( oleProp );
  52. }
  53. }
  54. //+---------------------------------------------------------------------------
  55. //
  56. // Method: CSearchAddProp::AddProperty
  57. //
  58. // Arguments:
  59. // [var] -- Property value
  60. // [ps] -- Property ID
  61. // [drep] -- Data repository for filtered information
  62. //
  63. // History: 21-Oct-93 DwightKr Created.
  64. // 23-Jul-96 SrikantS Adapted for search needs
  65. //
  66. //----------------------------------------------------------------------------
  67. void CSearchAddProp::AddProperty(
  68. CStorageVariant const & var,
  69. CFullPropSpec & ps,
  70. CDataRepository & drep )
  71. {
  72. //
  73. // Don't filter paths
  74. //
  75. if ( ps != psPath )
  76. {
  77. vqDebugOut(( DEB_FILTER, "Filter property 0x%x: ", ps.GetPropertyPropid() ));
  78. #if CIDBG == 1
  79. var.DisplayVariant(DEB_FILTER | DEB_NOCOMPNAME, 0);
  80. #endif // CIDBG == 1
  81. vqDebugOut(( DEB_FILTER | DEB_NOCOMPNAME, "\n" ));
  82. // output the property to the data repository
  83. drep.PutPropName( ps );
  84. drep.PutValue( var );
  85. // store all property values in the property cache, though
  86. // only some are actually stored
  87. drep.StoreValue( ps, var );
  88. }
  89. }
  90. //+---------------------------------------------------------------------------
  91. //
  92. // Method: CSearchAddProp::AddProperties
  93. //
  94. // Arguments:
  95. // [propEnum] -- iterator for properties in a file
  96. //
  97. // History: 27-Nov-93 DwightKr Created.
  98. // 23-Jul-96 SrikantS Adapted for search needs
  99. //
  100. //----------------------------------------------------------------------------
  101. void CSearchAddProp::AddProperties(
  102. CPropertyEnum & propEnum )
  103. {
  104. CFullPropSpec ps;
  105. for ( CStorageVariant const * pvar = propEnum.Next( ps );
  106. pvar != 0;
  107. pvar = propEnum.Next( ps ) )
  108. {
  109. AddProperty( *pvar, ps, _drep );
  110. }
  111. }