使用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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#pragma once
#include "SImRichEdit.h"
// SChatEditLog command target
 
 
typedef struct tagSTKWaitImage
{
    SStringT        strMsgID;
    DWORD            dwWaitImageIndex;
    SStringT        strFileID;
    SStringT        strFileImage;
    SStringT        strImageExt;
    SStringT        strFileSFlag;
}stSTKWaitImage;
 
typedef enum
{
    e_TipsType_Info,
    e_TipsType_Error,
    e_TipsType_Ok,
    e_TipsType_Help,
    e_TipsType_NULL
}eTipsType;
 
typedef enum 
{
    e_CustomImage_Error,
    e_CustomImage_Wait,
} eCustomImageType;
 
typedef struct tagSTKReoData
{
    eCustomImageType customType;
    int        nInsertPos;
    DWORD    dwData;
    SStringT strFileName;        //ËùµÈ´ýµÄͼƬ
 
 
    tagSTKReoData()
    {
        customType = e_CustomImage_Wait;
        nInsertPos = -1;
        dwData = 0;
    }
 
}stSTKReoData;
 
 
typedef CMap<SStringT, LPCTSTR, stSTKWaitImage, stSTKWaitImage&> CMapSTKWaitImage;
typedef struct _stMBChatFile
{
    SStringT        strFileName;
    SStringT        strFilePath;
    SStringT        strFileID;
    SStringT        strFileSFlag;
    SStringT        strMsgFlag;
    __int64        nFileSize;
    _stMBChatFile(): nFileSize(0){};
}stMBChatFile;
 
typedef SArray<stMBChatFile>  SArrayChatFile;
typedef CMap<CString, LPCTSTR, stAttachInfo, stAttachInfo&> CMapAttachInfo;
 
class CChatUserInfo
   {
    public:
         CChatUserInfo() :
            Name(L""),
            Account(L""),
            AvatarId(L""),
            AvatarPath(L""),
            Title(L"")
        {
        }
        CChatUserInfo(LPCWSTR pName, LPCWSTR pAccount, LPCWSTR pAvatarId, LPCWSTR pAvatarPath, LPCWSTR pTitle,CHighTime &tTime) :
            Name(pName),
            Account(pAccount),
            AvatarId(pAvatarId),
            AvatarPath(pAvatarPath),
            Title(pTitle),
            tDateTime(tTime)
        {
        }
        CHighTime tDateTime;
        SStringT Name;
        SStringT Account;
        SStringT AvatarId;
        SStringT AvatarPath;
        SStringT Title;
    };
class AFX_EXT_CLASS SChatEditLog : public SImRichEdit
{
public:
    SOUI_CLASS_NAME(SChatEditLog,L"chateditlog")
public:
    SChatEditLog();
    virtual ~SChatEditLog();
public:
    SStringT            m_strChatTitle;
    SStringT            m_strTitleFormat;
    SStringT            m_strMyNick;
    vector<stSTKReoData*> m_vecReoData; 
    BOOL            m_bWaitingImage;
    CMapSTKWaitImage    m_mapWaitImage;
    CMBImageInfoArray  m_arImageInfo;  // Í¼Æ¬Êý¾Ý
    SWindow            *m_pButtonCopy; // ¸´Öư´Å¥
    SWindow            *m_pButtonSaveAs; // Áí´æÎª°´Å¥
    CString                    m_strSaveAsImage;
    BOOL                    m_bShowUserName;
public:
    void     SetMyNick( LPCTSTR strNick);//Setting the user name in IM
    void    SetShowUserName( BOOL bShowUserName);//Setting the user name in IM
    void    SetChatTitle( LPCTSTR strChatTitle);//Setting the user name in IM
    virtual SStringT GetImageFolder();
    virtual SStringT GetCustomImageFolder();
    void    WriteNewLine();
    static    BOOL LoadEmotions(LPCTSTR strFolder = NULL,LPCTSTR strExtrenFolder = NULL);
    void    AddFetchMoreBlock();
    void    AddSeparatorBar();
    UINT    AddCenterMessage(SStringT body, UINT insertTo = RECONTENT_LAST);
    UINT    AddCenterMessageWhitoutBuggle(const SStringT body, UINT insertTo = RECONTENT_LAST);
    UINT    AddLeftMessage(CChatUserInfo& info, const SStringT& msgid, const SStringT& body, UINT insertTo = RECONTENT_LAST);
    UINT    AddRightMessage(CChatUserInfo& info, const SStringT& msgid, const SStringT& body,const SStringT msgdata = _T(""),bool bMsgSending =false, UINT insertTo = RECONTENT_LAST);
    UINT    AddSendFileMessage(CChatUserInfo& info, SStringT &strFilePath,SStringT &strFileSFlag,SStringT &strSendFlag,SStringT &strChatId,__int64 nFileSize,const SStringT& msgdata, UINT insertTo = RECONTENT_LAST);
    UINT    AddShareFileMessage(CChatUserInfo& info, SStringT &strFileName,SStringT &strShareID,SStringT &strChatId,__int64 nFileSize, UINT insertTo = RECONTENT_LAST);
    void    AddCustomCenterMessageTip(const SStringT& body,eTipsType nTipsType = e_TipsType_Info);
    void    ClearLog();
    UINT    AddXMLMessage( CChatUserInfo& info, const SStringT& msgid, const SStringT& body,SStringT &strChatId, UINT insertTo = RECONTENT_LAST);
    SStringT GetSouiFormatText(const SStringT msgid,SStringT strContent ,SStringT strChatId);
    SStringT GungHoMsgToSouiFormat(const SStringT& msgid,SStringT strUrl,SStringT strContent ,SStringT &strChatId, SStringT strSubject);
    SStringT GetFileSouiFormatText(const SStringT& msgid,SArrayChatFile &arFile,SStringT &strChatId,SStringT strFrom,bool bSendMsg = true );
    SStringT GetShareFileSouiFormatText(const SStringT& msgid,SStringT &strFileName,SStringT &strFilePath,SStringT &strChatId,__int64 nFileSize );
    SStringT GetSouiCharFormat(IXMLDOMElementPtr ptrBody/*,CString strMainCharFormat =_T("")*/);
    SStringT GetAllContent();
    BOOL    ReplaceCustomImage( CString strFileID, eCustomImageType nType, LPCTSTR strWantedImage);
    BOOL    SetTransferSize(CString strSendFlag, CString strSendFileFlag, __int64 nSizeFile,__int64 nSzeTransfer);
    BOOL    StartTransferFile(CString strSendFlag, CString strSendFileFlag,long nTrID);
    BOOL    SetTransferSpeed(CString strSendFlag, CString strSendFileFlag,CString strSpeed);
    BOOL    SetTransferFinsish(CString strSendFlag, CString strSendFileFlag,  CString strFileID);
    BOOL    SetDownloadFinsish(CString strSendFlag, CString strSendFileFlag,  CString strFilePath);
    BOOL    CancelFileTransfer(CString strSendFlag, CString strSendFileFlag);
    BOOL    SetTransferFailed(CString strSendFlag, CString strSendFileFlag,CString strErrorInfo = _T(""));
    BOOL    SendMsgFailed(CString strSendFlag,CString strErrorInfo = _T(""));
    BOOL    ResendMsg(CString strSendFlag );
    BOOL    SendMsgSuccess(CString strSendFlag,CString strMsgID   );
    BOOL    CheckTransferFileCancel(CString strSendFlag, CString strSendFileFlag);
    BOOL    SetTransferFileContinue(CString strSendFlag, CString strSendFileFlag);
    BOOL    SetSendMsgSuccess(CString strSendFlag, CString strMsgID,CString strState = _T(""));
    BOOL    SetTransferFileDeleted(CString strSendFlag, CString strSendFileFlag,CString strTipInfo = _T(""));
    SStringT GetSOUIContent(SStringT strSendFlag);
    SStringT TransferFormatText(SArrayChatFile &arFileInfo,SStringT strSouiText,SStringT &strMsgData);
 
