1 2 17 18 19 package org.apache.poi.hwpf.usermodel; 20 21 import org.apache.poi.util.BitField; 22 import org.apache.poi.util.LittleEndian; 23 24 public class BorderCode 25 implements Cloneable 26 { 27 public static final int SIZE = 4; 28 private short _info; 29 private final static BitField _dptLineWidth = new BitField(0xff); 30 private final static BitField _brcType = new BitField(0xff00); 31 private short _info2; 32 private final static BitField _ico = new BitField(0xff); 33 private final static BitField _dptDpace = new BitField(0x1f00); 34 private final static BitField _fShadow = new BitField(0x2000); 35 private final static BitField _fFrame = new BitField(0x4000); 36 37 public BorderCode() 38 { 39 } 40 41 public BorderCode(byte[] buf, int offset) 42 { 43 _info = LittleEndian.getShort(buf, offset); 44 _info2 = LittleEndian.getShort(buf, offset + LittleEndian.SHORT_SIZE); 45 } 46 47 public void serialize(byte[] buf, int offset) 48 { 49 LittleEndian.putShort(buf, offset, _info); 50 LittleEndian.putShort(buf, offset + LittleEndian.SHORT_SIZE, _info2); 51 } 52 53 public int toInt() 54 { 55 byte[] buf = new byte[4]; 56 serialize(buf, 0); 57 return LittleEndian.getInt(buf); 58 } 59 60 public boolean isEmpty() 61 { 62 return _info == 0 && _info2 == 0; 63 } 64 65 public boolean equals(Object o) 66 { 67 BorderCode brc = (BorderCode)o; 68 return _info == brc._info && _info2 == brc._info2; 69 } 70 71 public Object clone() 72 throws CloneNotSupportedException 73 { 74 return super.clone(); 75 } 76 } 77 | Popular Tags |