Ejemplo n.º 1
0
 public override void ScrollToPreviousPageOfRows()
 {
     NavigatorHelper.ScrollToPreviousPageOfRows(_excel);
 }
Ejemplo n.º 2
0
        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);
        }