aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFShapeProperties.java
blob: 9182f26ba8bda3589ac526a77dbcf8bb511c894e (plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
/* ====================================================================
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
==================================================================== */

package org.apache.poi.xddf.usermodel;

import org.apache.poi.util.Beta;
import org.apache.poi.util.Internal;
import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;

@Beta
public class XDDFShapeProperties {
    private CTShapeProperties props;

    public XDDFShapeProperties() {
        this(CTShapeProperties.Factory.newInstance());
    }

    @Internal
    public XDDFShapeProperties(CTShapeProperties properties) {
        this.props = properties;
    }

    @Internal
    public CTShapeProperties getXmlObject() {
        return props;
    }

    public BlackWhiteMode getBlackWhiteMode() {
        if (props.isSetBwMode()) {
            return BlackWhiteMode.valueOf(props.getBwMode());
        } else {
            return null;
        }
    }

    public void setBlackWhiteMode(BlackWhiteMode mode) {
        if (mode == null) {
            if (props.isSetBwMode()) {
                props.unsetBwMode();
            }
        } else {
            props.setBwMode(mode.underlying);
        }
    }

    public XDDFFillProperties getFillProperties() {
        if (props.isSetGradFill()) {
            return new XDDFGradientFillProperties(props.getGradFill());
        } else if (props.isSetGrpFill()) {
            return new XDDFGroupFillProperties(props.getGrpFill());
        } else if (props.isSetNoFill()) {
            return new XDDFNoFillProperties(props.getNoFill());
        } else if (props.isSetPattFill()) {
            return new XDDFPatternFillProperties(props.getPattFill());
        } else if (props.isSetBlipFill()) {
            return new XDDFPictureFillProperties(props.getBlipFill());
        } else if (props.isSetSolidFill()) {
            return new XDDFSolidFillProperties(props.getSolidFill());
        } else {
            return null;
        }
    }

    public void setFillProperties(XDDFFillProperties properties) {
        if (props.isSetBlipFill()) {
            props.unsetBlipFill();
        }
        if (props.isSetGradFill()) {
            props.unsetGradFill();
        }
        if (props.isSetGrpFill()) {
            props.unsetGrpFill();
        }
        if (props.isSetNoFill()) {
            props.unsetNoFill();
        }
        if (props.isSetPattFill()) {
            props.unsetPattFill();
        }
        if (props.isSetSolidFill()) {
            props.unsetSolidFill();
        }
        if (properties == null) {
            return;
        }
        if (properties instanceof XDDFGradientFillProperties) {
            props.setGradFill(((XDDFGradientFillProperties) properties).getXmlObject());
        } else if (properties instanceof XDDFGroupFillProperties) {
            props.setGrpFill(((XDDFGroupFillProperties) properties).getXmlObject());
        } else if (properties instanceof XDDFNoFillProperties) {
            props.setNoFill(((XDDFNoFillProperties) properties).getXmlObject());
        } else if (properties instanceof XDDFPatternFillProperties) {
            props.setPattFill(((XDDFPatternFillProperties) properties).getXmlObject());
        } else if (properties instanceof XDDFPictureFillProperties) {
            props.setBlipFill(((XDDFPictureFillProperties) properties).getXmlObject());
        } else if (properties instanceof XDDFSolidFillProperties) {
            props.setSolidFill(((XDDFSolidFillProperties) properties).getXmlObject());
        }
    }

    public XDDFLineProperties getLineProperties() {
        if (props.isSetLn()) {
            return new XDDFLineProperties(props.getLn());
        } else {
            return null;
        }
    }

    public void setLineProperties(XDDFLineProperties properties) {
        if (properties == null) {
            if (props.isSetLn()) {
                props.unsetLn();
            }
        } else {
            props.setLn(properties.getXmlObject());
        }
    }

    public XDDFCustomGeometry2D getCustomGeometry2D() {
        if (props.isSetCustGeom()) {
            return new XDDFCustomGeometry2D(props.getCustGeom());
        } else {
            return null;
        }
    }

    public void setCustomGeometry2D(XDDFCustomGeometry2D geometry) {
        if (geometry == null) {
            if (props.isSetCustGeom()) {
                props.unsetCustGeom();
            }
        } else {
            props.setCustGeom(geometry.getXmlObject());
        }
    }

    public XDDFPresetGeometry2D getPresetGeometry2D() {
        if (props.isSetPrstGeom()) {
            return new XDDFPresetGeometry2D(props.getPrstGeom());
        } else {
            return null;
        }
    }

    public void setPresetGeometry2D(XDDFPresetGeometry2D geometry) {
        if (geometry == null) {
            if (props.isSetPrstGeom()) {
                props.unsetPrstGeom();
            }
        } else {
            props.setPrstGeom(geometry.getXmlObject());
        }
    }

    public XDDFEffectContainer getEffectContainer() {
        if (props.isSetEffectDag()) {
            return new XDDFEffectContainer(props.getEffectDag());
        } else {
            return null;
        }
    }

    public void setEffectContainer(XDDFEffectContainer container) {
        if (container == null) {
            if (props.isSetEffectDag()) {
                props.unsetEffectDag();
            }
        } else {
            props.setEffectDag(container.getXmlObject());
        }
    }

    public XDDFEffectList getEffectList() {
        if (props.isSetEffectLst()) {
            return new XDDFEffectList(props.getEffectLst());
        } else {
            return null;
        }
    }

    public void setEffectList(XDDFEffectList list) {
        if (list == null) {
            if (props.isSetEffectLst()) {
                props.unsetEffectLst();
            }
        } else {
            props.setEffectLst(list.getXmlObject());
        }
    }

    public XDDFExtensionList getExtensionList() {
        if (props.isSetExtLst()) {
            return new XDDFExtensionList(props.getExtLst());
        } else {
            return null;
        }
    }

    public void setExtensionList(XDDFExtensionList list) {
        if (list == null) {
            if (props.isSetExtLst()) {
                props.unsetExtLst();
            }
        } else {
            props.setExtLst(list.getXmlObject());
        }
    }

    public XDDFScene3D getScene3D() {
        if (props.isSetScene3D()) {
            return new XDDFScene3D(props.getScene3D());
        } else {
            return null;
        }
    }

    public void setScene3D(XDDFScene3D scene) {
        if (scene == null) {
            if (props.isSetScene3D()) {
                props.unsetScene3D();
            }
        } else {
            props.setScene3D(scene.getXmlObject());
        }
    }

    public XDDFShape3D getShape3D() {
        if (props.isSetSp3D()) {
            return new XDDFShape3D(props.getSp3D());
        } else {
            return null;
        }
    }

    public void setShape3D(XDDFShape3D shape) {
        if (shape == null) {
            if (props.isSetSp3D()) {
                props.unsetSp3D();
            }
        } else {
            props.setSp3D(shape.getXmlObject());
        }
    }

    public XDDFTransform2D getTransform2D() {
        if (props.isSetXfrm()) {
            return new XDDFTransform2D(props.getXfrm());
        } else {
            return null;
        }
    }

    public void setTransform2D(XDDFTransform2D transform) {
        if (transform == null) {
            if (props.isSetXfrm()) {
                props.unsetXfrm();
            }
        } else {
            props.setXfrm(transform.getXmlObject());
        }
    }
}