// RichEditBuffer.cpp : _xZkqqHx_iDeDiDjDiDhGiDiKiDiBiDjDiDgFiBfLiDfGiDiHiDjD_xHqqkZx_ _xZkqqHx_iDhEiDeAiDeDiDiL_xHqqkZx_
//

#include "stdafx.h"
#include "DynamicDraw.h"	// For FFGetApp().
#include "UtilStr.h"		// For GetWChar.
#include "TextOut.h"		// For FFCopy.etc.
#include "UtilFile.h"		// For BYTEVector <<.
#include "UtilVersion.h"	// For FCHeaderInf.
#include "UtilErr.h"		// For FFThrowFileException.
#include "UtilWin.h"		// For FFSetWindowText.
#include "UtilMisc.h"		// For FFLoadLibrary.etc.
#include "RegData.h"		// For GetSpecAppName.
#include "DynamicDrawView.h"	// For g_pView.
#include "RichEditBuffer.h"	// This header.

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#define FDRB_WCH_LINEINFO	0x0001
#define FDRB_WCH_FONTINFO	0x0002


//----- 02.06.26 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
//----- Platform SDK _xZkqqHx_iCoGiCoI_xHqqkZx_ -----
#define CP_WINANSI      1004    // default codepage for windows & old DDE convs.
#define CP_WINUNICODE   1200

#define EM_SETTEXTEX			(WM_USER + 97)

// Flags for the SETEXTEX data structure.
#define ST_DEFAULT		0
#define ST_KEEPUNDO		1
#define ST_SELECTION	2

// EM_SETTEXTEX info; this struct is passed in the wparam of the message.
typedef struct _settextex
{
	DWORD	flags;			// flags (see the ST_XXX defines
	UINT	codepage;		// code page for translation (CP_ACP for sys default;
							// 1200 for Unicode, -1 for control default_xZkqqHx_iBeC_xHqqkZx_
} SETTEXTEX;
//------------------------------
//----- 02.06.26 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----

