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

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

#ifndef WOLE2StreamHPP
#define WOLE2StreamHPP

#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <XlsMessages.hpp>	// Pascal unit
#include <ComObj.hpp>	// Pascal unit
#include <ActiveX.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 Wole2stream
{
//-- type declarations -------------------------------------------------------
#pragma option push -b-
enum TEnumOle2Open { Ole2_Read, Ole2_Write };
#pragma option pop

struct TMsOleDirInfo
{
	WideString Name;
	int OleType;
	__int64 Size;
} ;

typedef DynamicArray<_di_IStorage >  TIStorageArray;

typedef DynamicArray<TMsOleDirInfo >  TMsOleDirInfoArray;

class DELPHICLASS TOle2Storage;
class PASCALIMPLEMENTATION TOle2Storage : public System::TObject 
{
	typedef System::TObject inherited;
	
private:
	TEnumOle2Open FMode;
	_di_IStorage FStorage;
	DynamicArray<_di_IStorage >  StorageList;
	__int64 SizeWritten;
	_di_ILockBytes FLockBytes;
	unsigned HLockBytes;
	Classes::TStream* FStream;
	
public:
	__fastcall TOle2Storage(const AnsiString AFileName, const TEnumOle2Open aMode, const Classes::TStream* 
		aStream);
	__fastcall virtual ~TOle2Storage(void);
	void __fastcall GetDirectories(TMsOleDirInfoArray &DirInfo);
	void __fastcall CdUp(void);
	void __fastcall CdDown(const WideString Dir, const bool CreateIfNeeded);
	__property _di_IStorage Storage = {read=FStorage};
	__property TEnumOle2Open Mode = {read=FMode, nodefault};
	void __fastcall Commit(void);
	void __fastcall CheckCommit(const __int64 Count);
};


class DELPHICLASS TOle2Stream;
class PASCALIMPLEMENTATION TOle2Stream : public Classes::TStream 
{
	typedef Classes::TStream inherited;
	
protected:
	TOle2Storage* FStorage;
	_di_IStream FStream;
	
public:
	__fastcall TOle2Stream(const TOle2Storage* AStorage, const WideString StreamName);
	virtual int __fastcall Write(const void *Buffer, int Count);
	virtual int __fastcall Read(void *Buffer, int Count);
	virtual int __fastcall Seek(int Offset, Word Origin);
public:
	#pragma option push -w-inl
	/* TObject.Destroy */ inline __fastcall virtual ~TOle2Stream(void) { }
	#pragma option pop
	
};


//-- var, const, procedure ---------------------------------------------------
static const Shortint OptionsReadStorage = 0x10;
static const Shortint OptionsReadRoot = 0x20;
static const Shortint OptionsWrite = 0x11;
static const Word OptionsStreamWrite = 0x1011;
static const Shortint OptionsStreamRead = 0x10;
static const Shortint MsOleStreamT = 0x2;
static const Shortint MsOleStorageT = 0x1;

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

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