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

// (DO NOT EDIT: machine generated header) 'FMX.GridExcelIO.pas' rev: 27.00 (Windows)

#ifndef Fmx_GridexcelioHPP
#define Fmx_GridexcelioHPP

#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>	// Pascal unit
#include <SysInit.hpp>	// Pascal unit
#include <System.SysUtils.hpp>	// Pascal unit
#include <System.Classes.hpp>	// Pascal unit
#include <FMX.XLSAdapter.hpp>	// Pascal unit
#include <FMX.UExcelAdapter.hpp>	// Pascal unit
#include <FMX.UFlxUtils.hpp>	// Pascal unit
#include <FMX.TMSBaseControl.hpp>	// Pascal unit
#include <FMX.UFlxFormats.hpp>	// Pascal unit
#include <FMX.UFlxMessages.hpp>	// Pascal unit
#include <FMX.UXlsPictures.hpp>	// Pascal unit
#include <FMX.XlsMessages.hpp>	// Pascal unit
#include <FMX.TMSGrid.hpp>	// Pascal unit
#include <FMX.TMSGridData.hpp>	// Pascal unit
#include <FMX.TMSGridCell.hpp>	// Pascal unit
#include <FMX.TMSGridDataUtil.hpp>	// Pascal unit
#include <FMX.Types.hpp>	// Pascal unit
#include <System.UITypes.hpp>	// Pascal unit
#include <FMX.Dialogs.hpp>	// Pascal unit
#include <FMX.TMSXUtil.hpp>	// Pascal unit
#include <System.Variants.hpp>	// Pascal unit
#include <FMX.UFlxNumberFormat.hpp>	// Pascal unit
#include <System.UIConsts.hpp>	// Pascal unit
#include <FMX.Styles.hpp>	// Pascal unit
#include <FMX.Graphics.hpp>	// Pascal unit
#include <FMX.TMSCustomGrid.hpp>	// Pascal unit
#include <FMX.Controls.hpp>	// Pascal unit

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

