1 19 20 package jxl.biff; 21 22 import common.Logger; 23 import jxl.WorkbookSettings; 24 import jxl.biff.formula.ExternalSheet; 25 import jxl.biff.formula.FormulaParser; 26 import jxl.biff.formula.FormulaException; 27 28 32 public class DValParser 33 { 34 37 private static Logger logger = Logger.getLogger(DValParser.class); 38 39 private static int PROMPT_BOX_VISIBLE_MASK = 0x1; 41 private static int PROMPT_BOX_AT_CELL_MASK = 0x2; 42 private static int VALIDITY_DATA_CACHED_MASK = 0x4; 43 44 47 private boolean promptBoxVisible; 48 49 52 private boolean promptBoxAtCell; 53 54 57 private boolean validityDataCached; 58 59 62 private int numDVRecords; 63 64 67 public DValParser(byte[] data) 68 { 69 int options = IntegerHelper.getInt(data[0], data[1]); 70 71 promptBoxVisible = (options & PROMPT_BOX_VISIBLE_MASK) != 0; 72 promptBoxAtCell = (options & PROMPT_BOX_AT_CELL_MASK) != 0; 73 validityDataCached = (options & VALIDITY_DATA_CACHED_MASK) != 0; 74 75 numDVRecords = IntegerHelper.getInt(data[14], data[15], 76 data[16], data[17]); 77 } 78 79 82 public byte[] getData() 83 { 84 byte[] data = new byte[18]; 85 86 int options = 0; 87 88 if (promptBoxVisible) 89 { 90 options |= PROMPT_BOX_VISIBLE_MASK; 91 } 92 93 if (promptBoxAtCell) 94 { 95 options |= PROMPT_BOX_AT_CELL_MASK; 96 } 97 98 if (validityDataCached) 99 { 100 options |= VALIDITY_DATA_CACHED_MASK; 101 } 102 103 IntegerHelper.getFourBytes(0xffffffff, data, 10); 104 105 IntegerHelper.getFourBytes(numDVRecords, data, 14); 106 107 return data; 108 } 109 110 114 public void dvRemoved() 115 { 116 numDVRecords--; 117 } 118 119 124 public int getNumberOfDVRecords() 125 { 126 return numDVRecords; 127 } 128 } 129 | Popular Tags |