1 19 20 package jxl.read.biff; 21 22 import common.Logger; 23 24 import jxl.WorkbookSettings; 25 import jxl.biff.IntegerHelper; 26 import jxl.biff.RecordData; 27 28 32 public class ExternalSheetRecord extends RecordData 33 { 34 37 private static Logger logger = Logger.getLogger(ExternalSheetRecord.class); 38 39 42 private static class Biff7 {}; 43 public static Biff7 biff7 = new Biff7(); 44 45 48 private static class XTI 49 { 50 53 int supbookIndex; 54 57 int firstTab; 58 61 int lastTab; 62 63 70 XTI(int s, int f, int l) 71 { 72 supbookIndex = s; 73 firstTab = f; 74 lastTab = l; 75 } 76 } 77 78 81 private XTI[] xtiArray; 82 83 89 ExternalSheetRecord(Record t, WorkbookSettings ws) 90 { 91 super(t); 92 byte[] data = getRecord().getData(); 93 94 int numxtis = IntegerHelper.getInt(data[0], data[1]); 95 96 if (data.length < numxtis * 6 + 2) 97 { 98 xtiArray = new XTI[0]; 99 logger.warn("Could not process external sheets. Formulas may " + 100 "be compromised."); 101 return; 102 } 103 104 xtiArray = new XTI[numxtis]; 105 106 int pos = 2; 107 for (int i = 0; i < numxtis; i++) 108 { 109 int s = IntegerHelper.getInt(data[pos], data[pos + 1]); 110 int f = IntegerHelper.getInt(data[pos + 2], data[pos + 3]); 111 int l = IntegerHelper.getInt(data[pos + 4], data[pos + 5]); 112 xtiArray[i] = new XTI(s, f, l); 113 pos += 6; 114 } 115 } 116 117 125 ExternalSheetRecord(Record t, WorkbookSettings settings, Biff7 dummy) 126 { 127 super(t); 128 129 logger.warn("External sheet record for Biff 7 not supported"); 130 } 131 132 136 public int getNumRecords() 137 { 138 return xtiArray != null ? xtiArray.length : 0; 139 } 140 146 public int getSupbookIndex(int index) 147 { 148 return xtiArray[index].supbookIndex; 149 } 150 151 157 public int getFirstTabIndex(int index) 158 { 159 return xtiArray[index].firstTab; 160 } 161 162 168 public int getLastTabIndex(int index) 169 { 170 return xtiArray[index].lastTab; 171 } 172 173 178 public byte[] getData() 179 { 180 return getRecord().getData(); 181 } 182 } 183 184 185 186 187 188 189 190 191 192 | Popular Tags |