In this section, the basic structure of iWork drawable objects is discussed. All shapes in the iWork XML shemas share some of these structures.
Drawable Object Geometry
Drawable Object Style
Drawable Object Path
Drawable Object Binary
Drawable Object Line Shape
Drawable Object Basic Shape
Drawable Object Images
“Listing 3-13” defines the basic geometry of an iWork drawable object in XML, as contained by the <sf:geometry> element.
Listing 2-13 The basic geometry of a drawable object
<sf:geometry sfa:ID="SFDAffineGeometry-0" sf:sizesLocked="true" sf:angle="315"> |
<sf:naturalSize sfa:w="100.0" sfa:h="0.0"/> |
<sf:size sfa:w="100.0" sfa:h="0.0"/> |
<sf:position sfa:x="100.0" sfa:y="100.0"/> |
</sf:geometry> |
The sfa:ID attribute is a unique string. The sf:sizesLocked attribute specifies whether the drawable object is locked with the "true" identifier. The sf:angle attribute specifies the angle of rotation as a float with a range of 0-360. The child element in this example (<sf:naturalSize>) is the unscaled size of the object, and for all but images should be the same as <sf:size>. The <sf:size> is the scaled size of the object. The <sf:position> defines the position on the page or slide.
“Listing 3-14” defines the basic style of an iWork drawable object in XML, as contained by the <sf:style> element.
Listing 2-14 The basic style of a drawable object
<sf:style> |
<sf:graphic-style-ref sfa:IDREF="SFDGraphicStyle-33"/> |
</sf:style> |
The child element <sf:graphic-style-ref> references the graphic style.
“Listing 3-15” defines the shape of a path of an iWork drawable object in XML, as contained by the <sf:path> element.
Listing 2-15 The basic path of a drawable object
<sf:path> |
<sf:bezier-path sfa:ID="SFDBezierPathSource-3"> |
<sf:bezier sfa:ID="NSBezierPath-9" sfa:path="M 0 50 L 50 100 L 100 50 L 50 0 Z M 0 50" sfa:version="524"/> |
</sf:bezier-path> |
</sf:path> |
The child element <sf:bezier-path> describes how the path is to be drawn. The format is the same as the format for the Keynote 1.x path elements. The sfa:version attribute must have a value of "524".
Important: If you are a developer working with the Keynote XML file format specification, you should make sure that the sfa:version attribute is present and has a value of "524", or the behavior of your application may become unpredictable.
“Listing 3-16” defines the binary of an iWork drawable object for an image, such as a JPEG, TIFF, PDF, or EPS in XML, as contained by the <sf:binary> element.
Listing 2-16 The basic binary of a drawable object
<sf:binary sfa:ID="SFRImageBinary-2"> |
<sf:size sfa:w="77" sfa:h="46"/> |
<sf:data sfa:ID="SFEData-2" sf:path="testA.tiff" sf:displayname="testA.tiff" sf:size="14362" sf:hfs-type="0" sf:checksum="707facb4" sfa:version="1"/> |
</sf:binary> |
The child element <sf:size> is the size of the original image, with the attributes sfa:w and sfa:h having float values that define the width and height. The <sf:data> element describes the image file with the following attributes:
sf:path, which defines the path, either as a bundle or absolute path name to the image file. (A bundle-relative path might be renamed to avoid collisions.)
sf:displayname, which displays the name of the image shown in the metrics inspector.
sf:size, which specifies the optional size of the file in bytes, and is used to determine if the file has changed.
sf:checksum, which is the checksum of the file data, and is used to determine if the file has changed.
sfa:version, which must have a value of "1".
“Listing 3-17” defines the basic line shape of an iWork drawable object in XML, as contained by the <sf:line> element.
Listing 2-17 The basic line of a drawable object
<sf:line sfa:ID="SFDLineInfo-0"> |
<sf:geometry sfa:ID="SFDAffineGeometry-0" sf:sizesLocked="true" sf:angle="315"> |
<sf:naturalSize sfa:w="100.0" sfa:h="0.0"/> |
<sf:size sfa:w="100.0" sfa:h="0.0"/> |
<sf:position sfa:x="100.0" sfa:y="100.0"/> |
</sf:geometry> |
<sf:style> |
<sf:graphic-style-ref sfa:IDREF="SFDGraphicStyle-0"/> |
</sf:style> |
<sf:head sfa:x="100.0" sfa:y="100.0"/> |
<sf:tail sfa:x="100.0" sfa:y="100.0"/> |
</sf:line> |
The child elements in this example are <sf:geometry> , <sf:style> , <sf:head>, and <sf:tail>. The <sf:head> defines the position of the head of the line, with attributes sfa:x and sfa:y having the floating point coordinates. The <sf:tail> defines the position of the tail of the line, with attributes sfa:x and sfa:y having the floating point coordinates.
“Listing 3-18” shows an example of the basic shape of an iWork drawable object in XML, as contained by the <sf:drawable-shape> element.
Listing 2-18 The basic shape of a drawable object
<sf:drawable-shape sfa:ID="SLShapeInfo-2" sfa:sfclass="shape" sl:max-attachment-scale-x="0.70710676908493042" sl:max-attachment-scale-y="0.70710676908493042"> |
<sf:geometry sfa:ID="SFDAffineGeometry-11"> |
<sf:naturalSize sfa:w="100" sfa:h="100"/> |
<sf:size sfa:w="100" sfa:h="100"/> |
<sf:position sfa:x="72" sfa:y="274"/> |
</sf:geometry> |
<sf:style> |
<sf:graphic-style-ref sfa:IDREF="SFDGraphicStyle-38"/> |
</sf:style> |
<sf:path> |
<sf:bezier-path sfa:ID="SFDBezierPathSource-2"> |
<sf:bezier sfa:ID="NSBezierPath-8" sfa:path="M 85.355339050292969 14.644660949707031 C 104.88155364990234 34.170875549316406 104.88155364990234 65.829124450683594 85.355339050292969 85.355339050292969 C 65.829124450683594 104.88155364990234 34.170875549316406 104.88155364990234 14.644660949707031 85.355339050292969 C -4.8815536499023438 65.829124450683594 -4.8815536499023438 34.170875549316406 14.644660949707031 14.644660949707031 C 34.170875549316406 -4.8815536499023438 65.829124450683594 -4.8815536499023438 85.355339050292969 14.644660949707031" sfa:version="524"/> |
</sf:bezier-path> |
</sf:path> |
<sf:text sfa:ID="SFWPFrame-14"> |
<sf:text-storage sfa:ID="SFWPStorage-22" sf:kind="textbox" sf:exclude-tables="true"> |
<sf:stylesheet-ref sfa:IDREF="SFSStylesheet-1"/> |
<sf:text-body> |
<sf:layout sf:style="graphic-shape-layout-style-default"> |
<sf:p sf:style="paragraph-style-default"/> |
</sf:layout> |
</sf:text-body> |
</sf:text-storage> |
</sf:text> |
</sf:drawable-shape> |
The sfa:class attribute always has a value of "shape".
The child elements in this example are <sf:geometry>, <sf:style>, <sf:path>, and <sf:text>. The <sf:text> element defines the text inside of the shape.
Text objects are discussed in detail in “Chapter 4, Working With Text Objects in Pages Documents,.”
“Listing 3-19” defines the basic images of an iWork drawable object in XML, as contained by the <sf:image> element.
Listing 2-19 The basic images of a drawable object
<sf:image sfa:ID="SFDImageInfo-1" sf:image-placeholder="true"> |
<sf:geometry sfa:ID="SFDAffineGeometry-19" sf:aspectRatioLocked="true"> |
<sf:naturalSize sfa:w="77" sfa:h="46"/> |
<sf:size sfa:w="77" sfa:h="46"/> |
<sf:position sfa:x="72" sfa:y="72"/> |
</sf:geometry> |
<sf:style> |
<sf:graphic-style-ref sfa:IDREF="SFDGraphicStyle-33"/> |
</sf:style> |
<sf:binary sfa:ID="SFRImageBinary-2"> |
<sf:size sfa:w="77" sfa:h="46"/> |
<sf:data sfa:ID="SFEData-2" sf:path="testA.tiff" sf:displayname="testA.tiff" sf:size="14362" sf:hfs-type="0" sf:checksum="707facb4" sfa:version="1"/> |
</sf:binary> |
</sf:image> |
The child elements in this example are <sf:geometry>, <sf:style>, and <sf:binary>. The sf:image-placeholder attribute has a value of "true" if the image is a placeholder; otherwise, this attribute is omitted.
Last updated: 2005-11-09