static bool IsDoubleLine(BorderLine line) { return(BorderLineLayoutEngine.IsDoubleLine(line)); }
void BuildBordersInternal(ref int rIndex, ref int cIndex, int row, int column, int lineDirection, ref LineItem previousLineItem, ref BorderLine previousLine, ref BorderLine previousBreaker1, ref BorderLine previousBreaker2) { if ((row == -1) && (lineDirection == 1)) { // 垂直线 previousBreaker1 = GetBorderLine(rIndex, cIndex, 0, column, Borders.TOP); previousBreaker2 = GetBorderLine(rIndex, cIndex, 0, NextColumn(cIndex), Borders.TOP); } else if ((column != -1) || (lineDirection != 0)) { BorderLine line; if (column == -1) { line = GetBorderLine(rIndex, cIndex, row, 0, Borders.LEFT); } else if (row == -1) { line = GetBorderLine(rIndex, cIndex, 0, column, Borders.TOP); } else { Borders borderIndex = (lineDirection == 0) ? Borders.BOTTOM : Borders.RIGHT; line = GetBorderLine(rIndex, cIndex, row, column, borderIndex); } bool flag = !BorderLineLayoutEngine.IsDoubleLine(line) && object.Equals(line, previousLine); if (flag) { flag = BorderLine.Max(previousBreaker1, previousBreaker2) < line || BorderLine.Max(previousBreaker1, previousBreaker2) == line; } if (flag && (IsDoubleLine(previousBreaker1) || IsDoubleLine(previousBreaker2))) { flag = false; } LineItem item; if (flag) { // 等同上一线 item = previousLineItem; switch (lineDirection) { case 0: previousLineItem.ColumnEnd = column; break; case 1: previousLineItem.RowEnd = row; break; } } else { item = new LineItem { Direction = lineDirection, RowFrom = row, RowEnd = row, ColumnFrom = column, ColumnEnd = column, Line = line, PreviousLine = previousLine, PreviousBreaker1 = previousBreaker1, PreviousBreaker2 = previousBreaker2 }; if (((item.Line != BorderLine.Empty) && (item.Line != BorderLine.NoBorder)) && (!item.IsGridLine || (line.Color.A != 0))) { ((IThemeContextSupport)line).SetContext(_owner.Excel.ActiveSheet); CreateLine(item); ((IThemeContextSupport)line).SetContext(null); } } switch (lineDirection) { case 0: if (row != -1) { item.NextLine = GetBorderLine(rIndex, cIndex, row, NextColumn(cIndex), Borders.BOTTOM); item.NextBreaker1 = GetBorderLine(rIndex, cIndex, row, column, Borders.RIGHT); item.NextBreaker2 = GetBorderLine(rIndex, cIndex, NextRow(rIndex), column, Borders.RIGHT); break; } item.NextLine = GetBorderLine(rIndex, cIndex, 0, NextColumn(cIndex), Borders.TOP); item.NextBreaker1 = _gridLine; item.NextBreaker2 = GetBorderLine(rIndex, cIndex, 0, column, Borders.RIGHT); break; case 1: if (column != -1) { item.NextLine = GetBorderLine(rIndex, cIndex, NextRow(rIndex), column, Borders.RIGHT); item.NextBreaker1 = GetBorderLine(rIndex, cIndex, row, column, Borders.BOTTOM); item.NextBreaker2 = GetBorderLine(rIndex, cIndex, row, NextColumn(cIndex), Borders.BOTTOM); break; } item.NextLine = GetBorderLine(rIndex, cIndex, NextRow(rIndex), column, Borders.LEFT); item.NextBreaker1 = _gridLine; item.NextBreaker2 = GetBorderLine(rIndex, cIndex, row, 0, Borders.BOTTOM); break; } ulong num = (ulong)row; num = num << 0x20; num |= (uint)column; Rect empty; if (!_cellBoundsCache.TryGetValue(num, out empty)) { empty = GetCellBounds(row, column); _cellBoundsCache.Add(num, empty); } item.Bounds.Add(empty); previousLine = line; previousLineItem = item; previousBreaker1 = item.NextBreaker1; previousBreaker2 = item.NextBreaker2; } }