FileDocCategorySizeDatePackage
EscherChildAnchorRecord.javaAPI DocApache Poi 3.0.16308Mon Jan 01 12:39:40 GMT 2007org.apache.poi.ddf

EscherChildAnchorRecord

public class EscherChildAnchorRecord extends EscherRecord
The escher child achor record is used to specify the position of a shape under an existing group. The first level of shape records use a EscherClientAnchor record instead.
author
Glen Stampoultzis
see
EscherChildAnchorRecord

Fields Summary
public static final short
RECORD_ID
public static final String
RECORD_DESCRIPTION
private int
field_1_dx1
private int
field_2_dy1
private int
field_3_dx2
private int
field_4_dy2
Constructors Summary
Methods Summary
public intfillFields(byte[] data, int offset, org.apache.poi.ddf.EscherRecordFactory recordFactory)
This method deserializes the record from a byte array.

param
data The byte array containing the escher record information
param
offset The starting offset into data.
param
recordFactory May be null since this is not a container record.
return
The number of bytes read from the byte array.


                                                                         
             
    
        int bytesRemaining = readHeader( data, offset );
        int pos            = offset + 8;
        int size           = 0;
        field_1_dx1    =  LittleEndian.getInt( data, pos + size );size+=4;
        field_2_dy1    =  LittleEndian.getInt( data, pos + size );size+=4;
        field_3_dx2  =  LittleEndian.getInt( data, pos + size );size+=4;
        field_4_dy2 =  LittleEndian.getInt( data, pos + size );size+=4;
        return 8 + size;
    
public intgetDx1()
Retrieves offset within the parent coordinate space for the top left point.

        return field_1_dx1;
    
public intgetDx2()
Retrieves offset within the parent coordinate space for the bottom right point.

        return field_3_dx2;
    
public intgetDy1()
Gets offset within the parent coordinate space for the top left point.

        return field_2_dy1;
    
public intgetDy2()
Gets the offset within the parent coordinate space for the bottom right point.

        return field_4_dy2;
    
public shortgetRecordId()
The record id for the EscherChildAnchorRecord.

        return RECORD_ID;
    
public java.lang.StringgetRecordName()
The short name for this record

        return "ChildAnchor";
    
public intgetRecordSize()
Returns the number of bytes that are required to serialize this record.

return
Number of bytes

        return 8 + 4 * 4;
    
public intserialize(int offset, byte[] data, org.apache.poi.ddf.EscherSerializationListener listener)
This method serializes this escher record into a byte array.

param
offset The offset into data to start writing the record data to.
param
data The byte array to serialize to.
param
listener A listener to retrieve start and end callbacks. Use a NullEscherSerailizationListener to ignore these events.
return
The number of bytes written.
see
NullEscherSerializationListener

        listener.beforeRecordSerialize( offset, getRecordId(), this );
        int pos = offset;
        LittleEndian.putShort( data, pos, getOptions() );          pos += 2;
        LittleEndian.putShort( data, pos, getRecordId() );         pos += 2;
        LittleEndian.putInt( data, pos, getRecordSize()-8 );       pos += 4;
        LittleEndian.putInt( data, pos, field_1_dx1 );             pos += 4;
        LittleEndian.putInt( data, pos, field_2_dy1 );             pos += 4;
        LittleEndian.putInt( data, pos, field_3_dx2 );           pos += 4;
        LittleEndian.putInt( data, pos, field_4_dy2 );          pos += 4;

        listener.afterRecordSerialize( pos, getRecordId(), pos - offset, this );
        return pos - offset;
    
public voidsetDx1(int field_1_dx1)
Sets offset within the parent coordinate space for the top left point.

        this.field_1_dx1 = field_1_dx1;
    
public voidsetDx2(int field_3_dx2)
Sets offset within the parent coordinate space for the bottom right point.

        this.field_3_dx2 = field_3_dx2;
    
public voidsetDy1(int field_2_dy1)
Sets offset within the parent coordinate space for the top left point.

        this.field_2_dy1 = field_2_dy1;
    
public voidsetDy2(int field_4_dy2)
Sets the offset within the parent coordinate space for the bottom right point.

        this.field_4_dy2 = field_4_dy2;
    
public java.lang.StringtoString()
The string representation of this record

        String nl = System.getProperty("line.separator");

        return getClass().getName() + ":" + nl +
                "  RecordId: 0x" + HexDump.toHex(RECORD_ID) + nl +
                "  Options: 0x" + HexDump.toHex(getOptions()) + nl +
                "  X1: " + field_1_dx1 + nl +
                "  Y1: " + field_2_dy1 + nl +
                "  X2: " + field_3_dx2 + nl +
                "  Y2: " + field_4_dy2 + nl ;