You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ab...@apache.org on 2018/01/06 02:51:53 UTC
svn commit: r1820369 [3/3] - in /poi/trunk/src:
examples/src/org/apache/poi/xslf/usermodel/
examples/src/org/apache/poi/xssf/usermodel/examples/
ooxml/java/org/apache/poi/xddf/usermodel/
ooxml/java/org/apache/poi/xddf/usermodel/chart/ ooxml/java/org/ap...
Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPictureFillProperties.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPictureFillProperties.java?rev=1820369&view=auto
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPictureFillProperties.java (added)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPictureFillProperties.java Sat Jan 6 02:51:53 2018
@@ -0,0 +1,151 @@
+/* ====================================================================
+ 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.CTBlip;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties;
+
+@Beta
+public class XDDFPictureFillProperties implements XDDFFillProperties {
+ private CTBlipFillProperties props;
+
+ public XDDFPictureFillProperties() {
+ this(CTBlipFillProperties.Factory.newInstance());
+ }
+
+ protected XDDFPictureFillProperties(CTBlipFillProperties properties) {
+ this.props = properties;
+ }
+
+ @Internal
+ protected CTBlipFillProperties getXmlObject() {
+ return props;
+ }
+
+ @Internal
+ public CTBlip getCTBlip() {
+ if (props.isSetBlip()) {
+ return props.getBlip();
+ } else {
+ return null;
+ }
+ }
+
+ @Internal
+ public void setBlip(CTBlip blip) {
+ if (blip == null) {
+ if (props.isSetBlip()) {
+ props.unsetBlip();
+ }
+ } else {
+ props.setBlip(blip);
+ }
+ }
+
+ public Boolean isRotatingWithShape() {
+ if (props.isSetRotWithShape()) {
+ return props.getRotWithShape();
+ } else {
+ return null;
+ }
+ }
+
+ public void setRotatingWithShape(Boolean rotating) {
+ if (rotating == null) {
+ if (props.isSetRotWithShape()) {
+ props.unsetRotWithShape();
+ }
+ } else {
+ props.setRotWithShape(rotating);
+ }
+ }
+
+ public Long getDpi() {
+ if (props.isSetDpi()) {
+ return props.getDpi();
+ } else {
+ return null;
+ }
+ }
+
+ public void setDpi(Long dpi) {
+ if (dpi == null) {
+ if (props.isSetDpi()) {
+ props.unsetDpi();
+ }
+ } else {
+ props.setDpi(dpi);
+ }
+ }
+
+ public XDDFRelativeRectangle getSourceRectangle() {
+ if (props.isSetSrcRect()) {
+ return new XDDFRelativeRectangle(props.getSrcRect());
+ } else {
+ return null;
+ }
+ }
+
+ public void setSourceRectangle(XDDFRelativeRectangle rectangle) {
+ if (rectangle == null) {
+ if (props.isSetSrcRect()) {
+ props.unsetSrcRect();
+ }
+ } else {
+ props.setSrcRect(rectangle.getXmlObject());
+ }
+ }
+
+ public XDDFStretchInfoProperties getStetchInfoProperties() {
+ if (props.isSetStretch()) {
+ return new XDDFStretchInfoProperties(props.getStretch());
+ } else {
+ return null;
+ }
+ }
+
+ public void setStretchInfoProperties(XDDFStretchInfoProperties properties) {
+ if (properties == null) {
+ if (props.isSetStretch()) {
+ props.unsetStretch();
+ }
+ } else {
+ props.setStretch(properties.getXmlObject());
+ }
+ }
+
+ public XDDFTileInfoProperties getTileInfoProperties() {
+ if (props.isSetTile()) {
+ return new XDDFTileInfoProperties(props.getTile());
+ } else {
+ return null;
+ }
+ }
+
+ public void setTileInfoProperties(XDDFTileInfoProperties properties) {
+ if (properties == null) {
+ if (props.isSetTile()) {
+ props.unsetTile();
+ }
+ } else {
+ props.setTile(properties.getXmlObject());
+ }
+ }
+}
Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPoint2D.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPoint2D.java?rev=1820369&view=auto
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPoint2D.java (added)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPoint2D.java Sat Jan 6 02:51:53 2018
@@ -0,0 +1,53 @@
+/* ====================================================================
+ 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.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D;
+
+@Beta
+public class XDDFPoint2D {
+ private CTPoint2D point;
+ private long x;
+ private long y;
+
+ protected XDDFPoint2D(CTPoint2D point) {
+ this.point = point;
+ }
+
+ public XDDFPoint2D(long x, long y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ public long getX() {
+ if (point == null) {
+ return x;
+ } else {
+ return point.getX();
+ }
+ }
+
+ public long getY() {
+ if (point == null) {
+ return y;
+ } else {
+ return point.getY();
+ }
+ }
+}
Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPositiveSize2D.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPositiveSize2D.java?rev=1820369&view=auto
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPositiveSize2D.java (added)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPositiveSize2D.java Sat Jan 6 02:51:53 2018
@@ -0,0 +1,56 @@
+/* ====================================================================
+ 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.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D;
+
+@Beta
+public class XDDFPositiveSize2D {
+ private CTPositiveSize2D size;
+ private long x;
+ private long y;
+
+ protected XDDFPositiveSize2D(CTPositiveSize2D size) {
+ this.size = size;
+ }
+
+ public XDDFPositiveSize2D(long x, long y) {
+ if (x <0 || y < 0) {
+ throw new IllegalArgumentException("x and y must be positive");
+ }
+ this.x = x;
+ this.y = y;
+ }
+
+ public long getX() {
+ if (size == null) {
+ return x;
+ } else {
+ return size.getCx();
+ }
+ }
+
+ public long getY() {
+ if (size == null) {
+ return y;
+ } else {
+ return size.getCy();
+ }
+ }
+}
Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPresetGeometry2D.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPresetGeometry2D.java?rev=1820369&view=auto
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPresetGeometry2D.java (added)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPresetGeometry2D.java Sat Jan 6 02:51:53 2018
@@ -0,0 +1,89 @@
+/* ====================================================================
+ 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 java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.poi.util.Beta;
+import org.apache.poi.util.Internal;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D;
+
+@Beta
+public class XDDFPresetGeometry2D {
+ private CTPresetGeometry2D geometry;
+
+ protected XDDFPresetGeometry2D(CTPresetGeometry2D geometry) {
+ this.geometry = geometry;
+ }
+
+ @Internal
+ protected CTPresetGeometry2D getXmlObject() {
+ return geometry;
+ }
+
+ public PresetGeometry getGeometry() {
+ return PresetGeometry.valueOf(geometry.getPrst());
+ }
+
+ public void setGeometry(PresetGeometry preset) {
+ geometry.setPrst(preset.underlying);
+ }
+
+ public XDDFGeometryGuide addAdjustValue() {
+ if (!geometry.isSetAvLst()) {
+ geometry.addNewAvLst();
+ }
+ return new XDDFGeometryGuide(geometry.getAvLst().addNewGd());
+ }
+
+ public XDDFGeometryGuide insertAdjustValue(int index) {
+ if (!geometry.isSetAvLst()) {
+ geometry.addNewAvLst();
+ }
+ return new XDDFGeometryGuide(geometry.getAvLst().insertNewGd(index));
+ }
+
+ public void removeAdjustValue(int index) {
+ if (geometry.isSetAvLst()) {
+ geometry.getAvLst().removeGd(index);
+ }
+ }
+
+ public XDDFGeometryGuide getAdjustValue(int index) {
+ if (geometry.isSetAvLst()) {
+ return new XDDFGeometryGuide(geometry.getAvLst().getGdArray(index));
+ } else {
+ return null;
+ }
+ }
+
+ public List<XDDFGeometryGuide> getAdjustValues() {
+ if (geometry.isSetAvLst()) {
+ return Collections.unmodifiableList(geometry
+ .getAvLst()
+ .getGdList()
+ .stream()
+ .map(guide -> new XDDFGeometryGuide(guide))
+ .collect(Collectors.toList()));
+ } else {
+ return Collections.emptyList();
+ }
+ }
+}
Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPresetLineDash.java (from r1820242, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLayout.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPresetLineDash.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPresetLineDash.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLayout.java&r1=1820242&r2=1820369&rev=1820369&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLayout.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPresetLineDash.java Sat Jan 6 02:51:53 2018
@@ -15,59 +15,45 @@
limitations under the License.
==================================================================== */
-package org.apache.poi.xddf.usermodel.chart;
+package org.apache.poi.xddf.usermodel;
import org.apache.poi.util.Beta;
import org.apache.poi.util.Internal;
-import org.openxmlformats.schemas.drawingml.x2006.chart.CTLayout;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPresetLineDashProperties;
@Beta
-public class XDDFLayout {
- private CTLayout layout;
+public class XDDFPresetLineDash {
+ private CTPresetLineDashProperties props;
- public XDDFLayout() {
- this(CTLayout.Factory.newInstance());
+ public XDDFPresetLineDash(PresetLineDash dash) {
+ this(CTPresetLineDashProperties.Factory.newInstance());
+ setValue(dash);
}
- @Internal
- protected XDDFLayout(CTLayout layout) {
- this.layout = layout;
+ protected XDDFPresetLineDash(CTPresetLineDashProperties properties) {
+ this.props = properties;
}
@Internal
- protected CTLayout getXmlObject() {
- return layout;
- }
-
- public void setExtensionList(XDDFChartExtensionList list) {
- if (list == null) {
- layout.unsetExtLst();
- } else {
- layout.setExtLst(list.getXmlObject());
- }
+ protected CTPresetLineDashProperties getXmlObject() {
+ return props;
}
- public XDDFChartExtensionList getExtensionList() {
- if (layout.isSetExtLst()) {
- return new XDDFChartExtensionList(layout.getExtLst());
+ public PresetLineDash getValue() {
+ if (props.isSetVal()) {
+ return PresetLineDash.valueOf(props.getVal());
} else {
return null;
}
}
- public void setManualLayout(XDDFManualLayout manual) {
- if (manual == null) {
- layout.unsetManualLayout();
+ public void setValue(PresetLineDash dash) {
+ if (dash == null) {
+ if (props.isSetVal()) {
+ props.unsetVal();
+ }
} else {
- layout.setManualLayout(manual.getXmlObject());
- }
- }
-
- public XDDFManualLayout getManualLayout() {
- if (layout.isSetManualLayout()) {
- return new XDDFManualLayout(layout);
- } else {
- return null;
+ props.setVal(dash.underlying);
}
}
}
Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFRelativeRectangle.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFRelativeRectangle.java?rev=1820369&view=auto
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFRelativeRectangle.java (added)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFRelativeRectangle.java Sat Jan 6 02:51:53 2018
@@ -0,0 +1,112 @@
+/* ====================================================================
+ 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.CTRelativeRect;
+
+@Beta
+public class XDDFRelativeRectangle {
+ private CTRelativeRect rect;
+
+ public XDDFRelativeRectangle() {
+ this(CTRelativeRect.Factory.newInstance());
+ }
+
+ protected XDDFRelativeRectangle(CTRelativeRect rectangle) {
+ this.rect = rectangle;
+ }
+
+ @Internal
+ protected CTRelativeRect getXmlObject() {
+ return rect;
+ }
+
+ public Integer getBottom() {
+ if (rect.isSetB()) {
+ return rect.getB();
+ } else {
+ return null;
+ }
+ }
+
+ public void setBottom(Integer bottom) {
+ if (bottom == null) {
+ if (rect.isSetB()) {
+ rect.unsetB();
+ }
+ } else {
+ rect.setB(bottom);
+ }
+ }
+
+ public Integer getLeft() {
+ if (rect.isSetL()) {
+ return rect.getL();
+ } else {
+ return null;
+ }
+ }
+
+ public void setLeft(Integer left) {
+ if (left == null) {
+ if (rect.isSetL()) {
+ rect.unsetL();
+ }
+ } else {
+ rect.setL(left);
+ }
+ }
+
+ public Integer getRight() {
+ if (rect.isSetR()) {
+ return rect.getR();
+ } else {
+ return null;
+ }
+ }
+
+ public void setRight(Integer right) {
+ if (right == null) {
+ if (rect.isSetR()) {
+ rect.unsetR();
+ }
+ } else {
+ rect.setR(right);
+ }
+ }
+
+ public Integer getTop() {
+ if (rect.isSetT()) {
+ return rect.getT();
+ } else {
+ return null;
+ }
+ }
+
+ public void setTop(Integer top) {
+ if (top == null) {
+ if (rect.isSetT()) {
+ rect.unsetT();
+ }
+ } else {
+ rect.setT(top);
+ }
+ }
+}
Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFScene3D.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFScene3D.java?rev=1820369&view=auto
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFScene3D.java (added)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFScene3D.java Sat Jan 6 02:51:53 2018
@@ -0,0 +1,36 @@
+/* ====================================================================
+ 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.CTScene3D;
+
+@Beta
+public class XDDFScene3D {
+ private CTScene3D scene;
+
+ protected XDDFScene3D(CTScene3D scene) {
+ this.scene = scene;
+ }
+
+ @Internal
+ public CTScene3D getXmlObject() {
+ return scene;
+ }
+}
Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFShape3D.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFShape3D.java?rev=1820369&view=auto
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFShape3D.java (added)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFShape3D.java Sat Jan 6 02:51:53 2018
@@ -0,0 +1,36 @@
+/* ====================================================================
+ 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.CTShape3D;
+
+@Beta
+public class XDDFShape3D {
+ private CTShape3D shape;
+
+ protected XDDFShape3D(CTShape3D shape) {
+ this.shape = shape;
+ }
+
+ @Internal
+ public CTShape3D getXmlObject() {
+ return shape;
+ }
+}
Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFShapeProperties.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFShapeProperties.java?rev=1820369&view=auto
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFShapeProperties.java (added)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFShapeProperties.java Sat Jan 6 02:51:53 2018
@@ -0,0 +1,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());
+ }
+ }
+}
Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFSolidFillProperties.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFSolidFillProperties.java?rev=1820369&view=auto
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFSolidFillProperties.java (added)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFSolidFillProperties.java Sat Jan 6 02:51:53 2018
@@ -0,0 +1,105 @@
+/* ====================================================================
+ 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.CTHslColor;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPresetColor;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTScRgbColor;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTSystemColor;
+
+@Beta
+public class XDDFSolidFillProperties implements XDDFFillProperties {
+ private CTSolidColorFillProperties props;
+
+ public XDDFSolidFillProperties() {
+ this(CTSolidColorFillProperties.Factory.newInstance());
+ }
+
+ public XDDFSolidFillProperties(XDDFColor color) {
+ this(CTSolidColorFillProperties.Factory.newInstance());
+ setColor(color);
+ }
+
+ protected XDDFSolidFillProperties(CTSolidColorFillProperties properties) {
+ this.props = properties;
+ }
+
+ @Internal
+ protected CTSolidColorFillProperties getXmlObject() {
+ return props;
+ }
+
+ public XDDFColor getColor() {
+ if (props.isSetHslClr()) {
+ return new XDDFColorHsl(props.getHslClr());
+ } else if (props.isSetPrstClr()) {
+ return new XDDFColorPreset(props.getPrstClr());
+ } else if (props.isSetSchemeClr()) {
+ return new XDDFColorSchemeBased(props.getSchemeClr());
+ } else if (props.isSetScrgbClr()) {
+ return new XDDFColorRgbPercent(props.getScrgbClr());
+ } else if (props.isSetSrgbClr()) {
+ return new XDDFColorRgbBinary(props.getSrgbClr());
+ } else if (props.isSetSysClr()) {
+ return new XDDFColorSystemDefined(props.getSysClr());
+ }
+ return null;
+ }
+
+ public void setColor(XDDFColor color) {
+ if (props.isSetHslClr()) {
+ props.unsetHslClr();
+ }
+ if (props.isSetPrstClr()) {
+ props.unsetPrstClr();
+ }
+ if (props.isSetSchemeClr()) {
+ props.unsetSchemeClr();
+ }
+ if (props.isSetScrgbClr()) {
+ props.unsetScrgbClr();
+ }
+ if (props.isSetSrgbClr()) {
+ props.unsetSrgbClr();
+ }
+ if (props.isSetSysClr()) {
+ props.unsetSysClr();
+ }
+ if (color == null) {
+ return;
+ }
+ if (color instanceof XDDFColorHsl) {
+ props.setHslClr((CTHslColor) color.getXmlObject());
+ } else if (color instanceof XDDFColorPreset) {
+ props.setPrstClr((CTPresetColor) color.getXmlObject());
+ } else if (color instanceof XDDFColorSchemeBased) {
+ props.setSchemeClr((CTSchemeColor) color.getXmlObject());
+ } else if (color instanceof XDDFColorRgbPercent) {
+ props.setScrgbClr((CTScRgbColor) color.getXmlObject());
+ } else if (color instanceof XDDFColorRgbBinary) {
+ props.setSrgbClr((CTSRgbColor) color.getXmlObject());
+ } else if (color instanceof XDDFColorSystemDefined) {
+ props.setSysClr((CTSystemColor) color.getXmlObject());
+ }
+ }
+}
Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFStretchInfoProperties.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFStretchInfoProperties.java?rev=1820369&view=auto
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFStretchInfoProperties.java (added)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFStretchInfoProperties.java Sat Jan 6 02:51:53 2018
@@ -0,0 +1,54 @@
+/* ====================================================================
+ 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.CTStretchInfoProperties;
+
+@Beta
+public class XDDFStretchInfoProperties {
+ private CTStretchInfoProperties props;
+
+ protected XDDFStretchInfoProperties(CTStretchInfoProperties properties) {
+ this.props = properties;
+ }
+
+ @Internal
+ protected CTStretchInfoProperties getXmlObject() {
+ return props;
+ }
+
+ public XDDFRelativeRectangle getFillRectangle() {
+ if (props.isSetFillRect()) {
+ return new XDDFRelativeRectangle(props.getFillRect());
+ } else {
+ return null;
+ }
+ }
+
+ public void setFillRectangle(XDDFRelativeRectangle rectangle) {
+ if (rectangle == null) {
+ if (props.isSetFillRect()) {
+ props.unsetFillRect();
+ }
+ } else {
+ props.setFillRect(rectangle.getXmlObject());
+ }
+ }
+}
Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFTileInfoProperties.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFTileInfoProperties.java?rev=1820369&view=auto
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFTileInfoProperties.java (added)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFTileInfoProperties.java Sat Jan 6 02:51:53 2018
@@ -0,0 +1,136 @@
+/* ====================================================================
+ 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.CTTileInfoProperties;
+
+@Beta
+public class XDDFTileInfoProperties {
+ private CTTileInfoProperties props;
+
+ protected XDDFTileInfoProperties(CTTileInfoProperties properties) {
+ this.props = properties;
+ }
+
+ @Internal
+ protected CTTileInfoProperties getXmlObject() {
+ return props;
+ }
+
+ public void setAlignment(RectangleAlignment alignment) {
+ if (alignment == null) {
+ if (props.isSetAlgn()) {
+ props.unsetAlgn();
+ }
+ } else {
+ props.setAlgn(alignment.underlying);
+ }
+ }
+
+ public TileFlipMode getFlipMode() {
+ if (props.isSetFlip()) {
+ return TileFlipMode.valueOf(props.getFlip());
+ } else {
+ return null;
+ }
+ }
+
+ public void setFlipMode(TileFlipMode mode) {
+ if (mode == null) {
+ if (props.isSetFlip()) {
+ props.unsetFlip();
+ }
+ } else {
+ props.setFlip(mode.underlying);
+ }
+ }
+
+ public Integer getSx() {
+ if (props.isSetSx()) {
+ return props.getSx();
+ } else {
+ return null;
+ }
+ }
+
+ public void setSx(Integer value) {
+ if (value == null) {
+ if (props.isSetSx()) {
+ props.unsetSx();
+ }
+ } else {
+ props.setSx(value);
+ }
+ }
+
+ public Integer getSy() {
+ if (props.isSetSy()) {
+ return props.getSy();
+ } else {
+ return null;
+ }
+ }
+
+ public void setSy(Integer value) {
+ if (value == null) {
+ if (props.isSetSy()) {
+ props.unsetSy();
+ }
+ } else {
+ props.setSy(value);
+ }
+ }
+
+ public Long getTx() {
+ if (props.isSetTx()) {
+ return props.getTx();
+ } else {
+ return null;
+ }
+ }
+
+ public void setTx(Long value) {
+ if (value == null) {
+ if (props.isSetTx()) {
+ props.unsetTx();
+ }
+ } else {
+ props.setTx(value);
+ }
+ }
+
+ public Long getTy() {
+ if (props.isSetTy()) {
+ return props.getTy();
+ } else {
+ return null;
+ }
+ }
+
+ public void setTy(Long value) {
+ if (value == null) {
+ if (props.isSetTy()) {
+ props.unsetTy();
+ }
+ } else {
+ props.setTy(value);
+ }
+ }
+}
Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFTransform2D.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFTransform2D.java?rev=1820369&view=auto
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFTransform2D.java (added)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFTransform2D.java Sat Jan 6 02:51:53 2018
@@ -0,0 +1,140 @@
+/* ====================================================================
+ 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.CTPoint2D;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D;
+
+@Beta
+public class XDDFTransform2D {
+ private CTTransform2D transform;
+
+ protected XDDFTransform2D(CTTransform2D transform) {
+ this.transform = transform;
+ }
+
+ @Internal
+ protected CTTransform2D getXmlObject() {
+ return transform;
+ }
+
+ public Boolean getFlipHorizontal() {
+ if (transform.isSetFlipH()) {
+ return transform.getFlipH();
+ } else {
+ return null;
+ }
+ }
+
+ public void setFlipHorizontal(Boolean flip) {
+ if (flip == null) {
+ if (transform.isSetFlipH()) {
+ transform.unsetFlipH();
+ }
+ } else {
+ transform.setFlipH(flip);
+ }
+ }
+
+ public Boolean getFlipVertical() {
+ if (transform.isSetFlipV()) {
+ return transform.getFlipV();
+ } else {
+ return null;
+ }
+ }
+
+ public void setFlipVertical(Boolean flip) {
+ if (flip == null) {
+ if (transform.isSetFlipV()) {
+ transform.unsetFlipV();
+ }
+ } else {
+ transform.setFlipV(flip);
+ }
+ }
+
+ public XDDFPositiveSize2D getExtension() {
+ if (transform.isSetExt()) {
+ return new XDDFPositiveSize2D(transform.getExt());
+ } else {
+ return null;
+ }
+ }
+
+ public void setExtension(XDDFPositiveSize2D extension) {
+ CTPositiveSize2D xformExt;
+ if (extension == null) {
+ if (transform.isSetExt()) {
+ transform.unsetExt();
+ }
+ return;
+ } else if (transform.isSetExt()) {
+ xformExt = transform.getExt();
+ } else {
+ xformExt = transform.addNewExt();
+ }
+ xformExt.setCx(extension.getX());
+ xformExt.setCy(extension.getY());
+ }
+
+ public XDDFPoint2D getOffset() {
+ if (transform.isSetOff()) {
+ return new XDDFPoint2D(transform.getOff());
+ } else {
+ return null;
+ }
+ }
+
+ public void setOffset(XDDFPoint2D offset) {
+ CTPoint2D xformOff;
+ if (offset == null) {
+ if (transform.isSetOff()) {
+ transform.unsetOff();
+ }
+ return;
+ } else if (transform.isSetOff()) {
+ xformOff = transform.getOff();
+ } else {
+ xformOff = transform.addNewOff();
+ }
+ xformOff.setX(offset.getX());
+ xformOff.setY(offset.getY());
+ }
+
+ public Integer getRotation() {
+ if (transform.isSetRot()) {
+ return transform.getRot();
+ } else {
+ return null;
+ }
+ }
+
+ public void setRotation(Integer rotation) {
+ if (rotation == null) {
+ if (transform.isSetRot()) {
+ transform.unsetRot();
+ }
+ } else {
+ transform.setRot(rotation);
+ }
+ }
+}
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java?rev=1820369&r1=1820368&r2=1820369&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java Sat Jan 6 02:51:53 2018
@@ -20,6 +20,7 @@ package org.apache.poi.xddf.usermodel.ch
import java.util.Map;
import org.apache.poi.util.Beta;
+import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTBarChart;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTBarSer;
@@ -133,6 +134,30 @@ public class XDDFBarChartData extends XD
}
}
+ @Override
+ public XDDFShapeProperties getShapeProperties() {
+ if (series.isSetSpPr()) {
+ return new XDDFShapeProperties(series.getSpPr());
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public void setShapeProperties(XDDFShapeProperties properties) {
+ if (properties == null) {
+ if (series.isSetSpPr()) {
+ series.unsetSpPr();
+ }
+ } else {
+ if (series.isSetSpPr()) {
+ series.setSpPr(properties.getXmlObject());
+ } else {
+ series.addNewSpPr().set(properties.getXmlObject());
+ }
+ }
+ }
+
@Override
protected CTAxDataSource getAxDS() {
return series.getCat();
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFCategoryAxis.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFCategoryAxis.java?rev=1820369&r1=1820368&r2=1820369&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFCategoryAxis.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFCategoryAxis.java Sat Jan 6 02:51:53 2018
@@ -18,10 +18,11 @@
package org.apache.poi.xddf.usermodel.chart;
import org.apache.poi.util.Beta;
-import org.apache.poi.util.Internal;
+import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxPos;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTBoolean;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTCatAx;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTChartLines;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTCrosses;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumFmt;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea;
@@ -45,21 +46,37 @@ public class XDDFCategoryAxis extends XD
}
@Override
- @Internal
- public CTShapeProperties getMajorGridLines() {
- if (!ctCatAx.isSetMajorGridlines()) {
- ctCatAx.addNewMajorGridlines();
+ public XDDFShapeProperties getOrAddMajorGridProperties() {
+ CTChartLines majorGridlines;
+ if (ctCatAx.isSetMajorGridlines()) {
+ majorGridlines = ctCatAx.getMajorGridlines();
+ } else {
+ majorGridlines = ctCatAx.addNewMajorGridlines();
}
- if (!ctCatAx.getMajorGridlines().isSetSpPr()) {
- ctCatAx.getMajorGridlines().addNewSpPr();
+ return new XDDFShapeProperties(getOrAddLinesProperties(majorGridlines));
+ }
+
+ @Override
+ public XDDFShapeProperties getOrAddMinorGridProperties() {
+ CTChartLines minorGridlines;
+ if (ctCatAx.isSetMinorGridlines()) {
+ minorGridlines = ctCatAx.getMinorGridlines();
+ } else {
+ minorGridlines = ctCatAx.addNewMinorGridlines();
}
- return ctCatAx.getMajorGridlines().getSpPr();
+ return new XDDFShapeProperties(getOrAddLinesProperties(minorGridlines));
}
@Override
- @Internal
- public CTShapeProperties getLine() {
- return ctCatAx.getSpPr();
+ public XDDFShapeProperties getOrAddShapeProperties() {
+ CTShapeProperties properties;
+ if (ctCatAx.isSetSpPr()) {
+ properties = ctCatAx.getSpPr();
+ } else {
+ properties = ctCatAx.addNewSpPr();
+ }
+
+ return new XDDFShapeProperties(properties);
}
@Override
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java?rev=1820369&r1=1820368&r2=1820369&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java Sat Jan 6 02:51:53 2018
@@ -33,6 +33,7 @@ import org.apache.poi.POIXMLDocumentPart
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.util.Beta;
import org.apache.poi.util.Internal;
+import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.apache.xmlbeans.XmlException;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTBarChart;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTBoolean;
@@ -48,6 +49,7 @@ import org.openxmlformats.schemas.drawin
import org.openxmlformats.schemas.drawingml.x2006.chart.CTSurface;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTValAx;
import org.openxmlformats.schemas.drawingml.x2006.chart.ChartSpaceDocument;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;
@Beta
public abstract class XDDFChart extends POIXMLDocumentPart {
@@ -172,6 +174,23 @@ public abstract class XDDFChart extends
chart.getAutoTitleDeleted().setVal(deleted);
}
+ public XDDFShapeProperties getOrAddShapeProperties() {
+ CTPlotArea plotArea = getCTPlotArea();
+ CTShapeProperties properties;
+ if (plotArea.isSetSpPr()) {
+ properties = plotArea.getSpPr();
+ } else {
+ properties = plotArea.addNewSpPr();
+ }
+ return new XDDFShapeProperties(properties);
+ }
+
+ public void deleteShapeProperties() {
+ if (getCTPlotArea().isSetSpPr()) {
+ getCTPlotArea().unsetSpPr();
+ }
+ }
+
public XDDFChartLegend getOrAddLegend() {
return new XDDFChartLegend(chart);
}
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartAxis.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartAxis.java?rev=1820369&r1=1820368&r2=1820369&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartAxis.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartAxis.java Sat Jan 6 02:51:53 2018
@@ -18,9 +18,11 @@
package org.apache.poi.xddf.usermodel.chart;
import org.apache.poi.util.Beta;
-import org.apache.poi.util.Internal;
+import org.apache.poi.xddf.usermodel.HasShapeProperties;
+import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxPos;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTBoolean;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTChartLines;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTCrosses;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTLogBase;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumFmt;
@@ -34,7 +36,7 @@ import org.openxmlformats.schemas.drawin
* Base class for all axis types.
*/
@Beta
-public abstract class XDDFChartAxis {
+public abstract class XDDFChartAxis implements HasShapeProperties {
protected abstract CTUnsignedInt getCTAxId();
protected abstract CTAxPos getCTAxPos();
@@ -51,11 +53,9 @@ public abstract class XDDFChartAxis {
protected abstract CTTickMark getMinorCTTickMark();
- @Internal
- public abstract CTShapeProperties getMajorGridLines();
+ public abstract XDDFShapeProperties getOrAddMajorGridProperties();
- @Internal
- public abstract CTShapeProperties getLine();
+ public abstract XDDFShapeProperties getOrAddMinorGridProperties();
/**
* @return axis id
@@ -80,8 +80,8 @@ public abstract class XDDFChartAxis {
}
/**
- * Use this to check before retrieving a number format, as calling {@link #getNumberFormat()} may create a default
- * one if none exists.
+ * Use this to check before retrieving a number format, as calling
+ * {@link #getNumberFormat()} may create a default one if none exists.
*
* @return true if a number format element is defined, false if not
*/
@@ -294,6 +294,16 @@ public abstract class XDDFChartAxis {
getMinorCTTickMark().setVal(tickMark.underlying);
}
+ protected CTShapeProperties getOrAddLinesProperties(CTChartLines gridlines) {
+ CTShapeProperties properties;
+ if (gridlines.isSetSpPr()) {
+ properties = gridlines.getSpPr();
+ } else {
+ properties = gridlines.addNewSpPr();
+ }
+ return properties;
+ }
+
protected long getNextAxId(CTPlotArea plotArea) {
long totalAxisCount = plotArea.sizeOfValAxArray() + plotArea.sizeOfCatAxArray() + plotArea.sizeOfDateAxArray()
+ plotArea.sizeOfSerAxArray();
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java?rev=1820369&r1=1820368&r2=1820369&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java Sat Jan 6 02:51:53 2018
@@ -24,6 +24,7 @@ import java.util.Map;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.util.Beta;
+import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumData;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource;
@@ -87,6 +88,8 @@ public abstract class XDDFChartData {
protected abstract CTSerTx getSeriesText();
public abstract void setShowLeaderLines(boolean showLeaderLines);
+ public abstract XDDFShapeProperties getShapeProperties();
+ public abstract void setShapeProperties(XDDFShapeProperties properties);
protected XDDFDataSource<?> categoryData;
protected XDDFNumericalDataSource<? extends Number> valuesData;
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartLegend.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartLegend.java?rev=1820369&r1=1820368&r2=1820369&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartLegend.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartLegend.java Sat Jan 6 02:51:53 2018
@@ -79,7 +79,9 @@ public final class XDDFChartLegend {
@Internal // will later replace with XDDFShapeProperties
public void setShapeProperties(CTShapeProperties properties) {
if (properties == null) {
- legend.unsetSpPr();
+ if (legend.isSetSpPr()) {
+ legend.unsetSpPr();
+ }
} else {
legend.setSpPr(properties);
}
@@ -95,7 +97,9 @@ public final class XDDFChartLegend {
public void setTextBody(XDDFTextBody body) {
if (body == null) {
- legend.unsetTxPr();
+ if (legend.isSetTxPr()) {
+ legend.unsetTxPr();
+ }
} else {
legend.setTxPr(body.getXmlObject());
}
@@ -119,7 +123,9 @@ public final class XDDFChartLegend {
public void setExtensionList(XDDFChartExtensionList list) {
if (list == null) {
- legend.unsetExtLst();
+ if (legend.isSetExtLst()) {
+ legend.unsetExtLst();
+ }
} else {
legend.setExtLst(list.getXmlObject());
}
@@ -135,7 +141,9 @@ public final class XDDFChartLegend {
public void setLayout(XDDFLayout layout) {
if (layout == null) {
- legend.unsetLayout();
+ if (legend.isSetLayout()) {
+ legend.unsetLayout();
+ }
} else {
legend.setLayout(layout.getXmlObject());
}
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDateAxis.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDateAxis.java?rev=1820369&r1=1820368&r2=1820369&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDateAxis.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDateAxis.java Sat Jan 6 02:51:53 2018
@@ -18,9 +18,10 @@
package org.apache.poi.xddf.usermodel.chart;
import org.apache.poi.util.Beta;
-import org.apache.poi.util.Internal;
+import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxPos;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTBoolean;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTChartLines;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTCrosses;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTDateAx;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumFmt;
@@ -32,8 +33,8 @@ import org.openxmlformats.schemas.drawin
import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;
/**
- * Date axis type. Currently only implements the same values as {@link XDDFCategoryAxis}, since the two are nearly
- * identical.
+ * Date axis type. Currently only implements the same values as
+ * {@link XDDFCategoryAxis}, since the two are nearly identical.
*/
@Beta
public class XDDFDateAxis extends XDDFChartAxis {
@@ -49,21 +50,36 @@ public class XDDFDateAxis extends XDDFCh
}
@Override
- @Internal
- public CTShapeProperties getMajorGridLines() {
- if (!ctDateAx.isSetMajorGridlines()) {
- ctDateAx.addNewMajorGridlines();
+ public XDDFShapeProperties getOrAddMajorGridProperties() {
+ CTChartLines majorGridlines;
+ if (ctDateAx.isSetMajorGridlines()) {
+ majorGridlines = ctDateAx.getMajorGridlines();
+ } else {
+ majorGridlines = ctDateAx.addNewMajorGridlines();
}
- if (!ctDateAx.getMajorGridlines().isSetSpPr()) {
- ctDateAx.getMajorGridlines().addNewSpPr();
+ return new XDDFShapeProperties(getOrAddLinesProperties(majorGridlines));
+ }
+
+ @Override
+ public XDDFShapeProperties getOrAddMinorGridProperties() {
+ CTChartLines minorGridlines;
+ if (ctDateAx.isSetMinorGridlines()) {
+ minorGridlines = ctDateAx.getMinorGridlines();
+ } else {
+ minorGridlines = ctDateAx.addNewMinorGridlines();
}
- return ctDateAx.getMajorGridlines().getSpPr();
+ return new XDDFShapeProperties(getOrAddLinesProperties(minorGridlines));
}
@Override
- @Internal
- public CTShapeProperties getLine() {
- return ctDateAx.getSpPr();
+ public XDDFShapeProperties getOrAddShapeProperties() {
+ CTShapeProperties properties;
+ if (ctDateAx.isSetSpPr()) {
+ properties = ctDateAx.getSpPr();
+ } else {
+ properties = ctDateAx.addNewSpPr();
+ }
+ return new XDDFShapeProperties(properties);
}
@Override
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLayout.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLayout.java?rev=1820369&r1=1820368&r2=1820369&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLayout.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLayout.java Sat Jan 6 02:51:53 2018
@@ -41,7 +41,9 @@ public class XDDFLayout {
public void setExtensionList(XDDFChartExtensionList list) {
if (list == null) {
- layout.unsetExtLst();
+ if (layout.isSetExtLst()) {
+ layout.unsetExtLst();
+ }
} else {
layout.setExtLst(list.getXmlObject());
}
@@ -57,7 +59,9 @@ public class XDDFLayout {
public void setManualLayout(XDDFManualLayout manual) {
if (manual == null) {
- layout.unsetManualLayout();
+ if (layout.isSetManualLayout()) {
+ layout.unsetManualLayout();
+ }
} else {
layout.setManualLayout(manual.getXmlObject());
}
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLegendEntry.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLegendEntry.java?rev=1820369&r1=1820368&r2=1820369&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLegendEntry.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLegendEntry.java Sat Jan 6 02:51:53 2018
@@ -46,7 +46,9 @@ public class XDDFLegendEntry {
public void setTextBody(XDDFTextBody body) {
if (body == null) {
- entry.unsetTxPr();
+ if (entry.isSetTxPr()) {
+ entry.unsetTxPr();
+ }
} else {
entry.setTxPr(body.getXmlObject());
}
@@ -62,7 +64,9 @@ public class XDDFLegendEntry {
public void setDelete(Boolean delete) {
if (delete == null) {
- entry.unsetDelete();
+ if (entry.isSetDelete()) {
+ entry.unsetDelete();
+ }
} else {
if (entry.isSetDelete()) {
entry.getDelete().setVal(delete);
@@ -82,7 +86,9 @@ public class XDDFLegendEntry {
public void setExtensionList(XDDFChartExtensionList list) {
if (list == null) {
- entry.unsetExtLst();
+ if (entry.isSetExtLst()) {
+ entry.unsetExtLst();
+ }
} else {
entry.setExtLst(list.getXmlObject());
}
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLineChartData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLineChartData.java?rev=1820369&r1=1820368&r2=1820369&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLineChartData.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLineChartData.java Sat Jan 6 02:51:53 2018
@@ -20,6 +20,7 @@ package org.apache.poi.xddf.usermodel.ch
import java.util.Map;
import org.apache.poi.util.Beta;
+import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTLineChart;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTLineSer;
@@ -102,6 +103,30 @@ public class XDDFLineChartData extends X
}
}
+ @Override
+ public XDDFShapeProperties getShapeProperties() {
+ if (series.isSetSpPr()) {
+ return new XDDFShapeProperties(series.getSpPr());
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public void setShapeProperties(XDDFShapeProperties properties) {
+ if (properties == null) {
+ if (series.isSetSpPr()) {
+ series.unsetSpPr();
+ }
+ } else {
+ if (series.isSetSpPr()) {
+ series.setSpPr(properties.getXmlObject());
+ } else {
+ series.addNewSpPr().set(properties.getXmlObject());
+ }
+ }
+ }
+
public void setMarkerSize(short size) {
CTMarker marker = getMarker();
if (marker.isSetSize()) {
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFManualLayout.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFManualLayout.java?rev=1820369&r1=1820368&r2=1820369&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFManualLayout.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFManualLayout.java Sat Jan 6 02:51:53 2018
@@ -71,7 +71,9 @@ public final class XDDFManualLayout {
public void setExtensionList(XDDFChartExtensionList list) {
if (list == null) {
- layout.unsetExtLst();
+ if (layout.isSetExtLst()) {
+ layout.unsetExtLst();
+ }
} else {
layout.setExtLst(list.getXmlObject());
}
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFPieChartData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFPieChartData.java?rev=1820369&r1=1820368&r2=1820369&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFPieChartData.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFPieChartData.java Sat Jan 6 02:51:53 2018
@@ -18,6 +18,7 @@
package org.apache.poi.xddf.usermodel.chart;
import org.apache.poi.util.Beta;
+import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTPieChart;
@@ -89,6 +90,30 @@ public class XDDFPieChartData extends XD
}
}
+ @Override
+ public XDDFShapeProperties getShapeProperties() {
+ if (series.isSetSpPr()) {
+ return new XDDFShapeProperties(series.getSpPr());
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public void setShapeProperties(XDDFShapeProperties properties) {
+ if (properties == null) {
+ if (series.isSetSpPr()) {
+ series.unsetSpPr();
+ }
+ } else {
+ if (series.isSetSpPr()) {
+ series.setSpPr(properties.getXmlObject());
+ } else {
+ series.addNewSpPr().set(properties.getXmlObject());
+ }
+ }
+ }
+
public long getExplosion() {
if (series.isSetExplosion()) {
return series.getExplosion().getVal();
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFRadarChartData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFRadarChartData.java?rev=1820369&r1=1820368&r2=1820369&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFRadarChartData.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFRadarChartData.java Sat Jan 6 02:51:53 2018
@@ -20,6 +20,7 @@ package org.apache.poi.xddf.usermodel.ch
import java.util.Map;
import org.apache.poi.util.Beta;
+import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTRadarChart;
@@ -106,6 +107,30 @@ public class XDDFRadarChartData extends
}
}
+ @Override
+ public XDDFShapeProperties getShapeProperties() {
+ if (series.isSetSpPr()) {
+ return new XDDFShapeProperties(series.getSpPr());
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public void setShapeProperties(XDDFShapeProperties properties) {
+ if (properties == null) {
+ if (series.isSetSpPr()) {
+ series.unsetSpPr();
+ }
+ } else {
+ if (series.isSetSpPr()) {
+ series.setSpPr(properties.getXmlObject());
+ } else {
+ series.addNewSpPr().set(properties.getXmlObject());
+ }
+ }
+ }
+
@Override
protected CTAxDataSource getAxDS() {
return series.getCat();
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFScatterChartData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFScatterChartData.java?rev=1820369&r1=1820368&r2=1820369&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFScatterChartData.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFScatterChartData.java Sat Jan 6 02:51:53 2018
@@ -20,6 +20,7 @@ package org.apache.poi.xddf.usermodel.ch
import java.util.Map;
import org.apache.poi.util.Beta;
+import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTScatterChart;
@@ -110,6 +111,30 @@ public class XDDFScatterChartData extend
}
}
+ @Override
+ public XDDFShapeProperties getShapeProperties() {
+ if (series.isSetSpPr()) {
+ return new XDDFShapeProperties(series.getSpPr());
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public void setShapeProperties(XDDFShapeProperties properties) {
+ if (properties == null) {
+ if (series.isSetSpPr()) {
+ series.unsetSpPr();
+ }
+ } else {
+ if (series.isSetSpPr()) {
+ series.setSpPr(properties.getXmlObject());
+ } else {
+ series.addNewSpPr().set(properties.getXmlObject());
+ }
+ }
+ }
+
@Override
protected CTAxDataSource getAxDS() {
return series.getXVal();
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFValueAxis.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFValueAxis.java?rev=1820369&r1=1820368&r2=1820369&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFValueAxis.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFValueAxis.java Sat Jan 6 02:51:53 2018
@@ -18,9 +18,10 @@
package org.apache.poi.xddf.usermodel.chart;
import org.apache.poi.util.Beta;
-import org.apache.poi.util.Internal;
+import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxPos;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTBoolean;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTChartLines;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTCrosses;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumFmt;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea;
@@ -45,21 +46,36 @@ public class XDDFValueAxis extends XDDFC
}
@Override
- @Internal
- public CTShapeProperties getMajorGridLines() {
- if (!ctValAx.isSetMajorGridlines()) {
- ctValAx.addNewMajorGridlines();
+ public XDDFShapeProperties getOrAddMajorGridProperties() {
+ CTChartLines majorGridlines;
+ if (ctValAx.isSetMajorGridlines()) {
+ majorGridlines = ctValAx.getMajorGridlines();
+ } else {
+ majorGridlines = ctValAx.addNewMajorGridlines();
}
- if (!ctValAx.getMajorGridlines().isSetSpPr()) {
- ctValAx.getMajorGridlines().addNewSpPr();
+ return new XDDFShapeProperties(getOrAddLinesProperties(majorGridlines));
+ }
+
+ @Override
+ public XDDFShapeProperties getOrAddMinorGridProperties() {
+ CTChartLines minorGridlines;
+ if (ctValAx.isSetMinorGridlines()) {
+ minorGridlines = ctValAx.getMinorGridlines();
+ } else {
+ minorGridlines = ctValAx.addNewMinorGridlines();
}
- return ctValAx.getMajorGridlines().getSpPr();
+ return new XDDFShapeProperties(getOrAddLinesProperties(minorGridlines));
}
@Override
- @Internal
- public CTShapeProperties getLine() {
- return ctValAx.getSpPr();
+ public XDDFShapeProperties getOrAddShapeProperties() {
+ CTShapeProperties properties;
+ if (ctValAx.isSetSpPr()) {
+ properties = ctValAx.getSpPr();
+ } else {
+ properties = ctValAx.addNewSpPr();
+ }
+ return new XDDFShapeProperties(properties);
}
@Override
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTheme.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTheme.java?rev=1820369&r1=1820368&r2=1820369&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTheme.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTheme.java Sat Jan 6 02:51:53 2018
@@ -49,12 +49,12 @@ import org.openxmlformats.schemas.drawin
public class XSLFTheme extends POIXMLDocumentPart {
private CTOfficeStyleSheet _theme;
private Map<String, CTColor> _schemeColors;
-
+
XSLFTheme() {
super();
_theme = CTOfficeStyleSheet.Factory.newInstance();
}
-
+
/**
* @since POI 3.14-Beta1
*/
@@ -65,7 +65,7 @@ public class XSLFTheme extends POIXMLDoc
_theme = doc.getTheme();
initialize();
}
-
+
public void importTheme(XSLFTheme theme) {
_theme = theme.getXmlObject();
_schemeColors = theme._schemeColors;
@@ -74,7 +74,7 @@ public class XSLFTheme extends POIXMLDoc
private void initialize(){
CTBaseStyles elems = _theme.getThemeElements();
CTColorScheme scheme = elems.getClrScheme();
- // The color scheme is responsible for defining a list of twelve colors.
+ // The color scheme is responsible for defining a list of twelve colors.
_schemeColors = new HashMap<>(12);
for(XmlObject o : scheme.selectPath("*")){
CTColor c = (CTColor)o;
@@ -114,13 +114,14 @@ public class XSLFTheme extends POIXMLDoc
/**
* Get a color from the theme's color scheme by name
- *
+ *
* @return a theme color or <code>null</code> if not found
*/
- CTColor getCTColor(String name){
+ @Internal
+ public CTColor getCTColor(String name){
return _schemeColors.get(name);
}
-
+
/**
* While developing only!
*/
@@ -129,6 +130,7 @@ public class XSLFTheme extends POIXMLDoc
return _theme;
}
+ @Override
protected final void commit() throws IOException {
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
xmlOptions.setSaveSyntheticDocumentElement(
Added: poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/TestXDDFColor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/TestXDDFColor.java?rev=1820369&view=auto
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/TestXDDFColor.java (added)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/TestXDDFColor.java Sat Jan 6 02:51:53 2018
@@ -0,0 +1,119 @@
+/* ====================================================================
+ 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 static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.apache.poi.xslf.usermodel.XMLSlideShow;
+import org.apache.poi.xslf.usermodel.XSLFTheme;
+import org.junit.Test;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTColor;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTScRgbColor;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTSystemColor;
+import org.openxmlformats.schemas.drawingml.x2006.main.STPresetColorVal;
+import org.openxmlformats.schemas.drawingml.x2006.main.STSchemeColorVal;
+import org.openxmlformats.schemas.drawingml.x2006.main.STSystemColorVal;
+
+public class TestXDDFColor {
+ private static final String XMLNS = "xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"/>";
+
+ @Test
+ public void testSchemeColor() throws IOException {
+ XMLSlideShow ppt = new XMLSlideShow();
+ XSLFTheme theme = ppt.createSlide().getTheme();
+
+ XDDFColor color = XDDFColor.forColorContainer(getThemeColor(theme, STSchemeColorVal.ACCENT_2));
+ // accent2 in theme1.xml is <a:srgbClr val="C0504D"/>
+ assertEquals("<a:srgbClr val=\"C0504D\" " + XMLNS, color.getColorContainer().toString());
+
+ color = XDDFColor.forColorContainer(getThemeColor(theme, STSchemeColorVal.LT_1));
+ assertEquals("<a:sysClr lastClr=\"FFFFFF\" val=\"window\" " + XMLNS, color.getColorContainer().toString());
+
+ color = XDDFColor.forColorContainer(getThemeColor(theme, STSchemeColorVal.DK_1));
+ assertEquals("<a:sysClr lastClr=\"000000\" val=\"windowText\" " + XMLNS, color.getColorContainer().toString());
+
+ ppt.close();
+ }
+
+ private CTColor getThemeColor(XSLFTheme theme, STSchemeColorVal.Enum value) {
+ // find referenced CTColor in the theme
+ return theme.getCTColor(value.toString());
+ }
+
+ @Test
+ public void testPreset() {
+ CTColor xml = CTColor.Factory.newInstance();
+ xml.addNewPrstClr().setVal(STPresetColorVal.AQUAMARINE);
+ String expected = XDDFColor.forColorContainer(xml).getXmlObject().toString();
+ XDDFColor built = XDDFColor.from(PresetColor.AQUAMARINE);
+ assertEquals(expected, built.getXmlObject().toString());
+ }
+
+ @Test
+ public void testSystemDefined() {
+ CTColor xml = CTColor.Factory.newInstance();
+ CTSystemColor sys = xml.addNewSysClr();
+ sys.setVal(STSystemColorVal.CAPTION_TEXT);
+ String expected = XDDFColor.forColorContainer(xml).getXmlObject().toString();
+
+ XDDFColor built = new XDDFColorSystemDefined(sys, xml);
+ assertEquals(expected, built.getXmlObject().toString());
+
+ built = XDDFColor.from(SystemColor.CAPTION_TEXT);
+ assertEquals(expected, built.getXmlObject().toString());
+ }
+
+ @Test
+ public void testRgbBinary() {
+ CTColor xml = CTColor.Factory.newInstance();
+ CTSRgbColor color = xml.addNewSrgbClr();
+ byte[] bs = new byte[]{-1, -1, -1};
+ color.setVal(bs);
+ String expected = XDDFColor.forColorContainer(xml).getXmlObject().toString();
+
+ XDDFColor built = XDDFColor.from(bs);
+ assertEquals(expected, built.getXmlObject().toString());
+ assertEquals("FFFFFF", ((XDDFColorRgbBinary)built).toRGBHex());
+ }
+
+ @Test
+ public void testRgbPercent() {
+ CTColor xml = CTColor.Factory.newInstance();
+ CTScRgbColor color = xml.addNewScrgbClr();
+ color.setR(0);
+ color.setG(0);
+ color.setB(0);
+ String expected = XDDFColor.forColorContainer(xml).getXmlObject().toString();
+
+ XDDFColorRgbPercent built = (XDDFColorRgbPercent) XDDFColor.from(-1, -1, -1);
+ assertEquals(expected, built.getXmlObject().toString());
+ assertEquals("000000", built.toRGBHex());
+
+ color.setR(100_000);
+ color.setG(100_000);
+ color.setB(100_000);
+ expected = XDDFColor.forColorContainer(xml).getXmlObject().toString();
+
+ built = (XDDFColorRgbPercent) XDDFColor.from(654321, 654321, 654321);
+ assertEquals(expected, built.getXmlObject().toString());
+ assertEquals("FFFFFF", built.toRGBHex());
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org