134 lines
2.3 KiB
C#
134 lines
2.3 KiB
C#
using System;
|
|
|
|
namespace CPF.ReoGrid.Core
|
|
{
|
|
internal class RangeModifyHelper
|
|
{
|
|
internal static void ProcessAfterInsertRow(int row, int count, IRowRange range)
|
|
{
|
|
bool flag = range.Row > row;
|
|
if (flag)
|
|
{
|
|
range.Row += count;
|
|
}
|
|
else
|
|
{
|
|
bool flag2 = range.EndRow > row;
|
|
if (flag2)
|
|
{
|
|
range.Rows += count;
|
|
}
|
|
}
|
|
}
|
|
|
|
internal static void ProcessAfterInsertColumn(int col, int count, IColumnRange range)
|
|
{
|
|
bool flag = range.Col > col;
|
|
if (flag)
|
|
{
|
|
range.Col += count;
|
|
}
|
|
else
|
|
{
|
|
bool flag2 = range.EndCol > col;
|
|
if (flag2)
|
|
{
|
|
range.Cols += count;
|
|
}
|
|
}
|
|
}
|
|
|
|
internal static void ProcessAfterDeleteRow(int row, int count, int endRow, IRowRange rowRange, Action onChange, Action onRemove)
|
|
{
|
|
bool flag = endRow - 1 < rowRange.Row;
|
|
if (flag)
|
|
{
|
|
rowRange.Row -= count;
|
|
}
|
|
else
|
|
{
|
|
bool flag2 = row < rowRange.Row;
|
|
if (flag2)
|
|
{
|
|
int num = endRow - rowRange.Row;
|
|
bool flag3 = num >= rowRange.Rows;
|
|
if (flag3)
|
|
{
|
|
onRemove();
|
|
}
|
|
else
|
|
{
|
|
onChange();
|
|
rowRange.Row -= count - num;
|
|
rowRange.Rows -= num;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
bool flag4 = row <= rowRange.EndRow;
|
|
if (flag4)
|
|
{
|
|
int num2 = Math.Min(rowRange.EndRow - row + 1, count);
|
|
bool flag5 = num2 >= rowRange.Rows;
|
|
if (flag5)
|
|
{
|
|
onRemove();
|
|
}
|
|
else
|
|
{
|
|
onChange();
|
|
rowRange.Rows -= num2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
internal static void ProcessAfterDeleteColumn(int col, int count, int endCol, IColumnRange colRange, Action onChange, Action onRemove)
|
|
{
|
|
bool flag = endCol - 1 < colRange.Col;
|
|
if (flag)
|
|
{
|
|
colRange.Col -= count;
|
|
}
|
|
else
|
|
{
|
|
bool flag2 = col < colRange.Col;
|
|
if (flag2)
|
|
{
|
|
int num = endCol - colRange.Col;
|
|
bool flag3 = num >= colRange.Cols;
|
|
if (flag3)
|
|
{
|
|
onRemove();
|
|
}
|
|
else
|
|
{
|
|
onChange();
|
|
colRange.Col -= count - num;
|
|
colRange.Cols -= num;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
bool flag4 = col <= colRange.EndCol;
|
|
if (flag4)
|
|
{
|
|
int num2 = Math.Min(colRange.EndCol - col + 1, count);
|
|
bool flag5 = num2 >= colRange.Cols;
|
|
if (flag5)
|
|
{
|
|
onRemove();
|
|
}
|
|
else
|
|
{
|
|
onChange();
|
|
colRange.Cols -= num2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|