Sie sind auf Seite 1von 57

Microsoft Visio 2010 Developer Training

What's New in Visio 2010 for Developers

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 1

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.

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 2

Table of Contents
Whats 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

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 3

Whats New for Developers in Visio 2010


Summary
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/.

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 4

ShapeSheet Enhancements
The 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.

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 5

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.

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 6

Creating cascading RMAs from the ShapeSheet


A 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.

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 7

Developer Tab in the Office Fluent UI


Conversion 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 tab


The features on the developer tab are hidden by design. Thats because most users dont use these features of the product. Show the Developer tab with the following steps:
1. 2. 3. 4.

Click the Backstage button in the upper left portion of the screen Choose Visio Options Choose Advanced Scroll down to the bottom to see the General section and select Run in developer mode

Groupings
The 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

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 8

New shape types


Visio 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. 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. Microsoft Visio 2010 Developer Training 2010 Microsoft Corporation. All rights reserved. What's New in Visio 2010 for Developers 9

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 users 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 cotainers 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.

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 10

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 shapes 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 Microsoft Visio 2010 Developer Training 2010 Microsoft Corporation. All rights reserved. What's New in Visio 2010 for Developers 11

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 Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers 2010 Microsoft Corporation. All rights reserved. 12

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

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 13

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. 2010 Microsoft Corporation. All rights reserved. 14

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

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 shapes CalloutTarget property. Test whether a shape is a callout with the shapes 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.

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 15

Diagram Services
Diagram 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

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 16

Copy / Paste
Visios 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

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 17

'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

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 18

Connectivity API
One 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 shapes 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. 2010 Microsoft Corporation. All rights reserved. 19

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

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.

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 20

Visio Services
Visio 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.

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 21

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 Applications


Visio 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. 2010 Microsoft Corporation. All rights reserved. 22

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

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 its clicked in the Visio web part. o Skills required: know how to create a web part page in SharePoint as well as how to setup Web Part Connections. The Visio Services Mash-up API o 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.

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 23

Process Validation
Process > 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.
Visio Premium is required. Process validation is not available in Visio Standard or Visio Professional.

Note:

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 Visios Process tab choose Check Diagram and then Rules to Check. Each item listed is a rule set. If the rule sets 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.

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 24

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 'Add a validation rule to the document Set vsoValidationRule = vsoValidationRuleSet.Rules.Add(Unglued2DShape)

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 25

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.

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 26

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

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 27

Object Model Updates


This section describes the new objects and members of the Visio 2010 object model.

New Automation Objects and Members


New Objects
New object types for Visio 2010. Objects ContainerProperties MovedSelectionEvent Description Information about a single container object. Information about a selection that is moved from one location, such as a page or a document to another. Holds information about the shapes that are involved in a container relationship or a callout relationship. Holds the options for publishing drawings as Visio Services. Top level object for Process diagram validation. A single issue resulting from validating a drawing. A collection of issues resulting from validating a process diagram. A rule applied to the validation process. The collection of all of the rules in a rule set. The set of rules to be applied when validating a drawing. The sets of all rules available for use.

RelatedShapePairEvent

ServerPublishOption Validation ValidationIssue ValidationIssues

ValidationRule ValidationRules ValidationRuleSet ValidationRuleSets

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 28

New Methods
New methods for Visio 2010. Object Application Method GetBuiltinStencilFile Description Returns one of the built in stencil files for backgrounds, borders, callouts, containers, legends Returns the path to the specified custom stencil used to populate certain galleries in the Microsoft Visio user interface. Returns a value that indicates whether preview is enabled for the specified gallery in the Microsoft Visio user interface. Register an application such as an addin for the ribbon interface. Turns preview on or off for a gallery in the Microsoft Visio user interface. Unregister an application such as an addin from using the ribbon extensibility interface. Returns the raster export resolution settings. Specifies the raster export resolution settings. Gets the raster export size. 2010 Microsoft Corporation. All rights reserved. 29

GetCustomStencilFile

