#ifndef AD_MCADSTRC_H
#define AD_MCADSTRC_H 1

//:Ignore
#define eNotImplemented eNotImplementedYet
#define eInetBase       20000

struct Mcad
{
    enum ErrorStatus       { eOk                        =  0,

                             eNotImplementedYet         =  1,
                             eNotApplicable             =  2,
                             eInvalidInput              =  3,
                             eAmbiguousInput            =  4,
                             eAmbiguousOutput           =  5,
                             eOutOfMemory               =  6,
                             eBufferTooSmall            =  7,
                             eInvalidOpenState          =  8,
                             eEntityInInactiveLayout    =  9,

                             eHandleExists              = 10,
                             eNullHandle                = 11,
                             eBrokenHandle              = 12,
                             eUnknownHandle             = 13,
                             eHandleInUse               = 14,
                             eNullObjectPointer         = 15,
                             eNullObjectId              = 16,
                             eNullBlockName             = 17,
                             eContainerNotEmpty	        = 18,
                             
                             eNullEntityPointer         = 20,
                             eIllegalEntityType         = 21,
                             eKeyNotFound               = 22,
                             eDuplicateKey              = 23,
                             eInvalidIndex              = 24,
                             eDuplicateIndex            = 25,
                             eAlreadyInDb               = 26,
                             eOutOfDisk                 = 27,
                             eDeletedEntry              = 28,
                             eNegativeValueNotAllowed   = 29,
                             eInvalidExtents            = 30,
                             eInvalidAdsName            = 31,
                             eInvalidSymbolTableName    = 32,
                             eInvalidKey                = 33,
                             eWrongObjectType           = 34,
                             eWrongDatabase             = 35,
                             eObjectToBeDeleted         = 36,
                             eInvalidDwgVersion         = 37,
                             eAnonymousEntry            = 38,
                             eIllegalReplacement        = 39,

                             eEndOfObject               = 40,
                             eEndOfFile                 = 41,
                             eIsReading                 = 42,
                             eIsWriting                 = 43,
                             eNotOpenForRead            = 44,
                             eNotOpenForWrite           = 45,
                             eNotThatKindOfClass        = 46,
                             eInvalidBlockName          = 47,
                             eMissingDxfField           = 48,
                             eDuplicateDxfField         = 49,

                             eInvalidDxfCode            = 50,
                             eInvalidResBuf     = 51,
                             eBadDxfSequence            = 52,
                             eFilerError                = 53,
                             eVertexAfterFace           = 54,
                             eInvalidFaceVertexIndex    = 55,
                             eInvalidMeshVertexIndex    = 56,
                             eOtherObjectsBusy          = 57,
                             eMustFirstAddBlockToDb     = 58,
                             eCannotNestBlockDefs       = 59,

                             eDwgRecoveredOK            = 60,
                             eDwgNotRecoverable         = 61,
                             eDxfPartiallyRead          = 62,
                             eDxfReadAborted            = 63,
                             eDxbPartiallyRead          = 64,
                             eDwgCRCDoesNotMatch        = 65,
                             eDwgSentinelDoesNotMatch   = 66,
                             eDwgObjectImproperlyRead   = 67,
                             eNoInputFiler              = 68,
                             eDwgNeedsAFullSave         = 69,
                             
                             eDxbReadAborted            = 70,
                             eFileLockedByMCAD          = 71,
                             eFileAccessErr             = 72,
                             eFileSystemErr             = 73,
                             eFileInternalErr           = 74,
                             eFileTooManyOpen           = 75,
                             eFileNotFound              = 76,
                             eDwkLockFileFound          = 77,
                             
                             eWasErased                 = 80,
                             ePermanentlyErased         = 81,
                             eWasOpenForRead            = 82,
                             eWasOpenForWrite           = 83,
                             eWasOpenForUndo            = 84,
                             eWasNotifying              = 85,
                             eWasOpenForNotify          = 86,
                             eOnLockedLayer             = 87,
                             eMustOpenThruOwner         = 88,
                             eSubentitiesStillOpen      = 89,
                             
                             eAtMaxReaders              = 90,
                             eIsWriteProtected          = 91,
                             eIsXRefObject              = 92,
                             eNotAnEntity               = 93,
                             eHadMultipleReaders        = 94,
                             eDuplicateRecordName       = 95,
                             eXRefDependent             = 96,
                             eSelfReference             = 97,
                             eMissingSymbolTable        = 98,
                             eMissingSymbolTableRec     = 99,

