/*------------------------------------------------------------------------------*
 * File Name: WizOperation.h													*
 * Creation: Sim 12-08-2008														*
 * Purpose: OriginC Source C file												*
 * Copyright (c) ABCD Corp.	2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010		*
 * All Rights Reserved															*
 * 																				*
 * Modification Log:															*
 *	Folger 03/11/09 QA80-13265 LAST_REPORT_LT_STRING_FOR_ALL_PA_GOALS_EXCEPT_FITTING
 *	Folger 03/27/09 ERPLOT_GRAPH_IS_NOT_SUPPORTED_FOR_PA_REPORT_SHEET			*
 *	Folger 08/07/09 QA80-13998 SUPPORT_GET_GOAL_AND_FITTING_REPORT_GRAPH_UID_FROM_PAWIZMANAGER
 *	Folger 08/07/09 QA80-13998-P1 OUTPUT_RANGE_LT_STRING_FAILS_TO_UPDATE_WHEN_RUN_PA_WITHOUT_AUTOUPDATE
 *	Sim 01-07-2009 QA81-14898 SHOW_GUI_SETTINGS_FOR_XFWIZ_OPERATION				*
 *------------------------------------------------------------------------------*/

#ifndef __XF_WIZ_OP_H__
#define __XF_WIZ_OP_H__

///---Sim 02-11-2009 FIX_WIZ_OPERATION_LABEL
#include <Operation.h>
#include "wksOperation.h" //---- CPY 10/14/06 SEPARATE_OUT_OPERATION_BASE_INTO_SEPARATE_HEADER
///---END FIX_WIZ_OPERATION_LABEL

///---Sim 01-13-2009 XFWIZ_CHANGE_PARAM_MAY_CHANGE_THEME_AND_IO_RANGE
#include <..\OriginLab\XFWiz.h>

//typedef	int		(*PFNDoWizOp)(DWORD dwOPUID, TreeNode &tnWizTheme, TreeNode &tnWizIOs, LPCSTR lpcszWizFuncFile, LPCSTR lpcszWizFunc);
///---END XFWIZ_CHANGE_PARAM_MAY_CHANGE_THEME_AND_IO_RANGE


enum {
	WIZOPH_EXECUTE					= 1,
	WIZOPH_SHOW_MODELESS_WIZDLG,
	WIZOPH_DO_CHANGE_PARAMS_WIZDLG,
	WIZOPH_SHOW_WIZDLG_GUI, ///---Sim 01-07-2009 QA81-14898 SHOW_GUI_SETTINGS_FOR_XFWIZ_OPERATION
};

//#define STR_WIZ_OP_FILE "Originlab\\WizOperation.cpp"
//#define STR_WIZ_OP_FUNC "DoWizardOperation"
///---Sim 01-13-2009 XFWIZ_CHANGE_PARAM_MAY_CHANGE_THEME_AND_IO_RANGE
//int		DoWizardOperation(DWORD dwOPUID, TreeNode &tnWizTheme, TreeNode &tnWizIOs, LPCSTR lpcszWizFuncFile, LPCSTR lpcszWizFunc);
///---Sim 02-11-2009 FIX_WIZ_OPERATION_LABEL
//int		DoWizardOperation(const XFWizTheme *pXFWizTheme, const XFWizInputOutputRange *pXFWizIO, LPCSTR lpcszWizFuncFile, LPCSTR lpcszWizFunc, DWORD dwOPUID = 0);
int		DoWizardOperation(const XFWizTheme *pXFWizTheme, const XFWizInputOutputRange *pXFWizIO, LPCSTR lpcszWizFile, LPCSTR lpcszWizFunc, LPCSTR lpcszWizOPClass, DWORD dwOPUID = 0);
///---END FIX_WIZ_OPERATION_LABEL
///---END XFWIZ_CHANGE_PARAM_MAY_CHANGE_THEME_AND_IO_RANGE

///---Sim 12-09-2008 QA80-12741 OPERATION_UNPROTECT_IO_RANGE_IN_EXEC_TIME_OF_CHANGE_PARAM_FUNC
////------ Folger 11/13/08 QA80-12488 v8.970 PROPER_HANDING_ABOUT_WIZARD_OPERATION_EXECUTE_HELPER
//void	DestroyWizardOperationExecuteHelper(DWORD dwOPUID);
////------
///---END QA80-12741 OPERATION_UNPROTECT_IO_RANGE_IN_EXEC_TIME_OF_CHANGE_PARAM_FUNC

///---Sim 02-11-2009 FIX_WIZ_OPERATION_LABEL
// This is the prototype of the custom function which general wizard operation code should call to execute the analysis
// or to show dlg for ChangeParams.
///---Sim 01-13-2009 XFWIZ_CHANGE_PARAM_MAY_CHANGE_THEME_AND_IO_RANGE
//typedef	int		(*PFNRUNWIZ)(UINT msg, TreeNode &tnWizTheme, TreeNode &tnWizIOs, DWORD dwOPUID, int nExeMode);
typedef	int		(*PFNRUNWIZ)(UINT msg, const XFWizTheme *pXFWizTheme, const XFWizInputOutputRange *pXFWizIO, DWORD dwOPUID, int nExeMode);

