home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Draft.h
-
- Contains: definition for XMPDraft
-
- Written by: Vincent Lo, Tantek I. Celik
-
- Copyright: ⌐ 1992 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <53> 2/18/94 VL #1142972, #1144024: Added
- GetDragDropStorageUnit to enable importing
- data from a foreign source (e.g. the
- Finder).
- <52> 2/4/94 VL Moved to PPC Header and began code cleanup.
- <51> 2/2/94 RR Added isRoot to CreateFrame
- <50> 2/1/94 CC Added the enumerated type XMPCloneKind;
- Added XMPCloneKind argument to BeginClone;
- added internal field fCloneKind and two
- private methods.
- <49> 1/28/94 CC Removed UniqueChangeID(),
- ShowLinkBorders(), and SetLinkBorders().
- <48> 1/27/94 VL Added IsValidDraftKey.
- <47> 1/25/94 CC Added fShowLinkBorders field.
- <46> 1/21/94 CC Added CreateLinkSource(), GetLinkSource(),
- RemoveLinkSource(),
- GetLinkSourceIterator(), and
- UniqueChangeID().
- <45> 1/18/94 CC Added ShowLinkBorders() and
- SetLinkBorders().
- <44> 12/21/93 VL Used new Init strategy. Added support for
- persistent link id. Removed friends for
- Document and StorageUnit.
- <43> 12/21/93 JBS CreateFrame with viewType & presentation
- <42> 12/20/93 VL Removed Window-related calls. XMPWindow is
- no longer a persistent object.
- <41> 12/16/93 Té CreatePart now takes an optional Editor
- parameter
- <40> 12/8/93 CC GetLink: Renamed 2nd parameter from
- theLinkSpec to linkSpec
- <39> 11/30/93 VL Changed frameGroup from XMPUShort to
- XMPULong.
- <38> 11/23/93 VL Added fHeap, GetHeap().
- <37> 11/15/93 CC Added CreateLinkSpec() method
- CreateLink() takes XMPPart* parameter
- <36> 11/12/93 JBS remove Layout methods
- <35> 11/11/93 PH Add forward declaration of XMPLinkSpec
- <34> 11/9/93 PH Added CreateDragDropStorageUnit
- <33> 11/1/93 VL Added BeginClone, EndClone, AbortClone.
- <32> 10/21/93 RR CreateWindow takes new window flags (these
- are Mac-specific and Draft isn't, but we
- need a new Initialize strategy anyway for
- SOM. Stay tuned)
- <31> 10/7/93 RR Added root part to CreateWindow
- <30> 10/7/93 VL Removed InitSemanticInterface, fIsFinished
- and added SetChangedFromPrev.
- <29> 9/30/93 VL Removed SetFinished.
- <28> 9/23/93 VL Added GetPermissions.
- <27> 9/21/93 VL Moved ChangedFromPrev method to private by
- convention and added another parameter to
- it.
- <26> 9/14/93 VL Added GetDraftGut to make calls reentrant.
- <25> 9/8/93 VL Support Flushing.
- <24> 9/3/93 JBS updated to support new Layout class
- <23> 8/26/93 VL Added Flush and FlushVersion in preparation
- for Bento Flush functionality.
- <22> 8/23/93 VL Added private fExternalized, private
- NeedExternalizing, FailIfNotExclusiveWrite
- and changed return value to void for
- SetChangedFromPrev.
- <21> 8/20/93 VL Added private ExternalizeCollections.
- <20> 8/18/93 VL ReleaseStorageUnit takes an ID now.
- <19> 8/9/93 VL Removed bogus types.
- <18> 8/9/93 NP Added class id string.
- <17> 8/6/93 VL Added CreateCollections and
- DeleteCollections.
- <16> 8/6/93 PH Storage integration
- <15> 8/6/93 VL Added support for getting
- PersistentObjects.
- <14> 7/29/93 VL Removed getting persistent objects by name.
- <13> 7/14/93 VL Fixed problem with fStorageUnits defined
- twice.
- <12> 7/14/93 VL Used AEHashTable for fStorageUnits.
- <11> 7/2/93 Té fix IntlText compile bugs
- <10> 7/1/93 VL CreateSU should take XMPType, not XMPName.
- <9> 6/30/93 VL Added Reinitialize, Open, Close, Abort,
- IsNewDraft and utility calls like
- Create/Open/Close/AbortVersion.
- <8> 6/22/93 VL Removed fDraftRefCount. Added
- fChangedFromPrev, fEmbeddedCotnainer and
- SetChangedFromPrev().
- <7> 6/15/93 VL Added fCMContainer to keep track of the
- embedded container.
- <6> 6/10/93 NP Changed some parameter type for XMPType.
- <5> 6/2/93 VL Added fDraftRefCount.
- <4> 4/29/93 VL 8.3 Name Change.
- <3> 4/9/93 VL XMPDraft should be subclassed from
- XMPRefCntObject.
- <2> 4/7/93 VL Moved parameters from Initialize to
- constructor.
- <1> 4/6/93 VL first checked in
-
- To Do:
- 1) Take out const names.
- 2) Do we need fEmbeddedContainer or fCMContainer? Should we always get it from fDocument?
- 3) XMPPositionCode is included only for XMPPositionCode.
- 4) XMPDraftKey is defined in StorageU.h.
- */
-
- #ifndef _DRAFT_
- #define _DRAFT_
-
- #ifndef _XMPTYPES_
- #include "XMPTypes.h"
- #endif
-
- #ifndef _PSTOBJ_
- #include "PstObj.h"
- #endif
-
- #ifndef _STORAGEU_
- #include "StorageU.h"
- #endif
-
- //==============================================================================
- // Constants
- //==============================================================================
-
- enum {
- kDPNone = 0,
- kDPTransient = 1,
- kDPReadOnly = 2,
- kDPSharedWrite = 3,
- kDPExclusiveWrite = 4
- };
-
- typedef XMPULong XMPDraftPermissions;
-
- typedef const enum {
- kInvisibleBlocks = 1,
- kAllBlocks = 2,
- kVisibleBlocks = 3
- } XMPPurgePriority;
-
- typedef enum {
- kXMPCloneCopy = 0,
- kXMPCloneCut,
- kXMPClonePaste,
- kXMPCloneDuplicate,
- kXMPCloneAll // For private use only
- } XMPCloneKind;
-
- //==============================================================================
- // Scalar Types
- //==============================================================================
- typedef XMPULong XMPVersionID;
- typedef XMPID XMPDraftID;
- typedef XMPID XMPLinkID;
- typedef XMPISOStr XMPDraftName;
-
- //==============================================================================
- // Classes defined in this interface
- //==============================================================================
- class XMPDraft;
-
- //==============================================================================
- // Classes used by this interface
- //==============================================================================
- class XMPCanvas;
- class XMPDocument;
- class XMPFrame;
- class XMPLink;
- class XMPLinkSource;
- class XMPLinkSpec;
- class XMPPart;
- class XMPPartTable;
- class XMPShape;
- class XMPEmbeddedContainer;
- class XMPAEHashTable;
- class IDList;
- class XMPStorageUnit;
- class VersionList;
- class XMPDragDropStorageUnit;
-
- //==============================================================================
- // XMPDraft
- //==============================================================================
-
- #define kXMPDraftID "appl:xmpdraft$class,1.0.0"
-
- class XMPDraft : public XMPRefCntObject
- {
- friend class XMPLinkIterator;
- friend class XMPLinkSourceIterator;
-
- public:
-
- XMPMethod XMPDocument* GetDocument();
-
- XMPMethod XMPDraftID GetID();
-
- XMPMethod XMPDraftName GetName();
-
- XMPMethod void SetName(XMPDraftName name);
-
- XMPMethod XMPStorageUnit* GetDraftProperties();
-
- XMPMethod void IncrementRefCount();
-
- XMPMethod void Release();
-
- XMPMethod XMPDraftPermissions GetPermissions();
-
- XMPMethod XMPStorageUnit* CreateStorageUnit();
- XMPMethod XMPStorageUnit* GetStorageUnit(XMPStorageUnitID id);
- XMPMethod void RemoveStorageUnit(XMPStorageUnit* storageUnit);
-
- XMPMethod XMPDraftKey BeginClone(XMPCloneKind kind);
-
- XMPMethod void EndClone(XMPDraftKey key);
-
- XMPMethod void AbortClone(XMPDraftKey key);
-
- XMPMethod XMPBoolean ChangedFromPrev();
-
- XMPMethod void SetChangedFromPrev();
-
- XMPMethod void RemoveFromDocument();
-
- XMPMethod XMPDraft* RemoveChanges();
-
- XMPMethod XMPDraft* Externalize();
-
- XMPMethod XMPDraft* SaveToAPrevious(XMPDraft* to);
-
- XMPMethod XMPFrame* CreateFrame(
- XMPFrame* containingFrame,
- XMPShape* frameShape,
- XMPPart* part,
- XMPTypeToken viewType,
- XMPTypeToken presentation,
- XMPULong frameGroup,
- XMPBoolean isRoot,
- XMPBoolean isOverlaid);
-
- XMPMethod XMPFrame* GetFrame(XMPStorageUnitID id);
- XMPMethod void RemoveFrame(XMPFrame* frame);
-
- XMPMethod XMPPart* CreatePart(XMPType partType,XMPEditor optionalEditor);
- XMPMethod XMPPart* GetPart(XMPStorageUnitID id);
- XMPMethod void RemovePart(XMPPart* part);
-
- XMPMethod XMPLinkSpec* CreateLinkSpec (XMPPart* part, XMPPtr data, XMPULong size);
- XMPMethod XMPLinkSource* CreateLinkSource(XMPPart* part);
- XMPMethod XMPLinkSource* GetLinkSource(XMPStorageUnitID id);
- XMPMethod XMPLink* GetLink(XMPStorageUnitID id,XMPLinkSpec* linkSpec);
- XMPMethod void RemoveLink(XMPLink* link);
- XMPMethod void RemoveLinkSource(XMPLinkSource* link);
-
- private:
-
- XMPMethod XMPSize Purge(XMPSize size);
-
- XMPMethod XMPStorageUnit* CreateSU(XMPStorageUnitID id, const XMPType suType);
-
- XMPMethod void CreateVersion();
- XMPMethod void OpenVersion();
- XMPMethod void CloseVersion();
- XMPMethod void DestroyVersion();
- XMPMethod void FlushVersion();
-
- XMPMethod XMPPersistentObject* GetPersistentObject(XMPStorageUnitID id);
- XMPMethod void ReleasePersistentObject(XMPPersistentObject* object);
- XMPMethod void RemovePersistentObject(XMPPersistentObject* object);
- XMPMethod void CreateCollections();
- XMPMethod void DeleteCollections();
- XMPMethod void ExternalizeCollections();
- XMPMethod void CloseCollections();
- XMPMethod void OpenCollections();
- XMPMethod XMPBoolean AreEmptyCollections();
-
- XMPMethod void FailIfNotExclusiveWrite();
-
- XMPMethod XMPLink* CreateLink(XMPLinkSource* linkSource);
-
- XMPMethod void PrepareLinksForClone();
- XMPMethod void AnnotateLinksForNextClone();
-
- XMPDocument* fDocument;
- XMPDraftID fID;
- XMPVersionID fVersionID;
- XMPVersionID fPrevVersionID;
-
- XMPDraftPermissions fPermissions;
- XMPEmbeddedContainer* fEmbeddedContainer;
- XMPBoolean fChangedFromPrev;
- XMPBoolean fIsNewDraft;
- XMPBoolean fExternalized;
-
- XMPAEHashTable* fPersistentObjects;
- XMPAEHashTable* fReleasedPersistentObjects;
- XMPAEHashTable* fStorageUnits;
- XMPAEHashTable* fReleasedStorageUnits;
-
- IDList* fIDList;
- XMPStorageUnit* fDraftProperties;
-
- XMPAEHashTable* fClonedSUIDs;
- XMPDraft* fDestDraft;
- XMPDraftKey fCurrentKey;
- XMPULong fLockCount;
- XMPCloneKind fCloneKind;
-
- XMPHeap fHeap;
-
- public: // private by convention
-
- XMPDraft();
-
- XMPVMethod ~XMPDraft();
-
- XMPMethod void InitDraft(XMPDocument* document, XMPDraftID id, XMPDraftPermissions perms);
-
- XMPMethod void ReleaseFrame(XMPFrame* frame);
- XMPMethod void ReleasePart(XMPPart* part);
- XMPMethod void ReleaseLink(XMPLink* link);
- XMPMethod XMPDraft* ReleaseStorageUnit(XMPStorageUnitID id);
-
- XMPMethod void SetChangedFromPrevFlag(XMPBoolean changed);
-
- XMPMethod IDList* GetIDList();
-
- XMPMethod void Reinitialize(XMPDraftPermissions perms);
- XMPMethod void Open();
- XMPMethod void Close();
- XMPMethod void Abort();
- XMPMethod void Flush();
- XMPMethod XMPBoolean IsNewDraft();
- XMPMethod XMPEmbeddedContainer* GetEmbeddedContainer();
- XMPMethod CMContainer GetCMContainer();
- XMPMethod XMPBoolean NeedExternalizing();
- XMPMethod XMPBoolean IsChangedFromPrev(VersionList* versionList);
- XMPMethod XMPAEHashTable* GetClonedSUIDs(XMPDraft* destDraft);
-
- XMPMethod XMPStorageUnit* CreateDragDropStorageUnit();
- XMPMethod XMPStorageUnit* GetDragDropStorageUnit(XMPStorageUnitID id);
-
- XMPMethod XMPBoolean IsValidDraftKey(XMPDraftKey key);
- XMPMethod XMPHeap GetHeap();
-
- XMPMethod XMPLinkID GetPersistentLinkID(XMPLink* link);
- XMPMethod XMPStorageUnitID GetLinkID(XMPLinkID linkID);
- XMPMethod XMPLinkIterator* GetXMPLinkIterator();
- XMPMethod XMPLinkSourceIterator* GetXMPLinkSourceIterator();
- };
-
- #endif // _DRAFT_
-