Leaked source code of windows server 2003
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.

158 lines
5.3 KiB

  1. /***************************************************************************
  2. * FontMan.h -- Definintion for the class: CFontManager
  3. *
  4. *
  5. * Copyright (C) 1992-93 ElseWare Corporation. All rights reserved.
  6. ***************************************************************************/
  7. #if !defined(__FONTMAN_H__)
  8. #define __FONTMAN_H__
  9. #if !defined(__FSNOTIFY_H__)
  10. #include "fsnotify.h"
  11. #endif
  12. #include "strtab.h"
  13. // The database search capabilities have been extended.
  14. enum {
  15. kSearchAny = 1,
  16. kSearchTT,
  17. kSearchNotTT
  18. };
  19. //*********************************************************************
  20. // Forward declarations
  21. //
  22. class CFontClass;
  23. class CFontList;
  24. class CFontManager;
  25. struct IPANOSEMapper;
  26. DWORD dwResetFamilyFlags(void);
  27. //*********************************************************************
  28. // Class CFontManager
  29. //
  30. class CFontManager
  31. {
  32. public:
  33. virtual ~CFontManager( );
  34. BOOL bInit( ); // Any initialization
  35. BOOL bLoadFontList( ); // Build the font list
  36. VOID vReconcileFolder( int iPriority );
  37. VOID vDoReconcileFolder();
  38. CFontClass * poAddToList( LPTSTR lpName, LPTSTR lpPath, LPTSTR lpCompFile = NULL );
  39. CFontList * poLockFontList( );
  40. void vReleaseFontList( );
  41. void vGetFamily( CFontClass * poFont, CFontList * poList );
  42. int iSearchFontList( PTSTR pszTarget, BOOL bExact = TRUE, int iType = kSearchAny );
  43. int iSearchFontListLHS( PTSTR pszLHS );
  44. int iSearchFontListFile( PTSTR pszFile );
  45. CFontClass * poSearchFontList( PTSTR pszTarget, BOOL bExact = TRUE, int iType = kSearchAny );
  46. CFontClass * poSearchFontListLHS( PTSTR pszLHS );
  47. CFontClass * poSearchFontListFile( PTSTR pszFile );
  48. VOID vResetFamilyFlags( );
  49. VOID vDoResetFamilyFlags( );
  50. BOOL bWaitOnFamilyReset( );
  51. BOOL bLoadFamList( );
  52. BOOL bRefresh( BOOL bCheckDup = TRUE );
  53. void vToBeRemoved( CFontList * poList );
  54. BOOL bCheckTBR( );
  55. void vUndoTBR( );
  56. void vVerifyList( );
  57. void vDeleteFontList( CFontList * poList, BOOL bDelete = TRUE );
  58. void vDeleteFont( CFontClass * pFont, BOOL bRemoveFile );
  59. void vDeleteFontFamily( CFontClass * pFont, BOOL bRemoveFile );
  60. int iCompare( CFontClass * pFont1, CFontClass * pFont2, CFontClass * pOrigin );
  61. USHORT nDiff( CFontClass * pFont1, CFontClass * pFont2 );
  62. int GetFontsDirectory( LPTSTR lpDir, int iLen );
  63. BOOL ShouldAutoInstallFile( PTSTR pstr, DWORD dwAttrib );
  64. BOOL bFamiliesNeverReset(void) { return m_bFamiliesNeverReset; }
  65. //
  66. // Enumerated return values for dwWaitForInstallationMutex().
  67. //
  68. enum { MUTEXWAIT_SUCCESS, // Got the mutex.
  69. MUTEXWAIT_TIMEOUT, // Wait timed out.
  70. MUTEXWAIT_FAILED, // Wait failed.
  71. MUTEXWAIT_WMQUIT // Rcvd WM_QUIT while waiting.
  72. };
  73. DWORD dwWaitForInstallationMutex(DWORD dwTimeout = 2000);
  74. BOOL bReleaseInstallationMutex(void);
  75. BOOL CheckForType1FontDriver(void);
  76. BOOL Type1FontDriverInstalled(void)
  77. { return m_bType1FontDriverInstalled; }
  78. private: // Methods
  79. CFontManager();
  80. VOID ProcessRegKey( HKEY hk, BOOL bCheckDup );
  81. VOID ProcessT1RegKey( HKEY hk, BOOL bCheckDup );
  82. int GetSection( LPTSTR lpFile,
  83. LPTSTR lpSection,
  84. LPHANDLE hSection);
  85. HRESULT GetPanMapper( IPANOSEMapper ** ppMapper );
  86. CFontList * m_poFontList;
  87. CFontList * m_poTempList;
  88. IPANOSEMapper * m_poPanMap;
  89. BOOL m_bTriedOnce; // Set to true if an attempt has been made
  90. // to get at the pan mapper.
  91. BOOL m_bFamiliesNeverReset; // T = family reset never done yet.
  92. BOOL m_bType1FontDriverInstalled;
  93. CFontList * m_poRemoveList; // List of fonts being dragged out.
  94. NOTIFYWATCH m_Notify;
  95. HANDLE m_hNotifyThread;
  96. HANDLE m_hReconcileThread;
  97. HANDLE m_hResetFamThread;
  98. HANDLE m_hEventTerminateThreads;
  99. HANDLE m_hEventResetFamily;
  100. HANDLE m_hMutexResetFamily;
  101. HANDLE m_hMutexInstallation; // Prevent concurrent installation
  102. // by reconciliation and main threads.
  103. CRITICAL_SECTION m_cs;
  104. class HiddenFilesList : public StringTable
  105. {
  106. public:
  107. HiddenFilesList(void) { }
  108. ~HiddenFilesList(void) { }
  109. DWORD Initialize(void);
  110. } m_HiddenFontFilesList;
  111. friend DWORD dwResetFamilyFlags(LPVOID);
  112. friend DWORD dwNotifyWatchProc(LPVOID);
  113. friend DWORD dwReconcileThread(LPVOID);
  114. friend HRESULT GetOrReleaseFontManager(CFontManager **ppoFontManager, bool bGet);
  115. };
  116. //
  117. // Singleton instance management.
  118. //
  119. HRESULT GetFontManager(CFontManager **ppoFontManager);
  120. void ReleaseFontManager(CFontManager **poFontManager);
  121. #endif // __FONTMAN_H__