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

// (DO NOT EDIT: machine generated header) 'SMXLS.pas' rev: 23.00 (Win32)

#ifndef SmxlsHPP
#define SmxlsHPP

#pragma delphiheader begin
#pragma option push
#pragma option -w-      // All warnings off
#pragma option -Vx      // Zero-length empty class member functions
#pragma pack(push,8)
#include <System.hpp>	// Pascal unit
#include <SysInit.hpp>	// Pascal unit
#include <System.Classes.hpp>	// Pascal unit
#include <Winapi.Windows.hpp>	// Pascal unit
#include <SMCells.hpp>	// Pascal unit
#include <Winapi.ActiveX.hpp>	// Pascal unit
#include <System.Win.ComObj.hpp>	// Pascal unit
#include <Vcl.Graphics.hpp>	// Pascal unit
#include <System.SysUtils.hpp>	// Pascal unit
#include <SMI_Sum.hpp>	// Pascal unit
#include <SMIUtils.hpp>	// Pascal unit
#include <SMIXML.hpp>	// Pascal unit
#include <System.Variants.hpp>	// Pascal unit
#include <SMIZipFile.hpp>	// Pascal unit
#include <System.UITypes.hpp>	// Pascal unit

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

namespace Smxls
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS ESMIExcelException;
#pragma pack(push,4)
class PASCALIMPLEMENTATION ESMIExcelException : public System::Sysutils::Exception
{
	typedef System::Sysutils::Exception inherited;
	
public:
	/* Exception.Create */ inline __fastcall ESMIExcelException(const System::UnicodeString Msg) : System::Sysutils::Exception(Msg) { }
	/* Exception.CreateFmt */ inline __fastcall ESMIExcelException(const System::UnicodeString Msg, System::TVarRec const *Args, const int Args_Size) : System::Sysutils::Exception(Msg, Args, Args_Size) { }
	/* Exception.CreateRes */ inline __fastcall ESMIExcelException(int Ident)/* overload */ : System::Sysutils::Exception(Ident) { }
	/* Exception.CreateResFmt */ inline __fastcall ESMIExcelException(int Ident, System::TVarRec const *Args, const int Args_Size)/* overload */ : System::Sysutils::Exception(Ident, Args, Args_Size) { }
	/* Exception.CreateHelp */ inline __fastcall ESMIExcelException(const System::UnicodeString Msg, int AHelpContext) : System::Sysutils::Exception(Msg, AHelpContext) { }
	/* Exception.CreateFmtHelp */ inline __fastcall ESMIExcelException(const System::UnicodeString Msg, System::TVarRec const *Args, const int Args_Size, int AHelpContext) : System::Sysutils::Exception(Msg, Args, Args_Size, AHelpContext) { }
	/* Exception.CreateResHelp */ inline __fastcall ESMIExcelException(int Ident, int AHelpContext)/* overload */ : System::Sysutils::Exception(Ident, AHelpContext) { }
	/* Exception.CreateResFmtHelp */ inline __fastcall ESMIExcelException(System::PResStringRec ResStringRec, System::TVarRec const *Args, const int Args_Size, int AHelpContext)/* overload */ : System::Sysutils::Exception(ResStringRec, Args, Args_Size, AHelpContext) { }
	/* Exception.Destroy */ inline __fastcall virtual ~ESMIExcelException(void) { }
	
};

#pragma pack(pop)

#pragma option push -b-
enum TExcelVersion : unsigned char { evUnknown, evExcel2, evExcel3, evExcel4, evExcel5, evExcel7, evExcel8, evExcel9, evExcel12, evExcel12Bin };
#pragma option pop

#pragma option push -b-
enum TSMIVerAlignment : unsigned char { ivaTop, ivaCenter, ivaBottom, ivaJustify };
#pragma option pop

typedef System::StaticArray<int, 65536> TLongIntArray;

typedef TLongIntArray *PLongIntArray;

class DELPHICLASS TXLSFormat;
#pragma pack(push,4)
class PASCALIMPLEMENTATION TXLSFormat : public System::TObject
{
	typedef System::TObject inherited;
	
public:
	System::UnicodeString Name;
	int NumberFormatIndex;
	int FontIndex;
	bool IsDateTime;
	System::Classes::TAlignment HorAlignment;
	TSMIVerAlignment VerAlignment;
	System::Uitypes::TColor Background;
public:
	/* TObject.Create */ inline __fastcall TXLSFormat(void) : System::TObject() { }
	/* TObject.Destroy */ inline __fastcall virtual ~TXLSFormat(void) { }
	
};

#pragma pack(pop)