GetPreviewEnabled

RegisterRibbonX

SetPreviewEnabled

UnregisterRibbonX

ApplicationsSett ings

GetRasterExportResolution

SetRasterExportResolution

GetRasterExportSize Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

SetRasterExportSize ContainerPrope rties AddMember

Sets the raster export size. Adds a shape to a container. Add options include visMemberAddDoNotExpand, visMemberAddExpandContaine r, visMemberAddUseResizeSettin g Disbands the container without removing the member shapes Same as the UI function Container > Fit to Contents Gives the position of a container list Returns Long array of list of container Gets the spacing between lists value from the User.msvSDListSpacing cell Gets the margin value from the User.msvSDContainerMargin cell. Returns a list of shape IDs belonging to the container. Given a shape returns a member value visContainerMemberInList, visContainerMemberInterior, visContainerMemberNotAMem ber, 2010 Microsoft Corporation. All rights reserved. 30

Disband

FitToContents

GetListMemberPosition

GetListMembers

GetListSpacing

GetMargin

GetMemberShapes

GetMemberState

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

visContainerMemberOnBounda ry, visContainerMemberOutside InsertListMember Adds a shape or set of shapes to the list in the container. Removes a shape from container membership. Moves a shape or a set of shapes up or down in the list. Specify direction for flipping list. Values are visLayoutDirFlipHorz, visLayoutDirFlipVert, visLayoutDirRotateLeft, visLayoutDirRotateRight Sets the spacing value to the User.msvSDListSpacing cell Sets the margin value to the User.msvSDContainerMargin cell. Returns one of the built in stencil files for backgrounds, borders, callouts, containers, legends Returns the path to the specified custom stencil used to populate certain galleries in the Microsoft Visio user interface. Returns a value that indicates whether preview is enabled for the specified gallery in the 2010 Microsoft Corporation. All rights reserved. 31

RemoveMember

ReorderListMember

RotateFlipList

SetListSpacing

SetMargin

InvisibleApp

GetBuiltinStencilFile

GetCustomStencilFile

GetPreviewEnabled

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

Microsoft Visio user interface. RegisterRibbonX Register an application such as an addin for the ribbon interface. Turns preview on or off for a gallery in the Microsoft Visio user interface. Unregister an application such as an addin from using the ribbon extensibility interface. Pastes a shape to the specified location. Draws multiple connections between specified shapes. 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. Makes small adjustments to shapes to move them off page breaks. Add a callout shape to the drawing page Places new shape and adds a connector from the existing shape to the new shape. Parallels the Autoconnect feature.

SetPreviewEnabled

UnregisterRibbonX

Master

PasteToLocation

Page

AutoConnectMany

AutoSizeDrawing

AvoidPageBreaks

DropCallout

DropConnected

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 32

DropContainer DropLegend DropIntoList

Add a container shape to a page Add a legend shape to the page. Drops the specified object into the specified list at the specified position. Returns a list of callouts on a page. Specify whether to include callouts that are inside containers using one of visContainerExcludeNested, visContainerIncludeNested Returns a list of container IDs. Change the direction of the layout as specified by VisLayoutDirection. Change the layout as specified using VisLayoutIncrementalType, VisLayoutHorzAlignType, and VisLayoutVertAlignType. Paste at a particular location. Splits a connector with a specified shape. Adds the selection of shapes to all underlying containers that allow it as a member. Makes small adjustments to selected shapes to move them off page breaks. 2010 Microsoft Corporation. All rights reserved. 33

GetCallouts

GetContainers LayoutChangeDirection

LayoutIncremental

PasteToLocation SplitConnector

Selection

AddToContainers

AvoidPageBreaks

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

DeleteEx

Deletes additional shapes associated with the selection, such as connectors and unselected container members, when the selection is deleted. Returns a list of callouts on a page. Specify whether to include callouts that are inside containers using one of visContainerExcludeNested, visContainerIncludeNested Returns a list of container IDs of the container shapes in the selection. Change the direction of the layout as specified by VisLayoutDirection. Change the layout as specified using VisLayoutIncrementalType, VisLayoutHorzAlignType, and VisLayoutVertAlignType. Returns an array of identifiers of the shapes that belong to the normal or list containers that contain all the shapes in the selection. 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.

