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.

314 lines
14 KiB

  1. #ifndef _NOTE_H_
  2. #define _NOTE_H_
  3. #include "imsgsite.h"
  4. #include "ibodyopt.h"
  5. #include "iheader.h"
  6. #include "statbar.h"
  7. #include "ibodyobj.h"
  8. #include "msgsite.h"
  9. #include "options.h"
  10. #include "acctutil.h"
  11. #include "dllmain.h"
  12. #include "tbbands.h"
  13. #include "msident.h"
  14. #include "storutil.h"
  15. enum NOTEINITSTATE
  16. {
  17. NIS_INIT = -1,
  18. NIS_NORMAL = 0,
  19. NIS_FIXFOCUS = 1
  20. };
  21. // As header, body and attman add additional items that should
  22. // be included in the tab order, these items might need to
  23. // be increased
  24. const int MAX_HEADER_COMP = 11;
  25. const int MAX_BODY_COMP = 1;
  26. const int MAX_ATTMAN_COMP = 1;
  27. class COEMsgSite;
  28. interface IBodyObj2;
  29. class CNote :
  30. public IOENote,
  31. public IBodyOptions,
  32. public IDropTarget,
  33. public IHeaderSite,
  34. public IPersistMime,
  35. public IServiceProvider,
  36. public IDockingWindowSite,
  37. public IMimeEditEventSink,
  38. public IIdentityChangeNotify,
  39. public IOleCommandTarget,
  40. public IStoreCallback,
  41. public ITimeoutCallback
  42. {
  43. public:
  44. CNote();
  45. ~CNote();
  46. // IUnknown
  47. virtual ULONG STDMETHODCALLTYPE AddRef();
  48. virtual ULONG STDMETHODCALLTYPE Release();
  49. virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, LPVOID FAR *);
  50. // IOENote
  51. virtual HRESULT STDMETHODCALLTYPE Init(DWORD action, DWORD dwCreateFlags, RECT *prc, HWND hwnd,
  52. INIT_MSGSITE_STRUCT *pInitStruct, IOEMsgSite *pMsgSite,
  53. IUnknown *punkPump);
  54. virtual HRESULT STDMETHODCALLTYPE Show(void);
  55. virtual HRESULT ToggleToolbar(void);
  56. // IBodyOptions
  57. virtual HRESULT STDMETHODCALLTYPE SignatureEnabled(BOOL fAuto);
  58. virtual HRESULT STDMETHODCALLTYPE GetSignature(LPCSTR szSigID, LPDWORD pdwSigOptions, BSTR *pbstr);
  59. virtual HRESULT STDMETHODCALLTYPE GetMarkAsReadTime(LPDWORD pdwSecs);
  60. virtual HRESULT STDMETHODCALLTYPE GetFlags(LPDWORD pdwFlags);
  61. virtual HRESULT STDMETHODCALLTYPE GetInfo(BODYOPTINFO *pBOI);
  62. virtual HRESULT STDMETHODCALLTYPE GetAccount(IImnAccount **ppAcct);
  63. // IHeaderSite
  64. virtual HRESULT STDMETHODCALLTYPE Resize(void);
  65. virtual HRESULT STDMETHODCALLTYPE Update(void);
  66. virtual HRESULT STDMETHODCALLTYPE OnUIActivate();
  67. virtual HRESULT STDMETHODCALLTYPE OnUIDeactivate(BOOL);
  68. virtual HRESULT STDMETHODCALLTYPE IsHTML(void);
  69. virtual HRESULT STDMETHODCALLTYPE SetHTML(BOOL);
  70. virtual HRESULT STDMETHODCALLTYPE SaveAttachment(void);
  71. virtual HRESULT STDMETHODCALLTYPE IsModal();
  72. virtual HRESULT STDMETHODCALLTYPE CheckCharsetConflict();
  73. virtual HRESULT STDMETHODCALLTYPE ChangeCharset(HCHARSET hCharset);
  74. virtual HRESULT STDMETHODCALLTYPE GetCharset(HCHARSET *phCharset);
  75. #ifdef SMIME_V3
  76. virtual HRESULT STDMETHODCALLTYPE GetLabelFromNote(PSMIME_SECURITY_LABEL *plabel);
  77. virtual HRESULT STDMETHODCALLTYPE IsSecReceiptRequest(void);
  78. virtual HRESULT STDMETHODCALLTYPE IsForceEncryption(void);
  79. #endif
  80. // IPersistMime
  81. virtual HRESULT STDMETHODCALLTYPE IsDirty(void);
  82. virtual HRESULT STDMETHODCALLTYPE Load(LPMIMEMESSAGE);
  83. virtual HRESULT STDMETHODCALLTYPE Save(LPMIMEMESSAGE, DWORD);
  84. virtual HRESULT STDMETHODCALLTYPE InitNew(void);
  85. virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClsID);
  86. // IDropTarget methods
  87. HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  88. HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  89. HRESULT STDMETHODCALLTYPE DragLeave(void);
  90. HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  91. // IServiceProvider
  92. HRESULT STDMETHODCALLTYPE QueryService(REFGUID rsid, REFIID riid, void **ppvObj);
  93. // IMimeEditEventSink
  94. HRESULT STDMETHODCALLTYPE EventOccurred(DWORD cmdID, IMimeMessage *pMessage);
  95. // IIdentityChangeNotify
  96. HRESULT STDMETHODCALLTYPE QuerySwitchIdentities();
  97. HRESULT STDMETHODCALLTYPE SwitchIdentities();
  98. HRESULT STDMETHODCALLTYPE IdentityInformationChanged(DWORD dwType);
  99. // IOleCommandTarget
  100. HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *, ULONG, OLECMD prgCmds[], OLECMDTEXT *);
  101. HRESULT STDMETHODCALLTYPE Exec(const GUID *, DWORD, DWORD, VARIANTARG *, VARIANTARG *);
  102. // IDockingWindowSite (also IOleWindow)
  103. HRESULT STDMETHODCALLTYPE GetBorderDW(IUnknown* punkSrc, LPRECT lprectBorder);
  104. HRESULT STDMETHODCALLTYPE RequestBorderSpaceDW(IUnknown* punkSrc, LPCBORDERWIDTHS pborderwidths);
  105. HRESULT STDMETHODCALLTYPE SetBorderSpaceDW(IUnknown* punkSrc, LPCBORDERWIDTHS pborderwidths);
  106. // IOleWindow methods
  107. HRESULT STDMETHODCALLTYPE GetWindow (HWND * lphwnd);
  108. HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode) {return E_NOTIMPL;};
  109. // IStoreCallback methods
  110. HRESULT STDMETHODCALLTYPE OnBegin(STOREOPERATIONTYPE tyOperation, STOREOPERATIONINFO *pOpInfo, IOperationCancel *pCancel);
  111. HRESULT STDMETHODCALLTYPE OnProgress(STOREOPERATIONTYPE tyOperation, DWORD dwCurrent, DWORD dwMax, LPCSTR pszStatus);
  112. HRESULT STDMETHODCALLTYPE OnTimeout(LPINETSERVER pServer, LPDWORD pdwTimeout, IXPTYPE ixpServerType);
  113. HRESULT STDMETHODCALLTYPE CanConnect(LPCSTR pszAccountId, DWORD dwFlags);
  114. HRESULT STDMETHODCALLTYPE OnLogonPrompt(LPINETSERVER pServer, IXPTYPE ixpServerType);
  115. HRESULT STDMETHODCALLTYPE OnComplete(STOREOPERATIONTYPE tyOperation, HRESULT hrComplete, LPSTOREOPERATIONINFO pOpInfo, LPSTOREERROR pErrorInfo);
  116. HRESULT STDMETHODCALLTYPE OnPrompt(HRESULT hrError, LPCTSTR pszText, LPCTSTR pszCaption, UINT uType, INT *piUserResponse);
  117. HRESULT STDMETHODCALLTYPE GetParentWindow(DWORD dwReserved, HWND *phwndParent);
  118. // ITimeoutCallback
  119. HRESULT STDMETHODCALLTYPE OnTimeoutResponse(TIMEOUTRESPONSE eResponse);
  120. HRESULT TranslateAccelerator(LPMSG lpmsg);
  121. static LRESULT EXPORT_16 CALLBACK ExtNoteWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  122. HRESULT IsMenuMessage(MSG *lpmsg);
  123. protected:
  124. BOOL IsFlagged(DWORD dwFlag = ARF_FLAGGED);
  125. BOOL FCanClose();
  126. BOOL IsReplyNote();
  127. BOOL DoProperties();
  128. BOOL WMCreate(HWND hwnd);
  129. void WMNCDestroy();
  130. void FormatSettings();
  131. void ToggleFormatbar();
  132. void ToggleStatusbar();
  133. void OnDocumentReady();
  134. void InitSendAndBccBtns();
  135. void DeferedLanguageMenu();
  136. void DisableSendNoteOnlyMenus();
  137. void WMSize(int, int, BOOL);
  138. void RemoveNewMailIcon(void);
  139. void SwitchLanguage(int idm);
  140. void SetProgressPct(INT iPct);
  141. void SetStatusText(LPSTR szBuf);
  142. void GetNoteMenu(HMENU *phmenu);
  143. void ShowErrorScreen(HRESULT hr);
  144. void WMGetMinMaxInfo(LPMINMAXINFO pmmi);
  145. void WMNotify(int idFrom, NMHDR *pnmhdr);
  146. void UpdateMsgOptions(LPMIMEMESSAGE pMsg);
  147. void ReloadMessageFromSite(BOOL fOriginal = FALSE);
  148. void ChangeReadToComposeIfUnsent(IMimeMessage *pMsg);
  149. void EnableNote(BOOL fEnable);
  150. HRESULT _SetPendingOp(STOREOPERATIONTYPE tyOperation);
  151. void _OnComplete(STOREOPERATIONTYPE tyOperation, HRESULT hrComplete) ;
  152. HRESULT InitBodyObj();
  153. HRESULT OnKillFocus();
  154. HRESULT UpdateTitle();
  155. HRESULT SaveMessage(DWORD dwSaveFlags);
  156. HRESULT SaveMessageAs();
  157. HRESULT ClearDirtyFlag();
  158. HRESULT CheckTabStopArrays();
  159. HRESULT CommitChangesInNote();
  160. HRESULT InitMenusAndToolbars();
  161. HRESULT SetComposeStationery();
  162. HRESULT HrSendMail(int idm);
  163. HRESULT OnSetFocus(HWND hwndFrom);
  164. HRESULT SetCharsetUnicodeIfNeeded(IMimeMessage *pMsg);
  165. HRESULT CycleThroughControls(BOOL fForward);
  166. HRESULT InitWindows(RECT *prc, HWND ownerHwnd);
  167. HRESULT WMCommand(HWND hwndCmd, int id, WORD wCmd);
  168. HRESULT MarkMessage(MARK_TYPE dwFlags, APPLYCHILDRENTYPE dwApplyType);
  169. HRESULT HeaderExecCommand(UINT uCmdID, DWORD nCmdExecOpt, VARIANTARG *pvaIn);
  170. LRESULT WMInitMenuPopup(HWND, HMENU, UINT);
  171. LRESULT OnDropDown(HWND hwnd, LPNMHDR lpnmh);
  172. LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  173. LRESULT OnInitMenuPopup(HWND hwnd, HMENU hmenuPopup, UINT uPos, UINT wID);
  174. LRESULT NoteDefWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  175. INT GetRequiredHdrHeight();
  176. HACCEL GetAcceleratorTable();
  177. int GetNextIndex(int index, BOOL fForward);
  178. LONG lTestHook(UINT uMsg, WPARAM wParam, LPARAM lParam);
  179. BYTE GetNoteType();
  180. void ResizeChildren(int cxNote, int cyNote, int cy, BOOL fInternal);
  181. void CheckAndForceEncryption(void);
  182. private:
  183. CStatusBar *m_pstatus;
  184. // Used to make sure that special pumps for note don't close while note is open.
  185. // This was initially for the finder.
  186. IUnknown *m_punkPump;
  187. IOEMsgSite *m_pMsgSite;
  188. IHeader *m_pHdr;
  189. IMimeMessage *m_pMsg;
  190. IPersistMime *m_pPrstMime;
  191. IBodyObj2 *m_pBodyObj2;
  192. IOleCommandTarget *m_pCmdTargetHdr,
  193. *m_pCmdTargetBody;
  194. IDropTarget *m_pDropTargetHdr,
  195. *m_pTridentDropTarget;
  196. IOperationCancel *m_pCancel;
  197. HTMLOPT m_rHtmlOpt;
  198. PLAINOPT m_rPlainOpt;
  199. MARK_TYPE m_dwCBMarkType;
  200. STOREOPERATIONTYPE m_OrigOperationType;
  201. HCHARSET m_hCharset;
  202. HBITMAP m_hbmBack;
  203. HICON m_hIcon;
  204. HCURSOR m_hCursor;
  205. HTIMEOUT m_hTimeout;
  206. LPACCTMENU m_pAcctMenu,
  207. m_pAcctLater;
  208. int m_cTabStopCount,
  209. m_iIndexOfBody;
  210. NOTEINITSTATE m_nisNoteState;
  211. CRITICAL_SECTION m_csNoteState;
  212. HMENU m_hmenuLanguage,
  213. m_hmenuAccounts,
  214. m_hmenuLater;
  215. ULONG m_cRef,
  216. m_ulPct,
  217. m_cAcctMenu,
  218. m_cAcctLater;
  219. DWORD m_dwNoteCreateFlags,
  220. m_dwNoteAction,
  221. m_dwMarkOnReplyForwardState,
  222. m_dwIdentCookie;
  223. HWND m_hwnd,
  224. m_pTabStopArray[MAX_HEADER_COMP+MAX_BODY_COMP+MAX_ATTMAN_COMP],
  225. m_hwndFocus,
  226. m_hwndOwner,
  227. m_hwndToolbar;
  228. BOOL m_fHtml :1, // Tells whether we are in html mode or not
  229. m_fMail :1, // This will be removed when the UI is combined
  230. m_fReadNote :1, // Is this a read note?
  231. m_fPackageImages :1, // Toggled per note. Use to be m_fSendImages
  232. m_fUseStationeryFonts :1, // Keep fonts that are in the stationary
  233. m_fToolbarVisible :1, // Is toolbar visible
  234. m_fStatusbarVisible :1, // Is status bar visible
  235. m_fFormatbarVisible :1, // Is the format bar visible
  236. m_fHeaderUIActive :1, // Are we currently active?
  237. m_fBypassDropTests :1, // Used to say drop not acceptable. Use to be m_fNoText
  238. m_fCompleteMsg :1, // Is true if message contains all of message
  239. m_fTabStopsSet :1, // Have the tab stops been set up???
  240. m_fBodyContainsFrames :1, // Was previously m_fReadOnlyBody
  241. m_fOriginallyWasRead :1, // Initial NoteAction was OENA_READ
  242. m_fCBDestroyWindow :1, // Destroy window after callback complete
  243. m_fCBCopy :1, // Used during callback complete to tell if copied or moved.
  244. m_fFlagged :1, // Is message flagged
  245. m_fFullHeaders :1, // Show full headers
  246. m_fWindowDisabled :1, // Is the window disabled?
  247. m_fProgress :1,
  248. m_fOrgCmdWasDelete :1, // Delete from callback wasn't originally a save or move/copy
  249. m_fCommitSave :1, // Used to say that when you save, you should call commit
  250. m_fOnDocReadyHandled :1, // Used in the OnDocumentReady function.
  251. m_fUseReplyHeaders :1, // Use reply headers
  252. m_fHasBeenSaved :1, // Is this a message that has been saved (ie ID_SAVE)
  253. m_fInternal :1, // used to enable/disable thread windows
  254. m_fSecurityLabel :1, // used for security labels
  255. m_fSecReceiptRequest :1, // used for security receipt request
  256. m_fPreventConflictDlg :1, // make sure we only show charset conflictdlg once per save
  257. m_fForceClose :1; // used when forcing a destory
  258. RECT m_rcRebar;
  259. CBands *m_pToolbarObj;
  260. HWND m_hwndRebar;
  261. HMENU m_hMenu;
  262. HWNDLIST m_hlDisabled;
  263. DWORD m_dwRequestMDNLocked;
  264. #ifdef SMIME_V3
  265. PSMIME_SECURITY_LABEL m_pLabel;
  266. #endif // SMIME_V3
  267. };
  268. BOOL Note_Init(BOOL);
  269. HRESULT CreateOENote(IUnknown *pUnkOuter, IUnknown **ppUnknown);
  270. HRESULT CreateAndShowNote(DWORD dwAction, DWORD dwCreateFlags, INIT_MSGSITE_STRUCT *pInitStruct,
  271. HWND hwnd = 0, IUnknown *punk = NULL, RECT *prc = NULL, IOEMsgSite *pMsgSite = NULL);
  272. void SetTlsGlobalActiveNote(CNote* pNote);
  273. CNote* GetTlsGlobalActiveNote(void);
  274. void InitTlsActiveNote();
  275. void DeInitTlsActiveNote();
  276. #endif