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

// (DO NOT EDIT: machine generated header) 'BIFF_VBA5.pas' rev: 28.00 (Windows)

#ifndef Biff_vba5HPP
#define Biff_vba5HPP

#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 <System.Contnrs.hpp>	// Pascal unit
#include <Winapi.Windows.hpp>	// Pascal unit
#include <Winapi.ActiveX.hpp>	// Pascal unit
#include <System.Win.ComObj.hpp>	// Pascal unit
#include <BIFF_WideStrList5.hpp>	// Pascal unit
#include <XLSUtils5.hpp>	// Pascal unit

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

namespace Biff_vba5
{
//-- type declarations -------------------------------------------------------
enum DECLSPEC_DENUM TVBAReadResult : unsigned char { vbarrFailure, vbarrReadOnly, vbarrOk };

#pragma pack(push,1)
struct DECLSPEC_DRECORD TVBARecHeader
{
public:
	System::Word RecId;
	unsigned Length;
};
#pragma pack(pop)


struct TVBARecordData;
typedef TVBARecordData *PVBARecordData;

struct DECLSPEC_DRECORD TVBARecordData
{
private:
	struct DECLSPEC_DRECORD _TVBARecordData__1
	{
	};
	
	
	
public:
	System::Word RecId;
	unsigned Length;
	_TVBARecordData__1 Data;
};


#pragma pack(push,1)
struct DECLSPEC_DRECORD TRecVBAProjVersion
{
public:
	System::Word ExcelVBA;
	System::Word Mac;
	System::Word Unknown;
};
#pragma pack(pop)


#pragma pack(push,1)
struct DECLSPEC_DRECORD TRecVBALanguageId
{
public:
	unsigned Id1;
	unsigned Id2;
	System::Word CharSet;
	System::Word Len1;
	unsigned Unknown1;
	unsigned Unknown2;
	System::Word Len2;
	System::Word Len3;
	System::Word Len4;
};
#pragma pack(pop)


struct DECLSPEC_DRECORD TModuleData
{
public:
	System::WideString Name;
	unsigned Offset;
};


enum DECLSPEC_DENUM TVbaModuleType : unsigned char { vmtMacro, vmtDocument };

class DELPHICLASS TRecordStorageVBA;
#pragma pack(push,4)
class PASCALIMPLEMENTATION TRecordStorageVBA : public System::Classes::TList
{
	typedef System::Classes::TList inherited;
	
private:
	System::RawByteString __fastcall GetAsString(int Index);
	System::UnicodeString __fastcall GetAsWideString(int Index);
	void __fastcall SetAsString(int Index, const System::RawByteString Value);
	void __fastcall SetAsWideString(int Index, const System::UnicodeString Value);
	PVBARecordData __fastcall GetItems(int Index);
	
public:
	__fastcall virtual ~TRecordStorageVBA(void);
	virtual void __fastcall Clear(void);
	PVBARecordData __fastcall AddRec(const TVBARecHeader &Header, System::Sysutils::PByteArray Data);
	HIDESBASE void __fastcall Delete(int Index);
	void __fastcall RenameModule(System::UnicodeString Name);
	void __fastcall Write(System::Classes::TStream* Stream);
	__property PVBARecordData Items[int Index] = {read=GetItems};
	__property System::RawByteString AsString[int Index] = {read=GetAsString, write=SetAsString};
	__property System::UnicodeString AsWideString[int Index] = {read=GetAsWideString, write=SetAsWideString};
public:
	/* TObject.Create */ inline __fastcall TRecordStorageVBA(void) : System::Classes::TList() { }
	
};

#pragma pack(pop)

class DELPHICLASS TXLSVBAProject;
#pragma pack(push,4)
class PASCALIMPLEMENTATION TXLSVBAProject : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	typedef System::DynamicArray<System::UnicodeString> _TXLSVBAProject__1;
	
	typedef System::DynamicArray<TModuleData> _TXLSVBAProject__2;
	
	
private:
	TRecVBAProjVersion FProjVersion;
	TRecVBALanguageId FLangId;
	_TXLSVBAProject__1 FLinkStrings;
	_TXLSVBAProject__2 FModules;
	
public:
	bool __fastcall Read(_di_IStream Stream);
	void __fastcall Clear(void);
public:
	/* TObject.Create */ inline __fastcall TXLSVBAProject(void) : System::TObject() { }
	/* TObject.Destroy */ inline __fastcall virtual ~TXLSVBAProject(void) { }
	
};

#pragma pack(pop)

class DELPHICLASS TVBAModule;
#pragma pack(push,4)
class PASCALIMPLEMENTATION TVBAModule : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	void __fastcall SetName(const System::UnicodeString Value);
	
protected:
	System::UnicodeString FName;
	int FFileOffset;
	TVbaModuleType FModuleType;
	Biff_widestrlist5::TXLSValueWideStringList* FAttributes;
	TRecordStorageVBA* FDir;
	
