Search in sources :

Example 26 with AbstractEscherOptRecord

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

the class HSLFSimpleShape method getLineTailDecoration.

public DecorationShape getLineTailDecoration() {
    AbstractEscherOptRecord opt = getEscherOptRecord();
    EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.LINESTYLE__LINEENDARROWHEAD);
    return (prop == null) ? null : DecorationShape.fromNativeId(prop.getPropertyValue());
}
Also used : EscherSimpleProperty(org.apache.poi.ddf.EscherSimpleProperty) AbstractEscherOptRecord(org.apache.poi.ddf.AbstractEscherOptRecord)

Example 27 with AbstractEscherOptRecord

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

the class HSLFSimpleShape method setLineCap.

/**
     * Sets line cap.
     *
     * @param pen new style of the line.
     */
public void setLineCap(LineCap pen) {
    AbstractEscherOptRecord opt = getEscherOptRecord();
    setEscherProperty(opt, EscherProperties.LINESTYLE__LINEENDCAPSTYLE, pen == LineCap.FLAT ? -1 : pen.nativeId);
}
Also used : AbstractEscherOptRecord(org.apache.poi.ddf.AbstractEscherOptRecord)

Example 28 with AbstractEscherOptRecord

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

the class HSLFSimpleShape method getLineHeadDecoration.

public DecorationShape getLineHeadDecoration() {
    AbstractEscherOptRecord opt = getEscherOptRecord();
    EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.LINESTYLE__LINESTARTARROWHEAD);
    return (prop == null) ? null : DecorationShape.fromNativeId(prop.getPropertyValue());
}
Also used : EscherSimpleProperty(org.apache.poi.ddf.EscherSimpleProperty) AbstractEscherOptRecord(org.apache.poi.ddf.AbstractEscherOptRecord)

Example 29 with AbstractEscherOptRecord

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

the class HSLFSimpleShape method setLineBackgroundColor.

/**
     * Sets the background color of line
     *
     * @param color new background color of the line
     */
public void setLineBackgroundColor(Color color) {
    AbstractEscherOptRecord opt = getEscherOptRecord();
    if (color == null) {
        setEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x80000);
        opt.removeEscherProperty(EscherProperties.LINESTYLE__BACKCOLOR);
    } else {
        int rgb = new Color(color.getBlue(), color.getGreen(), color.getRed(), 0).getRGB();
        setEscherProperty(opt, EscherProperties.LINESTYLE__BACKCOLOR, rgb);
        setEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x180018);
    }
}
Also used : Color(java.awt.Color) AbstractEscherOptRecord(org.apache.poi.ddf.AbstractEscherOptRecord) DrawPaint(org.apache.poi.sl.draw.DrawPaint) SolidPaint(org.apache.poi.sl.usermodel.PaintStyle.SolidPaint)

Example 30 with AbstractEscherOptRecord

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

the class HSLFSimpleShape method getLineWidth.

/**
     *  Returns width of the line in in points
     */
public double getLineWidth() {
    AbstractEscherOptRecord opt = getEscherOptRecord();
    EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH);
    double width = (prop == null) ? DEFAULT_LINE_WIDTH : Units.toPoints(prop.getPropertyValue());
    return width;
}
Also used : EscherSimpleProperty(org.apache.poi.ddf.EscherSimpleProperty) AbstractEscherOptRecord(org.apache.poi.ddf.AbstractEscherOptRecord)

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