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.

129 lines
4.9 KiB

  1. #if _MSC_VER > 1000
  2. #pragma once
  3. #endif
  4. #ifndef __CSUBSET_H__
  5. #define __CSUBSET_H__
  6. #include "cinfotyp.h"
  7. #define MAX_SUBSETS 10
  8. class CHHWinType;
  9. class CSubSet
  10. {
  11. private:
  12. INFOTYPE dwI;
  13. INFOTYPE dwE;
  14. public:
  15. CStr m_cszSubSetName;
  16. INFOTYPE *m_pInclusive; // A bit field of the ITs to include in the subset
  17. INFOTYPE *m_pExclusive; // A bit field of the ITs to exclude in from the subset
  18. CInfoType *m_pIT;
  19. int m_ITSize; // the size of INFOTYPE
  20. BOOL m_bPredefined; // Created by author or user, author created SS are read only
  21. BOOL m_bIsEntireCollection;
  22. INFOTYPE **m_aCatMasks;
  23. public:
  24. CSubSet( int const ITSize); // Constructor
  25. ~CSubSet(); // Descructor
  26. const CSubSet& operator=(const CSubSet& SetSrc); // Copy constructor
  27. BOOL Filter( INFOTYPE const *pTopicIT ) const;// { return TRUE; }
  28. void DeleteIncType( int const type ){ if(m_pInclusive) DeleteIT(type, m_pInclusive);}
  29. void DeleteExcType( int const type ){ if(m_pExclusive) DeleteIT(type, m_pExclusive);}
  30. void AddIncType(int const type ){if(m_pInclusive) AddIT(type, m_pInclusive);}
  31. void AddExcType(int const type) {if(m_pExclusive) AddIT(type, m_pExclusive);}
  32. void BuildMask(void);
  33. BOOL IsSameSet (PCSTR pszName) const;
  34. int GetFirstExcITinSubSet(void) const;
  35. int GetNextExcITinSubSet(void) const;
  36. int GetFirstIncITinSubSet(void) const;
  37. int GetNextIncITinSubSet(void) const;
  38. BOOL IsDeleted( const int pos ) const {if (!m_pIT) return TRUE;
  39. return ( ((m_pIT->m_itTables.m_ptblInfoTypes->CountStrings()>0)&&
  40. *(m_pIT->m_itTables.m_ptblInfoTypes->GetPointer(pos))==' ' ))?TRUE:FALSE;}
  41. };
  42. class CSubSets : public CSubSet
  43. {
  44. friend class CChooseSubsets;
  45. friend class CAdvancedSearchNavPane;
  46. public:
  47. CSubSets( int ITSize, CTable *ptblSubSets, CSiteMap *pSiteMap, BOOL fPredefined );
  48. CSubSets( int ITSize, CInfoType *pIT, BOOL fPredefined ); // constructor
  49. ~CSubSets(void); // Destructor
  50. const CSubSets& operator=( const CSubSets& SetsSrc ); // Copy Constructor
  51. #ifdef HHCTRL
  52. CSubSets( int ITSize, CHmData* const phmData, BOOL fPredefined);
  53. void CopyTo( CHmData * const phmData );
  54. #endif
  55. protected:
  56. void _CSubSets(void);
  57. CSubSet **m_aSubSets; // An allocated array of allocated subsets.
  58. int m_cSets; // The number of subsets defined in m_aSubSets
  59. int m_max_subsets; // the number of allocated locations in m_aSubSets
  60. PSTR m_pszFilename; // Where user defined subsets persist on disk
  61. CSubSet *m_Toc;
  62. CSubSet *m_Index;
  63. CSubSet *m_FTS;
  64. public:
  65. BOOL m_fPredefined; // TRUE if the SS are predefined
  66. CSubSet *m_cur_Set;
  67. public:
  68. BOOL fTOCFilter( INFOTYPE const *pTopicIT ) const { return m_Toc?m_Toc->Filter( pTopicIT ):TRUE; }
  69. BOOL fIndexFilter( INFOTYPE const *pTopicIT ) const { return m_Index?m_Index->Filter( pTopicIT ):TRUE; }
  70. BOOL fFTSFilter( INFOTYPE const *pTopicIT ) const { return m_FTS?m_FTS->Filter( pTopicIT ):TRUE; }
  71. CSubSet * GetTocSubset() { return m_Toc; }
  72. CSubSet * GetIndexSubset() { return m_Index; }
  73. CSubSet * GetFTSSubset() { return m_FTS; }
  74. BOOL fTocMask(void) const { return ( m_Toc == NULL)?FALSE:TRUE; }
  75. BOOL fIndexMask(void) const { return ( m_Index == NULL)?FALSE:TRUE; }
  76. BOOL fFTSMask(void) const { return ( m_FTS == NULL)?FALSE:TRUE; }
  77. #ifdef HHCTRL
  78. void SetTocMask( PCSTR psz, CHHWinType* phh);
  79. #else
  80. void SetTocMask( PCSTR psz ) { if (int i = GetSubSetIndex(psz)>=0) m_Toc = m_aSubSets[i]; else m_Toc = NULL ;}
  81. #endif
  82. void SetIndexMask( PCSTR psz) { if (int i = GetSubSetIndex(psz)>=0) m_Index = m_aSubSets[i]; else m_Index = NULL ;}
  83. void SetFTSMask( PCSTR psz ) { if (int i = GetSubSetIndex(psz)>=0) m_FTS = m_aSubSets[i]; else m_FTS = NULL ;}
  84. CSubSet *AddSubSet(CSubSet *SubSet); // import a subset
  85. CSubSet *AddSubSet( ); // create a new subset.
  86. void RemoveSubSet( PCSTR cszName );
  87. BOOL SaveToFile( PCSTR filename ); // user defined subsets
  88. BOOL ReadFromFile( PCSTR filename ); // user degined subsets
  89. PCSTR GetSubSetFile(void) { return m_pszFilename; }
  90. void SetSubSetFile(PCSTR pszFile) {
  91. if (!m_pszFilename && pszFile)
  92. m_pszFilename = lcStrDup(pszFile); }
  93. int HowManySubSets() const { return m_cSets; }
  94. int GetSubSetIndex( PCSTR pszName ) const;
  95. CSubSet *GetSubSet( int const SubSet ) const { return m_aSubSets[SubSet]; }
  96. CSubSet *GetSubSet( PCSTR pszName ) const { return m_aSubSets[GetSubSetIndex(pszName)]; }
  97. CSubSet *SelectSubSet( PCSTR pszName ) {m_cur_Set = m_aSubSets[GetSubSetIndex(pszName)];return m_cur_Set;}
  98. protected:
  99. void ReSizeSubSet(); // called from AddSubSet()
  100. };
  101. #endif // __CSUBSET_H__