Search in sources :

Example 26 with EscherContainerRecord

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

the class HSLFFill method getEscherBSERecord.

@SuppressWarnings("resource")
protected EscherBSERecord getEscherBSERecord(int idx) {
    HSLFSheet sheet = shape.getSheet();
    if (sheet == null) {
        LOG.log(POILogger.DEBUG, "Fill has not yet been assigned to a sheet");
        return null;
    }
    HSLFSlideShow ppt = sheet.getSlideShow();
    Document doc = ppt.getDocumentRecord();
    EscherContainerRecord dggContainer = doc.getPPDrawingGroup().getDggContainer();
    EscherContainerRecord bstore = HSLFShape.getEscherChild(dggContainer, EscherContainerRecord.BSTORE_CONTAINER);
    if (bstore == null) {
        LOG.log(POILogger.DEBUG, "EscherContainerRecord.BSTORE_CONTAINER was not found ");
        return null;
    }
    List<EscherRecord> lst = bstore.getChildRecords();
    return (EscherBSERecord) lst.get(idx - 1);
}
Also used : EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) EscherRecord(org.apache.poi.ddf.EscherRecord) Document(org.apache.poi.hslf.record.Document) EscherBSERecord(org.apache.poi.ddf.EscherBSERecord)

Example 27 with EscherContainerRecord

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

the class HSLFShapeFactory method createShapeGroup.

public static HSLFGroupShape createShapeGroup(EscherContainerRecord spContainer, ShapeContainer<HSLFShape, HSLFTextParagraph> parent) {
    boolean isTable = false;
    EscherContainerRecord ecr = (EscherContainerRecord) spContainer.getChild(0);
    EscherRecord opt = HSLFShape.getEscherChild(ecr, RecordTypes.EscherUserDefined);
    if (opt != null) {
        EscherPropertyFactory f = new EscherPropertyFactory();
        List<EscherProperty> props = f.createProperties(opt.serialize(), 8, opt.getInstance());
        for (EscherProperty ep : props) {
            if (ep.getPropertyNumber() == EscherProperties.GROUPSHAPE__TABLEPROPERTIES && ep instanceof EscherSimpleProperty && (((EscherSimpleProperty) ep).getPropertyValue() & 1) == 1) {
                isTable = true;
                break;
            }
        }
    }
    HSLFGroupShape group;
    if (isTable) {
        group = new HSLFTable(spContainer, parent);
    } else {
        group = new HSLFGroupShape(spContainer, parent);
    }
    return group;
}
Also used : EscherSimpleProperty(org.apache.poi.ddf.EscherSimpleProperty) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) EscherRecord(org.apache.poi.ddf.EscherRecord) EscherPropertyFactory(org.apache.poi.ddf.EscherPropertyFactory) EscherProperty(org.apache.poi.ddf.EscherProperty)

Example 28 with EscherContainerRecord

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

the class HSLFSheet method addShape.

/**
     * Add a new Shape to this Slide
     *
     * @param shape - the Shape to add
     */
@Override
public void addShape(HSLFShape shape) {
    PPDrawing ppdrawing = getPPDrawing();
    EscherContainerRecord dgContainer = ppdrawing.getDgContainer();
    EscherContainerRecord spgr = (EscherContainerRecord) HSLFShape.getEscherChild(dgContainer, EscherContainerRecord.SPGR_CONTAINER);
    spgr.addChildRecord(shape.getSpContainer());
    shape.setSheet(this);
    shape.setShapeId(allocateShapeId());
    shape.afterInsert(this);
}
Also used : PPDrawing(org.apache.poi.hslf.record.PPDrawing) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord)

Example 29 with EscherContainerRecord

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

the class HSLFSheet method getShapes.

/**
     * Returns all shapes contained in this Sheet
     *
     * @return all shapes contained in this Sheet (Slide or Notes)
     */
@Override
public List<HSLFShape> getShapes() {
    PPDrawing ppdrawing = getPPDrawing();
    EscherContainerRecord dg = ppdrawing.getDgContainer();
    EscherContainerRecord spgr = null;
    for (EscherRecord rec : dg) {
        if (rec.getRecordId() == EscherContainerRecord.SPGR_CONTAINER) {
            spgr = (EscherContainerRecord) rec;
            break;
        }
    }
    if (spgr == null) {
        throw new IllegalStateException("spgr not found");
    }
    List<HSLFShape> shapeList = new ArrayList<HSLFShape>();
    boolean isFirst = true;
    for (EscherRecord r : spgr) {
        if (isFirst) {
            // skip first item
            isFirst = false;
            continue;
        }
        EscherContainerRecord sp = (EscherContainerRecord) r;
        HSLFShape sh = HSLFShapeFactory.createShape(sp, null);
        sh.setSheet(this);
        if (sh instanceof HSLFSimpleShape) {
            HSLFHyperlink link = HSLFHyperlink.find(sh);
            if (link != null) {
                ((HSLFSimpleShape) sh).setHyperlink(link);
            }
        }
        shapeList.add(sh);
    }
    return shapeList;
}
Also used : PPDrawing(org.apache.poi.hslf.record.PPDrawing) ArrayList(java.util.ArrayList) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) EscherRecord(org.apache.poi.ddf.EscherRecord)

Example 30 with EscherContainerRecord

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

the class HSLFShape method createSpContainer.

/**
     * Create and assign the lower level escher record to this shape
     */
protected EscherContainerRecord createSpContainer(boolean isChild) {
    if (_escherContainer == null) {
        _escherContainer = new EscherContainerRecord();
        _escherContainer.setOptions((short) 15);
    }
    return _escherContainer;
}
Also used : EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord)

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