// CodeGear C++Builder
// Copyright (c) 1995, 2020 by Embarcadero Technologies, Inc.
// All rights reserved

// (DO NOT EDIT: machine generated header) 'QImport3XLSMapParser.pas' rev: 34.00 (Windows)

#ifndef Qimport3xlsmapparserHPP
#define Qimport3xlsmapparserHPP

#pragma delphiheader begin
#pragma option push
#pragma option -w-      // All warnings off
#pragma option -Vx      // Zero-length empty class member 
#pragma pack(push,8)
#include <System.hpp>
#include <SysInit.hpp>
#include <System.Classes.hpp>
#include <System.SysUtils.hpp>
#include <System.Math.hpp>
#include <Winapi.Windows.hpp>
#include <QImport3XLSFile.hpp>
#include <QImport3XLSUtils.hpp>

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

namespace Qimport3xlsmapparser
{
//-- forward type declarations -----------------------------------------------
class DELPHICLASS TMapRange;
class DELPHICLASS TMapRow;
class DELPHICLASS TMapRowList;
//-- type declarations -------------------------------------------------------
enum DECLSPEC_DENUM TRangeType : unsigned char { rtCol, rtRow, rtCell, rtUnknown };

enum DECLSPEC_DENUM TRangeDirection : unsigned char { rdDown, rdUp, rdUnknown };

enum DECLSPEC_DENUM TSheetIDType : unsigned char { sitUnknown, sitName, sitNumber };

#pragma pack(push,4)
class PASCALIMPLEMENTATION TMapRange : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	TMapRow* FMapRow;
	Qimport3xlsfile::TxlsFile* FXLSFile;
	TRangeDirection FDirection;
	TSheetIDType FSheetIDType;
	int FSheetNumber;
	System::WideString FSheetName;
	int FRow1;
	int FCol1;
	int FRow2;
	int FCol2;
	TRangeType FRangeType;
	int FLength;
	void __fastcall Arrange();
	bool __fastcall GetHasSheet();
	System::UnicodeString __fastcall GetAsString();
	int __fastcall GetSkipFirstRows();
	int __fastcall GetSkipFirstCols();
	
protected:
	void __fastcall UpdateDirection();
	
public:
	__fastcall TMapRange(TMapRow* MapRow);
	void __fastcall Update();
	void __fastcall Assign(TMapRange* Range);
	__property TMapRow* MapRow = {read=FMapRow, write=FMapRow};
	__property Qimport3xlsfile::TxlsFile* XLSFile = {read=FXLSFile};
	__property TRangeType RangeType = {read=FRangeType, nodefault};
	__property TRangeDirection Direction = {read=FDirection, write=FDirection, nodefault};
	__property bool HasSheet = {read=GetHasSheet, nodefault};
	__property TSheetIDType SheetIDType = {read=FSheetIDType, write=FSheetIDType, nodefault};
	__property int SheetNumber = {read=FSheetNumber, write=FSheetNumber, nodefault};
	__property System::WideString SheetName = {read=FSheetName, write=FSheetName};
	__property int Row1 = {read=FRow1, write=FRow1, nodefault};
	__property int Col1 = {read=FCol1, write=FCol1, nodefault};
	__property int Row2 = {read=FRow2, write=FRow2, nodefault};
	__property int Col2 = {read=FCol2, write=FCol2, nodefault};
	__property int Length = {read=FLength, nodefault};
	__property System::UnicodeString AsString = {read=GetAsString};
	__property int SkipFirstRows = {read=GetSkipFirstRows, nodefault};
	__property int SkipFirstCols = {read=GetSkipFirstCols, nodefault};
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TMapRange() { }
	
};

#pragma pack(pop)

#pragma pack(push,4)
class PASCALIMPLEMENTATION TMapRow : public System::Classes::TList
{
	typedef System::Classes::TList inherited;
	
public:
	TMapRange* operator[](int Index) { return this->Items[Index]; }
	
private:
	TMapRowList* FMapRowList;
	Qimport3xlsfile::TxlsFile* FXLSFile;
	int FLength;
	TMapRange* __fastcall GetItems(int Index);
	void __fastcall SetItems(int Index, TMapRange* Value);
	System::UnicodeString __fastcall GetAsString();
	void __fastcall SetAsString(const System::UnicodeString Value);
	int __fastcall GetSkipFirstRows();
	int __fastcall GetSkipFirstCols();
	
public:
	__fastcall TMapRow(TMapRowList* MapRowList);
	HIDESBASE int __fastcall Add(TMapRange* Item);
	HIDESBASE void __fastcall Delete(int Index);
	void __fastcall Update();
	System::WideString __fastcall GetCellValue(int AbsoluteIndex);
	void __fastcall Optimize();
	int __fastcall IndexOfRange(const System::UnicodeString RangeStr);
	__property TMapRowList* MapRowList = {read=FMapRowList};
	__property Qimport3xlsfile::TxlsFile* XLSFile = {read=FXLSFile};
	__property TMapRange* Items[int Index] = {read=GetItems, write=SetItems/*, default*/};
	__property int Length = {read=FLength, nodefault};
	__property System::UnicodeString AsString = {read=GetAsString, write=SetAsString};
	__property int SkipFirstRows = {read=GetSkipFirstRows, nodefault};
	__property int SkipFirstCols = {read=GetSkipFirstCols, nodefault};
public:
	/* TList.Destroy */ inline __fastcall virtual ~TMapRow() { }
	
};

