示例#1
0
 internal PaneWrapper(object _window, ViewModelBase _vm, Tools.CustomTaskPane _pane, int _id = 0)
 {
     Window    = _window;
     ViewModel = _vm;
     Pane      = _pane;
     Id        = _id;
 }
示例#2
0
        private void UpdateWikiExplorerButtonState()
        {
            XWikiNavigationPane activePane = XWikiTaskPane;

            Tools.CustomTaskPane ctp = GetActiveWikiExplorer();
            Globals.Ribbons.XWikiRibbon.SetWikiExplorerButtonState(ctp.Visible);
        }
示例#3
0
        public void OnViewAction(Office.IRibbonControl control)
        {
            //Event handler for view contacts clicked
            try {
                IssueSelector     ie        = null;
                Outlook.Inspector inspector = (Outlook.Inspector)control.Context;
                if (Globals.ThisAddIn.InspectorWrappers.ContainsKey(inspector))
                {
                    InspectorWrapper     iw  = Globals.ThisAddIn.InspectorWrappers[inspector];
                    Tools.CustomTaskPane ctp = iw.CustomTaskPane;
                    if (ctp != null)
                    {
                        ie = (IssueSelector)ctp.Control;
                    }
                }
                switch (control.Id)
                {
                case "btnRef": if (ie != null)
                    {
                        ie.Refresh();
                    }
                    break;

                case "btnRefC": if (ie != null)
                    {
                        ie.RefreshCache();
                    }
                    break;
                }
            }
            catch (Exception ex) { App.ReportError(new ApplicationException("Unexpected error while handling View actions in the Issue Mgt ribbon extension.", ex), true, LogLevel.Error); }
            finally { this.mRibbonUI.Invalidate(); }
        }
示例#4
0
        public static MOT.CustomTaskPane GetTaskPane(Func <UserControl> taskPaneCreatorFunc, string taskPaneName, MOT.CustomTaskPaneCollection customTaskPanes, string Hwnd)
        {
            MOT.CustomTaskPane ctp = default(MOT.CustomTaskPane);

            //PLLog.Trace3("Enter", Common.LOG_CATEGORY);

            string key = string.Format("{0}({1})", taskPaneName, Hwnd);

            if (_CreatedPanes.ContainsKey(key))
            {
                // Return the existing TaskPane

                ctp = _CreatedPanes[key];
            }
            else
            {
                // Create a new TaskPane and add to the dictionary

                ctp = customTaskPanes.Add(taskPaneCreatorFunc(), taskPaneName);
                _CreatedPanes[key] = ctp;
                ctp.DockPosition   = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionRight;
                //ctp.Visible = true;
            }

            //PLLog.Trace3("Exit", System.Data.Common.LOG_CATEGORY);
            return(ctp);
        }
        private void Application_WorkbookActivate(Excel.Workbook Wb)
        {
            var wbCtp = ExcelCustomTaskPanes.Where(wb => wb.Key == Wb.FullName).FirstOrDefault().Value;

            if (wbCtp == null)
            {
                Globals.Ribbons.Ribbon1.toggleButton1.Checked = false;
                taskPaneValue = this.CustomTaskPanes.Add(new ExcelAddinTaskPane(),
                                                         "SQL Server For Excel", Wb.Windows[1]);
                taskPaneValue.VisibleChanged +=
                    new EventHandler(taskPaneValue_VisibleChanged);
                ExcelCustomTaskPanes.Add(Wb.FullName, taskPaneValue);
            }
            else
            {
                taskPaneValue = wbCtp;
                if (taskPaneValue.Visible)
                {
                    Globals.Ribbons.Ribbon1.toggleButton1.Checked = true;
                }
                else
                {
                    Globals.Ribbons.Ribbon1.toggleButton1.Checked = false;
                }
            }
        }