                             eWasNotOpenForWrite        = 100,
                             eCloseWasNotifying         = 101,
                             eCloseModifyAborted        = 102,
                             eClosePartialFailure       = 103,
                             eCloseFailObjectDamaged    = 104,
                             eCannotBeErasedByCaller    = 105,
                             eCannotBeResurrected       = 106,

                             eInsertAfter               = 110,
                             
                             eFixedAllErrors            = 120,
                             eLeftErrorsUnfixed         = 122,
                             eUnrecoverableErrors       = 123,
                             eNoDatabase                = 124,
                             eXdataSizeExceeded         = 125,
                             eRegappIdNotFound          = 126,
                             eRepeatEntity              = 127,
                             eRecordNotInTable          = 128,
                             eIteratorDone              = 129,
                             eNullIterator              = 130,
                             eNotInBlock                = 131,
                             eOwnerNotInDatabase        = 132,
                             eOwnerNotOpenForRead       = 133,
                             eOwnerNotOpenForWrite      = 134,
                             eExplodeBeforeTransform    = 135,
                             eCannotScaleNonUniformly   = 136,
                             eNotInDatabase             = 137,
                             eNotCurrentDatabase        = 138,
                             eIsAnEntity                = 139,

                             eCannotChangeActiveViewport = 140,
                             eNotInPaperspace           = 141,
                             eCommandWasInProgress      = 142,
                             
                             eGeneralModelingFailure    = 150,
                             eOutOfRange                = 151,
                             eNonCoplanarGeometry       = 152,
                             eDegenerateGeometry        = 153,
                             eInvalidAxis               = 154,
                             ePointNotOnEntity          = 155,
                             eSingularPoint             = 156,
                             eInvalidOffset             = 157,
                             eNonPlanarEntity           = 158,
                             eCannotExplodeEntity       = 159,

                             eStringTooLong             = 160,
                             eInvalidSymTableFlag       = 161,
                             eUndefinedLineType         = 162,
                             eInvalidTextStyle          = 163,
                             eTooFewLineTypeElements    = 164,
                             eTooManyLineTypeElements   = 165,
                             eExcessiveItemCount        = 166,
                             eIgnoredLinetypeRedef      = 167,
                             eBadUCS                    = 168,
                             eBadPaperspaceView         = 169,

                             eSomeInputDataLeftUnread   = 170,
                             eNoInternalSpace           = 171,
                             eInvalidDimStyle           = 172,
                             eInvalidLayer              = 173,

                             eUserBreak                 = 180,

                             eDwgNeedsRecovery          = 190,
                             eDeleteEntity              = 191,
                             eInvalidFix                = 192,
                             eFSMError                  = 193,
                             
                             eBadLayerName              = 200,
                             eLayerGroupCodeMissing     = 201,
                             eBadColorIndex             = 202,
                             eBadLinetypeName           = 203,
                             eBadLinetypeScale          = 204,
                             eBadVisibilityValue        = 205,
                             eProperClassSeparatorExpected = 206,
                             eBadLineWeightValue        = 207,

                             ePagerError                = 210,
                             eOutOfPagerMemory          = 211,
                             ePagerWriteError           = 212,
                             eWasNotForwarding          = 213,
                             
                             eInvalidIdMap              = 220,
                             eInvalidOwnerObject        = 221,
                             eOwnerNotSet               = 222,
                             
                             eWrongSubentityType        = 230,
                             eTooManyVertices           = 231,
                             eTooFewVertices            = 232,
                             
                             eNoActiveTransactions      = 250,
                             eNotTopTransaction         = 251,
                             eTransactionOpenWhileCommandEnded =  252,
                             eInProcessOfCommitting     = 253,
                             eNotNewlyCreated           = 254,
                             eLongTransReferenceError   = 255,
                             eNoWorkSet                 = 256,
                             
                             eAlreadyInGroup            = 260,
                             eNotInGroup                = 261,

                             eInvalidREFIID             = 290,
                             eInvalidNormal             = 291,
                             eInvalidStyle              = 292,

                             eCannotRestoreFromAcisFile = 300,
                             eMakeMeProxy               = 301,
                             eNLSFileNotAvailable       = 302,
                             eNotAllowedForThisProxy    = 303,

                             eNotSupportedInDwgApi      = 310,
                             ePolyWidthLost             = 311,
                             eNullExtents               = 312,
                             eExplodeAgain              = 313,
                             eBadDwgHeader              = 314,

