Contains the various biff records used to copy a Button (from the
Form toolbox) between workbook
Method from jxl.biff.drawing.Button Detail: |
public void addMso(MsoDrawingRecord d) {
mso = d;
drawingData.addRawData(mso.getData());
}
|
public final int getBlipId() {
if (!initialized)
{
initialize();
}
return blipId;
}
|
public int getColumn() {
return 0;
}
Accessor for the column. As buttons are not associated with a cell,
does nothing here |
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() {
Assert.verify(false);
return null;
}
Accessor for the image data |
public byte[] getImageData() {
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 int getRow() {
return 0;
}
Accessor for the row. As buttons are not associated with a cell,
does nothing here |
public final int getShapeId() {
if (!initialized)
{
initialize();
}
return shapeId;
}
Accessor for the shape id |
public EscherContainer getSpContainer() {
if (!initialized)
{
initialize();
}
if (origin == Origin.READ)
{
return getReadSpContainer();
}
Assert.verify(false);
/*
if (spContainer == null)
{
spContainer = new SpContainer();
Sp sp = new Sp(type, shapeId, 2560);
spContainer.add(sp);
Opt opt = new Opt();
opt.addProperty(344, false, false, 0); // ?
opt.addProperty(385, false, false, 134217808); // fill colour
opt.addProperty(387, false, false, 134217808); // background colour
opt.addProperty(959, false, false, 131074); // hide
spContainer.add(opt);
ClientAnchor clientAnchor = new ClientAnchor(column + 1.3,
Math.max(0, row - 0.6),
column+3, row + 4);
spContainer.add(clientAnchor);
ClientData clientData = new ClientData();
spContainer.add(clientData);
ClientTextBox clientTextBox = new ClientTextBox();
spContainer.add(clientTextBox);
}
*/
return spContainer;
}
Creates the main Sp container for the drawing |
public String getText() {
if (commentText == null)
{
Assert.verify(text != null);
byte[] td = text.getData();
if (td[0] == 0)
{
commentText = StringHelper.getString
(td, td.length - 1, 1, workbookSettings);
}
else
{
commentText = StringHelper.getUnicodeString
(td, (td.length - 1) / 2, 1);
}
}
return commentText;
}
Accessor for the text on the button |
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 column;
}
Accessor for the column of this drawing |
public double getY() {
if (!initialized)
{
initialize();
}
return row;
}
Accessor for the row of this drawing |
public int hashCode() {
return commentText.hashCode();
}
|
public boolean isFirst() {
return mso.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 true;
}
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 setButtonText(String t) {
commentText = t;
if (origin == Origin.READ)
{
origin = Origin.READ_WRITE;
}
}
Called when the comment text is changed during the sheet copy process |
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 setFormatting(ContinueRecord t) {
formatting = t;
}
|
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 setText(ContinueRecord t) {
text = t;
}
|
public void setTextObject(TextObjectRecord t) {
txo = t;
}
|
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;
}
column = (int) x;
}
Sets the column position of this drawing. Used when inserting/removing
columns from the spreadsheet |
public void setY(double y) {
if (origin == Origin.READ)
{
if (!initialized)
{
initialize();
}
origin = Origin.READ_WRITE;
}
row = (int) y;
}
Accessor for the row of the drawing |
public void writeAdditionalRecords(File outputFile) throws IOException {
if (origin == Origin.READ)
{
outputFile.write(objRecord);
if (mso != null)
{
outputFile.write(mso);
}
outputFile.write(txo);
outputFile.write(text);
if (formatting != null)
{
outputFile.write(formatting);
}
return;
}
Assert.verify(false);
// Create the obj record
ObjRecord objrec = new ObjRecord(objectId,
ObjRecord.EXCELNOTE);
outputFile.write(objrec);
// Create the mso data record. Write the text box record again,
// although it is already included in the SpContainer
ClientTextBox textBox = new ClientTextBox();
MsoDrawingRecord msod = new MsoDrawingRecord(textBox.getData());
outputFile.write(msod);
TextObjectRecord tor = new TextObjectRecord(getText());
outputFile.write(tor);
// Data for the first continue record
byte[] textData = new byte[commentText.length() * 2 + 1];
textData[0] = 0x1; // unicode indicator
StringHelper.getUnicodeBytes(commentText, textData, 1);
//StringHelper.getBytes(commentText, textData, 1);
ContinueRecord textContinue = new ContinueRecord(textData);
outputFile.write(textContinue);
// Data for the formatting runs
byte[] frData = new byte[16];
// First txo run (the user)
IntegerHelper.getTwoBytes(0, frData, 0); // index to the first character
IntegerHelper.getTwoBytes(0, frData, 2); // index to the font(default)
// Mandatory last txo run
IntegerHelper.getTwoBytes(commentText.length(), frData, 8);
IntegerHelper.getTwoBytes(0, frData, 10); // index to the font(default)
ContinueRecord frContinue = new ContinueRecord(frData);
outputFile.write(frContinue);
}
Writes out any additional records |
public void writeTailRecords(File outputFile) {
}
Writes any records that need to be written after all the drawing group
objects have been written
Writes out all the note records |