C# Class Smrf.NodeXL.ExcelTemplate.WorksheetContextMenuManager

Adds custom menu items to the Excel context menus that appear when one of several tables is clicked in the workbook.
This class takes care of all of the details involved in adding custom NodeXL menu items to the Excel context menus, including handling and forwarding the events that are fired when the custom menu items are clicked.

A RequestEdgeCommandEnable or event is fired before an edge or vertex table context menu is displayed and this class needs to know which menu items to enable. A RunNoParamCommandEventArgs command is sent via the CommandDispatcher class when the user clicks one of the custom menu items.

Inheritance: Object
Mostra file Open project: 2014-sed-team3/term-project Class Usage Examples

Public Properties

Property Type Description
NoRowID System.Int32

Protected Properties

Property Type Description
m_oEdgeTable Microsoft.Office.Tools.Excel.ListObject
m_oGroupTable Microsoft.Office.Tools.Excel.ListObject
m_oVertexTable Microsoft.Office.Tools.Excel.ListObject
m_oWorkbook Microsoft.Office.Tools.Excel.WorkbookBase

Public Methods

Method Description
WorksheetContextMenuManager ( Microsoft workbook, Microsoft edgeWorksheet, Microsoft edgeTable, Microsoft vertexWorksheet, Microsoft vertexTable, Microsoft groupWorksheet, Microsoft groupTable ) : System

Initializes a new instance of the class.

Protected Methods

Method Description
AddContextMenuItem ( CommandBarPopup oCommandBarPopup, String sText, Int32 iClickedID, _CommandBarButtonEvents_ClickEventHandler oEventHandler ) : System.Windows.Forms.CommandBarButton
AddContextMenuSeparator ( CommandBar oTableContextCommandBar, System.Boolean bAdd ) : void
AddEdgeContextMenuItems ( Microsoft oClickedRange ) : void
AddGroupContextMenuItems ( Microsoft oClickedRange ) : void
AddSetColorContextMenuItem ( Microsoft oTable, Microsoft oClickedRange ) : void
AddTopLevelPopup ( CommandBar oTableContextCommandBar ) : CommandBarPopup
AddVertexContextMenuItems ( Microsoft oClickedRange ) : void
CommandBarButtonToClickedID ( System.Windows.Forms.CommandBarButton oCommandBarButton ) : Int32
EdgeTable_BeforeRightClick ( Microsoft Target, bool &Cancel ) : void
GroupTable_BeforeRightClick ( Microsoft Target, bool &Cancel ) : void
PrepareToAddChildMenuItems ( Microsoft oClickedRange, Microsoft oTable, String sIDColumnName, Int32 &iClickedID, CommandBarPopup &oTopLevelPopup ) : void
RemoveContextMenuItems ( ) : void
RunAVertexCommand ( System.Windows.Forms.CommandBarButton oCommandBarButton, VertexCommand eVertexCommand ) : void
RunAnEdgeCommand ( System.Windows.Forms.CommandBarButton oCommandBarButton, EdgeCommand eEdgeCommand ) : void
TryGetClickedID ( Microsoft oClickedRange, Microsoft oTable, String sIDColumnName, Int32 &iClickedID ) : System.Boolean
VertexTable_BeforeRightClick ( Microsoft Target, bool &Cancel ) : void
Workbook_Deactivate ( ) : void
Worksheet_Deactivate ( ) : void
oDeselectAdjacentVerticesOfEdgeButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
oDeselectAdjacentVerticesOfVertexButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
oDeselectAllEdgesButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
oDeselectAllVerticesButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
oDeselectIncidentEdgesButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
oEditVertexAttributesButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
oSelectAdjacentVerticesOfEdgeButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
oSelectAdjacentVerticesOfVertexButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
oSelectAllEdgesButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
oSelectAllVerticesButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
oSelectIncidentEdgesButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
oSelectSubgraphsButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
oSetColorButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void

Private Methods

Method Description
AssertValid ( ) : void

Method Details

AddContextMenuItem() protected method

