Search in sources :

Example 1 with CTShapeNonVisual

use of org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual in project poi by apache.

the class XSLFAutoShape method prototype.

/**
     * @param shapeId 1-based shapeId
     */
static CTShape prototype(int shapeId) {
    CTShape ct = CTShape.Factory.newInstance();
    CTShapeNonVisual nvSpPr = ct.addNewNvSpPr();
    CTNonVisualDrawingProps cnv = nvSpPr.addNewCNvPr();
    cnv.setName("AutoShape " + shapeId);
    cnv.setId(shapeId + 1);
    nvSpPr.addNewCNvSpPr();
    nvSpPr.addNewNvPr();
    CTShapeProperties spPr = ct.addNewSpPr();
    CTPresetGeometry2D prst = spPr.addNewPrstGeom();
    prst.setPrst(STShapeType.RECT);
    prst.addNewAvLst();
    return ct;
}
Also used : CTShapeNonVisual(org.openxmlformats.schemas.presentationml.x2006.main.CTShapeNonVisual) CTShapeProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties) CTPresetGeometry2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D) CTNonVisualDrawingProps(org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps) CTShape(org.openxmlformats.schemas.presentationml.x2006.main.CTShape)

Example 2 with CTShapeNonVisual

use of org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual in project poi by apache.

the class XSSFSimpleShape method prototype.

/**
     * Prototype with the default structure of a new auto-shape.
     */
protected static CTShape prototype() {
    if (prototype == null) {
        CTShape shape = CTShape.Factory.newInstance();
        CTShapeNonVisual nv = shape.addNewNvSpPr();
        CTNonVisualDrawingProps nvp = nv.addNewCNvPr();
        nvp.setId(1);
        nvp.setName("Shape 1");
        nv.addNewCNvSpPr();
        CTShapeProperties sp = shape.addNewSpPr();
        CTTransform2D t2d = sp.addNewXfrm();
        CTPositiveSize2D p1 = t2d.addNewExt();
        p1.setCx(0);
        p1.setCy(0);
        CTPoint2D p2 = t2d.addNewOff();
        p2.setX(0);
        p2.setY(0);
        CTPresetGeometry2D geom = sp.addNewPrstGeom();
        geom.setPrst(STShapeType.RECT);
        geom.addNewAvLst();
        CTTextBody body = shape.addNewTxBody();
        CTTextBodyProperties bodypr = body.addNewBodyPr();
        bodypr.setAnchor(STTextAnchoringType.T);
        bodypr.setRtlCol(false);
        CTTextParagraph p = body.addNewP();
        p.addNewPPr().setAlgn(STTextAlignType.L);
        CTTextCharacterProperties endPr = p.addNewEndParaRPr();
        endPr.setLang("en-US");
        endPr.setSz(1100);
        CTSolidColorFillProperties scfpr = endPr.addNewSolidFill();
        scfpr.addNewSrgbClr().setVal(new byte[] { 0, 0, 0 });
        body.addNewLstStyle();
        prototype = shape;
    }
    return prototype;
}
Also used : CTShape(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape) CTShapeNonVisual(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual)

Example 3 with CTShapeNonVisual

use of org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual in project tika by apache.

the class XSSFBExcelExtractorDecorator method extractHyperLinksFromShape.

private void extractHyperLinksFromShape(CTShape ctShape, XHTMLContentHandler xhtml) throws SAXException {
    if (ctShape == null)
        return;
    CTShapeNonVisual nvSpPR = ctShape.getNvSpPr();
    if (nvSpPR == null)
        return;
    CTNonVisualDrawingProps cNvPr = nvSpPR.getCNvPr();
    if (cNvPr == null)
        return;
    CTHyperlink ctHyperlink = cNvPr.getHlinkClick();
    if (ctHyperlink == null)
        return;
    String url = drawingHyperlinks.get(ctHyperlink.getId());
    if (url != null) {
        xhtml.startElement("a", "href", url);
        xhtml.characters(url);
        xhtml.endElement("a");
    }
    CTHyperlink ctHoverHyperlink = cNvPr.getHlinkHover();
    if (ctHoverHyperlink == null)
        return;
    url = drawingHyperlinks.get(ctHoverHyperlink.getId());
    if (url != null) {
        xhtml.startElement("a", "href", url);
        xhtml.characters(url);
        xhtml.endElement("a");
    }
}
Also used : CTShapeNonVisual(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual) CTNonVisualDrawingProps(org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps) CTHyperlink(org.openxmlformats.schemas.drawingml.x2006.main.CTHyperlink)

