|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Accessibility;
namespace Office2007UIModel
{
public class MSWordWindow : OfficeUIItem
{
OfficeRibbon _ribbon = null;
OfficeRibbonPropertyPage _propertyPage = null;
public Dictionary<string, OfficeToolBar> ToolBars
{
get { return _propertyPage.ToolBars; }
}
public MSWordWindow(string name)
: base(name)
{
if (this.Accessible == default(IAccessible))
{
throw new Exception("MS Word window not found with the name : " + name);
}
_ribbon = new OfficeRibbon(Accessible, "Ribbon", true);
if (_ribbon.Accessible == default(IAccessible))
{
throw new Exception("Ribbon not found.");
}
}
public MSWordWindow(OfficeAppType appType, string caption)
: base(GetClassName(appType), caption)
{
}
public void SelectTab(string name)
{
if (!_ribbon.Tabs.ContainsKey(name))
{
//Just give one more try
_ribbon.ReloadTabs();
if (!_ribbon.Tabs.ContainsKey(name))
{
throw new Exception(name + " Ribbon Tab not found.");
}
}
if (_ribbon.Tabs[name].Invoke())
{
_propertyPage = new OfficeRibbonPropertyPage(_ribbon.Accessible, name,
MSAALayer.AccessibleUIItemType.PropertyPage, true);
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.