protected AddContextMenuItem ( CommandBarPopup oCommandBarPopup, String sText, Int32 iClickedID, _CommandBarButtonEvents_ClickEventHandler oEventHandler ) : System.Windows.Forms.CommandBarButton
oCommandBarPopup CommandBarPopup
sText String
iClickedID System.Int32
oEventHandler _CommandBarButtonEvents_ClickEventHandler
return System.Windows.Forms.CommandBarButton

AddContextMenuSeparator() protected method

protected AddContextMenuSeparator ( CommandBar oTableContextCommandBar, System.Boolean bAdd ) : void
oTableContextCommandBar System.Windows.Forms.CommandBar
bAdd System.Boolean
return void

AddEdgeContextMenuItems() protected method

protected AddEdgeContextMenuItems ( Microsoft oClickedRange ) : void
oClickedRange Microsoft
return void

AddGroupContextMenuItems() protected method

protected AddGroupContextMenuItems ( Microsoft oClickedRange ) : void
oClickedRange Microsoft
return void

AddSetColorContextMenuItem() protected method

protected AddSetColorContextMenuItem ( Microsoft oTable, Microsoft oClickedRange ) : void
oTable Microsoft
oClickedRange Microsoft
return void

AddTopLevelPopup() protected method

protected AddTopLevelPopup ( CommandBar oTableContextCommandBar ) : CommandBarPopup
oTableContextCommandBar System.Windows.Forms.CommandBar
return CommandBarPopup

AddVertexContextMenuItems() protected method

protected AddVertexContextMenuItems ( Microsoft oClickedRange ) : void
oClickedRange Microsoft
return void

CommandBarButtonToClickedID() protected method

protected CommandBarButtonToClickedID ( System.Windows.Forms.CommandBarButton oCommandBarButton ) : Int32
oCommandBarButton System.Windows.Forms.CommandBarButton
return System.Int32

EdgeTable_BeforeRightClick() protected method

protected EdgeTable_BeforeRightClick ( Microsoft Target, bool &Cancel ) : void
Target Microsoft
Cancel bool
return void

GroupTable_BeforeRightClick() protected method

protected GroupTable_BeforeRightClick ( Microsoft Target, bool &Cancel ) : void
Target Microsoft
Cancel bool
return void

PrepareToAddChildMenuItems() protected method

protected PrepareToAddChildMenuItems ( Microsoft oClickedRange, Microsoft oTable, String sIDColumnName, Int32 &iClickedID, CommandBarPopup &oTopLevelPopup ) : void
oClickedRange Microsoft
oTable Microsoft
sIDColumnName String
iClickedID System.Int32
oTopLevelPopup CommandBarPopup
return void

RemoveContextMenuItems() protected method

protected RemoveContextMenuItems ( ) : void
return void

RunAVertexCommand() protected method

protected RunAVertexCommand ( System.Windows.Forms.CommandBarButton oCommandBarButton, VertexCommand eVertexCommand ) : void
oCommandBarButton System.Windows.Forms.CommandBarButton
eVertexCommand VertexCommand
return void

RunAnEdgeCommand() protected method

protected RunAnEdgeCommand ( System.Windows.Forms.CommandBarButton oCommandBarButton, EdgeCommand eEdgeCommand ) : void
oCommandBarButton System.Windows.Forms.CommandBarButton
eEdgeCommand EdgeCommand
return void

TryGetClickedID() protected method

protected TryGetClickedID ( Microsoft oClickedRange, Microsoft oTable, String sIDColumnName, Int32 &iClickedID ) : System.Boolean
oClickedRange Microsoft
oTable Microsoft
sIDColumnName String
iClickedID System.Int32
return System.Boolean

VertexTable_BeforeRightClick() protected method

protected VertexTable_BeforeRightClick ( Microsoft Target, bool &Cancel ) : void
Target Microsoft
Cancel bool
return void

Workbook_Deactivate() protected method

protected Workbook_Deactivate ( ) : void
return void

WorksheetContextMenuManager() public method