namespace Fmx
{
namespace Gridexcelio
{
//-- type declarations -------------------------------------------------------
typedef void __fastcall (__closure *TASGIOProgressEvent)(System::TObject* Sender, int SheetNum, int SheetTot, int RowNum, int RowTot);

typedef void __fastcall (__closure *TExportColumnFormatEvent)(System::TObject* Sender, int GridCol, int GridRow, int XlsCol, int XlsRow, const System::WideString Value, bool &ExportCellAsString);

typedef void __fastcall (__closure *TGetCommentBoxSizeEvent)(System::TObject* Sender, const System::WideString Comment, int &Height, int &Width);

enum DECLSPEC_DENUM TOverwriteMode : unsigned char { omNever, omAlways, omWarn };

enum DECLSPEC_DENUM TInsertInSheet : unsigned char { InsertInSheet_Clear, InsertInSheet_OverwriteCells, InsertInSheet_InsertRows, InsertInSheet_InsertCols, InsertInSheet_InsertRowsExceptFirstAndSecond, InsertInSheet_InsertColsExceptFirstAndSecond };

class DELPHICLASS TASGIOOptions;
#pragma pack(push,4)
class PASCALIMPLEMENTATION TASGIOOptions : public System::Classes::TPersistent
{
	typedef System::Classes::TPersistent inherited;
	
private:
	bool FImportCellProperties;
	bool FImportCellSizes;
	bool FImportCellFormats;
	bool FImportClearCells;
	bool FImportFormulas;
	bool FImportImages;
	bool FImportPrintOptions;
	bool FExportCellSizes;
	bool FExportCellFormats;
	bool FExportFormulas;
	bool FExportCellProperties;
	bool FExportWordWrapped;
	bool FExportHTMLTags;
	bool FExportImages;
	bool FExportHiddenColumns;
	bool FExportHiddenRows;
	bool FExportShowInExcel;
	System::UnicodeString FExportOverwriteMessage;
	TOverwriteMode FExportOverwrite;
	bool FExportHardBorders;
	bool FUseExcelStandardColorPalette;
	bool FExportShowGridLines;
	bool FImportLockedCellsAsReadonly;
	bool FExportReadonlyCellsAsLocked;
	bool FExportPrintOptions;
	bool FExportSummaryRowsBelowDetail;
	bool FExportCellMargins;
	
public:
	__fastcall TASGIOOptions(void);
	virtual void __fastcall Assign(System::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 bool ImportClearCells = {read=FImportClearCells, write=FImportClearCells, default=1};
	__property bool ImportLockedCellsAsReadonly = {read=FImportLockedCellsAsReadonly, write=FImportLockedCellsAsReadonly, default=0};
	__property TOverwriteMode ExportOverwrite = {read=FExportOverwrite, write=FExportOverwrite, default=0};
	__property System::UnicodeString 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 ExportImages = {read=FExportImages, write=FExportImages, default=1};
	__property bool ExportReadonlyCellsAsLocked = {read=FExportReadonlyCellsAsLocked, write=FExportReadonlyCellsAsLocked, 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};
	__property bool ExportShowGridLines = {read=FExportShowGridLines, write=FExportShowGridLines, default=1};
	__property bool ExportPrintOptions = {read=FExportPrintOptions, write=FExportPrintOptions, default=1};
	__property bool ImportPrintOptions = {read=FImportPrintOptions, write=FImportPrintOptions, default=1};
	__property bool ExportSummaryRowsBelowDetail = {read=FExportSummaryRowsBelowDetail, write=FExportSummaryRowsBelowDetail, default=0};
	__property bool ExportCellMargins = {read=FExportCellMargins, write=FExportCellMargins, default=0};
	__property bool UseExcelStandardColorPalette = {read=FUseExcelStandardColorPalette, write=FUseExcelStandardColorPalette, default=1};
public:
	/* TPersistent.Destroy */ inline __fastcall virtual ~TASGIOOptions(void) { }
	
};

#pragma pack(pop)

class DELPHICLASS TAGrid;
class PASCALIMPLEMENTATION TAGrid : public Fmx::Tmsgrid::TTMSFMXGrid
{
	typedef Fmx::Tmsgrid::TTMSFMXGrid inherited;
	
public:
	/* TTMSFMXGrid.Create */ inline __fastcall virtual TAGrid(System::Classes::TComponent* AOwner) : Fmx::Tmsgrid::TTMSFMXGrid(AOwner) { }
	/* TTMSFMXGrid.Destroy */ inline __fastcall virtual ~TAGrid(void) { }
	
};


struct DECLSPEC_DRECORD TOneRowBorder
{
public:
	bool HasBottom;
	bool HasRight;
	int BottomColor;
	int RightColor;
};


typedef System::DynamicArray<TOneRowBorder> TRowBorderArray;

class DELPHICLASS TTMSFMXGridExcelIO;
class PASCALIMPLEMENTATION TTMSFMXGridExcelIO : public System::Classes::TComponent
{
	typedef System::Classes::TComponent inherited;
	
private:
	typedef System::DynamicArray<System::UnicodeString> _TTMSFMXGridExcelIO__1;
	
	
private:
	Fmx::Tmsgrid::TTMSFMXGrid* FFMXGrid;
	Fmx::Uexceladapter::TExcelAdapter* FAdapter;
	bool FAutoResizeGrid;
	bool FUseUnicode;
	_TTMSFMXGridExcelIO__1 FSheetNames;
	int FGridStartCol;
	int FGridStartRow;
	int FXlsStartRow;
	int FXlsStartCol;
	bool FZoomSaved;
	int FZoom;
	int FWorkSheet;
	int FWorkSheetNum;
	System::UnicodeString FDateFormat;
	System::UnicodeString FTimeFormat;
	TASGIOOptions* FOptions;
	TASGIOProgressEvent FOnProgress;
	TExportColumnFormatEvent FOnExportColumnFormat;
	TGetCommentBoxSizeEvent FOnGetCommentBoxSize;
	void __fastcall SetFMXGrid(Fmx::Tmsgrid::TTMSFMXGrid* const Value);
	TAGrid* __fastcall CurrentGrid(void);
	void __fastcall ImportData(Fmx::Uexceladapter::TExcelFile* const Workbook);
	void __fastcall ExportData(Fmx::Uexceladapter::TExcelFile* const Workbook);
	void __fastcall CloseFile(Fmx::Uexceladapter::TExcelFile* &Workbook);
	Fmx::Uflxformats::TFlxFormat __fastcall CellFormatDef(Fmx::Uexceladapter::TExcelFile* const Workbook, const int aRow, const int aCol);
	System::Uitypes::TAlphaColor __fastcall GetColor(Fmx::Uexceladapter::TExcelFile* const Workbook, const Fmx::Uflxformats::TFlxFormat &Fm);
	System::Uitypes::TAlphaColor __fastcall GetFontColor(Fmx::Uexceladapter::TExcelFile* const Workbook, const Fmx::Uflxformats::TFlxFormat &Fm);
	System::UnicodeString __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(Fmx::Uexceladapter::TExcelFile* const Workbook, const System::Sysutils::TFileName FileName, const System::WideChar Delimiter);
	void __fastcall SetZoom(const int Value);
	void __fastcall ImportImages(Fmx::Uexceladapter::TExcelFile* const Workbook, const System::Extended Zoom100);
	void __fastcall ExportImage(Fmx::Uexceladapter::TExcelFile* const Workbook, Fmx::Graphics::TBitmap* const Pic, const int rx, const int cx, const int cg, const int rg);
	void __fastcall InternalXLSImport(const System::Sysutils::TFileName FileName, const int SheetNumber, const System::UnicodeString SheetName);
	System::UnicodeString __fastcall SupressCR(System::UnicodeString s);
	bool __fastcall FindSheet(Fmx::Uexceladapter::TExcelFile* const Workbook, const System::UnicodeString SheetName, /* out */ int &index);
	void __fastcall SetOptions(TASGIOOptions* const Value);
	void __fastcall SetBorders(const int cg, const int rg, TRowBorderArray &LastRowBorders, int SpanRow, int SpanCol, Fmx::Uflxformats::TFlxFormat &Fm, Fmx::Uexceladapter::TExcelFile* const Workbook, const Fmx::Uflxmessages::BooleanArray UsedColors);
	void __fastcall CopyFmToMerged(Fmx::Uexceladapter::TExcelFile* const Workbook, Fmx::Tmsgriddata::TCellProperty* const cp, const int rx, const int cx, const Fmx::Uflxformats::TFlxFormat &Fm);
	void __fastcall ImportNodes(Fmx::Uexceladapter::TExcelFile* const Workbook, const int first, const int last, const int level);
	void __fastcall ImportAllNodes(Fmx::Uexceladapter::TExcelFile* const Workbook, const int first, const int last);
	int __fastcall NearestColorIndex(Fmx::Uexceladapter::TExcelFile* const Workbook, const System::Uitypes::TAlphaColor aColor, const Fmx::Uflxmessages::BooleanArray UsedColors);
	Fmx::Uflxmessages::BooleanArray __fastcall GetUsedPaletteColors(Fmx::Uexceladapter::TExcelFile* const Workbook);
	void __fastcall OpenFile(Fmx::Uexceladapter::TExcelFile* const Workbook, const System::UnicodeString FileName);
	System::UnicodeString __fastcall GetVersion(void);
	void __fastcall SetVersion(const System::UnicodeString Value);
	
protected:
	virtual void __fastcall Notification(System::Classes::TComponent* AComponent, System::Classes::TOperation Operation);
	
public:
	void __fastcall XLSImport(const System::Sysutils::TFileName FileName)/* overload */;
	void __fastcall XLSImport(const System::Sysutils::TFileName FileName, const int SheetNumber)/* overload */;
	void __fastcall XLSImport(const System::Sysutils::TFileName FileName, const System::UnicodeString SheetName)/* overload */;
	void __fastcall XLSExport(const System::Sysutils::TFileName FileName, const System::UnicodeString SheetName = System::UnicodeString(), const int SheetPos = 0xffffffff, const int SelectSheet = 0x1, const TInsertInSheet InsertInSheet = (TInsertInSheet)(0x0));
	void __fastcall LoadSheetNames(const System::UnicodeString FileName);
	__property System::UnicodeString SheetNames[int index] = {read=GetSheetNames};
	__property int SheetNamesCount = {read=GetSheetNamesCount, nodefault};
	__fastcall virtual TTMSFMXGridExcelIO(System::Classes::TComponent* AOwner);
	__fastcall virtual ~TTMSFMXGridExcelIO(void);
	
__published:
	__property Fmx::Tmsgrid::TTMSFMXGrid* Grid = {read=FFMXGrid, write=SetFMXGrid};
	__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 System::UnicodeString DateFormat = {read=FDateFormat, write=FDateFormat};
	__property System::UnicodeString TimeFormat = {read=FTimeFormat, write=FTimeFormat};
	__property System::UnicodeString Version = {read=GetVersion, write=SetVersion};
	__property TASGIOProgressEvent OnProgress = {read=FOnProgress, write=FOnProgress};
	__property TExportColumnFormatEvent OnExportColumnFormat = {read=FOnExportColumnFormat, write=FOnExportColumnFormat};
	__property TGetCommentBoxSizeEvent OnGetCommentBoxSize = {read=FOnGetCommentBoxSize, write=FOnGetCommentBoxSize};
};


//-- var, const, procedure ---------------------------------------------------
static const System::Int8 CellOfs = System::Int8(0x0);
}	/* namespace Gridexcelio */
}	/* namespace Fmx */
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_FMX_GRIDEXCELIO)
using namespace Fmx::Gridexcelio;
#endif
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_FMX)
using namespace Fmx;
#endif
#pragma pack(pop)
#pragma option pop

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