1 16 17 package org.apache.poi.hssf.model; 18 19 import java.util.ArrayList ; 20 import java.util.Iterator ; 21 import java.util.List ; 22 23 import org.apache.poi.hssf.record.NameRecord; 24 import org.apache.poi.hssf.record.Record; 25 26 public class WorkbookRecordList 27 { 28 private List records = new ArrayList (); 29 30 private int protpos = 0; private int bspos = 0; private int tabpos = 0; private int fontpos = 0; private int xfpos = 0; private int backuppos = 0; private int namepos = 0; private int supbookpos = 0; private int externsheetPos = 0; private int palettepos = -1; 41 42 public void setRecords( List records ) 43 { 44 this.records = records; 45 } 46 47 public int size() 48 { 49 return records.size(); 50 } 51 52 public Record get( int i ) 53 { 54 return (Record) records.get(i); 55 } 56 57 public void add( int pos, Record r ) 58 { 59 records.add(pos, r); 60 if (getProtpos() >= pos) setProtpos( protpos + 1 ); 61 if (getBspos() >= pos) setBspos( bspos + 1 ); 62 if (getTabpos() >= pos) setTabpos( tabpos + 1 ); 63 if (getFontpos() >= pos) setFontpos( fontpos + 1 ); 64 if (getXfpos() >= pos) setXfpos( xfpos + 1 ); 65 if (getBackuppos() >= pos) setBackuppos( backuppos + 1 ); 66 if (getNamepos() >= pos) setNamepos(namepos+1); 67 if (getSupbookpos() >= pos) setSupbookpos(supbookpos+1); 68 if ((getPalettepos() != -1) && (getPalettepos() >= pos)) setPalettepos( palettepos + 1 ); 69 if (getExternsheetPos() >= pos) setExternsheetPos(getExternsheetPos() + 1); 70 } 71 72 public List getRecords() 73 { 74 return records; 75 } 76 77 public Iterator iterator() 78 { 79 return records.iterator(); 80 } 81 82 public void remove( int pos ) 83 { 84 records.remove(pos); 85 if (getProtpos() >= pos) setProtpos( protpos - 1 ); 86 if (getBspos() >= pos) setBspos( bspos - 1 ); 87 if (getTabpos() >= pos) setTabpos( tabpos - 1 ); 88 if (getFontpos() >= pos) setFontpos( fontpos - 1 ); 89 if (getXfpos() >= pos) setXfpos( xfpos - 1 ); 90 if (getBackuppos() >= pos) setBackuppos( backuppos - 1 ); 91 if (getNamepos() >= pos) setNamepos(getNamepos()-1); 92 if (getSupbookpos() >= pos) setSupbookpos(getSupbookpos()-1); 93 if ((getPalettepos() != -1) && (getPalettepos() >= pos)) setPalettepos( palettepos - 1 ); 94 if (getExternsheetPos() >= pos) setExternsheetPos( getExternsheetPos() -1); 95 } 96 97 public int getProtpos() 98 { 99 return protpos; 100 } 101 102 public void setProtpos( int protpos ) 103 { 104 this.protpos = protpos; 105 } 106 107 public int getBspos() 108 { 109 return bspos; 110 } 111 112 public void setBspos( int bspos ) 113 { 114 this.bspos = bspos; 115 } 116 117 public int getTabpos() 118 { 119 return tabpos; 120 } 121 122 public void setTabpos( int tabpos ) 123 { 124 this.tabpos = tabpos; 125 } 126 127 public int getFontpos() 128 { 129 return fontpos; 130 } 131 132 public void setFontpos( int fontpos ) 133 { 134 this.fontpos = fontpos; 135 } 136 137 public int getXfpos() 138 { 139 return xfpos; 140 } 141 142 public void setXfpos( int xfpos ) 143 { 144 this.xfpos = xfpos; 145 } 146 147 public int getBackuppos() 148 { 149 return backuppos; 150 } 151 152 public void setBackuppos( int backuppos ) 153 { 154 this.backuppos = backuppos; 155 } 156 157 public int getPalettepos() 158 { 159 return palettepos; 160 } 161 162 public void setPalettepos( int palettepos ) 163 { 164 this.palettepos = palettepos; 165 } 166 167 168 172 public int getNamepos() { 173 return namepos; 174 } 175 176 180 public int getSupbookpos() { 181 return supbookpos; 182 } 183 184 188 public void setNamepos(int namepos) { 189 this.namepos = namepos; 190 } 191 192 196 public void setSupbookpos(int supbookpos) { 197 this.supbookpos = supbookpos; 198 } 199 200 204 public int getExternsheetPos() { 205 return externsheetPos; 206 } 207 208 212 public void setExternsheetPos(int externsheetPos) { 213 this.externsheetPos = externsheetPos; 214 } 215 216 } 217 | Popular Tags |