Search in sources :

Example 1 with CTApplicationNonVisualDrawingProps

use of org.openxmlformats.schemas.presentationml.x2006.main.CTApplicationNonVisualDrawingProps in project poi by apache.

the class XSLFCommonSlideData method processShape.

private void processShape(CTGroupShape gs, List<DrawingTextBody> out) {
    for (CTShape shape : gs.getSpArray()) {
        CTTextBody ctTextBody = shape.getTxBody();
        if (ctTextBody == null) {
            continue;
        }
        DrawingTextBody textBody;
        CTApplicationNonVisualDrawingProps nvpr = shape.getNvSpPr().getNvPr();
        if (nvpr.isSetPh()) {
            textBody = new DrawingTextPlaceholder(ctTextBody, nvpr.getPh());
        } else {
            textBody = new DrawingTextBody(ctTextBody);
        }
        out.add(textBody);
    }
}
Also used : CTShape(org.openxmlformats.schemas.presentationml.x2006.main.CTShape) CTApplicationNonVisualDrawingProps(org.openxmlformats.schemas.presentationml.x2006.main.CTApplicationNonVisualDrawingProps) CTTextBody(org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody)

Example 2 with CTApplicationNonVisualDrawingProps

use of org.openxmlformats.schemas.presentationml.x2006.main.CTApplicationNonVisualDrawingProps in project poi by apache.

the class XSLFShape method setPlaceholder.

/**
     * Specifies that the corresponding shape should be represented by the generating application
     * as a placeholder. When a shape is considered a placeholder by the generating application
     * it can have special properties to alert the user that they may enter content into the shape.
     * Different types of placeholders are allowed and can be specified by using the placeholder
     * type attribute for this element
     *
     * @param placeholder The shape to use as placeholder or null if no placeholder should be set.
     */
protected void setPlaceholder(Placeholder placeholder) {
    String xquery = "declare namespace p='" + PML_NS + "' .//*/p:nvPr";
    CTApplicationNonVisualDrawingProps nv = selectProperty(CTApplicationNonVisualDrawingProps.class, xquery);
    if (nv == null)
        return;
    if (placeholder == null) {
        if (nv.isSetPh())
            nv.unsetPh();
        _ph = null;
    } else {
        nv.addNewPh().setType(STPlaceholderType.Enum.forInt(placeholder.ooxmlId));
    }
}
Also used : CTApplicationNonVisualDrawingProps(org.openxmlformats.schemas.presentationml.x2006.main.CTApplicationNonVisualDrawingProps)

Example 3 with CTApplicationNonVisualDrawingProps

use of org.openxmlformats.schemas.presentationml.x2006.main.CTApplicationNonVisualDrawingProps in project poi by apache.

the class XSLFPictureShape method copy.

@Override
void copy(XSLFShape sh) {
    super.copy(sh);
    XSLFPictureShape p = (XSLFPictureShape) sh;
    String blipId = p.getBlipId();
    String relId = getSheet().importBlip(blipId, p.getSheet().getPackagePart());
    CTPicture ct = (CTPicture) getXmlObject();
    CTBlip blip = getBlipFill().getBlip();
    blip.setEmbed(relId);
    CTApplicationNonVisualDrawingProps nvPr = ct.getNvPicPr().getNvPr();
    if (nvPr.isSetCustDataLst()) {
        // discard any custom tags associated with the picture being copied
        nvPr.unsetCustDataLst();
    }
    if (blip.isSetExtLst()) {
        CTOfficeArtExtensionList extLst = blip.getExtLst();
        for (CTOfficeArtExtension ext : extLst.getExtArray()) {
            String xpath = "declare namespace a14='http://schemas.microsoft.com/office/drawing/2010/main' $this//a14:imgProps/a14:imgLayer";
            XmlObject[] obj = ext.selectPath(xpath);
            if (obj != null && obj.length == 1) {
                XmlCursor c = obj[0].newCursor();
                //selectPath("declare namespace r='http://schemas.openxmlformats.org/officeDocument/2006/relationships' $this//[@embed]");
                String id = c.getAttributeText(new QName("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "embed"));
                String newId = getSheet().importBlip(id, p.getSheet().getPackagePart());
                c.setAttributeText(new QName("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "embed"), newId);
                c.dispose();
            }
        }
    }
}
Also used : CTBlip(org.openxmlformats.schemas.drawingml.x2006.main.CTBlip) QName(javax.xml.namespace.QName) CTPicture(org.openxmlformats.schemas.presentationml.x2006.main.CTPicture) CTApplicationNonVisualDrawingProps(org.openxmlformats.schemas.presentationml.x2006.main.CTApplicationNonVisualDrawingProps) CTOfficeArtExtension(org.openxmlformats.schemas.drawingml.x2006.main.CTOfficeArtExtension) XmlObject(org.apache.xmlbeans.XmlObject) CTOfficeArtExtensionList(org.openxmlformats.schemas.drawingml.x2006.main.CTOfficeArtExtensionList) XmlCursor(org.apache.xmlbeans.XmlCursor)

Aggregations

CTApplicationNonVisualDrawingProps (org.openxmlformats.schemas.presentationml.x2006.main.CTApplicationNonVisualDrawingProps)3 QName (javax.xml.namespace.QName)1 XmlCursor (org.apache.xmlbeans.XmlCursor)1 XmlObject (org.apache.xmlbeans.XmlObject)1 CTBlip (org.openxmlformats.schemas.drawingml.x2006.main.CTBlip)1 CTOfficeArtExtension (org.openxmlformats.schemas.drawingml.x2006.main.CTOfficeArtExtension)1 CTOfficeArtExtensionList (org.openxmlformats.schemas.drawingml.x2006.main.CTOfficeArtExtensionList)1 CTTextBody (org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody)1 CTPicture (org.openxmlformats.schemas.presentationml.x2006.main.CTPicture)1 CTShape (org.openxmlformats.schemas.presentationml.x2006.main.CTShape)1