P15GEN2\59518
2025-10-10 9f6890646993d16260d4201d613c092132856127
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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();
}