// CommonEditorDoc.cpp : _xZkqqHx_iDeDiDjDiDhGiDiKiDiBiDjDiDgFiBfLiDfGiDiHiDjD_xHqqkZx_ _xZkqqHx_iDhEiDeAiDeDiDiL_xHqqkZx_
//

#include "stdafx.h"
#include "DynamicDraw.h"
#include "UtilMisc.h"			// For FdtimeToFdsec.
#include "UtilStr.h"			// For GetResString.
#include "UtilErr.h"			// For FFMessageBox.
#include "UtilMath.h"			// For mmroundoff.
//#include "MainFrame.h"		// For g_pFrame.
#include "CommonEditorFrame.h"	// For CFCCommonEditorFrame.
#include "Env.h"				// For g_pEnv.etc.
#include "Communicate.h"		// For ReceiveData.
#include "DynamicDrawView.h"	// For g_pView.
#include "SheetManager.h"		// For FCSheetManager.
#include "ZOrder.h"				// For FCZOrder.
#include "ObjDynabase.h"			// For FCObjDynabase.
// 06.04.04 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//#include "DlgObjUserUlong.h"	// For CFCDlgObjUserUlong.
#include "HiCommandTable.h"		// For m_pGate.
#include "FrameWnd.h"			// For FFGetMainWnd().
#include "DynamicDb.h"			// For g_pFileServer.
#include "CommonEditorDoc.h"	// This header.

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

// Superclass_xZkqqHx_iCmMjCoIiLgAiBeC_xHqqkZx_

// _xZkqqHx_iDhEiDiJiDgCiDfGiDiFiCpAiClHiCoJiOjOiKnEiCmMiNmFiPkMjCgMiBeCjFgCjAjEiBeCiClBiClBiCpAiCoNiClEiCmGiNiCiCkNiClFiCmEiDgFiDfIiDgHiBeC_xHqqkZx_
#define FD_THRESHOLD_FLUSH_TIME		5

/////////////////////////////////////////////////////////////////////////////
// CFCCommonEditorDoc

IMPLEMENT_DYNCREATE(CFCCommonEditorDoc, CFCFoundDoc)

CFCCommonEditorDoc::CFCCommonEditorDoc ()
{
// 02.12.03 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//	g_pCommonEditorDoc = this;	// _xZkqqHx_iDgAiDgCiDhGiDeHiDgGiDeCiDfOiDgIiDeMiDiFiDiBiDjDiDgHjFmPjAjEiCpAjAnNjCoIiBeC_xHqqkZx_
} // CFCCommonEditorDoc::CFCCommonEditorDoc.

CFCCommonEditorDoc::~CFCCommonEditorDoc ()
{
// 02.12.03 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//	g_pCommonEditorDoc = NULL;	// _xZkqqHx_iDgAiDgCiDhGiDeHiDgGiDeCiDfOiDgIiDeMiDiFiDiBiDjDiDgHjFmPjAjEiCpAjAnNjCoIiBeC_xHqqkZx_
} // CFCCommonEditorDoc::~CFCCommonEditorDoc.

BEGIN_MESSAGE_MAP(CFCCommonEditorDoc, BASE_CLASS)
	//{{AFX_MSG_MAP(CFCCommonEditorDoc)
	ON_COMMAND(ID_FILE_COMEDT_NO_SAVE_EXIT, OnFileComedtNoSaveExit)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// 06.04.04 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//	ON_COMMAND(ID_CHIPEDIT_SET_USER_ID, OnChipeditSetUserId)

/////////////////////////////////////////////////////////////////////////////
// CFCCommonEditorDoc_xZkqqHx_iDiGiBfLiDfFiKnGjAjEiBeC_xHqqkZx_

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCCommonEditorDoc::ReceiveStreamAndInit
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	Molip Draw_xZkqqHx_iCkJiCoHjBjHjAeNiClDiCoKiCoJiDgGiBfLiDfOiCpAiOpDjAeNiClFiBeBiDfIiDgHiDiKiBfLiDiAiCmJ_xHqqkZx_
 *			_xZkqqHx_jDpMjHmNiClHiCoJiBeC_xHqqkZx_
 *			_xZkqqHx_iDgAiDgCiDhGiDeHiDgGiDeCiDfOiDiCiBfLiDgIiOjOiCmJiOgHjHhAiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	hwndDraw	:_xZkqqHx_jBjHjAeNiMlDiDeBiDhGiDiKiCmMiDeFiDeCiDjDiDgIiDeFiDgOiDjDiDgIiDiLiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	CFCMainFrame_xZkqqHx_iCkJiCoHiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.01.09 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *			99.03.24 Fukushiro M. CFCFoundDoc_xZkqqHx_iCkJiCoHiInKjDkOiBeC_xHqqkZx_
 *			99.11.02 Fukushiro M. _xZkqqHx_jFjEjFgJiCkKjFkBiNiHiDgAiDgCiDhGiCmMiPoKiNiHiJpAjBmMiClHiCoJiPiIjHjNiCpAjCmHiJmBiBeC_xHqqkZx_
 *************************************************************************/
