jxl.biff.drawing
Class Drawing

java.lang.Object
  extended byjxl.biff.drawing.Drawing
All Implemented Interfaces:
DrawingGroupObject, Image
Direct Known Subclasses:
WritableImage

public class Drawing
extends java.lang.Object
implements DrawingGroupObject, Image

Contains the various biff records used to insert a drawing into a worksheet


Constructor Summary
  Drawing(double x, double y, double width, double height, byte[] image)
          Constructor invoked when writing the images
  Drawing(double x, double y, double width, double height, java.io.File image)
          Constructor invoked when writing the images
protected Drawing(DrawingGroupObject dgo, DrawingGroup dg)
          Copy constructor used to copy drawings from read to write
  Drawing(MsoDrawingRecord mso, ObjRecord obj, DrawingData dd, DrawingGroup dg)
          Constructor used when reading images
 
Method Summary
 int getBlipId()
          Accessor for the blip id
 double getColumn()
          Interface method
 DrawingGroup getDrawingGroup()
          Accessor for the drawing group
 double getHeight()
          Accessor for the height of this drawing
 byte[] getImageBytes()
          Accessor for the image data
 byte[] getImageData()
          Accessor for the image data
 java.io.File getImageFile()
          Accessor for the image file
 java.lang.String getImageFilePath()
          Accessor for the image file path.
 MsoDrawingRecord getMsoDrawingRecord()
          Gets the drawing record which was read in
 int getObjectId()
          Accessor for the object id
 Origin getOrigin()
          Gets the origin of this drawing
 int getReferenceCount()
          Accessor for the reference count on this drawing
 double getRow()
          Interface method
 int getShapeId()
          Accessor for the shape id
 jxl.biff.drawing.EscherContainer getSpContainer()
          Creates the main Sp container for the drawing
 jxl.biff.drawing.ShapeType getType()
          Accessor for the type
 double getWidth()
          Accessor for the width of this drawing
 double getX()
          Accessor for the column of this drawing
 double getY()
          Accessor for the row of this drawing
 boolean isFirst()
          Accessor for the first drawing on the sheet.
 boolean isFormObject()
          Queries whether this object is a form object.
 void setDrawingGroup(DrawingGroup dg)
          Sets the drawing group for this drawing.
 void setHeight(double h)
          Accessor for the height of this drawing
 void setObjectId(int objid, int bip, int sid)
          Sets the object id.
 void setReferenceCount(int r)
          Sets the new reference count on the drawing
 void setWidth(double w)
          Accessor for the width
 void setX(double x)
          Sets the column position of this drawing
 void setY(double y)
          Accessor for the row of the drawing
 void writeAdditionalRecords(File outputFile)
          Writes any other records associated with this drawing group object
 void writeTailRecords(File outputFile)
          Writes any records that need to be written after all the drawing group objects have been written Does nothing here
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Drawing

public Drawing(MsoDrawingRecord mso,
               ObjRecord obj,
               DrawingData dd,
               DrawingGroup dg)
Constructor used when reading images

Parameters:
mso - the drawing record
obj - the object record
dd - the drawing data for all drawings on this sheet
dg - the drawing group

Drawing

protected Drawing(DrawingGroupObject dgo,
                  DrawingGroup dg)
Copy constructor used to copy drawings from read to write


Drawing

public Drawing(double x,
               double y,
               double width,
               double height,
               java.io.File image)
Constructor invoked when writing the images

Parameters:
x - the column
y - the row
width - the width in cells
height - the height in cells
image - the image file

Drawing

public Drawing(double x,
               double y,
               double width,
               double height,
               byte[] image)
Constructor invoked when writing the images

Parameters:
x - the column
y - the row
width - the width in cells
height - the height in cells
image - the image data
Method Detail

getImageFile

public java.io.File getImageFile()
Accessor for the image file

Specified by:
getImageFile in interface Image
Returns:
the image file

getImageFilePath

public java.lang.String getImageFilePath()
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

Specified by:
getImageFilePath in interface DrawingGroupObject
Returns:
the image file path, or the blip id

setObjectId

public final void setObjectId(int objid,
                              int bip,
                              int sid)
Sets the object id. Invoked by the drawing group when the object is added to id

Specified by:
setObjectId in interface DrawingGroupObject
Parameters:
objid - the object id
bip - the blip id
sid - the shape id

getObjectId

public final int getObjectId()
Accessor for the object id

Specified by:
getObjectId in interface DrawingGroupObject
Returns:
the object id

getShapeId

public int getShapeId()
Accessor for the shape id

