AcquireDraft
Document ShellThe AcquireDraft method returns a reference to the specified draft of this document with its permissions set as specified.
ODDraft AcquireDraft (in ODDraftPermissions perms, in ODDraftID id, in ODDraft draft, in ODPositionCode posCode, in ODBoolean release);
perms- The target permissions for the draft. Valid values for
permsare dependent on the container suite; the Bento container suite supports two values: read only (kODDPReadOnly) and exclusive read/write (kODDPExclusiveWrite).id- The ID of the desired draft, or
kODNULLIDto use thedraftandposCodeparameters to identify the desired draft.draft- A reference to the draft object that is used with the
posCodeparameter to identify the desired draft, orkODNULLto use theidparameter to identify the desired draft.posCode- The position, relative to the
draftparameter, of the desired draft in this document's draft history, orkODPosUndefinedto use theidparameter to identify the desired draft.releasekODTrueif the draft specified by thedraftparameter should be released after the desired draft is returned, otherwisekODFalse. (Used only when thedraftandposCodeparameters identify the desired draft.)- return value
- A reference to the specified draft object.
DISCUSSION
If theidparameter is not null, this method uses that parameter to identify the desired draft, and thedraft,posCode, andreleaseparameters are ignored.If the
idparameter iskODNULLID, this method uses thedraftandposCodeparameters to identify the desired draft. When theposCodeparameter iskODPosSame, the desired draft is the draft object specified by thedraftparameter, and this method changes the permissions of that draft. If thereleaseparameter is true, the draft passed in thedraftparameter is released if the desired draft can be returned.Once the desired draft is identified, this method returns a reference to that draft object with its permissions set as specified in the
permsparameter. The specified permissions must be consistent with the ways in which other objects are currently accessing the desired draft. The restrictions placed on the permissions depend on the container suite. With the Bento container suite, the permissions may be set to exclusive read/write (kODDPExclusiveWrite) if the desired draft is the document's most recent draft and no other object already has access to the draft (either read only or exclusive read/write). The permissions may be set to read only (kODDPReadOnly) if no object has exclusive read/write access to the draft.This method increments the reference count of the returned draft. When the caller has finished using that draft, it should call the draft's
Releasemethod.EXCEPTIONS
kODErrCannotChangePermissions- The draft's permissions cannot be changed if the draft is retrieved with different permissions.
kODErrInvalidDraftID- The specified draft ID is invalid.
kODErrInvalidPermissions- The target permissions are invalid.
kODErrRefCountNotEqualOne- Attempt to change the permissions for a draft while other objects have references to it.
kODErrUnsupportedPosCode- The specified position code is not supported.
SEE ALSO
TheODDraftIDtype (page 902).
TheODDraftPermissionstype (page 902).
TheODPositionCodetype (page 915).
TheODContainer::AcquireDocumentmethod (page 100).
TheODDocument::AcquireBaseDraftmethod (page 134).
"Insert" on page 247 in OpenDoc Programmer's Guide.
Table 11-1 on page 466 in OpenDoc Programmer's Guide.