J.5.7 Creating Image Map-Like Functionality

J.5.7 Creating Image Map-Like Functionality

Although Office Open XML does not natively support image maps via a specific tag, the technology contained within Office Open XML can be used to deliver image map-like functionality. In short, to deliver image map-like functionality, four components are needed: an object to “map,” a clickable region, hit testing and a hyperlink.

By using an image as the object to be “mapped,” one can position no-fill, no-line DrawingML shapes over that image to define the clickable regions as well as to provide hit testing. It is often suggested that the shapes be grouped with the object, although that is not strictly required. A hyperlink per shape can be used to provide the actual hyperlink itself.

Consider the case where a slide has a picture that includes two objects, and the author wants to provide image map-like functionality. She can position shapes “over” the picture to get the desired functionality. This construction appears as follows:

image

image

Image file to be “mapped”

Shapes positioned over interactive areas

The following XML shows the three shapes in the shape tree: one for the image and two, one for each of the shapes that are positioned over the image.

<p:spTree>
<p:nvGrpSpPr>
<p:cNvPr id="1" name=""/>
<p:cNvGrpSpPr/>
<p:nvPr/>
</p:nvGrpSpPr>
<p:grpSpPr>
<a:xfrm>...</a:xfrm>
</p:grpSpPr>
// This represents the “mapped” object
<p:pic>
<p:nvPicPr>
<p:cNvPr id="4" name="Picture 3" descr="A picture from our 2007 trip to
Pisa, Italy" title="Classic Pisa"/>
<p:cNvPicPr>...</p:cNvPicPr>
<p:nvPr/>
</p:nvPicPr>
<p:blipFill>
// The rel ID refers to the image that makes up the object
<a:blip r:embed="rId2"/>
<a:stretch><a:fillRect/></a:stretch>
</p:blipFill>
<p:spPr>...</p:spPr>
</p:pic>
// This represents the first shape positioned over the one of the
// “mapped” regions of object above.
<p:sp>
<p:nvSpPr>
// The hyperlink contains both the tooltip that provides
// hit-testing feedback is defined in the tooltip attribute;
// the hyperlink is defined by the relationship ID attribute.
<p:cNvPr id="5" name="Rectangle 4" descr="Rachel">
<a:hlinkClick r:id="rId3" tooltip="More information about Rachel"/>
</p:cNvPr>
<p:cNvSpPr/>
<p:nvPr/>
</p:nvSpPr>
<p:spPr>
<a:xfrm>...</a:xfrm>...
// The shapes to trigger the hyperlink and hit testing
// have no fill and no line applied to them.
<a:noFill/>
<a:ln><a:noFill/></a:ln>
</p:spPr>
<p:style>...</p:style>
<p:txBody>...</p:txBody>
</p:sp>
// This is the second shape positioned over the picture to provide hit
testing and hyperlink behavior
<p:sp>...
</p:sp>
</p:spTree>
<Relationships
xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
  <Relationship Id="rId3"
Type="http://purl.oclc.org/ooxml/officeDocument/relationships/hyperlink"
Target="http://url2/" TargetMode="External"/>
  <Relationship Id="rId2"
Type="http://purl.oclc.org/ooxml/officeDocument/relationships/image"
Target="../media/image1.jpeg"/>
  <Relationship Id="rId1"
Type="http://purl.oclc.org/ooxml/officeDocument/relationships/slideLayout"
Target="../slideLayouts/slideLayout7.xml"/>
  <Relationship Id="rId4"
Type="http://purl.oclc.org/ooxml/officeDocument/relationships/hyperlink"
Target="http://url1/" TargetMode="External"/>
</Relationships>
Last updated on