📄 externalsheetrecord.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: ExternalSheetRecord.java
package jxl.write.biff;
import java.util.ArrayList;
import java.util.Iterator;
import jxl.biff.IntegerHelper;
import jxl.biff.Type;
import jxl.biff.WritableRecordData;
class ExternalSheetRecord extends WritableRecordData
{
private static class XTI
{
int supbookIndex;
int firstTab;
int lastTab;
void sheetInserted(int index)
{
if(firstTab >= index)
firstTab++;
if(lastTab >= index)
lastTab++;
}
void sheetRemoved(int index)
{
if(firstTab == index)
firstTab = 0;
if(lastTab == index)
lastTab = 0;
if(firstTab > index)
firstTab--;
if(lastTab > index)
lastTab--;
}
XTI(int s, int f, int l)
{
supbookIndex = s;
firstTab = f;
lastTab = l;
}
}
private byte data[];
private ArrayList xtis;
public ExternalSheetRecord(jxl.read.biff.ExternalSheetRecord esf)
{
super(Type.EXTERNSHEET);
xtis = new ArrayList(esf.getNumRecords());
XTI xti = null;
for(int i = 0; i < esf.getNumRecords(); i++)
{
xti = new XTI(esf.getSupbookIndex(i), esf.getFirstTabIndex(i), esf.getLastTabIndex(i));
xtis.add(xti);
}
}
public ExternalSheetRecord()
{
super(Type.EXTERNSHEET);
xtis = new ArrayList();
}
int getIndex(int supbookind, int sheetind)
{
Iterator i = xtis.iterator();
XTI xti = null;
boolean found = false;
int pos = 0;
while(i.hasNext() && !found)
{
xti = (XTI)i.next();
if(xti.supbookIndex == supbookind && xti.firstTab == sheetind)
found = true;
else
pos++;
}
if(!found)
{
xti = new XTI(supbookind, sheetind, sheetind);
xtis.add(xti);
pos = xtis.size() - 1;
}
return pos;
}
public byte[] getData()
{
byte data[] = new byte[2 + xtis.size() * 6];
int pos = 0;
IntegerHelper.getTwoBytes(xtis.size(), data, 0);
pos += 2;
Iterator i = xtis.iterator();
XTI xti = null;
while(i.hasNext())
{
xti = (XTI)i.next();
IntegerHelper.getTwoBytes(xti.supbookIndex, data, pos);
IntegerHelper.getTwoBytes(xti.firstTab, data, pos + 2);
IntegerHelper.getTwoBytes(xti.lastTab, data, pos + 4);
pos += 6;
}
return data;
}
public int getSupbookIndex(int index)
{
return ((XTI)xtis.get(index)).supbookIndex;
}
public int getFirstTabIndex(int index)
{
return ((XTI)xtis.get(index)).firstTab;
}
public int getLastTabIndex(int index)
{
return ((XTI)xtis.get(index)).lastTab;
}
void sheetInserted(int index)
{
XTI xti = null;
for(Iterator i = xtis.iterator(); i.hasNext(); xti.sheetInserted(index))
xti = (XTI)i.next();
}
void sheetRemoved(int index)
{
XTI xti = null;
for(Iterator i = xtis.iterator(); i.hasNext(); xti.sheetRemoved(index))
xti = (XTI)i.next();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -