1 2 17 18 19 20 package org.apache.poi.hwpf.model; 21 22 import java.io.OutputStream ; 23 import java.io.IOException ; 24 25 import org.apache.poi.util.BitField; 26 import org.apache.poi.util.LittleEndian; 27 28 public class ParagraphHeight 29 { 30 private short infoField; 31 private BitField fSpare = new BitField(0x0001); 32 private BitField fUnk = new BitField(0x0002); 33 private BitField fDiffLines = new BitField(0x0004); 34 private BitField clMac = new BitField(0xff00); 35 private short reserved; 36 private int dxaCol; 37 private int dymLineOrHeight; 38 39 public ParagraphHeight(byte[] buf, int offset) 40 { 41 infoField = LittleEndian.getShort(buf, offset); 42 offset += LittleEndian.SHORT_SIZE; 43 reserved = LittleEndian.getShort(buf, offset); 44 offset += LittleEndian.SHORT_SIZE; 45 dxaCol = LittleEndian.getInt(buf, offset); 46 offset += LittleEndian.INT_SIZE; 47 dymLineOrHeight = LittleEndian.getInt(buf, offset); 48 } 49 50 public ParagraphHeight() 51 { 52 53 } 54 55 public void write(OutputStream out) 56 throws IOException 57 { 58 out.write(toByteArray()); 59 } 60 61 protected byte[] toByteArray() 62 { 63 byte[] buf = new byte[12]; 64 int offset = 0; 65 LittleEndian.putShort(buf, offset, infoField); 66 offset += LittleEndian.SHORT_SIZE; 67 LittleEndian.putShort(buf, offset, reserved); 68 offset += LittleEndian.SHORT_SIZE; 69 LittleEndian.putInt(buf, offset, dxaCol); 70 offset += LittleEndian.INT_SIZE; 71 LittleEndian.putInt(buf, offset, dymLineOrHeight); 72 73 return buf; 74 } 75 76 public boolean equals(Object o) 77 { 78 ParagraphHeight ph = (ParagraphHeight)o; 79 80 return infoField == ph.infoField && reserved == ph.reserved && 81 dxaCol == ph.dxaCol && dymLineOrHeight == ph.dymLineOrHeight; 82 } 83 } 84 | Popular Tags |