示例#6
0
        private Outlook.Inspector m_Window; // wrapped window object

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Create a new instance of the tracking class for a particular 
        /// inspector and custom task pane.
        /// </summary>
        /// <param name="inspector">A new inspector window to track</param>
        ///<remarks></remarks>
        public OutlookInspector(Outlook.Inspector inspector)
        {
            m_Window = inspector;

            // Hookup the close event
            ((Outlook.InspectorEvents_Event)inspector).Close +=
                new Outlook.InspectorEvents_CloseEventHandler(
                OutlookInspectorWindow_Close);

            taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(
                new UserControl1(), "My task pane", m_Window);
            taskPane.Visible = true;
            //  taskPane.VisibleChanged += new EventHandler(TaskPane_VisibleChanged);

            // Hookup item-level events as needed
            // For example, the following code hooks up PropertyChange
            // event for a ContactItem
            //OutlookItem olItem = new OutlookItem(inspector.CurrentItem);
            //if(olItem.Class==Outlook.OlObjectClass.olContact)
            //{
            //    m_Contact = olItem.InnerObject as Outlook.ContactItem;
            //    m_Contact.PropertyChange +=
            //        new Outlook.ItemEvents_10_PropertyChangeEventHandler(
            //        m_Contact_PropertyChange);
            //}
        }
示例#7
0
        public static void RemoveTaskPane(MOT.CustomTaskPane taskPane, MOT.CustomTaskPaneCollection customTaskPanes)
        {
            //PLLog.Trace3("Enter", System.Data.Common.LOG_CATEGORY);

            customTaskPanes.Remove(taskPane);

            //PLLog.Trace3("Exit", System.Data.Common.LOG_CATEGORY);
        }
示例#8
0
 /// <summary>
 /// Shows or hides the active Wiki Explorer.
 /// </summary>
 /// <param name="newState">The new state of the pane. TRUE for visible, FALSE for hidden.</param>
 public void ToggleActiveTaskPane(bool newState)
 {
     Tools.CustomTaskPane ctp = GetActiveWikiExplorer();
     if (ctp != null)
     {
         ctp.Visible = newState;
     }
 }
示例#9
0
        internal void DisplaySignaturePane()
        {
            paneMode = PaneMode.SignatureDisplayPane;
            Word.Window window = this.Application.ActiveDocument.ActiveWindow;

            RemoveTaskPaneFromWindow(window);

            // Check for task pane in window
            Tools.CustomTaskPane docPane      = null;
            Tools.CustomTaskPane paneToRemove = null;
            foreach (Tools.CustomTaskPane pane in SAPOLDisplayPanes)
            {
                try
                {
                    if (pane.Window == window)
                    {
                        docPane = pane;
                        break;
                    }
                }
                catch (ArgumentNullException)
                {
                    // pane.Window is null, so document1 has been unloaded.
                    paneToRemove = pane;
                }
            }

            // Remove pane if necessary
            SAPOLDisplayPanes.Remove(paneToRemove);

            // Add task pane to doc
            if (docPane == null)
            {
                Tools.CustomTaskPane pane;
                //09/05/2017
                try
                {
                    this.Application.ActiveDocument.Unprotect("NEOPHYTE");
                }
                catch (Exception)
                {
                    //
                }
                //PopulateDocumentPath();
                PopulateSignatureFileds();
                SignatureDisplayPane userCtrl = new SignatureDisplayPane(documentEditProperties[this.Application.ActiveDocument.Name], logger);
                pane = this.CustomTaskPanes.Add(
                    userCtrl,
                    "Add Signature(s) to Document",
                    window);

                pane.Width = GetWidth();
                userCtrl.AdjustSize(pane.Height);
                SAPOLDisplayPanes.Add(pane);
                pane.Visible = true;
            }
        }
示例#10
0
 private void RemoveTaskPaneFromWindow()
 {
     Tools.CustomTaskPane docPane = GetPaneByName();
     // Remove document task pane
     if (docPane != null)
     {
         this.CustomTaskPanes.Remove(docPane);
         SAPOLDisplayPanes.Remove(docPane);
     }
 }
示例#11
0
 private void timerDisplayPane_VisibleChanged(object sender, EventArgs e)
 {
     // Get task pane and toggle visibility
     Tools.CustomTaskPane taskPane = (Tools.CustomTaskPane)sender;
     if (taskPane.Visible)
     {
         TimerDisplayPane timerControl = (TimerDisplayPane)taskPane.Control;
         timerControl.RefreshDisplay();
     }
 }
