#include "stdafx.h"
#include "FrameWnd.h"		// For FFGetMainWnd().
#include "PursuerText.h"	// For CFCPursuerText.
#include "ObjRect.h"		// For FCObjRect.
#include "ToolRichText.h"	// This header.

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


// 02.12.05 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//FCToolRichText	g_toolRichText;

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolRichText::FCToolRichText
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDfCiDjDiDfIiDgHiDiJiDeOiDfO_xHqqkZx_
 *************************************************************************/
FCToolRichText::FCToolRichText ()
{
// 05.07.15 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//	m_objpReference = NULL;
} // FCToolRichText::FCToolRichText.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolRichText::CreateInsideObject
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jDoAjFjEjFjEjFgJiCpAiNoMjAkMiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jDoAjFjEjFjEjFgJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.07.15 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
FCObjDynabase* FCToolRichText::CreateInsideObject ()
{
	FCObjDynabase* pObj = new FCObjRect();
	pObj->CalcResizeFrame();
//----- 06.11.26 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
	// _xZkqqHx_jFjEjFgJiCpAjEjCjAeGjDgIiCoIiCmCiCnEiClFiCmFiPiJiKpKiJlLiBeC_xHqqkZx_
	InitInsideObject(pObj);
//----- 06.11.26 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----
	return pObj;
} // FCToolRichText::CreateInsideObject.

//----- 05.07.15 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolRichText::OnViewCreate
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	CFCDynamicDrawView::OnCreate_xZkqqHx_iCkJiCoH_xHqqkZx_Call.Tool_xZkqqHx_iCmMiPiJiKpKiJlL_xHqqkZx_.
// *
// * <_xZkqqHx_jCiNiInD_xHqqkZx_>	_xZkqqHx_iClHiCnHiCmEiCmMiDfEiDhFiDeOiDiJiDfIiCmFjFeLjAhL_xHqqkZx_.
// *************************************************************************/
//void FCToolRichText::OnViewCreate ()
//{
//	// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
//	BASE_CLASS::OnViewCreate();
//	//----- _xZkqqHx_iDiKiDhEiDeAiDiMiDjDiDfIjFjEjFgJiCmMiNoMjAkM_xHqqkZx_ -----
//	m_objpReference = new FCObjRect();
//	m_objpReference->CalcResizeFrame();
//// 05.05.02 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
////	m_objpReference->CalcOuterFrame();
//} // FCToolRichText::OnViewCreate.
//----- 05.07.15 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

//----- 05.07.15 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolRichText::OnViewDestroy
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	CFCDynamicDrawView::OnDestroy_xZkqqHx_iCkJiCoH_xHqqkZx_Call.Tool_xZkqqHx_iCmMiPeJjHlJiPiIjHjN_xHqqkZx_.
// *
// * <_xZkqqHx_jCiNiInD_xHqqkZx_>	_xZkqqHx_iClHiCnHiCmEiCmMiDfEiDhFiDeOiDiJiDfIiCmFjFeLjAhL_xHqqkZx_.
// *************************************************************************/
//void FCToolRichText::OnViewDestroy ()
//{
//	//----- _xZkqqHx_iDiKiDhEiDeAiDiMiDjDiDfIjFjEjFgJiCmMiPmBiLiO_xHqqkZx_ -----
//	delete m_objpReference;
//	m_objpReference = NULL;
//	// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
//	BASE_CLASS::OnViewDestroy();
//} // FCToolRichText::OnViewDestroy.
//----- 05.07.15 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

