Search in sources :

Example 36 with AbstractEscherOptRecord

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

the class HSLFSimpleShape method setLineTailWidth.

public void setLineTailWidth(DecorationSize decoSize) {
    AbstractEscherOptRecord opt = getEscherOptRecord();
    setEscherProperty(opt, EscherProperties.LINESTYLE__LINEENDARROWWIDTH, decoSize == null ? -1 : decoSize.nativeId);
}
Also used : AbstractEscherOptRecord(org.apache.poi.ddf.AbstractEscherOptRecord)

Example 37 with AbstractEscherOptRecord

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

the class TestBugs method bug46441.

@Test
public void bug46441() throws IOException {
    HSLFSlideShow ppt = open("bug46441.ppt");
    HSLFAutoShape as = (HSLFAutoShape) ppt.getSlides().get(0).getShapes().get(0);
    AbstractEscherOptRecord opt = as.getEscherOptRecord();
    EscherArrayProperty ep = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__SHADECOLORS);
    double[][] exp = { // r, g, b, position
    { 94, 158, 255, 0 }, { 133, 194, 255, 0.399994 }, { 196, 214, 235, 0.699997 }, { 255, 235, 250, 1 } };
    int i = 0;
    for (byte[] data : ep) {
        EscherColorRef ecr = new EscherColorRef(data, 0, 4);
        int[] rgb = ecr.getRGB();
        double pos = Units.fixedPointToDouble(LittleEndian.getInt(data, 4));
        assertEquals((int) exp[i][0], rgb[0]);
        assertEquals((int) exp[i][1], rgb[1]);
        assertEquals((int) exp[i][2], rgb[2]);
        assertEquals(exp[i][3], pos, 0.01);
        i++;
    }
    ppt.close();
}
Also used : EscherColorRef(org.apache.poi.ddf.EscherColorRef) EscherArrayProperty(org.apache.poi.ddf.EscherArrayProperty) AbstractEscherOptRecord(org.apache.poi.ddf.AbstractEscherOptRecord) DrawPaint(org.apache.poi.sl.draw.DrawPaint) SolidPaint(org.apache.poi.sl.usermodel.PaintStyle.SolidPaint) Test(org.junit.Test)

Example 38 with AbstractEscherOptRecord

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

the class HSLFFill method setPictureData.

/**
     * Assign picture used to fill the underlying shape.
     *
     * @param data the picture data added to this ppt by {@link HSLFSlideShow#addPicture(byte[], org.apache.poi.sl.usermodel.PictureData.PictureType)} method.
     */
public void setPictureData(HSLFPictureData data) {
    AbstractEscherOptRecord opt = shape.getEscherOptRecord();
    HSLFShape.setEscherProperty(opt, (short) (EscherProperties.FILL__PATTERNTEXTURE + 0x4000), (data == null ? 0 : data.getIndex()));
    if (data != null && shape.getSheet() != null) {
        EscherBSERecord bse = getEscherBSERecord(data.getIndex());
        if (bse != null) {
            bse.setRef(bse.getRef() + 1);
        }
    }
}
Also used : AbstractEscherOptRecord(org.apache.poi.ddf.AbstractEscherOptRecord) EscherBSERecord(org.apache.poi.ddf.EscherBSERecord)

Example 39 with AbstractEscherOptRecord

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

the class HSLFFill method setFillType.

/**
     * Sets fill type.
     * Must be one of the <code>FILL_*</code> constants defined in this class.
     *
     * @param type type of the fill
     */
public void setFillType(int type) {
    AbstractEscherOptRecord opt = shape.getEscherOptRecord();
    HSLFShape.setEscherProperty(opt, EscherProperties.FILL__FILLTYPE, type);
}
Also used : AbstractEscherOptRecord(org.apache.poi.ddf.AbstractEscherOptRecord)

Example 40 with AbstractEscherOptRecord

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

the class HSLFFill method afterInsert.

/**
     */
protected void afterInsert(HSLFSheet sh) {
    AbstractEscherOptRecord opt = shape.getEscherOptRecord();
    EscherSimpleProperty p = HSLFShape.getEscherProperty(opt, EscherProperties.FILL__PATTERNTEXTURE);
    if (p != null) {
        int idx = p.getPropertyValue();
        EscherBSERecord bse = getEscherBSERecord(idx);
        if (bse != null) {
            bse.setRef(bse.getRef() + 1);
        }
    }
}
Also used : EscherSimpleProperty(org.apache.poi.ddf.EscherSimpleProperty) AbstractEscherOptRecord(org.apache.poi.ddf.AbstractEscherOptRecord) DrawPaint(org.apache.poi.sl.draw.DrawPaint) GradientPaint(org.apache.poi.sl.usermodel.PaintStyle.GradientPaint) TexturePaint(org.apache.poi.sl.usermodel.PaintStyle.TexturePaint) EscherBSERecord(org.apache.poi.ddf.EscherBSERecord)

Aggregations

AbstractEscherOptRecord (org.apache.poi.ddf.AbstractEscherOptRecord)68 EscherSimpleProperty (org.apache.poi.ddf.EscherSimpleProperty)36 DrawPaint (org.apache.poi.sl.draw.DrawPaint)13 Color (java.awt.Color)8 GradientPaint (org.apache.poi.sl.usermodel.PaintStyle.GradientPaint)7 TexturePaint (org.apache.poi.sl.usermodel.PaintStyle.TexturePaint)7 EscherArrayProperty (org.apache.poi.ddf.EscherArrayProperty)6 EscherContainerRecord (org.apache.poi.ddf.EscherContainerRecord)6 SolidPaint (org.apache.poi.sl.usermodel.PaintStyle.SolidPaint)6 EscherBSERecord (org.apache.poi.ddf.EscherBSERecord)4 Rectangle2D (java.awt.geom.Rectangle2D)3 EscherColorRef (org.apache.poi.ddf.EscherColorRef)3 EscherComplexProperty (org.apache.poi.ddf.EscherComplexProperty)3 EscherRecord (org.apache.poi.ddf.EscherRecord)3 EscherSpRecord (org.apache.poi.ddf.EscherSpRecord)3 AffineTransform (java.awt.geom.AffineTransform)2 EscherProperty (org.apache.poi.ddf.EscherProperty)2 Document (org.apache.poi.hslf.record.Document)2 Test (org.junit.Test)2 Insets (java.awt.Insets)1