//#
//#	File:		ODTypesB.idl
//#
//#	Contains:	Platform independent types for OpenDoc
//#
//#	Owned by:	Richard Rodseth
//#
//#	Copyright:	c 1994 by Apple Computer, Inc., all rights reserved.
//#
//#	Change History (most recent first):
//#
//#		<19>	11/14/94	VL		1155887: Added new pos code for top draft.
//#		<18>	 9/23/94	VL		1184272: ContainerID is a sequence of
//#									octets. 1184166: Moved ContainerName and
//#									DocumentName to M file.
//#		<17>	  9/7/94	CC		#1185056 - Define ODLinkStatus to be
//#									ODULong instead of an enumeration.
//#		<16>	 8/31/94	T		#1183129, #1183116, #1183119, #1183111:
//#									Lots of ErrorCode cleanup.  Moved Exception
//#									struct definition to here since no
//#									types/structs should be in Def files.
//#		<15>	 8/18/94	T		#1181622 Set Owned By: field to Richard
//#		<14>	 8/12/94	CC		1160117 -Added kODCloneToLink and
//#									kODCloneFromLink.
//#		<13>	  8/3/94	CC		Removed ODClipboardKey type.
//#		<12>	 7/29/94	CG		Changes to ODNSTypeSpec.
//#		<11>	  7/7/94	CC		Added kODdrag. constants from DragDrp.idl.
//#		<10>	 6/29/94	NP		Added semantic interface extension name
//#									constant and kODNoWait.
//#		 <9>	 6/28/94	VL		Added new ODDropResult.
//#		 <8>	 6/22/94	eeh		added kODNullTypeToken, kODViewAs*
//#		 <7>	 6/15/94	jpa		Added imaging stuff (xform types, etc.)
//#		 <6>	 6/15/94	CG		Removed duplicate consts found in
//#									StdDefs.idl.
//#		 <5>	 6/14/94	CG		Added more NameSpace and Binding constants.
//#		 <3>	  6/1/94	RR		Redefined IText in ODTypesM.idl
//#
//#	To Do:
//#

//# Primitive and Platform-Independent Types

#ifndef _ODTYPESB_
#define _ODTYPESB_

//==============================================================================
// Constants
//==============================================================================
//# $$$$$
const long kODNULL = 0;

// for Undo protocol
enum ODDoneState
{
  kODDone,
  kODUndone,
  kODRedone
};

//==============================================================================
// Scalar Types
//==============================================================================

// Common OD Types

typedef boolean        ODBoolean;    // boolean value. Do not count on its size.
typedef octet          ODUByte;    // unsigned >= 8-bit value
//  KLS:  Changed from unsigned char
typedef char           ODSByte;    // signed >= 8-bit value
typedef unsigned short ODUShort;    // unsigned >= 16-bit value
typedef short          ODSShort;    // signed >= 16-bit value
typedef unsigned long  ODULong;    // unsigned >= 32-bit value
typedef long           ODSLong;    // signed >= 32-bit value
typedef float          ODFloat;    // floating-point value

typedef void*          ODPtr;      // OD pointer
typedef ODUByte*      ODRawPtr;    // generic pointer

typedef string  ODISOStr;      // 7 bit ascii. No embedded NULLs. NULL
                    //  terminated.

typedef ODISOStr  ODType;      // Used for storage types, focus types,
                    //  data types, etc.

typedef ODULong   ODTypeToken;    // Tokenized form of ODType

typedef ODULong  ODID;        // Storage Unit IDs

typedef ODType    ODValueType;    // Used to identify the type of the value, e.g., TEXT, PICT and so
                    //  on. Obviously, the type doesn't need to be an OSType.

typedef ODUByte*  TValue;        // Pointer to a stream of bytes.

typedef ODSLong  ODError;      // >= 32-bit exception code

typedef ODULong  ODToken;      // >= 32-bit unsigned value for tokens

typedef ODULong  ODSize;      // >= 32-bit unsigned value for size

typedef ODULong   ODInfoType;    // The type for the part info stored in a frame

typedef ODULong  ODFlags;      // >= 32-bit unsigned value for flags

typedef sequence<octet> ODByteArray;	// ODByteArray should be used for foreign types larger than 4 bytes
										// and for variable length data in general


typedef ODByteArray ODContainerID;
typedef ODISOStr ODContainerType;

