예제 #1
0
파일: GcRect.cs 프로젝트: Daoting/dt
 /// <summary>
 /// Initializes a new instance of the Dt.Xls.GcRect class at the specified location and size.
 /// </summary>
 /// <param name="point1">A Dt.Xls.GcPoint object that represents the upper-left corner of the rectangular region</param>
 /// <param name="point2">A GrepaCityExcel.GcPoint object that represents the lower-right corner of the rectangular region</param>
 public GcRect(GcPoint point1, GcPoint point2)
 {
     this._x      = Math.Min(point1._x, point2._x);
     this._y      = Math.Min(point1._y, point2._y);
     this._width  = Math.Max((double)(Math.Max(point1._x, point2._x) - this._x), (double)0.0);
     this._height = Math.Max((double)(Math.Max(point1._y, point2._y) - this._y), (double)0.0);
 }
예제 #2
0
        /// <summary>
        /// Specifies whether this Dt.Xls.GcPoint contains the same coordinates as the specified System.Object
        /// </summary>
        /// <param name="o">The System.Object to test.</param>
        /// <returns>true if obj is a  Dt.Xls.GcPoint and has the same coordinates as this  Dt.Xls.GcPoint</returns>
        public override bool Equals(object o)
        {
            if ((o == null) || !(o is GcPoint))
            {
                return(false);
            }
            GcPoint point = (GcPoint)o;

            return(Equals(this, point));
        }
예제 #3
0
 /// <summary>
 /// Compares two  Dt.Xls.GcPoint objects.  The result specifies whether the values of the two objects are unequal
 /// </summary>
 /// <param name="point1">A  Dt.Xls.GcPoint object to compare</param>
 /// <param name="point2">A  Dt.Xls.GcPoint object to compare</param>
 /// <returns>true if they are unequal; otherwise, false.</returns>
 public static bool Equals(GcPoint point1, GcPoint point2)
 {
     return(((double)point1.X).Equals(point2.X) && ((double)point1.Y).Equals(point2.Y));
 }
예제 #4
0
 /// <summary>
 /// Specifies whether this Dt.Xls.GcPoint contains the same coordinates as the specified Dt.Xls.GcPoint
 /// </summary>
 /// <param name="value">A Dt.Xls.GcPoint to compare.</param>
 /// <returns>true if the Dt.Xls.GcPoint has the same coordinates as this Dt.Xls.GcPoint</returns>
 public bool Equals(GcPoint value)
 {
     return(Equals(this, value));
 }
예제 #5
0
파일: ExcelWriter.cs 프로젝트: Daoting/dt
        public bool GetSelectionList(short sheet, List <GcRect> selectionList, ref GcPoint activeCell, ref PaneType paneIndex)
        {
            IExcelWorksheet worksheet         = this._workbook.Worksheets[sheet];
            int             frozenRowCount    = worksheet.FrozenRowCount;
            int             frozenColumnCount = worksheet.FrozenColumnCount;

            activeCell.X = worksheet.ActiveColumnIndex;
            activeCell.Y = worksheet.ActiveRowIndex;
            ExcelWorksheet.ExcelViewportInfo defaultViewport = worksheet.DefaultViewport;
            if (defaultViewport != null)
            {
                int rowPaneCount    = defaultViewport.RowPaneCount;
                int columnPaneCount = defaultViewport.ColumnPaneCount;
                if ((paneIndex != PaneType.TopLeft) && ((rowPaneCount > 2) || (columnPaneCount > 2)))
                {
                    return(false);
                }
                if (paneIndex == PaneType.BottomRight)
                {
                    if (((rowPaneCount <= 1) || (columnPaneCount <= 1)) && ((frozenRowCount <= 0) || (frozenColumnCount <= 0)))
                    {
                        return(false);
                    }
                }
                else if (paneIndex == PaneType.TopRight)
                {
                    if ((columnPaneCount <= 1) && (frozenColumnCount <= 0))
                    {
                        return(false);
                    }
                }
                else if (paneIndex == PaneType.BottomLeft)
                {
                    if ((rowPaneCount <= 1) && (frozenRowCount <= 0))
                    {
                        return(false);
                    }
                }
                else
                {
                    int num1 = (int)paneIndex;
                }
                if (selectionList != null)
                {
                    if ((worksheet.Selections != null) && (worksheet.Selections.Count > 0))
                    {
                        foreach (ISelectionRange range in worksheet.Selections)
                        {
                            if (range.activePaneType == paneIndex)
                            {
                                GcRect rect = new GcRect((range.Column > 0) ? ((double)range.Column) : ((double)0), (range.Row > 0) ? ((double)range.Row) : ((double)0), (range.ColumnSpan > 0) ? ((double)range.ColumnSpan) : ((double)0x4000), (range.RowSpan > 0) ? ((double)range.RowSpan) : ((double)0x100000));
                                selectionList.Add(rect);
                            }
                        }
                    }
                    else
                    {
                        selectionList.Add(new GcRect(activeCell.X, activeCell.Y, 1.0, 1.0));
                    }
                }
            }
            return(true);
        }