void CFCCommonEditorDoc::ReceiveStreamAndInit (HWND hwndDraw)
{
//----- 05.07.15 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	// _xZkqqHx_iClBiClBiCmF_xHqqkZx_DeleteContents_xZkqqHx_iCpAiOmAiNhDiClHiCoJiCmG_xHqqkZx_Document_xZkqqHx_iCmMjDoAjFjEiCmJiJgFiLlPiCpAjHfOiCkGiCmEiClFiCnMiCkEiBeC_xHqqkZx_
//	// _xZkqqHx_iKmCiLkLjFnLjBlGjFmPjAjEiCpAiDeOiDiKiDeBiBeC_xHqqkZx_
//	g_pEnv->ClearAll();
//----- 05.07.15 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

	BYTE* bypData;	// _xZkqqHx_iDgGiBfLiDfOiOpDiCkPiOoGiCoIjHhAjFmPjAjEiBeC_xHqqkZx_
	long  lDataSize;
	// _xZkqqHx_iDgGiBfLiDfOiCmMiOpDjAeNiBeC_xHqqkZx_
	if (!::ReceiveData(hwndDraw, lDataSize, bypData))
	{
		// IDS_ERR_MSG_FAIL_COMMUNICATE = "_xZkqqHx_iDgGiBfLiDfOjBjHiOpDjAeNiCmJiOlIjEhDiClFiCnMiClFiClN_xHqqkZx_"
		FFErrorBox(IDS_ERR_MSG_FAIL_COMMUNICATE);
		// _xZkqqHx_iClBiCmMiCnMiCnMiPeJjHlJiClHiCoJiBeC_xHqqkZx_
//----- 03.08.15 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//		SetModifiedFlag(FALSE);
//		::PostMessage(AfxGetMainWnd()->GetSafeHwnd(), WM_COMMAND, ID_APP_EXIT, 0);
//----- 03.08.15 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
		ExitApplication();
//----- 03.08.15 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----
		return;
	}
	CMemFile file;
	file.Attach(bypData, lDataSize);
	FCUndoArchive ar(&file, FD_ARCHIVE_LOAD);
	ar.SetDocument(g_pDoc);
	// _xZkqqHx_iDfIiDgHiDiKiBfLiDiAjDpMjHmNjBePiPiIjHjNiBeC_xHqqkZx_
	g_pView->PrepareStreamIn();

	//----- _xZkqqHx_iDgAiDgCiDhGjGlMjDmHiCnNiNjOiCnNiPiIjHjN_xHqqkZx_ -----
	WORD wNameSize;
	// _xZkqqHx_iDgAiDgCiDhGjGlMiCmMjClHiClDiBgJiPeJjCfLiKnMiCnMiCmIiCkCiBgKiCpAiOoGjDlOiBeC_xHqqkZx_
	ar >> wNameSize;
	// _xZkqqHx_jDmHiCnNiNjOiCnNjHhAiDgPiDgCiDhEiDeAiCpAiKgNjFnLiBeC_xHqqkZx_
	WCharVector wvChipName(wNameSize);
	// _xZkqqHx_iDgAiDgCiDhGjGlMiCpAjDmHiCnNiNjOiCnNiBeC_xHqqkZx_
	ar.Read(wvChipName.begin(), wNameSize * sizeof(wchar_t));
	// _xZkqqHx_iPeJjCfLjAnNjCoIiBeC_xHqqkZx_
	wvChipName.push_back(L'\0');
	// _xZkqqHx_jGlDjBoIiCmMiPoKiNiHiBeB_xHqqkZx_"Untitled"_xZkqqHx_iCpAiOoGjDlOiBeC_xHqqkZx_
	if (wvChipName[0] == L'\0')
	{
		// _xZkqqHx_iDgAiDgCiDhGjGlMiCpAiDfOiDeDiDgHiDiLiCmJjAnNjCoIiBeC_xHqqkZx_
		SetTitle(WStrToTStr(FFGetApp()->GetDocString(CDocTemplate::docName)));
	} else
	{
		// _xZkqqHx_iDgAiDgCiDhGjGlMiCpAiDfOiDeDiDgHiDiLiCmJjAnNjCoIiBeC_xHqqkZx_
		SetTitle(WStrToTStr(wvChipName.begin()));
	}
	//----- _xZkqqHx_iDgGiBfLiDfOiOoGiCoIiNjOiCnNiPiIjHjN_xHqqkZx_ -----
	// _xZkqqHx_iKmCiLkLjDmHiCnNiNjOiCnNiBeC_xHqqkZx_
	g_pEnv->InStream(ar);
	// _xZkqqHx_jFjEjFgJjDmHiCnNiNjOiCnNiBeC_xHqqkZx_
// 03.05.23 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ( )
//	InStream(ar);
	SheetManager()->InStream(ar);
	// _xZkqqHx_iDeBiBfLiDeKiDeDiDhFiCpAjFmCiClGiCoJiBeC_xHqqkZx_
	ar.Close();
	// _xZkqqHx_iOpDjAeNiDgGiBfLiDfOiDgPiDgCiDhEiDeAiCpAiKeKjFpKiBeC_xHqqkZx_
	delete[] bypData;
	// _xZkqqHx_iOpDjAeNiClFiClNjFjEjFgJiCkKjFkBiNiHiDgAiDgCiDhGiBgJiDgAiDgCiDhGiDhNiDfIiDfOiBgKiCmMiPoKiNiHiBeBiClBiCoKiCpAiJpAjBmMiClFiCmEjGpAiKiEiCpAiOoGiCoIiPgPiClHiBeC_xHqqkZx_

	//----- _xZkqqHx_jBfDiCmEiCmMjFjEjFgJiCmJiKePjAnKiClHiCoJiDhEiDiMiBfLiDiAiCpAiOfKiPgPiClFiBeBiDfGiBfLiDgHiDfEiDeDiDfJiCpAiLiBiCnPiCoJ_xHqqkZx_ ------
	// _xZkqqHx_iDfGiBfLiDgHiCmMiNmFjCoBjFnLiPnIiDfEiDeDiDfJiCpAjAnNjCoIiBeC_xHqqkZx_
	DBLRect mmrtSheet = mmroundoff(DBLRect(0.0, 0.0, 600.0, 600.0));
	struct myFunc
	{
		static BOOL myCalcOuterFrame (FCObjDynabase* pObj, void* data)
		{
			DBLRect& mmrtSheet = *((DBLRect*)data);
			DBLRect mmrtOuter = pObj->GetOuterFrame();
			if (mmrtOuter.left < mmrtSheet.left)	mmrtSheet.left = mmrtOuter.left;
			if (mmrtOuter.top < mmrtSheet.top)		mmrtSheet.top = mmrtOuter.top;
			if (mmrtSheet.right < mmrtOuter.right)	mmrtSheet.right = mmrtOuter.right;
			if (mmrtSheet.bottom < mmrtOuter.bottom) mmrtSheet.bottom = mmrtOuter.bottom;
			return TRUE;
		}
	};
	// _xZkqqHx_jBfDiCmEiCmMjFjEjFgJiCmJjBmOiClFiCmEiBeB_xHqqkZx_myCalcOuterFrame _xZkqqHx_iKnGjAjEiCpAiOmAiNhDiClHiCoJiBeC_xHqqkZx_
	GetSheetManager()->CallForAllObject(myFunc::myCalcOuterFrame, &mmrtSheet);
	g_pEnv->SetSheetRect(mmrtSheet);
	g_pEnv->SetDocPaperSize(DMORIENT_PORTRAIT, -1, mmrtSheet.Width(), mmrtSheet.Height(),
							0.0, 0.0, 0.0, 0.0);

//----- 05.07.02 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	// FCEnv_xZkqqHx_iCmMiDfGiBfLiDgHiDfEiDeDiDfJjFmPiNfIiCpAjFfMiOkGiCmJjElNiJgGiBeC_xHqqkZx_
//	g_pView->UpdateScrollSize();
//	// _xZkqqHx_iDhCiDiFiBfLiCmMiPiJiKpKiJlLiPiIjHjNiCpAiMmEiCnBiPgPiClHiBeC_xHqqkZx_
//	g_pView->InitContents();
//	// _xZkqqHx_iDhEiDiMiBfLiDiAiCmMiPiJiKpKiJlLiPiIjHjNiCpAiMmEiCnBiPgPiClHiBeC_xHqqkZx_
//	if (FFGetMainWnd()->IsAvailable())
//		FFGetMainWnd()->InitContents();
//	// _xZkqqHx_jBfDiJoGjGmKiCpAiNmEjFgAiJoGiBeC_xHqqkZx_
//	g_pView->SendRgnRedraw(TRUE);
//----- 05.07.02 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
} // CFCCommonEditorDoc::ReceiveStreamAndInit.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCCommonEditorDoc::SendStreamAndEnd
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDeHiDgGiDeCiDfOiBfLiLeOjDkOiMlDiDeBiDhGiDiKiCmJiDgGiBfLiDfOjBjHjAeNiCpAiNhDiCkEiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.04.07 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCCommonEditorDoc::SendStreamAndEnd ()
{
	//----- _xZkqqHx_jDfNjBjHiClHiCoJiDgGiBfLiDfOiCmMiPiAjEpF_xHqqkZx_ -----
	CMemFile file;
	FCUndoArchive ar(&file, FD_ARCHIVE_STORE);
	ar.SetDocument(g_pDoc);
	// _xZkqqHx_iKmCiLkLiPoOjFpBiCmGjFjEjFgJiPoOjFpBiCpAiPjBiCkLiPgPiClHiBeC_xHqqkZx_
	g_pEnv->OutStream(ar, TRUE, TRUE);
// 06.06.23 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
//	SheetManager()->OutStream(ar, TRUE);
	SheetManager()->OutStream(ar, TRUE, FALSE);
	ar.Close();
	long lDataSize = static_cast<long>(file.GetLength());	// _xZkqqHx_iDgGiBfLiDfOiDgPiDeDiDgHiBeC_xHqqkZx_
	BYTE* bypData = file.Detach();
	// _xZkqqHx_iDgAiDgCiDhGiDfIiDgHiDiKiBfLiDiAiCmMiOpDiCkPiOoGiCoIjHhGiLiBiCpAjEkNiNhDiBeC_xHqqkZx_
	::PostMessage(CFCCommonEditorFrame::GetMasterAppFrame(),
					WM_USER_FROM_EDITDRAW, FDFC_RECEIVE_EDITDRAW_STREAM,
					reinterpret_cast<LPARAM>(FFGetMainWnd()->GetWnd()->m_hWnd));
	// Molip Draw_xZkqqHx_iCnGiDgGiBfLiDfOiCpAjDfNjBjHiBeC_xHqqkZx_
	if (!::SendData(CFCCommonEditorFrame::GetMasterAppFrame(), lDataSize, bypData))
	{
		// IDS_ERR_MSG_FAIL_COMMUNICATE = "_xZkqqHx_iDgGiBfLiDfOjBjHiOpDjAeNiCmJiOlIjEhDiClFiCnMiClFiClN_xHqqkZx_"
		FFErrorBox(IDS_ERR_MSG_FAIL_COMMUNICATE);
	}
	::free(bypData);

//----- 06.05.24 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
	// _xZkqqHx_iMlLiNnNiCmMjHjKjHpAiDhEiDeAiDeDiDiLiImKjChFiCpAiDiKiDfKiDgCiDgHiBeC_xHqqkZx_
	// CFCFoundDoc::IsModified() _xZkqqHx_iCkK_xHqqkZx_ FALSE_xZkqqHx_iCpAjFnEiClHiCoGiCkEiCmJiBeC_xHqqkZx_
	m_fliLastSavedSessionIdx = GetNextSessionIndex();
//----- 06.05.24 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----
	// _xZkqqHx_iClBiCmMiCnMiCnMiPeJjHlJiClHiCoJiBeC_xHqqkZx_
	ExitApplication();
} // CFCCommonEditorDoc::SendStreamAndEnd.