////////////////////////////////////////////////////////////////////////////
// FCRichTextBuffer

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichTextBuffer::FCRichTextBuffer
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDfCiDjDiDfIiDgHiDiJiDeOiDfOiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
FCRichTextBuffer::FCRichTextBuffer ()
{
	CRect rect(-100, -100, -90, -90);
//----- 02.06.26 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
//	m_hmdlRich1_0 = NULL;
//	m_hmdlRich2_0 = NULL;
//----- 02.06.26 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
	m_hmdlRichEdit = NULL;
	m_nVersion = 0;
//----- 02.06.26 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
	m_hwndRichEdit = NULL;

//----- 02.06.26 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
//// 01.07.05 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
////	if ((m_hmdlRich2_0 = ::LoadLibrary(_T("RICHED20.DLL"))) != NULL)
//	if ((m_hmdlRich2_0 = ::LoadLibrary(_T("RICHED20.DLL"))) > (HINSTANCE)HINSTANCE_ERROR)
//	{
//#if defined(_MBCS)
//		m_hwndRichEdit = ::CreateWindowEx(0, RICHEDIT_CLASSA,
//				NULL, WS_CHILD|ES_MULTILINE, -100, -100, 10, 10,
//				g_pView->GetSafeHwnd(), HMENU(2000), FFGetApp()->GetResourceInstance(), NULL);
//#elif defined(_UNICODE)
//		m_hwndRichEdit = ::CreateWindowEx(0, RICHEDIT_CLASSW,
//				NULL, WS_CHILD|ES_MULTILINE, -100, -100, 10, 10,
//				g_pView->GetSafeHwnd(), HMENU(2000), FFGetApp()->GetResourceInstance(), NULL);
//#endif//_UNICODE
//	} else
//// 01.07.05 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
////	if ((m_hmdlRich1_0 = ::LoadLibrary(_T("RICHED32.DLL"))) != NULL)
//	if ((m_hmdlRich1_0 = ::LoadLibrary(_T("RICHED32.DLL"))) > (HINSTANCE)HINSTANCE_ERROR)
//	{
//		m_hwndRichEdit = ::CreateWindowEx(0, _T("RICHEDIT"),
//				NULL, WS_CHILD|ES_MULTILINE, -100, -100, 10, 10,
//				g_pView->GetSafeHwnd(), HMENU(2000), FFGetApp()->GetResourceInstance(), NULL);
//	}
//	if (m_hwndRichEdit == NULL)
//		FFThrowFileException(CFileException::fileNotFound, -1, L"RICHED32.DLL");
//// 01.04.16 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
////	m_richEditCtrl.Create(WS_CHILD|ES_MULTILINE, rect, g_pView, 2000);
//----- 02.06.26 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----

	if (FFVersionInfo().dwPlatformId == VER_PLATFORM_WIN32_NT ||
		(FFVersionInfo().dwPlatformId == VER_PLATFORM_WIN32_WINDOWS &&
		 FFVersionInfo().dwMinorVersion == 90))
	//----- NT_xZkqqHx_iMgOiBeBiIlNiCkCiCmN_xHqqkZx_ 95_xZkqqHx_iMgO_xHqqkZx_Me _xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
	{
		// RichEdit_xZkqqHx_iCmMiDgPiBfLiDfHiDiHiDjDiCkK_xHqqkZx_2.0_xZkqqHx_iImIiPoDiCmFiCoAiBeB_xHqqkZx_Win95_xZkqqHx_iBeB_xHqqkZx_Win98_xZkqqHx_iCmFiCmN_xHqqkZx_UNICODE_xZkqqHx_iCkKiIlFiCkGiCmIiCkJiCmBiClNiBeC_xHqqkZx_
		// WinMe_xZkqqHx_iCmMiCnNiIlFiCkGiClNiBeCiClBiCmMiClNiCnPiBeB_xHqqkZx_NT_xZkqqHx_iMgOiCmG_xHqqkZx_Me_xZkqqHx_iCmJiMmAjCoIiClHiCoJiBeC_xHqqkZx_
	
		// RichEdit2.0_xZkqqHx_iCmM_xHqqkZx_DLL_xZkqqHx_iCpAiDiNiBfLiDgIiClHiCoJiBeC_xHqqkZx_
		m_hmdlRichEdit = FFLoadLibrary(L"RICHED20.DLL");
		if ((HINSTANCE)HINSTANCE_ERROR < m_hmdlRichEdit)
		//----- DLL_xZkqqHx_iCkKiDiNiBfLiDgIiCmFiCkLiClNiPoKiNiH_xHqqkZx_ ------
		{
			//----- _xZkqqHx_iCnMiClI_xHqqkZx_RichEdit_xZkqqHx_iCmMiDgPiBfLiDfHiDiHiDjDiCpAiDgAiDeGiDgCiDeO_xHqqkZx_ -----
			// _xZkqqHx_iDgPiBfLiDfHiDiHiDjDiCmNiNmFjCoBiCmFiCoA_xHqqkZx_2.0_xZkqqHx_iBeC_xHqqkZx_
			m_nVersion = 2;
			// _xZkqqHx_iDgPiBfLiDfHiDiHiDjDiPoOjFpBiCmMiDfEiDeDiDfJiCpAiOoGjDlOiBeC_xHqqkZx_
			DWORD dwVerHnd = 0;	// An 'ignored' parameter, always '0'
			DWORD dwVerInfoSize = GetFileVersionInfoSize(_T("RICHED20.DLL"), &dwVerHnd);
			if (dwVerInfoSize != 0)
			{
				// _xZkqqHx_iDgPiBfLiDfHiDiHiDjDiPoOjFpBiCpAiOoGiCoIiPgPiClHiBeC_xHqqkZx_
				BYTEVector vData(dwVerInfoSize);
				GetFileVersionInfo(_T("RICHED20.DLL"), dwVerHnd, dwVerInfoSize, vData.begin());
				struct LANGANDCODEPAGE
				{
					WORD wLanguage;
					WORD wCodePage;
				} *lpTranslate;
				UINT cbTranslate;
				// Read the list of languages and code pages.
				VerQueryValue(vData.begin(), _T("\\VarFileInfo\\Translation"),
				              (LPVOID*)&lpTranslate, &cbTranslate);
				_TCHAR szSubBlock[100];
				// Read the file description for each language and code page.
				if (0 < cbTranslate)
				{
					_stprintf(szSubBlock,
								_T("\\StringFileInfo\\%04x%04x\\ProductVersion"),
								lpTranslate[0].wLanguage,
								lpTranslate[0].wCodePage);

					// Retrieve file description for language and code page "i". 
					LPTSTR lpBuffer;
					UINT dwBytes;
					VerQueryValue(vData.begin(), szSubBlock, (LPVOID*)&lpBuffer, &dwBytes);
					m_nVersion = _ttoi(lpBuffer);
				}
			}
			// RichEdit_xZkqqHx_iCmMiDeFiDeCiDjDiDgIiDeFiCpAiNoMjAkMiBeC_xHqqkZx_
			m_hwndRichEdit = ::CreateWindowEx(0, WStrToTStr(RICHEDIT_CLASSW),
					NULL, WS_CHILD|ES_MULTILINE, -100, -100, 10, 10,
					g_pView->GetSafeHwnd(), HMENU(2000), FFGetApp()->GetResourceInstance(), NULL);
		}
	}
	if (m_hwndRichEdit == NULL)
	//----- _xZkqqHx_iCnMiClO_xHqqkZx_RichEdit_xZkqqHx_iCkKiNoMjAkMiCmFiCkLiCmEiCkCiCmIiCkCiPoKiNiH_xHqqkZx_ -----
	{
		// RichEdit1.0_xZkqqHx_iCmM_xHqqkZx_DLL_xZkqqHx_iCpAiDiNiBfLiDgIiClHiCoJiBeC_xHqqkZx_
		m_hmdlRichEdit = FFLoadLibrary(L"RICHED32.DLL");
		if ((HINSTANCE)HINSTANCE_ERROR < m_hmdlRichEdit)
		//----- DLL_xZkqqHx_iCkKiDiNiBfLiDgIiCmFiCkLiClNiPoKiNiH_xHqqkZx_ ------
		{
			// _xZkqqHx_iDgPiBfLiDfHiDiHiDjDiCmN_xHqqkZx_1.0_xZkqqHx_iBeC_xHqqkZx_
			m_nVersion = 1;
			// RichEdit_xZkqqHx_iCmMiDeFiDeCiDjDiDgIiDeFiCpAiNoMjAkMiBeC_xHqqkZx_
			m_hwndRichEdit = ::CreateWindowEx(0, _T("RICHEDIT"),
					NULL, WS_CHILD|ES_MULTILINE, -100, -100, 10, 10,
					g_pView->GetSafeHwnd(), HMENU(2000), FFGetApp()->GetResourceInstance(), NULL);
		}
	}
	if (m_hwndRichEdit == NULL)
		FFThrowFileException(CFileException::fileNotFound, -1, L"RICHED32.DLL");
//----- 02.06.26 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
} // FCRichTextBuffer::FCRichTextBuffer.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichTextBuffer::~FCRichTextBuffer
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgGiDfIiDgHiDiJiDeOiDfOiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
FCRichTextBuffer::~FCRichTextBuffer ()
{
// 01.04.16 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//	m_richEditCtrl.DestroyWindow();
	if (m_hwndRichEdit != NULL)
	{
		::DestroyWindow(m_hwndRichEdit);
		m_hwndRichEdit = NULL;
	}
//----- 02.06.26 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
//	if (m_hmdlRich1_0 != NULL)
//	{
//		::FreeLibrary(m_hmdlRich1_0);
//		m_hmdlRich1_0 = NULL;
//	}
//	if (m_hmdlRich2_0 != NULL)
//	{
//		::FreeLibrary(m_hmdlRich2_0);
//		m_hmdlRich2_0 = NULL;
//	}
//----- 02.06.26 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
	if (m_hmdlRichEdit != NULL)
	{
		FFFreeLibrary(m_hmdlRichEdit);
		m_hmdlRichEdit = NULL;
	}
//----- 02.06.26 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
} // FCRichTextBuffer::~FCRichTextBuffer.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichTextBuffer::BeginGetChar
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFlGiOjKiOoGjDlOiCmMiNmFiPiJiCmMiPiIjHjNiBeCiPiJiKpKiJlLiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCRichTextBuffer::BeginGetChar ()
{
//----- 02.06.18 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ (Times New Roman_xZkqqHx_iCmM_xHqqkZx_"_xZkqqHx_iDlP_xHqqkZx_"_xZkqqHx_iCkKjDfMiCoIjFhEiCkPiCoKiCmIiCkC_xHqqkZx_)-----
//	RichGetWindowText(m_str);
//	m_lCurIndex = 0;
////----- 02.05.30 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ (MS_xZkqqHx_jGlOjCkJiCmMiBhFjBfDiKhAjFlGiOjKiBhGiCmG_xHqqkZx_Century_xZkqqHx_iCmMiBhFjElMiKhAjFlGiOjKiBhGiCkKiNkMiClEiCmBiClNjFlGiPmNiCkKiCkEiCnMiCkNjDfMiCoKiCmIiCkC_xHqqkZx_)-----
//	// _xZkqqHx_iMlLiNnNiCmMjFlGiOjKiImKjChF_xHqqkZx_(2Byte_xZkqqHx_jFlGiOjKiCoA_xHqqkZx_1_xZkqqHx_jFlGiOjKiCmJ_xHqqkZx_)_xZkqqHx_iBeC_xHqqkZx_RichEdit2.0_xZkqqHx_jAoKjHhAiBeC_xHqqkZx_
//	m_lCurCharIndex = 0;
////----- 02.05.30 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ (MS_xZkqqHx_jGlOjCkJiCmMiBhFjBfDiKhAjFlGiOjKiBhGiCmG_xHqqkZx_Century_xZkqqHx_iCmMiBhFjElMiKhAjFlGiOjKiBhGiCkKiNkMiClEiCmBiClNjFlGiPmNiCkKiCkEiCnMiCkNjDfMiCoKiCmIiCkC_xHqqkZx_)-----
//----- 02.06.18 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ (Times New Roman_xZkqqHx_iCmM_xHqqkZx_"_xZkqqHx_iDlP_xHqqkZx_"_xZkqqHx_iCkKjDfMiCoIjFhEiCkPiCoKiCmIiCkC_xHqqkZx_)-----

#if defined(_MBCS)
	switch (m_nVersion)
	{
	case 1:	// RichEdit1.0_xZkqqHx_iCmMiPoKiNiHiBeC_xHqqkZx_
		RichGetWindowText(m_tstr);
		m_lCurIndex = 0;
		break;
	default:	// RichEdit2.0, 3.0_xZkqqHx_iCmMiPoKiNiHiBeC_xHqqkZx_
// 06.11.22 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
		GetText(m_wstr);
		m_lCurIndex = 0;
	}
#elif defined(_UNICODE)
// 06.11.22 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
	GetText(m_wstr);
	m_lCurIndex = 0;
#endif//_UNICODE

//----- 02.06.18 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ (Times New Roman_xZkqqHx_iCmM_xHqqkZx_"_xZkqqHx_iDlP_xHqqkZx_"_xZkqqHx_iCkKjDfMiCoIjFhEiCkPiCoKiCmIiCkC_xHqqkZx_)-----
} // FCRichTextBuffer::BeginGetChar.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichTextBuffer::NextGetChar
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFlGiOjKiOoGjDlOiClFiCmEiBeBiDhMiDeDiDjDiDfOiCpAiOjPiCmJiInKjDkOiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	wc	:_xZkqqHx_iOoGjDlOiClFiClNjFlGiOjKiDfCiBfLiDgIiCpAjFnEiClHiBeC_xHqqkZx_
 *			fci	:_xZkqqHx_jFlGiOjKiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAjFnEiClHiBeC_xHqqkZx_
 *			tli	:_xZkqqHx_jFlGiOjKiCmMjBlGiNnNiClHiCoJiNhDiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_iOoGjDlOiCmFiCkLiCmIiCkCiPoKiNiHiCmN_xHqqkZx_ FALSE_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_jCiNiInD_xHqqkZx_>	wc_xZkqqHx_iCkKiOoGjDlOiCmFiCkLiCmEiCoAiBeB_xHqqkZx_fci_xZkqqHx_iCoC_xHqqkZx_tli_xZkqqHx_iCkKiOoGjDlOiCmFiCkLiCmIiCkCiPoKiNiHiCkKiCkAiCoJiBeC_xHqqkZx_
 *			_xZkqqHx_iClBiCmMiPoKiNiHiBeB_xHqqkZx_fci_xZkqqHx_iCmG_xHqqkZx_tli_xZkqqHx_iCmMjCiGjAgHiCmNiDeOiDiKiDeBiClDiCoKiCmEjFnEiClDiCoKiCoJiBeC_xHqqkZx_
 *			Excel_xZkqqHx_iCmMjFfMiCpAjDfMiCoIjFhEiCkPiClNiPoKiNiHiCmIiCmHiBeBiNiAjGnKiLoGjAnIiCoIiCmMiDfOiDhFiCmMjBkOjAkLiCmN_xHqqkZx_
 *			_xZkqqHx_iOoGjDlOiCmFiCkLiCmIiCkCiClNiCnPiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL FCRichTextBuffer::NextGetChar (wchar_t& wc, FCFontCharInfo& fci, FCTextLineInfo& tli)
{
	CHARFORMATW cfTmp;
//----- 06.11.22 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
	// _xZkqqHx_iKgFjFmPjAjEiCpAiDeOiDiKiDeBiBeC_xHqqkZx_tli_xZkqqHx_iCpA_xHqqkZx_memset_xZkqqHx_iCmFiDeOiDiKiDeBiClFiCmEiCmNiCkCiCkPiCmIiCkCiBeC_xHqqkZx_
	// til_xZkqqHx_iCmJiCmN_xHqqkZx_vector_xZkqqHx_iCmMiDiBiDjDiDgPiBfLiCkKiKnMiCnMiCoKiCoJiClNiCnPiBeC_xHqqkZx_
	memset(&cfTmp, 0, sizeof(cfTmp));
	fci.dwMask = 0;
	tli.dwMask = 0;
//----- 06.11.22 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----

#if defined(_MBCS)
	if (m_nVersion == 1)
	//----- RichEdit1.0_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
	{
		const _TCHAR* pStr = (const _TCHAR*)m_tstr + m_lCurIndex;
		const _TCHAR* pStrNext;

		// RichEdit1.0 _xZkqqHx_iCmNiBeB_xHqqkZx_2Byte_xZkqqHx_jFlGiOjKiCmN_xHqqkZx_2_xZkqqHx_jFlGiOjKiCmJiCnNiCmEiClFiCnMiCkEiClNiCnPiBeB_xHqqkZx_
		// RichSetSel_xZkqqHx_iKnGjAjEiCmNiBeB_xHqqkZx_2Byte_xZkqqHx_jFlGiOjKiCpAjFkKjCgGiClFiCmEiClFiCnMiCkEiJmCjEfMjAkLiCkKiCkAiCoJiBeC_xHqqkZx_
		// _xZkqqHx_iCfBiDgPiDeDiDgHjFlGiOjKiCmMiCfAiDgPiDeDiDgHjGnKiCmMiCnNiCmMjBeJjBpAiCmFiCmNiBeBjAlDiPoNiCmJ_xHqqkZx_CHARFORMAT_xZkqqHx_iCpA_xHqqkZx_
		// _xZkqqHx_iOoGjDlOiCmFiCkLiCmIiCkCiClNiCnPiBeBiDfCiBfLiDgIiDhJiBfLiDfHiCmJiCoGiCoJjElLjCgGiCpAjCpKiCnPiCoJiBeC_xHqqkZx_
		// _xZkqqHx_jFlGiOjKjHpBiCkJiCoHiCfAjFlGiOjKiDfCiBfLiDgIiCpAjAlGjAkMiBeC_xHqqkZx_
		wc = ::GetWChar(pStrNext, pStr, CP_ACP);
		if (wc == 0) return FALSE;
		if (wc == WCH_LF && *pStrNext == WCH_CR)
		{
			wc = WCH_CR;
			pStrNext++;
		}
		int iCharSize = pStrNext - pStr;
		//----- _xZkqqHx_iDeHiDgGiDeCiDgCiDgHiDfCiDjDiDgHiDiNiBfLiDiLiCmMiCfAjFlGiOjKiCmMjBkOjAkLiCpAiOoGjDlO_xHqqkZx_ -----
//----- 06.11.22 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//		RichSetSel(m_lCurIndex, m_lCurIndex + iCharSize);
//		RichGetSelectionCharFormat(cfTmp);
//----- 06.11.22 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
		if (RichSetSel(m_lCurIndex, m_lCurIndex + iCharSize))
			RichGetSelectionCharFormat(cfTmp);
//----- 06.11.22 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----
		m_lCurIndex += iCharSize;
	} else
	//----- RichEdit2.0, 3.0_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
	{
#endif//(_MBCS)
		// RichEdit2.0 _xZkqqHx_iCmNiBeB_xHqqkZx_2Byte_xZkqqHx_jFlGiOjKiCpA_xHqqkZx_1_xZkqqHx_jFlGiOjKiCmGiClFiCmEiCnNiCmEiCkNiCoKiCoJiCmMiCmFiBeB_xHqqkZx_
		// RichSetSel_xZkqqHx_iKnGjAjEiCkK_xHqqkZx_2Byte_xZkqqHx_jFlGiOjKiCpAjFkKjCgGiClHiCoJiClBiCmGiCmNiCmIiCkCiBeC_xHqqkZx_
		//----- _xZkqqHx_iDeHiDgGiDeCiDgCiDgHiDfCiDjDiDgHiDiNiBfLiDiLiCmMiCfAjFlGiOjKiCmMjBkOjAkLiCpAiOoGjDlO_xHqqkZx_ -----
//----- 06.11.22 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//		RichSetSel(m_lCurIndex, m_lCurIndex + 1);
//		RichGetSelectionCharFormat(cfTmp);
//		wchar_t wstr[2] = {L'\0'};
//		DWORD dwStrLen = RichGetSelText(wstr);
//		if (dwStrLen == 0) return FALSE;
//		wc = wstr[0];
//		if (wc == 0) return FALSE;
//		if (wc == WCH_LF)
//		{
//			wc = WCH_CR;
//			// _xZkqqHx_iMlLiNnNiCmMjFlGiOjKiImKjChFiCpAiIoKiCmCjBjHiCoJiBeC_xHqqkZx_
//			m_lCurIndex++;
//			// _xZkqqHx_iOjPiCmMjFlGiOjKiCkK_xHqqkZx_'\n'_xZkqqHx_iCmIiCoHiBeBiCoAiCkEiCfAjFlGiOjKjBjHiCoJiBeC_xHqqkZx_
//			RichSetSel(m_lCurIndex, m_lCurIndex + 1);
//			dwStrLen = RichGetSelText(wstr);
//			if (dwStrLen == 1 && wstr[0] == WCH_CR)
//				m_lCurIndex++;
//		} else
//		{
//			m_lCurIndex++;
//		}
//----- 06.11.22 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
		// RichEdit3.0_xZkqqHx_iCmFiCmNiBeBiKmIiInFjDeJiCmIjFfMiCpAiOjNiCmCiClBiCmGiCkKiCmFiCkLiCoJiBeC_xHqqkZx_
		// _xZkqqHx_iClBiCmMjFfMjCiGiCmMiDfOiDhFjFlGiOjKiCpAjBeJjBpAiClHiCoJiCmGiBeBiClLiCmMjBePiCmMjCfAiMoKjBfDjBmMiCkK_xHqqkZx_
		// _xZkqqHx_jBeJjBpAiPpDjBnEiCmJiCmIiCmBiCmEiClFiCnMiCkEiBeC_xHqqkZx_
		// _xZkqqHx_iDfOiDhFiCmMiCnNiCpAjBeJjBpAiClHiCoJjFpLjGeAiCmNjGlDiCkCiCmMiCmFiBeBiImIiJlKiCmMiCoGiCkEiCmJ_xHqqkZx_
		// m_wstr_xZkqqHx_iCpAjHjIjHhAiClHiCoJiCoGiCkEiCmJiClFiClNiBeC_xHqqkZx_
		if (m_wstr.GetLength() <= m_lCurIndex)
			return FALSE;
		// m_lCurIndex_xZkqqHx_iCmMiCfAjFlGiOjKiCmMiCnNjBeJjBpAiBeCjFkBjAjEjFlGiOjKiCkKiOkJjDkOjDeJiCmJjBeJjBpAiClDiCoKiClN_xHqqkZx_
		// _xZkqqHx_iPoKiNiHiCmNiBeB_xHqqkZx_m_lCurIndex_xZkqqHx_iCmJiDeKiBfLiDfMiDiLiCpAiInKjDkOiClHiCoJiBeC_xHqqkZx_
		// _xZkqqHx_iJlKjFpLiCmM_xHqqkZx_RichGetParaFormat_xZkqqHx_iKnGjAjEiCmMiClNiCnPiBeC_xHqqkZx_
		if (RichSetSel(m_lCurIndex, m_lCurIndex + 1))
			RichGetSelectionCharFormat(cfTmp);
		else
			RichSetSel(m_lCurIndex, m_lCurIndex);
		wc = m_wstr.GetAt(m_lCurIndex);
		if (wc == WCH_LF)
		//----- '\r'_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
		{
			// '\n'_xZkqqHx_iCmJjFoCjAlDiBeC_xHqqkZx_
			wc = WCH_CR;
			// '\r'_xZkqqHx_iCpAiCfAjFlGiOjKjBjHiCoJiBeC_xHqqkZx_
			m_lCurIndex++;
			// _xZkqqHx_iOjPiCmMjFlGiOjKiCkK_xHqqkZx_'\n'_xZkqqHx_iCmMiPoKiNiHiCmNiCfAjFlGiOjKjBjHiCoJiBeC_xHqqkZx_
			// _xZkqqHx_jCmKiPoNiCmN_xHqqkZx_'\n'_xZkqqHx_iCmNiKnMiCnMiCoKiCmIiCkCiBeC_xHqqkZx_
			if (m_lCurIndex < m_wstr.GetLength() &&
				m_wstr.GetAt(m_lCurIndex) == WCH_CR)
				m_lCurIndex++;
		} else
		//----- '\r'_xZkqqHx_iImIiKePiCmMiPoKiNiH_xHqqkZx_ -----
		{
			// _xZkqqHx_iCfAjFlGiOjKjBjHiCoJiBeC_xHqqkZx_
			m_lCurIndex++;
		}
//----- 06.11.22 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----
#if defined(_MBCS)
	}
#endif//(_MBCS)
	// _xZkqqHx_jFnEiClHjCgMiCpAjAnNjCoIiBeC_xHqqkZx_
	FFCopy(fci, cfTmp);
	// _xZkqqHx_iNfMjBkCjBmMiCmMiDfEiDeDiDfJiCpAiOhHjCoIiBeC_xHqqkZx_PARAFORMAT2_xZkqqHx_iNfMjBkCjBmMiCmGiLoGjFmKiClHiCoJiInHiBeC_xHqqkZx_
	PARAFORMAT pf;
	pf.cbSize = sizeof(pf);
	// _xZkqqHx_iClBiCmMiNhDiCmMjBkOjAkLiCpAiOoGjDlOiBeC_xHqqkZx_
	RichGetParaFormat(pf);
	// _xZkqqHx_iOoGjDlOiClFiClNjBkOjAkLiCpA_xHqqkZx_tli_xZkqqHx_iCmJiDfCiDhDiBfLiBeC_xHqqkZx_
	FFCopy(tli, pf);
	return TRUE;
} // FCRichTextBuffer::NextGetChar.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichTextBuffer::BeginAddChar
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFlGiOjKjCmHiJmBiCmMiNmFiPiJiCmMiPiIjHjNiBeCiPiJiKpKiJlLiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	fci	:_xZkqqHx_iPiJiKpKiJlLjHhAiCmMjFlGiOjKiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCRichTextBuffer::BeginAddChar (const FCFontCharInfo& fci)
{
	// _xZkqqHx_iDeHiDgGiDeCiDfOiPiJiKpKiJlLiBeC_xHqqkZx_
	RichSetWindowText(L"");
// 02.06.25 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)
//	MY_CHARFORMAT cf;
	CHARFORMATW cf;
	FFCopy(cf, fci);
	RichSetDefaultCharFormat(cf);
	RichSetSelectionCharFormat(cf);
	RichSetWordCharFormat(cf);
} // FCRichTextBuffer::BeginAddChar.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichTextBuffer::NextAddChar
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFlGiOjKjCmHiJmBiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	wc	:_xZkqqHx_jCmHiJmBiClHiCoJjFlGiOjKiDfCiBfLiDgIiCpAiOhHjCoIiBeC_xHqqkZx_
 *			fci	:_xZkqqHx_jFlGiOjKiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *			tli	:_xZkqqHx_jFlGiOjKiCmMjBlGiNnNiClHiCoJiNhDiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCRichTextBuffer::NextAddChar (const wchar_t& wc, const FCFontCharInfo& fci,
									const FCTextLineInfo& tli)
{
//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
//	wchar_t szStr[3] = {0,0,0};
//	//----- _xZkqqHx_iDhEiDeIiBfLiDhNiDgCiDgHiCmMjAnNjCoI_xHqqkZx_ -----
//	// _xZkqqHx_iDeHiDgGiDeCiDfOiCmJiMlLiNnNiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAjAnNjCoIiClHiCoJiBeC_xHqqkZx_
//	MY_CHARFORMAT cf;
//	::FFCopy(cf, fci);
//	RichSetWordCharFormat(cf);
//	// _xZkqqHx_iNhDiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAjAnNjCoIiClHiCoJiBeC_xHqqkZx_
//	PARAFORMAT pf;
//	FFCopy(pf, tli);
//	RichSetParaFormat(pf);
//	//----- _xZkqqHx_jFlGiOjKiCpAjCmHiJmB_xHqqkZx_ -----
//	if (wc == WCH_CR)
//	//----- _xZkqqHx_iJpMiNhDiDfCiBfLiDgIiCmMiPoKiNiH_xHqqkZx_ -----
//	{
//		szStr[0] = WCH_LF;
//		szStr[1] = WCH_CR;
//	} else
//	//----- _xZkqqHx_iJpMiNhDiDfCiBfLiDgIiImIiKePiCmMiPoKiNiH_xHqqkZx_ -----
//	{
////----- 02.02.08 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
////		long lStrLen;
////		(void)GetTChar(szStr, lStrLen, wc);
////----- 02.02.08 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
//		szStr[0] = wc;
////----- 02.02.08 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----
//	}
//	// _xZkqqHx_iDeHiDgGiDeCiDfOiNmFiMoDiCmJiCfAjFlGiOjKjCmHiJmBiBeC_xHqqkZx_
//	RichReplaceSel(szStr);
//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
	wchar_t wszStr[3] = {0,0,0};
	//----- _xZkqqHx_iDhEiDeIiBfLiDhNiDgCiDgHiCmMjAnNjCoI_xHqqkZx_ -----
	// _xZkqqHx_iDeHiDgGiDeCiDfOiCmJiMlLiNnNiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAjAnNjCoIiClHiCoJiBeC_xHqqkZx_
	CHARFORMATW cf;
	::FFCopy(cf, fci);
	RichSetWordCharFormat(cf);
	// _xZkqqHx_iNhDiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAjAnNjCoIiClHiCoJiBeC_xHqqkZx_
	PARAFORMAT pf;
	FFCopy(pf, tli);
	RichSetParaFormat(pf);
	//----- _xZkqqHx_jFlGiOjKiCpAjCmHiJmB_xHqqkZx_ -----
	if (wc == WCH_CR)
	//----- _xZkqqHx_iJpMiNhDiDfCiBfLiDgIiCmMiPoKiNiH_xHqqkZx_ -----
	{
		wszStr[0] = WCH_LF;
		wszStr[1] = WCH_CR;
	} else
	//----- _xZkqqHx_iJpMiNhDiDfCiBfLiDgIiImIiKePiCmMiPoKiNiH_xHqqkZx_ -----
	{
		wszStr[0] = wc;
	}
	// _xZkqqHx_iDeHiDgGiDeCiDfOiNmFiMoDiCmJiCfAjFlGiOjKjCmHiJmBiBeC_xHqqkZx_
	RichReplaceSel(wszStr);
//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
} // FCRichTextBuffer::NextAddChar.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichTextBuffer::EndAddChar
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFlGiOjKjBhNjDpMiPiIjHjNiCpAiPeJjHlJiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.06.09 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCRichTextBuffer::EndAddChar ()
{
} // FCRichTextBuffer::EndAddChar.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichTextBuffer::CanPasteSpecial
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDhJiBfLiDfIiDgHiJmCjEfMiCmIiCoHiCmO_xHqqkZx_ TRUE_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	dwFormat:_xZkqqHx_jDfMiCoIjFhEiCkPiCoJiDgGiBfLiDfOiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAiOhHjCoIiBeCiCmHiCmMiCoGiCkEiCmI_xHqqkZx_
 *					 _xZkqqHx_iDhEiDeIiBfLiDhNiDgCiDgHiCmFiCoAiCkCiCkCiCmIiCoHiBeBiCePiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL FCRichTextBuffer::CanPasteSpecial (DWORD dwFormat) const
{
	return RichCanPaste(dwFormat);
} // FCRichTextBuffer::CanPasteSpecial.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichTextBuffer::PasteSpecial
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDeOiDiKiDgCiDhGiDhLiBfLiDgIiDgGiBfLiDfOiCpAiDhJiBfLiDfIiDgHiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	fci		:_xZkqqHx_iPiJiKpKiJlLjHhAiCmMjFlGiOjKiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *			dwFormat:_xZkqqHx_jDfMiCoIjFhEiCkPiCoJiDgGiBfLiDfOiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAiOhHjCoIiBeCiCmHiCmMiCoGiCkEiCmI_xHqqkZx_
 *					 _xZkqqHx_iDhEiDeIiBfLiDhNiDgCiDgHiCmFiCoAiCkCiCkCiCmIiCoHiBeBiCePiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCRichTextBuffer::PasteSpecial (const FCFontCharInfo& fci, DWORD dwFormat)
{
	// _xZkqqHx_iDeHiDgGiDeCiDfOiPiJiKpKiJlLiBeC_xHqqkZx_
	RichSetWindowText(L"");
	CHARFORMATW cf;
	FFCopy(cf, fci);
	RichSetDefaultCharFormat(cf);
	RichSetSelectionCharFormat(cf);
	RichSetWordCharFormat(cf);
	// _xZkqqHx_iDhJiBfLiDfIiDgHiPiIjHjNiBeC_xHqqkZx_
	if (dwFormat == 0)
		RichPaste();
	else
		RichPasteSpecial(dwFormat);
} // FCRichTextBuffer::PasteSpecial.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichTextBuffer::Copy
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgPiDgCiDhEiDeAjCiGjBfDiDgFiDeMiDfIiDgHiCpAiDeOiDiKiDgCiDhGiDhLiBfLiDgIiCmJiDfCiDhDiBfLiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCRichTextBuffer::Copy ()
{
	// _xZkqqHx_jBfDiDgFiDeMiDfIiDgHiCpAjBeJjBpAiBeC_xHqqkZx_lCount_xZkqqHx_iCmMjBoDiCoNiCoIiCmJ_xHqqkZx_-1_xZkqqHx_iCpAiOhHjCoIiClFiClNiPoKiNiHiBeB_xHqqkZx_
	// _xZkqqHx_iDfCiDhDiBfLjFlGiOjKjHpBiCmMiNmFiMoDiCmJ_xHqqkZx_0x0d_xZkqqHx_iCkKjCmHiJmBiClDiCoKiCmEiClFiCnMiCkEiBeC_xHqqkZx_
	RichSetSel(0, RichGetTextLength());
	// _xZkqqHx_iDfCiDhDiBfLiPiIjHjNiBeC_xHqqkZx_
	RichCopy();
} // FCRichTextBuffer::Copy.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichTextBuffer::Clear
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jDoAjFjEiCmMiDgPiDgCiDhEiDeAiCpAjBfDiCmEiDeOiDiKiDeBiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCRichTextBuffer::Clear ()
{
	RichSetWindowText(L"");
	m_tstr.Empty();
// 06.11.22 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
	m_wstr.Empty();
	m_lCurIndex = 0;
} // FCRichTextBuffer::Clear.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichTextBuffer::IsEmpty
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgFiDeMiDfIiDgHiCkKiLpDiCmIiCoHiCmO_xHqqkZx_ TRUE_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL FCRichTextBuffer::IsEmpty () const
{
	return (RichGetTextLength() == 0);
} // FCRichTextBuffer::IsEmpty.

