Author Topic: Customizing the Ribbon in Visio 2010  (Read 18189 times)

0 Members and 1 Guest are viewing this topic.

Nikolay

  • Hero Member
  • *****
  • Posts: 1307
    • UnmanagedVisio
Customizing the Ribbon in Visio 2010
« on: July 03, 2009, 03:38:15 AM »
It turns out that our add-in's old user interface (toolbar, menus) looks painfully lame with new Visio 2010 ribbon :)
So it seems we have to re-do it using that "fist-sized-buttons" (c) technology.

Is there API for programming Visio ribbon?
Do I understand correctly that this is the very same ribbon other office applications use and it can be programmed the same way?
Can someone give some links to articles about that?

And another question.
Will native x86 DLL COM add-ins still be supported (somehow? somehow?) with Visio 2010 x64 edition?? Will -x86 "VSL" be supported in -x64 edition?
Or there are no miracles in this world, and one has to port native code to x64?

Thanks in advance, Nikolay.
« Last Edit: July 16, 2009, 04:49:08 PM by Visio Guy »

aledlund

  • Hero Member
  • *****
  • Posts: 1412
Re: Customizing the Ribbon in Visio 2010
« Reply #1 on: July 03, 2009, 12:24:50 PM »
The biggest problem I had in porting to x64 was poor attention on my part. It turns out that I should have been watching - type long in x32 is 16bits, long in x64 is 32bits...

If your add-in calls outside to 'standard' windows functions they may have been renamed (the sysWOW64 exposure), assuming that MS carried your function forward (which means there are two versions).

Mixed libraries play a part (if your user are 32bit etc...). Right now, since v2007 is 32bit on my 64bit system, coding for 'anyCPU' will fail...

I'm curious -
Whether I can have both versions (simultaneously) on my system, the 32 and 64 bit versions.
I'd like more data on the VisioServer that was announced
Will the client release that is coming shortly, also make the host stuff available?
How about embedded xaml/silverlight support, since XPS is now standard on Win7/srv2008R2

and the saga goes one,

al
« Last Edit: July 16, 2009, 04:49:23 PM by Visio Guy »

aledlund

  • Hero Member
  • *****
  • Posts: 1412
« Last Edit: July 16, 2009, 04:49:47 PM by Visio Guy »

Nikolay

  • Hero Member
  • *****
  • Posts: 1307
    • UnmanagedVisio
« Last Edit: July 16, 2009, 04:49:34 PM by Visio Guy »

Nikolay

  • Hero Member
  • *****
  • Posts: 1307
    • UnmanagedVisio
Re: Customizing the Ribbon in Visio 2010
« Reply #4 on: August 02, 2009, 01:58:18 AM »
Today finally I got my hands on Visio 2010 ribbon.

It really works! IMO, the ribbon is awesome from the developer's point of view (and hopefully from user's point of view too) - it seems to include "everything I ever wanted" from the user interface as a developer. The above articles do work with Visio just fine; i.e. one can use these as a reference to work with Visio ribbon as well. It just works!

Though, I've got some issues.

I haven't figured out how to do the shape context menu customization. It seems that the "old" techniques for accessing the context menu like (commandbars) - CommandBars("Drawing Object Selected") or (uiobjects) ItemAtID(visUIObjSetCntx_DrawObjSel) ceased to function (?!). Instead, they do something weird "on my computer" - they add a top-level menu to the tab "Add-ins" (?!) As if the "Drawing Object Selected" is not recognized as a special command bar name anymore (?!). Or probably I have messed up somehow... Anyways, unfortunately I was unable to change the shape context menu in new Visio. No luck.

I needed to customize the context menu to make a hierarchical shape-dependent context menu. Fortunately enough, Visio 2010 seems to (finally!!!)  include the "natural" support for the hierarchical shape context menus in the shape-sheet (via new column "FlyoutChild" in "Actions" row).
Viva la visio developers!

Second, I've got a question - do I understand correctly, that from now on Visio shall support the Custom Task Panes, like all other "ribboned" office applications do? Am I missing something? My CTPFactoryAvailable is just not called! Or do I expect too much? :D

All other things I needed can be done in "no time" -
- Creating ribbon buttons
- Creating ribbon menus
- Setting custom images for menus/buttons
- Enabling/disabling controls at runtime

Definitely, this ribbon opens a new horizon for user interface customization! Now Visio UI customization became really flexi'ble (c) :D - Now one can use three (!!!) mutually exclusive approaches for that - UIObjects, CommandBars, and the Ribbon. I just wonder how many customization approaches will Visio 2020 have? :D

BTW, one can visually design a custom Ribbon using Visual Studio ("Visual Studio Tools For Office" have a special designer for that). Though AFAIU it is intended to be used for the "tools-for-office"-based add-ins, the raw ribbon xml description can be easily generated (using "Export to xml" command) and this XML can be used for any type of add-in, not only for the "tools-for-office" addin. I was particularly interested in the native code - it works just fine.

Kind regards, Nikolay

JuneTheSecond

  • Hero Member
  • *****
  • Posts: 1027
    • Visio Shapes, Stencils and Sample Drawings
Re: Customizing the Ribbon in Visio 2010
« Reply #5 on: August 04, 2009, 01:34:31 AM »
Here is an "Adding a Ribbon to Visio" to Visio2007.
http://www.visguy.com/2007/08/27/interesting-blog-with-cool-visio-topics/
It works on Visio2010 preview well.
Source code is available, but this code is too difficult for me to
understand how it works.
Is it really a ribbon?

Visio 2010 preview has import/export button for
only user customized ribbon.
The exported file is like a xml file. You can customize this file.
But I could not find the way to automate to import and export.
Is there any way?
« Last Edit: August 04, 2009, 07:04:41 PM by JuneTheSecond »
Best Regards,

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

Nikolay

  • Hero Member
  • *****
  • Posts: 1307
    • UnmanagedVisio
Re: Customizing the Ribbon in Visio 2010
« Reply #6 on: August 08, 2009, 07:06:27 AM »
Here is an "Adding a Ribbon to Visio" to Visio2007.
http://www.visguy.com/2007/08/27/interesting-blog-with-cool-visio-topics/
It works on Visio2010 preview well. Source code is available, but this code is too difficult for me to understand how it works.
Is it really a ribbon?

No, it's not a ribbon, but kind of ribbon emulation, but it works with Visio 2007 (that does not have Ribbon at all).

Visio 2010 preview has import/export button for only user customized ribbon.The exported file is like a xml file. You can customize this file.
But I could not find the way to automate to import and export.
Is there any way?

I was basically interested in a solution to customize Visio ribbon from an add-in (add my custom tab that contains my controls). So, I figured out (from the above 3 msdn articles) that to do that, one just needs to implement the interface IRibbonExtensibility in the add-in. This interface has only one method - GetCustomUI, and one shall just return the XML for the custom part of the ribbon from this method. That's it.

Anyways, if anyone is interested, I could post an article/code about that... either unmanaged (ATL/C++) or managed (.NET) variant...
I don't think it is possible to do ribbon customization now using the ("old") VSTO for Visio12... though I might be wrong of course :)

Kind regards, Nikolay

JuneTheSecond

  • Hero Member
  • *****
  • Posts: 1027
    • Visio Shapes, Stencils and Sample Drawings
Re: Customizing the Ribbon in Visio 2010
« Reply #7 on: August 10, 2009, 12:41:10 AM »
Thank you Nikolay,

Sample in Using RibbonX with C++ and ATL really adds Custom Ribbon.
I shall study this program more.
« Last Edit: August 10, 2009, 12:48:00 AM by JuneTheSecond »
Best Regards,

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

Aravind

  • Newbie
  • *
  • Posts: 9
Re: Customizing the Ribbon in Visio 2010
« Reply #8 on: August 27, 2009, 12:36:25 AM »
Can any one help me out to build a document level ribbon tab rather than an application level ribbon tab for Visio 2010?
« Last Edit: August 27, 2009, 07:29:24 AM by Aravind »