Ribbon tab for visio14 at visio document level rather than application level

Started by Aravind, August 27, 2009, 12:40:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Aravind

Can any one help me out to build a document level ribbon tab rather than an application level ribbon tab for Visio 2010?

JuneTheSecond

Hi,

I am quite a new about the ribbon, and now studying about the ribbon in Office 2007.
I've just learned that Office 2007 Excel, Word, and Power Point support Office Open XML, and that I can add ribbon in the document level by adding customUI.xml.
I think I can add the ribbon in a document level, if also the Visio supports Office Open XLM.
Is it true?
Best Regards,

Junichi Yoda
http://june.minibird.jp/

Aravind

I'm proceeding with the VSTO ribbon designer rather than the custom ribbon XML. It will be great if anyone helps me to proceed with ribbon designer.

JuneTheSecond

Hi,

As far as I know, VSTO in Visual Studio 2008 supports only Office 2007, but does not support 2010.
But ribbon made by the ribbon designer can be exported to the XML file.
For detail, please refer to the document here.
"How to: Export a Ribbon from the Ribbon Designer to Ribbon XML "
http://msdn.microsoft.com/en-us/library/bb386297.aspx

So far, only available is the Shared Add-ins in the category of Extendibility.
It is explained here in step by step manner at the "Using COM Add-ins to modify the Fluent UI".
But you need to read "Word 2007" as "Visio 2010", replacing Word into Visio and 2007 to 2010.
And you need to modify some lines in the example code to write text just to meet the Visio specification but not Word.
"Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)"
You need to fine the sub title "Using COM Add-ins to modify the Fluent UI"
http://msdn.microsoft.com/en-us/aa338202.aspx#OfficeCustomizingRibbonUIforDevelopers_UsingCOMAddIns

You can add custom ribbon to Visio 2010 in an application level but not in a document level.

Best Regards,

Junichi Yoda
http://june.minibird.jp/

Aravind

But still my requirement will be met only if my ribbon tab is at document level rather than application level :'(. I'm using check boxes in my ribbon tab, on opening new document they are getting reset. so please help me in building a document level tab rather than application level tab.

JuneTheSecond

Hi,

As far as I know, there is no way to add ribbon in a document level in the current Visio 2010 Technical Preview.
Best Regards,

Junichi Yoda
http://june.minibird.jp/

Paul Herber

Not being able to modify the UI at the document level would be a bit of a disaster.
Can the ribbon UI cope with more that one addon trying to modify the UI at the same time i.e one standard addon and a startup addon?
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Aravind

No its possible. The in built add ons are creating the tabs at document level only. for example check Database model diagram. They are having the database tab at the document level only. so its possible but i don't know how ??? Anyone please help me out.

JuneTheSecond

Hi,

I think they are not ribbons, but legacy commandbar controls.
Please, open Option dialog by right clicking the menu "Customize Ribbon".
You would see "Add-ins" tab.
The commandbar controls of existing legacy add-ins are shown in "Add-ins" tab.
Here is a document about legacy add-ins.
"Extend The 2007 Office System With Your Own Ribbon Tabs And Controls"
And find sub title "Support for Existing Add-Ins".
http://msdn.microsoft.com/en-us/magazine/cc163469.aspx

But I don't know how to rename the tab name into "Database" or "UML".
Here is another question about ribbon.
Best Regards,

Junichi Yoda
http://june.minibird.jp/

Nikolay

After doing some investigations about Ribbon recently,
I decided that it might be good idea to share some results of these "investigations" with the community.
So I started a blog.

Please take a look, if this is helpful:
http://unmanagedvisio.blogspot.com/2009/08/making-visio-ribbon-document-dependent.html

Barry

Yes, document-specific RibbonX addons are possible in the Visio 2010 TR.  We haven't posted the documentation yet for the requisite API's, but that is forthcoming.  In a nutshell:

1) addon implements IRibbonExtensibility interface (as explained on MSDN)
2) addon calls Visio.Application.RegisterRibbonX() to register the interface.  RegisterRibbonX() takes two arguments -- a Visio document and a visRXMode enum.  If NULL is passed for the document, the addon's RibbonX UI applies to all documents, otherwise it applies to the specified document.  The visRXMode enum allows the addon to be further narrowed to a specific window type or mode (e.g. Drawing, Stencil, Print Preview, etc.)
3) upon shutdown of the addon, addon calls Visio.Application.UnregisterRibbonX() to detach the addon UI from Visio.  Note this must be done early enough in the shutdown sequence so that the application and document objects are still available.

FWIW, all of the Microsoft-authored Visio addon UI is implemented in this manner.  Org Charts, Database modeling, etc are a couple examples.

If your RibbonX does not require addon code and simply shuffles the UI around, you can attach the RibbonX XML to the document via the document.customui property and then save the file.   Upon load of the file, the Ribbon XML stored in this property will be realized in the UI.  If you're exploring the API changes via IntelliSense/Object browser/Reflection/etc, you will also notice the the existence of a 'usercustomui' property hanging off the document.  UserCustomUI is where the user's customizations are stored.  Users customize the ribbon via File | Visio Options.  And yes, all methods of Ribbon customization (RegisterRibbonX(), Document.CustomUI, Document.UserCustomUI) can be simultaneously employed to reconfigure the UI.

If you choose to use the RegisterRibbonX() API to register your addon ui, then you have the luxury of not needing to create a new COM Addin (like the rest of the Office Apps) and instead just need to implement the IRibbonExtensibility interface on top of your existing VSL.  Creating a COM Addin just to customize the Ribbon will result in an addon that is inherently not document-specific.  Sticking with a good old VSL is the only way to get a document-specific addon.

Hopefully this is enough to unblock you.


Barry


Nikolay

That's great! Thanks a lot.

Please can you be so kind and also clarify if there is something special about the context menus in new Visio?
I mean, for some reason I just can't add a custom context (right-click) menu using CommandBars in Visio 2010. It just does not work the way it did in 2007 and 2003 for some reason... :(
The menu items are added to the "Add-in commands" ribbon tab instead of the context menu... Why?!
How do I do that correctly?

Barry

Customization of context menus and the outspace are also done via ribbonx XML:

<customui>
      <ribbon>
      </ribbon>
     <contextmenus>
     </contextmenus>
     <outspace>
     </outspace>
</customui>

Here are a couple MSDN links that show sample XML:

context menu customization: http://msdn.microsoft.com/en-us/library/dd926324.aspx
outspace customization: http://msdn.microsoft.com/en-us/library/dd947358.aspx.

If I recall correctly, the shape context menu id is "MenuShape", the page context menu is "MenuPage", and the text context menu is "MenuText".  I'm away from the office, so I'll need to double-check this.

Also note that outspace customization doesn't work in the Visio 2010 TR.  This has been fixed for Beta2.

Barry


Aravind

Hi Barry,

Thanks but still I'm facing problem. I'm not getting the RegisterRibbonX() method at all. Can you explain me where this has to handled? Moreover when i'm trying to create ribbon designer
public partial class Ribbon1 : OfficeRibbon

I'm not seeing IRibbonExtensibility implemented. I'm sure that you can help out in explaining me out where I'm getting out of track since I'm new to this office add-ons development. ::)