                             eLockViolation             = 320,
                             eLockConflict              = 321,
                             eDatabaseObjectsOpen       = 322,
                             eLockChangeInProgress      = 323,

                             eVetoed                    = 325,

                             eNoDocument                = 330,
                             eNotFromThisDocument       = 331,
                             eLISPActive                = 332,
                             eTargetDocNotQuiescent     = 333,
                             eDocumentSwitchDisabled    = 334,
                             eInvalidContext            = 335, 

                             eCreateFailed              = 337,
                             eCreateInvalidName         = 338,
                             eSetFailed                 = 340,
                             eDelDoesNotExist           = 342,
                             eDelIsModelSpace           = 343,
                             eDelLastLayout             = 344,
                             eDelUnableToSetCurrent     = 345,
                             eDelUnableToFind           = 346,
                             eRenameDoesNotExist        = 348,
                             eRenameIsModelSpace        = 349,
                             eRenameInvalidLayoutName   = 350,
                             eRenameLayoutAlreadyExists = 351, 
                             eRenameInvalidName         = 352, 
                             eCopyDoesNotExist          = 354,
                             eCopyIsModelSpace          = 355,
                             eCopyFailed                = 356,
                             eCopyInvalidName           = 357,
                             eCopyNameExists            = 358,

                             eProfileDoesNotExist       = 359,
                             eInvalidFileExtension      = 360,
                             eInvalidProfileName        = 361,
                             eFileExists                = 362,     
                             eProfileIsInUse            = 363,
                             eCantOpenFile              = 364,
                             eNoFileName                = 365,
                             eRegistryAccessError       = 366,
                             eRegistryCreateError       = 367,

                             eBadDxfFile                = 368,
                             eUnknownDxfFileFormat      = 369,
                             eMissingDxfSection         = 370,
                             eInvalidDxfSectionName     = 371,
                             eNotDxfHeaderGroupCode     = 372,
                             eUndefinedDxfGroupCode     = 373,
                             eNotInitializedYet         = 374,
                             eInvalidDxf2dPoint         = 375,
                             eInvalidDxf3dPoint         = 376,
                             eBadlyNestedAppData        = 378,
                             eIncompleteBlockDefinition = 379,
                             eIncompleteComplexObject   = 380,
                             eBlockDefInEntitySection   = 381,
                             eNoBlockBegin              = 382,
                             eDuplicateLayerName        = 383,
                             eBadPlotStyleName          = 384,
                             eDuplicateBlockName        = 385,
                             eBadPlotStyleType          = 386,
                             eBadPlotStyleNameHandle    = 387,
                             eUndefineShapeName         = 388,
                             eDuplicateBlockDefinition  = 389,
                             eMissingBlockName          = 390,
                             eBinaryDataSizeExceeded    = 391,
                             eObjectIsReferenced        = 392,
                             eNoThumbnailBitmap         = 393,
                             eGuidNoAddress             = 394,

                             eMustBe0to2                = 395,    
                             eMustBe0to3                = 396,
                             eMustBe0to4                = 397,
                             eMustBe0to5                = 398,
                             eMustBe0to8                = 399,
                             eMustBe1to8                = 400,
                             eMustBe1to15               = 401,
                             eMustBePositive            = 402,
                             eMustBeNonNegative         = 403,
                             eMustBeNonZero             = 404,
                             eMustBe1to6                = 405,

                             eNoPlotStyleTranslationTable   = 406,
                             ePlotStyleInColorDependentMode = 407,
                             eMaxLayouts                = 408,
                             eNoClassId                 = 409,

                             eUndoOperationNotAvailable = 410,
                             eUndoNoGroupBegin          = 411,
                             
                             eHatchTooDense             = 420,

                             eOpenFileCancelled         = 430,
                             eNotHandled                = 431,
                             eMakeMeProxyAndResurrect   = 432,

                           
                             eInetOk                    = eInetBase,
                             eInetInCache, 
                             
                            
                             eInetFileNotFound,     
                             eInetBadPath,          
                             eInetTooManyOpenFiles, 
                             eInetFileAccessDenied, 
                             eInetInvalidFileHandle,
                             eInetDirectoryFull,    
                             eInetHardwareError,    
                             eInetSharingViolation, 
                             eInetDiskFull,         
                             eInetFileGenericError, 
                             
                            
                             eInetValidURL,
                             eInetNotAnURL,         
                             eInetNoWinInet,        
                             eInetOldWinInet,       
                             eInetNoMcadInet,       
                             eInetNotImplemented,   
                             eInetProtocolNotSupported,
                             
