/*------------------------------------------------------------------------------*
 * File Name: IWBase.c	 														*
 * Creation: 																	*
 * Purpose:  base class for filter of import file								*
 * Copyright (c)2003 OriginLab Corp.											*
 * All Rights Reserved															*
 * 																				*
 * Modification Log:															*
 *	Hong 07/21/08 QA80-11869 FIX_FILTER_SCRIPT_FAIL_RUN_WHEN_DRAG_AND_DROP_EXCEPT_ASCII
 *------------------------------------------------------------------------------*/
 
#ifndef _IW_BASE_
#define _IW_BASE_

//#include <origin.h>
//#include <oFilterUtils.h> ///---Sim 08-02-2006// Hong 8/21/06 CLEAN_HEADER_FILE
//#include "fu_utils.h" ///---Sim 08-17-2006 REMOVE_TO_FU_UTILS

///---Sim 08-17-2006 REMOVE_TO_FU_UTILS
/*
enum {
	IMPERR_NONE = 0,
	IMPERR_NO_FILTER,
	IMPERR_LOAD_FILTER,
	IMPERR_NO_TARGET_PAGE,
	IMPERR_GET_IMPORT_FUNC,
	IMPERR_IMPORT_FUNC_ERR,
	IMPERR_PREPARE_WKS,
	IMPERR_IMPORT_MODE, ///---Sim 07-31-2006 ERR_HANDLE
	IMPERR_FILTER_TYPE,
	IMPERR_CANCEL_ON_LOCKED_COL,
	IMPERR_NO_DATA_FILE, /// EJP 2005-10-26 v8.0324 Qa70-7921 XFUNC_TO_IMPORT_FILES
	IMPERR_TARGET_PAGE_TYPE, /// EJP 2006-03-24 v8.0380 PRESERVE_ACTIVE_PAGE_AND_LAYER
	IMP_USER_CANCEL, /// Sim 07-28-2006 MORE_CODE
	IMPERR_IWCLASS_UNDEFINED, /// AW 
	IMPERR_UNSUUPORT_PAGE_TYPE, ///AW
};	
*/
///---END REMOVE_TO_FU_UTILS

///---Sim 08-17-2006 REMOVE_TO_FU_UTILS
/*
///---Sim 08-02-2006 COMMON_DEFINED
#define fuGetType(_tn)		fuGetInt(&_tn, IDE_FLT_TYPE, FILTER_TYPE_UNKNOWN)

#define fuIsRenameWks(_tn)							fuGetInt(&_tn, IDE_FLT_REN_WKS, FALSE)
#define fuIsRenameWorkbook(_tn)						fuGetFlag(&_tn, AI_FLAG_FNAME_TO_WKBK_NAME, FALSE)

#define fuGetOriginVersion(_tn)		fuGetDouble(&_tn, IDE_FLT_ORIGIN_VER, 7.5)

#define fuGetImportMode(_tn)			fuGetInt(&_tn, IDE_FLT_IMPORT_MODE, ASCIMP_MODE_REPLACE_DATA)

#define fuGetPlotID(_tn)					fuGetInt(&_tn, IDE_FLT_PLOT_TYPE, IDM_PLOT_LINE)
///---END COMMON_DEFINED
*/
///---Sim 08-17-2006 REMOVE_TO_FU_UTILS


class IWBase
{
public:
	/// Hong 04/12/07 v8.0599 ADD_REIMPORT_SUPPORT_FOR_IMP_WIZ
	//IWBase() {m_iFilterType = FILTER_TYPE_UNKNOWN} /// AW 08/03/06 MORE_ON_IW_IMPORT
	IWBase() 
	{
		m_iFilterType = FILTER_TYPE_UNKNOWN;
		m_bReimport = false;
	} 
	
	/// end ADD_REIMPORT_SUPPORT_FOR_IMP_WIZ
	~IWBase() {}
public:
	//int Execute(Layer& lyTarget, int nIndexFile, string& strFileName, TreeNode& tnInfo, TreeNode& trFilter, string& strGraphPage, int nIndexLayer);
	virtual int Execute(Layer& lyTarget, int nIndexFile, string& strFileName, TreeNode& tnInfo, TreeNode& trFilter);
	DataRange GetDatRange() { return m_orng; } /// /// AW 08/01/06 ADD_DATA_RANGE_IN_XF_IMPORT_FILE		
	/// AW 08/30/06 SUPPORT_MULTI_FILES_INXF
	virtual bool AddFile(LPCSTR strFullFileName, bool bSameFilter = true ) {return false; } ///---Sim 01-26-2007 VALUE_OF_SAME_FILTER_SHOULD_DEFAULT_IS_TRUE
	virtual void InitFileArray() {}
	/// ENDULTI_FILES_INXF
	
	/// Hong 04/12/07 v8.0599 ADD_REIMPORT_SUPPORT_FOR_IMP_WIZ
	void SetReimport(bool bReimport)
	{ m_bReimport = bReimport; }
	/// end ADD_REIMPORT_SUPPORT_FOR_IMP_WIZ
	
protected:
	