class DELPHICLASS TXLSName;
#pragma pack(push,4)
class PASCALIMPLEMENTATION TXLSName : public System::TObject
{
	typedef System::TObject inherited;
	
public:
	System::UnicodeString Name;
	System::UnicodeString Formula;
	int Options;
public:
	/* TObject.Create */ inline __fastcall TXLSName(void) : System::TObject() { }
	/* TObject.Destroy */ inline __fastcall virtual ~TXLSName(void) { }
	
};

#pragma pack(pop)

class DELPHICLASS TXLSSharedFormula;
#pragma pack(push,4)
class PASCALIMPLEMENTATION TXLSSharedFormula : public System::TObject
{
	typedef System::TObject inherited;
	
public:
	int SheetIndex;
	System::Word Row1;
	System::Word Row2;
	System::Byte Col1;
	System::Byte Col2;
	System::Word Len;
	System::Sysutils::TByteArray *Formula;
	System::UnicodeString __fastcall FormulaString(void);
public:
	/* TObject.Create */ inline __fastcall TXLSSharedFormula(void) : System::TObject() { }
	/* TObject.Destroy */ inline __fastcall virtual ~TXLSSharedFormula(void) { }
	
};

#pragma pack(pop)

class DELPHICLASS TXLSSharedObject;
#pragma pack(push,4)
class PASCALIMPLEMENTATION TXLSSharedObject : public System::TObject
{
	typedef System::TObject inherited;
	
public:
	int ID;
	System::Word ObjectType;
	System::UnicodeString Name;
	System::Classes::TStream* Data;
public:
	/* TObject.Create */ inline __fastcall TXLSSharedObject(void) : System::TObject() { }
	/* TObject.Destroy */ inline __fastcall virtual ~TXLSSharedObject(void) { }
	
};

#pragma pack(pop)

class DELPHICLASS TXLSSharedObjects;
#pragma pack(push,4)
class PASCALIMPLEMENTATION TXLSSharedObjects : public System::Classes::TList
{
	typedef System::Classes::TList inherited;
	
public:
	int __fastcall GetIndexByID(int AID);
public:
	/* TList.Destroy */ inline __fastcall virtual ~TXLSSharedObjects(void) { }
	
public:
	/* TObject.Create */ inline __fastcall TXLSSharedObjects(void) : System::Classes::TList() { }
	
};

#pragma pack(pop)

class DELPHICLASS TXLSObjectInSheet;
#pragma pack(push,4)
class PASCALIMPLEMENTATION TXLSObjectInSheet : public System::TObject
{
	typedef System::TObject inherited;
	
public:
	System::Word ObjectType;
	Smcells::TSMRange* Range;
	Smcells::TSMRange* Offset;
	int SharedIndex;
public:
	/* TObject.Create */ inline __fastcall TXLSObjectInSheet(void) : System::TObject() { }
	/* TObject.Destroy */ inline __fastcall virtual ~TXLSObjectInSheet(void) { }
	
};

#pragma pack(pop)

class DELPHICLASS TXLSObjectsInSheet;
#pragma pack(push,4)
class PASCALIMPLEMENTATION TXLSObjectsInSheet : public System::Classes::TList
{
	typedef System::Classes::TList inherited;
	
public:
	/* TList.Destroy */ inline __fastcall virtual ~TXLSObjectsInSheet(void) { }
	
public:
	/* TObject.Create */ inline __fastcall TXLSObjectsInSheet(void) : System::Classes::TList() { }
	
};

#pragma pack(pop)

class DELPHICLASS TVBAProjectItem;
#pragma pack(push,4)
class PASCALIMPLEMENTATION TVBAProjectItem : public System::TObject
{
	typedef System::TObject inherited;
	
public:
	System::WideString Entry;
	System::WideString ModuleName;
	System::WideString ModuleID;
	unsigned Offset;
	System::UnicodeString Body;
public:
	/* TObject.Create */ inline __fastcall TVBAProjectItem(void) : System::TObject() { }
	/* TObject.Destroy */ inline __fastcall virtual ~TVBAProjectItem(void) { }
	
};

#pragma pack(pop)

class DELPHICLASS TVBAProjectItems;
#pragma pack(push,4)
class PASCALIMPLEMENTATION TVBAProjectItems : public System::Classes::TList
{
	typedef System::Classes::TList inherited;
	
public:
	/* TList.Destroy */ inline __fastcall virtual ~TVBAProjectItems(void) { }
	
public:
	/* TObject.Create */ inline __fastcall TVBAProjectItems(void) : System::Classes::TList() { }
	
};

#pragma pack(pop)

