what's new for developers in visio 2010

84
Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers Microsoft Visio 2010 Developer Training © 2010 Microsoft Corporation. All rights reserved. What's New in Visio 2010 for Developers 1

Upload: herbert-leipold

Post on 03-Mar-2015

283 views

Category:

Documents


10 download

TRANSCRIPT

Page 1: What's New for Developers in Visio 2010

1

Page 2: What's New for Developers in Visio 2010

DISCLAIMER

© 2010 Microsoft Corporation. All rights reserved.

Microsoft®, Internet Explorer, and Windows® are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

The names of actual companies and products mentioned herein may be the trademarks of their respective owners.

THE CONTENTS OF THIS PACKAGE ARE FOR INFORMATIONAL AND TRAINING PURPOSES ONLY AND ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.

No part of the text or software included in this training package may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or any information storage and retrieval system, without permission from Microsoft®. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. The names of actual companies and products mentioned herein may be the trademarks of their respective owners.

To obtain authorization for uses other than those specified above, please visit the Microsoft Copyright Permissions Web page at http://www.microsoft.com/about/legal/permissions

This content is proprietary and confidential, and is intended only for users described in the content provided in this document. This content and information is provided to you under a Non-Disclosure Agreement and cannot be distributed. Copying, disclosing all or any portion of the content and/or information included in this document is strictly prohibited.

2

Page 3: What's New for Developers in Visio 2010

Table of Contents

What’s New for Developers in Visio 2010...................................................................................................4

Summary.............................................................................................................................................................4

Author Information..............................................................................................................................................4

ShapeSheet Enhancements.....................................................................................................................................5

Creating cascading RMAs from the ShapeSheet......................................................................................................7

Developer Tab in the Office Fluent UI......................................................................................................................8

New shape types......................................................................................................................................................9

Containers...........................................................................................................................................................9

Lists....................................................................................................................................................................11

Legends..............................................................................................................................................................13

Callouts..............................................................................................................................................................14

Diagram Services....................................................................................................................................................16

Copy / Paste...........................................................................................................................................................17

Connectivity API.....................................................................................................................................................19

Visio Services.........................................................................................................................................................21

Process Validation..................................................................................................................................................24

Validation methods for managing issues...........................................................................................................27

Object Model Updates...........................................................................................................................................28

New Automation Objects and Members...........................................................................................................28

New ShapeSheet Cells and Functions................................................................................................................52

Deprecated features..............................................................................................................................................56

Summary................................................................................................................................................................57

3

Page 4: What's New for Developers in Visio 2010

What’s New for Developers in Visio 2010Summary

What follows is a quick summary of the new features available for developers in Visio 2010. The new developer features parallel new features available through the user interface. So just as there are new tools for validating process drawings through the user interface, there are tools for the developer to accomplish the same tasks.

Author Information

This material was prepared for Microsoft by Visimation, Inc, a Microsoft Gold Certified Partner specializing in services for Visio. Since 1997, Visimation has helped companies improve their productivity by providing visual software tools to ease business and technical tasks. Website: http://www.visimation.com/ .

4

Page 5: What's New for Developers in Visio 2010

ShapeSheet EnhancementsThe ShapeSheet has been upgraded to utilize Intellisense any time you enter content into a ShapeSheet cell.

Select a cell to edit and start typing. Intellisense will immediately start and offer the names of shape properties and ShapeSheet functions. All ShapeSheet cell names are treated as cell properties and presented through Intellisense. This makes it much easier to enter cell references without having to click on the target cell in order to have the name inserted into the new formula.

As you are entering an expression, any time a right parenthesis “)” is entered, the matching left parenthesis is highlighted in red. For those that create complex formulas with lots of nested parentheses this will be a real time saver.

