ClientAnchor.java 源代码
package jxl.biff.drawing;
import common.Logger;
import jxl.biff.IntegerHelper;
public class ClientAnchor extends EscherAtom {
static Class class$jxl$biff$drawing$ClientAnchor;
private static final Logger logger;
private byte[] data;
private int properties;
private double x1;
private double x2;
private double y1;
private double y2;
static {
Class cls = class$jxl$biff$drawing$ClientAnchor;
if (cls == null) {
cls = class$("jxl.biff.drawing.ClientAnchor");
class$jxl$biff$drawing$ClientAnchor = cls;
}
logger = Logger.getLogger(cls);
}
static Class class$(String str) {
try {
return Class.forName(str);
} catch (ClassNotFoundException e) {
throw new NoClassDefFoundError(e.getMessage());
}
}
public ClientAnchor(EscherRecordData escherRecordData) {
super(escherRecordData);
byte[] bytes = getBytes();
this.properties = IntegerHelper.getInt(bytes[0], bytes[1]);
this.x1 = IntegerHelper.getInt(bytes[2], bytes[3]) + (IntegerHelper.getInt(bytes[4], bytes[5]) / 1024.0d);
this.y1 = IntegerHelper.getInt(bytes[6], bytes[7]) + (IntegerHelper.getInt(bytes[8], bytes[9]) / 256.0d);
this.x2 = IntegerHelper.getInt(bytes[10], bytes[11]) + (IntegerHelper.getInt(bytes[12], bytes[13]) / 1024.0d);
this.y2 = IntegerHelper.getInt(bytes[14], bytes[15]) + (IntegerHelper.getInt(bytes[16], bytes[17]) / 256.0d);
}
public ClientAnchor(double d, double d2, double d3, double d4, int i) {
super(EscherRecordType.CLIENT_ANCHOR);
this.x1 = d;
this.y1 = d2;
this.x2 = d3;
this.y2 = d4;
this.properties = i;
}
@Override
public byte[] getData() {
byte[] bArr = new byte[18];
this.data = bArr;
IntegerHelper.getTwoBytes(this.properties, bArr, 0);
IntegerHelper.getTwoBytes((int) this.x1, this.data, 2);
IntegerHelper.getTwoBytes((int) ((this.x1 - ((int) r0)) * 1024.0d), this.data, 4);
IntegerHelper.getTwoBytes((int) this.y1, this.data, 6);
IntegerHelper.getTwoBytes((int) ((this.y1 - ((int) r0)) * 256.0d), this.data, 8);
IntegerHelper.getTwoBytes((int) this.x2, this.data, 10);
IntegerHelper.getTwoBytes((int) ((this.x2 - ((int) r0)) * 1024.0d), this.data, 12);
IntegerHelper.getTwoBytes((int) this.y2, this.data, 14);
IntegerHelper.getTwoBytes((int) ((this.y2 - ((int) r0)) * 256.0d), this.data, 16);
return setHeaderData(this.data);
}
public double getX1() {
return this.x1;
}
public double getY1() {
return this.y1;
}
public double getX2() {
return this.x2;
}
public double getY2() {
return this.y2;
}
public int getProperties() {
return this.properties;
}
}