470 likes | 590 Views
CD303 - The 2007 Microsoft Office System: Developer Model for the New User Interface. Savraj Dhanjal Program Manager Microsoft Corporation. Alex Mogilevsky Architect Microsoft Corporation. The New User Interface. Access, Excel, Outlook, PowerPoint, Word. Ribbon Extensibility - “RibbonX”.
E N D
CD303 - The 2007 Microsoft Office System: Developer Model for the New User Interface Savraj Dhanjal Program Manager Microsoft Corporation Alex Mogilevsky Architect Microsoft Corporation
The New User Interface • Access, Excel, Outlook, PowerPoint, Word
Ribbon Extensibility - “RibbonX” • Developers can modify the Ribbon • For example: remove tabs, add a tab, add a group
Agenda • Existing solutions • RibbonX Details • Demos • Migrating existing solutions • Conclusion • Questions
Agenda • Existing solutions • RibbonX Details • Demos • Migrating existing solutions • Conclusion • Questions
Existing Solutions • XLM • WordBasic • CommandBars (‘96) • WLL, XLL • XLA, PPA, Word global templates • In Excel, “Init Menus” registry key • Attached Toolbars in Word & Excel • Other technologies… • And it all still works!
Existing Solutions Custom Buttons on Formatting Toolbar Custom Menu Custom Toolbars
Agenda • Existing solutions • RibbonX Details • Demos • Migrating existing solutions • Conclusion • Questions
Before Office 2007… Inconsistency across applications Office 2000 VBA Programmers Guide, MS Press, 1999
Before Office 2007… • Hard to build well-behaved add-ins • Hard to reference built-in controls, images • Hard to localize • Nearly impossible to make add-in customizable by end users • Easy to have add-in conflicts • Result: UI deteriorates over time
Excel, after you open a few hundred workbooks with attached toolbars…
RibbonX… • Is a consistent, XML-based developer model for Office UI • Produces well-behaved solutions by default • Exposes new control types • Targets specific developer scenarios
Add your own tabs Add to built-in tabs Add to the Office Menu Add to built-in contextual tabs Remove tabs, groups, controls RibbonXBasics
Tabs Groups Buttons Menus SplitButtons ToggleButtons Labels CheckBoxes RibbonXControls
EditBoxes DialogBoxLaunchers DropDowns ComboBoxes Galleries RibbonX Controls Only five controls in Office 2003: msoControlButton, msoControlEdit, msoControlPopup, msoControlComboBox, msoControlDropdown
RibbonX Markup • Declarative XML • Easy to understand, localize, generate • Separates UI from your business logic • Gets applied to UI at add-in or document load <tab idMso=“TabWrite”> <group id=“myGroup” label=“My Group”> <button id=“hw” label=“Hello World!” onAction=“myHelloFunc” /> </group> </tab>
RibbonX Entry Points • New File Format Documents (VBA solutions) • Include customUI markup as a part • COM Add-Ins (C#, C++, VB.NET, VB6) • Return customUI markup via IRibbonExtensibility interface • VSTO v3 Solutions • Same as COM • Wizard, generated code (connection, resources, images) • GUI editor (maybe – see CD308 for VSTO pans)
RibbonX Solution Space COM VBA VSTO (C#, VB.NET, VB6, C++) Installed at app-level Word: Global Template, Excel (.xlam) PPT (.ppam) contains customUI part VSTO v3 Write a VSTO v3 app-level solution App. Level Word, Excel, PPT New file format document contains customUI part Access: loadCustomUI method Installed at app-level, displays UI based on doc properties VSTO v3 Write a VSTO v3 doc-based solution Doc. Level
RibbonX Schema • ribbon, tab, group, box • Containers • “Find or create” model • id, idMso • Define a custom id, refer to built-in id • insertAfterMso, insertBeforeMso • Insert in relation to built-in control • image, imageMso • Define your own image, refer to a built-in image • getImage, onAction, getEnabled, getVisible • Some of the available callbacks
Hello World Document Alex MogilevskyArchitect Microsoft Corporation
Features Targeting Developers • StartFromScratch • Global repurposing • Referencing built-in controls and images <ribbon startFromScratch=“true”> <!– hides the main tabs --> <command idMso=“Save” onAction=“runMyCode” /> <!- takes over the built-in save action --> <button id=“x” imageMso=“Save” label=“Imposter!” /> <!- “steals” the image of the Save button -->
Dynamic Update of Controls • XML is the only way to add controls • No API to add new controls at arbitrary time • State and properties are dynamic, via callbacks • getVisible, getLabel, getImage… • Galleries, dynamicMenus • Can be dynamically populated with controls • The “pull” model
“Pull” Model • Questions you’ll never ask again • When is it OK to add UI? Remove? • In how many documents, windows? • Will I be called on uninstall to clean up? • Is there other code changing the same UI? • Can the user remove controls I want to change? • Can the user move or copy my controls? • No “housekeeping” code • No need to make adjustments at open, close, install, uninstall (unlike CommandBars)
Status Bar Mini Toolbar Add/Remove inside built-in groups Custom group scaling Right-click (context) menus However, Existing right-click customizations work Global repurposing works for all controls Outside Scope Of RibbonX
Agenda • Existing solutions • RibbonX Details • Demos • Migrating existing solutions • Conclusion • Questions
Custom Group, Tab, & Gallery Alex MogilevskyArchitect Microsoft Corporation
Custom Office Menu Item Alex MogilevskyArchitect Microsoft Corporation
Dynamic Update via Invalidate Call InvalidateorInvalidateControl When Office updates the Ribbon, it will ask your code again for dynamic properties Markup: <button id=“MyButton” label=“My First Button” getImage=“myButtonImage” /> C#: Ribbon.InvalidateControl(“MyButton”); Office queries your callback functions again.
Invalidate Alex MogilevskyArchitect Microsoft Corporation
Repurposing, Start From Scratch Alex MogilevskyArchitect Microsoft Corporation
End-User Customization Alex MogilevskyArchitect Microsoft Corporation
Two Excel Workbooks Alex MogilevskyArchitect Microsoft Corporation
Outlook, Access Alex MogilevskyArchitect Microsoft Corporation
Agenda • Existing solutions • RibbonX • Migrating existing solutions • Deployment • Conclusion • Questions
Migrating a Solution • Spectrum of Possibilities None Don’t change your code whatsoever. Your added buttons appear on the add-ins tab. Simple Find the right place and the right control types for your UI in the new Ribbon. Just move them to the right place. Full Rethink your UI based on the new paradigms, perhaps using gallery controls and a reorganization of your commands.
Simple Migration • In Office 2003, your code added items to the tools menu.
Agenda • Existing solutions • RibbonX Details • Demos • Migrating existing solutions • Conclusion • Questions
Conclusion… • Existing solutions still work • New model is XML-based, easier to build great add-ins • Optimized for common scenarios • Consistent across applications • You can spend your time building solutions, instead of worrying about the UI!
Known Changes at Beta 2 TR • <fileMenu> tag will be <officeMenu> • <advanced> tag will be <dialogBoxLauncher> in B2TR • Built-in control IDs will be significantly updated in B2TR
Resources • Office Developer Center • http://msdn.microsoft.com/office/ • Ribbon Developer Center • http://msdn.microsoft.com/office/tool/ribbon • UI Blog • http://blogs.msdn.com/jensenh/ see the developer section (Thursdays)
© 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.