//----- 05.07.15 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolRichText::GetInsideObject
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFjEjFgJiCmMjAlGjAkMiCmJiOgHjHhAiClDiCoKiCoJiDgDiBfLiDiLjDoAjFjEjFjEjFgJiCpAjFnEiClH_xHqqkZx_.
// *
// * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_iDgDiBfLiDiLjDoAjFjEjFjEjFgJiCmMiDhMiDeDiDjDiDfO_xHqqkZx_.
// *
// * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	_xZkqqHx_iClBiCmMjFjEjFgJiCpAiOgHiCmBiCmEiBeBiDhNiDeFiDfIiInKjDkOiOjOiCmMjFgAiJoGiCoCjFjEjFgJiCmMjAlGjAkMiCpAiNhDiCkE_xHqqkZx_.
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	98.09.29 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//FCObjDynabase* FCToolRichText::GetInsideObject () const
//{
//	return m_objpReference;
//} // FCToolRichText::GetInsideObject.
//----- 05.07.15 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolRichText::GetDefaultIdleCursor
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	StateIdle_xZkqqHx_iCmFiDgGiDhEiDeIiDiLiDgHiCmJiOgHiCoNiCoKiCoJiDeKiBfLiDfMiDiLiDgOiDjDiDgIiDiLiCpAjFnEiClHiBeC_xHqqkZx_
 *			_xZkqqHx_jFfHiPiAiCmMiDeKiBfLiDfMiDiLiCmMiPoKiNiHiCmN_xHqqkZx_ NULL_xZkqqHx_iCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.07.19 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
HCURSOR FCToolRichText::GetDefaultIdleCursor () const
{
	return FFGetApp()->LoadCursor(IDC_CURSOR_TOOL_RICH_TEXT);
} // FCToolRichText::GetDefaultIdleCursor.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolRichText::StopToEditText
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDeHiDgGiDeCiDfOiCmMjFnCiPfHiPeJjHlJiOjOiCmJiMmEiCmOiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jCiNiInD_xHqqkZx_>	_xZkqqHx_iClBiClBiCmJjHiIiClNiOjOiCmNiLeMjIfOiDfKiDgCiDfGiDiHiDjDiCmMiNmFjCiGiCmFiCkAiCoJiClBiCmGiCmJjCiNiInDiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	02.02.18 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolRichText::StopToEditText ()
{
	// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
	BASE_CLASS::StopToEditText();
	// _xZkqqHx_iLeMjIfOiDfKiDgCiDfGiDiHiDjDiCmMiPeJjHlJiBeC_xHqqkZx_StateStopCreate_xZkqqHx_iKnGjAjEiCmFiKeKiOgOiClDiCoKiClNiDfKiDgCiDfGiDiHiDjDiCpAjFmCiClGiCoJiBeC_xHqqkZx_
	g_pDoc->SessionEnd();
} // FCToolRichText::StopToEditText.