//----- 06.04.04 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCCommonEditorDoc::GetObjUserUlong
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFjEjFgJiDiGiBfLiDfF_xHqqkZx_ID_xZkqqHx_iCpAjFnEiClHiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.08.16 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//DWORD CFCCommonEditorDoc::GetObjUserUlong () const
//{
//	return m_dwObjUserUlong;
//} // CFCCommonEditorDoc::GetObjUserUlong.
//
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCCommonEditorDoc::SetObjUserUlong
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFjEjFgJiDiGiBfLiDfF_xHqqkZx_ID_xZkqqHx_iCpAjAnNjCoIiClHiCoJiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.08.16 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//void CFCCommonEditorDoc::SetObjUserUlong (DWORD dwId)
//{
//	m_dwObjUserUlong = dwId;
//} // CFCCommonEditorDoc::SetObjUserUlong.
//----- 06.04.04 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCCommonEditorDoc::GetForbiddenObject
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iClBiCmMiDgIiDeMiDiFiDiBiDjDiDgHiCmFiIlFiCkCiCkKiLnGiOhOiClDiCoKiClNjFjEjFgJiCmMiOoNjHnOiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	lIndex	:_xZkqqHx_iDeDiDjDiDgGiDgCiDeOiDfIiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jFjEjFgJiOoNiBeCiOhHjCoIiCmMiDeDiDjDiDgGiDgCiDeOiDfIiCkKiNmFiMoDiCmIiCoHiCmO_xHqqkZx_ FDOJ_NONE_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	_xZkqqHx_iClBiCmMjFjEjFgJiOoNiCmMiDfEiDhFiDeOiDiJiDfIjBfDiCmEiCkKiLnGiOhOiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.04.12 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
FTObjectType CFCCommonEditorDoc::GetForbiddenObject (long lIndex) const
{
	static FTObjectType s_ObjKind[] = { FDOJ_OLE };
	static int s_iObjKindCount = sizeof(s_ObjKind) / sizeof(s_ObjKind[0]);
	if (s_iObjKindCount <= lIndex)
		return BASE_CLASS::GetForbiddenObject(lIndex - s_iObjKindCount);
	return s_ObjKind[lIndex];
} // CFCCommonEditorDoc::GetForbiddenObject.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCCommonEditorDoc::OnFrameTimer
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDhEiDiMiBfLiDiAiDeFiDeCiDjDiDgIiDeFiCmM_xHqqkZx_OnTimer_xZkqqHx_iCkJiCoHiOmAiNhDiBeCiDfCiDhNiDjDiDgIiDhEiDeAiDeDiDiLiCmM_xHqqkZx_
 *			_xZkqqHx_iDhEiDiJiDgCiDfGiDiFjHhAiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.06.18 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCCommonEditorDoc::OnFrameTimer (UINT nIDEvent)
{
	if (nIDEvent == FDTIMER_FRAME_FLUSH)
	//----- _xZkqqHx_iDhEiDiJiDgCiDfGiDiFiDfOiDeDiDhNiBfLiCmMiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_jHjKjHpAjFlGiPjBiDhEiDeAiDeDiDiLiCpAiDhEiDiJiDgCiDfGiDiFiClHiCoJiBeC_xHqqkZx_
		if (m_pGate->IsOpened() && !IsReadOnly())
		{
			if (g_pFileServer->GetFdtimeFromFirstModified() != -1 &&
				FD_THRESHOLD_FLUSH_TIME <= FdtimeToFdsec(g_pFileServer->GetFdtimeFromFirstModified()))
			{
				// Undo_xZkqqHx_iDhEiDeAiDeDiDiLiCpA_xHqqkZx_Flush_xZkqqHx_iClHiCoJiBeC_xHqqkZx_
				// _xZkqqHx_iDgPiDgCiDeOiDeBiDgCiDhGiNlHjFkKiDhEiDeAiDeDiDiLiCpAiNoMjAkMiClFiCmIiCkCiBeC_xHqqkZx_
				if (!g_pFileServer->FlushAll2())
					FFThrowMiscException(FFGetDDErrorMessage());
			}
		}
	} else
	//----- _xZkqqHx_iDhEiDiJiDgCiDfGiDiFiDfOiDeDiDhNiBfLiImIiKePiCmMiPoKiNiH_xHqqkZx_ -----
	{
		// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
		BASE_CLASS::OnFrameTimer(nIDEvent);
	}
} // CFCCommonEditorDoc::OnFrameTimer.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCCommonEditorDoc::OnReqSyncHiviewToDocument
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	[ID_DREQ_SYNC_HIVIEW_TO_DOCUMENT]_xZkqqHx_iCmMiPiIjHjNiKnGjAjEiBeC_xHqqkZx_
 *			_xZkqqHx_iDgIiDeMiDiFiDiBiDjDiDgHjHhGiLiB_xHqqkZx_[_xZkqqHx_jHjKjHpAiNfMjBkCiDhCiDiFiBfLiCpAjDkPiKpKiClDiClJiCoJiBeC_xHqqkZx_]_xZkqqHx_iCpAiPiIjHjNiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	ret		:_xZkqqHx_iDgIiDeMiDiFiDiBiDjDiDgHjHhGiLiBiCmMiPiIjHjNiKnGjAjEiCmMiMiLiJmKiCpAjFnEiClHiBeC_xHqqkZx_
 *			arg		:_xZkqqHx_iDgIiDeMiDiFiDiBiDjDiDgHjHhGiLiBiCmMiPiIjHjNiKnGjAjEiCnGiCmMiIpIjAjEiCpAiOhHjCoIiBeC_xHqqkZx_
 *			reqLock	:_xZkqqHx_iDgIiDeMiDiFiDiBiDjDiDgHjHhGiLiBiCmMiPiIjHjNiKnGjAjEiCnGiCmMiDiNiDgCiDeOiIpIjAjEiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.03.17 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
