使用soui开发的mbc,只支持windows版本
w1146869587
2022-01-24 0408576e9da10015ffa9da0079b8c985113ce4b3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#pragma once
#include "SImRichEdit.h"
// SChatEditMsg command target
 
// #define EVT_CHATEDIT_KEYRETURN (EVT_EXTERNAL_BEGIN+500)
//    
//class EventChatEditKeyReturn : public TplEventArgs<EventChatEditKeyReturn>
//{
//    SOUI_CLASS_NAME(EventChatEditKeyReturn,L"on_chatedit_key_return")
//public:
//    EventChatEditKeyReturn(SObject *pSender):TplEventArgs<EventChatEditKeyReturn>(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);
 
    
};