示例#12
0
 private void ThisAddIn_Startup(object sender, System.EventArgs e)
 {
     propertyResearchControl     = new PropertyResearchControl();
     propertyResearchCtp         = this.CustomTaskPanes.Add(propertyResearchControl, "Property Research Pane");
     propertyResearchCtp.Visible = true;
     propertyResearchCtp.Width   = 500;
     MainViewModel.ExcelWorkbook =
         Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveWorkbook);
     MainViewModel.ExcelWorksheet =
         Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveSheet);
 }
示例#13
0
 /// <summary>
 /// Removes all task pane instances that not longer have an existing window.
 /// </summary>
 private void RemoveOrphans()
 {
     for (int i = this.CustomTaskPanes.Count; i > 0; i--)
     {
         Tools.CustomTaskPane ctp = this.CustomTaskPanes[i - 1];
         if (ctp.Window == null)
         {
             this.CustomTaskPanes.Remove(ctp);
         }
     }
 }
示例#14
0
 /// <summary>
 /// Handles CustomTaskPane Visibility
 /// </summary>
 /// <param name="sender">Custom Task Pane</param>
 /// <param name="e">Event arguments</param>
 void OnCustomTaskPaneVisibleChanged(object sender, EventArgs e)
 {
     Microsoft.Office.Tools.CustomTaskPane custTaskPane = (Microsoft.Office.Tools.CustomTaskPane)sender;
     Globals.Ribbons.Ribbon.layerManagerButton.Checked = custTaskPane.Visible;
     if (Globals.Ribbons.Ribbon.layerManagerButton.Checked)
     {
     }
     else
     {
     }
 }
示例#15
0
 /*InternalLink Event to display InternalLink task pane
  * on the right side of the document*/
 private void Internal_Link(object sender, RibbonControlEventArgs e)
 {
     if (InternalLinkTaskPane.Count == 0)
     {
         Microsoft.Office.Tools.CustomTaskPane _taskpane = Globals.ThisAddIn.CustomTaskPanes.Add(new InternalLinkTaskPane(), "Internal Links");
         _taskpane.Width            = 500;
         _taskpane.Visible          = true;
         _taskpane.VisibleChanged  += new EventHandler(InternalTaskPane_VisibleChanged);
         InternalLinkTaskPane.Count = InternalLinkTaskPane.Count + 1;
     }
 }
示例#16
0
        private ConfigPane(Object inWin, Object inDoc, CustomTaskPaneCollection inCustomTaskPanes, string version)
        {
            const int OrigWidth = 363;

            logger.ConditionalDebug("ConfigPane");
            theWin               = inWin;
            theDoc               = inDoc;
            customTaskPanes      = inCustomTaskPanes;
            confContr            = new ConfigControl(inWin, inDoc, version);
            configTaskPane       = customTaskPanes.Add(confContr, ConfigBase.ColorizationName, theWin);
            configTaskPane.Width = ((int)(OrigWidth * confContr.ScaleFactor)) + 2;
        }
示例#17
0
 void InternalTaskPane_VisibleChanged(object sender, EventArgs e)
 {
     Microsoft.Office.Tools.CustomTaskPane ctpComment = (Microsoft.Office.Tools.CustomTaskPane)sender;
     // Microsoft.Office.Tools.CustomTaskPane
     if (ctpComment != null)
     {
         if (ctpComment.Visible == false)
         {
             InternalLinkTaskPane.Count = InternalLinkTaskPane.Count - 1;
         }
     }
 }
示例#18
0
        private void RemoveTaskPaneFromWindow(Word.Window Wn)
        {
            // Check for task pane in window
            Tools.CustomTaskPane docPane = GetPaneByWindow(Wn);

            // Remove document task pane
            if (docPane != null)
            {
                this.CustomTaskPanes.Remove(docPane);
                SAPOLDisplayPanes.Remove(docPane);
            }
        }
示例#19
0
 private Tools.CustomTaskPane GetPaneByWindow(Word.Window Wn)
 {
     Tools.CustomTaskPane docPane = null;
     foreach (Tools.CustomTaskPane pane in SAPOLDisplayPanes)
     {
         if (pane.Window == Wn)
         {
             docPane = pane;
             break;
         }
     }
     return(docPane);
 }
