1
votes

I want to create a new Master Shape in the Microsoft Visio 2013 x64 like the Class Master Shape in the UML Class Stencil.

When add the Class Master Shape to a page, it appends two Member and one Separator Master Shapes in itself automatically. Furthermore, can add more Member and Separator Master Shapes in it.

I was thinking that it adds other Master Shapes in itself by some written VBA codes; however, when I checked the file of the UML Class (Metric) Stencil in the following full path, I got that it uses no VBA codes, not at all.

D:\Program Files\Microsoft Office\Office15\Visio Content\1033\USTRME_M.VSSX

The file extension is "Visio Stencil (.vssx)" instead of "Visio Macro-Enabled Stencil (.vssm)"; so, it can't have VBA codes.

I know that I can do something by adding some new Rows in the Actions Section of the ShapeSheet; however, it doesn't exist any action Rows to add fresh Member and Separator Master Shapes for Class Shape.

Separator Shape with two additional options in the Context Menu and without any related rows in the ShapeSheet

Figure 1 - Separator Shape with two additional options in the Context Menu and without any related rows in the ShapeSheet

Display a Bar to insert Separator Shape

Figure 2 - Display a Bar to insert Separator Shape

Member Shape with two additional options in the Context Menu and without any related rows in the ShapeSheet

Figure 3 - Member Shape with two additional options in the Context Menu and without any related rows in the ShapeSheet

Display a Bar to insert Member Shape

Figure 4 - Display a Bar to insert Member Shape

When I do RMB click on a Class Shape that is placed in the page, it has two new options in the Context Menu:

  • Show Template Parameter
  • Show Stereotype

And I see related Actions' Section Rows for them.

Class Shape with two additional options in the Context Menu and related rows in the ShapeSheet

Figure 5 - Class Shape with two additional options in the Context Menu and related rows in the ShapeSheet

When I do RMB click on the Member and Separator Shapes in added Class Shape, can see "Insert "Member/Separator" before/after"; however, when I add Member and Separator Master Shapes on the page directly (not in the Class Shape), when I do RMB click on them, can't see extra options in the Context Menu.

Separator Shape with no additional options in the Context Menu

Figure 6 - Separator Shape with no additional options in the Context Menu

Member Shape with no additional options in the Context Menu

Figure 7 - Member Shape with no additional options in the Context Menu

I checked their ShapeSheet and can't find any related rows for above-mentioned actions.

Now, my question is that how can I create a new Master Shape with the ability to accept some other Master Shapes without any VBA codes like Class Shape in the UML Class Stencil that is created by Microsoft?

1

1 Answers

2
votes

This feature is called "List" (structured diagram) in Visio (was introduced in Visio 2010). To allow this sort of functionality (allow some shape to "accept" others similarly to "class" shape), you need to declare the shape to be a "list", by setting the user property User.msvStructureType="List" in it's shape sheet. To declare type of items it should accept, you also need to set the cell User.msvSDListItemMaster = USE("Your item's master name"). Means, you can just draw a plain rectangle (for example) and then convert it into a "List" by adding these two user properties. There are more options available for lists/container (such as margins, behavior, etc).

The MSDN article describing this functionality in details: http://blogs.msdn.com/b/visio/archive/2010/01/12/custom-containers-lists-and-callouts-in-visio-2010.aspx

enter image description here