#pragma once #include "SImRichEdit.h" // SChatEditMsg command target // #define EVT_CHATEDIT_KEYRETURN (EVT_EXTERNAL_BEGIN+500) // //class EventChatEditKeyReturn : public TplEventArgs //{ // SOUI_CLASS_NAME(EventChatEditKeyReturn,L"on_chatedit_key_return") //public: // EventChatEditKeyReturn(SObject *pSender):TplEventArgs(pSender),bCancel(false){} // enum {EventID=EVT_CHATEDIT_KEYRETURN}; // bool bCancel; //}; class AFX_EXT_CLASS SChatEditMsg : public SImRichEdit { public: SOUI_CLASS_NAME(SChatEdit,L"chateditmsg") public: SChatEditMsg(); virtual ~SChatEditMsg(); public: SStringT m_strMyNick; private: CHARFORMAT m_cfTextCharFormat; SStringT m_strTextCharFormatTime; public: void OnInit(); void InitDefaultCharFormat(CHARFORMAT * pcf) ; virtual SStringT GetImageFolder(); virtual SStringT GetCustomImageFolder(); static SStringT GetImageFolder( SStringT strLoginName); void SetMyNick( SStringT strNick); BOOL ReadConfig(bool bFirstRead = true); BOOL WriteConfig(); static BOOL LoadEmotions(LPCTSTR strFolder = NULL,LPCTSTR strExtrenFolder = NULL); SStringT GetFormatText(CStringArray &arFile,SStringT strSouiText); SStringT GetFormatTextBody(SStringT strText,SStringT strCharFormat); BOOL InsertSysFace( int nIndex); SStringT GetFormatFontText(CString strFontName = _T("΢ÈíÑźÚ"),COLORREF clrTextColor=0,int nFontSize = 10,BOOL bFontBold = FALSE,BOOL bFontUnderline= FALSE,BOOL bFontItalic= FALSE); SStringT GetSOUIFormatText(CString strFileFlag,SStringT strChatId,bool bClear); void InsertImage(SStringT strFile,SStringT strImgType,SStringT strFaceID = L"" ); void InsertFile(SStringT strFile ); void InsertSOUIText(CString strSOUIText ); void InsertText(CString strText ); int GetFontHeight( float nFontSize); float GetFontSize( int nFontHeight); static CString GetSubjectFromFormatText( CString strFormatText); static CString GetTextContent( CString strFormatText); virtual SStringW GetSelectedContent(CHARRANGE* lpchrg/*=NULL*/); void GetCharFormatFont(CHARFORMAT &cfCharFormat,CString& strFontName,COLORREF &clrTextColor,int& nFontSize,BOOL &bFontBold,BOOL &bFontUnderline,BOOL &bFontItalic); BOOL CheckCharFormatFontSame(CHARFORMAT &cfCharFormat,CHARFORMAT &cfCharFormat2); BOOL GetTextCharFormat(CHARFORMAT& cf); BOOL SetTextCharFormat(CHARFORMAT& cf); void ReplaceTextCharFormat(CHARFORMAT& cf); void GetFiles(CMapStringToString &mapFile); SStringT GetSouiFormatText(SStringT strContent); SStringT GetSysFacePath(int nIndex); public: virtual UINT OnGetDlgCode(); private: SStringT GetSysFaceShortCut(int nIndex); int GetSysFaceIndex(CString strShortCut); SStringT GetSelectedText(CHARRANGE* lpchrg/*=NULL*/, bool bIsFirst, bool bIsLast); SStringT GetSouiCharFormat(IXMLDOMElementPtr ptrBody); };