1 19 20 package jxl.write.biff; 21 22 import common.Assert; 23 import jxl.BooleanCell; 24 import jxl.CellType; 25 import jxl.format.CellFormat; 26 import jxl.biff.Type; 27 28 31 public abstract class BooleanRecord extends CellValue 32 { 33 37 private boolean value; 38 39 46 protected BooleanRecord(int c, int r, boolean val) 47 { 48 super(Type.BOOLERR, c, r); 49 value = val; 50 } 51 52 61 protected BooleanRecord(int c, int r, boolean val, CellFormat st) 62 { 63 super(Type.BOOLERR, c, r, st); 64 value = val; 65 } 66 67 72 protected BooleanRecord(BooleanCell nc) 73 { 74 super(Type.BOOLERR, nc); 75 value = nc.getValue(); 76 } 77 78 85 protected BooleanRecord(int c, int r, BooleanRecord br) 86 { 87 super(Type.BOOLERR, c, r, br); 88 value = br.value; 89 } 90 91 99 public boolean getValue() 100 { 101 return value; 102 } 103 104 109 public String getContents() 110 { 111 return (new Boolean (value)).toString(); 113 } 114 115 120 public CellType getType() 121 { 122 return CellType.BOOLEAN; 123 } 124 125 130 protected void setValue(boolean val) 131 { 132 value = val; 133 } 134 135 140 public byte[] getData() 141 { 142 byte[] celldata = super.getData(); 143 byte[] data = new byte[celldata.length + 2]; 144 System.arraycopy(celldata, 0, data, 0, celldata.length); 145 146 if (value) 147 { 148 data[celldata.length] = 1; 149 } 150 151 return data; 152 } 153 154 } 155 156 157 158 159 160 161 | Popular Tags |