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.

180 lines
5.3 KiB

  1. // wordpad.h : main header file for the WORDPAD application
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1995 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12. #ifndef __AFXWIN_H__
  13. #error include 'stdafx.h' before including this file for PCH
  14. #endif
  15. #include "resource.h" // main symbols
  16. #include "options.h"
  17. #include "afxtempl.h"
  18. #include "msctf.h"
  19. #define WPM_BARSTATE WM_USER
  20. #define WORDPAD_HELP_FILE TEXT("WORDPAD.HLP")
  21. // If MFC ever compiles with WINVER >= 0x500 then this cruft should be removed.
  22. #ifndef WS_EX_LAYOUTRTL
  23. #define WS_EX_LAYOUTRTL 0x400000
  24. #endif // WS_EX_LAYOUTRTL
  25. // Free with delete[]
  26. LPSTR WideToAnsiNewArray(LPCWSTR pwsz);
  27. LPWSTR AnsiToWideNewArray(LPCSTR psz);
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CWordPadApp:
  30. // See wordpad.cpp for the implementation of this class
  31. //
  32. class CWordPadCommandLineInfo : public CCommandLineInfo
  33. {
  34. public:
  35. CWordPadCommandLineInfo() {m_bForceTextMode = FALSE;}
  36. BOOL m_bForceTextMode;
  37. virtual void ParseParam(const char* pszParam,BOOL bFlag,BOOL bLast);
  38. };
  39. class CWordPadApp : public CWinApp
  40. {
  41. private:
  42. enum InitializationPhase
  43. {
  44. InitializationPending = 0,
  45. InitializingPrinter = 1,
  46. UpdatingPrinterRelatedUI = 2,
  47. UpdatingRegistry = 3,
  48. InitializationComplete = 99
  49. };
  50. public:
  51. CWordPadApp();
  52. ~CWordPadApp();
  53. //Attributes
  54. CWordPadCommandLineInfo cmdInfo;
  55. CDC m_dcScreen;
  56. LOGFONT m_lf;
  57. int m_nDefFont;
  58. static int m_nOpenMsg;
  59. static int m_nPrinterChangedMsg;
  60. static int m_nOLEHelpMsg;
  61. CRect m_rectPageMargin;
  62. CRect m_rectInitialFrame;
  63. BOOL m_bMaximized;
  64. BOOL m_bPromptForType;
  65. BOOL m_bWin4;
  66. #ifndef _UNICODE
  67. BOOL m_bWin31;
  68. #endif
  69. BOOL m_bLargeIcons;
  70. BOOL m_bForceTextMode;
  71. BOOL m_bWordSel;
  72. BOOL m_bForceOEM;
  73. BOOL m_always_convert_to_rtf;
  74. int m_nFilterIndex;
  75. int m_nNewDocType;
  76. CDocOptions m_optionsText;
  77. CDocOptions m_optionsRTF;
  78. CDocOptions m_optionsWord; //wrap to ruler
  79. CDocOptions m_optionsWrite; //wrap to ruler
  80. CDocOptions m_optionsIP; //wrap to ruler
  81. CDocOptions m_optionsNull;
  82. CList<HWND, HWND> m_listPrinterNotify;
  83. BOOL IsDocOpen(LPCTSTR lpszFileName);
  84. // Get
  85. int GetUnits() {return m_nUnits;}
  86. int GetTPU() { return GetTPU(m_nUnits);}
  87. int GetTPU(int n) { return m_units[n].m_nTPU;}
  88. LPCTSTR GetAbbrev() { return m_units[m_nUnits].m_strAbbrev;}
  89. LPCTSTR GetAbbrev(int n) { return m_units[n].m_strAbbrev;}
  90. const CUnit& GetUnit() {return m_units[m_nUnits];}
  91. CDockState& GetDockState(int nDocType, BOOL bPrimary = TRUE);
  92. CDocOptions& GetDocOptions(int nDocType);
  93. CDocOptions& GetDocOptions() {return GetDocOptions(m_nNewDocType);}
  94. BOOL ShouldAlwaysConvertToRTF() {return m_always_convert_to_rtf;}
  95. // Set
  96. void SetUnits(int n);
  97. void SetAlwaysConvertToRTF() {m_always_convert_to_rtf = TRUE;}
  98. // Operations
  99. void RegisterFormats();
  100. static BOOL CALLBACK StaticEnumProc(HWND hWnd, LPARAM lParam);
  101. void UpdateRegistry();
  102. void NotifyPrinterChanged(BOOL bUpdatePrinterSelection = FALSE);
  103. BOOL PromptForFileName(CString& fileName, UINT nIDSTitle, DWORD dwFlags,
  104. BOOL bOpenFileDialog, int* pType = NULL);
  105. BOOL ParseMeasurement(TCHAR* buf, int& lVal);
  106. void PrintTwips(WCHAR* buf, int cchBuf, int nValue, int nDecimal);
  107. void SaveOptions();
  108. void LoadOptions();
  109. void LoadAbbrevStrings();
  110. HGLOBAL CreateDevNames();
  111. void EnsurePrinterIsInitialized();
  112. HGLOBAL GetDevNames(void)
  113. {
  114. return m_hDevNames ;
  115. }
  116. // Overrides
  117. BOOL IsIdleMessage(MSG* pMsg);
  118. // ClassWizard generated virtual function overrides
  119. //{{AFX_VIRTUAL(CWordPadApp)
  120. public:
  121. virtual BOOL InitInstance();
  122. virtual int ExitInstance();
  123. virtual BOOL OnDDECommand(LPTSTR lpszCommand);
  124. virtual void WinHelp(DWORD dwData, UINT nCmd = HELP_CONTEXT);
  125. virtual BOOL PreTranslateMessage(MSG* pMsg);
  126. //}}AFX_VIRTUAL
  127. // Implementation
  128. COleTemplateServer m_server;
  129. // Server object for document creation
  130. //{{AFX_MSG(CWordPadApp)
  131. afx_msg void OnAppAbout();
  132. afx_msg void OnFileNew();
  133. afx_msg void OnFileOpen();
  134. //}}AFX_MSG
  135. DECLARE_MESSAGE_MAP()
  136. private:
  137. int m_nUnits;
  138. static const int m_nPrimaryNumUnits;
  139. static const int m_nNumUnits;
  140. static CUnit m_units[];
  141. // Initialization
  142. volatile InitializationPhase m_initialization_phase;
  143. CWinThread * m_pInitializationThread;
  144. // Cicero process atoms
  145. ATOM m_atomEnableCTF;
  146. ATOM m_atomProcessCTF;
  147. static UINT AFX_CDECL DoDeferredInitialization(LPVOID pvWordPadApp);
  148. };
  149. /////////////////////////////////////////////////////////////////////////////
  150. extern CWordPadApp theApp;
  151. //inline CWordPadApp* GetWordPadApp() {return (CWordPadApp*)AfxGetApp();}