Contains the various biff records used to insert a drawing into a
worksheet. This type of image does not have an associated object
record
| Constructor: |
protected Drawing2(DrawingGroupObject dgo,
DrawingGroup dg) {
Drawing2 d = (Drawing2) dgo;
Assert.verify(d.origin == Origin.READ);
msoDrawingRecord = d.msoDrawingRecord;
initialized = false;
origin = Origin.READ;
drawingData = d.drawingData;
drawingGroup = dg;
drawingNumber = d.drawingNumber;
drawingGroup.addDrawing(this);
}
Copy constructor used to copy drawings from read to write Parameters:
dgo - the drawing group object
dg - the drawing group
|
public Drawing2(MsoDrawingRecord mso,
DrawingData dd,
DrawingGroup dg) {
drawingGroup = dg;
msoDrawingRecord = mso;
drawingData = dd;
initialized = false;
origin = Origin.READ;
// there is no drawing number associated with this drawing
drawingData.addRawData(msoDrawingRecord.getData());
drawingGroup.addDrawing(this);
Assert.verify(mso != null);
initialize();
}
Constructor used when reading images Parameters:
mso - the drawing record
dd - the drawing data for all drawings on this sheet
dg - the drawing group
|
public Drawing2(double x,
double y,
double w,
double h,
File image) {
imageFile = image;
initialized = true;
origin = Origin.WRITE;
this.x = x;
this.y = y;
this.width = w;
this.height = h;
referenceCount = 1;
type = ShapeType.PICTURE_FRAME;
}
Constructor invoked when writing the images Parameters:
x - the column
y - the row
w - the width in cells
h - the height in cells
image - the image file
|
public Drawing2(double x,
double y,
double w,
double h,
byte[] image) {
imageData = image;
initialized = true;
origin = Origin.WRITE;
this.x = x;
this.y = y;
this.width = w;
this.height = h;
referenceCount = 1;
type = ShapeType.PICTURE_FRAME;
}
Constructor invoked when writing the images Parameters:
x - the column
y - the row
w - the width in cells
h - the height in cells
image - the image data
|
| Method from jxl.biff.drawing.Drawing2 Detail: |
public final int getBlipId() {
if (!initialized)
{
initialize();
}
return blipId;
}
|
public double getColumn() {
return getX();
}
|
public DrawingGroup getDrawingGroup() {
return drawingGroup;
}
Accessor for the drawing group |
public double getHeight() {
if (!initialized)
{
initialize();
}
return height;
}
Accessor for the height of this drawing |
public byte[] getImageBytes() throws IOException {
Assert.verify(false);
if (origin == Origin.READ || origin == Origin.READ_WRITE)
{
return getImageData();
}
Assert.verify(origin == Origin.WRITE);
if (imageFile == null)
{
Assert.verify(imageData != null);
return imageData;
}
byte[] data = new byte[(int) imageFile.length()];
FileInputStream fis = new FileInputStream(imageFile);
fis.read(data, 0, data.length);
fis.close();
return data;
}
Accessor for the image data |
public byte[] getImageData() {
Assert.verify(false);
Assert.verify(origin == Origin.READ || origin == Origin.READ_WRITE);
if (!initialized)
{
initialize();
}
return drawingGroup.getImageData(blipId);
}
Accessor for the image data |
public String getImageFilePath() {
Assert.verify(false);
return null;
}
Accessor for the image file path. Normally this is the absolute path
of a file on the directory system, but if this drawing was constructed
using an byte[] then the blip id is returned |
public MsoDrawingRecord getMsoDrawingRecord() {
return msoDrawingRecord;
}
Gets the drawing record which was read in |
public final int getObjectId() {
if (!initialized)
{
initialize();
}
return objectId;
}
Accessor for the object id |
public Origin getOrigin() {
return origin;
}
Gets the origin of this drawing |
public int getReferenceCount() {
return referenceCount;
}
Accessor for the reference count on this drawing |
public double getRow() {
return getY();
}
|
public int getShapeId() {
if (!initialized)
{
initialize();
}
return shapeId;
}
Accessor for the shape id |
public EscherContainer getSpContainer() {
if (!initialized)
{
initialize();
}
Assert.verify(origin == Origin.READ);
return getReadSpContainer();
}
Creates the main Sp container for the drawing |
public ShapeType getType() {
return type;
}
|
public double getWidth() {
if (!initialized)
{
initialize();
}
return width;
}
Accessor for the width of this drawing |
public double getX() {
if (!initialized)
{
initialize();
}
return x;
}
Accessor for the column of this drawing |
public double getY() {
if (!initialized)
{
initialize();
}
return y;
}
Accessor for the row of this drawing |
public boolean isFirst() {
return msoDrawingRecord.isFirst();
}
Accessor for the first drawing on the sheet. This is used when
copying unmodified sheets to indicate that this drawing contains
the first time Escher gubbins |
public boolean isFormObject() {
return false;
}
Queries whether this object is a form object. Form objects have their
drawings records spread over TXO and CONTINUE records and
require special handling |
public void removeRow(int r) {
if (y > r)
{
setY(r);
}
}
|
public void setDrawingGroup(DrawingGroup dg) {
drawingGroup = dg;
}
Sets the drawing group for this drawing. Called by the drawing group
when this drawing is added to it |
public void setHeight(double h) {
if (origin == Origin.READ)
{
if (!initialized)
{
initialize();
}
origin = Origin.READ_WRITE;
}
height = h;
}
Accessor for the height of this drawing |
public final void setObjectId(int objid,
int bip,
int sid) {
objectId = objid;
blipId = bip;
shapeId = sid;
if (origin == Origin.READ)
{
origin = Origin.READ_WRITE;
}
}
Sets the object id. Invoked by the drawing group when the object is
added to id |
public void setReferenceCount(int r) {
referenceCount = r;
}
Sets the new reference count on the drawing |
public void setWidth(double w) {
if (origin == Origin.READ)
{
if (!initialized)
{
initialize();
}
origin = Origin.READ_WRITE;
}
width = w;
}
|
public void setX(double x) {
if (origin == Origin.READ)
{
if (!initialized)
{
initialize();
}
origin = Origin.READ_WRITE;
}
this.x = x;
}
Sets the column position of this drawing |
public void setY(double y) {
if (origin == Origin.READ)
{
if (!initialized)
{
initialize();
}
origin = Origin.READ_WRITE;
}
this.y = y;
}
Accessor for the row of the drawing |
public void writeAdditionalRecords(File outputFile) throws IOException {
// no records to write
}
Writes any other records associated with this drawing group object |
public void writeTailRecords(File outputFile) throws IOException {
// does nothing
}
Writes any records that need to be written after all the drawing group
objects have been written
Does nothing here |