示例#20
0
 private Tools.CustomTaskPane GetPaneByName()
 {
     Tools.CustomTaskPane docPane = null;
     foreach (Tools.CustomTaskPane pane in SAPOLDisplayPanes)
     {
         if (pane.Control.Name == paneMode.ToString())
         {
             docPane = pane;
             break;
         }
     }
     return(docPane);
 }
示例#21
0
 /*Comments Event to display Comments task pane
  * on the right side of the document*/
 private void Comments_Click(object sender, RibbonControlEventArgs e)
 {
     // bool bln=Globals.ThisAddIn.CustomTaskPanes.Select<CommentsTaskPane>(x => x.Title.Contains("Comments & Meta Data"))
     if (CommentsTaskPane.Count == 0)
     {
         Microsoft.Office.Tools.CustomTaskPane _taskpane = Globals.ThisAddIn.CustomTaskPanes.Add(new CommentsTaskPane(), "Comments & Meta Data");
         _taskpane.Width = 500;
         object obj = _taskpane.Window;
         _taskpane.Visible         = true;
         _taskpane.VisibleChanged += new EventHandler(CommentsTaskPane_VisibleChanged);
         CommentsTaskPane.Count    = CommentsTaskPane.Count + 1;
     }
 }
示例#22
0
        //public static MOT.CustomTaskPane GetTaskPane(System.Windows.Forms.UserControl taskPane, string name, MOT.CustomTaskPaneCollection customTaskPanes, string Hwnd)
        //{
        //    MOT.CustomTaskPane ctp = default(MOT.CustomTaskPane);

        //    //PLLog.Trace3("Enter", Common.LOG_CATEGORY);

        //    string key = string.Format("{0}({1})", name, Hwnd);

        //    if (_CreatedPanes.ContainsKey(key))
        //    {
        //        ctp = _CreatedPanes[key];
        //    }
        //    else
        //    {
        //        ctp = customTaskPanes.Add(taskPane, name);
        //        ctp.DockPosition = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionRight;
        //        //ctp.Visible = true;
        //    }

        //    //PLLog.Trace3("Exit", System.Data.Common.LOG_CATEGORY);
        //    return ctp;
        //}

        public static MOT.CustomTaskPane AddTaskPane(System.Windows.Forms.UserControl taskPane, string name, MOT.CustomTaskPaneCollection customTaskPanes)
        {
            MOT.CustomTaskPane ctp = default(MOT.CustomTaskPane);

            //PLLog.Trace3("Enter", Common.LOG_CATEGORY);

            ctp = customTaskPanes.Add(taskPane, name);
            ctp.DockPosition = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionRight;
            ctp.Visible      = true;

            //PLLog.Trace3("Exit", System.Data.Common.LOG_CATEGORY);
            return(ctp);
        }
示例#23
0
        private void OnInspectorClose()
        {
            //Event handler for Inspector closing event
            if (this.mTaskPane != null)
            {
                Globals.ThisAddIn.CustomTaskPanes.Remove(this.mTaskPane);
            }
            this.mTaskPane = null;

            Globals.ThisAddIn.InspectorWrappers.Remove(this.mInspector);
            ((Outlook.InspectorEvents_Event) this.mInspector).Close -= new Outlook.InspectorEvents_CloseEventHandler(OnInspectorClose);
            this.mInspector = null;
        }
