Search in sources :

Example 26 with CTLineProperties

use of org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties in project poi by apache.

the class XSLFSimpleShape method setLineTailLength.

/**
     * Specifies the line end width in relation to the line width.
     */
public void setLineTailLength(DecorationSize style) {
    CTLineProperties ln = getLn(this, true);
    if (ln == null) {
        return;
    }
    CTLineEndProperties lnEnd = ln.isSetTailEnd() ? ln.getTailEnd() : ln.addNewTailEnd();
    if (style == null) {
        if (lnEnd.isSetLen()) {
            lnEnd.unsetLen();
        }
    } else {
        lnEnd.setLen(STLineEndLength.Enum.forInt(style.ooxmlId));
    }
}
Also used : CTLineEndProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineEndProperties) CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties)

Example 27 with CTLineProperties

use of org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties in project poi by apache.

the class XSLFSimpleShape method getLineHeadWidth.

/**
     * @return the line end decoration width
     */
public DecorationSize getLineHeadWidth() {
    CTLineProperties ln = getLn(this, false);
    DecorationSize ds = DecorationSize.MEDIUM;
    if (ln != null && ln.isSetHeadEnd() && ln.getHeadEnd().isSetW()) {
        ds = DecorationSize.fromOoxmlId(ln.getHeadEnd().getW().intValue());
    }
    return ds;
}
Also used : DecorationSize(org.apache.poi.sl.usermodel.LineDecoration.DecorationSize) CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties)

Example 28 with CTLineProperties

use of org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties in project poi by apache.

the class XSLFSimpleShape method getLineWidth.

/**
     * @return line width in points. <code>0</code> means no line.
     */
public double getLineWidth() {
    PropertyFetcher<Double> fetcher = new PropertyFetcher<Double>() {

        @Override
        public boolean fetch(XSLFShape shape) {
            CTLineProperties ln = getLn(shape, false);
            if (ln != null) {
                if (ln.isSetNoFill()) {
                    setValue(0.);
                    return true;
                }
                if (ln.isSetW()) {
                    setValue(Units.toPoints(ln.getW()));
                    return true;
                }
            }
            return false;
        }
    };
    fetchShapeProperty(fetcher);
    double lineWidth = 0;
    if (fetcher.getValue() == null) {
        CTLineProperties defaultLn = getDefaultLineProperties();
        if (defaultLn != null) {
            if (defaultLn.isSetW()) {
                lineWidth = Units.toPoints(defaultLn.getW());
            }
        }
    } else {
        lineWidth = fetcher.getValue();
    }
    return lineWidth;
}
Also used : CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties) PropertyFetcher(org.apache.poi.xslf.model.PropertyFetcher)

Example 29 with CTLineProperties

use of org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties in project poi by apache.

the class XSLFTableCell method setBorderWidth.

@Override
public void setBorderWidth(BorderEdge edge, double width) {
    CTLineProperties ln = getCTLine(edge, true);
    ln.setW(Units.toEMU(width));
}
Also used : CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties)

Example 30 with CTLineProperties

use of org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties in project poi by apache.

the class XSLFTableCell method setBorderCompound.

@Override
public void setBorderCompound(BorderEdge edge, LineCompound compound) {
    if (compound == null) {
        throw new IllegalArgumentException("LineCompound need to be specified.");
    }
    CTLineProperties ln = setBorderDefaults(edge);
    ln.setCmpd(STCompoundLine.Enum.forInt(compound.ooxmlId));
}
Also used : CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties)

Aggregations

CTLineProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties)31 CTLineEndProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTLineEndProperties)7 CTShapeProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties)6 PropertyFetcher (org.apache.poi.xslf.model.PropertyFetcher)5 CTSolidColorFillProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties)5 DecorationSize (org.apache.poi.sl.usermodel.LineDecoration.DecorationSize)4 CTStyleMatrixReference (org.openxmlformats.schemas.drawingml.x2006.main.CTStyleMatrixReference)3 DrawPaint (org.apache.poi.sl.draw.DrawPaint)2 DecorationShape (org.apache.poi.sl.usermodel.LineDecoration.DecorationShape)2 SolidPaint (org.apache.poi.sl.usermodel.PaintStyle.SolidPaint)2 XmlObject (org.apache.xmlbeans.XmlObject)2 CTPresetLineDashProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTPresetLineDashProperties)2 CTShapeStyle (org.openxmlformats.schemas.drawingml.x2006.main.CTShapeStyle)2 STCompoundLine (org.openxmlformats.schemas.drawingml.x2006.main.STCompoundLine)2 PackagePart (org.apache.poi.openxml4j.opc.PackagePart)1 PaintStyle (org.apache.poi.sl.usermodel.PaintStyle)1 LineCap (org.apache.poi.sl.usermodel.StrokeStyle.LineCap)1 LineDash (org.apache.poi.sl.usermodel.StrokeStyle.LineDash)1 XSLFFillProperties (org.apache.poi.xslf.usermodel.XSLFPropertiesDelegate.XSLFFillProperties)1 CTBaseStyles (org.openxmlformats.schemas.drawingml.x2006.main.CTBaseStyles)1