//----- 02.08.29 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ (_xZkqqHx_jCiGiNjBiMoKiCmMiDgFiDeMiDfIiDgHjDfMiCoIjFhEiCkPiCkKiCkEiCnMiCkNiCkCiCkJiCmIiCkC_xHqqkZx_)-----
/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichTextBuffer::GetText
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgFiDeMiDfIiDgHiCpAiOoGiCoIiPgPiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	wstr	:_xZkqqHx_iDgFiDeMiDfIiDgHiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	02.08.29 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCRichTextBuffer::GetText (WString& wstr)
{
#if defined(_MBCS)
	if (m_nVersion == 1)
	//----- RichEdit1.0_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
	{
		CString rString;
		RichGetWindowText(rString);
		wstr = (const wchar_t*)TStrToWStr(rString);
	} else
	//----- RichEdit2.0, 3.0_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_jBfDiCmEiCpAjBeJjBpAiBeC_xHqqkZx_
		RichSetSel(0, -1);
		long lLen = RichGetTextLength();
		DWORD dwStrLen = RichGetSelText(wstr.assign(lLen + 1, L'\0').begin());
		wstr.resize(dwStrLen);
	}
#elif defined(_UNICODE)
	RichGetWindowText(wstr);
#endif//_UNICODE
} // FCRichTextBuffer::GetText.
//----- 02.08.29 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ (_xZkqqHx_jCiGiNjBiMoKiCmMiDgFiDeMiDfIiDgHjDfMiCoIjFhEiCkPiCkKiCkEiCnMiCkNiCkCiCkJiCmIiCkC_xHqqkZx_)-----