                             eInetCreateInternetSessionFailed,  
                             eInetInternetSessionConnectFailed,
                             eInetInternetSessionOpenFailed,
                             
                             eInetInvalidAccessType,    
                             eInetFileOpenFailed,       
                             eInetHttpOpenRequestFailed,
                             eInetUserCancelledTransfer,
                             
                            
                             eInetHttpBadRequest,                   
                             eInetHttpAccessDenied,                 
                             eInetHttpPaymentRequired,              
                             eInetHttpRequestForbidden,             
                             eInetHttpObjectNotFound,               
                             eInetHttpBadMethod,                    
                             eInetHttpNoAcceptableResponse,         
                             eInetHttpProxyAuthorizationRequired,   
                             eInetHttpTimedOut,                     
                             eInetHttpConflict,                     
                             eInetHttpResourceGone,                 
                             eInetHttpLengthRequired,               
                             eInetHttpPreconditionFailure,          
                             eInetHttpRequestTooLarge,              
                             eInetHttpUriTooLong,                   
                             eInetHttpUnsupportedMedia,             
                             
                             eInetHttpServerError,                  
                             eInetHttpNotSupported,                 
                             eInetHttpBadGateway,                   
                             eInetHttpServiceUnavailable,           
                             eInetHttpGatewayTimeout,               
                             eInetHttpVersionNotSupported,          
                             
                             eInetInternetError,                    
                             
                            
                             eInetGenericException,
                             
                           
                             eInetUnknownError,
                             
                            
                             eAlreadyActive,
                             eAlreadyInactive,

							 eMxDrawBase = 3000,

							 eAlreadyDeepClone,
							 eMxFastExit,
							 eIsAlreadyTheCurrentLayout,


							 eMxFileUnknownError = 3200,
							 eMxFileSZ_ERROR_UNKNOWN,
							 eMxFileSZ_ERROR_DATA,
							 eMxFileSZ_ERROR_MEM,
							 eMxFileSZ_ERROR_CRC,
							 eMxFileSZ_ERROR_UNSUPPORTED,
							 eMxFileSZ_ERROR_PARAM,
							 eMxFileSZ_ERROR_INPUT_EOF,
							 eMxFileSZ_ERROR_OUTPUT_EOF,
							 eMxFileSZ_ERROR_READ,
							 eMxFileSZ_ERROR_WRITE,
							 eMxFileSZ_ERROR_PROGRESS,
							 eMxFileSZ_ERROR_FAIL,
							 eMxFileSZ_ERROR_THREAD,

							 eMxFileSZ_ERROR_ARCHIVE,
							 eMxFileSZ_ERROR_NO_ARCHIVE,


							 eMxFileCreateTempFileFailed = 3250,
							 eMxFileNotOpenRegAppTable,
							 eMxFileNotOpenTextStyleTable,
							 eMxFileNotOpenLinetypeTable,
							 eMxFileNotOpenLayerTable,
							 eMxFileNotOpenBlockTable,
							 eMxFileNotOpenDimStyleTable,
							 eMxFileNotOpenViewportTable,
							 eMxFileNotOpenDictionary,
							 eMxFileCreateFileFailed,
							 eMxFileNewIteratorFailed,
							 eMxFileNewBlockRecordIteratorFailed,
							 eMxFileOpenFileFailed,
							 eMxFilePasswordEmpty,
							 eMxFileMajVersionError,
							 eMxFileMinVersionError,
							 eMxFileHandleError,
							 eMxFileReject,
							 eMxFileLibNotLoad,
							 eMxFileErrorProxyEntityType,
							 eMxFileErrorPrviewEntityType,
							 eMxFileOpenPrviewEntityError,
							 eMxFileNotOpenExDictionary,
							 eMxFileErrorSymbolTableClassName,
							 eMxFileErrorSymbolTableRecordClassName,
							 eMxFileErrorDictionaryClassName,
							 eMxFileErrorFileId,
							 eMxFileErrorBlockTableRecordClassName,
							 eMxFileErrorBlockRecordId,
							 eMxFileErrorSystemVariableClassName,
							 eMxFileNotCreateObject,
							 eMxFileErrorObjectClassName,
							 eMxFileErrorObjectFileId,
							 eMxFileErrorCustomEntityData,
							 eMxFileErrorSystemEntityData,
							 eMxFileNotOpenObjectDictionary,
						     eMxFileErrorZipType,
							 eMxFileInvalidFileHead,
						     eMxFileErrorLogic,
						     eMxFileErrorViewData,
							 eMxFileInvalidEnityVersion,

