#include "stdafx.h"
#include "2NewFDObjAny.h"	// For NewFDObjAny.
#include "2ObjGroup.h"		// This header.

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

#ifdef SUPER_CLASS
#undef SUPER_CLASS
#endif
#define SUPER_CLASS MC2ObjBase

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	MC2ObjGroup::MC2ObjGroup
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDfCiDjDiDfIiDgHiDiJiDeOiDfOiBeC_xHqqkZx_FDFoundDoc_xZkqqHx_iCmM_xHqqkZx_InStream_xZkqqHx_iCmFjFeLjHhGiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	98.11.16 Fukushiro M. _xZkqqHx_jFmPjAjEiCmMiPiJiKpKiJlLiCpAjCmHiJmB_xHqqkZx_.Tool_xZkqqHx_iCmFjAlGjAkMiClDiCoKiClNiOjOiCmMiInH_xHqqkZx_.
 *************************************************************************/
MC2ObjGroup::MC2ObjGroup ()
{
	// m_mmrtOuter_xZkqqHx_iCpAjGlDiMpIiCmJiClHiCoJiBeCiMoDiCmFiOfBiPmGiClDiCoKiClNiCmGiCkLiPiJiCnPiCmEiMhGiOfKiClHiCoJiCoGiCkEiCmJiBeC_xHqqkZx_
	m_mmrtOuter.SetRect(1,1,0,0);
	m_vObj.clear();
} // MC2ObjGroup::MC2ObjGroup.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	IsKindOf
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFjEjFgJiCkKiClBiCmMiMfOiBeBiIlNiCkCiCmNiClBiCmMiMfOiCmMiDfEiDhFiDeOiDiJiDfIiCmMiMfOiCkJiCmHiCkEiCkJiCpAjClCiCnHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	nType	: _xZkqqHx_jClCiCnHiCoJiMfOiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	TRUE	: nType_xZkqqHx_iMfOiBeBiIlNiCkCiCmNiClLiCmMiDfEiDhFiDeOiDiJiDfIiCmMiPoKiNiH_xHqqkZx_
 *			FALSE	: _xZkqqHx_iClLiCkEiCmFiCmIiCkCiPoKiNiH_xHqqkZx_
 *************************************************************************/
BOOL MC2ObjGroup::IsKindOf (FTObjectType nType) const
{
	if (nType == FDOJ_GROUP) return TRUE;
	return SUPER_CLASS::IsKindOf(nType);
} // MC2ObjGroup::IsKindOf.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	MC2ObjArc::Type
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iClBiCmMiDeOiDiJiDfIiCmMiMfOiCpAjFnEiClH_xHqqkZx_.
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_iDeOiDiJiDfIiCmMiMfO_xHqqkZx_
 *************************************************************************/
FTObjectType MC2ObjGroup::Type () const
{
	return FDOJ_GROUP;
} // MC2ObjGroup::Type.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	MC2ObjGroup::OutStream
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFjEjFgJiCmMiPpDjBnEiCpAiDfIiDgHiDiKiBfLiDiAiCmJiPjBiCkLiPgPiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	ar	: _xZkqqHx_iPjBiCkLiPgPiClFjHhAiCmM_xHqqkZx_MC2ARCHIVE
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.03.03 Fukushiro M. MC2ARCHIVE_xZkqqHx_iCpA_xHqqkZx_MC2ARCHIVE_xZkqqHx_iCmJiPeDjAlDiBeC_xHqqkZx_
 *************************************************************************/
