public override void BringCellToVisible(CompositePosition position) { if ((!position.IsEmpty && (position.Type == DataSheetElementType.Cell)) && (_excel.ActiveSheet != null)) { NavigatorHelper.BringCellToVisible(_excel, position.Row, position.Column); } }
public override void BringCellToVisible(TabularPosition position) { if ((!position.IsEmpty && (position.Area == SheetArea.Cells)) && (_excel.ActiveSheet != null)) { NavigatorHelper.BringCellToVisible(_excel, position.Row, position.Column); } }
public override void ScrollToPreviousPageOfRows() { NavigatorHelper.ScrollToPreviousPageOfRows(_excel); }
public override void ScrollToNextPageOfRows() { NavigatorHelper.ScrollToNextPageOfRows(_excel); }
CellRange KeyboardThroughSelect(CellRange currentRange, NavigationDirection direction) { int row = (currentRange.Row < 0) ? 0 : currentRange.Row; int column = (currentRange.Column < 0) ? 0 : currentRange.Column; int rowCount = (currentRange.Row < 0) ? _excel.ActiveSheet.RowCount : currentRange.RowCount; int columnCount = (currentRange.Column < 0) ? _excel.ActiveSheet.ColumnCount : currentRange.ColumnCount; CellRange activeCell = GetActiveCell(); CellRange range2 = null; if (direction == NavigationDirection.Home) { range2 = new CellRange(row, 0, rowCount, activeCell.Column + activeCell.ColumnCount); } else if (direction == NavigationDirection.End) { range2 = new CellRange(row, activeCell.Column, rowCount, _excel.ActiveSheet.ColumnCount - activeCell.Column); } else if (direction == NavigationDirection.Top) { range2 = new CellRange(0, column, activeCell.Row + activeCell.RowCount, columnCount); } else if (direction == NavigationDirection.Bottom) { range2 = new CellRange(activeCell.Row, column, _excel.ActiveSheet.RowCount - activeCell.Row, columnCount); } else if (direction == NavigationDirection.First) { range2 = new CellRange(_excel.ActiveSheet.FrozenRowCount, _excel.ActiveSheet.FrozenColumnCount, (activeCell.Row + activeCell.RowCount) - _excel.ActiveSheet.FrozenRowCount, (activeCell.Column + activeCell.ColumnCount) - _excel.ActiveSheet.FrozenColumnCount); } else if (direction == NavigationDirection.Last) { range2 = new CellRange(activeCell.Row, activeCell.Column, (_excel.ActiveSheet.RowCount - _excel.ActiveSheet.FrozenTrailingRowCount) - activeCell.Row, (_excel.ActiveSheet.ColumnCount - _excel.ActiveSheet.FrozenTrailingColumnCount) - activeCell.Column); } if (range2 != null) { int viewCellRow = range2.Row; int num6 = (range2.Row + range2.RowCount) - 1; int viewCellColumn = range2.Column; int num8 = (range2.Column + range2.ColumnCount) - 1; if ((direction == NavigationDirection.Top) || (direction == NavigationDirection.First)) { NavigatorHelper.BringCellToVisible(_excel, viewCellRow, viewCellColumn); return(range2); } if ((direction == NavigationDirection.Home) || (direction == NavigationDirection.End)) { int activeRowViewportIndex = _excel.GetActiveRowViewportIndex(); int viewportTopRow = _excel.GetViewportTopRow(activeRowViewportIndex); int viewportBottomRow = _excel.GetViewportBottomRow(activeRowViewportIndex); if (direction == NavigationDirection.Home) { if (num6 < viewportTopRow) { NavigatorHelper.BringCellToVisible(_excel, row, viewCellColumn); return(range2); } if (viewCellRow > viewportBottomRow) { NavigatorHelper.BringCellToVisible(_excel, num6, viewCellColumn); return(range2); } NavigatorHelper.BringCellToVisible(_excel, viewportTopRow, viewCellColumn); return(range2); } if (num6 < viewportTopRow) { NavigatorHelper.BringCellToVisible(_excel, row, num8); return(range2); } if (viewCellRow > viewportBottomRow) { NavigatorHelper.BringCellToVisible(_excel, num6, num8); return(range2); } NavigatorHelper.BringCellToVisible(_excel, viewportTopRow, num8); return(range2); } if ((direction == NavigationDirection.Bottom) || (direction == NavigationDirection.Last)) { NavigatorHelper.BringCellToVisible(_excel, num6, num8); } } return(range2); }
CellRange KeyboardPageSelect(CellRange currentRange, NavigationDirection direction) { int row = (currentRange.Row < 0) ? 0 : currentRange.Row; int rowCount = (currentRange.Row < 0) ? _excel.ActiveSheet.RowCount : currentRange.RowCount; int column = (currentRange.Column < 0) ? 0 : currentRange.Column; int columnCount = (currentRange.Column < 0) ? _excel.ActiveSheet.ColumnCount : currentRange.ColumnCount; int num5 = (row + rowCount) - 1; int num6 = (column + columnCount) - 1; int activeRowViewportIndex = _excel.GetActiveRowViewportIndex(); int activeColumnViewportIndex = _excel.GetActiveColumnViewportIndex(); int num9 = _excel.ActiveSheet.RowCount; int num10 = _excel.ActiveSheet.ColumnCount; int viewportTopRow = _excel.GetViewportTopRow(activeRowViewportIndex); _excel.GetViewportBottomRow(activeRowViewportIndex); int viewportLeftColumn = _excel.GetViewportLeftColumn(activeColumnViewportIndex); _excel.GetViewportRightColumn(activeColumnViewportIndex); int num13 = GetActiveCell().Row; int num14 = GetActiveCell().Column; CellRange range = null; if (direction == NavigationDirection.PageDown) { NavigatorHelper.ScrollToNextPageOfRows(_excel); int num15 = _excel.GetViewportTopRow(activeRowViewportIndex); int viewportBottomRow = _excel.GetViewportBottomRow(activeRowViewportIndex); int num17 = num15 - viewportTopRow; if (num17 > 0) { int num18 = num13; int num19 = num5 + num17; if (row != num13) { num18 = row + num17; num19 = num5; if (num18 >= num13) { num18 = num13; num19 = num5 + (num17 - (num13 - row)); } } if (num19 < num15) { num19 = num15; } else if (num18 > viewportBottomRow) { num18 = viewportBottomRow; num19 = num13; } else if ((num19 > viewportBottomRow) && (num13 <= viewportBottomRow)) { num19 = viewportBottomRow; } return(new CellRange(num18, column, (num19 - num18) + 1, columnCount)); } int num20 = (num9 - row) - rowCount; if ((num20 > 0) && (_excel.ActiveSheet.FrozenTrailingRowCount == 0)) { int num21 = num13; int num22 = num9 - 1; range = new CellRange(num21, column, (num22 - num21) + 1, columnCount); } return(range); } if (direction == NavigationDirection.PageUp) { NavigatorHelper.ScrollToPreviousPageOfRows(_excel); int num23 = _excel.GetViewportTopRow(activeRowViewportIndex); int num24 = _excel.GetViewportBottomRow(activeRowViewportIndex); int num25 = viewportTopRow - num23; if (num25 > 0) { int num26 = row - num25; int num27 = num5; if (num5 != num13) { num26 = row; num27 = num5 - num25; if (num27 <= num13) { num26 = row - (num25 - (num5 - num13)); num27 = num13; } } if (num27 < num23) { num26 = num13; num27 = num23; } else if (num26 > num24) { num26 = num24; } else if ((num26 < num23) && (num13 >= num23)) { num26 = num23; } return(new CellRange(num26, column, (num27 - num26) + 1, columnCount)); } if ((row > 0) && (_excel.ActiveSheet.FrozenRowCount == 0)) { int num28 = 0; int num29 = num13; range = new CellRange(num28, column, (num29 - num28) + 1, columnCount); } return(range); } if (direction == NavigationDirection.PageRight) { NavigatorHelper.ScrollToNextPageOfColumns(_excel); int num30 = _excel.GetViewportLeftColumn(activeColumnViewportIndex); int viewportRightColumn = _excel.GetViewportRightColumn(activeColumnViewportIndex); int num32 = num30 - viewportLeftColumn; if (num32 > 0) { int num33 = num14; int num34 = num6 + num32; if (column != num14) { num33 = column + num32; num34 = num6; if (num33 >= num14) { num33 = num14; num34 = num6 + (num32 - (num14 - column)); } } if (num34 < num30) { num34 = num30; } else if (num33 > viewportRightColumn) { num33 = viewportRightColumn; num34 = num14; } else if ((num34 > viewportRightColumn) && (num14 <= viewportRightColumn)) { num34 = viewportRightColumn; } return(new CellRange(row, num33, rowCount, (num34 - num33) + 1)); } int num35 = (num10 - column) - columnCount; if ((num35 > 0) && (_excel.ActiveSheet.FrozenTrailingColumnCount == 0)) { int num36 = num14; int num37 = num10 - 1; range = new CellRange(row, num36, rowCount, (num37 - num36) + 1); } return(range); } if (direction == NavigationDirection.PageLeft) { NavigatorHelper.ScrollToPreviousPageOfColumns(_excel); int num38 = _excel.GetViewportLeftColumn(activeColumnViewportIndex); int num39 = _excel.GetViewportRightColumn(activeColumnViewportIndex); int num40 = viewportLeftColumn - num38; if (num40 > 0) { int num41 = column - num40; int num42 = num6; if (num6 != num14) { num41 = column; num42 = num6 - num40; if (num42 <= num14) { num41 = column - (num40 - (num6 - num14)); num42 = num14; } } if (num42 < num38) { num41 = num14; num42 = num38; } else if (num41 > num39) { num41 = num39; } else if ((num41 < num38) && (num14 >= num38)) { num41 = num38; } return(new CellRange(row, num41, rowCount, (num42 - num41) + 1)); } if ((column > 0) && (_excel.ActiveSheet.FrozenColumnCount == 0)) { int num43 = 0; int num44 = num14; range = new CellRange(row, num43, rowCount, (num44 - num43) + 1); } } return(range); }
CellRange KeyboardLineSelect(CellRange currentRange, NavigationDirection navigationDirection, bool shrink) { TabularPosition position; TabularPosition position2; TabularPosition currentCell; CellRange expandIntersectedRange; int row = (currentRange.Row < 0) ? 0 : currentRange.Row; int column = (currentRange.Column < 0) ? 0 : currentRange.Column; int rowCount = (currentRange.Row < 0) ? _excel.ActiveSheet.RowCount : currentRange.RowCount; int columnCount = (currentRange.Column < 0) ? _excel.ActiveSheet.ColumnCount : currentRange.ColumnCount; GetAdjustedEdge(row, column, rowCount, columnCount, navigationDirection, shrink, out position, out position2); if ((position == TabularPosition.Empty) || (position2 == TabularPosition.Empty)) { return(null); } _keyboardNavigator.CurrentCell = position2; CellRange activeCell = GetActiveCell(); do { if (!_keyboardNavigator.MoveCurrent(navigationDirection)) { return(null); } currentCell = _keyboardNavigator.CurrentCell; expandIntersectedRange = GetExpandIntersectedRange(TabularPositionUnion(position, currentCell)); if (!expandIntersectedRange.Contains(activeCell)) { return(null); } }while (expandIntersectedRange.Equals(row, column, rowCount, columnCount)); bool flag = true; int viewCellRow = currentCell.Row; int viewCellColumn = currentCell.Column; int activeRowViewportIndex = _excel.GetActiveRowViewportIndex(); int activeColumnViewportIndex = _excel.GetActiveColumnViewportIndex(); int viewportTopRow = _excel.GetViewportTopRow(activeRowViewportIndex); int viewportBottomRow = _excel.GetViewportBottomRow(activeRowViewportIndex); int viewportLeftColumn = _excel.GetViewportLeftColumn(activeColumnViewportIndex); int viewportRightColumn = _excel.GetViewportRightColumn(activeColumnViewportIndex); if ((navigationDirection == NavigationDirection.Up) || (navigationDirection == NavigationDirection.Down)) { if ((expandIntersectedRange.Column == 0) && (expandIntersectedRange.ColumnCount == _excel.ActiveSheet.ColumnCount)) { if ((currentCell.Row >= viewportTopRow) && (currentCell.Row < viewportBottomRow)) { flag = false; } else { viewCellColumn = viewportLeftColumn; } } } else if (((navigationDirection == NavigationDirection.Left) || (navigationDirection == NavigationDirection.Right)) && ((expandIntersectedRange.Row == 0) && (expandIntersectedRange.RowCount == _excel.ActiveSheet.RowCount))) { if ((currentCell.Column >= viewportLeftColumn) && (currentCell.Column < viewportRightColumn)) { flag = false; } else { viewCellRow = viewportTopRow; } } if (flag) { NavigatorHelper.BringCellToVisible(_excel, viewCellRow, viewCellColumn); } return(expandIntersectedRange); }