#include "stdafx.h"
#include "3RichText.h"		// For MC3RichText.
#include "3UtilMath.h"		// For mmroundoff.
#include "3Env.h"			// For FD_PEN_REGISTER_UNUSE,etc.
#include "3ObjFigure.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 MC3ObjBase

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	MC3ObjFigure::MC3ObjFigure
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDhEiDeAiDeDiDiLjDmHiCnNiNjOiCnNjHhAiDfCiDjDiDfIiDgHiDiJiDeOiDfOiBeC_xHqqkZx_InStream_xZkqqHx_iCmFiPiJiKpKiJlLiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	_xZkqqHx_jGlDiClF_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	98.11.16 Fukushiro M. _xZkqqHx_jFmPjAjEiCmMiPiJiKpKiJlLiCpAjCmHiJmB_xHqqkZx_.Tool_xZkqqHx_iCmFjAlGjAkMiClDiCoKiClNiOjOiCmMiInH_xHqqkZx_.
 *************************************************************************/
MC3ObjFigure::MC3ObjFigure ()
{
//----- 01.07.11 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
	// memcmp_xZkqqHx_iCmFiDeJiDhFiDfHiDeGiDeOiDgHjEoEiKhCiCpAiClHiCoJiClNiCnPiBeBiNfMjBkCjBmMiDeNiDiDiDgCiDhGiCoAjBfDiCmEiCePiCmFjGiEiCnPiCoJiBeC_xHqqkZx_
	ASSERT(ALIGNMENT4(sizeof(SUPER_CLASS)) == offsetof(MC3ObjFigure, m_pridPenRegister));
	memset(&m_pridPenRegister, 0, sizeof(MC3ObjFigure) - offsetof(MC3ObjFigure, m_pridPenRegister));
	//----- _xZkqqHx_iDiBiDjDiDgPjFmPjAjEiCpAiDgGiDhEiDeIiDiLiDgHjCgMiCmJiPiJiKpKiJlL_xHqqkZx_ -----
	m_pridPenRegister		= FD_PEN_REGISTER_UNUSE;
	m_psidPenStyle			= 0;
	m_mmfPenWeight			= (fmmetol)mmroundoff(0.5);
	m_scidPenBackSColor		= FD_S_COLOR_BLACK;
	m_bridBrushRegister		= FD_BRUSH_REGISTER_UNUSE;
	m_scidBrushForeSColor	= FD_S_COLOR_UNUSE;
	m_ptidBrushPattern		= FD_PATTERN_UNUSE;
	m_scidBrushBackSColor	= FD_S_COLOR_UNUSE;
	m_scidShadowSColor		= FD_S_COLOR_UNUSE;
	m_byEMFHorzMap			= FDOF_EMFMAP_HORZ_SIZE;
	m_byEMFVertMap			= FDOF_EMFMAP_VERT_SIZE;
	m_emidEmfImage			= FD_EMF_IMAGE_UNUSE;
	m_byArrowFType			= FDUG_ARW_TYPE_FLAT;
	m_byArrowFParam0		= 0;
	m_byArrowFParam1		= 0;
	m_byArrowFParam2		= 0;
	m_byArrowBType			= FDUG_ARW_TYPE_FLAT;
	m_byArrowBParam0		= 0;
	m_byArrowBParam1		= 0;
	m_byArrowBParam2		= 0;
	m_wPictArrowF			= 0;
	m_wPictArrowB			= 0;
	m_pRichText = NULL;
} // MC3ObjFigure::MC3ObjFigure.

//----- 05.06.13 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	MC3ObjFigure::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 MC3ObjFigure::IsKindOf (FTObjectType nType) const
//{
//	if (nType == FDOJ_FIGURE) return TRUE;
//	return SUPER_CLASS::IsKindOf(nType);
//} // MC3ObjFigure::IsKindOf.
//----- 05.06.13 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	MC3ObjFigure::OutStream
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFjEjFgJiCmMiPpDjBnEiCpAiDfIiDgHiDiKiBfLiDiAiCmJiPjBiCkLiPgPiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	ar	: _xZkqqHx_iPjBiCkLiPgPiClFjHhAiCmM_xHqqkZx_MCARCHIVE
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.03.03 Fukushiro M. CArchive_xZkqqHx_iCpA_xHqqkZx_MCARCHIVE_xZkqqHx_iCmJiPeDjAlDiBeC_xHqqkZx_
 *************************************************************************/