	virtual int ImportFile(Layer& lyTarget, int nFile, string& strFileName, TreeNode& trFilter, TreeNode& tnInfo, int nImportMode) 
		{ASSERT(FALSE); return IMPERR_IWCLASS_UNDEFINED;}
/// Hong 8/07/06 MOVE_TO_IMPWIZ_H
	/*		
/// AW 08/01/06 ADD_DATA_RANGE_IN_XF_IMPORT_FILE
	///---Sim 08-02-2006 GET_IMP_INFO_NEED_FILTER
	//virtual int GenerateImpInfo(string& strFileName, Layer& lyTarget, TreeNode& trImpInfo) 
	/// AW 08/03/06 MORE_ON_IW_IMPORT
	//virtual int GenerateImpInfo(string& strFileName, Layer& lyTarget, TreeNode& trFilter, TreeNode& trImpInfo) 
	virtual void GenerateImpInfo(string& strFileName, Page& pgTarget, TreeNode& trFilter, TreeNode& trImpInfo);
	///---END GET_IMP_INFO_NEED_FILTER
	//	{ASSERT(FALSE); return IMPERR_IWCLASS_UNDEFINED;}
	/// END MORE_ON_IW_IMPORT
		
	/// AW 08/03/06 MORE_ON_IW_IMPORT
	virtual int GetColNumberFromFilter(TreeNode &trFilter) {ASSERT(FALSE); return 0;}
	///---Sim 08-04-06 COMMON_FUNC_ON_BASE_CLASS
	virtual void SetColDesignations(Worksheet& wks, TreeNode& trFilter, int nFirstTargetCol, int nCols);
	virtual void SetColFormats(Worksheet& wks, TreeNode& trFilter, int nFirstTargetCol, int nCols);
	///---END COMMON_FUNC_ON_BASE_CLASS
	virtual int PrepareWksColsForImport(Layer &lyTarget, TreeNode &trFilter);
	virtual void RenameTarget(string& strFullFileName, Layer& lyTarget, Page& pgTarget, TreeNode &trFilter );
	virtual void SetPageInfo(Page& pgTarget, TreeNode &trFilter, string& strFileName);
	virtual BOOL ImportHeaderVars(StringArray& saVarNames, StringArray& saVarValues, LPCSTR lpcszDataFile, const TreeNode& tnFilter);
	virtual BOOL ImportFileNameVars(StringArray& saVarNames, StringArray& saVarValues, LPCSTR lpcszDataFile, const TreeNode& tnFilter);
	virtual void GetWksColInfo(Layer& lyTarget);
	virtual void SetWksColInfo(Page& pgTarget);
	*/
	/// end MOVE_TO_IMPWIZ_H
	virtual void SetDataRange(Page&pgTarget, TreeNode& trImpInfo);
/// Hong 8/07/06 MOVE_TO_IMPWIZ_H
//protected:
	//void SetPageLayer(Page& pgTarget, Layer& lyTarget, TreeNode &trFilter, string& strFileName, TreeNode& trImpInfo);
	//MORE_ON_IW_IMPORT
	/// end MOVE_TO_IMPWIZ_H
	
	/// Hong 07/21/08 QA80-11869 FIX_FILTER_SCRIPT_FAIL_RUN_WHEN_DRAG_AND_DROP_EXCEPT_ASCII
	virtual void	AfterImport(const Layer& lyTarget, LPCSTR lpszFileName, const TreeNode& trFilter, TreeNode& tnInfo);
	/// end FIX_FILTER_SCRIPT_FAIL_RUN_WHEN_DRAG_AND_DROP_EXCEPT_ASCII
protected:
	/// YuI 09/22/06
	//	DataRange m_orng;
	/// YuI 03/19/07 QA70-9503 MERGE_SELFCREATING_RANGE_INTO_COKPOLYRANGE
	//	SelfCreatingRange m_orng;
	DataRange m_orng;
	/// end MERGE_SELFCREATING_RANGE_INTO_COKPOLYRANGE
	/// end YuI
	/// AW 08/03/06 MORE_ON_IW_IMPORT
	int 		m_iFilterType;
	
	/// Hong 04/12/07 v8.0599 ADD_REIMPORT_SUPPORT_FOR_IMP_WIZ
	bool 	m_bReimport;
	/// end ADD_REIMPORT_SUPPORT_FOR_IMP_WIZ
	
	/// Hong 8/07/06 MOVE_TO_IMPWIZ_H
	//string 		m_strColDesig, m_strColFormat;
	//bool		m_bRepetitive; ///---Sim 08-04-2006 RECORD_COL_DESIG_FORMAT_REPETITIVE
	//Tree		m_trFile;
	/// end MOVE_TO_IMPWIZ_H
	/// END MORE_ON_IW_IMPORT
/// END ADD_DATA_RANGE_IN_XF_IMPORT_FILE
};




#endif //_IW_BASE_