FTDocReqResult CFCCommonEditorDoc::OnReqSyncHiviewToDocument (FCReqBase& ret, FCReqLock& reqLock)
{
	return FD_DRR_OK;
} // CFCCommonEditorDoc::OnReqSyncHiviewToDocument.

/////////////////////////////////////////////////////////////////////////////
// CFCCommonEditorDoc _xZkqqHx_jAgGjCgG_xHqqkZx_

#ifdef _DEBUG
void CFCCommonEditorDoc::AssertValid() const
{
	BASE_CLASS::AssertValid();
} // CFCCommonEditorDoc::AssertValid.

void CFCCommonEditorDoc::Dump(CDumpContext& dc) const
{
	BASE_CLASS::Dump(dc);
} // CFCCommonEditorDoc::Dump.
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CFCCommonEditorDoc _xZkqqHx_iDfGiDiKiDeBiDiJiDeDiDfJ_xHqqkZx_

/////////////////////////////////////////////////////////////////////////////
// CFCCommonEditorDoc _xZkqqHx_iDfCiDhNiDjDiDgI_xHqqkZx_

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCCommonEditorDoc::OnFileComedtNoSaveExit
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDiBiDgKiDiFiBfLiBhFiDgAiDgCiDhGiCpAjDgPjIfOiClJiClIiPeJjHlJiBhGiCkJiCoHiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	98.10.15 Fukushiro M. _xZkqqHx_iDfCiDiBiDjDiDgHiNoMjAkM_xHqqkZx_
 *			99.01.10 Fukushiro M. OLEAutomation_xZkqqHx_iCkJiCoH_xHqqkZx_Message_xZkqqHx_iDhIiBfLiDfIjFmPiNfIiCmJ_xHqqkZx_
 *									_xZkqqHx_jElKiCmBiCmEjAfGiLeLiCmJiNoMjAkM_xHqqkZx_
 *			99.03.24 Fukushiro M. CFCFoundDoc_xZkqqHx_iCkJiCoHiClBiClBiCmJiInKjDkOiBeC_xHqqkZx_
 *************************************************************************/
