package foundation.io.engine;
|
|
import java.util.Map;
|
|
import org.apache.poi.xslf.usermodel.XSLFGraphicFrame;
|
import org.apache.poi.xslf.usermodel.XSLFPictureShape;
|
import org.apache.poi.xslf.usermodel.XSLFShape;
|
import org.apache.poi.xslf.usermodel.XSLFSlide;
|
import org.apache.poi.xslf.usermodel.XSLFTable;
|
import org.apache.poi.xslf.usermodel.XSLFTextShape;
|
|
import foundation.io.file.ppt.GraphicWriter;
|
import foundation.io.file.ppt.PictureShapeWriter;
|
import foundation.io.file.ppt.TableWriter;
|
import foundation.io.file.ppt.TextShapeWriter;
|
|
public abstract class IShapeWriter {
|
protected XSLFShape shape;
|
private String shapeName;
|
|
public IShapeWriter(XSLFShape shape) {
|
super();
|
this.shapeName = shape.getShapeName();
|
}
|
|
public static IShapeWriter createInstance(XSLFShape shape) {
|
|
if (shape instanceof XSLFTextShape) {
|
return new TextShapeWriter((XSLFTextShape)shape);
|
}
|
else if (shape instanceof XSLFTable){
|
return new TableWriter((XSLFTable)shape);
|
}
|
else if (shape instanceof XSLFPictureShape) {
|
return new PictureShapeWriter((XSLFPictureShape)shape);
|
}
|
else if (shape instanceof XSLFGraphicFrame) {
|
return new GraphicWriter((XSLFGraphicFrame)shape);
|
}
|
|
return new TextShapeWriter((XSLFTextShape)shape);
|
}
|
|
public abstract void writeData(XSLFSlide slide, Map<String, Object> data) throws Exception;
|
|
public abstract XSLFShape getShape();
|
}
|