Exemplo n.º 1
0
 //public PPTPaneManager() : this(DEFAULT_MODES) { }
 public PPTPaneManager(PPTLibrary.PPT ppt)
     : this(DEFAULT_MODES, ppt)
 {
 }
Exemplo n.º 2
0
        //public PPTPaneManager(string[] modes) : this(modes, new PPTLibrary.PPT()) { }
        public PPTPaneManager(string[] modes, PPTLibrary.PPT ppt)
        {
            if (modes == null)
                modes = DEFAULT_MODES;

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

            this.myPPT = ppt;

            // 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;

            // 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);
        }
Exemplo n.º 3
0
		public const int PPT_SAVE_AS_ID = 748; // Determined by experimentation; should hold regardless of language.

		/// <summary>
		/// Creates the PPT automation component which handles exporting CSD decks from PPT.
		/// </summary>
		/// <param name="ppt">non-null ppt library accessor</param>
		/// <param name="paneManager">pane manager or null if no pane management is to be used</param>
		public PPTDeckBuilder(PPTLibrary.PPT ppt, PPTPaneManagement.PPTPaneManager paneManager)
#endif
		{
			if (ppt == null) throw new ArgumentNullException("ppt");

			// Hook up to arguments.
			this.myPPT = ppt;

			// Prepare the loader.
			this.myLoader = new PPTSlideLoader(DEFAULT_SIZE, DEFAULT_COMMENT_TYPE, this.myPPT, paneManager
#if SIP_MODE
				, propertyManager
#endif
				);

			// Find the menubar. 
			Core.CommandBar menu = null;
			foreach (Core.CommandBar cb in this.myPPT.App.CommandBars)
				if (cb.Id == PPT_MENU_BAR_ID)
				{
					menu = cb;
					break;
				}
			if (menu == null) 
				throw new Exception("PPTDeckBuilderAddin: Unable to find the PowerPoint menu bar.");

			// Find the file menu.
			Core.CommandBarPopup fileMenu = null;
			foreach (Core.CommandBarControl bar in menu.Controls)
				if (bar.Id == PPT_FILE_ID)
				{
					fileMenu = (Core.CommandBarPopup)bar;
					break;
				}
			if (fileMenu == null) 
				throw new Exception("PPTDeckBuilderAddin: Unable to find the PowerPoint file menu.");

			// Find the Save As.. button.
			// And see if the export to CSD button is already there.
			Core.CommandBarControl saveAs = null;
			foreach (Core.CommandBarControl control in fileMenu.Controls)
			{
				if (control.Id == PPT_SAVE_AS_ID)
					saveAs = control;
				if (control.Caption == "&Export to CSD...")
					control.Delete(false); // Delete permanently.
				if (control.Caption == "Load &Feedback Menu...")
					control.Delete(false);
			}

			// Add and configure the export to CSD button...
			this.myExportButton = (Core.CommandBarButton)fileMenu.Controls.Add(
				Core.MsoControlType.msoControlButton, 
				System.Reflection.Missing.Value,                // Not a built in button: no ID.
				System.Reflection.Missing.Value,                // No parameters used.
				(saveAs == null) ? (object)System.Reflection.Missing.Value : (object)(saveAs.Index + 1), // Place just after Save As... if possible.
				true);                                          // Temporary (disappear on closing PPT).
			this.myExportButton.Caption = "&Export to CSD...";
			this.myExportButton.DescriptionText = "Export the current presentation to the Conferencing Slide Deck format.";
			this.myExportButton.TooltipText = this.myExportButton.DescriptionText;
			this.myExportButton.Click += new Core._CommandBarButtonEvents_ClickEventHandler(this.HandleCSDButtonClick);
			this.myExportButton.Visible = true;
			this.ConfigureButton();

			// Add and configure the load feedback menu button...
			this.myFeedbackButton = (Core.CommandBarButton)fileMenu.Controls.Add(
				Core.MsoControlType.msoControlButton, 
				System.Reflection.Missing.Value,                // Not a built in button: no ID.
				System.Reflection.Missing.Value,                // No parameters used.
				(object)(this.myExportButton.Index + 1), // Place just after Export to CSD
				true);                                          // Temporary (disappear on closing PPT).
			this.myFeedbackButton.Caption = "Load &Feedback Menu...";
			this.myFeedbackButton.DescriptionText = "Load a feedback menu to associate with this deck.";
			this.myFeedbackButton.TooltipText = this.myFeedbackButton.DescriptionText;
			this.myFeedbackButton.Click += new Core._CommandBarButtonEvents_ClickEventHandler(this.HandleFeedbackButtonClick);
			this.myFeedbackButton.Visible = true;
			this.ConfigureButton();

			// Hook up to events to enable/disable the export button.
			this.myPPT.App.PresentationClose += new PowerPoint.EApplication_PresentationCloseEventHandler(this.HandlePresentation);
			this.myPPT.App.PresentationOpen += new PowerPoint.EApplication_PresentationOpenEventHandler(this.HandlePresentation);
			this.myPPT.App.WindowActivate += new PowerPoint.EApplication_WindowActivateEventHandler(this.HandleWindow);
			this.myPPT.App.WindowDeactivate += new PowerPoint.EApplication_WindowDeactivateEventHandler(this.HandleWindow);
		}