void FCRichTextBuffer::RichGetWindowText (CString& rString) const
{
//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
//	int nLen = ::GetWindowTextLength(m_hwndRichEdit);
//	::GetWindowText(m_hwndRichEdit, rString.GetBufferSetLength(nLen), nLen+1);
//	rString.ReleaseBuffer();
//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
	// RichEdit1.0_xZkqqHx_jAoKjHhAiCmMiKnGjAjEiBeC_xHqqkZx_2.0_xZkqqHx_iCmFiCmNiOgHiCoNiCmIiCkCiBeC_xHqqkZx_
	if (m_nVersion == 1)
	//----- RichEdit1.0_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
	{
		int nLen = ::GetWindowTextLength(m_hwndRichEdit);
		::GetWindowText(m_hwndRichEdit, rString.GetBufferSetLength(nLen), nLen+1);
		rString.ReleaseBuffer();
	}
//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
} // FCRichTextBuffer::RichGetWindowText.

//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
//DWORD FCRichTextBuffer::RichGetSelectionCharFormat (MY_CHARFORMAT& cf) const
//{
//	cf.cbSize = sizeof(MY_CHARFORMAT);
//	return (DWORD)::SendMessage(m_hwndRichEdit, EM_GETCHARFORMAT, 1, (LPARAM)&cf);
//} // FCRichTextBuffer::RichGetSelectionCharFormat.
//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
DWORD FCRichTextBuffer::RichGetSelectionCharFormat (CHARFORMATW& cf) const
{
	if (m_nVersion == 1)
	//----- RichEdit1.0_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
	{
		CHARFORMATA cfa;
		cfa.cbSize = sizeof(cfa);
		DWORD dwReturn = (DWORD)::SendMessage(m_hwndRichEdit, EM_GETCHARFORMAT, 1, (LPARAM)&cfa);
		::FFCopy(cf, cfa);
		return dwReturn;
	} else
	//----- RichEdit1.0_xZkqqHx_iImIiNhOiCmMiPoKiNiH_xHqqkZx_ -----
	{
		cf.cbSize = sizeof(cf);
		return (DWORD)::SendMessage(m_hwndRichEdit, EM_GETCHARFORMAT, 1, (LPARAM)&cf);
	}
} // FCRichTextBuffer::RichGetSelectionCharFormat.
//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----

