package net.sf.jpluck.plucker;
import net.sf.jpluck.palm.PdbOutputStream;
import net.sf.jpluck.plucker.functions.Align;
import net.sf.jpluck.plucker.functions.Function;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
public class TableCell extends Paragraph {
private int alignment;
private String imageURI;
private int columnSpan;
private int rowSpan;
TableCell() {
this.alignment = Align.LEFT;
this.columnSpan = 1;
this.rowSpan = 1;
}
public int getAlignment() {
return alignment;
}
public String getImageURI() {
return imageURI;
}
public int getColumnSpan() {
return columnSpan;
}
public int getRowSpan() {
return rowSpan;
}
public void write(PdbOutputStream out) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
super.write(new PdbOutputStream(baos));
byte[] data = baos.toByteArray();
out.writeByte(0);
out.writeByte(Function.TABLE_CELL);
out.writeByte(alignment);
// TODO: Image record ID
out.writeShort(0);
out.writeByte(columnSpan);
out.writeByte(rowSpan);
out.writeShort(data.length);
out.write(data);
}
public void setAlignment(int i) {
alignment = i;
}
public void setColumnSpan(int i) {
columnSpan = i;
}
public void setImageURI(String string) {
imageURI = string;
}
public void setRowSpan(int i) {
rowSpan = i;
}
}