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

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

#ifndef DWGHPP
#define DWGHPP

#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <MVFont.hpp>	// Pascal unit
#include <SGLines.hpp>	// Pascal unit
#include <sgConsts.hpp>	// Pascal unit
#include <Extrusion.hpp>	// Pascal unit
#include <DXFImage.hpp>	// Pascal unit
#include <DXFConv.hpp>	// Pascal unit
#include <Graphics.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 Dwg
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS EdwgError;
class PASCALIMPLEMENTATION EdwgError : public Sysutils::Exception 
{
	typedef Sysutils::Exception inherited;
	
public:
	#pragma option push -w-inl
	/* Exception.Create */ inline __fastcall EdwgError(const AnsiString Msg) : Sysutils::Exception(Msg)
		 { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateFmt */ inline __fastcall EdwgError(const AnsiString Msg, const System::TVarRec * 
		Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateRes */ inline __fastcall EdwgError(int Ident)/* overload */ : Sysutils::Exception(
		Ident) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResFmt */ inline __fastcall EdwgError(int Ident, const System::TVarRec * Args, const 
		int Args_Size)/* overload */ : Sysutils::Exception(Ident, Args, Args_Size) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateHelp */ inline __fastcall EdwgError(const AnsiString Msg, int AHelpContext) : Sysutils::Exception(
		Msg, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateFmtHelp */ inline __fastcall EdwgError(const AnsiString Msg, const System::TVarRec 
		* Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext
		) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResHelp */ inline __fastcall EdwgError(int Ident, int AHelpContext)/* overload */
		 : Sysutils::Exception(Ident, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResFmtHelp */ inline __fastcall EdwgError(System::PResStringRec ResStringRec, const 
		System::TVarRec * Args, const int Args_Size, int AHelpContext)/* overload */ : Sysutils::Exception(
		ResStringRec, Args, Args_Size, AHelpContext) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* TObject.Destroy */ inline __fastcall virtual ~EdwgError(void) { }
	#pragma option pop
	
};


typedef void __fastcall (__closure *TdwgProgressEvent)(Graphics::TProgressStage Stage, int Done, int 
	Count);

struct TdwgLocator;
typedef TdwgLocator *PdwgLocator;

#pragma pack(push, 1)
struct TdwgLocator
{
	Byte RecNumber;
	int Seeker;
	int Size;
} ;
#pragma pack(pop)

struct TdwgFileHeader;
typedef TdwgFileHeader *PdwgFileHeader;

#pragma pack(push, 1)
struct TdwgFileHeader
{
	char VersionID[6];
	char Pad[7];
	int ImageSeeker;
	Word Unknown;
	Word CodePage;
	int Locators;
} ;
#pragma pack(pop)

class DELPHICLASS TdwgObject;
class DELPHICLASS TdwgReader;
class PASCALIMPLEMENTATION TdwgObject : public System::TObject 
{
	typedef System::TObject inherited;
	
private:
	Dxfconv::TsgDXFEntity* FEntity;
	int FHandle;
	int FSubEnts;
	int FSrcStart;
	int FSrcEnd;
	Classes::TList* FChildren;
	Sgconsts::TsgDWGVersion FVer;
	Sgconsts::TsgInt64 FStrsStart;
	Sgconsts::TsgInt64 FHndsStart;
	Sgconsts::TsgInt64 FDataEnd;
	virtual int __fastcall GetBitSize(void);
	virtual void __fastcall SetBitSize(const int Value);
	virtual Sgconsts::TsgInt64 __fastcall GetObjectBeginning(void);
	virtual void __fastcall SetObjectBeginning(const Sgconsts::TsgInt64 &Value);
	
protected:
	virtual Dxfconv::TsgDXFEntity* __fastcall GetOwner(TdwgReader* Reader) = 0 ;
	virtual void __fastcall ReadData(Sgconsts::TsgInt64 &PBit) = 0 ;
	void __fastcall ReadLineWeight(int AIndex);
	virtual void __fastcall References(TdwgReader* Reader);
	void __fastcall SkipHandles(Sgconsts::TsgInt64 &PBit, int Reactors, TdwgObject* Obj);
	__property int BitSize = {read=GetBitSize, write=SetBitSize, nodefault};
	__property Sgconsts::TsgInt64 ObjectBeginning = {read=GetObjectBeginning, write=SetObjectBeginning}
		;
	
public:
	__fastcall virtual ~TdwgObject(void);
public:
	#pragma option push -w-inl
	/* TObject.Create */ inline __fastcall TdwgObject(void) : System::TObject() { }
	#pragma option pop
	
};


typedef TMetaClass*TdwgClass;

class PASCALIMPLEMENTATION TdwgReader : public System::TObject 
{
	typedef System::TObject inherited;
	
private:
	Dxfconv::TsgDXFConverter* FConv;
	Classes::TStream* FStream;
	Classes::TList* FClasses;
	Classes::TList* FObjMap;
	Classes::TList* FProxies;
	char *FMem;
	Classes::TCustomMemoryStream* FSource;
	System::TObject* FReading;
	int FSize;
	int FImage;
	bool FIsNotHasActiveVPort;
	int FNext;
	int FLoaded;
	int FUnits;
	float FArrow;
	TdwgProgressEvent FOnProgress;
	Word FCodePage;
	Sgconsts::TsgDWGVersion FVersion;
	bool FNested;
	int __fastcall FindHandle(int Handle, int &Index);
	TdwgObject* __fastcall NewObject(int Code);
	Dxfconv::TsgDXFEntity* __fastcall FinishObject(TdwgObject* AObj, Dxfconv::TsgDXFEntity* AOwner);
	Dxfconv::TsgDXFEntity* __fastcall ReadObject(int ASeek, int AHandle, int AIndex);
	void __fastcall Init2007ObjectData(Sgconsts::TsgInt64 &StartBit, Sgconsts::TsgInt64 &PStrStart, Sgconsts::TsgInt64 
		&PHndStart, unsigned &EndBit);
	void __fastcall Read2007StrDataLength(const Sgconsts::TsgInt64 &PStart, unsigned &EndBit, unsigned 
		&StrSize);
	Dxfconv::TsgDXFEntity* __fastcall ObjByHandle(int AHandle, TMetaClass* AClass);
	int __fastcall VarCode(int Code);
	void __fastcall DoProgress(Graphics::TProgressStage Stage);
	void __fastcall CRead(int ASeek, int ASize);
	void __fastcall Read(int ASeek, int ASize);
	void __fastcall ReadPart(int AFirst, int ALast, Classes::TList* List);
	void __fastcall ReadHeadVars(int ASeek, int ASize);
	void __fastcall ReadClasses(int ASeek, int ASize);
	void __fastcall ReadObjMap(int ASeek, int ASize);
	void __fastcall ReadMeasurement(int ASeek);
	void __fastcall ReadTemplate(int ASeek, int ASize);
	void __fastcall ReadSummaryInfo(int ASeek, int ASize);
	
protected:
	bool __fastcall Stopped(void);
	virtual void __fastcall ReadHeader(void);
	virtual void __fastcall ReadObjects(void);
	virtual void __fastcall ReadImage(void);
	__property Sgconsts::TsgDWGVersion Version = {read=FVersion, write=FVersion, nodefault};
	
public:
	__fastcall TdwgReader(Dxfconv::TsgDXFConverter* Conv, Classes::TStream* S);
	__fastcall virtual ~TdwgReader(void);
	void __fastcall ReadFile(void);
	__property Dxfconv::TsgDXFConverter* Conv = {read=FConv};
	__property Classes::TStream* Stream = {read=FStream};
	__property TdwgProgressEvent OnProgress = {read=FOnProgress, write=FOnProgress};
};


class DELPHICLASS TsgDWGConverter;
class PASCALIMPLEMENTATION TsgDWGConverter : public Dxfconv::TsgDXFConverter 
{
	typedef Dxfconv::TsgDXFConverter inherited;
	
protected:
	Graphics::TBitmap* FImage;
	bool FStopped;
	virtual void __fastcall Initialize(const AnsiString FileName);
	
public:
	__fastcall virtual ~TsgDWGConverter(void);
	virtual void __fastcall StopLoading(void);
public:
	#pragma option push -w-inl
	/* TsgDXFConverter.Create */ inline __fastcall TsgDWGConverter(const AnsiString FileName) : Dxfconv::TsgDXFConverter(
		FileName) { }
	#pragma option pop
	
};


class DELPHICLASS TsgDWGImage;
class PASCALIMPLEMENTATION TsgDWGImage : public Dxfimage::TsgDXFImage 
{
	typedef Dxfimage::TsgDXFImage inherited;
	
private:
	Graphics::TBitmap* __fastcall BM(void);
	HIDESBASE void __fastcall DoProgress(Graphics::TProgressStage Stage, int Done, int Count);
	
protected:
	virtual Dxfconv::TsgDXFConverter* __fastcall CreateConverter(void);
	virtual int __fastcall GetHeight(void);
	virtual int __fastcall GetWidth(void);
	virtual bool __fastcall GetEmpty(void);
	virtual void __fastcall Draw(Graphics::TCanvas* Canvas, const Windows::TRect &Rect);
	
public:
	virtual void __fastcall Assign(Classes::TPersistent* Source);
	virtual void __fastcall LoadFromStream(Classes::TStream* S);
	virtual void __fastcall SaveToStream(Classes::TStream* S);
	void __fastcall LoadPreviewFromFile(const AnsiString FileName);
	__property Graphics::TBitmap* Preview = {read=BM};
public:
	#pragma option push -w-inl
	/* TsgDXFImage.Create */ inline __fastcall virtual TsgDWGImage(void) : Dxfimage::TsgDXFImage() { }
	#pragma option pop
	#pragma option push -w-inl
	/* TsgDXFImage.Destroy */ inline __fastcall virtual ~TsgDWGImage(void) { }
	#pragma option pop
	
};


//-- var, const, procedure ---------------------------------------------------
extern PACKAGE Word CF_DWG;
extern PACKAGE bool DWGPreview;
extern PACKAGE void __fastcall ReadProxyData(Dxfconv::TsgDXFProxy* AProxy, Sgconsts::TsgInt64 &PBit)
	;
extern PACKAGE void __fastcall LoadProxySubEntities(Dxfconv::TsgDXFConverter* Conv, Classes::TList* 
	FProxies);

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

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