205 lines
5.8 KiB
C#
205 lines
5.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using CPF.ReoGrid.Core;
|
|
|
|
namespace CPF.ReoGrid.Outline
|
|
{
|
|
public class RowOutline : ReoGridOutline, IRowRange
|
|
{
|
|
internal RowOutline(Worksheet sheet, int start, int count) : base(sheet, start, count)
|
|
{
|
|
}
|
|
|
|
public override void Collapse()
|
|
{
|
|
OutlineCollection<ReoGridOutline> outlines = base.sheet.GetOutlines(RowOrColumn.Row);
|
|
bool flag = outlines == null;
|
|
if (!flag)
|
|
{
|
|
bool flag2 = !this.RaiseBeforeCollapseEvent();
|
|
if (!flag2)
|
|
{
|
|
int groupIndex;
|
|
int groupIndex2;
|
|
for (groupIndex = 0; groupIndex < outlines.Count - 1; groupIndex = groupIndex2 + 1)
|
|
{
|
|
OutlineGroup<ReoGridOutline> outlineGroup = outlines[groupIndex];
|
|
bool flag3 = outlineGroup.Contains(this);
|
|
if (flag3)
|
|
{
|
|
break;
|
|
}
|
|
groupIndex2 = groupIndex;
|
|
}
|
|
base.sheet.SetRowsHeight(base.Start, base.Count, delegate(int r)
|
|
{
|
|
Func<ReoGridOutline, bool> callFunc = null;
|
|
for (int i = groupIndex + 1; i < outlines.Count - 1; i++)
|
|
{
|
|
OutlineGroup<ReoGridOutline> outlineGroup2 = outlines[i];
|
|
IEnumerable<ReoGridOutline> source = outlineGroup2;
|
|
Func<ReoGridOutline, bool> predicate;
|
|
if ((predicate = callFunc) == null)
|
|
{
|
|
predicate = (callFunc = ((ReoGridOutline o) => o.InternalCollapsed && o != this && o.Start <= r && o.End > r));
|
|
}
|
|
ReoGridOutline reoGridOutline = source.FirstOrDefault(predicate);
|
|
bool flag4 = reoGridOutline != null;
|
|
if (flag4)
|
|
{
|
|
return -1;
|
|
}
|
|
}
|
|
return 0;
|
|
}, false);
|
|
base.CollapseInnerOutlines(outlines, groupIndex);
|
|
base.InternalCollapsed = true;
|
|
this.RaiseAfterCollapseEvent();
|
|
}
|
|
}
|
|
}
|
|
|
|
internal override bool RaiseBeforeCollapseEvent()
|
|
{
|
|
BeforeOutlineCollapseEventArgs beforeOutlineCollapseEventArgs = new BeforeOutlineCollapseEventArgs(this);
|
|
bool flag = this.BeforeCollapse != null;
|
|
if (flag)
|
|
{
|
|
this.BeforeCollapse(this, beforeOutlineCollapseEventArgs);
|
|
}
|
|
base.sheet.RaiseBeforeOutlineCollapseEvent(beforeOutlineCollapseEventArgs);
|
|
return !beforeOutlineCollapseEventArgs.IsCancelled;
|
|
}
|
|
|
|
internal override void RaiseAfterCollapseEvent()
|
|
{
|
|
AfterOutlineCollapseEventArgs afterOutlineCollapseEventArgs = new AfterOutlineCollapseEventArgs(this);
|
|
bool flag = this.AfterCollapse != null;
|
|
if (flag)
|
|
{
|
|
this.AfterCollapse(this, afterOutlineCollapseEventArgs);
|
|
}
|
|
base.sheet.RaiseAfterOutlineCollapseEvent(afterOutlineCollapseEventArgs);
|
|
}
|
|
|
|
public override void Expand()
|
|
{
|
|
OutlineCollection<ReoGridOutline> outlines = base.sheet.GetOutlines(RowOrColumn.Row);
|
|
bool flag = outlines == null;
|
|
if (!flag)
|
|
{
|
|
bool flag2 = !this.RaiseBeforeExpandingEvent();
|
|
if (!flag2)
|
|
{
|
|
int groupIndex;
|
|
int groupIndex2;
|
|
for (groupIndex = 0; groupIndex < outlines.Count - 1; groupIndex = groupIndex2 + 1)
|
|
{
|
|
OutlineGroup<ReoGridOutline> outlineGroup = outlines[groupIndex];
|
|
bool flag3 = outlineGroup.Contains(this);
|
|
if (flag3)
|
|
{
|
|
break;
|
|
}
|
|
groupIndex2 = groupIndex;
|
|
}
|
|
base.ExpandOuterOutlines(outlines, groupIndex);
|
|
base.sheet.SetRowsHeight(base.Start, base.Count, delegate(int r)
|
|
{
|
|
Func<ReoGridOutline, bool> callFunc = null;
|
|
for (int i = groupIndex + 1; i < outlines.Count - 1; i++)
|
|
{
|
|
OutlineGroup<ReoGridOutline> outlineGroup2 = outlines[i];
|
|
IEnumerable<ReoGridOutline> source = outlineGroup2;
|
|
Func<ReoGridOutline, bool> predicate;
|
|
if ((predicate = callFunc) == null)
|
|
{
|
|
predicate = (callFunc = ((ReoGridOutline o) => o.Start <= r && o.End > r));
|
|
}
|
|
ReoGridOutline reoGridOutline = source.FirstOrDefault(predicate);
|
|
bool flag4 = reoGridOutline != null && reoGridOutline.InternalCollapsed;
|
|
if (flag4)
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
RowHeader rowHeader = this.sheet.RetrieveRowHeader(r);
|
|
return (int)(rowHeader.IsVisible ? rowHeader.InnerHeight : rowHeader.LastHeight);
|
|
}, false);
|
|
base.InternalCollapsed = false;
|
|
this.RaiseAfterExpandingEvent();
|
|
}
|
|
}
|
|
}
|
|
|
|
public int Row
|
|
{
|
|
get
|
|
{
|
|
return base.Start;
|
|
}
|
|
set
|
|
{
|
|
base.Start = value;
|
|
}
|
|
}
|
|
|
|
public int Rows
|
|
{
|
|
get
|
|
{
|
|
return base.Count;
|
|
}
|
|
set
|
|
{
|
|
base.Count = value;
|
|
}
|
|
}
|
|
|
|
public int EndRow
|
|
{
|
|
get
|
|
{
|
|
return base.End - 1;
|
|
}
|
|
}
|
|
|
|
internal override bool RaiseBeforeExpandingEvent()
|
|
{
|
|
BeforeOutlineExpandingEventArgs beforeOutlineExpandingEventArgs = new BeforeOutlineExpandingEventArgs(this);
|
|
bool flag = this.BeforeExpand != null;
|
|
if (flag)
|
|
{
|
|
this.BeforeExpand(this, beforeOutlineExpandingEventArgs);
|
|
}
|
|
base.sheet.RaiseBeforeOutlineExpandEvent(beforeOutlineExpandingEventArgs);
|
|
return !beforeOutlineExpandingEventArgs.IsCancelled;
|
|
}
|
|
|
|
internal override void RaiseAfterExpandingEvent()
|
|
{
|
|
AfterOutlineExpandingEventArgs afterOutlineExpandingEventArgs = new AfterOutlineExpandingEventArgs(this);
|
|
bool flag = this.AfterExpand != null;
|
|
if (flag)
|
|
{
|
|
this.AfterExpand(this, afterOutlineExpandingEventArgs);
|
|
}
|
|
base.sheet.RaiseAfterOutlineExpandEvent(afterOutlineExpandingEventArgs);
|
|
}
|
|
|
|
//[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
public override event EventHandler<BeforeOutlineCollapseEventArgs> BeforeCollapse;
|
|
|
|
//[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
public override event EventHandler<AfterOutlineCollapseEventArgs> AfterCollapse;
|
|
|
|
//[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
public override event EventHandler<BeforeOutlineExpandingEventArgs> BeforeExpand;
|
|
|
|
//[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
public override event EventHandler<AfterOutlineExpandingEventArgs> AfterExpand;
|
|
}
|
|
}
|