GetCallouts

GetContainers

LayoutChangeDirection

LayoutIncremental

MemberOfContainersInters ection

MemberOfContainersUnion

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 34

MoveToSubprocess

Analogous to choosing Create from Selection from the Process tab. Remove a shape or selection from all containers that it belongs to. Resizes the selection by moving shape handles as specified. Values are visContainerFormatAutoResize, visContainerFormatFitToConten ts, visContainerFormatLockMembe rship Specify a page to exclude when publishing as Visio Services. Returns an array of pages that are set to be published to a server. Returns the identifiers (IDs) of the data recordsets that are set to be published to a server. Specify a page to include when publishing as Visio Services. Equivalient to selecting the pages to publish when saving as a web drawing. Equivalient to selecting the records to publish when saving

RemoveFromContainers

Resize

SetContainerFormat

ServerPublishO ptions

ExcludePage

GetPagesToPublish

GetRecordsToPublish

IncludePage

SetPagesToPublish

SetRecordsToPublish

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 35

as a web drawing. Shape AddToContainers Equivalent to Add to Underlying containers Returns IDs of shapes 1 degree of separation away from the shape Analogous to choosing Create From Selection from the Process tab. A shape delete method controlled with flags from VisDeleteFlags. Unglues the connector end points and offsets them a specified amount. Returns IDs of shapes glued to a shape. Checks the User.msvShapeCategories cell for the requested category. Analogous to choosing Create from Selection from the Process tab. Remove a shape or selection from all containers that it belongs to. Resizes the shape by moving shape handles as specified.

ConnectedShapes

CreateSubProcess

DeleteEx

Disconnect

GluedShapes

HasCategory

MoveToSubprocess

RemoveFromContainers

Resize

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 36

Validation

Validate

Validate a drawing based on the enabled rule sets stored within it. Delete an issue. Delete all validation issues. Create a new issue related to this ValidationRule. Delete a rule. Add a ValidationRule to the collection. Delete rule set.

ValidationIssue ValidationIssues ValidationRule

Delete Clear AddIssue

Delete ValidationRules Add

ValidationRuleS et ValidationRuleS ets

Delete

Add

Add a ValidationRuleSet to the collection. Add a copy of a ValidationRuleSet to the collection. Pans the Microsoft Visio drawing window to place the specified shape in the center of the view.

AddCopy

Window

CenterViewOnShape

New Properties
New Properties for Visio 2010. Object Application Property DeferRalationshipRecalc Description Determines whether recalculating shape size and relationships are

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 37

deferred when a member of the relationship pair is moved or resized. CurrentEdition The current edition of Microsoft Visio. An instance handle for the application if the 64 bit version of the application is used. Determines the flip that is applied to the exported image when you call the Export method of the Master, Page, Selection, or Shape object. 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. Indicates whether ShapeSheet formula AutoComplete is enabled. 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. Determines whether the exported raster image is interlaced or noninterlaced when you call the Export method of the Master, Page, Selection, or Shape object.

InstanceHandle64

ApplicationSettings

RasterExportFlip

RasterExportOperation

EnableFormulaAutoComplete

RasterExportBackgroundColor

RasterExportDataFormat

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 38

TransitionsEnabled

Determines whether Microsoft Visio uses an animated transition to show certain shape movements, such as re-layout of shapes. Determines whether connectors are deleted when a shape to which they are connected is deleted. 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. 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. 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. Determines the number of entries in the Recent Templates list in the Microsoft Visio user interface. Determines whether Microsoft Visio applies, to the exported image, the transparency color that is specified in the RasterExportTransparencyColor

DeleteConnectorsEnabled

RasterExportDataCompression

RasterExportColorFormat

