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. */
30 bool m_bMixedEOL; /**< EOL style of this buffer is mixed? */
33 * @brief Unicode encoding from ucr::UNICODESET.
35 * @note m_unicoding and m_codepage are indications of how the buffer is
36 * supposed to be saved on disk. In memory, it is invariant, depending on
38 * - ANSI: in memory it is CP_ACP/CP_THREAD_ACP 8-bit characters
39 * - Unicode: in memory it is wchars
41 FileTextEncoding m_encoding;
43 BOOL FlagIsSet(UINT line, DWORD flag) const;
46 CDiffTextBuffer(CMergeDoc * pDoc, int pane);
48 void SetTempPath(const String &path);
49 virtual void AddUndoRecord (BOOL bInsert, const CPoint & ptStartPos,
50 const CPoint & ptEndPos, LPCTSTR pszText, int cchText,
51 int nLinesToValidate, int nActionType = CE_ACTION_UNKNOWN,
52 CDWordArray *paSavedRevisonNumbers = NULL);
54 void ReplaceLine(CCrystalTextView * pSource, int nLine, LPCTSTR pchText,
55 int cchText, int nAction =CE_ACTION_UNKNOWN);
56 void ReplaceFullLine(CCrystalTextView * pSource, int nLine,
57 const CString& strText, int nAction = CE_ACTION_UNKNOWN);
59 int LoadFromFile(LPCTSTR pszFileName, PackingInfo * infoUnpacker,
60 LPCTSTR filteredFilenames, BOOL & readOnly, CRLFSTYLE nCrlfStyle,
61 const FileTextEncoding & encoding, CString &sError);
62 int SaveToFile (LPCTSTR pszFileName, BOOL bTempFile, String & sError,
63 PackingInfo * infoUnpacker = NULL, CRLFSTYLE nCrlfStyle = CRLF_STYLE_AUTOMATIC,
64 BOOL bClearModifiedFlag = TRUE );
65 ucr::UNICODESET getUnicoding() const { return m_encoding.m_unicoding; }
66 void setUnicoding(ucr::UNICODESET value) { m_encoding.m_unicoding = value; }
67 int getCodepage() const { return m_encoding.m_codepage; }
68 void setCodepage(int value) { m_encoding.m_codepage = value; }
69 const FileTextEncoding & getEncoding() const { return m_encoding; }
70 bool IsMixedEOL() const { return m_bMixedEOL; }
71 void SetMixedEOL(bool bMixed) { m_bMixedEOL = bMixed; }
73 // If line has text (excluding eol), set strLine to text (excluding eol)
74 BOOL GetLine(int nLineIndex, CString &strLine) const;
76 // if line has any text (including eol), set strLine to text (including eol)
77 BOOL GetFullLine(int nLineIndex, CString &strLine) const;
79 virtual void SetModified (BOOL bModified = TRUE);
80 void prepareForRescan();
81 virtual void OnNotifyLineHasBeenEdited(int nLine);
82 bool IsInitialized() const;
85 #endif // _DIFFTEXT_BUFFER_H_