void CFCCommonEditorDoc::OnFileComedtNoSaveExit ()
{
	// IDS_MSG_IS_QUIT_NO_REGISTER = "_xZkqqHx_jDgPjIfOiClJiClIiPeJjHlJiClFiCnMiClHiCkJiBeI_xHqqkZx_"
	if (FFMessageBox(IDS_MSG_IS_QUIT_NO_REGISTER, 0, MB_OKCANCEL) == IDOK)
	{
		// _xZkqqHx_iDeHiDgGiDeCiDfOiMmEiCnBiPgPiClFiMlDiCpAiDhEiDeIiDeBiDePiDiJiDjDiDgIiDeFiDeCiDjDiDgIiDeFiCmJiClHiCoJiBeC_xHqqkZx_
		::SetForegroundWindow(CFCCommonEditorFrame::GetMasterAppFrame());
//----- 06.05.24 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
		// _xZkqqHx_iMlLiNnNiCmMjHjKjHpAiDhEiDeAiDeDiDiLiImKjChFiCpAiDiKiDfKiDgCiDgHiBeC_xHqqkZx_
		// CFCFoundDoc::IsModified() _xZkqqHx_iCkK_xHqqkZx_ FALSE_xZkqqHx_iCpAjFnEiClHiCoGiCkEiCmJiBeC_xHqqkZx_
		m_fliLastSavedSessionIdx = GetNextSessionIndex();
//----- 06.05.24 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----
		// _xZkqqHx_iClBiCmMiCnMiCnMiPeJjHlJiClHiCoJiBeC_xHqqkZx_
		ExitApplication();
	}
} // CFCCommonEditorDoc::OnFileComedtNoSaveExit.