Specified by:
getShapeId in interface DrawingGroupObject
Returns:
the shape id

getBlipId

public final int getBlipId()
Accessor for the blip id

Specified by:
getBlipId in interface DrawingGroupObject
Returns:
the blip id

getMsoDrawingRecord

public MsoDrawingRecord getMsoDrawingRecord()
Gets the drawing record which was read in

Specified by:
getMsoDrawingRecord in interface DrawingGroupObject
Returns:
the drawing record

getSpContainer

public jxl.biff.drawing.EscherContainer getSpContainer()
Creates the main Sp container for the drawing

Specified by:
getSpContainer in interface DrawingGroupObject
Returns:
the SP container

setDrawingGroup

public void setDrawingGroup(DrawingGroup dg)
Sets the drawing group for this drawing. Called by the drawing group when this drawing is added to it

Specified by:
setDrawingGroup in interface DrawingGroupObject
Parameters:
dg - the drawing group

getDrawingGroup

public DrawingGroup getDrawingGroup()
Accessor for the drawing group

Specified by:
getDrawingGroup in interface DrawingGroupObject
Returns:
the drawing group

getOrigin

public Origin getOrigin()
Gets the origin of this drawing

Specified by:
getOrigin in interface DrawingGroupObject
Returns:
where this drawing came from

getReferenceCount

public int getReferenceCount()
Accessor for the reference count on this drawing

Specified by:
getReferenceCount in interface DrawingGroupObject
Returns:
the reference count

setReferenceCount

public void setReferenceCount(int r)
Sets the new reference count on the drawing

Specified by:
setReferenceCount in interface DrawingGroupObject
Parameters:
r - the new reference count

getX

public double getX()
Accessor for the column of this drawing

Specified by:
getX in interface DrawingGroupObject
Returns:
the column

setX

public void setX(double x)
Sets the column position of this drawing

Specified by:
setX in interface DrawingGroupObject
Parameters:
x - the column

getY

public double getY()
Accessor for the row of this drawing

Specified by:
getY in interface DrawingGroupObject
Returns:
the row

setY

public void setY(double y)
Accessor for the row of the drawing

Specified by:
setY in interface DrawingGroupObject
Parameters:
y - the row

getWidth

public double getWidth()
Accessor for the width of this drawing

Specified by:
getWidth in interface DrawingGroupObject
Returns:
the number of columns spanned by this image

setWidth

public void setWidth(double w)
Accessor for the width

Specified by:
setWidth in interface DrawingGroupObject
Parameters:
w - the number of columns to span

getHeight

public double getHeight()
Accessor for the height of this drawing

Specified by:
getHeight in interface DrawingGroupObject
Returns:
the number of rows spanned by this image

setHeight

public void setHeight(double h)
Accessor for the height of this drawing

Specified by:
setHeight in interface DrawingGroupObject
Parameters:
h - the number of rows spanned by this image

getImageData

public byte[] getImageData()
Accessor for the image data

Specified by:
getImageData in interface DrawingGroupObject
Returns:
the image data

getImageBytes

public byte[] getImageBytes()
                     throws java.io.IOException
Accessor for the image data

Specified by:
getImageBytes in interface DrawingGroupObject
Returns:
the image data
Throws:
java.io.IOException

getType

public jxl.biff.drawing.ShapeType getType()
Accessor for the type

Specified by:
getType in interface DrawingGroupObject
Returns:
the type

writeAdditionalRecords

public void writeAdditionalRecords(File outputFile)
                            throws java.io.IOException
Writes any other records associated with this drawing group object

Specified by:
writeAdditionalRecords in interface DrawingGroupObject
Throws:
java.io.IOException

writeTailRecords

public void writeTailRecords(File outputFile)
                      throws java.io.IOException
Writes any records that need to be written after all the drawing group objects have been written Does nothing here

Specified by:
writeTailRecords in interface DrawingGroupObject
Throws:
java.io.IOException

getColumn

public double getColumn()
Interface method

Specified by:
getColumn in interface Image
Returns:
the column number at which the image is positioned

getRow

public double getRow()
Interface method

Specified by:
getRow in interface Image
Returns:
the row number at which the image is positions

isFirst

public boolean 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

Specified by:
isFirst in interface DrawingGroupObject
Returns:
TRUE if this MSORecord is the first drawing on the sheet

isFormObject

public boolean isFormObject()
Queries whether this object is a form object. Form objects have their drawings records spread over TXO and CONTINUE records and require special handling

Specified by:
isFormObject in interface DrawingGroupObject
Returns:
TRUE if this is a form object, FALSE otherwise