void MC2ObjGroup::OutStream (MC2ARCHIVE& ar)
{
	SUPER_CLASS::OutStream(ar);
	ar << m_mmrtResize;	// _xZkqqHx_iDiKiDfEiDeDiDfJiDhEiDiMiBfLiDiAiBeC_xHqqkZx_
	ar << m_mmrtOuter;	// _xZkqqHx_iNmEjFgAiJoGjHmMiIoGiBeC_xHqqkZx_
	//----- _xZkqqHx_iDePiDiLiBfLiDhGjDoAjFjEjFgJiDgFiBfLiDhFiDiLiCpAiPgPjHmN_xHqqkZx_ -----
	// _xZkqqHx_jFjEjFgJjAjEiCpAiPgPjHmNiBeC_xHqqkZx_
	ar << static_cast<short>(m_vObj.size());
	MC2ObjBaseVector::const_iterator i;
	for (i = m_vObj.begin(); i != m_vObj.end(); i++)
	{
		// _xZkqqHx_jFjEjFgJiCmMiMfOiCpAiPgPjHmNiBeC_xHqqkZx_
		ar << static_cast<short>((*i)->Type());
		// _xZkqqHx_jFjEjFgJiCpAiPgPjHmNiBeC_xHqqkZx_
		(*i)->OutStream(ar);
	}
} // MC2ObjGroup::OutStream.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	MC2ObjGroup::InStream
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFjEjFgJiCmMiPpDjBnEiCpAiDfIiDgHiDiKiBfLiDiAiCkJiCoHjDmHiCnNiNjOiCnOiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	ar	: _xZkqqHx_jDmHiCnNiNjOiCnNjHhAiCmM_xHqqkZx_MC2ARCHIVE
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.01.16 Fukushiro M. _xZkqqHx_jFjEjFgJ_xHqqkZx_ID_xZkqqHx_iCmMjDgPjIfOiPiIjHjNiCpAjCmHiJmBiBeC_xHqqkZx_
 *			99.03.03 Fukushiro M. MC2ARCHIVE_xZkqqHx_iCpA_xHqqkZx_MC2ARCHIVE_xZkqqHx_iCmJiPeDjAlDiBeC_xHqqkZx_
 *			99.10.26 Fukushiro M. RegisterObject_xZkqqHx_iCpAjGjFiPmBiBeCiDgAiDgCiDhGiCpAiOgHiCmBiClNiOjO_xHqqkZx_
 *									_xZkqqHx_jDpBiPgEjDgPjIfOiClDiCoKiCoJiBeC_xHqqkZx_
 *************************************************************************/
void MC2ObjGroup::InStream (MC2ARCHIVE& ar)
{
	SUPER_CLASS::InStream(ar);

	//----- _xZkqqHx_iKpJjBlGiCmMjFjEjFgJiCpAjDgPjIfOjGjFiPmB_xHqqkZx_ -----
	MC2ObjBaseVector::const_iterator iON;
	for (iON = m_vObj.begin(); iON != m_vObj.end(); iON++)
		(*iON)->UnregisterObjID();
	//----- _xZkqqHx_iKpJjBlGiCmMjFjEjFgJiCpAiNoNiPjM_xHqqkZx_ -----
	for (iON = m_vObj.begin(); iON != m_vObj.end(); iON++)
		delete *iON;
	m_vObj.clear();

	ar >> m_mmrtResize;	// _xZkqqHx_iDiKiDfEiDeDiDfJiDhEiDiMiBfLiDiAiBeC_xHqqkZx_
	ar >> m_mmrtOuter;	// _xZkqqHx_iNmEjFgAiJoGjHmMiIoGiBeC_xHqqkZx_
	// m_mmrtOuter_xZkqqHx_iCpAjGlDiMpIiCmJiClHiCoJiBeCiMoDiCmFiOfBiPmGiClDiCoKiClNiCmGiCkLiPiJiCnPiCmEiMhGiOfKiClHiCoJiCoGiCkEiCmJiBeC_xHqqkZx_
	m_mmrtOuter.SetRect(1,1,0,0);
	//----- _xZkqqHx_iDePiDiLiBfLiDhGjDoAjFjEjFgJiDgFiBfLiDhFiDiLiCpAiPgPjHmN_xHqqkZx_ -----
	// _xZkqqHx_jFjEjFgJjAjEiCpAjDpMjHmNiBeC_xHqqkZx_
	short nSize;
	ar >> nSize;
	short		nType;
	MC2ObjBase*	pObj;
	while (0 < nSize--)
	{
		// _xZkqqHx_jFjEjFgJiCmMiMfOiCpAjDpMjHmNiBeC_xHqqkZx_
		ar >> nType;
		pObj = NewFDObjAny(FTObjectType(nType));
		// _xZkqqHx_jFjEjFgJiCpAjDpMjHmNiBeC_xHqqkZx_
		pObj->InStream(ar);
		m_vObj.push_back(pObj);
	}
	// _xZkqqHx_iClBiClBiCmJ_xHqqkZx_CalcOuterFrame_xZkqqHx_iCpAjDpMiCoKiClNiCkCiCmGiClBiCoLiClOiCkKiBeBiImIiJlKiCmMjHjNjHfCiCmFjFhDiJmCiBeC_xHqqkZx_
	// CalcOuterFrame_xZkqqHx_jCiGiCmFiMmEiCmOiCoKiCoJ_xHqqkZx_GetOuterFrame_xZkqqHx_iCmNiBeBjDgPjIfOiDhJiDjDiCmMjBlOiClDiCmIiCmHiCpAiOfBiPmGiClHiCoJiBeC_xHqqkZx_
	// OnPaste_xZkqqHx_iCmF_xHqqkZx_ _xZkqqHx_jDgPjIfOiDhJiDjDiCmMjBlOiClDiCpAiOfBiPmGiClHiCoJiCmGiBeBjGkCiClOjDgPjIfOiPiIjHjNiCkKiPeJiCoNiCmBiCmEiCkCiCmIiCkC_xHqqkZx_
	// _xZkqqHx_iPpDjBnEiCmFiOfBiPmGiClDiCoKiCmEiClFiCnMiCkEiClNiCnPiBeBjHiOiClPiCoJiBeC_xHqqkZx_
} // MC2ObjGroup::InStream.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	MC2ObjGroup::~MC2ObjGroup
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgGiDfIiDgHiDiJiDeOiDfOiBeC_xHqqkZx_
 *************************************************************************/
