#ifdef ACTIVE_EDITOR
 
#ifndef __CPASOBJ_HPP__
#define __CPASOBJ_HPP__
 
#include "stdafx.h"
#include <afxtempl.h>
 
#pragma warning(disable:4786)
 
#define HieFriend
#include "incSPO.h"
#undef HieFriend
 
 
/*#include "itf/EDTParam.hpp"*/
#include "itf/CPASObjB.hpp"
/*#include "itf/EDTSpec.hpp"*/
/*#include "itf/CPATemp.hpp"*/
 
 
#include "CPAMdfO.hpp"
 
#include "SCR.h"
 
/*class Evt_Editor;*/
class CPA_ObjectDLLBase;
class CPA_MainWorld;
 
/****************************************/
#ifndef CPA_EXPORT
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif
#endif
/****************************************/
 
 
/*=====================================================================*/
/* type name for super objects (constant)*/
#define C_szSuperObjectTypeName "SuperObject"
/*=====================================================================*/
 
typedef enum tdeTypeNotify_
{
	E_tn_BuildModifSection,
	E_tn_DeleteModifSection,
	E_tn_CancelModifSection,
	E_tn_BuildSection,
	E_tn_DeleteSection,
	E_tn_CancelSection,
}
tdeTypeNotify;
 
 
/*===========================================================================
*		Description:	class EDT_TemporarySO
*		Creation date:
*		Author:			Shaitan
*---------------------------------------------------------------------------
*		Revision date:                        Author:
*=========================================================================*/
class CPA_EXPORT CPA_SuperObject :	public CPA_ModifiableObject,
									public CPA_SuperObjectBase
{
 
private:
	/* object*/
	CPA_BaseObject		*m_p_oObject;
	CPA_ObjectDLLBase	*m_p_oObjectDLLInterface;
	/* Edition*/
	BOOL				 m_bEditProtected;
	tdeTypeSO			 m_eTypeSO;
	CPA_SuperObject		*m_pSuperObjectOwner;
	CString				 m_csModelName;
	BOOL				 m_bAxisDrawn;
	BOOL				 m_bCenterVisible;
 
public:
 
/*================ Constructors ===========================*/
 
    CPA_SuperObject (CPA_EditorBase *pEditor, HIE_tdxHandleToSuperObject hEngineSO, 
					 tdeSaveStatus eStatus, tdeTypeSO eTypeSO = C_NoType); 
 
	CPA_SuperObject (CPA_EditorBase *pEditor, tdeSaveStatus eStatus, tdeTypeSO eTypeSO);
 
    CPA_SuperObject (CPA_SuperObject &r_oSource);
 
    ~CPA_SuperObject(void);
 
 
/*================ Engine Struct ===========================*/
 
	void *	GetData		(void) { return GetStruct(); }
	long	GetDataType (void) { return HIE_C_ulSuperObject; }
 
	void SetSuperObjectStruct (HIE_tdxHandleToSuperObject hSupObj);
 
/*================ Members ===========================*/
 
	CPA_SuperObject *	GetSuperObjectOwner (void)		{ return m_pSuperObjectOwner; }
	tdeTypeSO			GetTypeSO			(void)		{ return m_eTypeSO; }
	CString				GetModelName		(void)		{ return m_csModelName; }
	BOOL				fn_bIsAxisDrawn		(void)		{ return m_bAxisDrawn; }
	BOOL				fn_bIsCenterVisible	(void)		{ return m_bCenterVisible; }
/*ANNECY CO SPOFLAG 05/02/98*/
	virtual BOOL		fn_bIsEditProtected (void)		{ return m_bEditProtected; }
/*ENDANNECY CO SPOFLAG*/
 
	void SetSuperObjectOwner (CPA_SuperObject *pOwner)	{ m_pSuperObjectOwner = pOwner; }
	void SetModelName		 (CString csName)			{ m_csModelName = csName; }
	void SetEditProtected	 (BOOL bProtected)			{ m_bEditProtected = bProtected; }
	void SetDrawnAxis		 (BOOL bFlag)				{ m_bAxisDrawn = bFlag; }
	void SetCenterVisible	 (BOOL bFlag)				{ m_bCenterVisible = bFlag; }
	BOOL SetTypeSO			 (tdeTypeSO eType);
 
/*================ Object & Type ===========================*/
 
	CPA_ObjectDLLBase * GetObjectDLL	(void) { return m_p_oObjectDLLInterface; }
	CPA_BaseObject	  *	GetObject		(void) { return m_p_oObject; }
 
	CString				GetRealTypeName	(void);
	long				GetObjectType	(void);
 
	void SetObject (CPA_BaseObject  *p_oNewObject);
 
/*================ Hierarchy ===========================*/
 
	CPA_SuperObject * GetSuperObjectFirstChild (void);
	CPA_SuperObject * GetSuperObjectLastChild (void);
	CPA_SuperObject * GetSuperObjectNextChild (CPA_SuperObject *pChild);
	CPA_SuperObject * GetSuperObjectPrevChild (CPA_SuperObject *pChild);
	CPA_SuperObject * GetSuperObjectFather (void);
 
	BOOL fn_bIsUnderObject (CPA_SuperObject *pEdObj);
 
	void AddANewChild		(CPA_SuperObject *pChild, BOOL bUpdateEngine = TRUE, CPA_SuperObject *pNextBrother = NULL);
	void RemoveAChild		(CPA_SuperObject *pChild, BOOL bUpdateEngine = TRUE);
	void RemoveAllChilds	(BOOL bUpdateEngine = TRUE);
	void IsolateChild		(BOOL bUpdateEngine = TRUE);
	
	void fn_vUpdateValidity (BOOL bValid);
 
/*================ Inits ===========================*/
 
	static void fn_vInitLoadEditor();
 
/*================ Save object ===========================*/
 
	virtual BOOL fn_bCanBeNotified (void) { return FALSE; }
 
	virtual tdeMissingCriteria fn_eCheckValidity (const CString csNewName) 
	{ return fn_eCheckUnicity(csNewName); }
 
	virtual void fn_vNotifySave		(void) { };
	virtual void fn_vNotifyUnSave	(void) { };
	virtual void fn_vNotifyRestore	(void) { };
	virtual void fn_vNotifyRename	(void) { };
 
	virtual void fn_vUpdateReference (CPA_SaveObject *pReferencedObject) { };
	
	virtual void fn_vUpdateSectionName (void) { };
 
	virtual CString fn_csComputeReferencedSectionName (const CString csNewName) 
	{ return GetReferencedSectionName(); }
 
/*================ Modifiable object ===========================*/
 
	virtual void fn_vSetOnState		(const CString _ocsModificationType, BOOL _bOnInitialState) { };
    virtual void fn_vValidateState	(const CString _ocsModificationType, BOOL bInitialState) { };
 
};
 
 
#endif /*__CPASOBJ_HPP__*/
 
#endif /*ACTIVE_EDITOR*/