						     eMxFileReadErrorGetFileHead,
						     eMxFileReadInvalidFileHead,


							eMbFileInvalidVersion = 4250
            };

    
    enum PointHistory     {   eTablet      = 0x0001, 
                                                     
                                                     
                              eNotDigitizer= 0x0002, 
                                                     
                                                     
                                                     
                                                     
                                                     
                                                     
                              eLastPt     = 0x0004,  
                                                     
                              eGripped    = 0x008,   
                              eCartSnapped= 0x0010,  
                                                     
                              eOrtho      = 0x0020,  
                              eCyclingPt  = 0x0040,  
                                                     
                                                     
                                                     
                                                     
                              eOsnapped   = 0x0080,  
                              ePolarAngle = 0x0100,  
                              eAligned    = 0x0400,  

                              eAppFiltered = 0x0800, 
                                                     
                                                     

                              eForcedPick = 0x1000,  
                              ePickMask   = 0xE000,  
                                                     
                                                     
                                                     
                                                     
                                                     
                                                     
                              eDidNotPick = 0x0000,  
                                                     
                                                     

                              eUsedPickBox = 0x2000, 
                                                     
                              eUsedOsnapBox = 0x4000,
                                                     
                              ePickAborted  = 0x8000,
                                                     
                                                     
                                                     
                                                     
                              eXPending   = 0x10000, 
                              eYPending   = 0x20000, 
                              eZPending   = 0x40000, 
                              eCoordPending =
                                            0x70000, 
                                                     
                              eFromKeyboard =
                                            0x80000, 
                                                     
                              eNotInteractive =
                                           0x100000, 
                                                     
                                                     
    };

  
    enum PromptStatus {
        eNone     =  5000,
        eNormal   =  5100,
        eError    = -5001,
        eCancel   = -5002,
        eRejected = -5003,
        eFailed   = -5004,
        eKeyword  = -5005,
        eDirect   = -5999    
    };

	enum ReadContent
	{
		
		kReadAll		= 0xFFFFFFFF,
		kReadNull       = 0x0,				// 下面数据都不读取
		kReadHandle		= 0x2,
		kReadBlockRefPreviewIcon	= 0x4,
		kReadObjectsDictionary		= 0x10,	// 是否读对象字典，如果不读，字典下所有数据都不会读取.
		kReadGroupDict              = 0x20,	// 是否读取组字典
		kReadLayoutDict             = 0x40,
		kReadMlineStyleDict         = 0x80,
		kReadImageDict				= 0x100,
		kReadXrecord				= 0x200,
		kReadDrawOrder				= 0x400,
		kReadxData					= 0x800,
		kReadExternalReference      = 0x2000,
		kReadCustomEntity           = 0x4000,		// 是否读取自定义实体，如果该为项为真，则自动让kReadHandle值也为真，因为自定义实体需要名柄支持.
		kReadNamedObjectsDictionary = 0x10000, // 是否读取命名对象字典
		kUseExDrawing               = 0x20000,
		kPartialLoad				= 0x100000,
		kForbiddenInstance         = 0x200000,
		kFastRead = kReadLayoutDict | kReadImageDict | kReadNamedObjectsDictionary | kReadMlineStyleDict,
		kReadDefault = kFastRead | kUseExDrawing,
		
	};
};
class McRxObject;
class MxResbuf;

//:End Ignore

// -------------------------------------------------------------------------
// Summary:
// 		对象创建函数类型
// -------------------------------------------------------------------------
typedef McRxObject* (*McRxMakeFunType)();

// -------------------------------------------------------------------------
// Summary:
// 		命令函数类型
// -------------------------------------------------------------------------
typedef void (*McRxFunctionPtr) ();

// -------------------------------------------------------------------------
// Summary:
// 		用户自定义函数类型
// -------------------------------------------------------------------------
typedef bool (*McRxCustomFunctionPtr)(IN const MxResbuf*  pParam,
									  OUT MxResbuf* pRetData);

class McDbEntity;
class McCmColor;
typedef int(*GetEntityColorFunPtr)(IN const McDbEntity* pEntity, OUT McCmColor* pColor,IN MxObjectId manId);

typedef int(*GetEntityLineweightFunPtr)(IN const McDbEntity* pEntity, OUT int* pLineweight, IN MxObjectId manId);

#ifdef _MX_USE_PUSH_POP
#pragma pack (pop)
#endif
#endif 
