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.

235 lines
8.6 KiB

  1. // Copyright (C) Microsoft Corporation 1996-1997, All Rights reserved.
  2. #if _MSC_VER > 1000
  3. #pragma once
  4. #endif
  5. #ifndef _SYSTEM_H_
  6. #define _SYSTEM_H_
  7. #include "fs.h"
  8. #include "fsclient.h"
  9. #include "cinfotyp.h"
  10. #include "hhtypes.h"
  11. // Manifest constants and Enums
  12. // These HHW and other modules suck these files in.
  13. #ifdef HHCTRL
  14. #define DEFAULT_FONT (_Resource.GetUIFont())
  15. #else
  16. #define DEFAULT_FONT (g_hfontDefault)
  17. #endif
  18. class CFullTextSearch;
  19. class CExCollection;
  20. class CExTitle;
  21. /////////////////////////////////////////////////////////////////////////////////////////////
  22. // CTitleInformation - read in the title informaton file (#SYSTEM) settings for each title
  23. //
  24. class CTitleInformation
  25. {
  26. public:
  27. CTitleInformation( CFileSystem* pFileSystem );
  28. ~CTitleInformation();
  29. inline SYSTEM_FLAGS GetSystemFlags() { Init(); return m_Settings; }
  30. inline PCSTR GetShortName() { Init(); return m_pszShortName; }
  31. inline PCSTR GetDefaultToc() { Init(); return m_pszDefToc; }
  32. inline PCSTR GetDefaultIndex() { Init(); return m_pszDefIndex; }
  33. inline PCSTR GetDefaultHtml() { Init(); return m_pszDefHtml; }
  34. inline PCSTR GetDefaultCaption() { Init(); return m_pszDefCaption; }
  35. inline PCSTR GetDefaultWindow() { Init(); return m_pszDefWindow; }
  36. inline PCSTR GetCompilerInformation() { Init(); return m_pszCompilerVersion; }
  37. inline HASH GetBinaryIndexNameHash() { Init(); return m_hashBinaryIndexName; }
  38. inline HASH GetBinaryTocNameHash() { Init(); return m_hashBinaryTocName; }
  39. inline INFOTYPE_DATA* GetInfoTypeData() { Init(); return m_pdInfoTypes; }
  40. inline int GetInfoTypeCount() { Init(); return m_iCntInfoTypes; }
  41. inline BOOL GetIdxHeader(IDXHEADER** ppIdxHdr)
  42. {
  43. Init();
  44. if ( ppIdxHdr )
  45. *ppIdxHdr = &m_idxhdr;
  46. return m_bGotHeader;
  47. }
  48. inline int GetExtTabCount() const { return m_cExtTabs; }
  49. inline EXTENSIBLE_TAB* GetExtTab(int pos) const { if (m_paExtTabs && pos < (int)m_cExtTabs) return &m_paExtTabs[pos]; else return NULL; }
  50. inline HFONT GetContentFont() { Init(); return (m_hFont); }
  51. inline HFONT GetAccessableContentFont() { Init(); return (m_hFontAccessableContent); }
  52. inline BOOL IsNeverPromptOnMerge() { Init(); return m_bNeverPromptOnMerge; }
  53. // below items are stored in the SYSTEM_FLAGS structure
  54. inline FILETIME GetFileTime() { Init(); return m_Settings.FileTime; }
  55. inline LCID GetLanguage() { Init(); return m_Settings.lcid; }
  56. #ifdef HHCTRL
  57. inline UINT GetCodePage() { Init(); if( !m_CodePage ) m_CodePage = CodePageFromLCID(m_Settings.lcid); return m_CodePage; }
  58. inline INT GetTitleCharset(void) { Init(); return m_iCharset; }
  59. #endif
  60. inline BOOL IsKeywordLinks() { Init(); return m_Settings.fKeywordLinks; }
  61. inline BOOL IsAssociativeLinks() { Init(); return m_Settings.fALinks; }
  62. inline BOOL IsFullTextSearch() { Init(); return m_Settings.fFTI; }
  63. inline BOOL IsDoubleByte() { Init(); return m_Settings.fDBCS; }
  64. HRESULT Initialize();
  65. private:
  66. void InitContentFont(PCSTR pszFontSpec);
  67. inline BOOL Init() { if( !m_bInit ) Initialize(); return m_bInit; }
  68. // m_pIT;
  69. BOOL m_bInit; // self-initing class
  70. BOOL m_bGotHeader;
  71. CFileSystem* m_pFileSystem; // title file system handle
  72. SYSTEM_FLAGS m_Settings; // simple title information settings
  73. PCSTR m_pszShortName; // short title name
  74. PCSTR m_pszDefToc;
  75. PCSTR m_pszDefIndex;
  76. PCSTR m_pszDefHtml;
  77. PCSTR m_pszDefCaption;
  78. PCSTR m_pszDefWindow;
  79. HASH m_hashBinaryIndexName; // used to see if we should use binary index or not
  80. HASH m_hashBinaryTocName; // used to see if we should use binary toc or not
  81. INFOTYPE_DATA* m_pdInfoTypes;
  82. PCSTR m_pszCompilerVersion;
  83. int m_iCntInfoTypes;
  84. IDXHEADER m_idxhdr;
  85. DWORD m_cExtTabs;
  86. EXTENSIBLE_TAB* m_paExtTabs;
  87. CTable* m_ptblExtTabs;
  88. PCSTR m_pszDefaultFont;
  89. HFONT m_hFont;
  90. HFONT m_hFontAccessableContent;
  91. BOOL m_bNeverPromptOnMerge;
  92. UINT m_CodePage;
  93. INT m_iCharset;
  94. };
  95. /////////////////////////////////////////////////////////////////////////////////////////////
  96. // CTitleInformation2 - get title informaton without going through the file system
  97. //
  98. class CTitleInformation2
  99. {
  100. public:
  101. CTitleInformation2( LPCTSTR pszPathName );
  102. ~CTitleInformation2();
  103. inline LPCTSTR GetShortName() { Init(); return m_pszShortName; }
  104. inline FILETIME GetFileTime() { Init(); return m_FileTime; }
  105. inline LCID GetLanguage() { Init(); return m_lcid; }
  106. HRESULT Initialize();
  107. private:
  108. inline BOOL Init() { if( !m_bInit ) Initialize(); return m_bInit; }
  109. BOOL m_bInit; // self-initing class
  110. LPCTSTR m_pszPathName; // title pathname
  111. LPCTSTR m_pszShortName; // short title name
  112. LCID m_lcid; // language
  113. FILETIME m_FileTime; // file time
  114. };
  115. /////////////////////////////////////////////////////////////////////////////////////////////
  116. // Darwin Stuff
  117. //
  118. // REVIEW: These must be tied to the calling process. If we ever support
  119. // multiple processes in a single OCX, this will break big time.
  120. extern PSTR g_pszDarwinGuid;
  121. extern PSTR g_pszDarwinBackupGuid;
  122. /////////////////////////////////////////////////////////////////////////////////////////////
  123. // CHmData
  124. //
  125. extern CHmData** g_phmData;
  126. CHmData* FindCurFileData(PCSTR pszCompiledFile);
  127. // WARNING: CStr is about the only class that can be specified in CHmData
  128. // that will be automatically created during the constructor -- we zero
  129. // out all members during ChmData contstruction which can wipe out another
  130. // class that wants non-zero members after its constructor
  131. class CHmData
  132. {
  133. public:
  134. CHmData::CHmData();
  135. CHmData::~CHmData();
  136. inline void AddRef() { cRef++; }
  137. int Release(void);
  138. inline CTitleInformation* GetInfo() { return m_pInfo; }
  139. inline PCSTR GetDefaultToc() { return m_pszDefToc; }
  140. inline PCSTR GetDefaultIndex() { return m_pszDefIndex; }
  141. inline PCSTR GetDefaultHtml() { return m_pszDefHtml; }
  142. inline PCSTR GetDefaultCaption() { return m_pszDefCaption; }
  143. inline PCSTR GetDefaultWindow() { return m_pszDefWindow; }
  144. LPCTSTR GetCompiledFile(void) const { return m_pszITSSFile; }
  145. void SetCompiledFile(PCSTR pszCompiledFile) {
  146. if (m_pszITSSFile)
  147. lcFree(m_pszITSSFile);
  148. m_pszITSSFile = lcStrDup(pszCompiledFile); }
  149. BOOL ReadSystemFiles(PCSTR pszITSSFile);
  150. BOOL ReadSystemFile(CExTitle* pTitle);
  151. BOOL ReadSubSets( CExTitle *pTitle );
  152. CExTitle* GetExTitle(void);
  153. void PopulateUNICODETables( void );
  154. PCSTR GetString(DWORD offset);
  155. inline int GetExtTabCount() const { return m_pInfo->GetExtTabCount(); }
  156. inline EXTENSIBLE_TAB* GetExtTab(int pos) const { return m_pInfo->GetExtTab(pos); }
  157. HFONT GetContentFont();
  158. PCSTR m_pszShortName;
  159. HASH m_hashBinaryIndexName; // used to see if we should use binary index or not
  160. HASH m_hashBinaryTocName; // used to see if we should use binary toc or not
  161. SUBSET_DATA* m_pdSubSets;
  162. INFOTYPE_DATA* m_pdInfoTypes;
  163. // public data is bad! make it private and expose via inline methods
  164. // For the Info Type API
  165. INFOTYPE* m_pAPIInfoTypes; // info type bit mask set by the API.
  166. int m_cur_Cat;
  167. int m_cur_IT;
  168. CInfoType* m_pInfoType;
  169. CTable* m_ptblIT; // The unicode copy of the Info Type strings
  170. CTable* m_ptblIT_Desc; // InfoType Descriptions
  171. CTable* m_ptblCat; // The unicode copy of the Category strings
  172. CTable* m_ptblCat_Desc; // Category Descriptions
  173. SYSTEM_FLAGS m_sysflags;
  174. CExCollection* m_pTitleCollection;
  175. protected:
  176. PCSTR m_pszITSSFile;
  177. int cRef;
  178. #ifdef _DEBUG
  179. DWORD m_cbStrings;
  180. DWORD m_cbUrls;
  181. DWORD m_cbKeywords;
  182. #endif
  183. private:
  184. PCSTR m_pszDefToc;
  185. PCSTR m_pszDefIndex;
  186. PCSTR m_pszDefHtml;
  187. PCSTR m_pszDefCaption;
  188. PCSTR m_pszDefWindow;
  189. CTitleInformation* m_pInfo;
  190. };
  191. #endif // _SYSTEM_H_