The parameters of a function are displayed after the “(“ is entered.

It has always been difficult to enter large formulas into ShapeSheet cells because having only a single line of input makes getting the function nesting difficult. With Visio 2010 there is now a formula editing box that gives a lot more room for displaying the formula text. Access this box from the Edit Formula button on ShapeSheet Tools tab.

5

Page 6: What's New for Developers in Visio 2010

Any white space and line feeds entered in the Edit Formula text box to make the formula more readable will not be persisted into the formula in the ShapeSheet. The next time the formula is edited with the Edit Formula dialog, any previous formatting will be lost.

6

Page 7: What's New for Developers in Visio 2010

Creating cascading RMAs from the ShapeSheetA new ShapeSheet feature allows the creation of cascading menus as a right mouse action on a shape, although only one level deep. A new cell in the Actions section makes this possible, the FlyoutChild cell.

As an example, observe the shape below. A right click on the shape shows the cascading menu Fill Color followed by the options Red, Green, and Blue. How this is set up is shown in the ShapeSheet below the shape image.

The FlyoutChild cell is set to True for each of the child menus. The Action cell of the top menu Fill Color has no action. The Action cell for each of the child options has a formula which is evaluated when that

menu is chosen.

7

Page 8: What's New for Developers in Visio 2010

Developer Tab in the Office Fluent UIConversion of Visio to the Office Fluent UI has presented a nice opportunity to regroup related functionality. The tools used primarily by developers have been collected together into one convenient tab (the Developer tab) to make shape development more convenient. You no longer have to go back and forth across multiple menus to add the behaviors and find the property information you need.

Turn on the developer tabThe features on the developer tab are hidden by design. That’s because most users don’t use these features of the product. Show the Developer tab with the following steps:

1. Click the Backstage button in the upper left portion of the screen2. Choose Visio Options3. Choose Advanced4. Scroll down to the bottom to see the “General” section and select “Run in developer

mode”

GroupingsThe developer tab groups developer features in these categories:

Code – record macros and access VBA code window Controls – add and work with controls to a Visio diagram Shape Design – ShapeSheet access, shape operations, grouping, drawing tools, Shape

Name, Protection, and Behavior dialogs Stencil – create new stencils Show/Hide – view Document Stencil, Drawing Explorer, and Master Explorer

8

Page 9: What's New for Developers in Visio 2010

New shape typesVisio 2010 introduces new shape types with special types of behaviors: containers, lists, legends, and callouts.

Container – provides a new way of collecting shapes together that is different from grouping. You can place shapes into a container shape and they automatically become associated with the container.

List – a special type of container that automatically orders and arranges its member shapes. Legend – documents the data bars, icon sets, and color by values in data graphics applied to

shapes on the page. The legend is implemented using containers and lists. Callout – can be associated with another shape without gluing and will maintain the same

relative position to the target shape when the target shape is moved.

The solution developer can customize the shapes provided with Visio and can create new stencils containing their own versions of these shapes. To designate any shape as a Container, List or Callout you only need to add one User-defined cell called User.msvStructureType. For the value enter “Container”, “List” or “Callout” as desired. This setting tells Visio that the shape is a Structured Diagram element and adds many of the Structured Diagrams behaviors to the shape.

Containers

Container shapes are designed to automatically sit behind other shapes on the page and keep track of any shapes that are associated or “contained” within them. This is a new and distinct feature from groups. The contained shape can always be selected and manipulated independently of the container.

9

Page 10: What's New for Developers in Visio 2010

By contrast, if a shape is in a group the user must first select the group and then subselect the shape in order to do something with it.

The cross functional flowchart solution in Visio has been revamped for Visio 2010 to implement each of the individual Swimlanes and each of the Phase shapes as containers.

New container shapes can be created by the solution developer via normal ShapeSheet design techniques. The Container structured design behaviors are controlled through a set of User defined cells specifically that are recognized by the engine specifically for Containers. These cells affect the layout and behavior of the container shape and whether a particular shape can be contained within a container.

Visio provides several built-in container shapes in the Insert Container gallery located on the Insert tab of the ribbon. It is possible to override this set of shapes by creating a specially named stencil with other container shapes. Create a stencil named _CONTAIN.vss and place it in the user’s My Shapes folder.

User.msvStructureType = “Container” – gives the shape the basic Container behaviors. These behaviors are managed by Visio.

User.msvSDContainerMargin – defines the distance between the container boundary and its members shapes.

User.msvSDContainerResize – controls resize behavior User.msvSDContainerStyle – current visual style of container User.msvSDContainerStyleCount – total number of visual styles supported by the container User.msvSDHeadingStyle – current visual style of the container header User.msvSDHeadingStyleCount – total number of visual header styles supported by the heading User.msvSDContainerLocked – Boolean value for locking a cotainer’s membership User.msvSDContainerRequiredCategories and User.msvSDContainerExcludedCategories – used

to manage which shapes can be added to a container User.msvSDContainerNoHighlight – Boolean value to control highlighting of container when

shapes are added User.msvSDContainerNoRibbon – hides the container from being displayed in the ribbon gallery User.msvSDContainerHeadingEdge – the location of the container relative to its header User.msvSDMembersOnHiddenLayer – allows container members to be on hidden layers

As is usually the case with Visio, what you can do through the user interface you can also do through automation calls.

Most of the functionality of working with containers is held in the new object ContainerProperties. Since a container is a Visio shape you work with it in the same way you would any other shape.

10

Page 11: What's New for Developers in Visio 2010

To resize a container to fit its contents use the FitToContents method of the ContainerProperties object.

To lock a container so that shapes cannot be added or taken away, use the LockMembership property of the ContainerProperties object.

Adding shapes to containers can be done from either the Shape or Selection objects or from the ContainerProperties object.

o Using AddToContainers from the Shape or Selection object is equivalent to Add to Underlying Container from the user interface.

o To add a shape to a specific container, use the AddMember method of the ContainerProperties object.

To get a list of all containers on the page use the GetContainers method of the Page object. Deleting a container using the normal shape delete will also delete all of the shapes within it. To

delete a container, but retain the shapes use the Disband method of the ContainerProperties object.

To get a list of all shapes within a container use the GetMemberShapes method of the ContainerProperties object. This returns an array of shape IDs.

The cross functional flowchart solution in Visio has been revamped for Visio 2010 to implement each of the individual Swimlanes and each of the Phase shapes as containers. Now when you add shapes to a cross functional flowchart, you are adding these shapes to Swimlane containers and to Phase containers. Each Swimlane and Phase shape is a special type of container that is automatically placed next to a shape of the same type. To keep track of all of the Swimlane shapes there is a special type of container which is of type List. There is a Swimlane List shape whose purpose is to hold all of the individual Swimlanes. There is also a Phase List container shape that holds all of the Phase container shapes.

Lists

The List shape also has a specific set of user defined cells that are recognized by the Visio engine and are used for controlling the list shape’s behavior.

User.msvStructureType = “List” – gives the shape the basic List behaviors. These behaviors are managed by Visio.

User.msvSDListAlignment – specifies vertical or horizontal alignment of member shapes User.msvSDListDirection – specifies the direction of member shapes User.msvSDListSpacing –distance between list members User.msvSDListItemMaster – name or UniqueID of master to insert on Insert commands User.msvSDListNoReorder – Boolean value to prevent reordering of member shapes

11

Page 12: What's New for Developers in Visio 2010

User.msvSDListRequiredCategories and User.msvSDListExcludedCategories – used to manage which shapes can be added to a List

Manage the List shape through automation in the same way as a Container shape.

To get a list of all of the members of a List container use GetListMembers of the ContainerProperties object. For example, the code below prints the names of the list members of a List container. The container shape must be a type list. Note that you can check the type of a container with the ContainerType property.

List member position can be discovered with GetListMemberPosition. New list members can be added with InsertListMember.

Sub PrintGetListMembers(containerShape As Visio.Shape)

'retrieve the print the IDs of the members of a List container to the

Immediate window

Dim arr() As Long

Dim i As Integer

Dim listMemberShape As Shape

'check that we have a valid List type container

If containerShape.ContainerProperties.ContainerType =

visContainerTypeList Then

Debug.Print "Container shape is : ", containerShape.NameU

'the method returns a array of IDs of member shapes

arr = containerShape.ContainerProperties.GetListMembers

For i = 0 To UBound(arr)

Set listMemberShape = ActivePage.Shapes.ItemFromID(arr(i))

Debug.Print i, listMemberShape.NameU

Debug.Print "ListMemberPosition : ",

containerShape.ContainerProperties.GetListMemberPosition(listMemberShape)

Next

End If

End Sub

There are also two new events related to containers: ContainerRelationshipAdded and ContainerRelationShipDeleted. The RelatedShapePairEvent object that these events return contains

12

Page 13: What's New for Developers in Visio 2010

two shapes: the container and the member, represented by the RelatedShapePairEvent.FromShapeID and the RelatedShapePairEvent.ToShapeID properties respectively.

Legends

Visio 2010 adds the ability to insert a legend that documents the data bars, icon sets and color by values in data graphics applied to shapes on the page. You can do this using the Insert Legend button on the Data tab.

Visio creates the legend at the upper right corner of the page. The legend contains a separate section for each data field referenced in the data graphics’ definitions. The descriptions for each legend item are obtained from the data graphics.

The legend is customizable, so you can add, remove and rename sections and shapes to make the legend look just right for your particular diagram. Because the legend is implemented using Containers

13

Page 14: What's New for Developers in Visio 2010

and List so the solution developer can create custom legends using the same tools. The Page.DropLegend method is used to add a legend to the page.

Legends_m.vss and Legends_u.vss are installed by the product. Application.GetBuiltInStencilFile(visBuiltInStencilLegends) provides the name of the legends stencil that the engine is using.

_LEGEND.vss can be created and placed in the My Shapes folder. This will automatically be used by the engine instead of the built in legend stencil in order to build a legend. So a dev could provide a customized legend stencil. This is application wide behavior.

Callouts

Visio adds another special purpose shape for version 2010, the Callout shape. There have long been callout shapes in Visio, but the new Callout shapes take on special characteristics. They always remain on top and they move with the target shape.

Much of the behavior of the callout shape is handled in the ShapeSheet. There are an extensive set of User cells and Action menu items for controlling the Callout shapes provided with Visio, but there are only a few key ShapeSheet cells that are required for created custom callouts.

User.msvStructureType=”Callout” – defines the shape as a Callout shape User.msvSDTargetIntersection – stores the offset between the Callout and the target

shape Controls.Association – a control with this name is required for a Callout shape

There are also a few important methods and properties for the automation programmer.

To add a new callout to the page use Page.DropCallout. This drops the callout and associates it with a target shape and positions it near the target shape.

14

Page 15: What's New for Developers in Visio 2010

To get a list of all callouts on a page use the GetCallouts method of the page. This returns a list of shape IDs. Callouts that are nested within containers can optionally be included or excluded from the list.

To find the callouts associated with a shape use the shape objects CalloutsAssocciated property.

To get the target shape of a callout shape use the callout shape’s CalloutTarget property. Test whether a shape is a callout with the shape’s IsCallout method.

There are also two new events that occur when a new callout relationship is added or deleted: CalloutRelationshipAdded and CalloutRelationShipDeleted. The RelatedShapePairEvent object returned by this event contains two shapes: the callout, represented by the FromShapeID property of the RelatedShapePairEvent object; and the target shape, represented by the ToShapeID property.

15

Page 16: What's New for Developers in Visio 2010

Diagram ServicesDiagram services is a new feature that allows the solution developer to enable and disable specific behaviors for some of the new features in Visio 2010. There are two new sets of diagram behaviors: structured-diagram behaviors and AutoSize behaviors. Structured-diagram behaviors define when container-membership relationships and callout associations are created. AutoSize behaviors define when Visio automatically resizes the drawing page to adjust to changes in its contents.

For example, because the Visio engine recognizes containers it is able to maintain the relationships with the member shapes. As the user moves a container the engine provides the service for moving the member shapes relative to their container. This behavior in automated solutions is turned off by default, but can be controlled by setting the DiagramServicesEnbled property of the document..

It is important to understand that this setting does not affect the UI. All of these behaviors are turned off by default but this only affects automation. If you move a container shape by setting the containers PinX and PinY cells using automation and you do not turn on the Container behaviors prior to setting these cells, the container will move but the member shapes will not.

As you use this setting it is best to follow the same best practices that you use when changing other settings, such as EventsEnabled. Keep track of the current value and set it back when you are done with your modification.

A typical operation requiring diagram services would be wrapped with code similar to the following example.

' capture the current setting and turn on diagram services

Dim diagramServices As Visio.VisDiagramServices

diagramServices = ActiveDocument.DiagramServicesEnabled

ActiveDocument.DiagramServicesEnabled = _

Visio.VisDiagramServices.visServiceAll

At the end of the code segment reset diagrams services to its original setting.

' reset diagram services now that we are done

ActiveDocument.DiagramServicesEnabled = diagramServices

16

Page 17: What's New for Developers in Visio 2010

Copy / PasteVisio’s paste function has always been difficult to control with any precision because the paste location has been to the center of the active window. The regular copy and paste using keyboard and menu commands now pastes to the same location as the source. For example, if you copy a shape from page 1 that is located at (x=4,y=2) and paste it to another page, no matter your zoom or pan setting the pasted shape will be placed at location (x=4,y=2)

Visio 2010 adds a new paste method on the Page object, PasteToLocation which allows the specification of a an x,y location and a flag to control some behaviors of the paste. The x,y location will be the center of the pasted object (the center of the selection if multiple objects are selected).

These same flags are used by the Copy, Paste and PasteToLocation methods.

visCopyPasteNormal – use default copy behavior visCopyPasteNoTranslate – copy shapes to their original coordinate locations visCopyPasteCenter – copy shapes to the center of the page visCopyPasteNoHealConnectors – do not clean up connectors attached to cut shapes visCopyPasteNoContainerMembers – do not cut and copy unselected members of containers or

lists visCopyPasteNoAssociatedCallouts – do not cut and copy unselected callouts associated with

shapes visCopyPasteDontAddToContainers – do not add pasted shapes to any underlying containers

The following sample copies any selected objects to Page-2 and centers the selected objects at location (2,5). If a shape that has a callout is selected, the normal operation will copy the callout even if the callout is not selected. To ensure that callouts are not copied the flag visCopyPasteNoAssociatedCallouts is passed to the Copy method.

Sub PasteToLocationExample()

'Enable diagram services

Dim DiagramServices As Integer

DiagramServices = ActiveDocument.DiagramServicesEnabled

ActiveDocument.DiagramServicesEnabled = visServiceVersion140

17

Page 18: What's New for Developers in Visio 2010

'copy the selected objects without any callouts

Application.ActiveWindow.Selection.Copy _

Visio.VisCutCopyPasteCodes.visCopyPasteNoAssociatedCallouts

'paste the selected objects to Page-2

Application.ActiveWindow.Page = ActiveDocument.Pages.ItemU("Page-2")

Application.ActiveWindow.Page.PasteToLocation _

2, 5, Visio.VisCutCopyPasteCodes.visCopyPasteNormal

'Restore diagram services

ActiveDocument.DiagramServicesEnabled = DiagramServices

End Sub

18

Page 19: What's New for Developers in Visio 2010

Connectivity APIOne of the very nice features of Visio has always been the ability to maintain and interrogate connected diagrams through automation. However, it does get tedious to use the Connects objects to retrieve this connectivity information. Visio 2010 introduces several new methods that make these efforts a lot easier.

Use Shape.ConnectedShapes(Flags, CategoryFilter) to return an array of identifiers (IDs) of shapes that are one degree of separation away from the given shape (i.e. separated by a 1-D connector). In other words you no longer have to go through the connector to see what is on the other side. The IDs can be filtered as incoming or outgoing connections.

Flags: Filters the list of returned shape IDs by the directionality of the connectors. CategoryFilter: Filters the list of returned shape IDs by limiting it to IDs of shapes that match the

specified category. A shape’s categories can be found in the User.msvShapeCategories cell of its ShapeSheet.

Use Shape.GluedShapes(Flags, CategoryFilter, [pOtherConnectedShape]) to return an array of identifiers for the shapes that are glued to a shape. The returned IDs can be filtered by 1D vs. 2D and by incoming vs. outgoing connections. You can optionally specify another shape to which any returned shapes must also be glued.

Flags: Specifies dimensionality and directionality of connectors of shapes returned. CategoryFilter: Specifies category of shapes returned. pOtherConnectedShape: Optional additional shape to which returned shapes must also be glued

A method that parallels the AutoConnect feature is Page.DropConnected(ObjectToDrop, TargetShape, PlacementDir, [Connector]). This creates a shape, positions it relative to the target shape and adds a connector from the target shape to the new shape. You can optionally specify a specific connector to use if you need to override the default connector.

ObjectToDrop: The shape to be added to the page TargetShape: The existing shape from which to align, space, and connect PlacementDir: The direction from TargetShape in which to place ObjectToDrop Connector: The connector to use (optional). This overrides usage of the default Dynamic

Connector.

19

Page 20: What's New for Developers in Visio 2010

To drop a new shape on a connector and split the connector, use Page.SplitConnector(ConnectorToSplit, Shape). Pass it the connector to split and the shape to drop.

ConnectorToSplit: The connector to split. Must be a routable 1-D connector. Shape: The shape to use to split the connector. Must be a 2-D shape.

Connectors can now be unglued and the end of the connector moved away from the original glue position with a single method call. Use Shape.Disconnect(ConnectorEnd, OffsetX, OffsetY, Units) and specify the end of the connector to disconnect, the offset, and the units.

ConnectorEnd: The end of the connector to disconnect OffsetX: The x-distance that the connector end is moved away from the shape OffsetY: The y-distance that the connector end is moved away from the shape Units: The units of measure for the assigned offset values

To add many connections quickly, use Page.AutoConnectMany(FromShapeIDs(), ToShapeIDs(), PlacementDirs(), [Connector]). This method automatically draws multiple connections in the specified directions between the specified shapes. It returns the number of shapes connected.

FromShapeIDs(): An array of identifers of the shapes from which to draw a connection ToShapeIDs(): An array of identifers of the shapes to which to draw a connection PlacementDirs(): An array of constants that represent the directions in which to draw the

connection Connector: The connector to use (optional). This overrides usage of the default Dynamic

Connector.

DeleteEx(Flag) will delete additional shapes associated with a shape or selection, such as connectors and unselected container members, when the selection is deleted.

Flag: specify that unselected connectors, shapes within a container, or callouts are to also be deleted. When deleting connectors there is an option to heal the connection if a shape is deleted between two connectors.

20

Page 21: What's New for Developers in Visio 2010

Visio ServicesVisio Services in Microsoft SharePoint Server 2010 is a service application that allows users to share and view Microsoft Visio diagrams (saved as Web Drawings (.vdw)) from SharePoint. The service also enables data-connected Microsoft Visio 2010 diagrams to be refreshed and updated from a variety of data sources.

There are new file save options under File > Share that enable saving directly to SharePoint, which can provide a central repository for sharing large numbers of drawings, tracking versions, and enabling those without Visio to view Visio drawings (.vdw files). Basic diagram exploration and navigation of these rendered diagrams are supported within a SharePoint Server 2010 Web Part. Page designers can configure the look and functionality of the Web Part.

The following options are available when saving to SharePoint:

Save a Drawing (.vsd) - This is used when you need a place to organize your documents and to share them through a SharePoint site or if you have a large number of drawings to share.

Save a Web Drawing (.vdw) – This publishes the drawings as XAML/PNG allowing users who do not have Visio to view the drawings in a web browser on SharePoint using Visio Services. Publishing as a Web Drawing also supports refreshing data linked diagrams on the server when viewed from a browser.

Along with the Web Drawing (.vdw) file format is a new object for managing the publishing options when automating the publishing process. Use it to specify the pages and records to be published with the drawing. These are analogous to choosing the option File > Share > Save to SharePoint > Web Drawing. Choose Options and select the pages and Data Sources to be published.

21

Page 22: What's New for Developers in Visio 2010

The following sample uses the ServerPublishOption to save a drawing as a .vdw file. Pages to publish are specified in an array of String with the array holding the page names. Recordsets to publish are held in an array of Long with each array value being the ID of the data recordsets to publish. Below is sample code for saving a drawing as a Web Drawing. It publishes pages 1 and 3 along with data recordset with ID 1.

Sub SaveAsVDW()

'set the pages to publish

Dim PageNamesU(1) As String

PageNamesU(0) = "Page-1"

PageNamesU(1) = "Page-3"

Application.ActiveDocument.ServerPublishOptions.SetPagesToPublish _

visPublishPageSelect, PageNamesU, visLangUniversal

'set the recordsets to publish

Dim RecordsetIDs(0) As Long

RecordsetIDs(0) = 1

Application.ActiveDocument.ServerPublishOptions.SetRecordsetsToPublish _

visPublishDataRecordsetSelect, RecordsetIDs

'save the file

Application.ActiveDocument.SaveAsEx _

"C:\Users\Fred\Desktop\Sample.vdw", visSaveAsWS + visSaveAsListInMRU

End Sub

Integrating Visio drawings into SharePoint ApplicationsVisio Services enables you to embed Visio Web Drawings, regardless of whether they are static or dynamic, into SharePoint applications. Depending on your skill level with web technologies there are three scenarios for doing this. Slightly different skill sets are required for each scenario.

Visio Web Access web part. o Scenario: Embed Visio diagrams into SharePoint pages.

22

Page 23: What's New for Developers in Visio 2010

o Skills required: know how to create a web part page in SharePoint. Web Part Connections.

o Scenario: You can enable limited interactivity between the Visio Web Access web part and another on the page, without code. A typical example of this type of interactivity is to trigger one web part to show extra relevant information about a particular shape when it’s clicked in the Visio web part.

o Skills required: know how to create a web part page in SharePoint as well as how to set-up Web Part Connections.

The Visio Services Mash-up APIo Scenario: You can enable rich interactivity on your web part page by manipulating the

different Visio web diagram objects programmatically. A typical example of this type of interactivity is to show custom visual overlays when the person viewing the diagram hovers over a particular shape.

o Skills required: know how to code JavaScript and/or ASPX pages.

23

Page 24: What's New for Developers in Visio 2010

Process ValidationProcess > Check Diagram is new feature to validate a drawing based on rules that are stored within the drawing. The feature is used to check for common errors such as connectors not being glued and for companies to ensure that employees are following certain diagramming standards.

Note:Visio Premium is required. Process validation is not available in Visio Standard or Visio Professional.

Rule sets are stored in document templates and are provided for the templates Basic Flowchart, Cross Functional Flowchart, Microsoft SharePoint Workflow and Business Process Modeling Notation. For example, Visio uses validation for Microsoft SharePoint Workflow diagrams to ensure that SharePoint workflows are structured correctly before exporting them.

A rich validation object model and corresponding API enable custom solutions that add and delete rules, validate drawings with the new rules, detect the Validation event, and manage validation issues. For example, you can build rules to check that a network diagram includes mandatory components, or that a process diagram complies with company policies.

As seen in the diagram below, a ValidationRule is part of a collection of ValidationRules. A ValidationRuleSet combines the ValidationRules collection along with a Description and Enabled flag. In Visio’s Process tab choose Check Diagram and then Rules to Check. Each item listed is a rule set. If the rule set’s Enabled flag is set, then this rule set is checked in the menu and will be applied to the current drawing when Check Diagram is chosen.

The validation API is based on three main concepts: rule sets, rules and issues. A validation rule, or simply a rule, represents one type of error that can occur in your diagram. Each rule has some underlying business logic which determines when the rule has been broken. An issue is one case in your diagram where the validation rule has been broken. Depending on your diagram, there may be multiple issues associated with the same rule. For example, if the rule requires that all shapes be labeled, then validation will display an issue for each shape without a label. Rule sets are logical grouping of rules, such as the BPMN and flowchart rule sets.

24

Page 25: What's New for Developers in Visio 2010

The following VBA code adds a rule set and a rule that targets a shape to the active document.

Set vsoDocument = Visio.Activedocument

'Add a validation rule set to the document

Set vsoValidationRuleSet =

vsoDocument.Validation.RuleSets.Add("Connectivity")

vsoValidationRuleSet.Description = "Verify that shapes are correctly

connected in

the document."

vsoValidationRuleSet.Enabled = True

vsoValidationRuleSet.RuleSetFlags = Visio.VisRuleSetFlags.visRuleSetDefault

25

Page 26: What's New for Developers in Visio 2010

'Add a validation rule to the document

Set vsoValidationRule = vsoValidationRuleSet.Rules.Add(“Unglued2DShape”)

vsoValidationRule.Category = "Shapes"

vsoValidationRule.Description = "This 2-dimensional shape is not connected to

any

other shape."

vsoValidationRule.Ignored = False

vsoValidationRule.TargetType = Visio.VisRuleTargets.visRuleTargetShape

'The validation function Is1D() returns a Boolean value indicating whether

the

‘shape is 1D (True) or 2D (False)

vsoValidationRule.FilterExpression = "NOT(Is1D())"

'The validation function GLUEDSHAPES returns a set of shapes glued to the

shape.

'It takes as input one parameter indicating the direction of the glue.

'The direction values are equivalent to members of VisGluedShapesFlags:

'0 = visGluedShapesAll1D and 3 = visGluedShapesAll2D

'The validation function AGGCOUNT takes a set of shapes as its input, and

returns

'the number of shapes in the set.

vsoValidationRule.TestExpression = _

"AGGCOUNT(GLUEDSHAPES(0)) + AGGCOUNT(GLUEDSHAPES(3)) > 0"

Rules stored in a drawing can be viewed easily by saving the Visio drawing as a .vdx file and then searching the resulting XML file for “validation”. It is possible to edit the XML directly, but it is recommended that the provided API be used instead.

26

Page 27: What's New for Developers in Visio 2010

Validation methods for managing issues

When you set the TargetType, FilterExpression and TestExpression of a rule, Visio will manage issues associated with the rule for you. For very complex validation rules, you can omit these properties and write the validation logic in solution code. For this approach, the solution should listen for the appropriate RuleSetValidated event and use its own logic to determine the list of issues to add to the document.

Use ValidationRule.AddIssue([TargetPage],[TargetShape]) to create a new validation issue that is based on the validation rule, and add it to the document.

TargetPage(Optional): The page that either has the issue or has the shape with the issue. TargetShape(Optional): The shape that has the issue.

Use ValidationIssue.Delete() to delete the ValidationIssue object from the document

'Add a custom issue to the vsoValidationRule validation rule and associate it

‘with shape vsoShape on vsoPage

Set vsoValidationIssue = vsoValidationRule.AddIssue(vsoPage, vsoShape)

vsoValidationIssue.Ignored = False

27

Page 28: What's New for Developers in Visio 2010

Object Model UpdatesThis section describes the new objects and members of the Visio 2010 object model.

New Automation Objects and Members

New ObjectsNew object types for Visio 2010.

Objects Description

ContainerProperties Information about a single container object.

MovedSelectionEvent Information about a selection that is moved from one location, such as a page or a document to another.

RelatedShapePairEvent

Holds information about the shapes that are involved in a container relationship or a callout relationship.

ServerPublishOption Holds the options for publishing drawings as Visio Services.

Validation Top level object for Process diagram validation.

ValidationIssue A single issue resulting from validating a drawing.

ValidationIssues A collection of issues resulting from validating a process diagram.

ValidationRule A rule applied to the validation process.

ValidationRules The collection of all of the rules in a rule set.

ValidationRuleSet The set of rules to be applied when validating a drawing.

ValidationRuleSets The sets of all rules available for use.

28

Page 29: What's New for Developers in Visio 2010

New MethodsNew methods for Visio 2010.

Object Method Description

Application GetBuiltinStencilFile Returns one of the built in stencil files for backgrounds, borders, callouts, containers, legends

GetCustomStencilFile Returns the path to the specified custom stencil used to populate certain galleries in the Microsoft Visio user interface.

GetPreviewEnabled Returns a value that indicates whether preview is enabled for the specified gallery in the Microsoft Visio user interface.

RegisterRibbonX Register an application such as an addin for the ribbon interface.

SetPreviewEnabled Turns preview on or off for a gallery in the Microsoft Visio user interface.

UnregisterRibbonX Unregister an application such as an addin from using the ribbon extensibility interface.

ApplicationsSettings

GetRasterExportResolution Returns the raster export resolution settings.

SetRasterExportResolution Specifies the raster export resolution settings.

GetRasterExportSize Gets the raster export size.

29

Page 30: What's New for Developers in Visio 2010

SetRasterExportSize Sets the raster export size.

ContainerProperties

AddMember Adds a shape to a container. Add options include visMemberAddDoNotExpand, visMemberAddExpandContainer, visMemberAddUseResizeSetting

Disband Disbands the container without removing the member shapes

FitToContents Same as the UI function Container > Fit to Contents

GetListMemberPosition Gives the position of a container list

GetListMembers Returns Long array of list of container

GetListSpacing Gets the spacing between lists value from the User.msvSDListSpacing cell

GetMargin Gets the margin value from the User.msvSDContainerMargin cell.

GetMemberShapes Returns a list of shape IDs belonging to the container.

GetMemberState Given a shape returns a member value visContainerMemberInList, visContainerMemberInterior, visContainerMemberNotAMember,

30

Page 31: What's New for Developers in Visio 2010

visContainerMemberOnBoundary, visContainerMemberOutside

InsertListMember Adds a shape or set of shapes to the list in the container.

RemoveMember Removes a shape from container membership.

ReorderListMember Moves a shape or a set of shapes up or down in the list.

RotateFlipList Specify direction for flipping list. Values are visLayoutDirFlipHorz, visLayoutDirFlipVert, visLayoutDirRotateLeft, visLayoutDirRotateRight

SetListSpacing Sets the spacing value to the User.msvSDListSpacing cell

SetMargin Sets the margin value to the User.msvSDContainerMargin cell.

InvisibleApp GetBuiltinStencilFile Returns one of the built in stencil files for backgrounds, borders, callouts, containers, legends

GetCustomStencilFile Returns the path to the specified custom stencil used to populate certain galleries in the Microsoft Visio user interface.

GetPreviewEnabled Returns a value that indicates whether preview is enabled for the specified gallery in the Microsoft Visio user interface.

31

Page 32: What's New for Developers in Visio 2010

RegisterRibbonX Register an application such as an addin for the ribbon interface.

SetPreviewEnabled Turns preview on or off for a gallery in the Microsoft Visio user interface.

UnregisterRibbonX Unregister an application such as an addin from using the ribbon extensibility interface.

Master PasteToLocation Pastes a shape to the specified location.

Page AutoConnectMany Draws multiple connections between specified shapes.

AutoSizeDrawing Automatically resizes the drawing page by adding as many printer-paper-sized tiles as necessary to fit all shapes in the drawing onto the page.

AvoidPageBreaks Makes small adjustments to shapes to move them off page breaks.

DropCallout Add a callout shape to the drawing page

DropConnected Places new shape and adds a connector from the existing shape to the new shape. Parallels the Autoconnect feature.

DropContainer Add a container shape to a page

32

Page 33: What's New for Developers in Visio 2010

DropLegend Add a legend shape to the page.

DropIntoList Drops the specified object into the specified list at the specified position.

GetCallouts Returns a list of callouts on a page. Specify whether to include callouts that are inside containers using one of visContainerExcludeNested, visContainerIncludeNested

GetContainers Returns a list of container IDs.

LayoutChangeDirection Change the direction of the layout as specified by VisLayoutDirection.

LayoutIncremental Change the layout as specified using VisLayoutIncrementalType, VisLayoutHorzAlignType, and VisLayoutVertAlignType.

PasteToLocation Paste at a particular location.

SplitConnector Splits a connector with a specified shape.

Selection AddToContainers Adds the selection of shapes to all underlying containers that allow it as a member.

AvoidPageBreaks Makes small adjustments to selected shapes to move them off page breaks.

DeleteEx Deletes additional shapes associated with the selection,

33

Page 34: What's New for Developers in Visio 2010

such as connectors and unselected container members, when the selection is deleted.

GetCallouts Returns a list of callouts on a page. Specify whether to include callouts that are inside containers using one of visContainerExcludeNested, visContainerIncludeNested

GetContainers Returns a list of container IDs of the container shapes in the selection.

LayoutChangeDirection Change the direction of the layout as specified by VisLayoutDirection.

LayoutIncremental Change the layout as specified using VisLayoutIncrementalType, VisLayoutHorzAlignType, and VisLayoutVertAlignType.

MemberOfContainersIntersection

Returns an array of identifiers of the shapes that belong to the normal or list containers that contain all the shapes in the selection.

MemberOfContainersUnion Returns an array of identifiers of the shapes that belong to the normal or list containers that contain at least one of the shapes in the selection.

MoveToSubprocess Analogous to choosing Create from Selection from the Process

34

Page 35: What's New for Developers in Visio 2010

tab.

RemoveFromContainers Remove a shape or selection from all containers that it belongs to.

Resize Resizes the selection by moving shape handles as specified.

SetContainerFormat Values are visContainerFormatAutoResize, visContainerFormatFitToContents, visContainerFormatLockMembership

ServerPublishOptions

ExcludePage Specify a page to exclude when publishing as Visio Services.

GetPagesToPublish Returns an array of pages that are set to be published to a server.

GetRecordsToPublish Returns the identifiers (IDs) of the data recordsets that are set to be published to a server.

IncludePage Specify a page to include when publishing as Visio Services.

SetPagesToPublish Equivalient to selecting the pages to publish when saving as a web drawing.

SetRecordsToPublish Equivalient to selecting the records to publish when saving as a web drawing.

Shape AddToContainers Equivalent to Add to Underlying

35

Page 36: What's New for Developers in Visio 2010

containers

ConnectedShapes Returns IDs of shapes 1 degree of separation away from the shape

CreateSubProcess Analogous to choosing Create From Selection from the Process tab.

DeleteEx A shape delete method controlled with flags from VisDeleteFlags.

Disconnect Unglues the connector end points and offsets them a specified amount.

GluedShapes Returns IDs of shapes glued to a shape.

HasCategory Checks the User.msvShapeCategories cell for the requested category.

MoveToSubprocess Analogous to choosing Create from Selection from the Process tab.

RemoveFromContainers Remove a shape or selection from all containers that it belongs to.

Resize Resizes the shape by moving shape handles as specified.

Validation Validate Validate a drawing based on the enabled rule sets stored within it.

36

Page 37: What's New for Developers in Visio 2010

ValidationIssue Delete Delete an issue.

ValidationIssues Clear Delete all validation issues.

ValidationRule AddIssue Create a new issue related to this ValidationRule.

Delete Delete a rule.

ValidationRules Add Add a ValidationRule to the collection.

ValidationRuleSet

Delete Delete rule set.

ValidationRuleSets

Add Add a ValidationRuleSet to the collection.

AddCopy Add a copy of a ValidationRuleSet to the collection.

Window CenterViewOnShape Pans the Microsoft Visio drawing window to place the specified shape in the center of the view.

New PropertiesNew Properties for Visio 2010.

Object Property Description

Application DeferRalationshipRecalc Determines whether recalculating shape size and relationships are deferred when a member of the relationship pair is moved or resized.

37

Page 38: What's New for Developers in Visio 2010

CurrentEdition The current edition of Microsoft Visio.

InstanceHandle64 An instance handle for the application if the 64 bit version of the application is used.

ApplicationSettings RasterExportFlip Determines the flip that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object.

RasterExportOperation Determines the export operation that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object.

EnableFormulaAutoComplete Indicates whether ShapeSheet formula AutoComplete is enabled.

RasterExportBackgroundColor Determines the background color that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object.

RasterExportDataFormat Determines whether the exported raster image is interlaced or non-interlaced when you call the Export method of the Master, Page, Selection, or Shape object.

TransitionsEnabled Determines whether Microsoft Visio uses an animated transition to show certain shape movements, such as re-layout of

38

Page 39: What's New for Developers in Visio 2010

shapes.

DeleteConnectorsEnabled Determines whether connectors are deleted when a shape to which they are connected is deleted.

RasterExportDataCompression Determines the data compression algorithm that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object.

RasterExportColorFormat Determines the color format that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object.

RasterExportColorReduction Determines the color reduction that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object.

RecentTemplatesListSize Determines the number of entries in the Recent Templates list in the Microsoft Visio user interface.

RasterExportUseTransparencyColor

Determines whether Microsoft Visio applies, to the exported image, the transparency color that is specified in the RasterExportTransparencyColor property when you call the Export method of the Master, Page, Selection, or Shape object.

39

Page 40: What's New for Developers in Visio 2010

RasterExportRotation Determines the rotation that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object.

RasterExportQuality Determines the export quality that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object.

ApplyBackgroundToDocument Determines whether the selected background or border is applied to all pages in the document (True) or only to the current page (False).

ContainerProperties

Application Returns the instance of Microsoft Visio that is associated with an object.

ContainerStyle Contains the value of the User.msvSDContainerStyle cell. The style number is the same as the list order number from the insert Container list in the UI.

ContainerType A regular container or a list type container. Values are:

visContainerTypeList

visContainerTypeNormal

Document Gets the Document object that is associated with the ContainerProperties object.

HeadingStyle Contains the value of the

40

Page 41: What's New for Developers in Visio 2010

User.msvSDHeadingStyle cell.

ListAlignment Contains the values visListAlignCenterOrMiddle, visListAlignLeftOrTop, visListAlignRightOrBottom

ListDirection Contains the values visListDirBottomToTop, visListLeftToRight, visListRightToLeft, visListTopToBottom

LockMembership True or False. Specifies whether the container is locked to adding or removing members.

ObjectType Returns the type of this object.

OverlappedList Creates or removes an overlapped list relationship with another list shape, or returns the target list shape that participates in an overlapped list relationship with the source list shape.

ResizeAsNeedeed Contains the value of the msvSDContainerResize cell. Has values visContainerAutoResizeExpand, visContainerAutoResizeExpandContract, visContainerAutoResizeNone

Shape Returns the shape reference this container properties is part of.

Document CustomUI Gets or sets the Ribbon XML string that is passed to the document to

41

Page 42: What's New for Developers in Visio 2010

customize the Microsoft Office Fluent user interface.

DiagramServicesEnabled Determines which, if any, diagram services are enabled for the document.

UserCustomUI Gets or sets the Ribbon XML string that is passed to the document to customize the Quick Access toolbar or the Ribbon.

Validation Returns the Validation object that is associated with the document.

ServerPublisherOptions Returns a ServerPublishOptions object that you can use to specify the settings to apply when you save a document as a Web drawing (as a .vdw file), then publish and use it on a Microsoft SharePoint site in conjunction with Visio Services.

InvisibleApp DeferRalationshipRecalc Determines whether recalculating shape size and relationships are deferred when a member of the relationship pair is moved or resized.

CurrentEdition The current edition of Microsoft Visio.

InstanceHandle64 An instance handle for the application if the 64 bit version of the application is used.

MovedSelectionEvent

Application Returns the instance of Microsoft Visio that is associated with an

42

Page 43: What's New for Developers in Visio 2010

object.

ObjectType Returns the type of this object.

ReplacementShape Returns a Shape object that represents the shape that is in the source page and that replaces the source-page shapes or selection being moved to a sub-process page.

SelectionSource Returns a Selection object that represents the set of selected shapes before they are moved to a sub-process page.

SelectionTarget Returns a Selection object that represents the set of selected shapes after they are moved to a new sub-process page.

Stat Returns status information of an object.

Page Autosize Determines whether Microsoft Visio automatically resizes the drawing page by adding printer-paper-sized sheets, as necessary, to fit the drawing's contents.

LayoutRoutePassive Determines whether to enable advanced connector routing logic on the page.

RelatedShapePairEvent

ContainingPage Returns the Page object that is associated with the RelatedShapePairEvent object.

ContainingPageID Returns the identifier of the Page

43

Page 44: What's New for Developers in Visio 2010

object that is associated with the RelatedShapePairEvent object.

FromShapeID Returrns the identifier of the first (container or callout) shape in the related shape pair.

ToShapeID Returrns the identifier of the second (member) shape in the related shape pair.

ServerPublishOptions

IsPublishedPage Returns True if the specified page is designated to be included when the document is published as a .vdw file.

Shape CalloutsAssociated Returns an array of shape IDs of the callouts associated with a shape.

CalloutTarget Returns the shape the callout connects to.

ContainerProperties A reference to the ContainerProperties object

IsCallout Boolean specifies whether a shape is a callout shape

MemberOfContainers Returns IDs of containers the shape is a member of.

Shapes ItemFromUniqueID Returns the Shape object that matches the specified UniqueID property value.

Validation Issues The set of issues created during a validation.

44

Page 45: What's New for Developers in Visio 2010

LastValidatedDate Time stamp for the last validation.

RuleSets The set of all rule sets defined within a document

ShowIgnoredIssues Specifies that ignored issues are to be displayed in the Issues Window.

ValidationIssue Ignored States that the issue is to be ignored.

Rule The rule this issue relates to.

TargetPage Returns the page object where the issue occurs

TargetPageID Returns the page ID for the page where the issue occurs

TargetShape Returns the shape that the issue relates to.

ValidationIssues Count Returns the number of ValidationIssue objects in the collection.

Item Returns the ValidationIssue object that has the specified name or index position.

ItemFromID Returns the ValidationIssue object that matches the specified ID.

ValidationRule Category Represents the text displayed in the Category column of the Issues window.

Description A description of the rule

45

Page 46: What's New for Developers in Visio 2010

FilterExpression A formula used to define which shapes to apply the rule to.

Ignored States that the rule is to be ignored.

RuleSet The collection of rules that are to be applied for a specific drawing type.

TargetType The type of object the rule is targeting. Values are visRuleTargetDocument, visRuleTargetPage, visRuleTargetShape.

TestExpression A formula defining the specific rule to test.

ValidationRules Count Returns the number of ValidationRule objects in the collection.

Item Returns the ValidationRule object that has the specified index position.

ItemFromID Returns the ValidationRule object that matches the specified ID.

ValidationRuleSet Description A description of the rule set

Enabled States whether the rule set is be applied during document validation

Rules The set of rules which make up a rule set.

46

Page 47: What's New for Developers in Visio 2010

RuleSetFlags Has one of the values visRuleSetDefault, visRuleSetHidden, visRuleSetValidateOnPublish

ValidationRuleSets Count Returns the number of ValidationRuleSet objects in the collection.

Item Returns the ValidationRuleSet object that has the specified universal name or index position.

ItemFromID Returns the ValidationRuleSet object that matches the specified ID.

Window SelectedValidationIssue The issue selected in the Issues Window

SelectionForDragCopy Returns the Selection object that represents the collection of shapes that will participate in drag or copy operations, based on the current selection.

New EventsNew Events for Visio 2010.

Event Objects Description

CalloutRelationshipAdded Application, Documents, InvisibleApp, Page, Pages

Fires when a callout shape is connected

CalloutRelationshipDeleted Application, Fires when a callout shape is

47

Page 48: What's New for Developers in Visio 2010

Documents, InvisibleApp, Page, Pages

disconnected

ContainerRelationshipAdded Application, Documents, InvisibleApp, Page, Pages

Fires when a shape is added to a container

ContainerRelationshipDeleted Application, Documents, InvisibleApp, Page, Pages

Fires when a shape is removed from a container

RuleSetValidated Application, Document, Documents, InvisibleApp

Fires when a rule a set is used to validate a drawing.

New EnumerationsNew Enumerations for Visio 2010.

Enumeration Description

VisBuiltInStencilTypes Used when retrieving one of the built in stencils using GetBuiltinStencil. Values are visBuiltinStencilBackgrounds, visBuiltinStencilBorders, visBuiltinStencilCallouts, visBuiltinStencilContainers, visBuiltinLegends.

VisCenterViewFlags Use to control CenterViewOnShape. Values are visCenterViewDefault, visCenterViewOffScreen, visCenterViewSelectedShape.

VisConnectedShapesFlags Requested connection types passed to Shape.ConnectedShapes method. Values are visConnectedShapesAllNodes,

48

Page 49: What's New for Developers in Visio 2010

visConnectedShapesIncomingNodes, visConnectedShapesOutgoingNodes

VisConnectorEnds Specifies the connector end passed to Shape.Disconnect. Values are visConnectorBeginpoint, visConnectorBothEnds, visConnectorEndPoint.

VisContainerAutoResize Used to control container resizing. Values are visContainerAutoResizeExpand, visContainerAutoResizeExpandContract, visContainerAutoResizeNone.

VisContainerFlags Use to control GetMemberShapes. Values are visContainerFlagsDefault, visContainerFlagsExcludeCallouts, visContainerFlagsExcludeConnectors, visContainerFlagsExcludeContainers, visContainerFlagsElements, visContainerFlagsExcludeListElements, visContainerFlagsExcludeMembers.

VisContainerFormatType Use to control SetContainerFormat. Values are visContainerFormatContainerAutoResize, visContainerFormatContainerFitToContents, visContainerFormatContainerLockMembership.

VisContainerMemberState

Use to control GetMemberState. Values are visContainerMemberInList, visContainerMemberInterior, visContainerMemberNotAMember, visContainerMemberOnBoundary, visContainerMemberOutside.

VisContainerNested Used to control GetContainers. Values are visContainerExcludeNested, visContainerIncludeNested.

VisContainerTypes Enumerates ContainType property of ContainerProperties. Values are visContainerTypeList, visContainerTypeNormal.

49

Page 50: What's New for Developers in Visio 2010

VisDeleteFlags Used to control Shape.DeleteEx. Values are visDeleteHealConnectors, visDeleteNoAssociatedCallouts, visDeleteNoAutoSizePage, visDeleteNoContainerMembers, visDeleteNoHealConnectors, visDeleteNormal.

VisEdition Enumerates the CurrentEdition property of the application. Values are visEditionProfessional, visEditionStandard, visEditionUltimate.

VisGluedShapesFlags Requested glue types passed to Shape.GluedShapes method. Values are visGluedShapesAll1D, visGluedShapesAll2D, visGluedShapesIncoming1D, visGluedShapesIncoming2D, visGluedShapesOutgoing1D, visGluedShapesOutgoing2D.

VisLangFlags Use to control GetPagesToPublish. Values are visLangLocal, visLangUniversal.

VisLayoutDirection Use to control RotateFlipList and LayoutChangeDirection. Values are visLayoutDirFlipHorz, visLayoutDirFlipVert, visLayoutDirRotateLeft, visLayoutDirRotateRight.

VisLayoutHorzAlignType Use to control LayoutIncremental. Values are visLayoutHorzAlignCenter, visLayoutHorzAlignDefault, visLayoutHorzAlignLeft, visLayoutHorzAlignNone, visLayoutHorzAlignRight.

VisLayoutIncrementalType Use to control LayoutIncremental. Values are visLayoutIncrAlign, visLayoutIncrSpace.

VisLayoutVertAlignType Use to control LayoutIncremental. Values are visLayoutVertAlignBottom, visLayoutVertAlignDefault, visLayoutVertAlignMiddle, visLayoutVertAlignNone, visLayoutVertAlignTop.

VisLegendFlags Use to control DropLegend. Values are

50

Page 51: What's New for Developers in Visio 2010

visLegendNoContents, visLegendPopulate.

VisListAlignment Enumerates ListAlignment propert of ContainerProperties. Values are visListAlignCenterOrMiddle, visListAlignLeftOrTop, visListAlignRightOrBottom.

VisListDirection Enumerates ListAlignment propert of ContainerProperties. Values are visListDirBottomToTop, visListDirLeftToRight, visListDirTopToBottom, visListDirRightToLeft.

VisMemberAddOptions Used to control AddMember. Values are visMemberAddDoNotExpand, visMemberAddExpandContainer, visMemberAddUseResizeSetting.

VisPublishDataRecordsets Use to control GetRecordsToPublish. Values are visPublishDataRecordsetAll, visPublishDataRecordsetNone, visPublishDataRecordsetSelect.

VisPublishPages Use to control GetPagesToPublish. Values are visPublishPageAll, visPublishPageSelect.

VisResizeDirection Use to control Shape or Selection Resize. Values are visResizeDirE, visResizeDirN, visResizeDirNE, visResizeDirNW, visResizeDirS, visResizeDirSE, visResizeDirSW, visResizeDirW.

VisRibbonXModes Use to set target mode for RegisterRibbonX. Values are visRXModeDrawing, visRXModeGettingStarted, visRXModeNone, visRXModePrintPreview, visRXModeShapeSheet, visRXModeStencil.

VisRoleSelectionTypes Values are visRoleSelCallout, visRoleSelContainer, visRoleSelConnector.

VisRuleSetFlags Describe the RuleSetFlags property in the

51

Page 52: What's New for Developers in Visio 2010

ValidationRuleSet object. Values are visRuleSetDefault, visRuleSetHidden, visRuleSetValidateOnPublish

VisRuleTargets Describe the TargetType property of the ValidationRule. Values are visRuleTargetDocument, visRuleTargetPage, visRuleTargetShape

VisValidationFlags Flags used by the Validate method. Values are visValidationDefaullt, visValidationNoOpenWindow

New ShapeSheet Cells and Functions

FunctionsThe following are new functions are available in the ShapeSheet for Visio 2010.

Function name Description

ANGLEALONGPATH (section, percent, segment)

Returns the tangent angle of a point on the path defined in a geometry section

BOUNDINGBOXDIST (index) Returns the measurement for the part of the shape's bounding box specified by the Index enumeration

BOUNDINGBOXRECT (index) Returns the coordinate of an edge of the shape's bounding box specified by the Index enumeration

CALLOUTCOUNT () Returns the number of callouts connected to a shape

CALLOUTTARGETREF () Returns a reference to the shape a callout is connected to

CONTAINERCOUNT () Returns the number of containers that a shape is within.

CONTAINERMEMBERCOUNT () Returns the number of member shapes within a container.

CONTAINERSHEETREF (index,category_opt)

Returns a Sheet reference to the container shape that this shape is a member of

52

Page 53: What's New for Developers in Visio 2010

-- The 1-based Index parameter specifies which parent container to return, where the topmost container is ordered first -- If category is specified, the container must have that category in order to be returned

DISTTOPATH (section,x,y) Returns the shortest distance from the specified coordinates to a point on the path defined in a geometry section

DOCLASTEDIT () Returns a time for when the document was last edited.

FONTTOID (font_name_string) Returns an index related to the font.

HASCATEGORY (category) Checks the User.msvShapeCategories cell for the requested category.

IFERROR (expr, alt_expr) If no error, returns result of expr, otherwise returns result of alt_expr.

IS1D() Returns TRUE if the shape is one-dimensional

LISTMEMBERCOUNT () Returns the number of list members within a shape of type List.

LISTORDER () Returns the 1 based position of the shape in the list.

LISTSHEETREF () Returns a Sheet reference to the list container shape that this shape is a member of

MSOSHADE (color,-deltaLum) Modifies the color by decreasing its luminosity by the amount specified

MSOTINT (color,deltaLum) Modifies the color by increasing its luminosity by the amount specified

NEARESTPOINTONPATH (section,x,y)

Returns the point along the path defined in a geometry section that is nearest the specified coordinates

PATHLENGTH (section,segment) Returns the length of the path defined in a geometry

53

Page 54: What's New for Developers in Visio 2010

section

PATHSEGMENT(segment,percent) Returns the 1-based segment number containing a point on the path defined in a geometry section

POINTALONGPATH (section, percent, [offset], [segment])

Returns the coordinates of a point on or offset from the path defined in a geometry section

SEGMENTCOUNT (section,percent)

Returns the number of line segments that make up the path defined in a geometry section

SHEETREF () Returns a Sheet reference for the specified shape

VERSION () Returns the version of Visio.

CellsThe following are new ShapeSheet cells in Visio 2010.

Cell Section Description

AvoidPageBreaks Page Layout

determines whether the Auto Align and Space features attempt to avoid placing shapes on page breaks. Values are True and False

DisplayLevel Shape Layout

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.

DrawingResizeType

Page Properties

Controls automatic page resizing. Values are 0 - visAutoSizeDefault, 1 – visAutoSizeOn, 2 - visAutoSizeOff

FlyoutChild Actions Used to create a flyout custom menu from the ShapeSheet.

NoQuickDrag Geometry Determines whether a shape can be selected or dragged when the user clicks the filled area defined by the Geometry section.

54

Page 55: What's New for Developers in Visio 2010

Relationships Shape Layout

Stores the relationships between containers, lists, callouts, and shapes. The cell contains a DEPENDSON formula with references to all of the sheets that are related to this shape.

55

Page 56: What's New for Developers in Visio 2010

Deprecated featuresThe following tools have been removed from the product for Visio 2010.

Shape Studio has been removed from the Visio 2010 SDK. The Color by value Addin has been removed from Visio.

56

Page 57: What's New for Developers in Visio 2010

SummaryThis paper has provided a summary of many of the new developer features for Visio 2010. There is a brief description of each new feature along the related ShapeSheet and automation API components, and in some cases code samples.

57