Our previous post introduced the improvements we made to the ShapeSheet window for shape developers. In this post, we will continue with ShapeSheet development and dig deeper to examine the new ShapeSheet cells and functions available in Visio 2010.
A number of new cells were added to both the PageSheet and the ShapeSheet to support new features in Visio 2010 and to expand the possibilities for shape development. We will examine each one in turn.
New PageSheet cells in Visio 2010:
New ShapeSheet cells in Visio 2010:
Recall that you can view the PageSheet for a page or the ShapeSheet for a shape using the Developer tab.
This cell takes a TRUE or FALSE value and determines whether the Auto Align and Space features attempt to avoid placing shapes on page breaks. This corresponds to the Space Shapes > Avoid Page Breaks setting under the Position button on the Home tab.
This cell corresponds to the Page Auto Size feature, which is found on the Design tab. It takes three values. Values 1 and 2 correspond to Auto Size on and off, respectively.
Zero is “undefined,” which is the default state for a document created in Visio 2007 or prior, since this cell doesn’t exist in those versions. This value allows Visio to determine whether Auto Size is enabled for the user. It makes a best guess by looking at the page size relative to common paper sizes and deciding whether the page size appears to have been customized, or left at a default size. If the page is at a default size, Visio enables Auto Size so users can benefit from it; if customized, Visio assumes that a specific page size was chosen for a reason and disables Auto Size. In any case, the user can change the setting by toggling the Auto Size button on the Design tab.
This cell defines “bands” of Z-order and is used to determine the default global Z-order position for a shape when it is added to the page. Visio uses this to place containers behind the shapes they contain, regardless of what order they are added to the page. Shapes with a higher DisplayLevel value are displayed on top of shapes with a lower value. Each value of DisplayLevel, which ranges from –32767 to +32767, defines a band.
As an example, consider a diagram with three masters, each with the DisplayLevel value shown. Regardless of what order shapes with DisplayLevel 10, 20 or 30 are dropped, the 10s will always be behind the 20s and 30s, and so forth. The blue shape shown below is at the bottom of the Z-order and was dropped before the other two shapes at DisplayLevel 10. DisplayLevel bands do not interfere with the Z-order commands on the Home tab – Bring Forward / Send Backward and Bring to Front / Send to Back. Using Bring to Front or Send to Back will initially only move the shape to the front or back of the Z-order for its band. A subsequent use will move it to the global front or back of the Z-order.
Notice the special –32768 value, which means that the shape has been pulled out of its band. Visio stores the previous band in a formula in the DisplayLevel cell so it can be restored. Note that changing the value of the DisplayLevel cell does not change the shape’s Z-order, but the band will be taken into account the next time Visio needs to manipulate the shape’s Z-order.
This cell allows Actions, or custom right-click menu items, to be nested. Any menu item whose FlyoutChild value is TRUE will appear in a flyout menu of the first row above it whose FlyoutChild is FALSE. This allows one level of nesting.
The Actions section below will show the following custom items on the right-click menu.
If the value of FlyoutChild for B and C is TRUE, then those items appears in a flyout menu under A.
This cell allows a shape developer to control how click and drag inside a given geometry section of a shape works. Typically, this picks up and moves a shape. By setting this cell to TRUE, you can create a non-clickable (or non-selectable) filled geometry area that prevents picking up and moving the shape. The container shapes new to Visio 2010 use this cell to allow click and drag to select shapes in the container rather than move the container.
This cell stores the relationships among containers, lists, callouts and shapes. It uses a series of DEPENDSON functions, one for each different type of relationship the object has. Note that changes to this cell will not trigger actual relationship changes; Visio only uses this as a means to store the relationship information. This cell is not intended to be modified by users or shape developers.
The types of relationships are listed below.
A shape named Process that is a member of a container named Container 1 would have a Relationships cell formula of this form: =SUM(DEPENDSON(4,Container 1!SheetRef())). The container’s Relationship cell would look like: =SUM(DEPENDSON(1,Process!SheetRef())).
If the Process shape were pinned to the left edge of the container, its Relationships cell would be: =SUM(DEPENDSON(7,Container 1!SheetRef()),DEPENDSON(4,Container 1!SheetRef())). The container’s cell would remain as listed.
A shape that is a member of two containers would look like: =SUM(DEPENDSON(7),DEPENDSON(4,Container 1!SheetRef(),Container 2!SheetRef())), and so forth.
We also added ShapeSheet functions that enable new developer scenarios, particularly for integrating with new Visio 2010 features.
A number of functions are designed to enable interaction with the new container and list features.
The following functions return a Sheet reference, or a reference to the shape. (Such functions exist in Visio 2007 and previous versions, such as NAME and ID.) This return value can then be used to call another function. For example, CALLOUTTARGETREF()!HASCATEGORY(“Category”).
The following functions return the number of associated shapes.
The following functions
In the example below, the rectangular process shape belongs to a container. It shows the total number of shapes in the container using a text field with the formula CONTAINERSHEETREF(1)!CONTAINERMEMBERCOUNT().
Another set of functions enable detailed interaction with individual geometry paths among different shapes. Each of these functions requires a specific Geometry section to be specified – e.g., PATHSEGMENT(Sheet.1!Geometry2.Path, 0.4). Points on a path are given as a percentage of the distance along the path.
These functions open up a broad set of interesting shape interactions that we’re sure shape and solution developers will love. We will write a more detailed post focusing on these functions soon.
The last group of functions are various helpers that either support the new functions or fill in gaps. The first four operate on a Sheet reference.
Index enumeration for BOUNDINGBOXDIST:
Index enumeration for BOUNDINGBOXRECT:
We also modified the following functions that existed in Visio 2007 and prior versions. You can continue to use these as you have in the past – e.g., NAME() – or you can use them with a Sheet reference, such as Sheet.4!NAME() or CONTAINERSHEETREF(1)!NAME().
We hope you will find these useful in opening new opportunities for shapes and making your shape development tasks easier. As always, we’re interested in your feedback and suggestions via a comment on the blog or using Send a Smile.
Very disappointed again that Visio 2010 is not included in ANY Office SKU. Why can't I buy all the productivity apps Word, Excel, PP, Access, OneNote, Puhlisher and Visio together?
for info about [b]geometry.path[/b] and [b]shapesheet reference by some functions[/b].