void MC3ObjFigure::OutStream (MCARCHIVE& ar)
{
	SUPER_CLASS::OutStream(ar);

	ar << m_pridPenRegister;		// _xZkqqHx_iDhJiDjDiCmMjDgPjIfOjGlMiBeC_xHqqkZx_2Byte_xZkqqHx_iBeC_xHqqkZx_
	ar << m_scidPenBackSColor;		// _xZkqqHx_iDhJiDjDiCmMjBePiMgJjAeGiBeC_xHqqkZx_2Byte_xZkqqHx_iBeC_xHqqkZx_
	ar << m_mmfPenWeight;			// _xZkqqHx_iDhJiDjDiCmMjFjNiBeC_xHqqkZx_4Byte_xZkqqHx_iBeC_xHqqkZx_
	ar << m_psidPenStyle;			// _xZkqqHx_iDhJiDjDiCmMiDfIiDfOiDeDiDiLiBeCjClMjApM_xHqqkZx_,_xZkqqHx_jDfPjApM_xHqqkZx_,etc_xZkqqHx_iBeC_xHqqkZx_2Byte_xZkqqHx_iBeC_xHqqkZx_
	ar << m_scidShadowSColor;		// _xZkqqHx_iJgFiCmMjAeGiBeC_xHqqkZx_2Byte_xZkqqHx_iBeC_xHqqkZx_
	ar << m_bridBrushRegister;		// _xZkqqHx_iDhFiDiJiDfGiCmMjDgPjIfOjGlMiBeC_xHqqkZx_2Byte_xZkqqHx_iBeC_xHqqkZx_
	ar << m_scidBrushForeSColor;	// _xZkqqHx_iDhFiDiJiDfGiCmMjBePiMgJjAeGiBeC_xHqqkZx_2Byte_xZkqqHx_iBeC_xHqqkZx_
	ar << m_scidBrushBackSColor;	// _xZkqqHx_iDhFiDiJiDfGiCmMjEhHiMgJjAeGiBeC_xHqqkZx_2Byte_xZkqqHx_iBeC_xHqqkZx_
	ar << m_ptidBrushPattern;		// _xZkqqHx_iDhFiDiJiDfGiCmMiDhAiDfOiBfLiDjDiBeC_xHqqkZx_2Byte_xZkqqHx_iBeC_xHqqkZx_
	ar << m_byEMFHorzMap;			// _xZkqqHx_iDiBiDfOiDhEiDeAiDeDiDiLiCmMjAiFjFlNjFpLiMpMiCmMiDhNiDgCiDhGjFpLjGeAiBeC_xHqqkZx_1Byte_xZkqqHx_iBeC_xHqqkZx_
	ar << m_byEMFVertMap;			// _xZkqqHx_iDiBiDfOiDhEiDeAiDeDiDiLiCmMjAiCjClMjFpLiMpMiCmMiDhNiDgCiDhGjFpLjGeAiBeC_xHqqkZx_1Byte_xZkqqHx_iBeC_xHqqkZx_
	ar << m_emidEmfImage;			// _xZkqqHx_iDiBiDfOiDhEiDeAiDeDiDiLiCmMjDgPjIfOjGlMiBeC_xHqqkZx_2Byte_xZkqqHx_iBeC_xHqqkZx_
	ar << m_wArrowFForStream;		// _xZkqqHx_iDfIiDgHiDiKiBfLiDiAjHhAiBeC_xHqqkZx_
	ar << m_wArrowBForStream;		// _xZkqqHx_iDfIiDgHiDiKiBfLiDiAjHhAiBeC_xHqqkZx_
	if (g_nVersion == 4)
	//----- Version4.x_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
	{
		ar << WORD(0);					// _xZkqqHx_iDgFiDeMiDfIiDgHjCmHiPfNiDiKiDfEiDeDiDfJiClHiCoJiCkJiBeI_xHqqkZx_
	}
	if (m_pRichText != NULL)
	//----- RichText_xZkqqHx_iCkKiCkAiCoJiPoKiNiH_xHqqkZx_ -----
	{
		ar << BYTE(0x01);
		m_pRichText->OutStream(ar);
	} else
	//----- RichText_xZkqqHx_iCkKjGlDiCkCiPoKiNiH_xHqqkZx_ -----
	{
		ar << BYTE(0x00);
	}
} // MC3ObjFigure::OutStream.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	MC3ObjFigure::InStream
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFjEjFgJiCmMiPpDjBnEiCpAiDfIiDgHiDiKiBfLiDiAiCkJiCoHjDmHiCnNiNjOiCnOiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	ar	: _xZkqqHx_jDmHiCnNiNjOiCnNjHhAiCmM_xHqqkZx_MCARCHIVE
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.03.03 Fukushiro M. CArchive_xZkqqHx_iCpA_xHqqkZx_MCARCHIVE_xZkqqHx_iCmJiPeDjAlDiBeC_xHqqkZx_
 *************************************************************************/