Example 4 with CTShapeNonVisual

use of org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual in project tika by apache.

the class XSSFExcelExtractorDecorator method extractHyperLinksFromShape.

private void extractHyperLinksFromShape(CTShape ctShape, XHTMLContentHandler xhtml) throws SAXException {
    if (ctShape == null)
        return;
    CTShapeNonVisual nvSpPR = ctShape.getNvSpPr();
    if (nvSpPR == null)
        return;
    CTNonVisualDrawingProps cNvPr = nvSpPR.getCNvPr();
    if (cNvPr == null)
        return;
    CTHyperlink ctHyperlink = cNvPr.getHlinkClick();
    if (ctHyperlink == null)
        return;
    String url = drawingHyperlinks.get(ctHyperlink.getId());
    if (url != null) {
        xhtml.startElement("a", "href", url);
        xhtml.characters(url);
        xhtml.endElement("a");
    }
    CTHyperlink ctHoverHyperlink = cNvPr.getHlinkHover();
    if (ctHoverHyperlink == null)
        return;
    url = drawingHyperlinks.get(ctHoverHyperlink.getId());
    if (url != null) {
        xhtml.startElement("a", "href", url);
        xhtml.characters(url);
        xhtml.endElement("a");
    }
}
Also used : CTShapeNonVisual(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual) CTNonVisualDrawingProps(org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps) CTHyperlink(org.openxmlformats.schemas.drawingml.x2006.main.CTHyperlink)

Example 5 with CTShapeNonVisual

use of org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual in project poi by apache.

the class XSLFFreeformShape method prototype.

/**
     * @param shapeId 1-based shapeId
     */
static CTShape prototype(int shapeId) {
    CTShape ct = CTShape.Factory.newInstance();
    CTShapeNonVisual nvSpPr = ct.addNewNvSpPr();
    CTNonVisualDrawingProps cnv = nvSpPr.addNewCNvPr();
    cnv.setName("Freeform " + shapeId);
    cnv.setId(shapeId + 1);
    nvSpPr.addNewCNvSpPr();
    nvSpPr.addNewNvPr();
    CTShapeProperties spPr = ct.addNewSpPr();
    CTCustomGeometry2D geom = spPr.addNewCustGeom();
    geom.addNewAvLst();
    geom.addNewGdLst();
    geom.addNewAhLst();
    geom.addNewCxnLst();
    CTGeomRect rect = geom.addNewRect();
    rect.setR("r");
    rect.setB("b");
    rect.setT("t");
    rect.setL("l");
    geom.addNewPathLst();
    return ct;
}
Also used : CTShapeNonVisual(org.openxmlformats.schemas.presentationml.x2006.main.CTShapeNonVisual) CTShapeProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties) CTCustomGeometry2D(org.openxmlformats.schemas.drawingml.x2006.main.CTCustomGeometry2D) CTNonVisualDrawingProps(org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps) CTGeomRect(org.openxmlformats.schemas.drawingml.x2006.main.CTGeomRect) CTShape(org.openxmlformats.schemas.presentationml.x2006.main.CTShape)

Aggregations

CTNonVisualDrawingProps (org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps)5 CTShapeNonVisual (org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual)4 CTShapeProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties)3 CTHyperlink (org.openxmlformats.schemas.drawingml.x2006.main.CTHyperlink)2 CTPresetGeometry2D (org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D)2 CTShape (org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape)2 CTShape (org.openxmlformats.schemas.presentationml.x2006.main.CTShape)2 CTShapeNonVisual (org.openxmlformats.schemas.presentationml.x2006.main.CTShapeNonVisual)2 QName (javax.xml.namespace.QName)1 XmlCursor (org.apache.xmlbeans.XmlCursor)1 CTCustomGeometry2D (org.openxmlformats.schemas.drawingml.x2006.main.CTCustomGeometry2D)1 CTGeomRect (org.openxmlformats.schemas.drawingml.x2006.main.CTGeomRect)1 CTOfficeArtExtension (org.openxmlformats.schemas.drawingml.x2006.main.CTOfficeArtExtension)1 CTOfficeArtExtensionList (org.openxmlformats.schemas.drawingml.x2006.main.CTOfficeArtExtensionList)1 CTPoint2D (org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D)1 CTPositiveSize2D (org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D)1 CTTransform2D (org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D)1