Edition Formats
Edition Formats
You can write data to an edition in several different formats. These formats
are the same as Clipboard formats. Clipboard formats are indicated by a
four-character tag.
Typically, when a user copies data, you identify the Clipboard formats and
then write the data to scrap. With the Edition Manager, when a user decides
to publish data, you identify the Clipboard formats and then write the data to
an edition. You can write multiple formats of the same data.
For an edition, you should write your preferred formats first. In general, to
write data to an edition, your application should use either 'TEXT' format or
'PICT' format. This allows your application to share data with most other
applications. To subscribe to an edition, your application should be able to read
both 'TEXT' and 'PICT' files. In addition, your application can write any other
private formats that you want to support.
Clipboard formats are described in the Scrap Manager.
A few special formats are defined as constants:
The kPublisherDocAliasFormat ('alis') format is written by the
Edition Manager. It is an alias record from the edition to the publisher's
document. Appended to the end of the alias is the section ID of the publisher,
which the Edition Manager uses to distinguish between multiple publishers
to a single edition. You should discourage users from making multiple copies of
the same publisher.
The kPreviewFormat ('prvw') format should be written by any application
that publishes large amounts of data that may be slow to draw a preview. This
format holds a preview of the edition data that is displayed in the preview area
of the subscriber dialog box. This format is actually a 'PICT' file that is
generated by the publishing application and displays well in a rectangle of 120
by 120 pixels. You can also use this 'PICT' file to display subscriber data
within a document (to save space).
To draw a preview in the 'prvw' format, the Edition Manager calls
DrawPicture with a 120 by 120 rectangle. To draw a preview in the 'PICT'
format, the Edition Manager examines the picture's bounding rectangle and
calls DrawPicture with a rectangle that scales the picture proportionally
and centers it in a 120 by 120 area.
The kFormatListFormat ('fmts') format is a virtual format that is read but
never written. It is a list of all the formats and their lengths. Applications can
use this format in place of the EditionHasFormat function ( described in
Opening an Edition Container to Read Data), which provides a procedural
interface to determine which formats are available.
If your application can read two or more of the available formats, use 'fmts'
to determine the priority of these formats for a particular edition. The order
of 'fmts' reflects the order in which the formats were written.
The FormatsAvailable structure defines a record for the 'fmts' format.
For example, an edition container may have a format type 'TEXT' of length
100, and a format type 'styl' of length 32. A subscriber to this edition can open
it and then read the format type 'fmts' to list all available formats. In this
example, it returns 16 bytes: 'TEXT' 0x00000064 'styl' 0x00000020.