class DELPHICLASS TCustomMSExcel;
class PASCALIMPLEMENTATION TCustomMSExcel : public Smcells::TSpreadSheetFile
{
	typedef Smcells::TSpreadSheetFile inherited;
	
private:
	TExcelVersion FVersion;
	bool FParseVBA;
	System::AnsiString FVBAProject;
	System::UnicodeString FVBAMacroSource;
	int FSheetIndex;
	bool FParsePictures;
	Smi_sum::TSMISummaryInformation* FSummaryInformation;
	bool FIsEncrypted;
	System::UnicodeString FPassword;
	Smcells::TSMIOnPasswordEvent FOnPassword;
	void __fastcall SetSummaryInformation(Smi_sum::TSMISummaryInformation* Value);
	System::WideString __fastcall GetUnicodeString(System::Byte *arr, int StartPos, System::Byte Options, int Len);
	
protected:
	System::Sysutils::TByteArray BufferRecord;
	__int64 intCurPos;
	int intRowCount;
	int intColCount;
	bool CountIsDefined;
	int intXLSRowCount;
	int intXLSColCount;
	TLongIntArray FColorPalette;
	System::Word FColorPaletteCount;
	bool __fastcall AskValidPassword(void);
	void __fastcall ProcessColors(void);
	System::UnicodeString __fastcall GetErrorText(int Code);
	virtual void __fastcall ApplyEvents(void);
	void __fastcall ClearFonts(void);
	void __fastcall ClearFormats(void);
	void __fastcall ClearVBAProjectItems(void);
	TXLSFormat* __fastcall GetXLSFormat(int Index);
	System::Uitypes::TColor __fastcall GetColorByXLSIndex(int AIndex);
	System::Uitypes::TColor __fastcall GetXLSColorByIndex(int index);
	void __fastcall AddFormat(bool IsNumericFormat, System::UnicodeString AName, int AIndex, int AFontIndex, int AHVAlignment, System::Uitypes::TColor ABackground);
	bool __fastcall ValueIsDateTime(int intFormat);
	bool __fastcall ValueIsPercent(int intFormat);
	void __fastcall DecompressMacros(_di_IStorage Storage);
	void __fastcall LoadVBProject(_di_IStorage Storage);
	void __fastcall LoadVBA(_di_IStorage Storage);
	
public:
	System::Classes::TList* Fonts;
	System::Classes::TList* Formats;
	System::Classes::TStrings* NumericFormats;
	System::Classes::TList* Names;
	Smiutils::TWideStrings* SheetNames;
	Smiutils::TWideStrings* SST;
	TVBAProjectItems* VBAProjectItems;
	__fastcall virtual TCustomMSExcel(System::Classes::TComponent* AOwner);
	__fastcall virtual ~TCustomMSExcel(void);
	__property System::AnsiString VBAProject = {read=FVBAProject};
	__property System::UnicodeString VBAMacroSource = {read=FVBAMacroSource};
	__property bool ParsePictures = {read=FParsePictures, write=FParsePictures, default=0};
	
__published:
	__property Smi_sum::TSMISummaryInformation* SummaryInformation = {read=FSummaryInformation, write=SetSummaryInformation};
	__property TExcelVersion Version = {read=FVersion, write=FVersion, nodefault};
	__property int SheetIndex = {read=FSheetIndex, write=FSheetIndex, nodefault};
	__property bool ParseVBA = {read=FParseVBA, write=FParseVBA, default=0};
	__property System::UnicodeString Password = {read=FPassword, write=FPassword};
	__property Smcells::TSMIOnPasswordEvent OnPassword = {read=FOnPassword, write=FOnPassword};
};


class DELPHICLASS TMSExcel;
class PASCALIMPLEMENTATION TMSExcel : public TCustomMSExcel
{
	typedef TCustomMSExcel inherited;
	
private:
	int FMaxBuffSize;
	int __fastcall GetMaxBuffSize(void);
	System::WideString __fastcall DecodeUnicodeString(System::Byte *arr, int StartPos, int Len, bool PlainAnsi);
	System::Classes::TAlignment __fastcall GetXLSAlignment(System::Byte Value);
	void __fastcall ParseMSODrawing(_di_IStream OStream);
	bool __fastcall ProcessBIFFRecord(_di_IStream OStream);
	
protected:
	System::TDateTime FBaseDate;
	System::Word XLSBuildNo;
	System::Word XLSBuildYear;
	bool __fastcall IsBIFF5Build(void);
	virtual void __fastcall ApplyEvents(void);
	void __fastcall ClearNames(void);
	void __fastcall ClearSharedFormulas(void);
	void __fastcall ImportFromStream(System::Classes::TStream* Stream);
	void __fastcall ImportFromOLEStream(_di_IStorage Storage);
	
public:
	System::Classes::TList* Names;
	System::Classes::TList* SharedFormulas;
	TXLSSharedObjects* SharedObjects;
	TXLSObjectsInSheet* ObjectsInSheet;
	__fastcall virtual TMSExcel(System::Classes::TComponent* AOwner);
	__fastcall virtual ~TMSExcel(void);
	virtual void __fastcall LoadFromFile(const System::WideString FileName);
	virtual void __fastcall LoadFromStream(System::Classes::TStream* AStream);
	System::UnicodeString __fastcall GetFormatString(int AFormatIndex);
	void __fastcall FillFormatForCell(Smcells::TSMICell* cell, Vcl::Graphics::TFont* &fnt, System::UnicodeString &FormatMask);
	__classmethod void __fastcall ClearSharedObjects(System::Classes::TList* lstObjectsInSheet, System::Classes::TList* lstObjects);
	virtual bool __fastcall IsEncrypted(void);
	__property __int64 CurrentPosition = {read=intCurPos};
};