RasterExportColorReduction

RecentTemplatesListSize

RasterExportUseTransparency Color

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 39

property when you call the Export method of the Master, Page, Selection, or Shape object. 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. 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. Determines whether the selected background or border is applied to all pages in the document (True) or only to the current page (False). Returns the instance of Microsoft Visio that is associated with an object. 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. A regular container or a list type container. Values are: visContainerTypeList visContainerTypeNormal Document Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers Gets the Document object that is 2010 Microsoft Corporation. All rights reserved. 40

RasterExportQuality

ApplyBackgroundToDocument

ContainerPropertie s

Application

ContainerStyle

ContainerType

associated with the ContainerProperties object. HeadingStyle Contains the value of the User.msvSDHeadingStyle cell. Contains the values visListAlignCenterOrMiddle, visListAlignLeftOrTop, visListAlignRightOrBottom Contains the values visListDirBottomToTop, visListLeftToRight, visListRightToLeft, visListTopToBottom True or False. Specifies whether the container is locked to adding or removing members. Returns the type of this object. 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. Contains the value of the msvSDContainerResize cell. Has values visContainerAutoResizeExpand, visContainerAutoResizeExpandCo ntract, visContainerAutoResizeNone

ListAlignment

ListDirection

LockMembership

ObjectType OverlappedList

ResizeAsNeedeed

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 41

Shape

Returns the shape reference this container properties is part of. Gets or sets the Ribbon XML string that is passed to the document to customize the Microsoft Office Fluent user interface. Determines which, if any, diagram services are enabled for the document. Gets or sets the Ribbon XML string that is passed to the document to customize the Quick Access toolbar or the Ribbon. Returns the Validation object that is associated with the document. 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. Determines whether recalculating shape size and relationships are deferred when a member of the relationship pair is moved or resized. The current edition of Microsoft Visio.

Document

CustomUI

DiagramServicesEnabled

UserCustomUI

Validation

ServerPublisherOptions

InvisibleApp

DeferRalationshipRecalc

CurrentEdition

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 42

InstanceHandle64

An instance handle for the application if the 64 bit version of the application is used. Returns the instance of Microsoft Visio that is associated with an object. Returns the type of this object. 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. Returns a Selection object that represents the set of selected shapes before they are moved to a sub-process page. Returns a Selection object that represents the set of selected shapes after they are moved to a new sub-process page. Returns status information of an object. Determines whether Microsoft Visio automatically resizes the drawing page by adding printerpaper-sized sheets, as necessary, to fit the drawing's contents. Determines whether to enable advanced connector routing logic 2010 Microsoft Corporation. All rights reserved. 43

MovedSelectionEve nt

Application

ObjectType ReplacementShape

SelectionSource

SelectionTarget

Stat

Page

Autosize

LayoutRoutePassive

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

on the page. RelatedShapePairE vent ContainingPage Returns the Page object that is associated with the RelatedShapePairEvent object. Returns the identifier of the Page object that is associated with the RelatedShapePairEvent object. Returrns the identifier of the first (container or callout) shape in the related shape pair. Returrns the identifier of the second (member) shape in the related shape pair. Returns True if the specified page is designated to be included when the document is published as a .vdw file. Returns an array of shape IDs of the callouts associated with a shape. Returns the shape the callout connects to. A reference to the ContainerProperties object Boolean specifies whether a shape is a callout shape Returns IDs of containers the shape is a member of.

ContainingPageID

FromShapeID

ToShapeID

ServerPublishOptio ns

IsPublishedPage

Shape

CalloutsAssociated

CalloutTarget

ContainerProperties

IsCallout

MemberOfContainers

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 44

Shapes

ItemFromUniqueID

Returns the Shape object that matches the specified UniqueID property value. The set of issues created during a validation. Time stamp for the last validation. The set of all rule sets defined within a document Specifies that ignored issues are to be displayed in the Issues Window. States that the issue is to be ignored. The rule this issue relates to. Returns the page object where the issue occurs Returns the page ID for the page where the issue occurs Returns the shape that the issue relates to. Returns the number of ValidationIssue objects in the collection. Returns the ValidationIssue object that has the specified name or index position. Returns the ValidationIssue object

