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

// (DO NOT EDIT: machine generated header) 'advsprd.pas' rev: 4.00

#ifndef advsprdHPP
#define advsprdHPP

#pragma delphiheader begin
#pragma option push -w-
#include <Controls.hpp>	// Pascal unit
#include <Messages.hpp>	// Pascal unit
#include <Grids.hpp>	// Pascal unit
#include <Windows.hpp>	// Pascal unit
#include <SysUtils.hpp>	// Pascal unit
#include <Classes.hpp>	// Pascal unit
#include <AdvPars.hpp>	// Pascal unit
#include <AdvGrid.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 *TCellFormatEvent)(System::TObject* Sender, int ACol, int Arow, AnsiString 
	&format, bool &datetype);

struct TCellRef;
typedef TCellRef *PCellRef;

#pragma pack(push, 4)
struct TCellRef
{
	Grids::TGridCoord src;
	Grids::TGridCoord dst;
	bool dirty;
} ;
#pragma pack(pop)

class DELPHICLASS TCellRefList;
#pragma pack(push, 4)
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(const Grids::TGridCoord &gc);
	void __fastcall DeleteAll(void);
	void __fastcall ClearAll(void);
};

#pragma pack(pop)

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

class DELPHICLASS TAdvSpreadGrid;
#pragma pack(push, 4)
class PASCALIMPLEMENTATION TAdvSpreadGrid : public Advgrid::TAdvStringGrid 
{
	typedef Advgrid::TAdvStringGrid inherited;
	
private:
	Advpars::TGridFormula* FGridFormula;
	bool FCalcBusy;
	bool FShowFormula;
	bool FAutoRecalc;
	AnsiString FCellFormat;
	TCellFormatEvent FOnCellFormat;
	TFormulaErrorEvent FOnFormulaError;
	TCellRefList* FCellRefList;
	AnsiString FErrorText;
	TCellNameMode FCellNameMode;
	bool FAutoHeaders;
	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 UpdCellRef(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);
	void __fastcall SetCellEx(int c, int r, const AnsiString Value);
	
protected:
	virtual AnsiString __fastcall CalcCell(int ACol, int ARow);
	virtual void __fastcall GetCellAlign(int ACol, int ARow, Classes::TAlignment &AAlignment);
	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);
	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);
	
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);
	__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};
	
__published:
	__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 TCellFormatEvent OnCellFormat = {read=FOnCellFormat, write=FOnCellFormat};
	__property TFormulaErrorEvent OnFormulaError = {read=FOnFormulaError, write=FOnFormulaError};
	__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
	
};

#pragma pack(pop)

//-- var, const, procedure ---------------------------------------------------
#define err_recurs "Circular cell formula"
#define err_parser "Formula parser error"
#define err_recursrange "Circular range formula"
#define err_invalrange "Invalid range"
#define err_empty "Empty formula"

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

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