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);
}
}
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));
}
}
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();
}
}
}
}
Aggregations