MC2ObjGroup::~MC2ObjGroup ()
{
	// _xZkqqHx_iDePiDiLiBfLiDhGjDoAiCmMjFjEjFgJiCpAiNoNiPjMiBeC_xHqqkZx_
	MC2ObjBaseVector::const_iterator iObj;
	for (iObj = m_vObj.begin(); iObj != m_vObj.end(); iObj++)
	{
		delete *iObj;
	}
} // MC2ObjGroup::~MC2ObjGroup.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	MC2ObjGroup::RegisterObjForceID
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFjEjFgJiCmMiCgIiCgDiCpAjDgPjIfOiClHiCoJiBeCiClBiCmMjFjEjFgJiCmJjFhEiCkPiCoHiCoKiCmEiCkCiCoJiCgIiCgDiOkJjAgHiCpA_xHqqkZx_
 *			_xZkqqHx_iLkNjAkHjDgPjIfOiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	_xZkqqHx_iDePiDiLiBfLiDhGiCmGiDgAiDgCiDhGiCmMjDgPjIfOiKnGiMfHiCmFiClBiCmMiKnGjAjEiCpAjAfGjAnNiClFiClNiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.10.26 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void MC2ObjGroup::RegisterObjForceID ()
{
	//----- _xZkqqHx_iDePiDiLiBfLiDhGjCiGiCmMiKgFjFjEjFgJiCpAiLkNjAkHjDgPjIfO_xHqqkZx_ -----
	MC2ObjBaseVector::const_iterator iObj;
	for (iObj = m_vObj.begin(); iObj != m_vObj.end(); iObj++)
		(*iObj)->RegisterObjForceID();
	// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeCiClBiClBiCmFiClBiCmMjFjEjFgJiOkJjAgHiCmMjDgPjIfOiCkKjAkMiClDiCoKiCoJiBeC_xHqqkZx_
	SUPER_CLASS::RegisterObjForceID();
} // MC2ObjGroup::RegisterObjForceID ().

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	UnregisterObjID
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iPeJjHlJiPiIjHjNiBeC_xHqqkZx_delete_xZkqqHx_jBePiCmJiOmAiNhDiClHiCoJiBeC_xHqqkZx_
 *************************************************************************/
void MC2ObjGroup::UnregisterObjID ()
{
	MC2ObjBaseVector::const_iterator iObj;
	for (iObj = m_vObj.begin(); iObj != m_vObj.end(); iObj++)
		(*iObj)->UnregisterObjID();

	SUPER_CLASS::UnregisterObjID();
} // MC2ObjGroup::UnregisterObjID.