public:
	__fastcall TVBAModule(void);
	__fastcall virtual ~TVBAModule(void);
	__property System::UnicodeString Name = {read=FName, write=SetName};
	__property TVbaModuleType ModuleType = {read=FModuleType, write=FModuleType, nodefault};
};

#pragma pack(pop)

class DELPHICLASS TVBAModuleSource;
#pragma pack(push,4)
class PASCALIMPLEMENTATION TVBAModuleSource : public TVBAModule
{
	typedef TVBAModule inherited;
	
private:
	System::Classes::TStringList* FSource;
	
protected:
	void __fastcall AddSrcExtractAttr(System::RawByteString Src);
	
public:
	__fastcall TVBAModuleSource(void);
	__fastcall virtual ~TVBAModuleSource(void);
	__property System::Classes::TStringList* Source = {read=FSource};
};

#pragma pack(pop)

class DELPHICLASS TXLSVBA;
#pragma pack(push,4)
class PASCALIMPLEMENTATION TXLSVBA : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	typedef System::DynamicArray<System::Byte> _TXLSVBA__1;
	
	
public:
	TVBAModuleSource* operator[](int Index) { return Modules[Index]; }
	
private:
	System::Contnrs::TObjectList* FModules;
	TXLSVBAProject* FVBAProject;
	System::Classes::TStringList* FProject;
	_TXLSVBA__1 FProjectwm;
	bool FEditVBA;
	bool FDisableVBA;
	bool FEditStateLocked;
	bool FIsEditing;
	TRecordStorageVBA* FDir;
	_di_ILockBytes FSavedLockBytes;
	_di_IStorage FSavedStorage;
	bool FHighCompression;
	void __fastcall SetEditVBA(const bool Value);
	int __fastcall StreamSize(_di_IStream Stream);
	int __fastcall DecompressVBA(System::Sysutils::PByteArray BufIn, System::Sysutils::PByteArray &BufOut, int BufSize, int Offset);
	void __fastcall CompressVBA(System::Sysutils::PByteArray Buf, int BufSize, _di_IStream Stream);
	void __fastcall ReadDir(_di_IStorage Storage, System::Sysutils::PByteArray Buf, int BufSz);
	TVBAModuleSource* __fastcall GetModules(int Index);
	int __fastcall ReadStrmToBuf(_di_IStream Stream, System::Sysutils::PByteArray &Buf);
	void __fastcall Strip(_di_IStorage stgVBA);
	void __fastcall ReadPROJECT(_di_IStorage Storage);
	void __fastcall ReadPROJECTwm(_di_IStorage Storage);
	void __fastcall WritePROJECT(_di_IStorage Storage);
	void __fastcall WritePROJECTwm(_di_IStorage Storage);
	void __fastcall WriteModules(_di_IStorage Storage);
	void __fastcall WriteDir(_di_IStorage Storage);
	void __fastcall WriteEmptyVBA_PROJECT(_di_IStream Stream);
	void __fastcall Int_AddModule(System::Sysutils::PByteArray &Buf, _di_IStorage Storage);
	int __fastcall GetCompressShift(int Index);
	void __fastcall SetDisableVBA(const bool Value);
	
public:
	__fastcall TXLSVBA(void);
	__fastcall virtual ~TXLSVBA(void);
	void __fastcall Clear(void);
	TVBAReadResult __fastcall Read(_di_IStorage Storage);
	void __fastcall Write(_di_IStorage Storage);
	TVBAModuleSource* __fastcall AddModule(System::UnicodeString ModuleName, TVbaModuleType ModuleType);
	TVBAModuleSource* __fastcall ModuleByName(System::UnicodeString ModuleName);
	int __fastcall ModuleIndexByName(System::UnicodeString ModuleName);
	void __fastcall DeleteModule(System::UnicodeString ModuleName);
	int __fastcall Count(void);
	bool __fastcall HasData(void);
	__property TVBAModuleSource* Modules[int Index] = {read=GetModules/*, default*/};
	__property bool EditVBA = {read=FEditVBA, write=SetEditVBA, nodefault};
	__property bool DisableVBA = {read=FDisableVBA, write=SetDisableVBA, nodefault};
	__property bool HighCompression = {read=FHighCompression, write=FHighCompression, nodefault};
};

#pragma pack(pop)

//-- var, const, procedure ---------------------------------------------------
#define VBA_ROOTDIR_NAME L"_VBA_PROJECT_CUR"
#define VBA_SUBDIR_NAME L"VBA"
#define VBA_PROJDIR_NAME L"_VBA_PROJECT"
}	/* namespace Biff_vba5 */
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_BIFF_VBA5)
using namespace Biff_vba5;
#endif
#pragma pack(pop)
#pragma option pop

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