79 lines
1.5 KiB
C#
79 lines
1.5 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
|
|
namespace CPF.ReoGrid.Print
|
|
{
|
|
internal class PrintSessionWorksheetCollection : ICollection<Worksheet>, IEnumerable<Worksheet>, IEnumerable
|
|
{
|
|
internal PrintSessionWorksheetCollection(PrintSession session)
|
|
{
|
|
this.session = session;
|
|
}
|
|
|
|
public void Add(Worksheet worksheet)
|
|
{
|
|
this.CheckInPrinting();
|
|
this.session.worksheets.Add(worksheet);
|
|
}
|
|
|
|
public void Clear()
|
|
{
|
|
this.CheckInPrinting();
|
|
}
|
|
|
|
public bool Contains(Worksheet worksheet)
|
|
{
|
|
return this.session.worksheets.Contains(worksheet);
|
|
}
|
|
|
|
public void CopyTo(Worksheet[] array, int arrayIndex)
|
|
{
|
|
this.session.worksheets.CopyTo(array, arrayIndex);
|
|
}
|
|
|
|
public int Count
|
|
{
|
|
get
|
|
{
|
|
return this.session.worksheets.Count;
|
|
}
|
|
}
|
|
|
|
public bool IsReadOnly
|
|
{
|
|
get
|
|
{
|
|
return this.session.IsPrinting;
|
|
}
|
|
}
|
|
|
|
public bool Remove(Worksheet worksheet)
|
|
{
|
|
this.CheckInPrinting();
|
|
return this.session.worksheets.Remove(worksheet);
|
|
}
|
|
|
|
private void CheckInPrinting()
|
|
{
|
|
bool isPrinting = this.session.IsPrinting;
|
|
if (isPrinting)
|
|
{
|
|
throw new InvalidOperationException("Cannot modify worksheet collection during printing.");
|
|
}
|
|
}
|
|
|
|
public IEnumerator<Worksheet> GetEnumerator()
|
|
{
|
|
return this.session.worksheets.GetEnumerator();
|
|
}
|
|
|
|
IEnumerator IEnumerable.GetEnumerator()
|
|
{
|
|
return this.session.worksheets.GetEnumerator();
|
|
}
|
|
|
|
private PrintSession session;
|
|
}
|
|
}
|