// Borland C++ Builder
// Copyright (c) 1995, 1999 by Borland International
// All rights reserved

// (DO NOT EDIT: machine generated header) 'AdvSprd.pas' rev: 5.00

#ifndef AdvSprdHPP
#define AdvSprdHPP

#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <Controls.hpp>	// Pascal unit
#include <Forms.hpp>	// Pascal unit
#include <AdvPars.hpp>	// Pascal unit
#include <AdvGrid.hpp>	// Pascal unit
#include <BaseGrid.hpp>	// Pascal unit
#include <Grids.hpp>	// Pascal unit
#include <SysUtils.hpp>	// Pascal unit
#include <Messages.hpp>	// Pascal unit
#include <Classes.hpp>	// Pascal unit
#include <Windows.hpp>	// Pascal unit
#include <SysInit.hpp>	// Pascal unit
#include <System.hpp>	// Pascal unit

//-- user supplied -----------------------------------------------------------

namespace Advsprd
{
//-- type declarations -------------------------------------------------------
typedef void __fastcall (__closure *TFormulaErrorEvent)(System::TObject* Sender, int ACol, int ARow, 
	AnsiString S);

typedef void __fastcall (__closure *TFormulaErrorInfoEvent)(System::TObject* Sender, int ACol, int ARow
	, int ErrType, int ErrPos, int ErrParam, AnsiString ErrStr);

typedef void __fastcall (__closure *TCellFormatEvent)(System::TObject* Sender, int ACol, int Arow, AnsiString 
	&Format, bool &DateType);

struct TCellRef;
typedef TCellRef *PCellRef;

class DELPHICLASS TAdvSpreadGrid;
class DELPHICLASS TCellRefList;
class PASCALIMPLEMENTATION TCellRefList : public Classes::TList 
{
	typedef Classes::TList inherited;
	
private:
	TCellRef __fastcall GetCellRef(int Index);
	void __fastcall ShowCellRefs(void);
	
public:
	__fastcall TCellRefList(void);
	__fastcall virtual ~TCellRefList(void);
	__property TCellRef CellRefs[int index] = {read=GetCellRef/*, default*/};
	HIDESBASE void __fastcall Add(const TCellRef &Value);
	HIDESBASE void __fastcall Delete(int Index);
	void __fastcall DeleteRef(TAdvSpreadGrid* AGrid, const Grids::TGridCoord &gc);
	void __fastcall DeleteAll(void);
	void __fastcall ClearAll(void);
};


#pragma option push -b-
enum TCellNameMode { nmA1, nmRC };
#pragma option pop

#pragma option push -b-
enum TCellCalcState { csNoCalc, csCalcOk, csCalcErr };
#pragma option pop

class PASCALIMPLEMENTATION TAdvSpreadGrid : public Advgrid::TAdvStringGrid 
{
	typedef Advgrid::TAdvStringGrid inherited;
	
private:
	Advpars::TGridFormula* FGridFormula;
	bool FCalcBusy;
	bool FShowFormula;
	bool FSaveFormula;
	bool FAutoRecalc;
	bool FEditHint;
	AnsiString FCellFormat;
	TCellFormatEvent FOnCellFormat;
	TFormulaErrorEvent FOnFormulaError;
	TCellRefList* FCellRefList;
	AnsiString FErrorText;
	TCellNameMode FCellNameMode;
	bool FAutoHeaders;
	Advpars::TLibBinder* FMathLib;
	Advpars::TGridBinder* FBinder;
	TFormulaErrorInfoEvent FOnFormulaErrorInfo;
	bool FPrintFormula;
	HIDESBASE MESSAGE void __fastcall WMLButtonDown(Messages::TWMMouse &Msg);
	void __fastcall SetShowFormula(const bool Value);
	void __fastcall SetCellFormat(const AnsiString Value);
	void __fastcall CalcFormula(int ACol, int ARow);
	void __fastcall DelCellRef(int ACol, int ARow);
	void __fastcall AddCellRef(int ACol, int ARow, AnsiString s);
	void __fastcall CalcCellRef(int ACol, int ARow);
	void __fastcall ClearCellRefs(void);
	void __fastcall UpdCellRef(void);
	void __fastcall ShowCellRefs(void);
	Advpars::TIsCustomFunction __fastcall GetIsCustomFunction();
	void __fastcall SetIsCustomFunction(Advpars::TIsCustomFunction value);
	Advpars::TCalcCustomFunction __fastcall GetCalcCustomFunction();
	void __fastcall SetCalcCustomFunction(Advpars::TCalcCustomFunction value);
	double __fastcall GetCellValue(int c, int r);
	AnsiString __fastcall GetCellName(int c, int r);
	void __fastcall SetCellName(int c, int r, const AnsiString Value);
	void __fastcall SetCellNameMode(const TCellNameMode Value);
	void __fastcall SetAutoHeaders(const bool Value);
	int __fastcall GetFixedCols(void);
	int __fastcall GetFixedRows(void);
	HIDESBASE void __fastcall SetFixedCols(const int Value);
	HIDESBASE void __fastcall SetFixedRows(const int Value);
	HIDESBASE AnsiString __fastcall GetCellsEx(int c, int r);
	HIDESBASE void __fastcall SetCellEx(int c, int r, const AnsiString Value);
	HIDESBASE int __fastcall GetColCountEx(void);
	HIDESBASE int __fastcall GetRowCountEx(void);
	HIDESBASE void __fastcall SetColCountEx(const int Value);
	HIDESBASE void __fastcall SetRowCountEx(const int Value);
	void __fastcall SetCellVal(int ACol, int ARow, double r);
	void __fastcall SetCellError(int ACol, int ARow, int ErrPos, int ErrLen);
	double __fastcall GetCellVal(int ACol, int ARow);
	void __fastcall ClearCellVal(int ACol, int ARow);
	TCellCalcState __fastcall GetCellState(int ACol, int ARow);
	
protected:
	AnsiString __fastcall GetCellText(int ACol, int ARow, bool Formula);
	virtual AnsiString __fastcall CalcCell(int ACol, int ARow);
	virtual AnsiString __fastcall SaveCell(int ACol, int ARow);
	virtual void __fastcall GetCellAlign(int ACol, int ARow, Classes::TAlignment &HAlign, Basegrid::TVAlignment 
		&VAlign);
	virtual void __fastcall UpdateCell(int ACol, int ARow);
	virtual void __fastcall PasteNotify(const Windows::TPoint &Orig, const Grids::TGridRect &gr, Advgrid::TClipOperation 
		lastop);
	DYNAMIC void __fastcall SetEditText(int ACol, int ARow, const AnsiString Value);
	bool __fastcall CheckRange(int c1, int r1, int c2, int r2);
	AnsiString __fastcall ModifyRange(AnsiString s, int ptx, int pty, int ofsx, int ofsy, int rngx, int 
		rngy);
	AnsiString __fastcall ModifyName(AnsiString s, int ptx, int pty, int ofsx, int ofsy);
	AnsiString __fastcall ModifyFormula(AnsiString s, int ptx, int pty, int ofsx, int ofsy, int rngx, int 
		rngy);
	virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation AOperation
		);
	void __fastcall ErrorHandler(System::TObject* Sender, int ACol, int ARow, int ErrType, int ErrPos, 
		int ErrParam, AnsiString ErrStr);
	virtual void __fastcall EditProgress(AnsiString Value, const Windows::TPoint &pt, int SelPos);
	AnsiString __fastcall GetEditHint(AnsiString Func, int ParamNr);
	virtual void __fastcall Loaded(void);
	virtual void __fastcall CellsLoaded(void);
	
public:
	__fastcall virtual TAdvSpreadGrid(Classes::TComponent* AOwner);
	__fastcall virtual ~TAdvSpreadGrid(void);
	virtual int __fastcall GetVersionNr(void);
	virtual AnsiString __fastcall GetVersionString();
	virtual void __fastcall ClearRect(int ACol1, int ARow1, int ACol2, int ARow2);
	void __fastcall AutoSpreadHeaders(void);
	void __fastcall RecalcCell(int ACol, int ARow);
	void __fastcall Recalc(void);
	AnsiString __fastcall CellToName(int Col, int Row);
	Grids::TGridCoord __fastcall NameToCell(AnsiString s);
	AnsiString __fastcall RangeToName(const Grids::TGridRect &gr);
	Grids::TGridRect __fastcall NameToRange(AnsiString s);
	virtual void __fastcall RemoveRows(int RowIndex, int RCount);
	virtual void __fastcall InsertRows(int RowIndex, int RCount);
	virtual void __fastcall RemoveCols(int ColIndex, int CCount);
	virtual void __fastcall InsertCols(int ColIndex, int CCount);
	virtual AnsiString __fastcall ErrorToString(int ErrType);
	__property AnsiString ErrorText = {read=FErrorText, write=FErrorText};
	__property double CellValue[int c][int r] = {read=GetCellValue};
	__property AnsiString CellName[int c][int r] = {read=GetCellName, write=SetCellName};
	__property AnsiString Cells[int c][int r] = {read=GetCellsEx, write=SetCellEx};
	__property bool SaveFormula = {read=FSaveFormula, write=FSaveFormula, nodefault};
	__property bool PrintFormula = {read=FPrintFormula, write=FPrintFormula, nodefault};
	
__published:
	__property Advpars::TGridBinder* Binder = {read=FBinder, write=FBinder};
	__property bool EditHint = {read=FEditHint, write=FEditHint, nodefault};
	__property Advpars::TLibBinder* Libs = {read=FMathLib, write=FMathLib};
	__property bool ShowFormula = {read=FShowFormula, write=SetShowFormula, nodefault};
	__property bool AutoRecalc = {read=FAutoRecalc, write=FAutoRecalc, nodefault};
	__property bool AutoHeaders = {read=FAutoHeaders, write=SetAutoHeaders, nodefault};
	__property int FixedCols = {read=GetFixedCols, write=SetFixedCols, nodefault};
	__property int FixedRows = {read=GetFixedRows, write=SetFixedRows, nodefault};
	__property AnsiString CellFormat = {read=FCellFormat, write=SetCellFormat};
	__property TCellNameMode CellNameMode = {read=FCellNameMode, write=SetCellNameMode, nodefault};
	__property int ColCount = {read=GetColCountEx, write=SetColCountEx, nodefault};
	__property int RowCount = {read=GetRowCountEx, write=SetRowCountEx, nodefault};
	__property TCellFormatEvent OnCellFormat = {read=FOnCellFormat, write=FOnCellFormat};
	__property TFormulaErrorEvent OnFormulaError = {read=FOnFormulaError, write=FOnFormulaError};
	__property TFormulaErrorInfoEvent OnFormulaErrorInfo = {read=FOnFormulaErrorInfo, write=FOnFormulaErrorInfo
		};
	__property Advpars::TIsCustomFunction OnIsCustomFunction = {read=GetIsCustomFunction, write=SetIsCustomFunction
		};
	__property Advpars::TCalcCustomFunction OnCalcCustomFunction = {read=GetCalcCustomFunction, write=SetCalcCustomFunction
		};
public:
	#pragma option push -w-inl
	/* TWinControl.CreateParented */ inline __fastcall TAdvSpreadGrid(HWND ParentWindow) : Advgrid::TAdvStringGrid(
		ParentWindow) { }
	#pragma option pop
	
};


struct TCellRef
{
	Grids::TGridCoord Src;
	Grids::TGridCoord Dst;
	TAdvSpreadGrid* SrcGrd;
	TAdvSpreadGrid* DstGrd;
	bool Dirty;
} ;

//-- var, const, procedure ---------------------------------------------------

}	/* namespace Advsprd */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Advsprd;
#endif
#pragma option pop	// -w-
#pragma option pop	// -Vx

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// AdvSprd