///---END XFWIZ_CHANGE_PARAM_MAY_CHANGE_THEME_AND_IO_RANGE
//////////////////////////////////////////////////////////////////////////
// class WizOperation
//////////////////////////////////////////////////////////////////////////
class OC_REGISTERED WizOperation	:	public	WksReportOperation
{
public:
	WizOperation();
	~WizOperation();

public:
	// virtual
	///---Sim 01-13-2009 XFWIZ_CHANGE_PARAM_MAY_CHANGE_THEME_AND_IO_RANGE
	//BOOL	SetThemeInputsOutputs(TreeNode &theme, TreeNode &trInputsOutputs, LPCSTR lpcszWizFuncFile, LPCSTR lpcszWizFunc, BOOL bOnRecalc);
	BOOL	SetThemeInputsOutputs(const XFWizTheme *pXFWizTheme, const XFWizInputOutputRange *pXFWizIO, LPCSTR lpcszWizFuncFile, LPCSTR lpcszWizFunc, BOOL bOnRecalc);
	///---END XFWIZ_CHANGE_PARAM_MAY_CHANGE_THEME_AND_IO_RANGE
	
	///---Sim 12-09-2008 QA80-12741 OPERATION_UNPROTECT_IO_RANGE_IN_EXEC_TIME_OF_CHANGE_PARAM_FUNC
	////------ Folger 11/13/08 QA80-12488 v8.970 PROPER_HANDING_ABOUT_WIZARD_OPERATION_EXECUTE_HELPER
	//void	DestroyExecuteHelper();
	////------
	///---END QA80-12741 OPERATION_UNPROTECT_IO_RANGE_IN_EXEC_TIME_OF_CHANGE_PARAM_FUNC
	
	///------ Folger 03/27/09 ERPLOT_GRAPH_IS_NOT_SUPPORTED_FOR_PA_REPORT_SHEET
	/// virtual
	bool	IsReplotGraphsSupported()			{ return false; }
	///------ End ERPLOT_GRAPH_IS_NOT_SUPPORTED_FOR_PA_REPORT_SHEET

	///------ Folger 08/07/09 QA80-13998 SUPPORT_GET_GOAL_AND_FITTING_REPORT_GRAPH_UID_FROM_PAWIZMANAGER
	TreeNode	GetWizThemeTree();
	///------ End SUPPORT_GET_GOAL_AND_FITTING_REPORT_GRAPH_UID_FROM_PAWIZMANAGER
	
protected:
	// virtual
	int		ChangeParam();
	
	// virtual
	BOOL	executeWithRange(int nExeMode = OEXEM_ON_CREATE, DWORD dwExecCntrl = 0);

	// virtual
	bool	updateTreeBeforeRunning(TreeNode &trOp, BOOL bLocalize = FALSE);
	
	void	ClearAllInputOutput();
	///---Sim 01-13-2009 XFWIZ_CHANGE_PARAM_MAY_CHANGE_THEME_AND_IO_RANGE
	bool	SetRange(XFWizInputOutputRange *pXFWizIO, LPCSTR lpcszXFName, bool bInput, int& nIndex);
	///---END XFWIZ_CHANGE_PARAM_MAY_CHANGE_THEME_AND_IO_RANGE
	
	///---Sim 01-07-2009 QA81-14898 SHOW_GUI_SETTINGS_FOR_XFWIZ_OPERATION
	int		ShowWizGUI();
	///---END QA81-14898 SHOW_GUI_SETTINGS_FOR_XFWIZ_OPERATION

private:
	//BOOL	GetThemeInputsOutputs(Tree &theme, TreeNode &trInputsOutputs);
	//BOOL	GetThemeInputsOutputs(TreeNode &theme, TreeNode &trInputsOutputs);
	
	BOOL		GetExternalNodes(Tree &trOp, TreeNode &tnTheme, TreeNode &tnInputsOutputs, TreeNode &tnWizInfo, BOOL bCreate = FALSE);
	PFNRUNWIZ	GetRunWiz(TreeNode &tnWizInfo);

	///---Sim 12-09-2008 QA80-12741 OPERATION_UNPROTECT_IO_RANGE_IN_EXEC_TIME_OF_CHANGE_PARAM_FUNC
	////------ Folger 11/13/08 QA80-12488 v8.970 PROPER_HANDING_ABOUT_WIZARD_OPERATION_EXECUTE_HELPER
//private:
	//
	//OnBeforeAfterExecuteHelper*		m_pExecuteHelper;
	////------ End PROPER_HANDING_ABOUT_WIZARD_OPERATION_EXECUTE_HELPER
	///---END QA80-12741 OPERATION_UNPROTECT_IO_RANGE_IN_EXEC_TIME_OF_CHANGE_PARAM_FUNC
	///---Sim 01-15-2009 QA80-12969 TEMP_FIX_RUN_XFWIZ_OP_ON_TEMPLATE_BOOK
	void updateInputOutputUID(TreeNode &trInputsOutputs, const XFWizTheme &objXFWizTheme);
	///---END QA80-12969 TEMP_FIX_RUN_XFWIZ_OP_ON_TEMPLATE_BOOK
	
	///------ Folger 08/07/09 QA80-13998-P1 OUTPUT_RANGE_LT_STRING_FAILS_TO_UPDATE_WHEN_RUN_PA_WITHOUT_AUTOUPDATE
	/////------ Folger 03/11/09 QA80-13265 LAST_REPORT_LT_STRING_FOR_ALL_PA_GOALS_EXCEPT_FITTING
	//virtual	void updateOutputsGlobalRangeStrings(Array<DataRange&>& arrOutputs, LPCSTR lpcszXFName)			{ ASSERT(false); }
	/////------ End LAST_REPORT_LT_STRING_FOR_ALL_PA_GOALS_EXCEPT_FITTING
	///------ End OUTPUT_RANGE_LT_STRING_FAILS_TO_UPDATE_WHEN_RUN_PA_WITHOUT_AUTOUPDATE
};
///---END FIX_WIZ_OPERATION_LABEL

#endif		//__XF_WIZ_OP_H__

