/* ====================================================================
Licensed to the Apache Software Foundation (ASF) Under one or more
contributor license agreements. See the NOTICE file distributed with
this work for Additional information regarding copyright ownership.
The ASF licenses this file to You Under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed Under the License is distributed on an "AS Is" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations Under the License.
==================================================================== */
namespace HH.WMS.Utils.NPOI.HSSF.Model
{
using System;
using System.Text;
using System.Collections;
using HH.WMS.Utils.NPOI.Util;
using HH.WMS.Utils.NPOI.HSSF.Record;
using System.Collections.Generic;
///
/// List for records in Workbook
///
public class WorkbookRecordList
{
private List records = new List();
private int protpos = 0; // holds the position of the protect record.
private int bspos = 0; // holds the position of the last bound sheet.
private int tabpos = 0; // holds the position of the tabid record
private int fontpos = 0; // hold the position of the last font record
private int xfpos = 0; // hold the position of the last extended font record
private int backuppos = 0; // holds the position of the backup record.
private int namepos = 0; // holds the position of last name record
private int supbookpos = 0; // holds the position of sup book
private int externsheetPos = 0;// holds the position of the extern sheet
private int palettepos = -1; // hold the position of the palette, if applicable
///
/// Gets or sets the records.
///
/// The records.
public List Records
{
get { return records; }
set { this.records = value; }
}
///
/// Gets the count.
///
/// The count.
public int Count
{
get { return records.Count; }
}
///
/// Gets the at the specified index.
///
///
public Record this[int index]
{
get { return (Record)records[index]; }
}
///
/// Adds the specified pos.
///
/// The pos.
/// The r.
public void Add(int pos, Record r)
{
records.Insert(pos, r);
if (Protpos >= pos) Protpos=(protpos + 1);
if (Bspos >= pos) Bspos=(bspos + 1);
if (Tabpos >= pos) Tabpos=(tabpos + 1);
if (Fontpos >= pos) Fontpos=(fontpos + 1);
if (Xfpos >= pos) Xfpos=(xfpos + 1);
if (Backuppos >= pos) Backuppos=(backuppos + 1);
if (Namepos>= pos) Namepos=(namepos + 1);
if (Supbookpos >= pos) Supbookpos=(supbookpos + 1);
if ((Palettepos!= -1) && (Palettepos>= pos)) Palettepos=(palettepos + 1);
if (ExternsheetPos >= pos) ExternsheetPos=ExternsheetPos + 1;
}
public IEnumerator GetEnumerator()
{
return records.GetEnumerator();
}
///
/// Removes the specified record.
///
/// The record.
public void Remove(Record record)
{
int i = records.IndexOf(record);
this.Remove(i);
}
///
/// Removes the specified position.
///
/// The position.
public void Remove(int pos)
{
records.RemoveAt(pos);
if (Protpos >= pos) Protpos=protpos - 1;
if (Bspos >= pos) Bspos=bspos - 1;
if (Tabpos >= pos) Tabpos=tabpos - 1;
if (Fontpos >= pos) Fontpos=fontpos - 1;
if (Xfpos >= pos) Xfpos=xfpos - 1;
if (Backuppos >= pos) Backuppos=backuppos - 1;
if (Namepos >= pos) Namepos=Namepos - 1;
if (Supbookpos >= pos) Supbookpos=Supbookpos - 1;
if ((Palettepos != -1) && (Palettepos >= pos)) Palettepos=palettepos - 1;
if (ExternsheetPos >= pos) ExternsheetPos=ExternsheetPos- 1;
}
///
/// Gets or sets the protpos.
///
/// The protpos.
public int Protpos
{
get { return protpos; }
set { this.protpos = value; }
}
///
/// Gets or sets the bspos.
///
/// The bspos.
public int Bspos
{
get{return bspos;}
set { this.bspos = value; }
}
///
/// Gets or sets the tabpos.
///
/// The tabpos.
public int Tabpos
{
get { return tabpos; }
set { this.tabpos =value; }
}
///
/// Gets or sets the fontpos.
///
/// The fontpos.
public int Fontpos
{
get { return fontpos; }
set { this.fontpos = value; }
}
///
/// Gets or sets the xfpos.
///
/// The xfpos.
public int Xfpos
{
get { return xfpos; }
set { this.xfpos = value; }
}
///
/// Gets or sets the backuppos.
///
/// The backuppos.
public int Backuppos
{
get{return backuppos;}
set { this.backuppos = value; }
}
///
/// Gets or sets the palettepos.
///
/// The palettepos.
public int Palettepos
{
get{return palettepos;}
set { this.palettepos = value; }
}
///
/// Gets or sets the namepos.
///
/// The namepos.
public int Namepos
{
get { return namepos; }
set { this.namepos = value; }
}
///
/// Gets or sets the supbookpos.
///
/// The supbookpos.
public int Supbookpos
{
get{return supbookpos;}
set { this.supbookpos = value; }
}
///
/// Gets or sets the externsheet pos.
///
/// The externsheet pos.
public int ExternsheetPos
{
get { return externsheetPos; }
set { this.externsheetPos = value; }
}
}
}