News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Customizing the Ribbon in Visio 2010

Started by Nikolay, July 03, 2009, 08:38:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Nikolay

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.

aledlund

#1
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

aledlund


Nikolay


Nikolay

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

#5
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?
Best Regards,

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

Nikolay

Quote from: JuneTheSecond on August 04, 2009, 06: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?

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

Quote from: JuneTheSecond on August 04, 2009, 06:34:31 AM
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

#7
Thank you Nikolay,

Sample in Using RibbonX with C++ and ATL really adds Custom Ribbon.
I shall study this program more.
Best Regards,

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

Aravind

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

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 326 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1192KB.
Tokens: post-login.
Cache hits: 14: 0.00714s for 26,724 bytes (show)
Cache misses: 4: (show)
Queries used: 17.

[Show Queries]