typedef ODType   ODFocusType;      // This is a string, which can be tokenized

typedef ODPtr    ODActionData;      // Action data for undo/redo

enum ODFramePosition
{
  kODFrameBehind,
  kODFrameInFront
};

enum ODTraversalType
{
  kODTopDown,
  kODBottomUp,
  kODChildrenOnly
};

enum ODSiblingOrder
{
  kODFrontToBack,
  kODBackToFront
};

//# $$$$$ Moved from NameSpace

enum ODNSTypeSpec
{
  kODNSDataTypeODObject,
  kODNSDataTypeODValue
};

//# $$$$$ Moved from Undo

enum ODRespectMarksChoices
{ 
  kODDontRespectMarks,
  kODRespectMarks 
};

enum ODActionType
{
  kODSingleAction,
  kODBeginAction,
  kODEndAction
};



//==============================================================================
// Imaging Types
//==============================================================================

typedef ODSLong     ODFixed;		// 16.16 fixed-point value
typedef ODSLong		ODFract;		//  2.30 fixed-point value

typedef ODFixed     ODCoordinate;	// Graphics coordinates; 16.16 fixed by default

//#$$$$$ Using ODCoordinate here, rather than ODFixed works around a bug in the
//# emitter whereby the type of "m" wouldn't be emitted if ODFixed is defined
//# as foreign.
struct ODMatrix       // Transform matrix for translation, scaling,
{ 						// skewing, rotation or any combination.
  ODCoordinate m[3][3];    // Same as "mapping" in QuickDraw GX.
};

// *** old Graphics system stuff ***
// $$$$$ Conflicts with SOM output: typedef ODRgnHandle  ODShapeData;    // Shape Data
typedef ODMatrix*    ODMapping;        // Pointer to transform matrixtypedef

typedef ODSShort     ODGraphicsSystem;    // Type of graphics system
const ODGraphicsSystem kODNoGraphicsSystem = 0;
	/* Graphics systems are of course platform dependent, but their numeric IDs
	   should be globally registered to avoid overlaps; otherwise confusion may
	   occur when documents are moved between platforms, or objects on different
	   platforms attempt to communicate via DSOM. */
	   
//# $$$$$ Moved from Trnsform.h

typedef ODSShort ODTransformType;

const ODTransformType kODIdentityXform		 = 0;	// Identity (no-op) transform
const ODTransformType kODTranslateXform		 = 1;	// Pure translation/offset
const ODTransformType kODScaleXform		 	 = 2;	// Pure scale, no offset
const ODTransformType kODScaleTranslateXform = 3;	// Scale and offset
const ODTransformType kODLinearXform		 = 4;	// Scale/rotate/skew, but no offset
const ODTransformType kODLinearTranslateXform= 5;	// Linear as above, but with offset
const ODTransformType kODPerspectiveXform	 = 6;	// Perspective: m[0][2]!=0 or m[1][2]!=0

const ODTransformType kODUnknownXform		 =-1;	// Type not known yet [internal use only]
const ODTransformType kODInvalidXform		 = 7;	// Bad matrix [internal use only]

const ODTypeToken kODNullTypeToken 			 = 0;

const	ODType	kODViewAsSmallIcon		= "OpenDoc:ViewAs:SmallIcon";
const	ODType	kODViewAsLargeIcon		= "OpenDoc:ViewAs:LargeIcon";
const	ODType	kODViewAsThumbnail		= "OpenDoc:ViewAs:Thumbnail";
const	ODType	kODViewAsFrame			= "OpenDoc:ViewAs:Frame";


//# $$$$$ Moved from Shape.h

enum ODGeometryMode {
	kODLoseGeometry,			// Toss out geometric info to save time or space.
	kODPreserveGeometry,		// Preserve geometric info as long as possible
	kODNeedsGeometry			// Must keep geometric info.
};
//# $$$$$ typedef short ODGeometryMode;


//# $$$$$ Moved from Frame.h

enum ODLinkStatusConsts
{
  kODInLinkDestination,
  kODInLinkSource,
  kODNotInLink
};
typedef ODULong ODLinkStatus;


// # $$$$$ Moved from Facet.h

enum ODHighlight{
	kODNoHighlight,
	kODFullHighlight,
	kXMPDimHighlight
};