Validation

Issues

LastValidatedDate RuleSets

ShowIgnoredIssues

ValidationIssue

Ignored

Rule TargetPage

TargetPageID

TargetShape

ValidationIssues

Count

Item

ItemFromID

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 45

that matches the specified ID. ValidationRule Category Represents the text displayed in the Category column of the Issues window. A description of the rule A formula used to define which shapes to apply the rule to. States that the rule is to be ignored. The collection of rules that are to be applied for a specific drawing type. The type of object the rule is targeting. Values are visRuleTargetDocument, visRuleTargetPage, visRuleTargetShape. A formula defining the specific rule to test. Returns the number of ValidationRule objects in the collection. Returns the ValidationRule object that has the specified index position. Returns the ValidationRule object that matches the specified ID. A description of the rule set 2010 Microsoft Corporation. All rights reserved. 46

Description FilterExpression

Ignored

RuleSet

TargetType

TestExpression

ValidationRules

Count

Item

ItemFromID

ValidationRuleSet

Description

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

Enabled

States whether the rule set is be applied during document validation The set of rules which make up a rule set. Has one of the values visRuleSetDefault, visRuleSetHidden, visRuleSetValidateOnPublish Returns the number of ValidationRuleSet objects in the collection. Returns the ValidationRuleSet object that has the specified universal name or index position. Returns the ValidationRuleSet object that matches the specified ID. The issue selected in the Issues Window Returns the Selection object that represents the collection of shapes that will participate in drag or copy operations, based on the current selection.

Rules

RuleSetFlags

ValidationRuleSets

Count

Item

ItemFromID

Window

SelectedValidationIssue

SelectionForDragCopy

New Events
New Events for Visio 2010. Event Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers Objects Description 2010 Microsoft Corporation. All rights reserved. 47

CalloutRelationshipAdded

Application, Documents, InvisibleApp, Page, Pages Application, Documents, InvisibleApp, Page, Pages Application, Documents, InvisibleApp, Page, Pages Application, Documents, InvisibleApp, Page, Pages Application, Document, Documents, InvisibleApp

Fires when a callout shape is connected

CalloutRelationshipDeleted

Fires when a callout shape is disconnected

ContainerRelationshipAdded

Fires when a shape is added to a container

ContainerRelationshipDeleted

Fires when a shape is removed from a container

RuleSetValidated

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

New Enumerations
New Enumerations for Visio 2010. Enumeration VisBuiltInStencilTypes Description Used when retrieving one of the built in stencils using GetBuiltinStencil. Values are visBuiltinStencilBackgrounds, visBuiltinStencilBorders, visBuiltinStencilCallouts, visBuiltinStencilContainers, visBuiltinLegends.

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 48

VisCenterViewFlags

Use to control CenterViewOnShape. Values are visCenterViewDefault, visCenterViewOffScreen, visCenterViewSelectedShape. Requested connection types passed to Shape.ConnectedShapes method. Values are visConnectedShapesAllNodes, visConnectedShapesIncomingNodes, visConnectedShapesOutgoingNodes Specifies the connector end passed to Shape.Disconnect. Values are visConnectorBeginpoint, visConnectorBothEnds, visConnectorEndPoint. Used to control container resizing. Values are visContainerAutoResizeExpand, visContainerAutoResizeExpandContract, visContainerAutoResizeNone. Use to control GetMemberShapes. Values are visContainerFlagsDefault, visContainerFlagsExcludeCallouts, visContainerFlagsExcludeConnectors, visContainerFlagsExcludeContainers, visContainerFlagsElements, visContainerFlagsExcludeListElements, visContainerFlagsExcludeMembers. Use to control SetContainerFormat. Values are visContainerFormatContainerAutoResize, visContainerFormatContainerFitToContents, visContainerFormatContainerLockMembership. Use to control GetMemberState. Values are visContainerMemberInList, visContainerMemberInterior, visContainerMemberNotAMember, visContainerMemberOnBoundary, visContainerMemberOutside. 2010 Microsoft Corporation. All rights reserved. 49