Exemplo n.º 4
0
		/// <summary>
		/// Creates the PPT automation component which handles exporting CSD decks from PPT.
		/// </summary>
		/// <param name="ppt">non-null ppt library accessor</param>
		/// <param name="paneManager">pane manager or null if no pane management is to be used</param>
		/// <param name="propertyManager">widget property manager or null if the builder should assume no widgets exist</param>
		public PPTDeckBuilder(PPTLibrary.PPT ppt, PPTPaneManagement.PPTPaneManager paneManager,
			PPTPropertyManagement.PPTPropertyManager propertyManager)
Exemplo n.º 5
0
		/// <param name="ppt">non-null ppt library accessor</param>
		/// <param name="paneManager">pane manager or null if no pane management is to be used</param>
		public PPTSlideLoader(Size viewerSize, int commentMenuType, PPTLibrary.PPT ppt, PPTPaneManagement.PPTPaneManager paneManager) 
#endif
		{
			if (ppt == null) throw new ArgumentNullException("ppt");

			this.myPPT = ppt;
			this.myPaneManager = paneManager;
#if SIP_MODE
			this.myPropertyManager = propertyManager;
#endif

			this.myViewerSize = viewerSize;
			this.myDefaultCommentMenuType = commentMenuType;

			this.myFilesLoaded = 0;

			this.myTemporaryDirectoryPath =  Path.GetTempPath() + "\\DeckBuilderTempFiles";
			try 
			{
				if (Directory.Exists(this.myTemporaryDirectoryPath))
					Directory.Delete(this.myTemporaryDirectoryPath, true);		// Delete directory to clean up old files
				Directory.CreateDirectory(this.myTemporaryDirectoryPath);

			}
			catch (IOException e)
			{
				Console.WriteLine(e.Message);
			}

		}
Exemplo n.º 6
0
		/// <param name="ppt">non-null ppt library accessor</param>
		/// <param name="paneManager">pane manager or null if no pane management is to be used</param>
		/// <param name="propertyManager">widget property manager or null if the loader should assume no widgets exist</param>
		public PPTSlideLoader(Size viewerSize, int commentMenuType, PPTLibrary.PPT ppt, 
			PPTPaneManager paneManager, PPTPropertyManager propertyManager) 
Exemplo n.º 7
0
 //public PPTPaneManager() : this(DEFAULT_MODES) { }
 public PPTPaneManager(PPTLibrary.PPT ppt, InstructorModeRibbon r)
     : this(DEFAULT_MODES, ppt, r)
 {
 }