示例#24
0
        /// <summary>
        /// Adds a custom task pane to the addin's taskpanes collection.
        /// The task pane is assigned to the given document's active window.
        /// </summary>
        /// <param name="doc">The instance of the document.</param>
        private void AddTaskPane(Word.Document doc)
        {
            XWikiNavigationPane paneControl = new XWikiNavigationPane(this);

            if (GetWikiExplorer(doc) == null)
            {
                //attach a new Wiki Explorer to the document window.
                Tools.CustomTaskPane ctp = this.CustomTaskPanes.Add(paneControl, XWikiNavigationPane.TASK_PANE_TITLE,
                                                                    doc.ActiveWindow);
                this.XWikiTaskPane  = paneControl;
                ctp.Visible         = true;
                ctp.VisibleChanged += new EventHandler(wikiExplorer_VisibleChanged);
            }
        }
        public void reInitialisePresentation()
        {
            if (Globals.ThisAddIn.Application.ActivePresentation != null)
            {
                Globals.ThisAddIn.Application.ActivePresentation.Close();

                PowerPoint.Application pptApp = Globals.ThisAddIn.Application;
                PowerPoint.Presentation presentation = pptApp.Presentations.Add(Office.MsoTriState.msoTrue);

                PowerPoint.Slides slides = presentation.Slides;
                PowerPoint.Slide slide = slides.Add(1, PowerPoint.PpSlideLayout.ppLayoutCustom);

                presentation = Globals.ThisAddIn.Application.ActivePresentation;
            }
        }
示例#26
0
 void Application_WindowActivate(Excel.Workbook wb, Excel.Window Wn)
 {
     RemoveOrphanedTaskPanes();
     try
     {
         DocumentProperties prps;
         prps = (DocumentProperties)Globals.ThisAddIn.Application.ActiveWorkbook.CustomDocumentProperties;
         CustomTaskPane ctp = Globals.ThisAddIn.CustomTaskPanes.Where(x => x.Control.Name == prps["customTaskPaneName"].Value.ToString()).FirstOrDefault();
         if (ctp != null && Globals.Ribbons.Ribbon1.toggleButton1.Checked)
         {
             ctp.Visible = true;
         }
     }
     catch { }
 }
示例#27
0
 void Application_WindowActivate(Word.Document Doc, Word.Window Wn)
 {
     RemoveOrphanedTaskPanes();
     try
     {
         DocumentProperties prps;
         prps = (DocumentProperties)Globals.ThisAddIn.Application.ActiveDocument.CustomDocumentProperties;
         CustomTaskPane ctp = Globals.ThisAddIn.CustomTaskPanes.Where(x => x.Control.Name == prps["customTaskPaneName"].Value.ToString()).FirstOrDefault();
         if (ctp != null && Wn.Active == true)
         {
             ctp.Visible = true;
         }
     }
     catch { }
 }
示例#28
0
        //Interface
        public InspectorWrapper(Outlook.Inspector inspector)
        {
            //Constructor
            this.mInspector = inspector;
            ((Outlook.InspectorEvents_Event) this.mInspector).Close += new Outlook.InspectorEvents_CloseEventHandler(OnInspectorClose);

            IssueSelector issueSel = new IssueSelector();

            issueSel.IssueSelected        += new EventHandler(OnIssueCtlIssueSelected);
            issueSel.Error                += new ControlErrorEventHandler(OnIssueCtlError);
            this.mTaskPane                 = Globals.ThisAddIn.CustomTaskPanes.Add(issueSel, ThisAddIn.TASKPANE_TITLE, this.mInspector);
            this.mTaskPane.DockPosition    = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionLeft;
            this.mTaskPane.Visible         = false;
            this.mTaskPane.VisibleChanged += new EventHandler(OnTaskPaneVisibleChanged);
        }
示例#29
0
 private void RemoveOrphanedTaskPanes()
 {
     for (int i = Globals.ThisAddIn.CustomTaskPanes.Count; i > 0; i--)
     {
         CustomTaskPane ctp = Globals.ThisAddIn.CustomTaskPanes[i - 1];
         if (ctp.Window == null)
         {
             this.CustomTaskPanes.Remove(ctp);
         }
         try
         {
             ctp.Visible = false;
         }
         catch { }
     }
 }
示例#30
0
        internal void ToggleTaskPaneDisplay()
        {
            // Ensure window has task window
            AddTaskPaneToWindow(this.Application.ActiveDocument.ActiveWindow);

            // toggle document task pane
            Tools.CustomTaskPane docPane = null;
            foreach (Tools.CustomTaskPane pane in timerDisplayPanes)
            {
                if (pane.Window == this.Application.ActiveDocument.ActiveWindow)
                {
                    docPane = pane;
                    break;
                }
            }
            docPane.Visible = !docPane.Visible;
        }
