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

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

#ifndef AdvGridExcelHPP
#define AdvGridExcelHPP

#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <Grids.hpp>	// Pascal unit
#include <UFlxNumberFormat.hpp>	// Pascal unit
#include <UTextDelim.hpp>	// Pascal unit
#include <AsgHTMLE.hpp>	// Pascal unit
#include <jpeg.hpp>	// Pascal unit
#include <Graphics.hpp>	// Pascal unit
#include <Controls.hpp>	// Pascal unit
#include <Dialogs.hpp>	// Pascal unit
#include <ShellAPI.hpp>	// Pascal unit
#include <UXlsPictures.hpp>	// Pascal unit
#include <BaseGrid.hpp>	// Pascal unit
#include <UFlxMessages.hpp>	// Pascal unit
#include <UFlxFormats.hpp>	// Pascal unit
#include <AdvGridWorkbook.hpp>	// Pascal unit
#include <AdvGrid.hpp>	// Pascal unit
#include <UFlxUtils.hpp>	// Pascal unit
#include <UExcelAdapter.hpp>	// Pascal unit
#include <XLSAdapter.hpp>	// Pascal unit
#include <Classes.hpp>	// Pascal unit
#include <SysUtils.hpp>	// Pascal unit
#include <Windows.hpp>	// Pascal unit
#include <SysInit.hpp>	// Pascal unit
#include <System.hpp>	// Pascal unit

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

namespace Advgridexcel
{
//-- type declarations -------------------------------------------------------
typedef void __fastcall (__closure *TFlxFormatCellEvent)(Advgrid::TAdvStringGrid* Sender, const int 
	GridCol, const int GridRow, const int XlsCol, const int XlsRow, const WideString Value, WideString 
	&DateFormat, WideString &TimeFormat);

typedef void __fastcall (__closure *TFlxFormatCellGenericEvent)(Advgrid::TAdvStringGrid* Sender, const 
	int GridCol, const int GridRow, const int XlsCol, const int XlsRow, const WideString Value, Uflxformats::TFlxFormat 
	&Format);

typedef void __fastcall (__closure *TASGIOProgressEvent)(System::TObject* Sender, int SheetNum, int 
	SheetTot, int RowNum, int RowTot);

#pragma option push -b-
enum TOverwriteMode { omNever, omAlways, omWarn };
#pragma option pop

class DELPHICLASS TASGIOOptions;
class PASCALIMPLEMENTATION TASGIOOptions : public Classes::TPersistent 
{
	typedef Classes::TPersistent inherited;
	
private:
	bool FImportCellProperties;
	bool FImportCellSizes;
	bool FImportCellFormats;
	bool FImportFormulas;
	bool FImportImages;
	bool FExportCellSizes;
	bool FExportCellFormats;
	bool FExportFormulas;
	bool FExportCellProperties;
	bool FExportWordWrapped;
	bool FExportHTMLTags;
	bool FExportHiddenColumns;
	bool FExportShowInExcel;
	AnsiString FExportOverwriteMessage;
	TOverwriteMode FExportOverwrite;
	bool FExportHardBorders;
	
public:
	__fastcall TASGIOOptions(void);
	virtual void __fastcall Assign(Classes::TPersistent* Source);
	
__published:
	__property bool ImportFormulas = {read=FImportFormulas, write=FImportFormulas, default=1};
	__property bool ImportImages = {read=FImportImages, write=FImportImages, default=1};
	__property bool ImportCellFormats = {read=FImportCellFormats, write=FImportCellFormats, default=1};
		
	__property bool ImportCellProperties = {read=FImportCellProperties, write=FImportCellProperties, default=0
		};
	__property bool ImportCellSizes = {read=FImportCellSizes, write=FImportCellSizes, default=1};
	__property TOverwriteMode ExportOverwrite = {read=FExportOverwrite, write=FExportOverwrite, default=0
		};
	__property AnsiString ExportOverwriteMessage = {read=FExportOverwriteMessage, write=FExportOverwriteMessage
		};
	__property bool ExportFormulas = {read=FExportFormulas, write=FExportFormulas, default=1};
	__property bool ExportCellFormats = {read=FExportCellFormats, write=FExportCellFormats, default=1};
		
