diff options
6 files changed, 0 insertions, 906 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFChart.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFChart.java index aa8dc61782..428d74e96a 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFChart.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFChart.java @@ -22,7 +22,6 @@ import org.apache.poi.ooxml.POIXMLRelation; import org.apache.poi.openxml4j.opc.PackagePart; import org.apache.poi.util.Removal; import org.apache.poi.xddf.usermodel.chart.XDDFChart; -import org.apache.poi.xssf.usermodel.charts.XSSFChartAxis; import org.apache.xmlbeans.XmlException; import org.apache.xmlbeans.XmlObject; import org.apache.xmlbeans.XmlOptions; @@ -34,8 +33,6 @@ import org.w3c.dom.Text; import javax.xml.namespace.QName; import java.io.IOException; import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; import static org.apache.poi.ooxml.POIXMLTypeLoader.DEFAULT_XML_OPTIONS; @@ -49,10 +46,6 @@ public final class XSSFChart extends XDDFChart { */ private XSSFGraphicFrame frame; - @Deprecated - @Removal(version = "4.2") - List<XSSFChartAxis> axis = new ArrayList<>(); - /** * Create a new SpreadsheetML chart */ diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFCategoryAxis.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFCategoryAxis.java deleted file mode 100644 index 050e31c22c..0000000000 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFCategoryAxis.java +++ /dev/null @@ -1,145 +0,0 @@ -/* ==================================================================== - 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.xssf.usermodel.charts; - -import org.apache.poi.ss.usermodel.charts.AxisCrosses; -import org.apache.poi.ss.usermodel.charts.AxisOrientation; -import org.apache.poi.ss.usermodel.charts.AxisPosition; -import org.apache.poi.ss.usermodel.charts.AxisTickMark; -import org.apache.poi.ss.usermodel.charts.ChartAxis; -import org.apache.poi.util.Internal; -import org.apache.poi.util.Removal; -import org.apache.poi.xddf.usermodel.chart.XDDFCategoryAxis; -import org.apache.poi.xssf.usermodel.XSSFChart; -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.CTScaling; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTTickMark; -import org.openxmlformats.schemas.drawingml.x2006.chart.STTickLblPos; -import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties; - -/** - * Category axis type. - * - * @deprecated use {@link XDDFCategoryAxis} instead - */ -@Deprecated -@Removal(version="4.2") -public class XSSFCategoryAxis extends XSSFChartAxis { - - private CTCatAx ctCatAx; - - public XSSFCategoryAxis(XSSFChart chart, long id, AxisPosition pos) { - super(chart); - createAxis(id, pos); - } - - public XSSFCategoryAxis(XSSFChart chart, CTCatAx ctCatAx) { - super(chart); - this.ctCatAx = ctCatAx; - } - - @Override - public long getId() { - return ctCatAx.getAxId().getVal(); - } - - @Override - @Internal - public CTShapeProperties getLine() { - return ctCatAx.getSpPr(); - } - - @Override - protected CTAxPos getCTAxPos() { - return ctCatAx.getAxPos(); - } - - @Override - protected CTNumFmt getCTNumFmt() { - if (ctCatAx.isSetNumFmt()) { - return ctCatAx.getNumFmt(); - } - return ctCatAx.addNewNumFmt(); - } - - @Override - protected CTScaling getCTScaling() { - return ctCatAx.getScaling(); - } - - @Override - protected CTCrosses getCTCrosses() { - return ctCatAx.getCrosses(); - } - - @Override - protected CTBoolean getDelete() { - return ctCatAx.getDelete(); - } - - @Override - protected CTTickMark getMajorCTTickMark() { - return ctCatAx.getMajorTickMark(); - } - - @Override - protected CTTickMark getMinorCTTickMark() { - return ctCatAx.getMinorTickMark(); - } - - @Override - @Internal - public CTChartLines getMajorGridLines() { - return ctCatAx.getMajorGridlines(); - } - - @Override - public void crossAxis(ChartAxis axis) { - ctCatAx.getCrossAx().setVal(axis.getId()); - } - - private void createAxis(long id, AxisPosition pos) { - ctCatAx = chart.getCTChart().getPlotArea().addNewCatAx(); - ctCatAx.addNewAxId().setVal(id); - ctCatAx.addNewAxPos(); - ctCatAx.addNewScaling(); - ctCatAx.addNewCrosses(); - ctCatAx.addNewCrossAx(); - ctCatAx.addNewTickLblPos().setVal(STTickLblPos.NEXT_TO); - ctCatAx.addNewDelete(); - ctCatAx.addNewMajorTickMark(); - ctCatAx.addNewMinorTickMark(); - - setPosition(pos); - setOrientation(AxisOrientation.MIN_MAX); - setCrosses(AxisCrosses.AUTO_ZERO); - setVisible(true); - setMajorTickMark(AxisTickMark.CROSS); - setMinorTickMark(AxisTickMark.NONE); - } - - @Override - public boolean hasNumberFormat() { - return ctCatAx.isSetNumFmt(); - } -} diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFChartAxis.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFChartAxis.java deleted file mode 100644 index 3af454bd48..0000000000 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFChartAxis.java +++ /dev/null @@ -1,306 +0,0 @@ -/* ==================================================================== - 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.xssf.usermodel.charts; - -import org.apache.poi.ss.usermodel.charts.AxisCrosses; -import org.apache.poi.ss.usermodel.charts.AxisOrientation; -import org.apache.poi.ss.usermodel.charts.AxisPosition; -import org.apache.poi.ss.usermodel.charts.AxisTickMark; -import org.apache.poi.ss.usermodel.charts.ChartAxis; -import org.apache.poi.util.Internal; -import org.apache.poi.util.Removal; -import org.apache.poi.xddf.usermodel.chart.XDDFChartAxis; -import org.apache.poi.xssf.usermodel.XSSFChart; -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; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTOrientation; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTScaling; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTTickMark; -import org.openxmlformats.schemas.drawingml.x2006.chart.STAxPos; -import org.openxmlformats.schemas.drawingml.x2006.chart.STCrosses; -import org.openxmlformats.schemas.drawingml.x2006.chart.STOrientation; -import org.openxmlformats.schemas.drawingml.x2006.chart.STTickMark; -import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties; - -/** - * Base class for all axis types. - * - * @deprecated use {@link XDDFChartAxis} instead - */ -@Deprecated -@Removal(version="4.2") -public abstract class XSSFChartAxis implements ChartAxis { - - protected XSSFChart chart; - - private static final double MIN_LOG_BASE = 2.0; - private static final double MAX_LOG_BASE = 1000.0; - - protected XSSFChartAxis(XSSFChart chart) { - this.chart = chart; - } - - @Override - public AxisPosition getPosition() { - return toAxisPosition(getCTAxPos()); - } - - @Override - public void setPosition(AxisPosition position) { - getCTAxPos().setVal(fromAxisPosition(position)); - } - - @Override - public void setNumberFormat(String format) { - getCTNumFmt().setFormatCode(format); - getCTNumFmt().setSourceLinked(true); - } - - @Override - public String getNumberFormat() { - return getCTNumFmt().getFormatCode(); - } - - @Override - public boolean isSetLogBase() { - return getCTScaling().isSetLogBase(); - } - - @Override - public void setLogBase(double logBase) { - if (logBase < MIN_LOG_BASE || - MAX_LOG_BASE < logBase) { - throw new IllegalArgumentException("Axis log base must be between 2 and 1000 (inclusive), got: " + logBase); - } - CTScaling scaling = getCTScaling(); - if (scaling.isSetLogBase()) { - scaling.getLogBase().setVal(logBase); - } else { - scaling.addNewLogBase().setVal(logBase); - } - } - - @Override - public double getLogBase() { - CTLogBase logBase = getCTScaling().getLogBase(); - if (logBase != null) { - return logBase.getVal(); - } - return 0.0; - } - - @Override - public boolean isSetMinimum() { - return getCTScaling().isSetMin(); - } - - @Override - public void setMinimum(double min) { - CTScaling scaling = getCTScaling(); - if (scaling.isSetMin()) { - scaling.getMin().setVal(min); - } else { - scaling.addNewMin().setVal(min); - } - } - - @Override - public double getMinimum() { - CTScaling scaling = getCTScaling(); - if (scaling.isSetMin()) { - return scaling.getMin().getVal(); - } else { - return 0.0; - } - } - - @Override - public boolean isSetMaximum() { - return getCTScaling().isSetMax(); - } - - @Override - public void setMaximum(double max) { - CTScaling scaling = getCTScaling(); - if (scaling.isSetMax()) { - scaling.getMax().setVal(max); - } else { - scaling.addNewMax().setVal(max); - } - } - - @Override - public double getMaximum() { - CTScaling scaling = getCTScaling(); - if (scaling.isSetMax()) { - return scaling.getMax().getVal(); - } else { - return 0.0; - } - } - - @Override - public AxisOrientation getOrientation() { - return toAxisOrientation(getCTScaling().getOrientation()); - } - - @Override - public void setOrientation(AxisOrientation orientation) { - CTScaling scaling = getCTScaling(); - STOrientation.Enum stOrientation = fromAxisOrientation(orientation); - if (scaling.isSetOrientation()) { - scaling.getOrientation().setVal(stOrientation); - } else { - getCTScaling().addNewOrientation().setVal(stOrientation); - } - } - - @Override - public AxisCrosses getCrosses() { - return toAxisCrosses(getCTCrosses()); - } - - @Override - public void setCrosses(AxisCrosses crosses) { - getCTCrosses().setVal(fromAxisCrosses(crosses)); - } - - @Override - public boolean isVisible() { - return !getDelete().getVal(); - } - - @Override - public void setVisible(boolean value) { - getDelete().setVal(!value); - } - - @Override - public AxisTickMark getMajorTickMark() { - return toAxisTickMark(getMajorCTTickMark()); - } - - @Override - public void setMajorTickMark(AxisTickMark tickMark) { - getMajorCTTickMark().setVal(fromAxisTickMark(tickMark)); - } - - @Override - public AxisTickMark getMinorTickMark() { - return toAxisTickMark(getMinorCTTickMark()); - } - - @Override - public void setMinorTickMark(AxisTickMark tickMark) { - getMinorCTTickMark().setVal(fromAxisTickMark(tickMark)); - } - - protected abstract CTAxPos getCTAxPos(); - protected abstract CTNumFmt getCTNumFmt(); - protected abstract CTScaling getCTScaling(); - protected abstract CTCrosses getCTCrosses(); - protected abstract CTBoolean getDelete(); - protected abstract CTTickMark getMajorCTTickMark(); - protected abstract CTTickMark getMinorCTTickMark(); - @Internal public abstract CTChartLines getMajorGridLines(); - @Internal public abstract CTShapeProperties getLine(); - - private static STOrientation.Enum fromAxisOrientation(AxisOrientation orientation) { - switch (orientation) { - case MIN_MAX: return STOrientation.MIN_MAX; - case MAX_MIN: return STOrientation.MAX_MIN; - default: - throw new IllegalArgumentException(); - } - } - - private static AxisOrientation toAxisOrientation(CTOrientation ctOrientation) { - switch (ctOrientation.getVal().intValue()) { - case STOrientation.INT_MIN_MAX: return AxisOrientation.MIN_MAX; - case STOrientation.INT_MAX_MIN: return AxisOrientation.MAX_MIN; - default: - throw new IllegalArgumentException(); - } - } - - private static STCrosses.Enum fromAxisCrosses(AxisCrosses crosses) { - switch (crosses) { - case AUTO_ZERO: return STCrosses.AUTO_ZERO; - case MIN: return STCrosses.MIN; - case MAX: return STCrosses.MAX; - default: - throw new IllegalArgumentException(); - } - } - - private static AxisCrosses toAxisCrosses(CTCrosses ctCrosses) { - switch (ctCrosses.getVal().intValue()) { - case STCrosses.INT_AUTO_ZERO: return AxisCrosses.AUTO_ZERO; - case STCrosses.INT_MAX: return AxisCrosses.MAX; - case STCrosses.INT_MIN: return AxisCrosses.MIN; - default: - throw new IllegalArgumentException(); - } - } - - private static STAxPos.Enum fromAxisPosition(AxisPosition position) { - switch (position) { - case BOTTOM: return STAxPos.B; - case LEFT: return STAxPos.L; - case RIGHT: return STAxPos.R; - case TOP: return STAxPos.T; - default: - throw new IllegalArgumentException(); - } - } - - private static AxisPosition toAxisPosition(CTAxPos ctAxPos) { - switch (ctAxPos.getVal().intValue()) { - case STAxPos.INT_B: return AxisPosition.BOTTOM; - case STAxPos.INT_L: return AxisPosition.LEFT; - case STAxPos.INT_R: return AxisPosition.RIGHT; - case STAxPos.INT_T: return AxisPosition.TOP; - default: return AxisPosition.BOTTOM; - } - } - - private static STTickMark.Enum fromAxisTickMark(AxisTickMark tickMark) { - switch (tickMark) { - case NONE: return STTickMark.NONE; - case IN: return STTickMark.IN; - case OUT: return STTickMark.OUT; - case CROSS: return STTickMark.CROSS; - default: - throw new IllegalArgumentException("Unknown AxisTickMark: " + tickMark); - } - } - - private static AxisTickMark toAxisTickMark(CTTickMark ctTickMark) { - switch (ctTickMark.getVal().intValue()) { - case STTickMark.INT_NONE: return AxisTickMark.NONE; - case STTickMark.INT_IN: return AxisTickMark.IN; - case STTickMark.INT_OUT: return AxisTickMark.OUT; - case STTickMark.INT_CROSS: return AxisTickMark.CROSS; - default: return AxisTickMark.CROSS; - } - } -} diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFChartUtil.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFChartUtil.java deleted file mode 100644 index 7578410441..0000000000 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFChartUtil.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * ==================================================================== - * 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.xssf.usermodel.charts; - -import org.apache.poi.ss.usermodel.charts.ChartDataSource; -import org.apache.poi.util.Removal; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumData; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumRef; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumVal; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTStrData; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTStrRef; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTStrVal; - -/** - * Package private class with utility methods. - * - * @deprecated - */ -@Deprecated -@Removal(version="4.2") -class XSSFChartUtil { - - private XSSFChartUtil() {} - - /** - * Builds CTAxDataSource object content from POI ChartDataSource. - * @param ctAxDataSource OOXML data source to build - * @param dataSource POI data source to use - */ - public static void buildAxDataSource(CTAxDataSource ctAxDataSource, ChartDataSource<?> dataSource) { - if (dataSource.isNumeric()) { - if (dataSource.isReference()) { - buildNumRef(ctAxDataSource.addNewNumRef(), dataSource); - } else { - buildNumLit(ctAxDataSource.addNewNumLit(), dataSource); - } - } else { - if (dataSource.isReference()) { - buildStrRef(ctAxDataSource.addNewStrRef(), dataSource); - } else { - buildStrLit(ctAxDataSource.addNewStrLit(), dataSource); - } - } - } - - /** - * Builds CTNumDataSource object content from POI ChartDataSource - * @param ctNumDataSource OOXML data source to build - * @param dataSource POI data source to use - */ - public static void buildNumDataSource(CTNumDataSource ctNumDataSource, - ChartDataSource<? extends Number> dataSource) { - if (dataSource.isReference()) { - buildNumRef(ctNumDataSource.addNewNumRef(), dataSource); - } else { - buildNumLit(ctNumDataSource.addNewNumLit(), dataSource); - } - } - - private static void buildNumRef(CTNumRef ctNumRef, ChartDataSource<?> dataSource) { - ctNumRef.setF(dataSource.getFormulaString()); - CTNumData cache = ctNumRef.addNewNumCache(); - fillNumCache(cache, dataSource); - } - - private static void buildNumLit(CTNumData ctNumData, ChartDataSource<?> dataSource) { - fillNumCache(ctNumData, dataSource); - } - - private static void buildStrRef(CTStrRef ctStrRef, ChartDataSource<?> dataSource) { - ctStrRef.setF(dataSource.getFormulaString()); - CTStrData cache = ctStrRef.addNewStrCache(); - fillStringCache(cache, dataSource); - } - - private static void buildStrLit(CTStrData ctStrData, ChartDataSource<?> dataSource) { - fillStringCache(ctStrData, dataSource); - } - - private static void fillStringCache(CTStrData cache, ChartDataSource<?> dataSource) { - int numOfPoints = dataSource.getPointCount(); - cache.addNewPtCount().setVal(numOfPoints); - for (int i = 0; i < numOfPoints; ++i) { - Object value = dataSource.getPointAt(i); - if (value != null) { - CTStrVal ctStrVal = cache.addNewPt(); - ctStrVal.setIdx(i); - ctStrVal.setV(value.toString()); - } - } - - } - - private static void fillNumCache(CTNumData cache, ChartDataSource<?> dataSource) { - int numOfPoints = dataSource.getPointCount(); - cache.addNewPtCount().setVal(numOfPoints); - for (int i = 0; i < numOfPoints; ++i) { - Number value = (Number) dataSource.getPointAt(i); - if (value != null) { - CTNumVal ctNumVal = cache.addNewPt(); - ctNumVal.setIdx(i); - ctNumVal.setV(value.toString()); - } - } - } -} diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFDateAxis.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFDateAxis.java deleted file mode 100644 index 53e0204128..0000000000 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFDateAxis.java +++ /dev/null @@ -1,145 +0,0 @@ -/* ==================================================================== - 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.xssf.usermodel.charts; - -import org.apache.poi.ss.usermodel.charts.AxisCrosses; -import org.apache.poi.ss.usermodel.charts.AxisOrientation; -import org.apache.poi.ss.usermodel.charts.AxisPosition; -import org.apache.poi.ss.usermodel.charts.AxisTickMark; -import org.apache.poi.ss.usermodel.charts.ChartAxis; -import org.apache.poi.util.Internal; -import org.apache.poi.util.Removal; -import org.apache.poi.xddf.usermodel.chart.XDDFDateAxis; -import org.apache.poi.xssf.usermodel.XSSFChart; -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; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTScaling; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTTickMark; -import org.openxmlformats.schemas.drawingml.x2006.chart.STTickLblPos; -import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties; - -/** - * Date axis type. Currently only implements the same values as {@link XSSFCategoryAxis}, since the two are nearly identical. - * - * @deprecated use {@link XDDFDateAxis} instead - */ -@Deprecated -@Removal(version="4.2") -public class XSSFDateAxis extends XSSFChartAxis { - - private CTDateAx ctDateAx; - - public XSSFDateAxis(XSSFChart chart, long id, AxisPosition pos) { - super(chart); - createAxis(id, pos); - } - - public XSSFDateAxis(XSSFChart chart, CTDateAx ctDateAx) { - super(chart); - this.ctDateAx = ctDateAx; - } - - @Override - public long getId() { - return ctDateAx.getAxId().getVal(); - } - - @Override - @Internal - public CTShapeProperties getLine() { - return ctDateAx.getSpPr(); - } - - @Override - protected CTAxPos getCTAxPos() { - return ctDateAx.getAxPos(); - } - - @Override - protected CTNumFmt getCTNumFmt() { - if (ctDateAx.isSetNumFmt()) { - return ctDateAx.getNumFmt(); - } - return ctDateAx.addNewNumFmt(); - } - - @Override - protected CTScaling getCTScaling() { - return ctDateAx.getScaling(); - } - - @Override - protected CTCrosses getCTCrosses() { - return ctDateAx.getCrosses(); - } - - @Override - protected CTBoolean getDelete() { - return ctDateAx.getDelete(); - } - - @Override - protected CTTickMark getMajorCTTickMark() { - return ctDateAx.getMajorTickMark(); - } - - @Override - protected CTTickMark getMinorCTTickMark() { - return ctDateAx.getMinorTickMark(); - } - - @Override - @Internal - public CTChartLines getMajorGridLines() { - return ctDateAx.getMajorGridlines(); - } - - @Override - public void crossAxis(ChartAxis axis) { - ctDateAx.getCrossAx().setVal(axis.getId()); - } - - private void createAxis(long id, AxisPosition pos) { - ctDateAx = chart.getCTChart().getPlotArea().addNewDateAx(); - ctDateAx.addNewAxId().setVal(id); - ctDateAx.addNewAxPos(); - ctDateAx.addNewScaling(); - ctDateAx.addNewCrosses(); - ctDateAx.addNewCrossAx(); - ctDateAx.addNewTickLblPos().setVal(STTickLblPos.NEXT_TO); - ctDateAx.addNewDelete(); - ctDateAx.addNewMajorTickMark(); - ctDateAx.addNewMinorTickMark(); - - setPosition(pos); - setOrientation(AxisOrientation.MIN_MAX); - setCrosses(AxisCrosses.AUTO_ZERO); - setVisible(true); - setMajorTickMark(AxisTickMark.CROSS); - setMinorTickMark(AxisTickMark.NONE); - } - - @Override - public boolean hasNumberFormat() { - return ctDateAx.isSetNumFmt(); - } -} diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFValueAxis.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFValueAxis.java deleted file mode 100644 index 14f16d4a11..0000000000 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFValueAxis.java +++ /dev/null @@ -1,178 +0,0 @@ -/* ==================================================================== - 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.xssf.usermodel.charts; - -import org.apache.poi.ss.usermodel.charts.AxisCrossBetween; -import org.apache.poi.ss.usermodel.charts.AxisCrosses; -import org.apache.poi.ss.usermodel.charts.AxisOrientation; -import org.apache.poi.ss.usermodel.charts.AxisPosition; -import org.apache.poi.ss.usermodel.charts.AxisTickMark; -import org.apache.poi.ss.usermodel.charts.ChartAxis; -import org.apache.poi.ss.usermodel.charts.ValueAxis; -import org.apache.poi.util.Internal; -import org.apache.poi.util.Removal; -import org.apache.poi.xddf.usermodel.chart.XDDFValueAxis; -import org.apache.poi.xssf.usermodel.XSSFChart; -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.CTScaling; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTTickMark; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTValAx; -import org.openxmlformats.schemas.drawingml.x2006.chart.STCrossBetween; -import org.openxmlformats.schemas.drawingml.x2006.chart.STTickLblPos; -import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties; - -/** - * Value axis type. - * - * @deprecated use {@link XDDFValueAxis} instead - */ -@Deprecated -@Removal(version="4.2") -public class XSSFValueAxis extends XSSFChartAxis implements ValueAxis { - - private CTValAx ctValAx; - - public XSSFValueAxis(XSSFChart chart, long id, AxisPosition pos) { - super(chart); - createAxis(id, pos); - } - - public XSSFValueAxis(XSSFChart chart, CTValAx ctValAx) { - super(chart); - this.ctValAx = ctValAx; - } - - @Override - public long getId() { - return ctValAx.getAxId().getVal(); - } - - @Override - @Internal - public CTShapeProperties getLine() { - return ctValAx.getSpPr(); - } - - @Override - public void setCrossBetween(AxisCrossBetween crossBetween) { - ctValAx.getCrossBetween().setVal(fromCrossBetween(crossBetween)); - } - - @Override - public AxisCrossBetween getCrossBetween() { - return toCrossBetween(ctValAx.getCrossBetween().getVal()); - } - - @Override - protected CTAxPos getCTAxPos() { - return ctValAx.getAxPos(); - } - - @Override - protected CTNumFmt getCTNumFmt() { - if (ctValAx.isSetNumFmt()) { - return ctValAx.getNumFmt(); - } - return ctValAx.addNewNumFmt(); - } - - @Override - protected CTScaling getCTScaling() { - return ctValAx.getScaling(); - } - - @Override - protected CTCrosses getCTCrosses() { - return ctValAx.getCrosses(); - } - - @Override - protected CTBoolean getDelete() { - return ctValAx.getDelete(); - } - - @Override - protected CTTickMark getMajorCTTickMark() { - return ctValAx.getMajorTickMark(); - } - - @Override - protected CTTickMark getMinorCTTickMark() { - return ctValAx.getMinorTickMark(); - } - - @Override - @Internal - public CTChartLines getMajorGridLines() { - return ctValAx.getMajorGridlines(); - } - - @Override - public void crossAxis(ChartAxis axis) { - ctValAx.getCrossAx().setVal(axis.getId()); - } - - private void createAxis(long id, AxisPosition pos) { - ctValAx = chart.getCTChart().getPlotArea().addNewValAx(); - ctValAx.addNewAxId().setVal(id); - ctValAx.addNewAxPos(); - ctValAx.addNewScaling(); - ctValAx.addNewCrossBetween(); - ctValAx.addNewCrosses(); - ctValAx.addNewCrossAx(); - ctValAx.addNewTickLblPos().setVal(STTickLblPos.NEXT_TO); - ctValAx.addNewDelete(); - ctValAx.addNewMajorTickMark(); - ctValAx.addNewMinorTickMark(); - - setPosition(pos); - setOrientation(AxisOrientation.MIN_MAX); - setCrossBetween(AxisCrossBetween.MIDPOINT_CATEGORY); - setCrosses(AxisCrosses.AUTO_ZERO); - setVisible(true); - setMajorTickMark(AxisTickMark.CROSS); - setMinorTickMark(AxisTickMark.NONE); - } - - private static STCrossBetween.Enum fromCrossBetween(AxisCrossBetween crossBetween) { - switch (crossBetween) { - case BETWEEN: return STCrossBetween.BETWEEN; - case MIDPOINT_CATEGORY: return STCrossBetween.MID_CAT; - default: - throw new IllegalArgumentException(); - } - } - - private static AxisCrossBetween toCrossBetween(STCrossBetween.Enum ctCrossBetween) { - switch (ctCrossBetween.intValue()) { - case STCrossBetween.INT_BETWEEN: return AxisCrossBetween.BETWEEN; - case STCrossBetween.INT_MID_CAT: return AxisCrossBetween.MIDPOINT_CATEGORY; - default: - throw new IllegalArgumentException(); - } - } - - @Override - public boolean hasNumberFormat() { - return ctValAx.isSetNumFmt(); - } -} |