class DELPHICLASS TMSExcelX;
class PASCALIMPLEMENTATION TMSExcelX : public TCustomMSExcel
{
	typedef TCustomMSExcel inherited;
	
private:
	int FcurSheetIndex;
	int CurrentRow;
	bool ToSkipLoadSheet;
	bool ToAddSST;
	void __fastcall ReadRecordHeader(System::Classes::TStream* AStream);
	
protected:
	Smcells::TBIFF12RecordHeader BufferHeader12;
	void __fastcall NewSSTAdd(System::TObject* Sender, Smixml::TSMXMLItem* ParentNode, System::WideString ATagName, System::WideString ATagValue, System::WideString ATagAttributes, bool &Accept);
	void __fastcall DeleteSSTTag(System::TObject* Sender, Smixml::TSMXMLItem* &Node, bool &Cancel);
	void __fastcall NewSheetNameAdd(System::TObject* Sender, Smixml::TSMXMLItem* ParentNode, System::WideString ATagName, System::WideString ATagValue, System::WideString ATagAttributes, bool &Accept);
	void __fastcall NewRowTag(System::TObject* Sender, Smixml::TSMXMLItem* ParentNode, System::WideString ATagName, System::WideString ATagValue, System::WideString ATagAttributes, bool &Accept);
	void __fastcall DeleteRowTag(System::TObject* Sender, Smixml::TSMXMLItem* &Node, bool &Cancel);
	bool __fastcall ProcessBIFF12Record(System::Classes::TStream* AStream);
	void __fastcall UnZipAndLoadBinaryXML(Smizipfile::TZipArchive* ZipFileMem, const System::UnicodeString AFileName);
	void __fastcall UnZipVBProjectAndLoad(Smizipfile::TZipArchive* ZipFileMem, const System::UnicodeString AFileName);
	void __fastcall UnZipDocProp(Smizipfile::TZipArchive* ZipFileMem, const System::UnicodeString AFileName);
	void __fastcall UnZipPath(Smizipfile::TZipArchive* ZipFileMem, const System::UnicodeString AFileName, const System::UnicodeString XMLPath, const System::UnicodeString XMLNode, Smixml::TSMIXMLOnTagEvent OnNewTag, Smixml::TSMIXMLOnAfterTagEvent OnAfterTag);
	void __fastcall UnZipStyles(Smizipfile::TZipArchive* ZipFileMem, const System::UnicodeString AFileName);
	virtual void __fastcall InternalLoadFromOLEStream(System::Classes::TStream* AStream);
	void __fastcall ImportFromOLEStream(_di_IStorage Storage);
	
public:
	__fastcall virtual TMSExcelX(System::Classes::TComponent* AOwner);
	virtual void __fastcall LoadFromStream(System::Classes::TStream* Stream);
	virtual void __fastcall LoadFromFile(const System::WideString AFileName);
public:
	/* TCustomMSExcel.Destroy */ inline __fastcall virtual ~TMSExcelX(void) { }
	
};


//-- var, const, procedure ---------------------------------------------------
static const System::Word XLSR_BLIP_WMF = System::Word(0x216);
static const System::Word XLSR_BLIP_EMF = System::Word(0x3d4);
static const System::Word XLSR_BLIP_JPEG = System::Word(0x46a);
static const System::Word XLSR_BLIP_PNG = System::Word(0x6e0);
static const System::Word XLSR_BLIP_DIB = System::Word(0x7a8);
extern PACKAGE System::UnicodeString __fastcall SMIApplyFormatByExcelMask(const System::UnicodeString XLSFormat, const System::Variant &Value);
extern PACKAGE bool __fastcall SMIGetSheetList(const System::UnicodeString AFileName, System::Classes::TStrings* lst);

}	/* namespace Smxls */
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_SMXLS)
using namespace Smxls;
#endif
#pragma pack(pop)
#pragma option pop

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