thisListItem.setDepth(listItem.getDepth()+1);
String modelId = thisListItem.getId();
// Find the pt
CTPt thisPoint = getPoint(modelId);
// attach its text
CTTextBody textBody = processText(thisListItem, thisPoint);
if (textFormats.size()<thisListItem.getDepth() ) {
// we don't have a template for this level yet,
// so add this one as the template for this level
if (textBody==null) {
// Add an empty one
textFormats.add(
diagramFactory.createT(
dmlFactory.createCTTextBody()));
} else {
textFormats.add(
diagramFactory.createT(textBody));
}
}
// attach its image
CTPt imgPt = getAssociatedPres(modelId, PRESNAME_FOR_IMAGE);
if (imgPt!=null
&& imgPt.getSpPr()!=null
&& imgPt.getSpPr().getBlipFill()!=null
&& imgPt.getSpPr().getBlipFill().getBlip()!=null) {
// Get the relId
CTBlip blip = imgPt.getSpPr().getBlipFill().getBlip();
if (blip.getEmbed()!=null) {
String relId = blip.getEmbed();
//Relationship r = diagramDataPart.getRelationshipsPart().getRelationshipByID(relId);
BinaryPartAbstractImage bpai = (BinaryPartAbstractImage)diagramDataPart.getRelationshipsPart().getPart(relId);
// Add it
Image image = factory.createSmartArtDataHierarchyImagesImage();
image.setContentType(bpai.getContentType());
image.setId(imgPt.getModelId());
image.setValue(bpai.getBytes());
images.getImage().add(image);
// reference
org.opendope.SmartArt.dataHierarchy.ImageRef imageRef = factory.createImageRef();
imageRef.setContentRef(imgPt.getModelId());
// Other attributes
if (imgPt.getPrSet()!=null ) {
CTElemPropSet props = imgPt.getPrSet();
if (props.getCustLinFactNeighborX()!=null) {
imageRef.setCustLinFactNeighborX(props.getCustLinFactNeighborX());
}
if (props.getCustLinFactNeighborY()!=null) {
imageRef.setCustLinFactNeighborY(props.getCustLinFactNeighborY());
}
if (props.getCustScaleX()!=null) {
imageRef.setCustScaleX(props.getCustScaleX());
}
if (props.getCustScaleY()!=null) {
imageRef.setCustScaleY(props.getCustScaleY());
}
}
thisListItem.setImageRef(imageRef);
} else if (blip.getLink()!=null) {
// TODO
// -check a linked image actually works in SmartArt.
// -our export format could be extended to support linked images
// -and/or we could fetch the image and embed it
}
}
// attach its sibTrans text (if applicable)
CTPt sibTrans = getPoint(thisListItem.getSibTransBody().getContentRef() );
// Don't clutter up our export, if it doesn't contain content
if (sibTrans.getT()!=null
&& sibTrans.getT().getP() !=null
&& sibTrans.getT().getP().get(0) !=null
&& sibTrans.getT().getP().get(0).getEGTextRun() !=null
&& !sibTrans.getT().getP().get(0).getEGTextRun().isEmpty() ) {
IdentifiedText wrapper = factory.createSmartArtDataHierarchyTextsIdentifiedText();
wrapper.setId(sibTrans.getModelId()); // = @sibTransContentRef
wrapper.setT( sibTrans.getT() );
texts.getIdentifiedText().add(wrapper);
} else {
// remove the reference
thisListItem.setSibTransBody(null);
}