Example #1
0
        void ArrangeColumnGroups(double buttonSize)
        {
            double            x;
            double            num5;
            double            num3 = Math.Max((double)0.0, (double)((buttonSize - 6.0) / 2.0)) + 2.0;
            ColumnLayoutModel columnLayoutModel = _excel.GetColumnLayoutModel(ViewportIndex, SheetArea.Cells);

            foreach (GroupDotInfo info in _groupDotInfos)
            {
                ColumnLayout layout = columnLayoutModel.FindColumn(info.Index);
                if ((layout != null) && (layout.Width >= 2.0))
                {
                    x    = layout.X + Math.Max((double)0.0, (double)((layout.Width - 2.0) / 2.0));
                    num5 = (Location.Y + (info.Level * buttonSize)) + num3;
                    info.Dot.Arrange(new Rect(PointToClient(new Point(x, num5)), _dotSize));
                }
            }

            RangeGroupDirection direction = _excel.ActiveSheet.ColumnRangeGroup.Direction;

            foreach (GroupLineInfo info2 in _groupLineInfos)
            {
                ColumnLayout layout2 = columnLayoutModel.FindColumn(info2.Start);
                ColumnLayout layout3 = columnLayoutModel.FindColumn(info2.End);
                if ((layout2 != null) && (layout3 != null))
                {
                    Rectangle line = info2.Line;
                    x = layout2.X;
                    switch (direction)
                    {
                    case RangeGroupDirection.Forward:
                        x++;
                        break;

                    case RangeGroupDirection.Backward:
                        x--;
                        break;
                    }
                    num5 = (base.Location.Y + (info2.Level * buttonSize)) + num3;
                    double num8 = Math.Max((double)0.0, (double)(((layout3.X + layout3.Width) - layout2.X) - 1.0));
                    double num9 = 2.0;
                    line.Arrange(new Rect(base.PointToClient(new Point(x, num5)), new Size(num8, num9)));
                    Rectangle startLine = info2.StartLine;
                    if (startLine != null)
                    {
                        double num10 = Math.Min((double)6.0, (double)(buttonSize - 2.0));
                        if (num10 > 0.0)
                        {
                            if (direction == RangeGroupDirection.Backward)
                            {
                                x = (x + num8) - 2.0;
                            }
                            if ((x >= layout2.X) && (x < (layout3.X + layout3.Width)))
                            {
                                startLine.Arrange(new Rect(base.PointToClient(new Point(x, num5)), new Size(2.0, num10)));
                            }
                        }
                    }
                }
            }

            foreach (GroupButtonInfo info3 in _groupButtonInfos)
            {
                GroupButton  button  = info3.Button;
                ColumnLayout layout4 = columnLayoutModel.FindColumn(button.Index);
                if (layout4 != null)
                {
                    double num11 = Math.Max((double)0.0, (double)((layout4.Width - buttonSize) / 2.0));
                    x    = layout4.X + num11;
                    num5 = (base.Location.Y + (button.Level * buttonSize)) + 2.0;
                    double num12 = Math.Min(buttonSize, layout4.Width);
                    double num13 = buttonSize;
                    button.Arrange(new Rect(base.PointToClient(new Point(x, num5)), new Size(num12, num13)));
                    Rectangle rectangle3 = info3.Line;
                    if ((rectangle3 != null) && (num12 < layout4.Width))
                    {
                        x    = layout4.X;
                        num5 = (base.Location.Y + (button.Level * buttonSize)) + num3;
                        double num14 = num11;
                        double num15 = 2.0;
                        if (info3.LineDirection == RangeGroupDirection.Backward)
                        {
                            x    += num11 + num12;
                            num14 = (layout4.Width - num12) - num11;
                        }
                        rectangle3.Arrange(new Rect(base.PointToClient(new Point(x, num5)), new Size(num14, num15)));
                    }
                }
            }
        }
Example #2
0
        void ArrangeRowGroups(double buttonSize)
        {
            double num4;
            double y;
            double num3 = Math.Max((double)0.0, (double)((buttonSize - 6.0) / 2.0)) + 2.0;

            _excel.GetSheetLayout();

            RowLayoutModel rowLayoutModel = _excel.GetRowLayoutModel(ViewportIndex, SheetArea.Cells);

            foreach (GroupDotInfo info in _groupDotInfos)
            {
                RowLayout layout = rowLayoutModel.Find(info.Index);
                if ((layout != null) && (layout.Height >= 2.0))
                {
                    num4 = (base.Location.X + (info.Level * buttonSize)) + num3;
                    y    = layout.Y + Math.Max((double)0.0, (double)((layout.Height - 2.0) / 2.0));
                    info.Dot.Arrange(new Rect(base.PointToClient(new Point(num4, y)), _dotSize));
                }
            }
            RangeGroupDirection direction = _excel.ActiveSheet.RowRangeGroup.Direction;

            foreach (GroupLineInfo info2 in _groupLineInfos)
            {
                RowLayout layout2 = rowLayoutModel.FindRow(info2.Start);
                RowLayout layout3 = rowLayoutModel.FindRow(info2.End);
                if ((layout2 != null) && (layout3 != null))
                {
                    Rectangle line = info2.Line;
                    num4 = (base.Location.X + (info2.Level * buttonSize)) + num3;
                    y    = layout2.Y;
                    switch (direction)
                    {
                    case RangeGroupDirection.Forward:
                        y++;
                        break;

                    case RangeGroupDirection.Backward:
                        y--;
                        break;
                    }
                    double num8 = 2.0;
                    double num9 = Math.Max((double)0.0, (double)(((layout3.Y + layout3.Height) - layout2.Y) - 1.0));
                    line.Arrange(new Rect(base.PointToClient(new Point(num4, y)), new Size(num8, num9)));
                    Rectangle startLine = info2.StartLine;
                    if (startLine != null)
                    {
                        double num10 = Math.Min((double)6.0, (double)(buttonSize - 2.0));
                        if (num10 > 0.0)
                        {
                            if (direction == RangeGroupDirection.Backward)
                            {
                                y = (y + num9) - 2.0;
                            }
                            if ((y >= layout2.Y) && (y < (layout3.Y + layout3.Height)))
                            {
                                startLine.Arrange(new Rect(base.PointToClient(new Point(num4, y)), new Size(num10, 2.0)));
                            }
                        }
                    }
                }
            }
            foreach (GroupButtonInfo info3 in _groupButtonInfos)
            {
                RowLayout layout4 = rowLayoutModel.FindRow(info3.Button.Index);
                if (layout4 != null)
                {
                    GroupButton button = info3.Button;
                    double      num11  = Math.Max((double)0.0, (double)((layout4.Height - buttonSize) / 2.0));
                    num4 = (base.Location.X + (button.Level * buttonSize)) + 2.0;
                    y    = layout4.Y + num11;
                    double num12 = buttonSize;
                    double num13 = Math.Min(buttonSize, layout4.Height);
                    button.Arrange(new Rect(base.PointToClient(new Point(num4, y)), new Size(num12, num13)));
                    Rectangle rectangle3 = info3.Line;
                    if ((rectangle3 != null) && (num13 < layout4.Height))
                    {
                        num4 = (base.Location.X + (button.Level * buttonSize)) + num3;
                        y    = layout4.Y;
                        double num14 = 2.0;
                        double num15 = num11;
                        if (info3.LineDirection == RangeGroupDirection.Backward)
                        {
                            y    += num11 + num13;
                            num15 = (layout4.Height - num13) - num11;
                        }
                        rectangle3.Arrange(new Rect(base.PointToClient(new Point(num4, y)), new Size(num14, num15)));
                    }
                }
            }
        }