home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / compfrm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  9.4 KB  |  243 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. /* COMPFRM.H - header file for the ComposeFrame class. 
  20.  */
  21. #ifndef __COMPFRM_H
  22. #define __COMPFRM_H
  23.  
  24. #include "msgcom.h"
  25. #include "mainfrm.h"
  26. #include "edframe.h"
  27. #include "compmisc.h"
  28. #include "apiaddr.h"
  29. #include "statbar.h"
  30.  
  31. // Message used to synchronize setting the initial keyboard focus in the
  32. // compose window. This message is posted to the compose window by 
  33. // FE_CreateCompositionPane just before returning.
  34. #define WM_COMP_SET_INITIAL_FOCUS   WM_TOOLCONTROLLER + 1
  35.  
  36. #define ID_ENCRYPTED            1011
  37. #define ID_SIGNED               1012
  38.  
  39. // rhp - Flags for MAPI operations...
  40. #define MAPI_IGNORE             0
  41. #define MAPI_SEND               1
  42. #define MAPI_SAVE               2
  43.  
  44.  
  45. // Forward declarations
  46.  
  47. class CNSAddressList;           // address list widget
  48. class CEditToolBarController;   // HTML toolbar controlling object
  49. class CComposeBar;              // embedded address/attachment area
  50.  
  51. // CComposeFrame class declaration
  52.  
  53. class CComposeFrame : public CGenericFrame
  54. {
  55.     DECLARE_DYNCREATE(CComposeFrame)
  56.     
  57. protected:
  58.     CComposeFrame();                // protected constructor used by dynamic creation
  59.    ~CComposeFrame(); 
  60.  
  61.       MSG_Pane *m_pComposePane;       // Backend supplied pane context
  62.     CNetscapeStatusBar m_barStatus;
  63.     CComposeBar * m_pComposeBar;    // address/attachment block widget
  64.     BOOL m_bUseHtml;
  65.     BOOL m_bInitialized;
  66.     CEditToolBarController * m_pToolBarController;
  67.  
  68.     // these are used for plain text
  69.     CComposeEdit m_Editor;          // regular text editor - to be replaced by Gold editor
  70.     int32 m_quoteSel;                    // current plain text qutoing position 
  71.     CBlankWnd m_EditorParent;       // controls resizing the edit control (going away when Gold integrated)
  72.  
  73.     CWnd * m_pFocus;                // field which has focus in control
  74.     HFONT m_cfTextFont;             // font to use in the edit control
  75.     MSG_HEADER_SET m_SavedHeaders;  // hackery to redraw headers once we become visible and
  76.  
  77.     MWContext * m_pOldContext;
  78.     MSG_CompositionFields * m_pFields;
  79.      char *m_pInitialText;                   // initial text
  80.     BOOL m_bWrapLongLines;
  81.     int m_cxChar;
  82.  
  83.     int  m_bMAPISendMode;        // rhp - for MAPI Send Operations
  84.  
  85. public:
  86.     // data access functions 
  87.     inline int GetCharWidth() { return m_cxChar; }
  88.     inline BOOL GetWrapLongLines() { return m_bWrapLongLines; }
  89.     inline void SetComposeStuff(MWContext *pOld, MSG_CompositionFields * pFields)
  90.         { m_pOldContext = pOld; m_pFields = pFields; }
  91.     inline BOOL UseHtml(void)                       { return m_bUseHtml; }
  92.     inline CWnd * GetFocusField(void)               { return m_pFocus; }
  93.     inline void SetFocusField(CWnd * pwnd = NULL)   { m_pFocus = pwnd; }
  94.     inline MSG_Pane * GetMsgPane(void)              { return m_pComposePane; }
  95.     inline void SetToolBarController(CEditToolBarController * pController = NULL) {
  96.         m_pToolBarController = pController;
  97.      }    
  98.     inline CEditToolBarController * GetToolBarController(void) {
  99.         return m_pToolBarController;
  100.      }
  101.     inline CComposeEdit * GetEditor(void)           { return &m_Editor; }
  102.     inline int32 GetQuoteSel(void)                    { return m_quoteSel; }
  103.     inline void SetQuoteSel(int32 sel)                { m_quoteSel = sel; }
  104.     inline CBlankWnd * GetEditorParent(void)        { return &m_EditorParent; }
  105.     inline CComposeBar * GetComposeBar(void)        { return m_pComposeBar; }
  106.     inline void SetComposeBar(CComposeBar *pBar = NULL) { m_pComposeBar = pBar; }
  107.     inline void SetSavedHeaders(MSG_HEADER_SET headers) { m_SavedHeaders = headers; }
  108.     inline MSG_HEADER_SET GetSavedHeaders(void)     { return m_SavedHeaders; }
  109.     inline BOOL Initialized(void)                   { return m_bInitialized; }
  110.     
  111.     LPADDRESSCONTROL GetAddressWidgetInterface();
  112.     
  113.     // public interface
  114.     void SetQuoteSelection(void);
  115.     void SetMsgPane(MSG_Pane * pPane = NULL);
  116.     void SetModified(BOOL bvalue);
  117.     void CompleteComposeInitialization(void);       // gold specific stuff
  118.     void GoldDoneLoading(void);
  119.     void InsertInitialText(void);
  120.     void SetInitialText(const char *pText);
  121.     inline const char *GetInitialText() { return m_pInitialText; };
  122.     virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,
  123.        AFX_CMDHANDLERINFO* pHandlerInfo);
  124.  
  125. #ifdef XP_WIN32
  126.     virtual int16 GetTitleWinCSID();    // jliu
  127. #endif
  128.  
  129.     BOOL AppendAddress(MSG_HEADER_SET header, const char * value);
  130.     void SetType(MWContextType type);
  131.     void SetCSID(int16 iCSID);
  132.     void UpdateToolBar(void);
  133.     BOOL CreateEditBars();
  134.     void DisplayHeaders ( MSG_HEADER_SET );
  135.     CWnd * GetEditorWnd();
  136.     void UpdateAttachmentInfo(void);
  137.     void SetHtmlMode(BOOL bMode = FALSE);
  138.     void UpdateSecurityOptions(void);
  139.     BOOL BccOnly(void);
  140.     
  141.     virtual void RefreshNewEncoding(int16 doc_csid, BOOL bSave = TRUE);
  142.  
  143.     // rhp - For MAPI Operations!
  144.   inline void SetMAPISendMode(int bSendMode) { m_bMAPISendMode = bSendMode; };        // rhp - for MAPI
  145.   inline int  GetMAPISendMode(void) { return m_bMAPISendMode; }; // rhp - for MAPI
  146.   void        UpdateComposeWindowForMAPI(void);      // rhp - for MAPISendMail()
  147.  
  148.     // Overriden for setting the command help for editor plugin tools and edit history list
  149.     virtual void GetMessageString(UINT MenuID, CString& Message) const;  
  150.  
  151. protected:
  152.     virtual BOOL PreTranslateMessage( MSG* pMsg );
  153.     virtual BOOL PreCreateWindow ( CREATESTRUCT & );
  154.     virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext *pContext);
  155.     virtual BOOL CanCloseFrame(void);
  156.     
  157.     void OnUpdateThis ( CCmdUI* pCmdUI, MSG_CommandType tMenuType );
  158.     void MessageCommand( MSG_CommandType );
  159.     void ConvertToPlainText();
  160.     void ConvertToHtml();
  161.     void DoSend( BOOL bNow = TRUE );
  162.     int CreateHtmlToolbars();
  163.     void CreatePlainTextEditor();
  164.     void ShowHtmlToolbars();
  165.     void DestroyHtmlToolbars();
  166.     void SetEditorParent(CWnd*);
  167.     char * PromptMessageSubject();
  168.     void MakeComposeBarVisible();
  169.    
  170.     afx_msg void OnNew();
  171.     afx_msg void OnConvert();
  172.     afx_msg void OnAttachMyCard();
  173.     afx_msg void OnUpdateAttachMyCard(CCmdUI * pCmdUI);
  174.     afx_msg void OnUpdateConvert(CCmdUI*pCmdUI);
  175.     afx_msg void OnUpdateButtonGeneral(CCmdUI* pCmdUI);
  176.      afx_msg LONG OnToolController(UINT,LONG);
  177.     afx_msg void OnPasteQuote( void );
  178.     afx_msg void OnUpdatePasteQuote(CCmdUI *);
  179.     afx_msg void OnSelectAll(void);
  180.     afx_msg void OnUpdateSelectAll(CCmdUI *);
  181.     afx_msg void OnButtonTo(void);
  182.     afx_msg void OnQuoteOriginal ( void );
  183.     afx_msg void OnSaveAs( void );
  184.     afx_msg void OnSaveDraft(void);
  185.     afx_msg void OnSaveTemplate(void);
  186.     afx_msg void OnAttachFile(void);
  187.     afx_msg void OnCheckSpelling(void);
  188.     afx_msg void OnUpdateCheckSpelling(CCmdUI * pCmdUI);
  189.     afx_msg void OnDoneGoingOffline(void);
  190.     afx_msg void OnUpdateSaveDraft( CCmdUI * pCmdUI );
  191.     afx_msg void OnUpdateSaveTemplate( CCmdUI * pCmdUI );
  192.  
  193.     afx_msg void OnSend(void);
  194.     afx_msg void OnSendNow(void);
  195.     afx_msg void OnSendLater(void);
  196.     afx_msg void OnUpdateSend(CCmdUI * pCmdUI);
  197.     afx_msg void OnUpdateSendNow(CCmdUI * pCmdUI);
  198.     afx_msg void OnUpdateSendLater(CCmdUI * pCmdUI);
  199.     afx_msg void OnUpdateAttach ( CCmdUI * pCmdUI );
  200.     afx_msg void OnShowSecurityAdvisor ();
  201.     afx_msg void OnSetFocus(CWnd *);
  202.  
  203.     afx_msg int OnCreate ( LPCREATESTRUCT );
  204.     afx_msg void OnClose ( void );
  205.     afx_msg void OnDestroy(void);
  206.     afx_msg void OnAttachUrl(void);
  207.      afx_msg void OnSelectAddresses(void);
  208.     afx_msg void OnWrapLongLines(void);
  209.     afx_msg void OnUpdateWrapLongLines(CCmdUI*pCmdUI);
  210.  
  211.     afx_msg void OnViewAddresses();
  212.     afx_msg void OnViewAttachments();
  213.     afx_msg void OnViewOptions();
  214.     afx_msg void OnUpdateViewAddresses(CCmdUI * pCmdUI);
  215.     afx_msg void OnUpdateViewAttachments(CCmdUI * pCmdUI);
  216.     afx_msg void OnUpdateViewOptions(CCmdUI * pCmdUI);
  217.     
  218.     afx_msg void OnToggleMessageToolbar();
  219.     afx_msg void OnUpdateToggleMessageToolbar(CCmdUI *pCmdUI);
  220.     afx_msg void OnToggleAddressArea();
  221.     afx_msg void OnUpdateToggleAddressArea(CCmdUI * pCmdUI);
  222.     afx_msg void OnSecurity();
  223.  
  224.     afx_msg void OnAttachTab(void);
  225.     afx_msg void OnAddressTab(void);
  226.     afx_msg void OnOptionsTab(void);
  227.     afx_msg void OnCollapse(void);
  228.  
  229.     afx_msg void OnUpdateSecurity(CCmdUI *pCmdUI);
  230.     afx_msg void OnUpdateSecureStatus(CCmdUI *pCmdUI);
  231.     afx_msg LONG OnSetInitialFocus(WPARAM wParam, LPARAM lParam);
  232.     LRESULT OnButtonMenuOpen(WPARAM wParam, LPARAM lParam);
  233.  
  234.     afx_msg LRESULT OnFindReplace(WPARAM wParam, LPARAM lParam) ;
  235.      afx_msg LRESULT OnSetMessageString(WPARAM wParam, LPARAM lParam);
  236.  
  237.     DECLARE_MESSAGE_MAP()
  238.  
  239. };
  240.  
  241. /////////////////////////////////////////////////////////////////////////////
  242. #endif
  243.