void MC3ObjFigure::InStream (MCARCHIVE& ar)
{
	SUPER_CLASS::InStream(ar);

	ar >> m_pridPenRegister;		// _xZkqqHx_iDhJiDjDiCmMjDgPjIfOjGlMiBeC_xHqqkZx_2Byte_xZkqqHx_iBeC_xHqqkZx_
	ar >> m_scidPenBackSColor;		// _xZkqqHx_iDhJiDjDiCmMjBePiMgJjAeGiBeC_xHqqkZx_2Byte_xZkqqHx_iBeC_xHqqkZx_
	ar >> m_mmfPenWeight;			// _xZkqqHx_iDhJiDjDiCmMjFjNiBeC_xHqqkZx_4Byte_xZkqqHx_iBeC_xHqqkZx_
	ar >> m_psidPenStyle;			// _xZkqqHx_iDhJiDjDiCmMiDfIiDfOiDeDiDiLiBeCjClMjApM_xHqqkZx_,_xZkqqHx_jDfPjApM_xHqqkZx_,etc_xZkqqHx_iBeC_xHqqkZx_2Byte_xZkqqHx_iBeC_xHqqkZx_
	ar >> m_scidShadowSColor;		// _xZkqqHx_iJgFiCmMjAeGiBeC_xHqqkZx_2Byte_xZkqqHx_iBeC_xHqqkZx_
	ar >> m_bridBrushRegister;		// _xZkqqHx_iDhFiDiJiDfGiCmMjDgPjIfOjGlMiBeC_xHqqkZx_2Byte_xZkqqHx_iBeC_xHqqkZx_
	ar >> m_scidBrushForeSColor;	// _xZkqqHx_iDhFiDiJiDfGiCmMjBePiMgJjAeGiBeC_xHqqkZx_2Byte_xZkqqHx_iBeC_xHqqkZx_
	ar >> m_scidBrushBackSColor;	// _xZkqqHx_iDhFiDiJiDfGiCmMjEhHiMgJjAeGiBeC_xHqqkZx_2Byte_xZkqqHx_iBeC_xHqqkZx_
	ar >> m_ptidBrushPattern;		// _xZkqqHx_iDhFiDiJiDfGiCmMiDhAiDfOiBfLiDjDiBeC_xHqqkZx_2Byte_xZkqqHx_iBeC_xHqqkZx_
	ar >> m_byEMFHorzMap;			// _xZkqqHx_iDiBiDfOiDhEiDeAiDeDiDiLiCmMjAiFjFlNjFpLiMpMiCmMiDhNiDgCiDhGjFpLjGeAiBeC_xHqqkZx_1Byte_xZkqqHx_iBeC_xHqqkZx_
	ar >> m_byEMFVertMap;			// _xZkqqHx_iDiBiDfOiDhEiDeAiDeDiDiLiCmMjAiCjClMjFpLiMpMiCmMiDhNiDgCiDhGjFpLjGeAiBeC_xHqqkZx_1Byte_xZkqqHx_iBeC_xHqqkZx_
	ar >> m_emidEmfImage;			// _xZkqqHx_iDiBiDfOiDhEiDeAiDeDiDiLiCmMjDgPjIfOjGlMiBeC_xHqqkZx_2Byte_xZkqqHx_iBeC_xHqqkZx_
	ar >> m_wArrowFForStream;		// _xZkqqHx_iDfIiDgHiDiKiBfLiDiAjHhAiBeC_xHqqkZx_
	ar >> m_wArrowBForStream;		// _xZkqqHx_iDfIiDgHiDiKiBfLiDiAjHhAiBeC_xHqqkZx_
	if (g_nVersion == 4)
	//----- Version4.x_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
	{
		WORD wWork;
		ar >> wWork;					// _xZkqqHx_iDgFiDeMiDfIiDgHjCmHiPfNiDiKiDfEiDeDiDfJiClHiCoJiCkJiBeI_xHqqkZx_
	}

	BYTE byIsRTF;
	ar >> byIsRTF;
	if (byIsRTF)
	//----- RichText_xZkqqHx_iCkKiCkAiCoJiPoKiNiH_xHqqkZx_ -----
	{
		if (m_pRichText == NULL)
			m_pRichText = new MC3RichText();
		m_pRichText->InStream(ar);
	} else
	//----- RichText_xZkqqHx_iCkKjGlDiCkCiPoKiNiH_xHqqkZx_ -----
	{
		if (m_pRichText != NULL)
		{
			delete m_pRichText;
			m_pRichText = NULL;
		}
	}
} // MC3ObjFigure::InStream.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	MC3ObjFigure::~MC3ObjFigure
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgGiDfIiDgHiDiJiDeOiDfO_xHqqkZx_
 *************************************************************************/
MC3ObjFigure::~MC3ObjFigure ()
{
	if (m_pRichText != NULL)
	{
		delete m_pRichText;
		m_pRichText = NULL;
	}
} // MC3ObjFigure::~MC3ObjFigure.

