SelectGroupTableRows() { AssertValid(); SheetHelper oSheetHelper = m_oGroupWorksheet.SheetHelper; if (!oSheetHelper.TableExists) { return; } m_bIgnoreSelectionEvents = true; try { oSheetHelper.SelectTableRowsByColumnValues <String>( GroupTableColumnNames.Name, m_oTaskPane.GetSelectedCollapsedGroupNames(), ExcelUtil.TryGetNonEmptyStringFromCell ); } catch (Exception oException) { ErrorUtil.OnException(oException); } finally { m_bIgnoreSelectionEvents = false; } }
Sheet5_Startup ( object sender, System.EventArgs e ) { m_oSheetHelper = new SheetHelper(this, this.Groups); ThisWorkbook oThisWorkbook = Globals.ThisWorkbook; oThisWorkbook.GraphLaidOut += new EventHandler <GraphLaidOutEventArgs>( this.ThisWorkbook_GraphLaidOut); oThisWorkbook.VerticesMoved += new EventHandler <VerticesMovedEventArgs2>( this.ThisWorkbook_VerticesMoved); oThisWorkbook.GroupsCollapsedOrExpanded += new EventHandler <GroupsCollapsedOrExpandedEventArgs>( this.ThisWorkbook_GroupsCollapsedOrExpanded); CommandDispatcher.CommandSent += new RunCommandEventHandler(this.CommandDispatcher_CommandSent); }
IgnoreTableSelectionChange ( SheetHelper oSheetHelper ) { Debug.Assert(oSheetHelper != null); AssertValid(); return( // Work around an Excel bug. See the // ExcelUtil.SpecialCellsBeingCalled property for details. ExcelUtil.SpecialCellsBeingCalled || m_bIgnoreSelectionEvents || !oSheetHelper.TableExists ); }
OnGroupTableSelectionChange() { AssertValid(); SheetHelper oSheetHelper = m_oGroupWorksheet.SheetHelper; if (IgnoreTableSelectionChange(oSheetHelper)) { return; } // Enable the "set visual attribute" buttons in the Ribbon. m_oThisWorkbook.EnableSetVisualAttributes(); LinkedList <Int32> oVertexRowIDsToSelect = new LinkedList <Int32>(); LinkedList <String> oCollapsedGroupNamesToSelect = new LinkedList <String>(); foreach (String sSelectedGroupName in oSheetHelper.GetSelectedStringColumnValues( GroupTableColumnNames.Name)) { if (m_oTaskPane.IsCollapsedGroup(sSelectedGroupName)) { oCollapsedGroupNamesToSelect.AddLast(sSelectedGroupName); } else { foreach (Int32 iVertexIDInGroup in NodeXLWorkbookUtil.GetVertexIDsInGroup( m_oThisWorkbook.InnerObject, sSelectedGroupName)) { oVertexRowIDsToSelect.AddLast(iVertexIDInGroup); } } } m_bIgnoreSelectionEvents = true; // Select the vertices in the graph, then defer the selection of the // corresponding rows in the edge and vertex worksheets until those // worksheets are activated. m_oTaskPane.SetSelectedVerticesByRowID(oVertexRowIDsToSelect); m_bUpdateEdgeSelectionOnActivation = true; m_bUpdateVertexSelectionOnActivation = true; // Select the vertices that represent collapsed groups. This has to be // done after selecting the other vertices, because selecting the other // vertices clears the selection. foreach (String sCollapsedSelectedGroupName in oCollapsedGroupNamesToSelect) { m_oTaskPane.SelectCollapsedGroup(sCollapsedSelectedGroupName); } m_bIgnoreSelectionEvents = false; }