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.

125 lines
3.6 KiB

  1. #ifndef _VIEWSRC_
  2. #define _VIEWSRC_
  3. #include "richedit.h"
  4. #include "richole.h"
  5. interface IMimeMessage;
  6. HRESULT ViewSource(HWND hwndParent, IMimeMessage *pMsg);
  7. class CREMenu :
  8. public IRichEditOleCallback
  9. {
  10. public:
  11. CREMenu();
  12. ~CREMenu();
  13. // *** IUnknown methods ***
  14. HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, LPVOID FAR *);
  15. ULONG STDMETHODCALLTYPE AddRef();
  16. ULONG STDMETHODCALLTYPE Release();
  17. // *** IRichEditOleCallback methods ***
  18. HRESULT STDMETHODCALLTYPE GetNewStorage (LPSTORAGE FAR *);
  19. HRESULT STDMETHODCALLTYPE GetInPlaceContext(LPOLEINPLACEFRAME FAR *,LPOLEINPLACEUIWINDOW FAR *,LPOLEINPLACEFRAMEINFO);
  20. HRESULT STDMETHODCALLTYPE ShowContainerUI(BOOL);
  21. HRESULT STDMETHODCALLTYPE QueryInsertObject(LPCLSID, LPSTORAGE,LONG);
  22. HRESULT STDMETHODCALLTYPE DeleteObject(LPOLEOBJECT);
  23. HRESULT STDMETHODCALLTYPE QueryAcceptData( LPDATAOBJECT,CLIPFORMAT FAR *, DWORD,BOOL, HGLOBAL);
  24. HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL);
  25. HRESULT STDMETHODCALLTYPE GetClipboardData(CHARRANGE FAR *, DWORD,LPDATAOBJECT FAR *);
  26. HRESULT STDMETHODCALLTYPE GetDragDropEffect(BOOL, DWORD,LPDWORD);
  27. HRESULT STDMETHODCALLTYPE GetContextMenu(WORD, LPOLEOBJECT,CHARRANGE FAR *,HMENU FAR *);
  28. HRESULT Init(HWND hwndEdit, int idMenu);
  29. private:
  30. HWND m_hwndEdit;
  31. ULONG m_cRef;
  32. int m_idMenu;
  33. };
  34. class CMsgSource:
  35. public IOleCommandTarget
  36. {
  37. public:
  38. CMsgSource();
  39. ~CMsgSource();
  40. // IUnknown
  41. virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, LPVOID FAR *);
  42. virtual ULONG STDMETHODCALLTYPE AddRef();
  43. virtual ULONG STDMETHODCALLTYPE Release();
  44. // IOleCommandTarget
  45. virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *, ULONG, OLECMD prgCmds[], OLECMDTEXT *);
  46. virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *, DWORD, DWORD, VARIANTARG *, VARIANTARG *);
  47. HRESULT Init(HWND hwndParent, int id, IOleCommandTarget *pCmdTargetParent);
  48. HRESULT Show(BOOL fOn, BOOL fColor);
  49. HRESULT OnWMCommand(HWND hwnd, int id, WORD wCmd);
  50. HRESULT OnWMNotify(WPARAM wParam, NMHDR* pnmhdr, LRESULT *plRet);
  51. HRESULT Load(IStream *pstm);
  52. HRESULT Save(IStream **pstm);
  53. HRESULT SetRect(RECT *prc);
  54. HRESULT IsDirty();
  55. HRESULT SetDirty(BOOL fDirty);
  56. HRESULT OnTimer(WPARAM idTimer);
  57. HRESULT TranslateAccelerator(LPMSG lpmsg);
  58. HRESULT HasFocus();
  59. HRESULT SetFocus();
  60. private:
  61. ULONG m_cRef;
  62. HWND m_hwnd;
  63. BOOL m_fColor,
  64. m_fDisabled;
  65. LPSTR m_pszLastText;
  66. IOleCommandTarget *m_pCmdTargetParent;
  67. void OnChange();
  68. void HideSelection(BOOL fHide, BOOL fChangeStyle);
  69. void GetSel(CHARRANGE *pcr);
  70. void SetSel(int nStart, int nEnd);
  71. void GetSelectionCharFormat(CHARFORMAT *pcf);
  72. void SetSelectionCharFormat(CHARFORMAT *pcf);
  73. HRESULT _GetText(LPSTR *ppsz);
  74. };
  75. class CViewSource
  76. {
  77. public:
  78. CViewSource();
  79. ~CViewSource();
  80. ULONG STDMETHODCALLTYPE AddRef();
  81. ULONG STDMETHODCALLTYPE Release();
  82. HRESULT Init(HWND hwndParent, IMimeMessage *pMsg);
  83. HRESULT Show();
  84. static INT_PTR CALLBACK _ExtDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  85. private:
  86. HWND m_hwnd,
  87. m_hwndEdit;
  88. ULONG m_cRef;
  89. IMimeMessage *m_pMsg;
  90. HRESULT _BoldKids();
  91. INT_PTR _DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  92. };
  93. #endif //_VIEWSRC_