Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
programming4us
Windows 7

Microsoft Visio 2010 : Extensions to our ribbon

- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire
2/27/2012 4:17:04 PM

Our Rules Tools group in the Process tab of the Visio ribbon needs to be extended to include our new features. The features can be viewed in the following screenshot:

There are four new buttons required. They are:

  • Annotate

  • Report

  • Export

  • Import

These are added to Ribbon.xml and the relevant callbacks are added to the Ribbon class.

The Annotate button is enabled for all diagrams, but the other buttons are only enabled when the Rules Explorer window is open, and I have arranged them on the dropdown menu of a split button.

The OnAction event of the Annotate button checks whether the active page type is a visTypeForeground. This is because a user may inadvertently be on a reviewer (visTypeMarkup) or background (visTypeBackground) page when the button is clicked. This is explained further in the next section.

case "buttonAnnotate":
Globals.ThisAddIn.OnActionAnnotateIssues();
break;

The ThisAddin class has the following method:

public void OnActionAnnotateIssues()
{
ViewModel.VEDocument document = this.documents[Globals.ThisAddIn.Application.ActiveDocument.ID];
if (document != null)
{
// this is our document so call open window
document.OpenAnnotateIssues();
}
}


					  

The VEDocument class has the OpenAnnotateIssues() method that checks the page type, and whether the user is in markup mode or not (this is done by checking if the value of a specific cell in the document's ShapeSheet):

public void OpenAnnotateIssues()
{
Globals.ThisAddIn.VEApp.SelectedVEDocument = this;
//Toggle the annotation
if (Globals.ThisAddIn.VEApp.VisioApplication.ActivePage.Type == Visio.VisPageTypes.visTypeForeground)
if (this.document.DocumentSheet.get_CellsSRC( (short)Visio.VisSectionIndices.visSectionObject,
(short)Visio.VisRowIndices.visRowDoc,
(short)Visio.VisCellIndices.visDocViewMarkup).ResultIU ==0)
{ this.DisplayIssueMarkup(); }
else
{ this.HideIssueMarkup(); }
else
this.HideIssueMarkup();
}


					  

Both the Export RuleSets and RuleSets Report button will output a single rule set if a rule or rule set item is selected in the Rules Explorer window, or all of the rule sets if a document item is selected. The export method is as follows:

Globals.ThisAddIn.VEApp.SelectedVEDocument.ExportDocument(true, true);

And the report method is called as follows:

Globals.ThisAddIn.VEApp.SelectedVEDocument.ReportDocument(true, false);

The two arguments passed through are used to decide whether to include rule sets and issues in the action. Actually, whilst I have provided exporting rule sets and issues to XML, I have not included a report for issues currently. Therefore, the second argument for ReportDocument is false. Perhaps, you would like to create a XSL report for issues.

The action for the Import RuleSets button simply checks that a document has been selected in the Rules Explorer before asking for a confirmation of the rule sets in the selected XML document.

if (Globals.ThisAddIn.VEApp.SelectedVEDocument != null)
{
if (System.Windows.MessageBox.Show("Do you want to import the rule sets to " +
Globals.ThisAddIn.VEApp.SelectedVEDocument.DisplayName + "?",
this.GetLabel(control),
System.Windows.MessageBoxButton.YesNo,
System.Windows.MessageBoxImage.Question,
System.Windows.MessageBoxResult.Yes) == System.Windows.MessageBoxResult.Yes)
{
Globals.ThisAddIn.VEApp.SelectedVEDocument.ImportRuleSets();
}
}				  
Other -----------------
- Managing Printing : Managing Client-Side Printer Experience Using Group Policy
- Managing Printing : Client-Side Management of Printers
- Testing Code with Visual Studio 2010 : Approaches to Unit Testing
- Managing Printers Using Print Management (part 2) - Configuring Printer Driver Isolation Mode
- Managing Printers Using Print Management (part 1) - Configuring Properties of Printers, Publishing Printers in AD DS & Managing Printer Drivers
- Understanding the Print Management Console (part 2) - Configuring Default Security for Print Servers
- Understanding the Print Management Console (part 1) - Enhancements to the Print Management Console in Windows 7
- Managing Printing : How Printing Works in Windows 7
- Taking Advantage of Volume Licensing : KMS and the Client (part 2)
- Taking Advantage of Volume Licensing : KMS and the Client (part 1) - Changing the Client License Type After Installation & Postponing Activation
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us
Popular tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 windows Phone 7 windows Phone 8
programming4us programming4us
 
programming4us
Natural Miscarriage
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Game Trailer