//----- 06.04.04 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCCommonEditorDoc::OnChipeditSetUserId
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDiBiDgKiDiFiBfLiBhFjFjEjFgJiDiGiBfLiDfF_xHqqkZx_ID_xZkqqHx_iCpAjAnNjCoIiBhGiCkJiCoHiOmAiNhDiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.08.14 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//void CFCCommonEditorDoc::OnChipeditSetUserId ()
//{
//	CFCDlgObjUserUlong dlg;
//	dlg.DoModal();
//} // CFCCommonEditorDoc::OnChipeditSetUserId.
//----- 06.04.04 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCCommonEditorDoc::DeleteContents
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgIiDeMiDiFiDiBiDjDiDgHiCmMiDgGiBfLiDfOiCpAiNoNiPjMiClFiBeBiNmEiCnBiPiJiKpKiJlLiClHiCoJiBeC_xHqqkZx_
 *			_xZkqqHx_iDgIiDeMiDiFiDiBiDjDiDgH_xHqqkZx_ _xZkqqHx_iDeJiDhFiDfHiDeGiDeOiDgHiOkJjAgHiCmNjEgKiKpMiClJiClIiBeBiDgIiDeMiDiFiDiBiDjDiDgHiCmM_xHqqkZx_
 *			_xZkqqHx_iDgGiBfLiDfOiCpAiNoNiPjMiClHiCoJiClNiCnPiCmJiBeBiDhEiDiMiBfLiDiAiDiPiBfLiDeOiCkKiMmEiCnBiPgPiClHiBeC_xHqqkZx_
 *			_xZkqqHx_iImIiJlKiCmMiCfCiCmCiCmMiKnGjAjEiCkJiCoHiOmAiNhDiClDiCoKiCoJiBeC_xHqqkZx_
 *			_xZkqqHx_iBeF_xHqqkZx_COleServerDoc::OnNewDocument
 *			_xZkqqHx_iBeF_xHqqkZx_COleServerDoc::OnOpenDocument
 *			_xZkqqHx_iBeF_xHqqkZx_CFrameWnd::OnClose
 *
 * <_xZkqqHx_jCiNiInD_xHqqkZx_>	_xZkqqHx_iDgIiDeMiDiFiDiBiDjDiDgHjEgKiKpMiOjOiCmJiClBiCmMiKnGjAjEiCkKiMmEiCmOiCoKiCoJiOjOiCmNiBeBiKpJiCmJ_xHqqkZx_View_xZkqqHx_iCmNjEgKiKpM_xHqqkZx_
 *			_xZkqqHx_iClDiCoKiCmEiCkCiCoJiClBiCmGiCmJjCiNiInD_xHqqkZx_.
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	01.08.18 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void CFCCommonEditorDoc::DeleteContents ()
{
//----- 06.04.04 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	// _xZkqqHx_jFjEjFgJiDiGiBfLiDfF_xHqqkZx_ID_xZkqqHx_iCmMiPiJiKpKiJlLiBeC_xHqqkZx_
//	m_dwObjUserUlong = DWORD(-1);
//----- 06.04.04 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
	// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
	BASE_CLASS::DeleteContents();
} // CFCCommonEditorDoc::DeleteContents.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	CFCCommonEditorDoc::CanCloseFrame
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgIiDeMiDiFiDiBiDjDiDgHiCpAjFfMiOkGiClFiCmEiCkCiCoJ_xHqqkZx_CFrameWnd_xZkqqHx_iCkKjFmCiClGiCoHiCoKiCoJjBePiCmJiBeB_xHqqkZx_
 *			CFrameWnd_xZkqqHx_iCkKiMmEiCnBiPgPiClFiCnMiClHiBeCiDgGiDhEiDeIiDiLiDgHiCmMiDeDiDjDiDhGiDiKiDiBiDjDiDgHiCmFiCmNiBeB_xHqqkZx_
 *			_xZkqqHx_iDgIiDeMiDiFiDiBiDjDiDgHiCkKjFmPiNfIiClDiCoKiCmEiCkCiCoJiCmGiBeBiDgIiDeMiDiFiDiBiDjDiDgHiCpAjFnLjBlGiClHiCoJiCkJ_xHqqkZx_
 *			_xZkqqHx_iCmHiCkEiCkJjGoCiCkCiNiHiCoNiClJiCnMiClHiBeC_xHqqkZx_
 *			CFrameWnd_xZkqqHx_iCkKjFmCiClGiCoHiCoKiCoJiCmGiCkLiCmJiBeBjDmBjFmKiCmIiPiIjHjNiCpAiClFiClNiCkCiCmGiCkLiCmJiCmNiBeB_xHqqkZx_
 *			_xZkqqHx_iClBiCmMiKnGjAjEiCpAiDeJiBfLiDgPiBfLiDiJiDeDiDgIiClFiCnMiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pFrame	:CFrameWnd_xZkqqHx_iCnGiCmMiDhMiDeDiDjDiDfOiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	CFrameWnd_xZkqqHx_iCpAjFmCiClGiCoHiCoKiCoJiPpDjBnEiCmMiPoKiNiHiCmN_xHqqkZx_ 0 _xZkqqHx_iImIiKePiCpAjFnEiClFiCnMiClHiBeC_xHqqkZx_
 *			_xZkqqHx_iClLiCoKiImIiKePiCmMiPoKiNiHiCmN_xHqqkZx_ 0 _xZkqqHx_iCpAjFnEiClFiCnMiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	02.11.15 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL CFCCommonEditorDoc::CanCloseFrame (CFrameWnd* pFrame)
{
// 06.05.24 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//	AfxDebugBreak();
	if (IsModified())
	//----- _xZkqqHx_iDgIiDeMiDiFiDiBiDjDiDgHiCkKiPeDjAlDiClDiCoKiCmEiCkCiCoJiPoKiNiH_xHqqkZx_ -----
	{
		// IDS_MSG_IS_REGISTER_CHIP_ARROW = "_xZkqqHx_jFjEjFgJiCpAjDgPjIfOiClFiCnMiClHiCkJ_xHqqkZx_?"
		switch(FFMessageBox(IDS_MSG_IS_REGISTER_CHIP_ARROW, 0, MB_YESNOCANCEL))
		{
		case IDYES:
			// _xZkqqHx_iBhFjFnLjBlGiClFiCmEiPeJjHlJiBhGiCmMiDfCiDhNiDjDiDgIiCpAjBjHjFhEiBeC_xHqqkZx_
			pFrame->PostMessage(WM_COMMAND, ID_FILE_COMEDT_SAVE_EXIT, (LPARAM)0);
			break;
		case IDNO:
			// _xZkqqHx_iBhFjFnLjBlGiClJiClIiPeJjHlJiBhGiCmMiDfCiDhNiDjDiDgIiCpAjBjHjFhEiBeC_xHqqkZx_
			pFrame->PostMessage(WM_COMMAND, ID_FILE_COMEDT_NO_SAVE_EXIT, (LPARAM)0);
			break;
		default: // IDCANCEL:
			break;
		}
		// _xZkqqHx_iDhEiDiMiBfLiDiAiCmNjFmCiClGiCoHiCoKiCmIiCkCiBeC_xHqqkZx_
		return FALSE;
	} else
	//----- _xZkqqHx_iDgIiDeMiDiFiDiBiDjDiDgHiCkKiPeDjAlDiClDiCoKiCmEiCkCiCmIiCkCiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_iDhEiDiMiBfLiDiAiCmNjFmCiClGiCoHiCoKiCoJiBeC_xHqqkZx_
		return TRUE;
	}
} // CFCCommonEditorDoc::CanCloseFrame.