Initializes a new instance of the class.
public WorksheetContextMenuManager ( Microsoft workbook, Microsoft edgeWorksheet, Microsoft edgeTable, Microsoft vertexWorksheet, Microsoft vertexTable, Microsoft groupWorksheet, Microsoft groupTable ) : System
workbook Microsoft /// Excel workbook. ///
edgeWorksheet Microsoft /// The edge worksheet in the Excel workbook. ///
edgeTable Microsoft /// The edge table on the edge worksheet. ///
vertexWorksheet Microsoft /// The vertex worksheet in the Excel workbook. ///
vertexTable Microsoft /// The vertex table on the vertex worksheet. ///
groupWorksheet Microsoft /// The group worksheet in the Excel workbook. ///
groupTable Microsoft /// The group table on the group worksheet. ///
return System

Worksheet_Deactivate() protected method

protected Worksheet_Deactivate ( ) : void
return void

oDeselectAdjacentVerticesOfEdgeButton_Click() protected method

protected oDeselectAdjacentVerticesOfEdgeButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
Ctrl System.Windows.Forms.CommandBarButton
CancelDefault bool
return void

oDeselectAdjacentVerticesOfVertexButton_Click() protected method

protected oDeselectAdjacentVerticesOfVertexButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
Ctrl System.Windows.Forms.CommandBarButton
CancelDefault bool
return void

oDeselectAllEdgesButton_Click() protected method

protected oDeselectAllEdgesButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
Ctrl System.Windows.Forms.CommandBarButton
CancelDefault bool
return void

oDeselectAllVerticesButton_Click() protected method

protected oDeselectAllVerticesButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
Ctrl System.Windows.Forms.CommandBarButton
CancelDefault bool
return void

oDeselectIncidentEdgesButton_Click() protected method

protected oDeselectIncidentEdgesButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
Ctrl System.Windows.Forms.CommandBarButton
CancelDefault bool
return void

oEditVertexAttributesButton_Click() protected method

protected oEditVertexAttributesButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
Ctrl System.Windows.Forms.CommandBarButton
CancelDefault bool
return void

oSelectAdjacentVerticesOfEdgeButton_Click() protected method

protected oSelectAdjacentVerticesOfEdgeButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
Ctrl System.Windows.Forms.CommandBarButton
CancelDefault bool
return void

oSelectAdjacentVerticesOfVertexButton_Click() protected method

protected oSelectAdjacentVerticesOfVertexButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
Ctrl System.Windows.Forms.CommandBarButton
CancelDefault bool
return void

oSelectAllEdgesButton_Click() protected method

protected oSelectAllEdgesButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
Ctrl System.Windows.Forms.CommandBarButton
CancelDefault bool
return void

oSelectAllVerticesButton_Click() protected method

protected oSelectAllVerticesButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
Ctrl System.Windows.Forms.CommandBarButton
CancelDefault bool
return void

oSelectIncidentEdgesButton_Click() protected method

protected oSelectIncidentEdgesButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
Ctrl System.Windows.Forms.CommandBarButton
CancelDefault bool
return void

oSelectSubgraphsButton_Click() protected method

protected oSelectSubgraphsButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
Ctrl System.Windows.Forms.CommandBarButton
CancelDefault bool
return void

oSetColorButton_Click() protected method

protected oSetColorButton_Click ( System.Windows.Forms.CommandBarButton Ctrl, bool &CancelDefault ) : void
Ctrl System.Windows.Forms.CommandBarButton
CancelDefault bool
return void

Property Details

NoRowID public_oe static_oe property

Indicates that an edge or vertex row ID isn't available.
public static Int32,System NoRowID
return System.Int32

m_oEdgeTable protected_oe property

protected Microsoft.Office.Tools.Excel.ListObject m_oEdgeTable
return Microsoft.Office.Tools.Excel.ListObject

m_oGroupTable protected_oe property

protected Microsoft.Office.Tools.Excel.ListObject m_oGroupTable
return Microsoft.Office.Tools.Excel.ListObject

m_oVertexTable protected_oe property

protected Microsoft.Office.Tools.Excel.ListObject m_oVertexTable
return Microsoft.Office.Tools.Excel.ListObject

m_oWorkbook protected_oe property

protected Microsoft.Office.Tools.Excel.WorkbookBase m_oWorkbook
return Microsoft.Office.Tools.Excel.WorkbookBase