Search in sources :

Example 21 with EscherBSERecord

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

the class HSSFComment method resetBackgroundImage.

public void resetBackgroundImage() {
    EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.FILL__PATTERNTEXTURE);
    if (null != property) {
        EscherBSERecord bse = getPatriarch().getSheet().getWorkbook().getWorkbook().getBSERecord(property.getPropertyValue());
        bse.setRef(bse.getRef() - 1);
        getOptRecord().removeEscherProperty(EscherProperties.FILL__PATTERNTEXTURE);
    }
    setPropertyValue(new EscherSimpleProperty(EscherProperties.FILL__FILLTYPE, false, false, FILL_TYPE_SOLID));
}
Also used : EscherSimpleProperty(org.apache.poi.ddf.EscherSimpleProperty) EscherBSERecord(org.apache.poi.ddf.EscherBSERecord)

Example 22 with EscherBSERecord

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

the class HSSFPicture method getPictureData.

/**
     * Return picture data for this shape
     *
     * @return picture data for this shape or {@code null} if picture wasn't embedded, i.e. external linked
     */
@Override
public HSSFPictureData getPictureData() {
    int picIdx = getPictureIndex();
    if (picIdx == -1) {
        return null;
    }
    HSSFPatriarch patriarch = getPatriarch();
    HSSFShape parent = getParent();
    while (patriarch == null && parent != null) {
        patriarch = parent.getPatriarch();
        parent = parent.getParent();
    }
    if (patriarch == null) {
        throw new IllegalStateException("Could not find a patriarch for a HSSPicture");
    }
    InternalWorkbook iwb = patriarch.getSheet().getWorkbook().getWorkbook();
    EscherBSERecord bse = iwb.getBSERecord(picIdx);
    EscherBlipRecord blipRecord = bse.getBlipRecord();
    return new HSSFPictureData(blipRecord);
}
Also used : InternalWorkbook(org.apache.poi.hssf.model.InternalWorkbook) EscherBSERecord(org.apache.poi.ddf.EscherBSERecord) EscherBlipRecord(org.apache.poi.ddf.EscherBlipRecord)

Example 23 with EscherBSERecord

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

the class HSSFPicture method afterInsert.

@Override
void afterInsert(HSSFPatriarch patriarch) {
    EscherAggregate agg = patriarch.getBoundAggregate();
    agg.associateShapeToObjRecord(getEscherContainer().getChildById(EscherClientDataRecord.RECORD_ID), getObjRecord());
    if (getPictureIndex() != -1) {
        EscherBSERecord bse = patriarch.getSheet().getWorkbook().getWorkbook().getBSERecord(getPictureIndex());
        bse.setRef(bse.getRef() + 1);
    }
}
Also used : EscherAggregate(org.apache.poi.hssf.record.EscherAggregate) EscherBSERecord(org.apache.poi.ddf.EscherBSERecord)

Aggregations

EscherBSERecord (org.apache.poi.ddf.EscherBSERecord)23 EscherRecord (org.apache.poi.ddf.EscherRecord)9 EscherContainerRecord (org.apache.poi.ddf.EscherContainerRecord)8 EscherSimpleProperty (org.apache.poi.ddf.EscherSimpleProperty)6 EscherBlipRecord (org.apache.poi.ddf.EscherBlipRecord)5 AbstractEscherOptRecord (org.apache.poi.ddf.AbstractEscherOptRecord)4 Document (org.apache.poi.hslf.record.Document)4 InternalWorkbook (org.apache.poi.hssf.model.InternalWorkbook)3 Test (org.junit.Test)3 DefaultEscherRecordFactory (org.apache.poi.ddf.DefaultEscherRecordFactory)2 EscherDggRecord (org.apache.poi.ddf.EscherDggRecord)2 EscherRecordFactory (org.apache.poi.ddf.EscherRecordFactory)2 EscherAggregate (org.apache.poi.hssf.record.EscherAggregate)2 DrawPaint (org.apache.poi.sl.draw.DrawPaint)2 GradientPaint (org.apache.poi.sl.usermodel.PaintStyle.GradientPaint)2 TexturePaint (org.apache.poi.sl.usermodel.PaintStyle.TexturePaint)2 Rectangle (java.awt.Rectangle)1 Rectangle2D (java.awt.geom.Rectangle2D)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 EscherBitmapBlip (org.apache.poi.ddf.EscherBitmapBlip)1