Search in sources :

Example 31 with EscherContainerRecord

use of org.apache.poi.ddf.EscherContainerRecord in project poi by apache.

the class HSLFSheet method getBackground.

/**
     * Returns the background shape for this sheet.
     *
     * @return the background shape for this sheet.
     */
@Override
public HSLFBackground getBackground() {
    if (_background == null) {
        PPDrawing ppdrawing = getPPDrawing();
        EscherContainerRecord dg = ppdrawing.getDgContainer();
        EscherContainerRecord spContainer = dg.getChildById(EscherContainerRecord.SP_CONTAINER);
        _background = new HSLFBackground(spContainer, null);
        _background.setSheet(this);
    }
    return _background;
}
Also used : PPDrawing(org.apache.poi.hslf.record.PPDrawing) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord)

Example 32 with EscherContainerRecord

use of org.apache.poi.ddf.EscherContainerRecord in project poi by apache.

the class HSLFSimpleShape method createSpContainer.

/**
     * Create a new Shape
     *
     * @param isChild   <code>true</code> if the Line is inside a group, <code>false</code> otherwise
     * @return the record container which holds this shape
     */
@Override
protected EscherContainerRecord createSpContainer(boolean isChild) {
    EscherContainerRecord ecr = super.createSpContainer(isChild);
    ecr.setRecordId(EscherContainerRecord.SP_CONTAINER);
    EscherSpRecord sp = new EscherSpRecord();
    int flags = EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE;
    if (isChild) {
        flags |= EscherSpRecord.FLAG_CHILD;
    }
    sp.setFlags(flags);
    ecr.addChildRecord(sp);
    AbstractEscherOptRecord opt = new EscherOptRecord();
    opt.setRecordId(EscherOptRecord.RECORD_ID);
    ecr.addChildRecord(opt);
    EscherRecord anchor;
    if (isChild) {
        anchor = new EscherChildAnchorRecord();
    } else {
        anchor = new EscherClientAnchorRecord();
        //hack. internal variable EscherClientAnchorRecord.shortRecord can be
        //initialized only in fillFields(). We need to set shortRecord=false;
        byte[] header = new byte[16];
        LittleEndian.putUShort(header, 0, 0);
        LittleEndian.putUShort(header, 2, 0);
        LittleEndian.putInt(header, 4, 8);
        anchor.fillFields(header, 0, null);
    }
    ecr.addChildRecord(anchor);
    return ecr;
}
Also used : EscherChildAnchorRecord(org.apache.poi.ddf.EscherChildAnchorRecord) EscherSpRecord(org.apache.poi.ddf.EscherSpRecord) EscherClientAnchorRecord(org.apache.poi.ddf.EscherClientAnchorRecord) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) EscherRecord(org.apache.poi.ddf.EscherRecord) AbstractEscherOptRecord(org.apache.poi.ddf.AbstractEscherOptRecord) DrawPaint(org.apache.poi.sl.draw.DrawPaint) SolidPaint(org.apache.poi.sl.usermodel.PaintStyle.SolidPaint) AbstractEscherOptRecord(org.apache.poi.ddf.AbstractEscherOptRecord) EscherOptRecord(org.apache.poi.ddf.EscherOptRecord)

Example 33 with EscherContainerRecord

use of org.apache.poi.ddf.EscherContainerRecord in project poi by apache.

the class HSLFAutoShape method createSpContainer.

protected EscherContainerRecord createSpContainer(ShapeType shapeType, boolean isChild) {
    EscherContainerRecord ecr = super.createSpContainer(isChild);
    setShapeType(shapeType);
    //set default properties for an autoshape
    setEscherProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x40000);
    setEscherProperty(EscherProperties.FILL__FILLCOLOR, 0x8000004);
    setEscherProperty(EscherProperties.FILL__FILLCOLOR, 0x8000004);
    setEscherProperty(EscherProperties.FILL__FILLBACKCOLOR, 0x8000000);
    setEscherProperty(EscherProperties.FILL__NOFILLHITTEST, 0x100010);
    setEscherProperty(EscherProperties.LINESTYLE__COLOR, 0x8000001);
    setEscherProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x80008);
    setEscherProperty(EscherProperties.SHADOWSTYLE__COLOR, 0x8000002);
    return ecr;
}
Also used : EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord)

Example 34 with EscherContainerRecord

use of org.apache.poi.ddf.EscherContainerRecord in project poi by apache.

the class HSLFLine method createSpContainer.

@Override
protected EscherContainerRecord createSpContainer(boolean isChild) {
    EscherContainerRecord ecr = super.createSpContainer(isChild);
    setShapeType(ShapeType.LINE);
    EscherSpRecord spRecord = ecr.getChildById(EscherSpRecord.RECORD_ID);
    short type = (short) ((ShapeType.LINE.nativeId << 4) | 0x2);
    spRecord.setOptions(type);
    //set default properties for a line
    AbstractEscherOptRecord opt = getEscherOptRecord();
    //default line properties
    setEscherProperty(opt, EscherProperties.GEOMETRY__SHAPEPATH, 4);
    setEscherProperty(opt, EscherProperties.GEOMETRY__FILLOK, 0x10000);
    setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST, 0x100000);
    setEscherProperty(opt, EscherProperties.LINESTYLE__COLOR, 0x8000001);
    setEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0xA0008);
    setEscherProperty(opt, EscherProperties.SHADOWSTYLE__COLOR, 0x8000002);
    return ecr;
}
Also used : EscherSpRecord(org.apache.poi.ddf.EscherSpRecord) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) AbstractEscherOptRecord(org.apache.poi.ddf.AbstractEscherOptRecord)

Example 35 with EscherContainerRecord

use of org.apache.poi.ddf.EscherContainerRecord in project poi by apache.

the class HSLFPictureShape method createSpContainer.

/**
     * Create a new Picture and populate the inital structure of the <code>EscherSp</code> record which holds information about this picture.

     * @param idx the index of the picture which refers to <code>EscherBSE</code> container.
     * @return the create Picture object
     */
protected EscherContainerRecord createSpContainer(int idx, boolean isChild) {
    EscherContainerRecord ecr = super.createSpContainer(isChild);
    EscherSpRecord spRecord = ecr.getChildById(EscherSpRecord.RECORD_ID);
    spRecord.setOptions((short) ((ShapeType.FRAME.nativeId << 4) | 0x2));
    //set default properties for a picture
    AbstractEscherOptRecord opt = getEscherOptRecord();
    setEscherProperty(opt, EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x800080);
    //another weird feature of powerpoint: for picture id we must add 0x4000.
    setEscherProperty(opt, (short) (EscherProperties.BLIP__BLIPTODISPLAY + 0x4000), idx);
    return ecr;
}
Also used : EscherSpRecord(org.apache.poi.ddf.EscherSpRecord) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) AbstractEscherOptRecord(org.apache.poi.ddf.AbstractEscherOptRecord)

Aggregations

EscherContainerRecord (org.apache.poi.ddf.EscherContainerRecord)53 EscherRecord (org.apache.poi.ddf.EscherRecord)17 EscherSpRecord (org.apache.poi.ddf.EscherSpRecord)17 EscherOptRecord (org.apache.poi.ddf.EscherOptRecord)11 EscherBSERecord (org.apache.poi.ddf.EscherBSERecord)8 EscherSimpleProperty (org.apache.poi.ddf.EscherSimpleProperty)8 AbstractEscherOptRecord (org.apache.poi.ddf.AbstractEscherOptRecord)6 EscherDgRecord (org.apache.poi.ddf.EscherDgRecord)6 DefaultEscherRecordFactory (org.apache.poi.ddf.DefaultEscherRecordFactory)5 ObjRecord (org.apache.poi.hssf.record.ObjRecord)5 EscherDggRecord (org.apache.poi.ddf.EscherDggRecord)4 EscherSpgrRecord (org.apache.poi.ddf.EscherSpgrRecord)4 EscherTextboxRecord (org.apache.poi.ddf.EscherTextboxRecord)4 Document (org.apache.poi.hslf.record.Document)4 PPDrawing (org.apache.poi.hslf.record.PPDrawing)4 LinkedList (java.util.LinkedList)3 EscherBoolProperty (org.apache.poi.ddf.EscherBoolProperty)3 EscherClientDataRecord (org.apache.poi.ddf.EscherClientDataRecord)3 EscherRGBProperty (org.apache.poi.ddf.EscherRGBProperty)3 ExObjRefAtom (org.apache.poi.hslf.record.ExObjRefAtom)3