RichEditCtrlEx.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #if !defined(AFX_AUTORICHEDITCTRL_H__C26D1E0E_DD32_11D2_B39F_000092914562__INCLUDED_)
  2. #define AFX_AUTORICHEDITCTRL_H__C26D1E0E_DD32_11D2_B39F_000092914562__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // AutoRichEditCtrl.h : header file
  7. //
  8. /////////////////////////////////////////////////////////////////////////////
  9. // CRichEditCtrlEx window
  10. BOOL PASCAL AfxInitRichEditEx();
  11. class _AFX_RICHEDITEX_STATE
  12. {
  13. public:
  14. _AFX_RICHEDITEX_STATE()
  15. {
  16. m_hInstRichEdit20 = NULL;
  17. }
  18. virtual ~_AFX_RICHEDITEX_STATE()
  19. {
  20. if(m_hInstRichEdit20 != NULL)
  21. {
  22. ::FreeLibrary(m_hInstRichEdit20);
  23. }
  24. }
  25. HINSTANCE m_hInstRichEdit20;
  26. };
  27. class CRichEditCtrlEx : public CRichEditCtrl
  28. {
  29. // Construction
  30. public:
  31. CRichEditCtrlEx();
  32. // Attributes
  33. public:
  34. // Operations
  35. public:
  36. // Overrides
  37. // ClassWizard generated virtual function overrides
  38. //{{AFX_VIRTUAL(CRichEditCtrlEx)
  39. public:
  40. virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
  41. //}}AFX_VIRTUAL
  42. // Implementation
  43. public:
  44. long GetSelectionFontSize();
  45. CString GetSelectionFontName();
  46. CStringArray m_saFontList;
  47. void GetSystemFonts(CStringArray &saFontList);
  48. void SetFontSize(int nPointSize);
  49. void SetFontName(CString sFontName);
  50. void SelectColor();
  51. bool ParagraphIsBulleted();
  52. void SetParagraphBulleted();
  53. PARAFORMAT GetParagraphFormat();
  54. bool ParagraphIsRight();
  55. bool ParagraphIsLeft();
  56. bool ParagraphIsCentered();
  57. void SetParagraphRight();
  58. void SetParagraphLeft();
  59. void SetParagraphCenter();
  60. CHARFORMAT GetCharFormat(DWORD dwMask = CFM_COLOR | CFM_FACE | CFM_SIZE | CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE);
  61. bool SelectionIsBold();
  62. bool SelectionIsItalic();
  63. bool SelectionIsUnderlined();
  64. void SetSelectionBold();
  65. void SetSelectionItalic();
  66. void SetSelectionUnderlined();
  67. void SetRTF(CStringA sRTF);
  68. void SetRTF(const char *pRTF);
  69. CString GetRTF();
  70. void SetText(CString sText);
  71. CString GetText();
  72. virtual ~CRichEditCtrlEx();
  73. // Generated message map functions
  74. protected:
  75. //{{AFX_MSG(CRichEditCtrlEx)
  76. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  77. //}}AFX_MSG
  78. DECLARE_MESSAGE_MAP()
  79. private:
  80. void SetCharStyle(int MASK, int STYLE, int nStart, int nEnd);
  81. static DWORD CALLBACK CBStreamIn(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb);
  82. static DWORD CALLBACK CBStreamOut(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG* pcb);
  83. static BOOL CALLBACK CBEnumFonts(LPLOGFONT lplf, LPTEXTMETRIC lptm, DWORD dwType, LPARAM lpData);
  84. };
  85. /////////////////////////////////////////////////////////////////////////////
  86. //{{AFX_INSERT_LOCATION}}
  87. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  88. #endif // !defined(AFX_AUTORICHEDITCTRL_H__C26D1E0E_DD32_11D2_B39F_000092914562__INCLUDED_)