//*************************************************************************
        //  Constructor: WorksheetContextMenuManager()
        //
        /// <summary>
        /// Initializes a new instance of the <see
        /// cref="WorksheetContextMenuManager" /> class.
        /// </summary>
        ///
        /// <param name="workbook">
        /// Excel workbook.
        /// </param>
        ///
        /// <param name="edgeWorksheet">
        /// The edge worksheet in the Excel workbook.
        /// </param>
        ///
        /// <param name="edgeTable">
        /// The edge table on the edge worksheet.
        /// </param>
        ///
        /// <param name="vertexWorksheet">
        /// The vertex worksheet in the Excel workbook.
        /// </param>
        ///
        /// <param name="vertexTable">
        /// The vertex table on the vertex worksheet.
        /// </param>
        ///
        /// <param name="groupWorksheet">
        /// The group worksheet in the Excel workbook.
        /// </param>
        ///
        /// <param name="groupTable">
        /// The group table on the group worksheet.
        /// </param>
        //*************************************************************************
        public WorksheetContextMenuManager(
            Microsoft.Office.Tools.Excel.Workbook workbook,
            Microsoft.Office.Tools.Excel.Worksheet edgeWorksheet,
            Microsoft.Office.Tools.Excel.ListObject edgeTable,
            Microsoft.Office.Tools.Excel.Worksheet vertexWorksheet,
            Microsoft.Office.Tools.Excel.ListObject vertexTable,
            Microsoft.Office.Tools.Excel.Worksheet groupWorksheet,
            Microsoft.Office.Tools.Excel.ListObject groupTable
            )
        {
            Debug.Assert(workbook != null);
            Debug.Assert(edgeWorksheet != null);
            Debug.Assert(edgeTable != null);
            Debug.Assert(vertexWorksheet != null);
            Debug.Assert(vertexTable != null);
            Debug.Assert(groupWorksheet != null);
            Debug.Assert(groupTable != null);

            m_oWorkbook = workbook;
            m_oEdgeTable = edgeTable;
            m_oVertexTable = vertexTable;
            m_oGroupTable = groupTable;

            // Handle the events involved in adding, handling, and removing custom
            // menu items.

            workbook.Deactivate += new Microsoft.Office.Interop.
            Excel.WorkbookEvents_DeactivateEventHandler(
                this.Workbook_Deactivate);

            edgeWorksheet.Deactivate += new Microsoft.Office.Interop.
            Excel.DocEvents_DeactivateEventHandler(this.Worksheet_Deactivate);

            vertexWorksheet.Deactivate += new Microsoft.Office.Interop.
            Excel.DocEvents_DeactivateEventHandler(this.Worksheet_Deactivate);

            groupWorksheet.Deactivate += new Microsoft.Office.Interop.
            Excel.DocEvents_DeactivateEventHandler(this.Worksheet_Deactivate);

            edgeTable.BeforeRightClick += new Microsoft.Office.Interop.Excel.
            DocEvents_BeforeRightClickEventHandler(EdgeTable_BeforeRightClick);

            vertexTable.BeforeRightClick += new Microsoft.Office.Interop.Excel.
            DocEvents_BeforeRightClickEventHandler(
                VertexTable_BeforeRightClick);

            groupTable.BeforeRightClick += new Microsoft.Office.Interop.Excel.
            DocEvents_BeforeRightClickEventHandler(
                GroupTable_BeforeRightClick);
        }
示例#2
0
 protected GeneratorAbstract()
 {
     this.oWorkbook = Globals.ThisWorkbook.Base;
     this.app       = oWorkbook.Application;
 }