    BOOL    CheckMsgIsLoad(CString strMsgID);
    float    GetFontSize( int nFontHeight);
    void    ParseImageInfo(CString strMsg, UINT insertTo=RECONTENT_LAST);
    void    GetImageArrayWithCurIndex(CMBImageInfoArray &  arImage,int &nCurIndex,CString strKey);
    void    AppendRTF(CString strRTF); 
public:
     virtual UINT OnGetDlgCode();
      virtual SStringW        GetSelectedContent(CHARRANGE* lpchrg/*=NULL*/);
protected:
    void        ClearReoVector();
    BOOL        IsReoIndexValid( int nIndex);
    SStringT    GetSysFaceShortCut(int nIndex);
    int            GetSysFaceIndex(CString    strShortCut);
    SStringT    GetSysFaceDesc(SStringT    strShortCut);
    SStringT    GetSysFacePath(int nIndex);
    BOOL        CheckMsgIsOneFileOrImage(CString strMsg);
    BOOL        GetLineRect(int nLineNo, SOUI::CRect& rcLine);
protected:
    SOUI_MSG_MAP_BEGIN()
    MSG_WM_LBUTTONDOWN(OnLButtonDown)
    MSG_WM_LBUTTONDBLCLK(OnLButtonDblClick)
    MSG_WM_MOUSEMOVE(OnMouseMove)
    //MSG_WM_MOUSELEAVE(OnMouseLeave)
    SOUI_MSG_MAP_END()
     void        OnLButtonDown(UINT nFlags, SOUI::CPoint point);
     void       OnLButtonDblClick(UINT nFlags, SOUI::CPoint point);
     void        OnMouseMove(UINT nFlags, SOUI::CPoint point);
    // void        OnMouseLeave();
private:
    SStringT    GetSelectedText(CHARRANGE* lpchrg/*=NULL*/, bool bIsFirst, bool bIsLast);
    SStringT    GetOneMsgSelectedContent(CHARRANGE* lpchrg/*=NULL*/);
    BOOL        CheckCharFormatFontSame(CHARFORMAT  &cfCharFormat,CHARFORMAT  &cfCharFormat2);
    void        GetCharFormatFont(CHARFORMAT  &cfCharFormat,CString& strFontName,COLORREF &clrTextColor,int& nFontSize,BOOL &bFontBold,BOOL &bFontUnderline,BOOL &bFontItalic);
    SStringT    GetMsgContent(int nIndex);
    SStringT    GetMsgText(int nIndex);
    SStringT    GetGungHoMsgType(int nMsgType);
    SStringT    GetFormatFontText(CString strFontName = _T("΢ÈíÑźÚ"),COLORREF clrTextColor=0,int nFontSize = 10,BOOL bFontBold = FALSE,BOOL bFontUnderline= FALSE,BOOL bFontItalic= FALSE);
    SStringT    GetFormatTextBody(SStringT strText,SStringT strCharFormat);
};