#pragma pack(pop)

#pragma pack(push,4)
class PASCALIMPLEMENTATION TMapRowList : public System::Classes::TList
{
	typedef System::Classes::TList inherited;
	
public:
	TMapRow* operator[](int Index) { return this->Items[Index]; }
	
private:
	Qimport3xlsfile::TxlsFile* FXLSFile;
	int FMaxRow;
	int FMinRow;
	int FSkipFirstCols;
	int FSkipFirstRows;
	TMapRow* __fastcall GetItems(int Index);
	void __fastcall SetItems(int Index, TMapRow* Value);
	
public:
	__fastcall TMapRowList(Qimport3xlsfile::TxlsFile* XLSFile);
	__fastcall virtual ~TMapRowList();
	HIDESBASE int __fastcall Add(TMapRow* Item);
	HIDESBASE void __fastcall Delete(int Index);
	void __fastcall Update();
	__property Qimport3xlsfile::TxlsFile* XLSFile = {read=FXLSFile};
	__property TMapRow* Items[int Index] = {read=GetItems, write=SetItems/*, default*/};
	__property int MaxRow = {read=FMaxRow, nodefault};
	__property int MinRow = {read=FMinRow, nodefault};
	__property int SkipFirstRows = {read=FSkipFirstRows, write=FSkipFirstRows, nodefault};
	__property int SkipFirstCols = {read=FSkipFirstCols, write=FSkipFirstCols, nodefault};
};

#pragma pack(pop)

enum DECLSPEC_DENUM TCellNeighbour : unsigned char { cnLeft, cnRight, cnTop, cnBottom };

typedef System::Set<TCellNeighbour, TCellNeighbour::cnLeft, TCellNeighbour::cnBottom> TCellNeighbours;

//-- var, const, procedure ---------------------------------------------------
static const System::Word MAX_COL = System::Word(0x100);
static const int MAX_ROW = int(0x10000);
static const System::WideChar RANGE_DELIMITER = (System::WideChar)(0x3b);
static const System::WideChar ARRAY_DELIMITER = (System::WideChar)(0x2d);
static const System::WideChar SHEET_START = (System::WideChar)(0x5b);
static const System::WideChar SHEET_FINISH = (System::WideChar)(0x5d);
static const System::WideChar SHEET_NUMBER = (System::WideChar)(0x3a);
#define ILLEGAL_IN_SHEET L":\\/?*[]"
#define COLSTART L"COLSTART"
#define COLFINISH L"COLFINISH"
#define ROWSTART L"ROWSTART"
#define ROWFINISH L"ROWFINISH"
extern DELPHI_PACKAGE bool __fastcall ParseMapString(const System::UnicodeString MapString, TMapRow* MapRow);
extern DELPHI_PACKAGE void __fastcall ParseCellString(const System::UnicodeString CellString, int &Col, int &Row);
extern DELPHI_PACKAGE void __fastcall ParseColString(const System::UnicodeString ColString, int &Col);
extern DELPHI_PACKAGE void __fastcall ParseRowString(const System::UnicodeString RowString, int &Row);
extern DELPHI_PACKAGE void __fastcall ParseSheetNumber(const System::UnicodeString SheetNumber, int &Sheet);
extern DELPHI_PACKAGE void __fastcall ParseSheetName(const System::UnicodeString SheetName, System::UnicodeString &Sheet);
extern DELPHI_PACKAGE bool __fastcall CellInRange(TMapRange* Range, const System::UnicodeString SheetName, int SheetNumber, int Col, int Row);
extern DELPHI_PACKAGE bool __fastcall CellInRow(TMapRow* MapRow, const System::UnicodeString SheetName, int SheetNumber, int Col, int Row);
extern DELPHI_PACKAGE TCellNeighbours __fastcall GetCellNeighbours(TMapRow* MapRow, const System::UnicodeString SheetName, int SheetNumber, int Col, int Row);
extern DELPHI_PACKAGE void __fastcall RemoveCellFromRow(TMapRow* MapRow, const System::UnicodeString SheetName, int SheetNumber, int Col, int Row);
extern DELPHI_PACKAGE void __fastcall Str2ColRow(const System::UnicodeString Str, int &ACol, int &ARow);
extern DELPHI_PACKAGE void __fastcall Str2Range(const System::UnicodeString Str, int &ACol1, int &ARow1, int &ACol2, int &ARow2);
extern DELPHI_PACKAGE TRangeType __fastcall GetRangeType(const System::UnicodeString Str);
extern DELPHI_PACKAGE System::UnicodeString __fastcall OptimizeString(const System::UnicodeString Str);
extern DELPHI_PACKAGE System::UnicodeString __fastcall SkipFirstRows(const System::UnicodeString Str, int Rows);
extern DELPHI_PACKAGE System::UnicodeString __fastcall SkipFirstCols(const System::UnicodeString Str, int Cols);
extern DELPHI_PACKAGE System::UnicodeString __fastcall CheckRange(const System::UnicodeString Str);
}	/* namespace Qimport3xlsmapparser */
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_QIMPORT3XLSMAPPARSER)
using namespace Qimport3xlsmapparser;
#endif
#pragma pack(pop)
#pragma option pop

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