VisConnectedShapesFlags

VisConnectorEnds

VisContainerAutoResize

VisContainerFlags

VisContainerFormatType

VisContainerMemberState

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

VisContainerNested

Used to control GetContainers. Values are visContainerExcludeNested, visContainerIncludeNested. Enumerates ContainType property of ContainerProperties. Values are visContainerTypeList, visContainerTypeNormal. Used to control Shape.DeleteEx. Values are visDeleteHealConnectors, visDeleteNoAssociatedCallouts, visDeleteNoAutoSizePage, visDeleteNoContainerMembers, visDeleteNoHealConnectors, visDeleteNormal. Enumerates the CurrentEdition property of the application. Values are visEditionProfessional, visEditionStandard, visEditionUltimate. Requested glue types passed to Shape.GluedShapes method. Values are visGluedShapesAll1D, visGluedShapesAll2D, visGluedShapesIncoming1D, visGluedShapesIncoming2D, visGluedShapesOutgoing1D, visGluedShapesOutgoing2D. Use to control GetPagesToPublish. Values are visLangLocal, visLangUniversal. Use to control RotateFlipList and LayoutChangeDirection. Values are visLayoutDirFlipHorz, visLayoutDirFlipVert, visLayoutDirRotateLeft, visLayoutDirRotateRight. Use to control LayoutIncremental. Values are visLayoutHorzAlignCenter, visLayoutHorzAlignDefault, visLayoutHorzAlignLeft, visLayoutHorzAlignNone, visLayoutHorzAlignRight. Use to control LayoutIncremental. Values are visLayoutIncrAlign, visLayoutIncrSpace. 2010 Microsoft Corporation. All rights reserved. 50

VisContainerTypes

VisDeleteFlags

VisEdition

VisGluedShapesFlags

VisLangFlags

VisLayoutDirection

VisLayoutHorzAlignType

VisLayoutIncrementalType

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

VisLayoutVertAlignType

Use to control LayoutIncremental. Values are visLayoutVertAlignBottom, visLayoutVertAlignDefault, visLayoutVertAlignMiddle, visLayoutVertAlignNone, visLayoutVertAlignTop. Use to control DropLegend. Values are visLegendNoContents, visLegendPopulate. Enumerates ListAlignment propert of ContainerProperties. Values are visListAlignCenterOrMiddle, visListAlignLeftOrTop, visListAlignRightOrBottom. Enumerates ListAlignment propert of ContainerProperties. Values are visListDirBottomToTop, visListDirLeftToRight, visListDirTopToBottom, visListDirRightToLeft. Used to control AddMember. Values are visMemberAddDoNotExpand, visMemberAddExpandContainer, visMemberAddUseResizeSetting. Use to control GetRecordsToPublish. Values are visPublishDataRecordsetAll, visPublishDataRecordsetNone, visPublishDataRecordsetSelect. Use to control GetPagesToPublish. Values are visPublishPageAll, visPublishPageSelect. Use to control Shape or Selection Resize. Values are visResizeDirE, visResizeDirN, visResizeDirNE, visResizeDirNW, visResizeDirS, visResizeDirSE, visResizeDirSW, visResizeDirW. Use to set target mode for RegisterRibbonX. Values are visRXModeDrawing, visRXModeGettingStarted, visRXModeNone, visRXModePrintPreview, 2010 Microsoft Corporation. All rights reserved. 51

VisLegendFlags

VisListAlignment

VisListDirection

VisMemberAddOptions

VisPublishDataRecordsets

VisPublishPages

VisResizeDirection

VisRibbonXModes

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

