Пример #1
0
        //public PPTPaneManager(string[] modes) : this(modes, new PPTLibrary.PPT()) { }

        public PPTPaneManager(string[] modes, PPTLibrary.PPT ppt, InstructorModeRibbon r)
        {
            if (modes == null)
            {
                modes = DEFAULT_MODES;
            }

            if (ppt == null)
            {
                throw new ArgumentNullException("ppt");
            }

            this.myPPT = ppt;

            this.ribbon = r;

            // Set up the list of modes; should match the ordering of the buttons in the mode button bars.
            this.myModes = new string[modes.Length + 1];
            System.Array.Copy(modes, 0, this.myModes, 1, modes.Length);
            this.myModes[0] = DEFAULT_MODE;

            this.ribbon.PresentationModeChanged += new ChangedEventHandler(this.HandlePresentationModeClick);
            this.ribbon.ShapeModeChanged        += new ChangedEventHandler(this.HandleShapeModeClick);

/*			DONE CMPRINCE: Add the appropriate code here to hook up to the button events
 *          // Set up the bars.
 *                      this.myPresentationModeBar = this.myPPT.AddCommandBar(PRESENTATION_MODEBAR_NAME,
 *                              Core.MsoBarPosition.msoBarTop, true, true);
 *                      this.myShapeModeBar = this.myPPT.AddCommandBar(SHAPE_MODEBAR_NAME,
 *                              Core.MsoBarPosition.msoBarTop, true, true);
 *
 *                      // Add the "base" buttons
 *                      Core.CommandBarButton button = (Core.CommandBarButton)
 *                              this.myPPT.AddControl(this.myPresentationModeBar, Core.MsoControlType.msoControlButton, "Projected View");
 *                      button.Click += new Core._CommandBarButtonEvents_ClickEventHandler(this.HandlePresentationModeClick);
 *                      button.TooltipText = "Switch to base mode in which only unrestricted objects are visible.";
 *                      button.Style = Core.MsoButtonStyle.msoButtonWrapCaption;
 *
 *                      button = (Core.CommandBarButton)
 *                              this.myPPT.AddControl(this.myShapeModeBar, Core.MsoControlType.msoControlButton, "Unrestricted");
 *                      button.Click += new Core._CommandBarButtonEvents_ClickEventHandler(this.HandleShapeModeClick);
 *                      button.TooltipText = "Set shape(s) to be unrestricted, making them visible in all modes.";
 *                      button.Style = Core.MsoButtonStyle.msoButtonWrapCaption;
 *
 *                      foreach (string mode in modes) {
 *                              button = (Core.CommandBarButton)
 *                                      this.myPPT.AddControl(this.myPresentationModeBar, Core.MsoControlType.msoControlButton, mode + " View");
 *                              button.Click += new Core._CommandBarButtonEvents_ClickEventHandler(this.HandlePresentationModeClick);
 *                              button.TooltipText = "Toggle '" + mode + " View'.\nOnly unrestricted objects and objects restricted to '" + mode + " View' are visible in '" + mode + " View'.";
 *                              button.Style = Core.MsoButtonStyle.msoButtonWrapCaption;
 *
 *                              button = (Core.CommandBarButton)
 *                                      this.myPPT.AddControl(this.myShapeModeBar, Core.MsoControlType.msoControlButton, mode + " Note");
 *                              button.Click += new Core._CommandBarButtonEvents_ClickEventHandler(this.HandleShapeModeClick);
 *                              button.TooltipText = "Toggle restriction of shape(s) to '" + mode + "' mode.\nUnrestricted objects are visible in all modes.\nRestricted objects are visible only in the modes to which they are restricted.";
 *                              button.Style = Core.MsoButtonStyle.msoButtonWrapCaption;
 *                      }
 */
            // Hook to relevant PPT events.
            this.myPPT.App.WindowActivate        += new PowerPoint.EApplication_WindowActivateEventHandler(this.HandleWindowActivate);
            this.myPPT.App.WindowDeactivate      += new PowerPoint.EApplication_WindowDeactivateEventHandler(this.HandleWindowDeactivate);
            this.myPPT.App.WindowSelectionChange += new PowerPoint.EApplication_WindowSelectionChangeEventHandler(this.HandleWindowSelectionChange);
            // New presentation event doesn't seem to be working in pre-SP2 (or possibly SP1).
            this.myPPT.App.AfterNewPresentation  += new PowerPoint.EApplication_AfterNewPresentationEventHandler(this.HandleAfterNewPresentation);
            this.myPPT.App.PresentationSave      += new PowerPoint.EApplication_PresentationSaveEventHandler(this.HandlePresentationSave);
            this.myPPT.App.AfterPresentationOpen += new PowerPoint.EApplication_AfterPresentationOpenEventHandler(this.HandleAfterPresentationOpen);
            this.myPPT.App.PresentationNewSlide  += new PowerPoint.EApplication_PresentationNewSlideEventHandler(this.HandlePresentationNewSlide);

            this.ConfigurePresentationModeBar();
            this.ConfigureShapeModeBar();

            foreach (PowerPoint.Presentation presentation in this.myPPT.App.Presentations)
            {
                this.RebuildCache(presentation);
            }
        }
Пример #2
0
 //public PPTPaneManager() : this(DEFAULT_MODES) { }
 public PPTPaneManager(PPTLibrary.PPT ppt, InstructorModeRibbon r) : this(DEFAULT_MODES, ppt, r)
 {
 }