long FCRichTextBuffer::RichGetTextLength () const
{
//----- 02.08.29 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ (_xZkqqHx_iDgFiDeMiDfIiDgHjClHiCpAjFlGiOjKjAjEiCmGiClFiCmEiOoGjDlO_xHqqkZx_)-----
//	return (long)::SendMessage(m_hwndRichEdit, WM_GETTEXTLENGTH, NULL, NULL);
//----- 02.08.29 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ (_xZkqqHx_iDgFiDeMiDfIiDgHjClHiCpAjFlGiOjKjAjEiCmGiClFiCmEiOoGjDlO_xHqqkZx_)-----
	if (m_nVersion == 1)
	//----- RichEdit1.0_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_iDgPiDeDiDgHjAjEiCmGiClFiCmEiOoGjDlOiBeC_xHqqkZx_
		return (long)::SendMessage(m_hwndRichEdit, WM_GETTEXTLENGTH, NULL, NULL);
	} else
	//----- RichEdit1.0_xZkqqHx_iImIiNhOiCmMiPoKiNiH_xHqqkZx_ -----
	{
		// 1200 = UNICODE_xZkqqHx_iBeC_xHqqkZx_UNICODE_xZkqqHx_iCmMjFlGiOjKjAjEiCpAjAjEiCkGiCoJiBeC_xHqqkZx_
		GETTEXTLENGTHEX gt = { GTL_DEFAULT, 1200 };
		// RichEdit2.0_xZkqqHx_iImIiNhOjAoKjHhAiCmMiDiBiDgCiDfKiBfLiDfHiBeC_xHqqkZx_
		return (long)::SendMessage(m_hwndRichEdit, EM_GETTEXTLENGTHEX,
									(WPARAM)&gt, (LPARAM)0);
	}
//----- 02.08.29 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ (_xZkqqHx_iDgFiDeMiDfIiDgHjClHiCpAjFlGiOjKjAjEiCmGiClFiCmEiOoGjDlO_xHqqkZx_)-----
} // FCRichTextBuffer::RichGetTextLength.

