Ejemplo n.º 1
0
        /// <summary>
        ///		Applies this menu to the given CommandBarControls.
        /// </summary>
        /// <param name="window">The window holding the controls.</param>
        /// <param name="controls">The control set to apply to.</param>
        protected void Apply(OfficeWindow window, CommandBarControls controls)
        {
            IList toadd = new ArrayList(this.controls);

            foreach (CommandBarControl control in controls)
            {
                if (control.Tag.StartsWith("UIManager_"))
                {
                    string         thetag   = control.Tag.Substring(0, control.Tag.IndexOf("#"));
                    ToolbarControl tcontrol = (ToolbarControl)controlMap[thetag];
                    if (tcontrol != null)
                    {
                        tcontrol.Apply(window, control);
                        OfficeUIManager.RegisterCommandBarControl(control, window, tcontrol);
                        toadd.Remove(tcontrol);
                    }
                }
            }
            foreach (ToolbarControl tcontrol in toadd)
            {
                object newpos = System.Reflection.Missing.Value;
                if (tcontrol.Before != null)
                {
                    int pos = 0;
                    foreach (CommandBarControl findcontrol in controls)
                    {
                        pos++;
                        if (findcontrol.Caption == tcontrol.Before)
                        {
                            newpos = pos;
                        }
                    }
                }
                CommandBarControl control = controls.Add(tcontrol.Type, 1, System.Reflection.Missing.Value, newpos, true);
                control.Tag      = tcontrol.InternalTag + "#" + NEXT_TAG;
                control.OnAction = "!<" + OfficeUIManager.AddinProgID + ">";
                NEXT_TAG++;
                tcontrol.Apply(window, control);
                OfficeUIManager.RegisterCommandBarControl(control, window, tcontrol);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 ///		Creates a new set of toolbars.
 /// </summary>
 /// <param name="manager">The UI manager that owns the object.</param>
 internal Toolbars(OfficeUIManager manager)
 {
     this.manager = manager;
     toolbars     = new Hashtable();
 }