示例#31
0
        private void RemoveTaskPaneFromWindow(Word.Window Wn)
        {
            // Check for task pane in window
            Tools.CustomTaskPane docPane = null;
            foreach (Tools.CustomTaskPane pane in timerDisplayPanes)
            {
                if (pane.Window == Wn)
                {
                    docPane = pane;
                    break;
                }
            }

            // Remove document task pane
            if (docPane != null)
            {
                this.CustomTaskPanes.Remove(docPane);
                timerDisplayPanes.Remove(docPane);
            }
        }
示例#32
0
        public bool OnNavGetPressed(Office.IRibbonControl control)
        {
            //Event handler for toggl button getPressed event
            bool visible = false;

            try {
                Outlook.Inspector inspector = (Outlook.Inspector)control.Context;
                if (Globals.ThisAddIn.InspectorWrappers.ContainsKey(inspector))
                {
                    InspectorWrapper     iw  = Globals.ThisAddIn.InspectorWrappers[inspector];
                    Tools.CustomTaskPane ctp = iw.CustomTaskPane;
                    if (ctp != null)
                    {
                        visible = ctp.Visible;
                    }
                }
            }
            catch (Exception ex) { App.ReportError(new ApplicationException("Unexpected error while handling button pressed state in the Issue Mgt ribbon extension.", ex), true, LogLevel.Error); }
            finally { this.mRibbonUI.Invalidate(); }
            return(visible);
        }
        private void MainMenu_Load(object sender, RibbonUIEventArgs e)
        {
            presentation = Globals.ThisAddIn.CustomTaskPanes.Add(presentations, "Presentation");
            addDictionary = Globals.ThisAddIn.CustomTaskPanes.Add(addDictionaries, "Add Dictionaries");
            removeDictionary = Globals.ThisAddIn.CustomTaskPanes.Add(removeDictionaries, "Remove Dictionaries");
            updateDictionary = Globals.ThisAddIn.CustomTaskPanes.Add(updateDictionaries, "Update Dictionaries");
            renameDictionary = Globals.ThisAddIn.CustomTaskPanes.Add(renameDictionaries, "Rename Dictionaries");

            //Slide change event handler
            try
            {

                Globals.ThisAddIn.Application.SlideSelectionChanged += Application_SlideSelectionChanged;
                Globals.ThisAddIn.Application.SlideShowEnd += new PowerPoint.EApplication_SlideShowEndEventHandler(Application_SlideShowEnd);

            }
            catch (AccessViolationException ex)
            {

            }
        }
示例#34
0
 public void RemoveAllQueryServiceTaskPanes()
 {
     for (int i = this.CustomTaskPanes.Count; i > 0; i--)
     {
         ctp = this.CustomTaskPanes[i - 1];
         if (ctp.Title == "Query Service Control")
         {
             //this.CustomTaskPanes.RemoveAt(i - 1);
             //ctpTaskPane = null;
             ctpTaskPane.Visible = false;
         }
     }
 }
示例#35
0
 private void RemoveOrphanedTaskPanes()
 {
     for (int i = this.CustomTaskPanes.Count; i > 0; i--)
     {
         ctp = this.CustomTaskPanes[i - 1];
         if (ctp.Window == null)
         {
             this.CustomTaskPanes.Remove(ctp);
         }
     }
 }
示例#36
0
        /// <summary>
        /// Event Handler for the inspector close event.
        /// </summary>
        private void OutlookInspectorWindow_Close()
        {
            // Unhook events from any item-level instance variables
            //m_Contact.PropertyChange -=
            //    Outlook.ItemEvents_10_PropertyChangeEventHandler(
            //    m_Contact_PropertyChange);

            // Unhook events from the window

            if (taskPane != null)
            {
                Globals.ThisAddIn.CustomTaskPanes.Remove(taskPane);
            }

            taskPane = null;

            ((Outlook.InspectorEvents_Event)m_Window).Close -=
                new Outlook.InspectorEvents_CloseEventHandler(
                OutlookInspectorWindow_Close);

            // Raise the OutlookInspector close event
            if (Close != null)
            {
                Close(this, EventArgs.Empty);
            }

            // Unhook any item-level instance variables
            //m_Contact = null;
            m_Window = null;
        }