2 * @file DiffTextBuffer.h
4 * @brief Declaration of CDiffTextBuffer class
6 // ID line follows -- this is updated by SVN
9 #ifndef _DIFFTEXT_BUFFER_H_
10 #define _DIFFTEXT_BUFFER_H_
12 #include "GhostTextBuffer.h"
13 #include "FileTextEncoding.h"
19 * @brief Specialized buffer to save file data
21 class CDiffTextBuffer : public CGhostTextBuffer
23 friend class CMergeDoc;
26 CMergeDoc * m_pOwnerDoc; /**< Merge document owning this buffer. */
27 int m_nThisPane; /**< Left/Right side */
28 String m_strTempPath; /**< Temporary files folder. */
29 int m_unpackerSubcode; /**< Plugin information. */
32 * @brief Unicode encoding from ucr::UNICODESET.
34 * @note m_unicoding and m_codepage are indications of how the buffer is
35 * supposed to be saved on disk. In memory, it is invariant, depending on
37 * - ANSI: in memory it is CP_ACP/CP_THREAD_ACP 8-bit characters
38 * - Unicode: in memory it is wchars
40 FileTextEncoding m_encoding;
42 BOOL FlagIsSet(UINT line, DWORD flag);
45 CDiffTextBuffer(CMergeDoc * pDoc, int pane);
47 void SetTempPath(const String &path);
48 virtual void AddUndoRecord (BOOL bInsert, const CPoint & ptStartPos,
49 const CPoint & ptEndPos, LPCTSTR pszText, int cchText,
50 int nLinesToValidate, int nActionType = CE_ACTION_UNKNOWN,
51 CDWordArray *paSavedRevisonNumbers = NULL);
53 void ReplaceLine(CCrystalTextView * pSource, int nLine, LPCTSTR pchText,
54 int cchText, int nAction =CE_ACTION_UNKNOWN);
55 void ReplaceFullLine(CCrystalTextView * pSource, int nLine,
56 const CString& strText, int nAction = CE_ACTION_UNKNOWN);
58 int LoadFromFile(LPCTSTR pszFileName, PackingInfo * infoUnpacker,
59 LPCTSTR filteredFilenames, BOOL & readOnly, CRLFSTYLE nCrlfStyle,
60 const FileTextEncoding & encoding, CString &sError);
61 int SaveToFile (LPCTSTR pszFileName, BOOL bTempFile, String & sError,
62 PackingInfo * infoUnpacker = NULL, CRLFSTYLE nCrlfStyle = CRLF_STYLE_AUTOMATIC,
63 BOOL bClearModifiedFlag = TRUE );
64 ucr::UNICODESET getUnicoding() const { return m_encoding.m_unicoding; }
65 void setUnicoding(ucr::UNICODESET value) { m_encoding.m_unicoding = value; }
66 int getCodepage() const { return m_encoding.m_codepage; }
67 void setCodepage(int value) { m_encoding.m_codepage = value; }
68 const FileTextEncoding & getEncoding() const { return m_encoding; }
70 // If line has text (excluding eol), set strLine to text (excluding eol)
71 BOOL GetLine(int nLineIndex, CString &strLine);
73 // if line has any text (including eol), set strLine to text (including eol)
74 BOOL GetFullLine(int nLineIndex, CString &strLine);
76 virtual void SetModified (BOOL bModified = TRUE);
77 void prepareForRescan();
78 virtual void OnNotifyLineHasBeenEdited(int nLine);
79 bool IsInitialized() const;
82 #endif // _DIFFTEXT_BUFFER_H_