DWORD FCRichTextBuffer::RichGetParaFormat (PARAFORMAT& pf) const
{
	pf.cbSize = sizeof(PARAFORMAT);
	return (DWORD)::SendMessage(m_hwndRichEdit, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
} // FCRichTextBuffer::RichGetParaFormat.

//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
//DWORD FCRichTextBuffer::RichGetSelText (char astr[]) const
//{
//	return (DWORD)::SendMessage(m_hwndRichEdit, EM_GETSELTEXT, 0, (LPARAM)astr);
//} // FCRichTextBuffer::RichGetSelText.
//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
DWORD FCRichTextBuffer::RichGetSelText (wchar_t wstr[]) const
{
	// RichEdit2.0_xZkqqHx_iImIiNhOjAoKjHhAiCmMiKnGjAjEiBeC_xHqqkZx_1.0_xZkqqHx_iCmFiCmNiOgHiCoNiCmIiCkCiBeC_xHqqkZx_
	if (m_nVersion == 1)
	//----- RichEdit1.0_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
	{
		return 0;
	} else
	//----- RichEdit1.0_xZkqqHx_iImIiNhOiCmMiPoKiNiH_xHqqkZx_ -----
	{
		return (DWORD)::SendMessage(m_hwndRichEdit, EM_GETSELTEXT, 0, (LPARAM)wstr);
	}
} // FCRichTextBuffer::RichGetSelText.
//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----

//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
//BOOL FCRichTextBuffer::RichSetSelectionCharFormat (MY_CHARFORMAT& cf)
//{
//	cf.cbSize = sizeof(MY_CHARFORMAT);
//	return (BOOL)::SendMessage(m_hwndRichEdit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
//} // FCRichTextBuffer::RichSetSelectionCharFormat.
//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
BOOL FCRichTextBuffer::RichSetSelectionCharFormat (CHARFORMATW& cf)
{
	if (m_nVersion == 1)
	//----- RichEdit1.0_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
	{
		CHARFORMATA cfa;
		::FFCopy(cfa, cf);
		return (BOOL)::SendMessage(m_hwndRichEdit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfa);
	} else
	//----- RichEdit1.0_xZkqqHx_iImIiNhOiCmMiPoKiNiH_xHqqkZx_ -----
	{
		return (BOOL)::SendMessage(m_hwndRichEdit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
	}
} // FCRichTextBuffer::RichSetSelectionCharFormat.
//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----

//----- 06.11.22 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//void FCRichTextBuffer::RichSetSel (long nStartChar, long nEndChar)
//{
//	CHARRANGE cr;
//	cr.cpMin = nStartChar;
//	cr.cpMax = nEndChar;
//	LRESULT result = ::SendMessage(m_hwndRichEdit, EM_EXSETSEL, 0, (LPARAM)&cr);
//} // FCRichTextBuffer::RichSetSel.
//----- 06.11.22 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
BOOL FCRichTextBuffer::RichSetSel (long nStartChar, long nEndChar)
{
	// RichEdit3.0_xZkqqHx_iCmFiCmNiBeB_xHqqkZx_Excel_xZkqqHx_iDgGiBfLiDfOiCmMjDfMiCoIjFhEiCkPjDjJiCmJiCoGiCmBiCmE_xHqqkZx_
	// _xZkqqHx_iKmIiInFjDeJiCmIjFfMiCpAiOjNiClNiClJiCoJiClBiCmGiCkKiCmFiCkLiCoJiBeC_xHqqkZx_
	// _xZkqqHx_iClBiCmMjFfMjCiGiCmMiDfOiDhFjFlGiOjKiCpAjBeJjBpAiClHiCoJiCmGiBeBiClLiCmMjBePiCmMjCfAiMoKjBfDjBmMiCkK_xHqqkZx_
	// _xZkqqHx_jBeJjBpAiPpDjBnEiCmJiCmIiCmBiCmEiClFiCnMiCkEiBeC_xHqqkZx_
	// _xZkqqHx_iDfOiDhFiCmMiCnNiCpAjBeJjBpAiClHiCoJjFpLjGeAiCmNjGlDiCkCiCmMiCmFiBeBiImIiJlKiCmMiCoGiCkEiCmJ_xHqqkZx_
	// _xZkqqHx_jBeJjBpAiCpAiMjPiPnIiClHiCoJjFeLjHhGiCkKiCkAiCoJiBeC_xHqqkZx_
	CHARRANGE cr;
	cr.cpMin = nStartChar;
	cr.cpMax = nEndChar;
	::SendMessage(m_hwndRichEdit, EM_EXSETSEL, 0, (LPARAM)&cr);
	// _xZkqqHx_iOmAiNnLiCmJjBeJjBpAiClDiCoKiClNjEmNiImNiCpAiOoGjDlOiBeC_xHqqkZx_
	::SendMessage(m_hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
	if (nEndChar == -1)
	{
		return (cr.cpMin == nStartChar);
	} else
	{
		return (cr.cpMin == nStartChar && cr.cpMax == nEndChar);
	}
} // FCRichTextBuffer::RichSetSel.
//----- 06.11.22 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----

//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
//void FCRichTextBuffer::RichSetWindowText (LPCTSTR lpszString)
//{
//	::SetWindowText(m_hwndRichEdit, lpszString);
//} // FCRichTextBuffer::RichSetWindowText.
//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
void FCRichTextBuffer::RichSetWindowText (const wchar_t* wcpString)
{
	if (m_nVersion == 1)
	//----- RichEdit1.0_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
	{
		::SendMessage(m_hwndRichEdit, WM_SETTEXT, 0, (LPARAM)(const char*)(WStrToAStr(wcpString)));
	} else
	//----- RichEdit1.0_xZkqqHx_iImIiNhOiCmMiPoKiNiH_xHqqkZx_ -----
	{
		::SendMessage(m_hwndRichEdit, WM_SETTEXT, 0, (LPARAM)wcpString);
	}
} // FCRichTextBuffer::RichSetWindowText.
//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----

//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
//BOOL FCRichTextBuffer::RichSetDefaultCharFormat (MY_CHARFORMAT& cf)
//{
//	cf.cbSize = sizeof(MY_CHARFORMAT);
//	return (BOOL)::SendMessage(m_hwndRichEdit, EM_SETCHARFORMAT, 0, (LPARAM)&cf);
//} // FCRichTextBuffer::RichSetDefaultCharFormat.
//
//BOOL FCRichTextBuffer::RichSetWordCharFormat (MY_CHARFORMAT& cf)
//{
//	cf.cbSize = sizeof(MY_CHARFORMAT);
//	return (BOOL)::SendMessage(m_hwndRichEdit, EM_SETCHARFORMAT, SCF_SELECTION|SCF_WORD, (LPARAM)&cf);
//} // FCRichTextBuffer::RichSetWordCharFormat.
//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
BOOL FCRichTextBuffer::RichSetDefaultCharFormat (CHARFORMATW& cf)
{
	if (m_nVersion == 1)
	//----- RichEdit1.0_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
	{
		CHARFORMATA cfa;
		::FFCopy(cfa, cf);
		return (BOOL)::SendMessage(m_hwndRichEdit, EM_SETCHARFORMAT, 0, (LPARAM)&cfa);
	} else
	//----- RichEdit1.0_xZkqqHx_iImIiNhOiCmMiPoKiNiH_xHqqkZx_ -----
	{
		return (BOOL)::SendMessage(m_hwndRichEdit, EM_SETCHARFORMAT, 0, (LPARAM)&cf);
	}
} // FCRichTextBuffer::RichSetDefaultCharFormat.

BOOL FCRichTextBuffer::RichSetWordCharFormat (CHARFORMATW& cf)
{
	if (m_nVersion == 1)
	//----- RichEdit1.0_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
	{
		CHARFORMATA cfa;
		::FFCopy(cfa, cf);
		return (BOOL)::SendMessage(m_hwndRichEdit, EM_SETCHARFORMAT, SCF_SELECTION|SCF_WORD, (LPARAM)&cfa);
	} else
	//----- RichEdit1.0_xZkqqHx_iImIiNhOiCmMiPoKiNiH_xHqqkZx_ -----
	{
		return (BOOL)::SendMessage(m_hwndRichEdit, EM_SETCHARFORMAT, SCF_SELECTION|SCF_WORD, (LPARAM)&cf);
	}
} // FCRichTextBuffer::RichSetWordCharFormat.
//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----

BOOL FCRichTextBuffer::RichSetParaFormat (PARAFORMAT& pf)
{
	pf.cbSize = sizeof(PARAFORMAT);
	return (BOOL)::SendMessage(m_hwndRichEdit, EM_SETPARAFORMAT, 0, (LPARAM)&pf);
} // FCRichTextBuffer::RichSetParaFormat.

//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
//void FCRichTextBuffer::RichReplaceSel (LPCTSTR lpszNewText, BOOL bCanUndo)
//{
//	::SendMessage(m_hwndRichEdit, EM_REPLACESEL, (WPARAM) bCanUndo, (LPARAM)lpszNewText);
//} // FCRichTextBuffer::RichReplaceSel.
//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----
void FCRichTextBuffer::RichReplaceSel (const wchar_t* wcpNewText, BOOL bCanUndo)
{
	if (m_nVersion == 1 || m_nVersion == 2)
	//----- RichEdit1.0 , 2.0_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
	{
		::SendMessage(m_hwndRichEdit, EM_REPLACESEL, (WPARAM)bCanUndo, (LPARAM)LPCTSTR(WStrToAStr(wcpNewText)));
	} else
	//----- RichEdit3.0_xZkqqHx_iImIiNhOiCmMiPoKiNiH_xHqqkZx_ -----
	{
		SETTEXTEX sttx = { ST_SELECTION, CP_WINUNICODE };
		::SendMessage(m_hwndRichEdit, EM_SETTEXTEX, (WPARAM)&sttx, (LPARAM)wcpNewText);
	}
} // FCRichTextBuffer::RichReplaceSel.
//----- 02.06.25 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ (SJIS_xZkqqHx_iCmJiCmIiCkC_xHqqkZx_UNICODE_xZkqqHx_jFlGiOjKjHpBiCmMjDfMiCoIjFhEiCkPiCpAiJmCjEfMiCmJiClHiCoJ_xHqqkZx_)-----

BOOL FCRichTextBuffer::RichCanPaste (UINT nFormat) const
{
	COleMessageFilter* pFilter = AfxOleGetMessageFilter();
	if (pFilter != NULL)
		pFilter->BeginBusyState();
	BOOL b = (BOOL)::SendMessage(m_hwndRichEdit, EM_CANPASTE, nFormat, 0L);
	if (pFilter != NULL)
		pFilter->EndBusyState();
	return b;
} // FCRichTextBuffer::RichCanPaste.

void FCRichTextBuffer::RichPaste ()
{
	::SendMessage(m_hwndRichEdit, WM_PASTE, 0, 0);
} // FCRichTextBuffer::RichPaste.

void FCRichTextBuffer::RichPasteSpecial (UINT nFormat)
{
	::SendMessage(m_hwndRichEdit, EM_PASTESPECIAL, nFormat, 0);
} // FCRichTextBuffer::RichPasteSpecial.

void FCRichTextBuffer::RichCopy ()
{
	::SendMessage(m_hwndRichEdit, WM_COPY, 0, 0);
} // FCRichTextBuffer::RichCopy.

////////////////////////////////////////////////////////////////////////////
// FCMolipTextBuffer

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCMolipTextBuffer::FCMolipTextBuffer
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDfCiDjDiDfIiDgHiDiJiDeOiDfOiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.02.18 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
FCMolipTextBuffer::FCMolipTextBuffer ()
{
//----- 05.07.10 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	if (g_cfDDText == NULL)
//	{
//		// Clipboard_xZkqqHx_iDhEiDeIiBfLiDhNiDgCiDgHjGlMiBeC_xHqqkZx_"Dynamic Draw Text 3.0"_xZkqqHx_iBeC_xHqqkZx_
//		WString strClip;
//		strClip.Format(L"%s Text %s", ::GetSpecAppName(FD_APPMODE_DYNAMICDRAW),
//						FCHeaderInf::GetStcFileVersionString());
//		g_cfDDText = (CLIPFORMAT)::RegisterClipboardFormat(WStrToTStr(strClip));
//	}
//----- 05.07.10 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
	Clear();
} // FCMolipTextBuffer::FCMolipTextBuffer.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCMolipTextBuffer::BeginGetChar
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFlGiOjKiOoGjDlOiCmMiNmFiPiJiCmMiPiIjHjNiBeCiPiJiKpKiJlLiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.02.18 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCMolipTextBuffer::BeginGetChar ()
{
	m_bypHead = m_vTextBuff.begin();
	m_tliCurLine.dwMask = 0;
	m_fciCurFont.dwMask = 0;
} // FCMolipTextBuffer::BeginGetChar.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCMolipTextBuffer::NextGetChar
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFlGiOjKiOoGjDlOiClFiCmEiBeBiDhMiDeDiDjDiDfOiCpAiOjPiCmJiInKjDkOiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	wc	:_xZkqqHx_iOoGjDlOiClFiClNjFlGiOjKiDfCiBfLiDgIiCpAjFnEiClHiBeC_xHqqkZx_
 *			fci	:_xZkqqHx_jFlGiOjKiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAjFnEiClHiBeC_xHqqkZx_
 *			tli	:_xZkqqHx_jFlGiOjKiCmMjBlGiNnNiClHiCoJiNhDiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_iOoGjDlOiCmFiCkLiCmIiCkCiPoKiNiHiCmN_xHqqkZx_ FALSE_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.02.18 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL FCMolipTextBuffer::NextGetChar (wchar_t& wc, FCFontCharInfo& fci, FCTextLineInfo& tli)
{
	if (m_vTextBuff.end() <= m_bypHead) return FALSE;
	for (;;)
	{
		::FFReadData(wc, m_bypHead);
		// _xZkqqHx_iNhDiPoOjFpBjFmPiNfIiCpAiOkGiClHjDmBiOoKjFlGiOjKiBeC_xHqqkZx_
		if (wc == FDRB_WCH_LINEINFO)
		{
			m_tliCurLine.InStream(m_bypHead);
		} else
		// _xZkqqHx_iDhEiDeIiDjDiDgHiPoOjFpBjFmPiNfIiCpAiOkGiClHjDmBiOoKjFlGiOjKiBeC_xHqqkZx_
		if (wc == FDRB_WCH_FONTINFO)
		{
			m_fciCurFont.InStream(m_bypHead);
		} else
		// _xZkqqHx_iDgPiDgCiDhEiDeAiNmFiMoDiCpAiOkGiClHjDmBiOoKjFlGiOjKiBeC_xHqqkZx_
		if (wc == L'\0')
		{
			return FALSE;
		} else
		{
			break;
		}
	}
	fci = m_fciCurFont;
	tli = m_tliCurLine;
	return TRUE;
} // FCMolipTextBuffer::NextGetChar.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCMolipTextBuffer::BeginAddChar
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFlGiOjKjCmHiJmBiCmMiNmFiPiJiCmMiPiIjHjNiBeCiPiJiKpKiJlLiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	fci	:_xZkqqHx_iPiJiKpKiJlLjHhAiCmMjFlGiOjKiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.02.18 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCMolipTextBuffer::BeginAddChar (const FCFontCharInfo& fci)
{
	Clear();
} // FCMolipTextBuffer::BeginAddChar.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCMolipTextBuffer::NextAddChar
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFlGiOjKjCmHiJmBiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	wc		:_xZkqqHx_jCmHiJmBiClHiCoJjFlGiOjKiDfCiBfLiDgIiCpAiOhHjCoIiBeC_xHqqkZx_
 *			fci	:_xZkqqHx_jFlGiOjKiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *			tli		:_xZkqqHx_jFlGiOjKiCmMjBlGiNnNiClHiCoJiNhDiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.02.18 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCMolipTextBuffer::NextAddChar (const wchar_t& wc, const FCFontCharInfo& fci,
									const FCTextLineInfo& tli)
{
	//----- _xZkqqHx_iDgFiDeMiDfIiDgHiDgPiDgCiDhEiDeAiCmJjCmHiJmB_xHqqkZx_ -----
	if (m_tliCurLine != tli)
	//----- _xZkqqHx_iNhDiCmMiPoOjFpBiCmJjFmPiNfIiCkKiCkAiCmBiClNiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_iNhDiPoOjFpBjFmPiNfIiCpAiOkGiClHjDmBiOoKjFlGiOjKiCpAiLeMjIfOiBeC_xHqqkZx_
		const wchar_t wcCode = FDRB_WCH_LINEINFO;
		m_vTextBuff << wcCode;
		tli.OutStream(m_vTextBuff);
//----- 02.08.29 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ (_xZkqqHx_jFlGiOjKiClCiCmGiCmJiPoOjFpBiCkKiPgPjHmNiClDiCoKiCmEiClFiCnMiCkEiDgPiDeP_xHqqkZx_)-----
		// _xZkqqHx_iMlLiNnNiCmMiNhDiPoOjFpBiCpAjFmPiNfIiBeC_xHqqkZx_
		m_tliCurLine = tli;
//----- 02.08.29 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ (_xZkqqHx_jFlGiOjKiClCiCmGiCmJiPoOjFpBiCkKiPgPjHmNiClDiCoKiCmEiClFiCnMiCkEiDgPiDeP_xHqqkZx_)-----
	}
	if (m_fciCurFont != fci)
	//----- _xZkqqHx_iDhEiDeIiDjDiDgHiCmMiPoOjFpBiCmJjFmPiNfIiCkKiCkAiCmBiClNiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_iDhEiDeIiDjDiDgHiPoOjFpBjFmPiNfIiCpAiOkGiClHjDmBiOoKjFlGiOjKiCpAiLeMjIfOiBeC_xHqqkZx_
		const wchar_t wcCode = FDRB_WCH_FONTINFO;
		m_vTextBuff << wcCode;
		fci.OutStream(m_vTextBuff);
//----- 02.08.29 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ (_xZkqqHx_jFlGiOjKiClCiCmGiCmJiPoOjFpBiCkKiPgPjHmNiClDiCoKiCmEiClFiCnMiCkEiDgPiDeP_xHqqkZx_)-----
		// _xZkqqHx_iMlLiNnNiCmMiNhDiPoOjFpBiCpAjFmPiNfIiBeC_xHqqkZx_
		m_fciCurFont = fci;
//----- 02.08.29 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ (_xZkqqHx_jFlGiOjKiClCiCmGiCmJiPoOjFpBiCkKiPgPjHmNiClDiCoKiCmEiClFiCnMiCkEiDgPiDeP_xHqqkZx_)-----
	}
	m_vTextBuff << wc;
} // FCMolipTextBuffer::NextAddChar.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCMolipTextBuffer::EndAddChar
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFlGiOjKjBhNjDpMiPiIjHjNiCpAiPeJjHlJiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.04.19 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCMolipTextBuffer::EndAddChar ()
{
	// _xZkqqHx_jFlGiOjKiDgPiDgCiDhEiDeAiCmMiNmFiMoDiCmJiLpDjFlGiOjKiCpAjCmHiJmBiBeC_xHqqkZx_
	m_vTextBuff << L'\0';
} // FCMolipTextBuffer::EndAddChar.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCMolipTextBuffer::CanPaste
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDhJiBfLiDfIiDgHiJmCjEfMiCmIiCoHiCmO_xHqqkZx_ TRUE_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.02.18 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL FCMolipTextBuffer::CanPaste () const
{
	return IsClipboardFormatAvailable(g_cfDDText);
} // FCMolipTextBuffer::CanPaste.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCMolipTextBuffer::Paste
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDeOiDiKiDgCiDhGiDhLiBfLiDgIiDgGiBfLiDfOiCpAiDhJiBfLiDfIiDgHiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	fci	:_xZkqqHx_iPiJiKpKiJlLjHhAiCmMjFlGiOjKiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.02.18 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCMolipTextBuffer::Paste (const FCFontCharInfo& fci)
{
	Clear();
	if (::OpenClipboard(NULL))
	{
		// _xZkqqHx_iDeOiDiKiDgCiDhGiDhLiBfLiDgIiCkJiCoHiDgOiDjDiDgIiDiLiCpAiOoGjDlOiBeC_xHqqkZx_
		HANDLE hText = ::GetClipboardData(g_cfDDText);
		if (hText != NULL)
		{
			DWORD dwCount = GlobalSize(hText);
			BYTE* pBuff = (BYTE*)GlobalLock(hText);
			if (pBuff != NULL)
			{
				m_vTextBuff.resize(dwCount);
				memcpy(m_vTextBuff.begin(), pBuff, dwCount);
			}
			GlobalUnlock(hText);
		}
		// _xZkqqHx_iDeOiDiKiDgCiDhGiDhLiBfLiDgIiCpAjFmCiClGiCoJiBeC_xHqqkZx_
		::CloseClipboard();
	}
} // FCMolipTextBuffer::Paste.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCMolipTextBuffer::Copy
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgPiDgCiDhEiDeAjCiGjBfDiDgFiDeMiDfIiDgHiCpAiDeOiDiKiDgCiDhGiDhLiBfLiDgIiCmJiDfCiDhDiBfLiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.02.18 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCMolipTextBuffer::Copy ()
{
	//----- MolipDraw_xZkqqHx_iDgFiDeMiDfIiDgHjDmGiOkJiDhEiDeIiBfLiDhNiDgCiDgHiCmMiDfCiDhDiBfL_xHqqkZx_ -----
	HGLOBAL hText = GlobalAlloc(GHND, m_vTextBuff.size());
	if (hText == NULL) return;
	BYTE* pBuff = (BYTE*)GlobalLock(hText);
	if (pBuff == NULL) return;
	memcpy(pBuff, m_vTextBuff.begin(), m_vTextBuff.size());
	GlobalUnlock(hText);

	if (::OpenClipboard(NULL))
	{
		SetClipboardData(g_cfDDText, hText);
		::CloseClipboard();
	}
} // FCMolipTextBuffer::Copy.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCMolipTextBuffer::Clear
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jDoAjFjEiCmMiDgPiDgCiDhEiDeAiCpAjBfDiCmEiDeOiDiKiDeBiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.02.18 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCMolipTextBuffer::Clear ()
{
	m_bypHead = NULL;
	// _xZkqqHx_iDgFiDeMiDfIiDgHiDgPiDgCiDhEiDeAiPiJiKpKiJlLiBeC_xHqqkZx_
	m_vTextBuff.clear();
	m_tliCurLine.dwMask = 0;
	m_fciCurFont.dwMask = 0;
} // FCMolipTextBuffer::Clear.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCMolipTextBuffer::IsEmpty
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgFiDeMiDfIiDgHiCkKiLpDiCmIiCoHiCmO_xHqqkZx_ TRUE_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.02.18 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL FCMolipTextBuffer::IsEmpty () const
{
	return m_vTextBuff.empty();
} // FCMolipTextBuffer::IsEmpty.

//----- 02.08.29 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ (_xZkqqHx_jCiGiNjBiMoKiCmMiDgFiDeMiDfIiDgHjDfMiCoIjFhEiCkPiCkKiCkEiCnMiCkNiCkCiCkJiCmIiCkC_xHqqkZx_)-----
/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCMolipTextBuffer::GetText
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgFiDeMiDfIiDgHiCpAiOoGiCoIiPgPiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	wstr	:_xZkqqHx_iDgFiDeMiDfIiDgHiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	02.08.29 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCMolipTextBuffer::GetText (WString& wstr)
{
	wchar_t wc;
	FCTextLineInfo	tliCurLine;
	FCFontCharInfo	fciCurFont;
	const BYTE*		bypHead = m_vTextBuff.begin();
	for (;;)
	{
		if (m_vTextBuff.end() <= bypHead) break;
		::FFReadData(wc, bypHead);
		// _xZkqqHx_iNhDiPoOjFpBjFmPiNfIiCpAiOkGiClHjDmBiOoKjFlGiOjKiBeC_xHqqkZx_
		if (wc == FDRB_WCH_LINEINFO)
		{
			tliCurLine.InStream(bypHead);
		} else
		// _xZkqqHx_iDhEiDeIiDjDiDgHiPoOjFpBjFmPiNfIiCpAiOkGiClHjDmBiOoKjFlGiOjKiBeC_xHqqkZx_
		if (wc == FDRB_WCH_FONTINFO)
		{
			fciCurFont.InStream(bypHead);
		} else
		// _xZkqqHx_iDgPiDgCiDhEiDeAiNmFiMoDiCpAiOkGiClHjDmBiOoKjFlGiOjKiBeC_xHqqkZx_
		if (wc == L'\0')
		{
			break;
		} else
		{
			wstr += wc;
		}
	}
} // FCMolipTextBuffer::GetText.
//----- 02.08.29 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ (_xZkqqHx_jCiGiNjBiMoKiCmMiDgFiDeMiDfIiDgHjDfMiCoIjFhEiCkPiCkKiCkEiCnMiCkNiCkCiCkJiCmIiCkC_xHqqkZx_)-----

////////////////////////////////////////////////////////////////////////////
// FCRichEditBuffer

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichEditBuffer::BeginGetChar
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFlGiOjKiOoGjDlOiCmMiNmFiPiJiCmMiPiIjHjNiBeCiPiJiKpKiJlLiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCRichEditBuffer::BeginGetChar ()
{
	if (!m_MolipText.IsEmpty())
	{
		m_MolipText.BeginGetChar();
	} else
	{
		m_RichText.BeginGetChar();
	}
} // FCRichEditBuffer::BeginGetChar.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichEditBuffer::NextGetChar
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFlGiOjKiOoGjDlOiClFiCmEiBeBiDhMiDeDiDjDiDfOiCpAiOjPiCmJiInKjDkOiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	wc	:_xZkqqHx_iOoGjDlOiClFiClNjFlGiOjKiDfCiBfLiDgIiCpAjFnEiClHiBeC_xHqqkZx_
 *			fci	:_xZkqqHx_jFlGiOjKiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAjFnEiClHiBeC_xHqqkZx_
 *			tli	:_xZkqqHx_jFlGiOjKiCmMjBlGiNnNiClHiCoJiNhDiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_iOoGjDlOiCmFiCkLiCmIiCkCiPoKiNiHiCmN_xHqqkZx_ FALSE_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_jCiNiInD_xHqqkZx_>	wc_xZkqqHx_iCkKiOoGjDlOiCmFiCkLiCmEiCoAiBeB_xHqqkZx_fci_xZkqqHx_iCoC_xHqqkZx_tli_xZkqqHx_iCkKiOoGjDlOiCmFiCkLiCmIiCkCiPoKiNiHiCkKiCkAiCoJiBeC_xHqqkZx_
 *			_xZkqqHx_iClBiCmMiPoKiNiHiBeB_xHqqkZx_fci_xZkqqHx_iCmG_xHqqkZx_tli_xZkqqHx_iCmMjCiGjAgHiCmNiDeOiDiKiDeBiClDiCoKiCmEjFnEiClDiCoKiCoJiBeC_xHqqkZx_
 *			Excel_xZkqqHx_iCmMjFfMiCpAjDfMiCoIjFhEiCkPiClNiPoKiNiHiCmIiCmHiBeBiNiAjGnKiLoGjAnIiCoIiCmMiDfOiDhFiCmMjBkOjAkLiCmN_xHqqkZx_
 *			_xZkqqHx_iOoGjDlOiCmFiCkLiCmIiCkCiClNiCnPiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL FCRichEditBuffer::NextGetChar (wchar_t& wc, FCFontCharInfo& fci, FCTextLineInfo& tli)
{
	if (!m_MolipText.IsEmpty())
	{
		return m_MolipText.NextGetChar(wc, fci, tli);
	} else
	{
		return m_RichText.NextGetChar(wc, fci, tli);
	}
} // FCRichEditBuffer::NextGetChar.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichEditBuffer::BeginAddChar
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFlGiOjKjCmHiJmBiCmMiNmFiPiJiCmMiPiIjHjNiBeCiPiJiKpKiJlLiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	fci	:_xZkqqHx_iPiJiKpKiJlLjHhAiCmMjFlGiOjKiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCRichEditBuffer::BeginAddChar (const FCFontCharInfo& fci)
{
	m_MolipText.BeginAddChar(fci);
	m_RichText.BeginAddChar(fci);
} // FCRichEditBuffer::BeginAddChar.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichEditBuffer::NextAddChar
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFlGiOjKjCmHiJmBiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	wc		:_xZkqqHx_jCmHiJmBiClHiCoJjFlGiOjKiDfCiBfLiDgIiCpAiOhHjCoIiBeC_xHqqkZx_
 *			fci	:_xZkqqHx_jFlGiOjKiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *			tli		:_xZkqqHx_jFlGiOjKiCmMjBlGiNnNiClHiCoJiNhDiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCRichEditBuffer::NextAddChar (const wchar_t& wc, const FCFontCharInfo& fci,
									const FCTextLineInfo& tli)
{
	m_MolipText.NextAddChar(wc, fci, tli);
	m_RichText.NextAddChar(wc, fci, tli);
} // FCRichEditBuffer::NextAddChar.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichEditBuffer::EndAddChar
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFlGiOjKjBhNjDpMiPiIjHjNiCpAiPeJjHlJiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.04.19 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCRichEditBuffer::EndAddChar ()
{
	m_MolipText.EndAddChar();
	m_RichText.EndAddChar();
} // FCRichEditBuffer::EndAddChar.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichEditBuffer::CanPasteSpecial
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDhJiBfLiDfIiDgHiJmCjEfMiCmIiCoHiCmO_xHqqkZx_ TRUE_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	dwFormat:_xZkqqHx_jDfMiCoIjFhEiCkPiCoJiDgGiBfLiDfOiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAiOhHjCoIiBeCiCmHiCmMiCoGiCkEiCmI_xHqqkZx_
 *					 _xZkqqHx_iDhEiDeIiBfLiDhNiDgCiDgHiCmFiCoAiCkCiCkCiCmIiCoHiBeBiCePiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL FCRichEditBuffer::CanPasteSpecial (DWORD dwFormat) const
{
	if (dwFormat == 0)
	//----- _xZkqqHx_iDeOiDiKiDgCiDhGiDhLiBfLiDgIiPoDiCmMiCmHiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCmFiCoAiCoGiCkC_xHqqkZx_ -----
	{
		return (m_MolipText.CanPaste() ||
				m_RichText.CanPasteSpecial(dwFormat));
	} else
	//----- _xZkqqHx_iDhEiDeIiBfLiDhNiDgCiDgHiCkKiOhHjCoIiClDiCoKiCmEiCkCiCoJ_xHqqkZx_ ------
	{
		if (dwFormat == g_cfDDText)
			return m_MolipText.CanPaste();
		else
			return m_RichText.CanPasteSpecial(dwFormat);
	}
} // FCRichEditBuffer::CanPasteSpecial.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichEditBuffer::PasteSpecial
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDeOiDiKiDgCiDhGiDhLiBfLiDgIiDgGiBfLiDfOiCpAiDhJiBfLiDfIiDgHiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	fci		:_xZkqqHx_iPiJiKpKiJlLjHhAiCmMjFlGiOjKiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *			dwFormat:_xZkqqHx_jDfMiCoIjFhEiCkPiCoJiDgGiBfLiDfOiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCpAiOhHjCoIiBeCiCmHiCmMiCoGiCkEiCmI_xHqqkZx_
 *					 _xZkqqHx_iDhEiDeIiBfLiDhNiDgCiDgHiCmFiCoAiCkCiCkCiCmIiCoHiBeBiCePiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCRichEditBuffer::PasteSpecial (const FCFontCharInfo& fci, DWORD dwFormat)
{
	if (dwFormat == 0)
	//----- _xZkqqHx_iDeOiDiKiDgCiDhGiDhLiBfLiDgIiPoDiCmMiCmHiCmMiDhEiDeIiBfLiDhNiDgCiDgHiCmFiCoAiCoGiCkC_xHqqkZx_ -----
	{
		if (m_MolipText.CanPaste())
		{
			m_MolipText.Paste(fci);
			m_RichText.Clear();
		} else
		{
			m_MolipText.Clear();
			m_RichText.PasteSpecial(fci, dwFormat);
		}
	} else
	//----- _xZkqqHx_iDhEiDeIiBfLiDhNiDgCiDgHiCkKiOhHjCoIiClDiCoKiCmEiCkCiCoJ_xHqqkZx_ ------
	{
		if (dwFormat == g_cfDDText)
		{
			m_MolipText.Paste(fci);
			m_RichText.Clear();
		} else
		{
			m_MolipText.Clear();
			m_RichText.PasteSpecial(fci, dwFormat);
		}
	}
} // FCRichEditBuffer::PasteSpecial.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichEditBuffer::Copy
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgPiDgCiDhEiDeAjCiGjBfDiDgFiDeMiDfIiDgHiCpAiDeOiDiKiDgCiDhGiDhLiBfLiDgIiCmJiDfCiDhDiBfLiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCRichEditBuffer::Copy ()
{
	m_RichText.Copy();
	m_MolipText.Copy();
} // FCRichEditBuffer::Copy.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichEditBuffer::Clear
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jDoAjFjEiCmMiDgPiDgCiDhEiDeAiCpAjBfDiCmEiDeOiDiKiDeBiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCRichEditBuffer::Clear ()
{
	m_MolipText.Clear();
	m_RichText.Clear();
} // FCRichEditBuffer::Clear.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichEditBuffer::IsEmpty
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgFiDeMiDfIiDgHiCkKiLpDiCmIiCoHiCmO_xHqqkZx_ TRUE_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.01.30 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL FCRichEditBuffer::IsEmpty () const
{
	return m_MolipText.IsEmpty() && m_RichText.IsEmpty();
} // FCRichEditBuffer::IsEmpty.

//----- 02.08.29 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ (_xZkqqHx_jCiGiNjBiMoKiCmMiDgFiDeMiDfIiDgHjDfMiCoIjFhEiCkPiCkKiCkEiCnMiCkNiCkCiCkJiCmIiCkC_xHqqkZx_)-----
/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCRichEditBuffer::GetText
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgFiDeMiDfIiDgHiCpAiOoGiCoIiPgPiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	wstr	:_xZkqqHx_iDgFiDeMiDfIiDgHiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	02.08.29 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCRichEditBuffer::GetText (WString& wstr)
{
	if (!m_MolipText.IsEmpty())
	{
		m_MolipText.GetText(wstr);
	} else
	{
		m_RichText.GetText(wstr);
	}
} // FCRichEditBuffer::GetText.
//----- 02.08.29 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ (_xZkqqHx_jCiGiNjBiMoKiCmMiDgFiDeMiDfIiDgHjDfMiCoIjFhEiCkPiCkKiCkEiCnMiCkNiCkCiCkJiCmIiCkC_xHqqkZx_)-----
