#include <origin.h>
#include <GetNBox.h>
#include <xfutils.h>
enum{
	type_right,
	type_downright,
	type_down,
	type_downleft,
	type_left,
	type_upleft,
	type_up,
	type_upright,
};
#include <event_utils.h>

void insertArrow(const int& type, Range& orng)
{
	Worksheet wks;
	int r1,r2,c1,c2;
	///Jasmine 06/18/07 IMPROVE_ERROR_CHECKING
	/*
	orng.GetRange(0, r1, c1, r2, c2, wks);//must one cell
	if(!wks)
		XF_THROW(XFERR_INVALID_ARG); 
	*/
	///---Sim 12-14-2007 FIX_CHECK_RANGE_ERR_MSG
	//if(!orng || !orng.GetNumData() || !orng.GetRange(0, r1, c1, r2, c2, wks) || !wks)
		//XF_THROW_EX(XFERR_INVALID_MSG, _L("Output cell"));
	int nErr = check_1_cell(orng);
	if(nErr != CER_NO_ERROR)
	{
		if(CER_NO_DATA == nErr)
			XF_THROW(CER_INVALID_RANGE);
		XF_THROW(nErr);
	}
	orng.GetRange(0, r1, c1, r2, c2, wks);
	///---END FIX_CHECK_RANGE_ERR_MSG
	////End IMPROVE_ERROR_CHECKING
	vector<string> vsArrows = {"ArrowRight", "ArrowDownRight", "ArrowDown", "ArrowDownLeft", "ArrowLeft", "ArrowUpLeft", "ArrowUp", "ArrowUpRight"};
	string strFile = okutil_theme_get_path(ORIGIN_PATH_SYSTEM, THTYPE_UNDEF) + vsArrows[type] + ".emf";
	/// TD 10-10-2007 QA80-10510 UNDO_SUPPORT_FOR_ATTACHMENTS_IN_WKS_CELL
	//DWORD dwCntrl = EMBEDGRAPH_NO_RESIZE_CELL;//resize? 0 : EMBEDGRAPH_NO_RESIZE_CELL;
	DWORD dwCntrl = EMBEDGRAPH_NO_RESIZE_CELL|EMBEDGRAPH_DO_UNDO;//resize? 0 : EMBEDGRAPH_NO_RESIZE_CELL;
	/// end UNDO_SUPPORT_FOR_ATTACHMENTS_IN_WKS_CELL
	
	wks.AttachPicture(r1, c1, strFile,dwCntrl);
	
}

//nGetNDialog = 0,1,2, corresponding to the XF GetN dropdown, 0 = dialog is not used
//you can change nRet to be one of XFEVT_PROCEED (defualt), XFEVT_ABORT, XFEVT_PROCEED_NO_DLG or XFEVT_PROCEED_WITH_DLG(when nGetNDialog = 0)
//nGetNDialog = -1 when Ok on GetN dialog to allow handler to preocess <auto> etc variables
//dwCntrl is combination of bits
//LTXF_FROM_GUI_MENU, LTXF_FROM_GUI_PROMPT, LTXF_FROM_AUTO_UPDATE, LTXF_FROM_FUNCTION, LTXF_THEME_USED, LTXF_CHANGE_PARAM
void insertArrow_before_execute(TreeNode& trGetN, int nGetNDialog, int& nRet, int dwCntrl)
{

}