//# For ODDragAndDrop
enum  ODDropResult
{
	kODDropFail,
	kODDropCopy,
	kODDropMove,
	kODDropUnfinished		// Used only when DragAndDrop::StartDrag returns immediately.
};

const ODULong kODdragHasLeftSourceFrame	= 0x00000001;
const ODULong kODdragIsInSourcePart		= 0x00000002;
const ODULong kODdragIsInSourceFrame	= 0x00000004;

//# For ODLink

typedef ODULong	ODLinkKey;

const ODULong kODNoWait = 0;  // For the wait parameter to Lock()

//# For ODTranslation

typedef ODULong	ODTranslateResult;
typedef ODULong	ODPlatformTypeSpace;

enum ODTranslateResultConsts {
	kODCannotTranslate,
	kODCanTranslate,
	kODNative
};

enum ODPlatformTypeSpaceConsts {
	kODPlatformFileType,
	kODPlatformDataType
} ;


//# For ODStorageUnit

const ODULong kODPosUndefined = 0xFFFFFFFF;
const ODULong kODPosSame = 0x00;
const ODULong kODPosAll = 1;
const ODULong kODPosFirstSib = 2;
const ODULong kODPosLastSib = 3;
const ODULong kODPosNextSib = 4;
const ODULong kODPosPrevSib = 5;
const ODULong kODPosFirstBelow = 6;
const ODULong kODPosLastBelow = 7;
const ODULong kODPosFirstAbove = 8;
const ODULong kODPosLastAbove = 9;
const ODULong kODPosReserved11 = 10;
const ODULong kODPosReserved12 = 11;
const ODULong kODPosReserved13 = 12;
const ODULong kODPosReserved14 = 13;
const ODULong kODPosReserved15 = 14;
const ODULong kODPosMWrap = 0x10;
const ODULong kODPosTop = 0x20;
const ODULong kODPosMOtherTypes = 0x30;


const ODID	kODIDAll	= 0;
const ODID	kODIndexAll	= 0;
const ODID	kODIDWild	= 0;
const ODValueType	kODTypeAll = kODNULL;


typedef void*	ODValue;
typedef ODID	ODValueIndex;
typedef ODID	ODStorageUnitID;
typedef ODID	ODStorageUnitRef;
typedef ODULong ODStorageUnitKey;
typedef ODISOStr  ODPropertyName;
typedef ODISOStr  ODStorageUnitName;
typedef ODULong ODPositionCode;

//# For ODDocument

typedef  ODID		ODDocumentID;

const ODDocumentID  kODDefaultDocument = 1;

//# For ODDraft

enum ODPurgePriorityConsts {
	kInvisibleBlocks,
	kAllBlocks,
	kVisibleBlocks
}; 
typedef ODULong ODPurgePriority;

enum ODCloneKindConsts {
	kODCloneCopy,
	kODCloneCut,
	kODClonePaste,
	kODCloneDuplicate,
	kODCloneDropCopy,
	kODCloneDropMove,
	kODCloneToLink,
	kODCloneFromLink,
	kODCloneAll
};
typedef ODULong ODCloneKind;

enum ODDraftPermissionsConsts {
	kDPNone,
	kDPTransient,
	kDPReadOnly,
	kDPSharedWrite,
	kDPExclusiveWrite
};
typedef ODULong ODDraftPermissions;

typedef	ODULong	ODVersionID;
typedef	ODID	ODDraftID;
typedef	ODID	ODLinkID;
typedef	ODISOStr	ODDraftName;

const ODContainerType kODDefaultFileContainer = "Apple:ContainerType:File";
const ODContainerType kODDefaultMemoryContainer = "Apple:ContainerType:Memory";

const ODContainerType kODBentoEmbeddedContainer = "Apple:Bento:ContainerType:Embedded";
const ODContainerType kODBentoFileContainer = "Apple:Bento:ContainerType:File";
const ODContainerType kODBentoMemoryContainer = "Apple:Bento:ContainerType:Memory";

//# Semantic Events

const ODType	kODExtSemanticInterface = "SemanticInterface";

//# moved from ErrorDef.idl (NO TYPES/STRUCTS/CLASSES SHOULD BE IN .DEF FILES)

exception ODException {
	ODError	error;
	char	message[256];		// $$$$$ Do we really need this field???
};

#endif // _ODTYPESB_