//----- 05.06.06 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolRichText::TransFDA
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iMiIjCoIjAkLjHeMiMmAiDeJiBfLiDgHiDhNiDgHiDjDiCmMjBeKiInKiCpAjFnEiClHiBeC_xHqqkZx_ToolPoly.mdrw_xZkqqHx_iCpAiOfBiPmGiBeC_xHqqkZx_
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	iState	:_xZkqqHx_iMlLiNnNiCmMiPpDjBnEiCpAiOhHjCoIiBeC_xHqqkZx_
// *			iEvent	:_xZkqqHx_iDeDiDhIiDjDiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jBeKiInKiMoDiCmMiPpDjBnEiCpAjFnEiClHiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	00.01.14 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//int FCToolRichText::TransFDA (int iState, int iEvent)
//{
//	// _xZkqqHx_iInKiNhDjAoGiPpDjBnEiBeC_xHqqkZx_
//	int iNextState = STATE_NONE;	// _xZkqqHx_iPpDjBnEjGlDiClFiBeC_xHqqkZx_
//	// FDA_xZkqqHx_iCmMiMlLiNnNiCmMiPpDjBnEiBeC_xHqqkZx_
//	switch (iState)
//	{
//	case STATE_IDLE:				// _xZkqqHx_jBnCiClPiBeC_xHqqkZx_
//		switch (iEvent)
//		{
//		case WM_LBUTTONDOWN:	// _xZkqqHx_iNlGiDhLiDfOiDjDiDfPiDeFiDjDiBeC_xHqqkZx_
//			if (IsEditingText())
//				iNextState = STATE_IDLE;			// _xZkqqHx_jBnCiClPiBeC_xHqqkZx_
//			break;
//		}
//		break;
//	}
//	// _xZkqqHx_iPpDjBnEjBeKiInKjGlDiClFiCmMiPoKiNiHiCmNiDfIiBfLiDhAiBfLiDeOiDiJiDfIiCmMiPpDjBnEjBeKiInKiCpAiMmEiCnBiPgPiClHiBeC_xHqqkZx_
//	if (iNextState == STATE_NONE)
//		iNextState = BASE_CLASS::TransFDA(iState, iEvent);
//	return iNextState;
//} // FCToolRichText::TransFDA.
//----- 05.06.06 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolRichText::StateStopCreate
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iNoMjAkMiPeJjHlJiPiIjHjNiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC	:_xZkqqHx_jFgAiJoGjHhAiDgGiDgPiDeDiDfIiDfCiDjDiDgFiDeMiDfIiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	02.02.18 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolRichText::StateStopCreate (CDC* pDC)
{
	// _xZkqqHx_iLeMjIfOiDfKiDgCiDfGiDiHiDjDiKeKiOgOiBeC_xHqqkZx_BASE_CLASS::StateStopCreate_xZkqqHx_jCiGiCmFiCoA_xHqqkZx_
	// SessionBegin_xZkqqHx_iCmNiOmAiNhDiClDiCoKiCoJiCkKiBeBiClBiCmMjDpBiCmCiCpAiCfAiDfKiDgCiDfGiDiHiDjDiCmJiKiHiCoJiClNiCnPiBeB_xHqqkZx_
	// _xZkqqHx_iClBiClBiCmFiOmAiNhDiClHiCoJiBeC_xHqqkZx_
	g_pDoc->SessionBegin();
	// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
	BASE_CLASS::StateStopCreate(pDC);
} // FCToolRichText::StateStopCreate.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolRichText::StateExitCreate
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iNoMjAkMiPgPiMpLiPiIjHjNiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC	:_xZkqqHx_jFgAiJoGjHhAiDgGiDgPiDeDiDfIiDfCiDjDiDgFiDeMiDfIiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	00.01.18 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolRichText::StateExitCreate (CDC* pDC)
{
	TRACE(_T("StateExitCreate\r\n"));
//----- 06.04.02 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//	if (m_objpNew == NULL)
//	//----- BASE_CLASS_xZkqqHx_iCmFiNoMjAkMiClDiCoKiClNjFjEjFgJiCkKjGlDiCkCiPoKiNiH_xHqqkZx_ -----
//	{
//		BASE_CLASS::StateExitCreate(pDC);
//	} else
//	//----- BASE_CLASS_xZkqqHx_iCmFiNoMjAkMiClDiCoKiClNjFjEjFgJiCkKiCkAiCoJiPoKiNiH_xHqqkZx_ -----
//	{
//		// _xZkqqHx_iDiLiBfLiDiJiBfLiDhNiDeFiDfIiDhNiBfLiDeKiBfL_xHqqkZx_0_xZkqqHx_iCpAjEpBiJmCiOiLiCmJiClHiCoJ_xHqqkZx_.
//		FFGetMainWnd()->SetRulerMMKVisible(0, FALSE);
//		// _xZkqqHx_iDhNiDeFiDfIiCmMjFnPiKgMiCpAiJpAiPjMiClFiCnMiClHiBeC_xHqqkZx_
//		::FFReleaseCapture();
//		// _xZkqqHx_jCmHjAnFiDhBiDjDiDgHiCpAjEpBjFfMiOkGiCmJiBeC_xHqqkZx_
//		FFGetApp()->GetPopHint()->OnHide();
//		// _xZkqqHx_jFnCiPfHiKeKiOgOiBeC_xHqqkZx_
//		StartToEditText((FCObjFigure*)m_objpNew, NULL);
//
//		// _xZkqqHx_iDgFiDeMiDfIiDgHjFnCiPfHjCiGiCmFjGlDiCkPiCoKiCmOiBeBiLeMjIfOiDfKiDgCiDfGiDiHiDjDiCmMiPeJjHlJiBeC_xHqqkZx_
//		// _xZkqqHx_iPoDiLeMiCmFiKeKiOgOiClDiCoKiClNiDfKiDgCiDfGiDiHiDjDiCmNiBeB_xHqqkZx_StopToEditText_xZkqqHx_iKnGjAjEiCmFjFmCiClGiCoJiClNiCnPiBeB_xHqqkZx_
//		// StartToEditText _xZkqqHx_iCmFiDgFiDeMiDfIiDgHjFnCiPfHiKeKiOgOiCkKjAkMiMpHiClFiClNiPoKiNiHiCmMiCnNiBeB_xHqqkZx_
//		// _xZkqqHx_jHeMiMpIiCmGiClFiCmIiCkPiCoKiCmOiCmIiCoHiCmIiCkCiBeC_xHqqkZx_
//		if (!IsEditingText()) g_pDoc->SessionEnd();
//	}
//----- 06.04.02 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
	if (m_objpNew == NULL)
	//----- BASE_CLASS_xZkqqHx_iCmFiNoMjAkMiClDiCoKiClNjFjEjFgJiCkKjGlDiCkCiPoKiNiH_xHqqkZx_ -----
	{
		// Baseclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
		BASE_CLASS::StateExitCreate(pDC);
	} else
	//----- BASE_CLASS_xZkqqHx_iCmFiNoMjAkMiClDiCoKiClNjFjEjFgJiCkKiCkAiCoJiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_iDgDiBfLiDiLiCpAiDiNiDgCiDeOiClFiCmEiBeB_xHqqkZx_BASE_CLASS::StateExitCreate_xZkqqHx_iKnGjAjEiCmF_xHqqkZx_
		// EndOfSession_xZkqqHx_iCpAjGlDiMpIiCmJiClHiCoJiBeC_xHqqkZx_
		const BOOL bIsLockedBackup = SetLockStatus(TRUE);
		// Baseclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
		BASE_CLASS::StateExitCreate(pDC);
		SetLockStatus(bIsLockedBackup);
		// _xZkqqHx_jFnCiPfHiKeKiOgOiBeC_xHqqkZx_
		StartToEditText((FCObjFigure*)m_objpNew, NULL, NULL);
		// _xZkqqHx_iDgFiDeMiDfIiDgHjFnCiPfHjCiGiCmFjGlDiCkPiCoKiCmOiBeBiLeMjIfOiDfKiDgCiDfGiDiHiDjDiCmMiPeJjHlJiBeC_xHqqkZx_
		// _xZkqqHx_iPoDiLeMiCmFiKeKiOgOiClDiCoKiClNiDfKiDgCiDfGiDiHiDjDiCmNiBeB_xHqqkZx_StopToEditText_xZkqqHx_iKnGjAjEiCmFjFmCiClGiCoJiClNiCnPiBeB_xHqqkZx_
		// StartToEditText _xZkqqHx_iCmFiDgFiDeMiDfIiDgHjFnCiPfHiKeKiOgOiCkKjAkMiMpHiClFiClNiPoKiNiHiCmMiCnNiBeB_xHqqkZx_
		// _xZkqqHx_jHeMiMpIiCmGiClFiCmIiCkPiCoKiCmOiCmIiCoHiCmIiCkCiBeC_xHqqkZx_
		if (!IsEditingText()) g_pDoc->SessionEnd();
	}
//----- 06.04.02 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----
} // FCToolRichText::StateExitCreate.

