52 lines
1.4 KiB
Java
52 lines
1.4 KiB
Java
package jxl.biff;
|
|
|
|
import common.Logger;
|
|
|
|
public class DValParser {
|
|
private static Logger logger = Logger.getLogger(DValParser.class);
|
|
|
|
private static int PROMPT_BOX_VISIBLE_MASK = 1;
|
|
|
|
private static int PROMPT_BOX_AT_CELL_MASK = 2;
|
|
|
|
private static int VALIDITY_DATA_CACHED_MASK = 4;
|
|
|
|
private boolean promptBoxVisible;
|
|
|
|
private boolean promptBoxAtCell;
|
|
|
|
private boolean validityDataCached;
|
|
|
|
private int numDVRecords;
|
|
|
|
public DValParser(byte[] data) {
|
|
int options = IntegerHelper.getInt(data[0], data[1]);
|
|
this.promptBoxVisible = ((options & PROMPT_BOX_VISIBLE_MASK) != 0);
|
|
this.promptBoxAtCell = ((options & PROMPT_BOX_AT_CELL_MASK) != 0);
|
|
this.validityDataCached = ((options & VALIDITY_DATA_CACHED_MASK) != 0);
|
|
this.numDVRecords = IntegerHelper.getInt(data[14], data[15], data[16], data[17]);
|
|
}
|
|
|
|
public byte[] getData() {
|
|
byte[] data = new byte[18];
|
|
int options = 0;
|
|
if (this.promptBoxVisible)
|
|
options |= PROMPT_BOX_VISIBLE_MASK;
|
|
if (this.promptBoxAtCell)
|
|
options |= PROMPT_BOX_AT_CELL_MASK;
|
|
if (this.validityDataCached)
|
|
options |= VALIDITY_DATA_CACHED_MASK;
|
|
IntegerHelper.getFourBytes(-1, data, 10);
|
|
IntegerHelper.getFourBytes(this.numDVRecords, data, 14);
|
|
return data;
|
|
}
|
|
|
|
public void dvRemoved() {
|
|
this.numDVRecords--;
|
|
}
|
|
|
|
public int getNumberOfDVRecords() {
|
|
return this.numDVRecords;
|
|
}
|
|
}
|