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

// (DO NOT EDIT: machine generated header) 'Smxls.pas' rev: 21.00

#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 <Classes.hpp>	// Pascal unit
#include <Windows.hpp>	// Pascal unit
#include <Smcells.hpp>	// Pascal unit
#include <Activex.hpp>	// Pascal unit
#include <Comobj.hpp>	// Pascal unit
#include <Graphics.hpp>	// Pascal unit
#include <Sysutils.hpp>	// Pascal unit
#include <Smi_sum.hpp>	// Pascal unit
#include <Smiutils.hpp>	// Pascal unit
#include <Variants.hpp>	// Pascal unit

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

namespace Smxls
{
//-- type declarations -------------------------------------------------------
#pragma option push -b-
enum TExcelVersion { evUnknown, evExcel2, evExcel3, evExcel4, evExcel5, evExcel7, evExcel8, evExcel9, evExcel12, evExcel12Bin };
#pragma option pop

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

typedef StaticArray<int, 65536> TLongIntArray;

typedef TLongIntArray *PLongIntArray;

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


class DELPHICLASS TXLSName;
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) { }
	
};


class DELPHICLASS TXLSSharedFormula;
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;
	Sysutils::TByteArray *Formula;
	System::UnicodeString __fastcall FormulaString(void);
public:
	/* TObject.Create */ inline __fastcall TXLSSharedFormula(void) : System::TObject() { }
	/* TObject.Destroy */ inline __fastcall virtual ~TXLSSharedFormula(void) { }
	
};


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


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


class DELPHICLASS TXLSObjectInSheet;
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) { }
	
};


class DELPHICLASS TXLSObjectsInSheet;
class PASCALIMPLEMENTATION TXLSObjectsInSheet : public Classes::TList
{
	typedef Classes::TList inherited;
	
public:
	/* TList.Destroy */ inline __fastcall virtual ~TXLSObjectsInSheet(void) { }
	
public:
	/* TObject.Create */ inline __fastcall TXLSObjectsInSheet(void) : Classes::TList() { }
	
};


class DELPHICLASS TVBAProjectItem;
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) { }
	
};


class DELPHICLASS TVBAProjectItems;
class PASCALIMPLEMENTATION TVBAProjectItems : public Classes::TList
{
	typedef Classes::TList inherited;
	
public:
	/* TList.Destroy */ inline __fastcall virtual ~TVBAProjectItems(void) { }
	
public:
	/* TObject.Create */ inline __fastcall TVBAProjectItems(void) : Classes::TList() { }
	
};


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;
	void __fastcall SetSummaryInformation(Smi_sum::TSMISummaryInformation* Value);
	System::WideString __fastcall GetUnicodeString(System::Byte *arr, int StartPos, System::Byte Options, int Len);
	
protected:
	Sysutils::TByteArray BufferRecord;
	__int64 intCurPos;
	int intRowCount;
	int intColCount;
	bool CountIsDefined;
	int intXLSRowCount;
	int intXLSColCount;
	TLongIntArray FColorPalette;
	System::Word FColorPaletteCount;
	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);
	Graphics::TColor __fastcall GetColorByXLSIndex(int AIndex);
	Graphics::TColor __fastcall GetXLSColorByIndex(int index);
	void __fastcall AddFormat(bool IsNumericFormat, System::UnicodeString AName, int AIndex, int AFontIndex, int AHVAlignment, Graphics::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:
	Classes::TList* Fonts;
	Classes::TList* Formats;
	Classes::TStrings* NumericFormats;
	Classes::TList* Names;
	Smiutils::TWideStrings* SheetNames;
	Smiutils::TWideStrings* SST;
	TVBAProjectItems* VBAProjectItems;
	__fastcall virtual TCustomMSExcel(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};
};


class DELPHICLASS TMSExcel;
class PASCALIMPLEMENTATION TMSExcel : public TCustomMSExcel
{
	typedef TCustomMSExcel inherited;
	
private:
	bool FIsEncrypted;
	System::UnicodeString FPassword;
	Smcells::TSMIOnPasswordEvent FOnPassword;
	int FMaxBuffSize;
	int __fastcall GetMaxBuffSize(void);
	System::WideString __fastcall DecodeUnicodeString(System::Byte *arr, int StartPos, int Len, bool PlainAnsi);
	Classes::TAlignment __fastcall GetXLSAlignment(System::Byte Value);
	void __fastcall ParseMSODrawing(_di_IStream OStream);
	bool __fastcall AskValidPassword(void);
	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(Classes::TStream* Stream);
	void __fastcall ImportFromOLEStream(_di_IStorage Storage);
	
public:
	Classes::TList* Names;
	Classes::TList* SharedFormulas;
	TXLSSharedObjects* SharedObjects;
	TXLSObjectsInSheet* ObjectsInSheet;
	__fastcall virtual TMSExcel(Classes::TComponent* AOwner);
	__fastcall virtual ~TMSExcel(void);
	virtual void __fastcall LoadFromFile(const System::WideString FileName);
	virtual void __fastcall LoadFromStream(Classes::TStream* AStream);
	System::UnicodeString __fastcall GetFormatString(int AFormatIndex);
	void __fastcall FillFormatForCell(Smcells::TSMICell* cell, Graphics::TFont* &fnt, System::UnicodeString &FormatMask);
	__classmethod void __fastcall ClearSharedObjects(Classes::TList* lstObjectsInSheet, Classes::TList* lstObjects);
	virtual bool __fastcall IsEncrypted(void);
	__property __int64 CurrentPosition = {read=intCurPos};
	
__published:
	__property System::UnicodeString Password = {read=FPassword, write=FPassword};
	__property Smcells::TSMIOnPasswordEvent OnPassword = {read=FOnPassword, write=FOnPassword};
};


class DELPHICLASS TMSExcelX;
class PASCALIMPLEMENTATION TMSExcelX : public TCustomMSExcel
{
	typedef TCustomMSExcel inherited;
	
private:
	int CurrentRow;
	bool ToSkipLoadSheet;
	
protected:
	Smcells::TBIFF12RecordHeader BufferHeader12;
	bool __fastcall ProcessBIFF12Record(Classes::TStream* AStream);
	void __fastcall UnZipAndLoadBinaryXML(const System::UnicodeString AFileName);
	void __fastcall UnZipVBProjectAndLoad(const System::UnicodeString AFileName);
	void __fastcall UnZipProp(const System::UnicodeString AFileName, bool IsDocProp, const System::UnicodeString XMLPath, const System::UnicodeString XMLNode, Smiutils::TWideStrings* List);
	void __fastcall UnZipStyles(const System::UnicodeString AFileName);
	
public:
	__fastcall virtual TMSExcelX(Classes::TComponent* AOwner);
	virtual void __fastcall LoadFromStream(Classes::TStream* Stream);
	virtual void __fastcall LoadFromFile(const System::WideString AFileName);
public:
	/* TCustomMSExcel.Destroy */ inline __fastcall virtual ~TMSExcelX(void) { }
	
};


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

}	/* namespace Smxls */
using namespace Smxls;
#pragma pack(pop)
#pragma option pop

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