1 19 20 package jxl.read.biff; 21 22 import common.Logger; 23 24 import jxl.Cell; 25 import jxl.CellFeatures; 26 import jxl.format.CellFormat; 27 import jxl.biff.IntegerHelper; 28 import jxl.biff.RecordData; 29 import jxl.biff.XFRecord; 30 import jxl.biff.FormattingRecords; 31 32 35 public abstract class CellValue extends RecordData 36 implements Cell, CellFeaturesAccessor 37 { 38 41 private static Logger logger = Logger.getLogger(CellValue.class); 42 43 46 private int row; 47 48 51 private int column; 52 53 56 private int xfIndex; 57 58 62 private FormattingRecords formattingRecords; 63 64 67 private boolean initialized; 68 69 72 private XFRecord format; 73 74 77 private SheetImpl sheet; 78 79 82 private CellFeatures features; 83 84 91 protected CellValue(Record t, FormattingRecords fr, SheetImpl si) 92 { 93 super(t); 94 byte[] data = getRecord().getData(); 95 row = IntegerHelper.getInt(data[0], data[1]); 96 column = IntegerHelper.getInt(data[2], data[3]); 97 xfIndex = IntegerHelper.getInt(data[4], data[5]); 98 sheet = si; 99 formattingRecords = fr; 100 initialized = false; 101 } 102 103 108 public final int getRow() 109 { 110 return row; 111 } 112 113 118 public final int getColumn() 119 { 120 return column; 121 } 122 123 129 public final int getXFIndex() 130 { 131 return xfIndex; 132 } 133 134 140 public CellFormat getCellFormat() 141 { 142 if (!initialized) 143 { 144 format = formattingRecords.getXFRecord(xfIndex); 145 initialized = true; 146 } 147 148 return format; 149 } 150 151 156 public boolean isHidden() 157 { 158 ColumnInfoRecord cir = sheet.getColumnInfo(column); 159 160 if (cir != null && (cir.getWidth() == 0 || cir.getHidden())) 161 { 162 return true; 163 } 164 165 RowRecord rr = sheet.getRowInfo(row); 166 167 if (rr != null && (rr.getRowHeight() == 0 || rr.isCollapsed())) 168 { 169 return true; 170 } 171 172 return false; 173 } 174 175 180 protected SheetImpl getSheet() 181 { 182 return sheet; 183 } 184 185 190 public CellFeatures getCellFeatures() 191 { 192 return features; 193 } 194 195 200 public void setCellFeatures(CellFeatures cf) 201 { 202 if (features != null) 203 { 204 logger.warn("current cell features not null - overwriting"); 205 } 206 207 features = cf; 208 } 209 } 210 211 | Popular Tags |