visRXModeShapeSheet, visRXModeStencil. VisRoleSelectionTypes Values are visRoleSelCallout, visRoleSelContainer, visRoleSelConnector. Describe the RuleSetFlags property in the ValidationRuleSet object. Values are visRuleSetDefault, visRuleSetHidden, visRuleSetValidateOnPublish Describe the TargetType property of the ValidationRule. Values are visRuleTargetDocument, visRuleTargetPage, visRuleTargetShape Flags used by the Validate method. Values are visValidationDefaullt, visValidationNoOpenWindow

VisRuleSetFlags

VisRuleTargets

VisValidationFlags

New ShapeSheet Cells and Functions


Functions
The following are new functions are available in the ShapeSheet for Visio 2010. Function name ANGLEALONGPATH (section, percent, segment) BOUNDINGBOXDIST (index) Description Returns the tangent angle of a point on the path defined in a geometry section Returns the measurement for the part of the shape's bounding box specified by the Index enumeration Returns the coordinate of an edge of the shape's bounding box specified by the Index enumeration Returns the number of callouts connected to a shape Returns a reference to the shape a callout is connected to

BOUNDINGBOXRECT (index)

CALLOUTCOUNT () CALLOUTTARGETREF ()

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 52

CONTAINERCOUNT () CONTAINERMEMBERCOUNT ()

Returns the number of containers that a shape is within. Returns the number of member shapes within a container. Returns a Sheet reference to the container shape that this shape is a member of -- 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 Returns the shortest distance from the specified coordinates to a point on the path defined in a geometry section Returns a time for when the document was last edited. Returns an index related to the font. Checks the User.msvShapeCategories cell for the requested category. If no error, returns result of expr, otherwise returns result of alt_expr. Returns TRUE if the shape is one-dimensional Returns the number of list members within a shape of type List. Returns the 1 based position of the shape in the list. Returns a Sheet reference to the list container shape that this shape is a member of Modifies the color by decreasing its luminosity by the amount specified

CONTAINERSHEETREF (index,category_opt)

DISTTOPATH (section,x,y)

DOCLASTEDIT () FONTTOID (font_name_string) HASCATEGORY (category)

IFERROR (expr, alt_expr)

IS1D() LISTMEMBERCOUNT ()

LISTORDER () LISTSHEETREF ()

MSOSHADE (color,-deltaLum)

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 53

MSOTINT (color,deltaLum)

Modifies the color by increasing its luminosity by the amount specified Returns the point along the path defined in a geometry section that is nearest the specified coordinates Returns the length of the path defined in a geometry section Returns the 1-based segment number containing a point on the path defined in a geometry section Returns the coordinates of a point on or offset from the path defined in a geometry section Returns the number of line segments that make up the path defined in a geometry section Returns a Sheet reference for the specified shape Returns the version of Visio.

NEARESTPOINTONPATH (section,x,y) PATHLENGTH (section,segment)

PATHSEGMENT(segment,percent)

POINTALONGPATH (section, percent, [offset], [segment]) SEGMENTCOUNT (section,percent) SHEETREF () VERSION ()

Cells
The following are new ShapeSheet cells in Visio 2010. Cell AvoidPageBreaks Section Page Layout Description determines whether the Auto Align and Space features attempt to avoid placing shapes on page breaks. Values are True and False 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. Controls automatic page resizing. Values are 0 visAutoSizeDefault, 1 visAutoSizeOn, 2 visAutoSizeOff 2010 Microsoft Corporation. All rights reserved. 54

DisplayLevel

Shape Layout

DrawingResizeType

Page Properties

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

FlyoutChild

Actions

Used to create a flyout custom menu from the ShapeSheet. Determines whether a shape can be selected or dragged when the user clicks the filled area defined by the Geometry section. 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.

NoQuickDrag

Geometry

Relationships

Shape Layout

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 55

Deprecated features
The 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.

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 56

Summary
This 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.

Microsoft Visio 2010 Developer Training What's New in Visio 2010 for Developers

2010 Microsoft Corporation. All rights reserved. 57

Das könnte Ihnen auch gefallen