/*#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
*/
#include "ITF.h"
 
#include "EdtList.hpp"
 
/*TODO-B 28/02/97: define this when the coherence manager is fully available*/
#define D_UseCoherenceManager
#if defined ( D_UseCoherenceManager )
#include "ITF\cohemngr.hpp"
#endif /* D_UseCoherenceManager */
 
#ifndef __CPANLL_HPP__
#define __CPANLL_HPP__
 
class EdActors_EditorActor;
 
#if !defined(enum_tdeUpdateReason)
#define enum_tdeUpdateReason
typedef enum tdeUpdateReason_
{
 E_ur_NoReasonGiven = 0,
 E_ur_ButtonClicked,
 E_ur_ComboSelChanged,
 E_ur_ModelChangedNameList,
 E_ur_ModelEditedNameList,
 E_ur_InstanciatedFromModel
 
} tdeUpdateReason;
#endif /* enum_tdeUpdateReason */
 
typedef enum tdeShareMode_
{
 E_sm_FirstShareMode,
 E_sm_Common = E_sm_FirstShareMode,
 E_sm_Shared,
 E_sm_Virge,
 E_sm_LastShareMode = E_sm_Virge,
 E_sm_None
} tdeShareMode;
 
class tdoObjectName : public CPA_BaseObject
{
public:
 tdoObjectName &operator =(CString &r_csString);
 tdoObjectName(
  CPA_BaseObject *p_oOwner, /*the owner name list*/
  CString oName = "",
  tdeShareMode eMode = E_sm_None
 );
 tdoObjectName(tdoObjectName *p_oOriginalName);
 ~tdoObjectName() {};
 /* Virtual functions of CPA_BaseObject*/
 long GetDataType ()  { return 0; }
 void * GetData ()    { return NULL; }
 /*this one is pure: we have to overload it to be able to instanciate the class...*/
 static void StaticInit();
 void m_vSetShareMode(tdeShareMode eNewMode) { m_eShareMode = eNewMode; }
 tdeShareMode m_eGetShareMode() { return m_eShareMode; }
 tdeMissingCriteria fn_eCheckUnicity(const CString _csNewName)      { return fn_eCheckUnicityWithOwner(_csNewName); }
protected:
private:
 tdeShareMode m_eShareMode;
 
};
 
/*==========================================================
Class name:		CPA_tdoNameList
Description:	List of names
Author:			Benoit Germain
Date:			february 14, 1997
Revision:
==========================================================*/
class CPA_tdoNameList : public CPA_SaveObject, public CPA_List<tdoObjectName>
{
private:
    CPA_SectionObject   *m_p_oLevelSection;
    CPA_SectionObject   *m_p_oNamesSection;
public:
	/* Constructor*/
	CPA_tdoNameList(
		/*EdActors_EditorActor	*p_oCreatorEditorActor,*/
		CString csObjectType,
		CPA_BaseObject *p_oOwner,
        BOOL bSectionExist,
		CString csName = "" /*MT 17/04/97 plus de fichier ni de section*/
	);
	/*  Destructor*/
	~CPA_tdoNameList();
	static void StaticInit();
 
    /* Virtual functions of CPA_BaseObject*/
    long GetDataType ()  { return 0; }
    void * GetData ()    { return NULL; }
 
    tdeMissingCriteria  fn_eCheckUnicity( const CString csNewName );
 
    void fn_vNotifySave     (void);
    void fn_vNotifyUnSave   (void);
    void fn_vNotifyRestore  (void);
    void fn_vNotifyRename   (void);
 
	short m_wGetIndexOfName(CString csNameToFind);
 
	/* handler of the object lists associated to the name list.*/
	EdtListHandler	        *m_pEdtListHandler;
	void m_vDisplayChildLists(BOOL bNewValue = TRUE) { m_bDisplayChildObjectLists = bNewValue; }
	BOOL m_bGetChildListsDisplay() { return m_bDisplayChildObjectLists; }
	BOOL m_bIsNameValid(CString csName);
 
    /* CallBack loading*/
    static SCR_tde_Anl_ReturnValue m_fne_CallBackLoad( SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction );
    static SCR_tde_Anl_ReturnValue m_fne_CallBackLoadOnLevel( SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction );
    static SCR_tde_Anl_ReturnValue m_fne_CallBackLoadNamesList( SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction );
    static SCR_tde_Anl_ReturnValue m_fne_CallBackLoadSubSection( SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction );
 
    /* CallBack Saving*/
    static void m_fnv_CallBackSave( SCR_tdst_File_Description *_p_stFile, char *_p_szSectionName, void *_p_vData, SCR_tde_Ntfy_Action _eAction);
    static void m_fnv_CallBackSaveNamesList( SCR_tdst_File_Description *_p_stFile, char *_p_szSectionName, void *_p_vData, SCR_tde_Ntfy_Action _eAction); /* unused*/
    static void m_fnv_CallBackSaveAddENL( SCR_tdst_File_Description *_p_stFile, char *_p_szSectionName, void *_p_vData, SCR_tde_Ntfy_Action _eAction);
    /**/
    /* load & save section on family File*/
	
	
    /* load & save section on level File*/
    
    
	BOOL m_bHasAVirgeField();
	BOOL m_bHasACommonField();
	unsigned long m_ulGetNumberOfVirgeFields();
    void fn_vUpdateReference (CPA_SaveObject *pReferencedObject);
/* ALX*/
    void m_fnv_SetDefaultZA(CPA_BaseObject *_p_oZA)        { m_p_oDefaultZA = _p_oZA; }
    CPA_BaseObject* m_fnp_oGetDefaultZA()                  { return m_p_oDefaultZA; }
protected:
    CPA_SaveObject *m_fnp_oCreateNewZA(char *_szSectionName);
    CPA_SaveObject *m_fnp_oCreateNewZAList(char *_szSectionName);
    EdtList             *m_fnp_oCreateNewZoneList(char* _szSectionName);
 
private:
    /*EdActors_EditorActor    *m_p_oCreatorEditorActor;*/
    BOOL                    m_bDisplayChildObjectLists;
    CPA_BaseObject     *m_p_oDefaultZA;
};
 
#define M_bIsListNameValidForFamily(csName, p_oFamily) \
 (!g_pclInterface->GetMainWorld()->fn_bExist(csName, "", p_oFamily))
 
#endif