	__property bool ExportCellProperties = {read=FExportCellProperties, write=FExportCellProperties, default=1
		};
	__property bool ExportCellSizes = {read=FExportCellSizes, write=FExportCellSizes, default=1};
	__property bool ExportHiddenColumns = {read=FExportHiddenColumns, write=FExportHiddenColumns, default=0
		};
	__property bool ExportWordWrapped = {read=FExportWordWrapped, write=FExportWordWrapped, default=0};
		
	__property bool ExportHTMLTags = {read=FExportHTMLTags, write=FExportHTMLTags, default=1};
	__property bool ExportShowInExcel = {read=FExportShowInExcel, write=FExportShowInExcel, default=0};
		
	__property bool ExportHardBorders = {read=FExportHardBorders, write=FExportHardBorders, default=0};
		
public:
	#pragma option push -w-inl
	/* TPersistent.Destroy */ inline __fastcall virtual ~TASGIOOptions(void) { }
	#pragma option pop
	
};


class DELPHICLASS TAGrid;
class PASCALIMPLEMENTATION TAGrid : public Advgrid::TAdvStringGrid 
{
	typedef Advgrid::TAdvStringGrid inherited;
	
public:
	#pragma option push -w-inl
	/* TAdvStringGrid.Create */ inline __fastcall virtual TAGrid(Classes::TComponent* AOwner) : Advgrid::TAdvStringGrid(
		AOwner) { }
	#pragma option pop
	#pragma option push -w-inl
	/* TAdvStringGrid.Destroy */ inline __fastcall virtual ~TAGrid(void) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* TWinControl.CreateParented */ inline __fastcall TAGrid(HWND ParentWindow) : Advgrid::TAdvStringGrid(
		ParentWindow) { }
	#pragma option pop
	
};


struct TOneRowBorder
{
	bool HasBottom;
	bool HasRight;
	int BottomColor;
	int RightColor;
} ;

typedef DynamicArray<TOneRowBorder >  TRowBorderArray;

typedef DynamicArray<WideString >  AdvGridExcel__4;

class DELPHICLASS TAdvGridExcelIO;
class PASCALIMPLEMENTATION TAdvGridExcelIO : public Classes::TComponent 
{
	typedef Classes::TComponent inherited;
	
private:
	Advgrid::TAdvStringGrid* FAdvStringGrid;
	Advgridworkbook::TAdvGridWorkbook* FAdvGridWorkbook;
	Uexceladapter::TExcelAdapter* FAdapter;
	bool FAutoResizeGrid;
	bool FUseUnicode;
	DynamicArray<WideString >  FSheetNames;
	int FGridStartCol;
	int FGridStartRow;
	int FXlsStartRow;
	int FXlsStartCol;
	bool FZoomSaved;
	int FZoom;
	int FWorkSheet;
	int FWorkSheetNum;
	WideString FDateFormat;
	WideString FTimeFormat;
	TASGIOOptions* FOptions;
	TFlxFormatCellEvent FOnDateTimeFormat;
	TFlxFormatCellGenericEvent FOnCellFormat;
	TASGIOProgressEvent FOnProgress;
	void __fastcall SetAdvStringGrid(const Advgrid::TAdvStringGrid* Value);
	void __fastcall SetAdvGridWorkbook(const Advgridworkbook::TAdvGridWorkbook* Value);
	TAGrid* __fastcall CurrentGrid(void);
	void __fastcall ImportData(const Uexceladapter::TExcelFile* Workbook);
	void __fastcall ExportData(const Uexceladapter::TExcelFile* Workbook);
	void __fastcall CloseFile(Uexceladapter::TExcelFile* &Workbook);
	Uflxformats::TFlxFormat __fastcall CellFormatDef(const Uexceladapter::TExcelFile* Workbook, const int 
		aRow, const int aCol);
	Graphics::TColor __fastcall GetColor(const Uexceladapter::TExcelFile* Workbook, const Uflxformats::TFlxFormat 
		&Fm);
	WideString __fastcall GetSheetNames(int index);
	int __fastcall GetSheetNamesCount(void);
	void __fastcall SetGridStartCol(const int Value);
	void __fastcall SetGridStartRow(const int Value);
	void __fastcall SetXlsStartCol(const int Value);
	void __fastcall SetXlsStartRow(const int Value);
	void __fastcall OpenText(const Uexceladapter::TExcelFile* Workbook, const AnsiString FileName, const 
		char Delimiter);
	void __fastcall SetZoom(const int Value);
	void __fastcall ImportImages(const Uexceladapter::TExcelFile* Workbook, const Extended Zoom100);
	void __fastcall ExportImage(const Uexceladapter::TExcelFile* Workbook, const Graphics::TPicture* Pic
		, const int rx, const int cx, const int cg, const int rg);
	void __fastcall InternalXLSImport(const AnsiString FileName, const int SheetNumber, const WideString 
		SheetName);
	WideString __fastcall SupressCR(const WideString s);
	bool __fastcall FindSheet(const Uexceladapter::TExcelFile* Workbook, const WideString SheetName, int 
		&index);
	void __fastcall SetOptions(const TASGIOOptions* Value);
	void __fastcall SetBorders(const int cg, const int rg, TRowBorderArray &LastRowBorders, int SpanRow
		, int SpanCol, Uflxformats::TFlxFormat &Fm, const Uexceladapter::TExcelFile* Workbook);
	void __fastcall CopyFmToMerged(const Uexceladapter::TExcelFile* Workbook, const Basegrid::TCellProperties* 
		cp, const int rx, const int cx, const Uflxformats::TFlxFormat &Fm);
	void __fastcall ImportNodes(const Uexceladapter::TExcelFile* Workbook, const int first, const int last
		, const int level);
	void __fastcall ImportAllNodes(const Uexceladapter::TExcelFile* Workbook, const int first, const int 
		last);
	WideString __fastcall WideAdjustLineBreaks(const WideString w);
	
protected:
	virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation
		);
	
public:
	void __fastcall XLSImport(const AnsiString FileName)/* overload */;
	void __fastcall XLSImport(const AnsiString FileName, const int SheetNumber)/* overload */;
	void __fastcall XLSImport(const AnsiString FileName, const WideString SheetName)/* overload */;
	void __fastcall XLSExport(const AnsiString FileName, const WideString SheetName, const int SheetPos
		, const int SelectSheet);
	void __fastcall LoadSheetNames(const AnsiString FileName);
	__property WideString SheetNames[int index] = {read=GetSheetNames};
	__property int SheetNamesCount = {read=GetSheetNamesCount, nodefault};
	__fastcall virtual TAdvGridExcelIO(Classes::TComponent* AOwner);
	__fastcall virtual ~TAdvGridExcelIO(void);
	
__published:
	__property Advgrid::TAdvStringGrid* AdvStringGrid = {read=FAdvStringGrid, write=SetAdvStringGrid};
	__property Advgridworkbook::TAdvGridWorkbook* AdvGridWorkbook = {read=FAdvGridWorkbook, write=SetAdvGridWorkbook
		};
	__property bool AutoResizeGrid = {read=FAutoResizeGrid, write=FAutoResizeGrid, default=1};
	__property TASGIOOptions* Options = {read=FOptions, write=SetOptions};
	__property bool UseUnicode = {read=FUseUnicode, write=FUseUnicode, nodefault};
	__property int GridStartRow = {read=FGridStartRow, write=SetGridStartRow, default=1};
	__property int GridStartCol = {read=FGridStartCol, write=SetGridStartCol, default=1};
	__property int XlsStartRow = {read=FXlsStartRow, write=SetXlsStartRow, default=1};
	__property int XlsStartCol = {read=FXlsStartCol, write=SetXlsStartCol, default=1};
	__property bool ZoomSaved = {read=FZoomSaved, write=FZoomSaved, default=1};
	__property int Zoom = {read=FZoom, write=SetZoom, default=100};
	__property WideString DateFormat = {read=FDateFormat, write=FDateFormat};
	__property WideString TimeFormat = {read=FTimeFormat, write=FTimeFormat};
	__property TFlxFormatCellEvent OnDateTimeFormat = {read=FOnDateTimeFormat, write=FOnDateTimeFormat}
		;
	__property TFlxFormatCellGenericEvent OnCellFormat = {read=FOnCellFormat, write=FOnCellFormat};
	__property TASGIOProgressEvent OnProgress = {read=FOnProgress, write=FOnProgress};
};


//-- var, const, procedure ---------------------------------------------------
static const Shortint CellOfs = 0x0;
extern PACKAGE void __fastcall Register(void);

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

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