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.

88 lines
3.1 KiB

  1. #ifndef _FONTCASH_H
  2. #define _FONTCASH_H
  3. #include "privunk.h"
  4. #include "mimeole.h"
  5. #include "msoert.h"
  6. #include <ocidl.h>
  7. typedef struct FONTCACHEENTRY_tag
  8. {
  9. UINT uiCodePage;
  10. TCHAR szFaceName[LF_FACESIZE];
  11. HFONT rgFonts[FNT_SYS_LAST];
  12. } FONTCACHEENTRY, *PFONTCACHEENTRY;
  13. // =================================================================================
  14. // Font Cache Definition
  15. // =================================================================================
  16. class CFontCache : public CPrivateUnknown,
  17. public IFontCache,
  18. public IConnectionPoint
  19. {
  20. private:
  21. HRESULT InitResources();
  22. HRESULT FreeResources();
  23. void SendPostChangeNotifications();
  24. void SendPreChangeNotifications();
  25. HRESULT InitSysFontEntry();
  26. HRESULT GetSysFont(FNTSYSTYPE fntType, HFONT *phFont);
  27. HRESULT SetGDIAndFaceNameInLF(UINT uiCodePage, CODEPAGEID cpID, LOGFONT *lpLF);
  28. HRESULT SetFaceNameFromCPID(UINT cpID, LPTSTR szFaceName, DWORD cchFaceName);
  29. HRESULT SetFaceNameFromGDI(BYTE bGDICharSet, LPTSTR szFaceName, DWORD cchFaceName);
  30. HRESULT SetFaceNameFromReg(UINT uiCodePage, LPTSTR szFaceName, DWORD cchFaceName);
  31. virtual HRESULT PrivateQueryInterface(REFIID riid, LPVOID * ppvObj);
  32. IUnknownList *m_pAdviseRegistry;
  33. IVoidPtrList *m_pFontEntries;
  34. FONTCACHEENTRY *m_pSysCacheEntry;
  35. HKEY m_hkey;
  36. TCHAR m_szIntlKeyPath[1024];
  37. CRITICAL_SECTION m_rFontCritSect,
  38. m_rAdviseCritSect;
  39. BOOL m_bISO_2022_JP_ESC_SIO_Control;
  40. UINT m_uiSystemCodePage;
  41. public:
  42. CFontCache(IUnknown *pUnkOuter=NULL);
  43. virtual ~CFontCache();
  44. // IUnknown members
  45. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj) {
  46. return CPrivateUnknown::QueryInterface(riid, ppvObj); };
  47. virtual STDMETHODIMP_(ULONG) AddRef(void) {
  48. return CPrivateUnknown::AddRef();};
  49. virtual STDMETHODIMP_(ULONG) Release(void) {
  50. return CPrivateUnknown::Release(); };
  51. // IFontCache functions
  52. virtual HRESULT STDMETHODCALLTYPE Init(HKEY hkey, LPCSTR pszIntlKey, DWORD dwFlags);
  53. virtual HRESULT STDMETHODCALLTYPE GetFont(
  54. FNTSYSTYPE fntType,
  55. HCHARSET hCharset,
  56. HFONT *phFont);
  57. virtual HRESULT STDMETHODCALLTYPE OnOptionChange();
  58. virtual HRESULT STDMETHODCALLTYPE GetJP_ISOControl(BOOL *pfUseSIO);
  59. // IConnectionPoint functions
  60. virtual HRESULT STDMETHODCALLTYPE GetConnectionInterface(IID *pIID);
  61. virtual HRESULT STDMETHODCALLTYPE GetConnectionPointContainer(
  62. IConnectionPointContainer **ppCPC);
  63. virtual HRESULT STDMETHODCALLTYPE Advise(IUnknown *pUnkSink, DWORD *pdwCookie);
  64. virtual HRESULT STDMETHODCALLTYPE Unadvise(DWORD dwCookie);
  65. virtual HRESULT STDMETHODCALLTYPE EnumConnections(IEnumConnections **ppEnum);
  66. static HRESULT CreateInstance(IUnknown* pUnkOuter, IUnknown** ppUnknown);
  67. };
  68. #endif