introduce XDDFShapeProperties as user model API (closes #72 from GitHub)

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1820369 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alain Béarez 2018-01-06 02:51:53 +00:00
parent d4df69570c
commit 5f0072983b
82 changed files with 5409 additions and 88 deletions

View File

@ -55,9 +55,9 @@ public class BarChartDemo {
return;
}
BufferedReader modelReader = new BufferedReader(new FileReader(args[1]));
XMLSlideShow pptx = null;
try {
try (FileInputStream argIS = new FileInputStream(args[0]);
BufferedReader modelReader = new BufferedReader(new FileReader(args[1]))) {
String chartTitle = modelReader.readLine(); // first line is chart title
// Category Axis Data
@ -76,25 +76,18 @@ public class BarChartDemo {
String[] categories = listCategories.toArray(new String[listCategories.size()]);
Double[] values = listValues.toArray(new Double[listValues.size()]);
pptx = new XMLSlideShow(new FileInputStream(args[0]));
XSLFSlide slide = pptx.getSlides().get(0);
setBarData(findChart(slide), chartTitle, categories, values);
try (XMLSlideShow pptx = new XMLSlideShow(argIS)) {
XSLFSlide slide = pptx.getSlides().get(0);
setBarData(findChart(slide), chartTitle, categories, values);
XSLFChart chart = findChart(pptx.createSlide().importContent(slide));
setColumnData(chart, "Column variant");
XSLFChart chart = findChart(pptx.createSlide().importContent(slide));
setColumnData(chart, "Column variant");
// save the result
OutputStream out = new FileOutputStream("bar-chart-demo-output.pptx");
try {
pptx.write(out);
} finally {
out.close();
// save the result
try (OutputStream out = new FileOutputStream("bar-chart-demo-output.pptx")) {
pptx.write(out);
}
}
} finally {
if (pptx != null) {
pptx.close();
}
modelReader.close();
}
}

View File

@ -52,10 +52,11 @@ public class PieChartDemo {
return;
}
try (BufferedReader modelReader = new BufferedReader(new FileReader(args[1]))) {
try (FileInputStream argIS = new FileInputStream(args[0]);
BufferedReader modelReader = new BufferedReader(new FileReader(args[1]))) {
String chartTitle = modelReader.readLine(); // first line is chart title
try (XMLSlideShow pptx = new XMLSlideShow(new FileInputStream(args[0]))) {
try (XMLSlideShow pptx = new XMLSlideShow(argIS)) {
XSLFSlide slide = pptx.getSlides().get(0);
// find chart in the slide
@ -70,17 +71,17 @@ public class PieChartDemo {
if(chart == null) {
throw new IllegalStateException("chart not found in the template");
}
// Series Text
List<XDDFChartData> series = chart.getChartSeries();
XDDFPieChartData pie = (XDDFPieChartData) series.get(0);
// Category Axis Data
List<String> listCategories = new ArrayList<String>(3);
// Values
List<Double> listValues = new ArrayList<Double>(3);
// set model
String ln;
while((ln = modelReader.readLine()) != null){

View File

@ -0,0 +1,104 @@
/* ====================================================================
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.examples;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xddf.usermodel.PresetColor;
import org.apache.poi.xddf.usermodel.XDDFColor;
import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.apache.poi.xddf.usermodel.XDDFSolidFillProperties;
import org.apache.poi.xddf.usermodel.chart.AxisCrosses;
import org.apache.poi.xddf.usermodel.chart.AxisPosition;
import org.apache.poi.xddf.usermodel.chart.ChartTypes;
import org.apache.poi.xddf.usermodel.chart.LegendPosition;
import org.apache.poi.xddf.usermodel.chart.XDDFCategoryAxis;
import org.apache.poi.xddf.usermodel.chart.XDDFChartData;
import org.apache.poi.xddf.usermodel.chart.XDDFChartLegend;
import org.apache.poi.xddf.usermodel.chart.XDDFDataSource;
import org.apache.poi.xddf.usermodel.chart.XDDFDataSourcesFactory;
import org.apache.poi.xddf.usermodel.chart.XDDFNumericalDataSource;
import org.apache.poi.xddf.usermodel.chart.XDDFValueAxis;
import org.apache.poi.xssf.usermodel.XSSFChart;
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
import org.apache.poi.xssf.usermodel.XSSFDrawing;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
/**
* Line chart example.
*/
public class BarChart {
public static void main(String[] args) throws IOException {
try (XSSFWorkbook wb = new XSSFWorkbook()) {
XSSFSheet sheet = wb.createSheet("barchart");
final int NUM_OF_ROWS = 3;
final int NUM_OF_COLUMNS = 10;
// Create a row and put some cells in it. Rows are 0 based.
Row row;
Cell cell;
for (int rowIndex = 0; rowIndex < NUM_OF_ROWS; rowIndex++) {
row = sheet.createRow((short) rowIndex);
for (int colIndex = 0; colIndex < NUM_OF_COLUMNS; colIndex++) {
cell = row.createCell((short) colIndex);
cell.setCellValue(colIndex * (rowIndex + 1));
}
}
XSSFDrawing drawing = sheet.createDrawingPatriarch();
XSSFClientAnchor anchor = drawing.createAnchor(0, 0, 0, 0, 0, 5, 10, 15);
XSSFChart chart = drawing.createChart(anchor);
XDDFChartLegend legend = chart.getOrAddLegend();
legend.setPosition(LegendPosition.TOP_RIGHT);
// Use a category axis for the bottom axis.
XDDFCategoryAxis bottomAxis = chart.createCategoryAxis(AxisPosition.BOTTOM);
XDDFValueAxis leftAxis = chart.createValueAxis(AxisPosition.LEFT);
leftAxis.setCrosses(AxisCrosses.AUTO_ZERO);
XDDFDataSource<Double> xs = XDDFDataSourcesFactory.fromNumericCellRange(sheet, new CellRangeAddress(0, 0, 0, NUM_OF_COLUMNS - 1));
XDDFNumericalDataSource<Double> ys1 = XDDFDataSourcesFactory.fromNumericCellRange(sheet, new CellRangeAddress(1, 1, 0, NUM_OF_COLUMNS - 1));
XDDFNumericalDataSource<Double> ys2 = XDDFDataSourcesFactory.fromNumericCellRange(sheet, new CellRangeAddress(2, 2, 0, NUM_OF_COLUMNS - 1));
XDDFChartData data = chart.createData(ChartTypes.BAR, bottomAxis, leftAxis);
data.addSeries(xs, ys1);
data.addSeries(xs, ys2);
chart.plot(data);
XDDFSolidFillProperties fill = new XDDFSolidFillProperties(XDDFColor.from(PresetColor.CHARTREUSE));
XDDFChartData.Series firstSeries = data.getSeries().get(0);
XDDFShapeProperties properties = firstSeries.getShapeProperties();
if (properties == null) {
properties = new XDDFShapeProperties();
}
properties.setFillProperties(fill);
firstSeries.setShapeProperties(properties);
// Write the output to a file
try (FileOutputStream fileOut = new FileOutputStream("ooxml-bar-chart.xlsx")) {
wb.write(fileOut);
}
}
}
}

View File

@ -0,0 +1,46 @@
/* ====================================================================
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.HashMap;
import org.openxmlformats.schemas.drawingml.x2006.main.STBlackWhiteMode;
public enum BlackWhiteMode {
AUTO(STBlackWhiteMode.AUTO),
BLACK(STBlackWhiteMode.BLACK),
BLACK_GRAY(STBlackWhiteMode.BLACK_GRAY),
BLACK_WHITE(STBlackWhiteMode.BLACK_WHITE);
final STBlackWhiteMode.Enum underlying;
BlackWhiteMode(STBlackWhiteMode.Enum mode) {
this.underlying = mode;
}
private final static HashMap<STBlackWhiteMode.Enum, BlackWhiteMode> reverse = new HashMap<STBlackWhiteMode.Enum, BlackWhiteMode>();
static {
for (BlackWhiteMode value : values()) {
reverse.put(value.underlying, value);
}
}
static BlackWhiteMode valueOf(STBlackWhiteMode.Enum mode) {
return reverse.get(mode);
}
}

View File

@ -0,0 +1,47 @@
/* ====================================================================
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.HashMap;
import org.openxmlformats.schemas.drawingml.x2006.main.STCompoundLine;
public enum CompoundLine {
DOUBLE(STCompoundLine.DBL),
SINGLE(STCompoundLine.SNG),
THICK_THIN(STCompoundLine.THICK_THIN),
THIN_THICK(STCompoundLine.THIN_THICK),
TRIPLE(STCompoundLine.TRI);
final STCompoundLine.Enum underlying;
CompoundLine(STCompoundLine.Enum line) {
this.underlying = line;
}
private final static HashMap<STCompoundLine.Enum, CompoundLine> reverse = new HashMap<STCompoundLine.Enum, CompoundLine>();
static {
for (CompoundLine value : values()) {
reverse.put(value.underlying, value);
}
}
static CompoundLine valueOf(STCompoundLine.Enum LineEndWidth) {
return reverse.get(LineEndWidth);
}
}

View File

@ -0,0 +1,22 @@
/* ====================================================================
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;
public interface HasShapeProperties {
XDDFShapeProperties getOrAddShapeProperties();
}

View File

@ -0,0 +1,45 @@
/* ====================================================================
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.HashMap;
import org.openxmlformats.schemas.drawingml.x2006.main.STLineCap;
public enum LineCap {
FLAT(STLineCap.FLAT),
ROUND(STLineCap.RND),
SQUARE(STLineCap.SQ);
final STLineCap.Enum underlying;
LineCap(STLineCap.Enum line) {
this.underlying = line;
}
private final static HashMap<STLineCap.Enum, LineCap> reverse = new HashMap<STLineCap.Enum, LineCap>();
static {
for (LineCap value : values()) {
reverse.put(value.underlying, value);
}
}
static LineCap valueOf(STLineCap.Enum LineEndWidth) {
return reverse.get(LineEndWidth);
}
}

View File

@ -0,0 +1,45 @@
/* ====================================================================
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.HashMap;
import org.openxmlformats.schemas.drawingml.x2006.main.STLineEndLength;
public enum LineEndLength {
LARGE(STLineEndLength.LG),
MEDIUM(STLineEndLength.MED),
SMALL(STLineEndLength.SM);
final STLineEndLength.Enum underlying;
LineEndLength(STLineEndLength.Enum lineEnd) {
this.underlying = lineEnd;
}
private final static HashMap<STLineEndLength.Enum, LineEndLength> reverse = new HashMap<STLineEndLength.Enum, LineEndLength>();
static {
for (LineEndLength value : values()) {
reverse.put(value.underlying, value);
}
}
static LineEndLength valueOf(STLineEndLength.Enum LineEndWidth) {
return reverse.get(LineEndWidth);
}
}

View File

@ -0,0 +1,48 @@
/* ====================================================================
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.HashMap;
import org.openxmlformats.schemas.drawingml.x2006.main.STLineEndType;
public enum LineEndType {
ARROW(STLineEndType.ARROW),
DIAMOND(STLineEndType.DIAMOND),
NONE(STLineEndType.NONE),
OVAL(STLineEndType.OVAL),
STEALTH(STLineEndType.STEALTH),
TRIANGLE(STLineEndType.TRIANGLE);
final STLineEndType.Enum underlying;
LineEndType(STLineEndType.Enum lineEnd) {
this.underlying = lineEnd;
}
private final static HashMap<STLineEndType.Enum, LineEndType> reverse = new HashMap<STLineEndType.Enum, LineEndType>();
static {
for (LineEndType value : values()) {
reverse.put(value.underlying, value);
}
}
static LineEndType valueOf(STLineEndType.Enum LineEndWidth) {
return reverse.get(LineEndWidth);
}
}

View File

@ -0,0 +1,45 @@
/* ====================================================================
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.HashMap;
import org.openxmlformats.schemas.drawingml.x2006.main.STLineEndWidth;
public enum LineEndWidth {
LARGE(STLineEndWidth.LG),
MEDIUM(STLineEndWidth.MED),
SMALL(STLineEndWidth.SM);
final STLineEndWidth.Enum underlying;
LineEndWidth(STLineEndWidth.Enum lineEnd) {
this.underlying = lineEnd;
}
private final static HashMap<STLineEndWidth.Enum, LineEndWidth> reverse = new HashMap<STLineEndWidth.Enum, LineEndWidth>();
static {
for (LineEndWidth value : values()) {
reverse.put(value.underlying, value);
}
}
static LineEndWidth valueOf(STLineEndWidth.Enum LineEndWidth) {
return reverse.get(LineEndWidth);
}
}

View File

@ -0,0 +1,45 @@
/* ====================================================================
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.HashMap;
import org.openxmlformats.schemas.drawingml.x2006.main.STPathShadeType;
public enum PathShadeType {
CIRCLE(STPathShadeType.CIRCLE),
RECTANGLE(STPathShadeType.RECT),
SHAPE(STPathShadeType.SHAPE);
final STPathShadeType.Enum underlying;
PathShadeType(STPathShadeType.Enum pathShadeType) {
this.underlying = pathShadeType;
}
private final static HashMap<STPathShadeType.Enum, PathShadeType> reverse = new HashMap<STPathShadeType.Enum, PathShadeType>();
static {
for (PathShadeType value : values()) {
reverse.put(value.underlying, value);
}
}
static PathShadeType valueOf(STPathShadeType.Enum pathShadeType) {
return reverse.get(pathShadeType);
}
}

View File

@ -0,0 +1,44 @@
/* ====================================================================
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.HashMap;
import org.openxmlformats.schemas.drawingml.x2006.main.STPenAlignment;
public enum PenAlignment {
CENTER(STPenAlignment.CTR),
IN(STPenAlignment.IN);
final STPenAlignment.Enum underlying;
PenAlignment(STPenAlignment.Enum alignment) {
this.underlying = alignment;
}
private final static HashMap<STPenAlignment.Enum, PenAlignment> reverse = new HashMap<STPenAlignment.Enum, PenAlignment>();
static {
for (PenAlignment value : values()) {
reverse.put(value.underlying, value);
}
}
static PenAlignment valueOf(STPenAlignment.Enum LineEndWidth) {
return reverse.get(LineEndWidth);
}
}

View File

@ -0,0 +1,180 @@
/* ====================================================================
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.HashMap;
import org.openxmlformats.schemas.drawingml.x2006.main.STPresetColorVal;
public enum PresetColor {
ALICE_BLUE(STPresetColorVal.ALICE_BLUE),
ANTIQUE_WHITE(STPresetColorVal.ANTIQUE_WHITE),
AQUA(STPresetColorVal.AQUA),
AQUAMARINE(STPresetColorVal.AQUAMARINE),
AZURE(STPresetColorVal.AZURE),
BEIGE(STPresetColorVal.BEIGE),
BISQUE(STPresetColorVal.BISQUE),
BLACK(STPresetColorVal.BLACK),
BLANCHED_ALMOND(STPresetColorVal.BLANCHED_ALMOND),
BLUE(STPresetColorVal.BLUE),
BLUE_VIOLET(STPresetColorVal.BLUE_VIOLET),
CADET_BLUE(STPresetColorVal.CADET_BLUE),
CHARTREUSE(STPresetColorVal.CHARTREUSE),
CHOCOLATE(STPresetColorVal.CHOCOLATE),
CORAL(STPresetColorVal.CORAL),
CORNFLOWER_BLUE(STPresetColorVal.CORNFLOWER_BLUE),
CORNSILK(STPresetColorVal.CORNSILK),
CRIMSON(STPresetColorVal.CRIMSON),
CYAN(STPresetColorVal.CYAN),
DEEP_PINK(STPresetColorVal.DEEP_PINK),
DEEP_SKY_BLUE(STPresetColorVal.DEEP_SKY_BLUE),
DIM_GRAY(STPresetColorVal.DIM_GRAY),
DARK_BLUE(STPresetColorVal.DK_BLUE),
DARK_CYAN(STPresetColorVal.DK_CYAN),
DARK_GOLDENROD(STPresetColorVal.DK_GOLDENROD),
DARK_GRAY(STPresetColorVal.DK_GRAY),
DARK_GREEN(STPresetColorVal.DK_GREEN),
DARK_KHAKI(STPresetColorVal.DK_KHAKI),
DARK_MAGENTA(STPresetColorVal.DK_MAGENTA),
DARK_OLIVE_GREEN(STPresetColorVal.DK_OLIVE_GREEN),
DARK_ORANGE(STPresetColorVal.DK_ORANGE),
DARK_ORCHID(STPresetColorVal.DK_ORCHID),
DARK_RED(STPresetColorVal.DK_RED),
DARK_SALMON(STPresetColorVal.DK_SALMON),
DARK_SEA_GREEN(STPresetColorVal.DK_SEA_GREEN),
DARK_SLATE_BLUE(STPresetColorVal.DK_SLATE_BLUE),
DARK_SLATE_GRAY(STPresetColorVal.DK_SLATE_GRAY),
DARK_TURQUOISE(STPresetColorVal.DK_TURQUOISE),
DARK_VIOLET(STPresetColorVal.DK_VIOLET),
DODGER_BLUE(STPresetColorVal.DODGER_BLUE),
FIREBRICK(STPresetColorVal.FIREBRICK),
FLORAL_WHITE(STPresetColorVal.FLORAL_WHITE),
FOREST_GREEN(STPresetColorVal.FOREST_GREEN),
FUCHSIA(STPresetColorVal.FUCHSIA),
GAINSBORO(STPresetColorVal.GAINSBORO),
GHOST_WHITE(STPresetColorVal.GHOST_WHITE),
GOLD(STPresetColorVal.GOLD),
GOLDENROD(STPresetColorVal.GOLDENROD),
GRAY(STPresetColorVal.GRAY),
GREEN(STPresetColorVal.GREEN),
GREEN_YELLOW(STPresetColorVal.GREEN_YELLOW),
HONEYDEW(STPresetColorVal.HONEYDEW),
HOT_PINK(STPresetColorVal.HOT_PINK),
INDIAN_RED(STPresetColorVal.INDIAN_RED),
INDIGO(STPresetColorVal.INDIGO),
IVORY(STPresetColorVal.IVORY),
KHAKI(STPresetColorVal.KHAKI),
LAVENDER(STPresetColorVal.LAVENDER),
LAVENDER_BLUSH(STPresetColorVal.LAVENDER_BLUSH),
LAWN_GREEN(STPresetColorVal.LAWN_GREEN),
LEMON_CHIFFON(STPresetColorVal.LEMON_CHIFFON),
LIME(STPresetColorVal.LIME),
LIME_GREEN(STPresetColorVal.LIME_GREEN),
LINEN(STPresetColorVal.LINEN),
LIGHT_BLUE(STPresetColorVal.LT_BLUE),
LIGHT_CORAL(STPresetColorVal.LT_CORAL),
LIGHT_CYAN(STPresetColorVal.LT_CYAN),
LIGHT_GOLDENROD_YELLOW(STPresetColorVal.LT_GOLDENROD_YELLOW),
LIGHT_GRAY(STPresetColorVal.LT_GRAY),
LIGHT_GREEN(STPresetColorVal.LT_GREEN),
LIGHT_PINK(STPresetColorVal.LT_PINK),
LIGHT_SALMON(STPresetColorVal.LT_SALMON),
LIGHT_SEA_GREEN(STPresetColorVal.LT_SEA_GREEN),
LIGHT_SKY_BLUE(STPresetColorVal.LT_SKY_BLUE),
LIGHT_SLATE_GRAY(STPresetColorVal.LT_SLATE_GRAY),
LIGHT_STEEL_BLUE(STPresetColorVal.LT_STEEL_BLUE),
LIGHT_YELLOW(STPresetColorVal.LT_YELLOW),
MAGENTA(STPresetColorVal.MAGENTA),
MAROON(STPresetColorVal.MAROON),
MEDIUM_AQUAMARINE(STPresetColorVal.MED_AQUAMARINE),
MEDIUM_BLUE(STPresetColorVal.MED_BLUE),
MEDIUM_ORCHID(STPresetColorVal.MED_ORCHID),
MEDIUM_PURPLE(STPresetColorVal.MED_PURPLE),
MEDIUM_SEA_GREEN(STPresetColorVal.MED_SEA_GREEN),
MEDIUM_SLATE_BLUE(STPresetColorVal.MED_SLATE_BLUE),
MEDIUM_SPRING_GREEN(STPresetColorVal.MED_SPRING_GREEN),
MEDIUM_TURQUOISE(STPresetColorVal.MED_TURQUOISE),
MEDIUM_VIOLET_RED(STPresetColorVal.MED_VIOLET_RED),
MIDNIGHT_BLUE(STPresetColorVal.MIDNIGHT_BLUE),
MINT_CREAM(STPresetColorVal.MINT_CREAM),
MISTY_ROSE(STPresetColorVal.MISTY_ROSE),
MOCCASIN(STPresetColorVal.MOCCASIN),
NAVAJO_WHITE(STPresetColorVal.NAVAJO_WHITE),
NAVY(STPresetColorVal.NAVY),
OLD_LACE(STPresetColorVal.OLD_LACE),
OLIVE(STPresetColorVal.OLIVE),
OLIVE_DRAB(STPresetColorVal.OLIVE_DRAB),
ORANGE(STPresetColorVal.ORANGE),
ORANGE_RED(STPresetColorVal.ORANGE_RED),
ORCHID(STPresetColorVal.ORCHID),
PALE_GOLDENROD(STPresetColorVal.PALE_GOLDENROD),
PALE_GREEN(STPresetColorVal.PALE_GREEN),
PALE_TURQUOISE(STPresetColorVal.PALE_TURQUOISE),
PALE_VIOLET_RED(STPresetColorVal.PALE_VIOLET_RED),
PAPAYA_WHIP(STPresetColorVal.PAPAYA_WHIP),
PEACH_PUFF(STPresetColorVal.PEACH_PUFF),
PERU(STPresetColorVal.PERU),
PINK(STPresetColorVal.PINK),
PLUM(STPresetColorVal.PLUM),
POWDER_BLUE(STPresetColorVal.POWDER_BLUE),
PURPLE(STPresetColorVal.PURPLE),
RED(STPresetColorVal.RED),
ROSY_BROWN(STPresetColorVal.ROSY_BROWN),
ROYAL_BLUE(STPresetColorVal.ROYAL_BLUE),
SADDLE_BROWN(STPresetColorVal.SADDLE_BROWN),
SALMON(STPresetColorVal.SALMON),
SANDY_BROWN(STPresetColorVal.SANDY_BROWN),
SEA_GREEN(STPresetColorVal.SEA_GREEN),
SEA_SHELL(STPresetColorVal.SEA_SHELL),
SIENNA(STPresetColorVal.SIENNA),
SILVER(STPresetColorVal.SILVER),
SKY_BLUE(STPresetColorVal.SKY_BLUE),
SLATE_BLUE(STPresetColorVal.SLATE_BLUE),
SLATE_GRAY(STPresetColorVal.SLATE_GRAY),
SNOW(STPresetColorVal.SNOW),
SPRING_GREEN(STPresetColorVal.SPRING_GREEN),
STEEL_BLUE(STPresetColorVal.STEEL_BLUE),
TAN(STPresetColorVal.TAN),
TEAL(STPresetColorVal.TEAL),
THISTLE(STPresetColorVal.THISTLE),
TOMATO(STPresetColorVal.TOMATO),
TURQUOISE(STPresetColorVal.TURQUOISE),
VIOLET(STPresetColorVal.VIOLET),
WHEAT(STPresetColorVal.WHEAT),
WHITE(STPresetColorVal.WHITE),
WHITE_SMOKE(STPresetColorVal.WHITE_SMOKE),
YELLOW(STPresetColorVal.YELLOW),
YELLOW_GREEN(STPresetColorVal.YELLOW_GREEN);
final STPresetColorVal.Enum underlying;
PresetColor(STPresetColorVal.Enum color) {
this.underlying = color;
}
private final static HashMap<STPresetColorVal.Enum, PresetColor> reverse = new HashMap<STPresetColorVal.Enum, PresetColor>();
static {
for (PresetColor value : values()) {
reverse.put(value.underlying, value);
}
}
static PresetColor valueOf(STPresetColorVal.Enum color) {
return reverse.get(color);
}
}

View File

@ -0,0 +1,230 @@
/* ====================================================================
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.HashMap;
import org.openxmlformats.schemas.drawingml.x2006.main.STShapeType;
public enum PresetGeometry {
ACCENT_BORDER_CALLOUT_1(STShapeType.ACCENT_BORDER_CALLOUT_1),
ACCENT_BORDER_CALLOUT_2(STShapeType.ACCENT_BORDER_CALLOUT_2),
ACCENT_BORDER_CALLOUT_3(STShapeType.ACCENT_BORDER_CALLOUT_3),
ACCENT_CALLOUT_1(STShapeType.ACCENT_CALLOUT_1),
ACCENT_CALLOUT_2(STShapeType.ACCENT_CALLOUT_2),
ACCENT_CALLOUT_3(STShapeType.ACCENT_CALLOUT_3),
ACTION_BUTTON_BACK_PREVIOUS(STShapeType.ACTION_BUTTON_BACK_PREVIOUS),
ACTION_BUTTON_BEGINNING(STShapeType.ACTION_BUTTON_BEGINNING),
ACTION_BUTTON_BLANK(STShapeType.ACTION_BUTTON_BLANK),
ACTION_BUTTON_DOCUMENT(STShapeType.ACTION_BUTTON_DOCUMENT),
ACTION_BUTTON_END(STShapeType.ACTION_BUTTON_END),
ACTION_BUTTON_FORWARD_NEXT(STShapeType.ACTION_BUTTON_FORWARD_NEXT),
ACTION_BUTTON_HELP(STShapeType.ACTION_BUTTON_HELP),
ACTION_BUTTON_HOME(STShapeType.ACTION_BUTTON_HOME),
ACTION_BUTTON_INFORMATION(STShapeType.ACTION_BUTTON_INFORMATION),
ACTION_BUTTON_MOVIE(STShapeType.ACTION_BUTTON_MOVIE),
ACTION_BUTTON_RETURN(STShapeType.ACTION_BUTTON_RETURN),
ACTION_BUTTON_SOUND(STShapeType.ACTION_BUTTON_SOUND),
ARC(STShapeType.ARC),
BENT_ARROW(STShapeType.BENT_ARROW),
BENT_CONNECTOR_2(STShapeType.BENT_CONNECTOR_2),
BENT_CONNECTOR_3(STShapeType.BENT_CONNECTOR_3),
DARK_BLUE(STShapeType.BENT_CONNECTOR_4),
BENT_CONNECTOR_4(STShapeType.BENT_CONNECTOR_4),
BENT_CONNECTOR_5(STShapeType.BENT_CONNECTOR_5),
BENT_UP_ARROW(STShapeType.BENT_UP_ARROW),
BEVEL(STShapeType.BEVEL),
BLOCK_ARC(STShapeType.BLOCK_ARC),
BORDER_CALLOUT_1(STShapeType.BORDER_CALLOUT_1),
BORDER_CALLOUT_2(STShapeType.BORDER_CALLOUT_2),
BORDER_CALLOUT_3(STShapeType.BORDER_CALLOUT_3),
BRACE_PAIR(STShapeType.BRACE_PAIR),
BRACKET_PAIR(STShapeType.BRACKET_PAIR),
CALLOUT_1(STShapeType.CALLOUT_1),
CALLOUT_2(STShapeType.CALLOUT_2),
CALLOUT_3(STShapeType.CALLOUT_3),
CAN(STShapeType.CAN),
CHART_PLUS(STShapeType.CHART_PLUS),
CHART_STAR(STShapeType.CHART_STAR),
CHART_X(STShapeType.CHART_X),
CHEVRON(STShapeType.CHEVRON),
CHORD(STShapeType.CHORD),
CIRCULAR_ARROW(STShapeType.CIRCULAR_ARROW),
CLOUD(STShapeType.CLOUD),
CLOUD_CALLOUT(STShapeType.CLOUD_CALLOUT),
CORNER(STShapeType.CORNER),
CORNER_TABS(STShapeType.CORNER_TABS),
CUBE(STShapeType.CUBE),
CURVED_CONNECTOR_2(STShapeType.CURVED_CONNECTOR_2),
CURVED_CONNECTOR_3(STShapeType.CURVED_CONNECTOR_3),
CURVED_CONNECTOR_4(STShapeType.CURVED_CONNECTOR_4),
CURVED_CONNECTOR_5(STShapeType.CURVED_CONNECTOR_5),
CURVED_DOWN_ARROW(STShapeType.CURVED_DOWN_ARROW),
CURVED_LEFT_ARROW(STShapeType.CURVED_LEFT_ARROW),
CURVED_RIGHT_ARROW(STShapeType.CURVED_RIGHT_ARROW),
CURVED_UP_ARROW(STShapeType.CURVED_UP_ARROW),
DECAGON(STShapeType.DECAGON),
DIAGONAL_STRIPE(STShapeType.DIAG_STRIPE),
DIAMOND(STShapeType.DIAMOND),
DODECAGON(STShapeType.DODECAGON),
DONUT(STShapeType.DONUT),
DOUBLE_WAVE(STShapeType.DOUBLE_WAVE),
DOWN_ARROW(STShapeType.DOWN_ARROW),
DOWN_ARROW_CALLOUT(STShapeType.DOWN_ARROW_CALLOUT),
ELLIPSE(STShapeType.ELLIPSE),
ELLIPSE_RIBBON(STShapeType.ELLIPSE_RIBBON),
ELLIPSE_RIBBON_2(STShapeType.ELLIPSE_RIBBON_2),
FLOW_CHART_ALTERNATE_PROCESS(STShapeType.FLOW_CHART_ALTERNATE_PROCESS),
FLOW_CHART_COLLATE(STShapeType.FLOW_CHART_COLLATE),
FLOW_CHART_CONNECTOR(STShapeType.FLOW_CHART_CONNECTOR),
FLOW_CHART_DECISION(STShapeType.FLOW_CHART_DECISION),
FLOW_CHART_DELAY(STShapeType.FLOW_CHART_DELAY),
FLOW_CHART_DISPLAY(STShapeType.FLOW_CHART_DISPLAY),
FLOW_CHART_DOCUMENT(STShapeType.FLOW_CHART_DOCUMENT),
FLOW_CHART_EXTRACT(STShapeType.FLOW_CHART_EXTRACT),
FLOW_CHART_INPUT_OUTPUT(STShapeType.FLOW_CHART_INPUT_OUTPUT),
FLOW_CHART_INTERNAL_STORAGE(STShapeType.FLOW_CHART_INTERNAL_STORAGE),
FLOW_CHART_MAGNETIC_DISK(STShapeType.FLOW_CHART_MAGNETIC_DISK),
FLOW_CHART_MAGNETIC_DRUM(STShapeType.FLOW_CHART_MAGNETIC_DRUM),
FLOW_CHART_MAGNETIC_TAPE(STShapeType.FLOW_CHART_MAGNETIC_TAPE),
FLOW_CHART_MANUAL_INPUT(STShapeType.FLOW_CHART_MANUAL_INPUT),
FLOW_CHART_MANUAL_OPERATION(STShapeType.FLOW_CHART_MANUAL_OPERATION),
FLOW_CHART_MERGE(STShapeType.FLOW_CHART_MERGE),
FLOW_CHART_MULTIDOCUMENT(STShapeType.FLOW_CHART_MULTIDOCUMENT),
FLOW_CHART_OFFLINE_STORAGE(STShapeType.FLOW_CHART_OFFLINE_STORAGE),
FLOW_CHART_OFFPAGE_CONNECTOR(STShapeType.FLOW_CHART_OFFPAGE_CONNECTOR),
FLOW_CHART_ONLINE_STORAGE(STShapeType.FLOW_CHART_ONLINE_STORAGE),
FLOW_CHART_OR(STShapeType.FLOW_CHART_OR),
FLOW_CHART_PREDEFINED_PROCESS(STShapeType.FLOW_CHART_PREDEFINED_PROCESS),
FLOW_CHART_PREPARATION(STShapeType.FLOW_CHART_PREPARATION),
FLOW_CHART_PROCESS(STShapeType.FLOW_CHART_PROCESS),
FLOW_CHART_PUNCHED_CARD(STShapeType.FLOW_CHART_PUNCHED_CARD),
FLOW_CHART_PUNCHED_TAPE(STShapeType.FLOW_CHART_PUNCHED_TAPE),
FLOW_CHART_SORT(STShapeType.FLOW_CHART_SORT),
FLOW_CHART_SUMMING_JUNCTION(STShapeType.FLOW_CHART_SUMMING_JUNCTION),
FLOW_CHART_TERMINATOR(STShapeType.FLOW_CHART_TERMINATOR),
FOLDED_CORNER(STShapeType.FOLDED_CORNER),
FRAME(STShapeType.FRAME),
FUNNEL(STShapeType.FUNNEL),
GEAR_6(STShapeType.GEAR_6),
GEAR_9(STShapeType.GEAR_9),
HALF_FRAME(STShapeType.HALF_FRAME),
HEART(STShapeType.HEART),
HEPTAGON(STShapeType.HEPTAGON),
HEXAGON(STShapeType.HEXAGON),
HOME_PLATE(STShapeType.HOME_PLATE),
HORIZONTAL_SCROLL(STShapeType.HORIZONTAL_SCROLL),
IRREGULAR_SEAL_1(STShapeType.IRREGULAR_SEAL_1),
IRREGULAR_SEAL_2(STShapeType.IRREGULAR_SEAL_2),
LEFT_ARROW(STShapeType.LEFT_ARROW),
LEFT_ARROW_CALLOUT(STShapeType.LEFT_ARROW_CALLOUT),
LEFT_BRACE(STShapeType.LEFT_BRACE),
LEFT_BRACKET(STShapeType.LEFT_BRACKET),
LEFT_CIRCULAR_ARROW(STShapeType.LEFT_CIRCULAR_ARROW),
LEFT_RIGHT_ARROW(STShapeType.LEFT_RIGHT_ARROW),
LEFT_RIGHT_ARROW_CALLOUT(STShapeType.LEFT_RIGHT_ARROW_CALLOUT),
LEFT_RIGHT_CIRCULAR_ARROW(STShapeType.LEFT_RIGHT_CIRCULAR_ARROW),
LEFT_RIGHT_RIBBON(STShapeType.LEFT_RIGHT_RIBBON),
LEFT_RIGHT_UP_ARROW(STShapeType.LEFT_RIGHT_UP_ARROW),
LEFT_UP_ARROW(STShapeType.LEFT_UP_ARROW),
LIGHTNING_BOLT(STShapeType.LIGHTNING_BOLT),
LINE(STShapeType.LINE),
LINE_INVERTED(STShapeType.LINE_INV),
MATH_DIVIDE(STShapeType.MATH_DIVIDE),
MATH_EQUAL(STShapeType.MATH_EQUAL),
MATH_MINUS(STShapeType.MATH_MINUS),
MATH_MULTIPLY(STShapeType.MATH_MULTIPLY),
MATH_NOT_EQUAL(STShapeType.MATH_NOT_EQUAL),
MATH_PLUS(STShapeType.MATH_PLUS),
MOON(STShapeType.MOON),
NO_SMOKING(STShapeType.NO_SMOKING),
NON_ISOSCELES_TRAPEZOID(STShapeType.NON_ISOSCELES_TRAPEZOID),
NOTCHED_RIGHT_ARROW(STShapeType.NOTCHED_RIGHT_ARROW),
OCTAGON(STShapeType.OCTAGON),
PARALLELOGRAM(STShapeType.PARALLELOGRAM),
PENTAGON(STShapeType.PENTAGON),
PIE(STShapeType.PIE),
PIE_WEDGE(STShapeType.PIE_WEDGE),
PLAQUE(STShapeType.PLAQUE),
PLAQUE_TABS(STShapeType.PLAQUE_TABS),
PLUS(STShapeType.PLUS),
QUAD_ARROW(STShapeType.QUAD_ARROW),
QUAD_ARROW_CALLOUT(STShapeType.QUAD_ARROW_CALLOUT),
RECTANGLE(STShapeType.RECT),
RIBBON(STShapeType.RIBBON),
RIBBON_2(STShapeType.RIBBON_2),
RIGHT_ARROW(STShapeType.RIGHT_ARROW),
RIGHT_ARROW_CALLOUT(STShapeType.RIGHT_ARROW_CALLOUT),
RIGHT_BRACE(STShapeType.RIGHT_BRACE),
RIGHT_BRACKET(STShapeType.RIGHT_BRACKET),
ROUND_RECTANGLE_1_CORNER(STShapeType.ROUND_1_RECT),
ROUND_RECTANGLE_2_DIAGONAL_CORNERS(STShapeType.ROUND_2_DIAG_RECT),
ROUND_RECTANGLE_2_SAME_SIDE_CORNERS(STShapeType.ROUND_2_SAME_RECT),
ROUND_RECTANGLE(STShapeType.ROUND_RECT),
RIGHT_TRIANGLE(STShapeType.RT_TRIANGLE),
SMILEY_FACE(STShapeType.SMILEY_FACE),
SNIP_RECTANGLE_1_CORNER(STShapeType.SNIP_1_RECT),
SNIP_RECTANGLE_2_DIAGONAL_CORNERS(STShapeType.SNIP_2_DIAG_RECT),
SNIP_RECTANGLE_2_SAME_SIDE_CORNERS(STShapeType.SNIP_2_SAME_RECT),
SNIP_ROUND_RECTANGLE(STShapeType.SNIP_ROUND_RECT),
SQUARE_TABS(STShapeType.SQUARE_TABS),
STAR_10(STShapeType.STAR_10),
STAR_12(STShapeType.STAR_12),
STAR_16(STShapeType.STAR_16),
STAR_24(STShapeType.STAR_24),
STAR_32(STShapeType.STAR_32),
STAR_4(STShapeType.STAR_4),
STAR_5(STShapeType.STAR_5),
STAR_6(STShapeType.STAR_6),
STAR_7(STShapeType.STAR_7),
STAR_8(STShapeType.STAR_8),
STRAIGHT_CONNECTOR(STShapeType.STRAIGHT_CONNECTOR_1),
STRIPED_RIGHT_ARROW(STShapeType.STRIPED_RIGHT_ARROW),
SUN(STShapeType.SUN),
SWOOSH_ARROW(STShapeType.SWOOSH_ARROW),
TEARDROP(STShapeType.TEARDROP),
TRAPEZOID(STShapeType.TRAPEZOID),
TRIANGLE(STShapeType.TRIANGLE),
UP_ARROW(STShapeType.UP_ARROW),
UP_ARROW_CALLOUT(STShapeType.UP_ARROW_CALLOUT),
UP_DOWN_ARROW(STShapeType.UP_DOWN_ARROW),
UP_DOWN_ARROW_CALLOUT(STShapeType.UP_DOWN_ARROW_CALLOUT),
UTURN_ARROW(STShapeType.UTURN_ARROW),
VERTICAL_SCROLL(STShapeType.VERTICAL_SCROLL),
WAVE(STShapeType.WAVE),
WEDGE_ELLIPSE_CALLOUT(STShapeType.WEDGE_ELLIPSE_CALLOUT),
WEDGE_RECTANGLE_CALLOUT(STShapeType.WEDGE_RECT_CALLOUT),
WEDGE_ROUND_RECTANGLE_CALLOUT(STShapeType.WEDGE_ROUND_RECT_CALLOUT);
final STShapeType.Enum underlying;
PresetGeometry(STShapeType.Enum shape) {
this.underlying = shape;
}
private final static HashMap<STShapeType.Enum, PresetGeometry> reverse = new HashMap<STShapeType.Enum, PresetGeometry>();
static {
for (PresetGeometry value : values()) {
reverse.put(value.underlying, value);
}
}
static PresetGeometry valueOf(STShapeType.Enum shape) {
return reverse.get(shape);
}
}

View File

@ -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 java.util.HashMap;
import org.openxmlformats.schemas.drawingml.x2006.main.STPresetLineDashVal;
public enum PresetLineDash {
DASH(STPresetLineDashVal.DASH),
DASH_DOT(STPresetLineDashVal.DASH_DOT),
DOT(STPresetLineDashVal.DOT),
LARGE_DASH(STPresetLineDashVal.LG_DASH),
LARGE_DASH_DOT(STPresetLineDashVal.LG_DASH_DOT),
LARGE_DASH_DOT_DOT(STPresetLineDashVal.LG_DASH_DOT_DOT),
SOLID(STPresetLineDashVal.SOLID),
SYSTEM_DASH(STPresetLineDashVal.SYS_DASH),
SYSTEM_DASH_DOT(STPresetLineDashVal.SYS_DASH_DOT),
SYSTEM_DASH_DOT_DOT(STPresetLineDashVal.SYS_DASH_DOT_DOT),
SYSTEM_DOT(STPresetLineDashVal.SYS_DOT);
final STPresetLineDashVal.Enum underlying;
PresetLineDash(STPresetLineDashVal.Enum dash) {
this.underlying = dash;
}
private final static HashMap<STPresetLineDashVal.Enum, PresetLineDash> reverse = new HashMap<STPresetLineDashVal.Enum, PresetLineDash>();
static {
for (PresetLineDash value : values()) {
reverse.put(value.underlying, value);
}
}
static PresetLineDash valueOf(STPresetLineDashVal.Enum dash) {
return reverse.get(dash);
}
}

View File

@ -0,0 +1,96 @@
/* ====================================================================
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.HashMap;
import org.openxmlformats.schemas.drawingml.x2006.main.STPresetPatternVal;
public enum PresetPattern {
CROSS(STPresetPatternVal.CROSS),
DASH_DOWNWARD_DIAGONAL(STPresetPatternVal.DASH_DN_DIAG),
DASH_HORIZONTAL(STPresetPatternVal.DASH_HORZ),
DASH_UPWARD_DIAGONAL(STPresetPatternVal.DASH_UP_DIAG),
DASH_VERTICAL(STPresetPatternVal.DASH_VERT),
DIAGONAL_BRICK(STPresetPatternVal.DIAG_BRICK),
DIAGONAL_CROSS(STPresetPatternVal.DIAG_CROSS),
DIVOT(STPresetPatternVal.DIVOT),
DARK_DOWNWARD_DIAGONAL(STPresetPatternVal.DK_DN_DIAG),
DARK_HORIZONTAL(STPresetPatternVal.DK_HORZ),
DARK_UPWARD_DIAGONAL(STPresetPatternVal.DK_UP_DIAG),
DARK_VERTICAL(STPresetPatternVal.DK_VERT),
DOWNWARD_DIAGONAL(STPresetPatternVal.DN_DIAG),
DOTTED_DIAMOND(STPresetPatternVal.DOT_DMND),
DOTTED_GRID(STPresetPatternVal.DOT_GRID),
HORIZONTAL(STPresetPatternVal.HORZ),
HORIZONTAL_BRICK(STPresetPatternVal.HORZ_BRICK),
LARGE_CHECKER_BOARD(STPresetPatternVal.LG_CHECK),
LARGE_CONFETTI(STPresetPatternVal.LG_CONFETTI),
LARGE_GRID(STPresetPatternVal.LG_GRID),
LIGHT_DOWNWARD_DIAGONAL(STPresetPatternVal.LT_DN_DIAG),
LIGHT_HORIZONTAL(STPresetPatternVal.LT_HORZ),
LIGHT_UPWARD_DIAGONAL(STPresetPatternVal.LT_UP_DIAG),
LIGHT_VERTICAL(STPresetPatternVal.LT_VERT),
NARROW_HORIZONTAL(STPresetPatternVal.NAR_HORZ),
NARROW_VERTICAL(STPresetPatternVal.NAR_VERT),
OPEN_DIAMOND(STPresetPatternVal.OPEN_DMND),
PERCENT_5(STPresetPatternVal.PCT_5),
PERCENT_10(STPresetPatternVal.PCT_10),
PERCENT_20(STPresetPatternVal.PCT_20),
PERCENT_25(STPresetPatternVal.PCT_25),
PERCENT_30(STPresetPatternVal.PCT_30),
PERCENT_40(STPresetPatternVal.PCT_40),
PERCENT_50(STPresetPatternVal.PCT_50),
PERCENT_60(STPresetPatternVal.PCT_60),
PERCENT_70(STPresetPatternVal.PCT_70),
PERCENT_75(STPresetPatternVal.PCT_75),
PERCENT_80(STPresetPatternVal.PCT_80),
PERCENT_90(STPresetPatternVal.PCT_90),
PLAID(STPresetPatternVal.PLAID),
SHINGLE(STPresetPatternVal.SHINGLE),
SMALL_CHECKER_BOARD(STPresetPatternVal.SM_CHECK),
SMALL_CONFETTI(STPresetPatternVal.SM_CONFETTI),
SMALL_GRID(STPresetPatternVal.SM_GRID),
SOLID_DIAMOND(STPresetPatternVal.SOLID_DMND),
SPHERE(STPresetPatternVal.SPHERE),
TRELLIS(STPresetPatternVal.TRELLIS),
UPWARD_DIAGONAL(STPresetPatternVal.UP_DIAG),
VERTICAL(STPresetPatternVal.VERT),
WAVE(STPresetPatternVal.WAVE),
WEAVE(STPresetPatternVal.WEAVE),
WIDE_DOWNWARD_DIAGONAL(STPresetPatternVal.WD_DN_DIAG),
WIDE_UPWARD_DIAGONAL(STPresetPatternVal.WD_UP_DIAG),
ZIG_ZAG(STPresetPatternVal.ZIG_ZAG);
final STPresetPatternVal.Enum underlying;
PresetPattern(STPresetPatternVal.Enum pattern) {
this.underlying = pattern;
}
private final static HashMap<STPresetPatternVal.Enum, PresetPattern> reverse = new HashMap<STPresetPatternVal.Enum, PresetPattern>();
static {
for (PresetPattern value : values()) {
reverse.put(value.underlying, value);
}
}
static PresetPattern valueOf(STPresetPatternVal.Enum pattern) {
return reverse.get(pattern);
}
}

View File

@ -0,0 +1,51 @@
/* ====================================================================
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.HashMap;
import org.openxmlformats.schemas.drawingml.x2006.main.STRectAlignment;
public enum RectangleAlignment {
BOTTOM(STRectAlignment.B),
BOTTOM_LEFT(STRectAlignment.BL),
BOTTOM_RIGHT(STRectAlignment.BR),
CENTER(STRectAlignment.CTR),
LEFT(STRectAlignment.L),
RIGHT(STRectAlignment.R),
TOP(STRectAlignment.T),
TOP_LEFT(STRectAlignment.TL),
TOP_RIGHT(STRectAlignment.TR);
final STRectAlignment.Enum underlying;
RectangleAlignment(STRectAlignment.Enum alignment) {
this.underlying = alignment;
}
private final static HashMap<STRectAlignment.Enum, RectangleAlignment> reverse = new HashMap<STRectAlignment.Enum, RectangleAlignment>();
static {
for (RectangleAlignment value : values()) {
reverse.put(value.underlying, value);
}
}
static RectangleAlignment valueOf(STRectAlignment.Enum alignment) {
return reverse.get(alignment);
}
}

View File

@ -0,0 +1,59 @@
/* ====================================================================
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.HashMap;
import org.openxmlformats.schemas.drawingml.x2006.main.STSchemeColorVal;
public enum SchemeColor {
ACCENT_1(STSchemeColorVal.ACCENT_1),
ACCENT_2(STSchemeColorVal.ACCENT_2),
ACCENT_3(STSchemeColorVal.ACCENT_3),
ACCENT_4(STSchemeColorVal.ACCENT_4),
ACCENT_5(STSchemeColorVal.ACCENT_5),
ACCENT_6(STSchemeColorVal.ACCENT_6),
BACKGROUND_1(STSchemeColorVal.BG_1),
BACKGROUND_2(STSchemeColorVal.BG_2),
DARK_1(STSchemeColorVal.DK_1),
DARK_2(STSchemeColorVal.DK_2),
FOLLOWED_LINK(STSchemeColorVal.FOL_HLINK),
LINK(STSchemeColorVal.HLINK),
LIGHT_1(STSchemeColorVal.LT_1),
LIGHT_2(STSchemeColorVal.LT_2),
PLACEHOLDER(STSchemeColorVal.PH_CLR),
TEXT_1(STSchemeColorVal.TX_1),
TEXT_2(STSchemeColorVal.TX_2);
final STSchemeColorVal.Enum underlying;
SchemeColor(STSchemeColorVal.Enum color) {
this.underlying = color;
}
private final static HashMap<STSchemeColorVal.Enum, SchemeColor> reverse = new HashMap<STSchemeColorVal.Enum, SchemeColor>();
static {
for (SchemeColor value : values()) {
reverse.put(value.underlying, value);
}
}
static SchemeColor valueOf(STSchemeColorVal.Enum color) {
return reverse.get(color);
}
}

View File

@ -0,0 +1,72 @@
/* ====================================================================
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.HashMap;
import org.openxmlformats.schemas.drawingml.x2006.main.STSystemColorVal;
public enum SystemColor {
ACTIVE_BORDER(STSystemColorVal.ACTIVE_BORDER),
ACTIVE_CAPTION(STSystemColorVal.ACTIVE_CAPTION),
APPLICATION_WORKSPACE(STSystemColorVal.APP_WORKSPACE),
BACKGROUND(STSystemColorVal.BACKGROUND),
BUTTON_FACE(STSystemColorVal.BTN_FACE),
BUTTON_HIGHLIGHT(STSystemColorVal.BTN_HIGHLIGHT),
BUTTON_SHADOW(STSystemColorVal.BTN_SHADOW),
BUTTON_TEXT(STSystemColorVal.BTN_TEXT),
CAPTION_TEXT(STSystemColorVal.CAPTION_TEXT),
GRADIENT_ACTIVE_CAPTION(STSystemColorVal.GRADIENT_ACTIVE_CAPTION),
GRADIENT_INACTIVE_CAPTION(STSystemColorVal.GRADIENT_INACTIVE_CAPTION),
GRAY_TEXT(STSystemColorVal.GRAY_TEXT),
HIGHLIGHT(STSystemColorVal.HIGHLIGHT),
HIGHLIGHT_TEXT(STSystemColorVal.HIGHLIGHT_TEXT),
HOT_LIGHT(STSystemColorVal.HOT_LIGHT),
INACTIVE_BORDER(STSystemColorVal.INACTIVE_BORDER),
INACTIVE_CAPTION(STSystemColorVal.INACTIVE_CAPTION),
INACTIVE_CAPTION_TEXT(STSystemColorVal.INACTIVE_CAPTION_TEXT),
INFO_BACKGROUND(STSystemColorVal.INFO_BK),
INFO_TEXT(STSystemColorVal.INFO_TEXT),
MENU(STSystemColorVal.MENU),
MENU_BAR(STSystemColorVal.MENU_BAR),
MENU_HIGHLIGHT(STSystemColorVal.MENU_HIGHLIGHT),
MENU_TEXT(STSystemColorVal.MENU_TEXT),
SCROLL_BAR(STSystemColorVal.SCROLL_BAR),
WINDOW(STSystemColorVal.WINDOW),
WINDOW_FRAME(STSystemColorVal.WINDOW_FRAME),
WINDOW_TEXT(STSystemColorVal.WINDOW_TEXT),
X_3D_DARK_SHADOW(STSystemColorVal.X_3_D_DK_SHADOW),
X_3D_LIGHT(STSystemColorVal.X_3_D_LIGHT);
final STSystemColorVal.Enum underlying;
SystemColor(STSystemColorVal.Enum color) {
this.underlying = color;
}
private final static HashMap<STSystemColorVal.Enum, SystemColor> reverse = new HashMap<STSystemColorVal.Enum, SystemColor>();
static {
for (SystemColor value : values()) {
reverse.put(value.underlying, value);
}
}
static SystemColor valueOf(STSystemColorVal.Enum color) {
return reverse.get(color);
}
}

View File

@ -0,0 +1,46 @@
/* ====================================================================
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.HashMap;
import org.openxmlformats.schemas.drawingml.x2006.main.STTileFlipMode;
public enum TileFlipMode {
NONE(STTileFlipMode.NONE),
X(STTileFlipMode.X),
XY(STTileFlipMode.XY),
Y(STTileFlipMode.Y);
final STTileFlipMode.Enum underlying;
TileFlipMode(STTileFlipMode.Enum mode) {
this.underlying = mode;
}
private final static HashMap<STTileFlipMode.Enum, TileFlipMode> reverse = new HashMap<STTileFlipMode.Enum, TileFlipMode>();
static {
for (TileFlipMode value : values()) {
reverse.put(value.underlying, value);
}
}
static TileFlipMode valueOf(STTileFlipMode.Enum mode) {
return reverse.get(mode);
}
}

View File

@ -0,0 +1,39 @@
/*
* ====================================================================
* 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.CTPolarAdjustHandle;
@Beta
public class XDDFAdjustHandlePolar {
private CTPolarAdjustHandle handle;
@Internal
public XDDFAdjustHandlePolar(CTPolarAdjustHandle handle) {
this.handle = handle;
}
@Internal
public CTPolarAdjustHandle getXmlObject() {
return handle;
}
}

View File

@ -0,0 +1,39 @@
/*
* ====================================================================
* 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.CTXYAdjustHandle;
@Beta
public class XDDFAdjustHandleXY {
private CTXYAdjustHandle handle;
@Internal
public XDDFAdjustHandleXY(CTXYAdjustHandle handle) {
this.handle = handle;
}
@Internal
public CTXYAdjustHandle getXmlObject() {
return handle;
}
}

View File

@ -0,0 +1,79 @@
/* ====================================================================
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.apache.xmlbeans.XmlObject;
import org.openxmlformats.schemas.drawingml.x2006.main.CTColor;
@Beta
public abstract class XDDFColor {
protected CTColor container;
@Internal
protected XDDFColor(CTColor container) {
this.container = container;
}
public static XDDFColor from(byte[] color) {
return new XDDFColorRgbBinary(color);
}
public static XDDFColor from(int red, int green, int blue) {
return new XDDFColorRgbPercent(red, green, blue);
}
public static XDDFColor from(PresetColor color) {
return new XDDFColorPreset(color);
}
public static XDDFColor from(SchemeColor color) {
return new XDDFColorSchemeBased(color);
}
public static XDDFColor from(SystemColor color) {
return new XDDFColorSystemDefined(color);
}
@Internal
protected static XDDFColor forColorContainer(CTColor container) {
if (container.isSetHslClr()) {
return new XDDFColorHsl(container.getHslClr(), container);
} else if (container.isSetPrstClr()) {
return new XDDFColorPreset(container.getPrstClr(), container);
} else if (container.isSetSchemeClr()) {
return new XDDFColorSchemeBased(container.getSchemeClr(), container);
} else if (container.isSetScrgbClr()) {
return new XDDFColorRgbPercent(container.getScrgbClr(), container);
} else if (container.isSetSrgbClr()) {
return new XDDFColorRgbBinary(container.getSrgbClr(), container);
} else if (container.isSetSysClr()) {
return new XDDFColorSystemDefined(container.getSysClr(), container);
}
return null;
}
@Internal
protected CTColor getColorContainer() {
return container;
}
@Internal
protected abstract XmlObject getXmlObject();
}

View File

@ -0,0 +1,77 @@
/* ====================================================================
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.apache.xmlbeans.XmlObject;
import org.openxmlformats.schemas.drawingml.x2006.main.CTColor;
import org.openxmlformats.schemas.drawingml.x2006.main.CTHslColor;
@Beta
public class XDDFColorHsl extends XDDFColor {
private CTHslColor color;
public XDDFColorHsl(int hue, int saturation, int luminance) {
this(CTHslColor.Factory.newInstance(), CTColor.Factory.newInstance());
setHue(hue);
setSaturation(saturation);
setLuminance(luminance);
}
@Internal
protected XDDFColorHsl(CTHslColor color) {
this(color, null);
}
@Internal
protected XDDFColorHsl(CTHslColor color, CTColor container) {
super(container);
this.color = color;
}
@Override
@Internal
protected XmlObject getXmlObject() {
return color;
}
public int getHue() {
return color.getHue2();
}
public void setHue(int hue) {
color.setHue2(hue);
}
public int getSaturation() {
return color.getSat2();
}
public void setSaturation(int saturation) {
color.setSat2(saturation);
}
public int getLuminance() {
return color.getLum2();
}
public void setLuminance(int lightness) {
color.setLum2(lightness);
}
}

View File

@ -0,0 +1,69 @@
/* ====================================================================
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.apache.xmlbeans.XmlObject;
import org.openxmlformats.schemas.drawingml.x2006.main.CTColor;
import org.openxmlformats.schemas.drawingml.x2006.main.CTPresetColor;
@Beta
public class XDDFColorPreset extends XDDFColor {
private CTPresetColor color;
public XDDFColorPreset(PresetColor color) {
this(CTPresetColor.Factory.newInstance(), CTColor.Factory.newInstance());
setValue(color);
}
@Internal
protected XDDFColorPreset(CTPresetColor color) {
this(color, null);
}
@Internal
protected XDDFColorPreset(CTPresetColor color, CTColor container) {
super(container);
this.color = color;
}
@Override
@Internal
protected XmlObject getXmlObject() {
return color;
}
public PresetColor getValue() {
if (color.isSetVal()) {
return PresetColor.valueOf(color.getVal());
} else {
return null;
}
}
public void setValue(PresetColor value) {
if (value == null) {
if (color.isSetVal()) {
color.unsetVal();
}
} else {
color.setVal(value.underlying);
}
}
}

View File

@ -0,0 +1,69 @@
/* ====================================================================
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.Locale;
import org.apache.poi.util.Beta;
import org.apache.poi.util.Internal;
import org.apache.xmlbeans.XmlObject;
import org.openxmlformats.schemas.drawingml.x2006.main.CTColor;
import org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor;
@Beta
public class XDDFColorRgbBinary extends XDDFColor {
private CTSRgbColor color;
public XDDFColorRgbBinary(byte[] color) {
this(CTSRgbColor.Factory.newInstance(), CTColor.Factory.newInstance());
setValue(color);
}
@Internal
protected XDDFColorRgbBinary(CTSRgbColor color) {
this(color, null);
}
@Internal
protected XDDFColorRgbBinary(CTSRgbColor color, CTColor container) {
super(container);
this.color = color;
}
@Override
@Internal
protected XmlObject getXmlObject() {
return color;
}
public byte[] getValue() {
return color.getVal();
}
public void setValue(byte[] value) {
color.setVal(value);
}
public String toRGBHex() {
StringBuilder sb = new StringBuilder(6);
for (byte b: color.getVal()) {
sb.append(String.format(Locale.ROOT, "%02X", b));
}
return sb.toString().toUpperCase(Locale.ROOT);
}
}

View File

@ -0,0 +1,102 @@
/* ====================================================================
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.Locale;
import org.apache.poi.util.Beta;
import org.apache.poi.util.Internal;
import org.apache.xmlbeans.XmlObject;
import org.openxmlformats.schemas.drawingml.x2006.main.CTColor;
import org.openxmlformats.schemas.drawingml.x2006.main.CTScRgbColor;
@Beta
public class XDDFColorRgbPercent extends XDDFColor {
private CTScRgbColor color;
public XDDFColorRgbPercent(int red, int green, int blue) {
this(CTScRgbColor.Factory.newInstance(), CTColor.Factory.newInstance());
setRed(red);
setGreen(green);
setBlue(blue);
}
@Internal
protected XDDFColorRgbPercent(CTScRgbColor color) {
this(color, null);
}
@Internal
protected XDDFColorRgbPercent(CTScRgbColor color, CTColor container) {
super(container);
this.color = color;
}
@Override
@Internal
protected XmlObject getXmlObject() {
return color;
}
public int getRed() {
return color.getR();
}
public void setRed(int red) {
color.setR(normalize(red));
}
public int getGreen() {
return color.getG();
}
public void setGreen(int green) {
color.setG(normalize(green));
}
public int getBlue() {
return color.getB();
}
public void setBlue(int blue) {
color.setB(normalize(blue));
}
private int normalize(int value) {
if (value < 0) {
return 0;
}
if (100_000 < value) {
return 100_000;
}
return value;
}
public String toRGBHex() {
StringBuilder sb = new StringBuilder(6);
appendHex(sb, color.getR());
appendHex(sb, color.getG());
appendHex(sb, color.getB());
return sb.toString().toUpperCase(Locale.ROOT);
}
private void appendHex(StringBuilder sb, int value) {
int b = value * 255 / 100_000;
sb.append(String.format(Locale.ROOT, "%02X", b));
}
}

View File

@ -0,0 +1,59 @@
/* ====================================================================
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.apache.xmlbeans.XmlObject;
import org.openxmlformats.schemas.drawingml.x2006.main.CTColor;
import org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor;
@Beta
public class XDDFColorSchemeBased extends XDDFColor {
private CTSchemeColor color;
public XDDFColorSchemeBased(SchemeColor color) {
this(CTSchemeColor.Factory.newInstance(), CTColor.Factory.newInstance());
setValue(color);
}
@Internal
protected XDDFColorSchemeBased(CTSchemeColor color) {
this(color, null);
}
@Internal
protected XDDFColorSchemeBased(CTSchemeColor color, CTColor container) {
super(container);
this.color = color;
}
@Override
@Internal
protected XmlObject getXmlObject() {
return color;
}
public SchemeColor getValue() {
return SchemeColor.valueOf(color.getVal());
}
public void setValue(SchemeColor scheme) {
color.setVal(scheme.underlying);
}
}

View File

@ -0,0 +1,77 @@
/* ====================================================================
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.apache.xmlbeans.XmlObject;
import org.openxmlformats.schemas.drawingml.x2006.main.CTColor;
import org.openxmlformats.schemas.drawingml.x2006.main.CTSystemColor;
@Beta
public class XDDFColorSystemDefined extends XDDFColor {
private CTSystemColor color;
public XDDFColorSystemDefined(SystemColor color) {
this(CTSystemColor.Factory.newInstance(), CTColor.Factory.newInstance());
setValue(color);
}
@Internal
protected XDDFColorSystemDefined(CTSystemColor color) {
this(color, null);
}
@Internal
protected XDDFColorSystemDefined(CTSystemColor color, CTColor container) {
super(container);
this.color = color;
}
@Override
@Internal
protected XmlObject getXmlObject() {
return color;
}
public SystemColor getValue() {
return SystemColor.valueOf(color.getVal());
}
public void setValue(SystemColor value) {
color.setVal(value.underlying);
}
public byte[] getLastColor() {
if (color.isSetLastClr()) {
return color.getLastClr();
} else {
return null;
}
}
public void setLastColor(byte[] last) {
if (last == null) {
if (color.isSetLastClr()) {
color.unsetLastClr();
}
} else {
color.setLastClr(last);
}
}
}

View File

@ -0,0 +1,39 @@
/*
* ====================================================================
* 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.CTConnectionSite;
@Beta
public class XDDFConnectionSite {
private CTConnectionSite site;
@Internal
protected XDDFConnectionSite(CTConnectionSite site) {
this.site = site;
}
@Internal
public CTConnectionSite getXmlObject() {
return site;
}
}

View File

@ -0,0 +1,288 @@
/* ====================================================================
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.CTCustomGeometry2D;
@Beta
public class XDDFCustomGeometry2D {
private CTCustomGeometry2D geometry;
protected XDDFCustomGeometry2D(CTCustomGeometry2D geometry) {
this.geometry = geometry;
}
@Internal
protected CTCustomGeometry2D getXmlObject() {
return geometry;
}
public XDDFGeometryRectangle getRectangle() {
if (geometry.isSetRect()) {
return new XDDFGeometryRectangle(geometry.getRect());
} else {
return null;
}
}
public void setRectangle(XDDFGeometryRectangle rectangle) {
if (rectangle == null) {
if (geometry.isSetRect()) {
geometry.unsetRect();
}
} else {
geometry.setRect(rectangle.getXmlObject());
}
}
public XDDFAdjustHandlePolar addPolarAdjustHandle() {
if (!geometry.isSetAhLst()) {
geometry.addNewAhLst();
}
return new XDDFAdjustHandlePolar(geometry.getAhLst().addNewAhPolar());
}
public XDDFAdjustHandlePolar insertPolarAdjustHandle(int index) {
if (!geometry.isSetAhLst()) {
geometry.addNewAhLst();
}
return new XDDFAdjustHandlePolar(geometry.getAhLst().insertNewAhPolar(index));
}
public void removePolarAdjustHandle(int index) {
if (geometry.isSetAhLst()) {
geometry.getAhLst().removeAhPolar(index);
}
}
public XDDFAdjustHandlePolar getPolarAdjustHandle(int index) {
if (geometry.isSetAhLst()) {
return new XDDFAdjustHandlePolar(geometry.getAhLst().getAhPolarArray(index));
} else {
return null;
}
}
public List<XDDFAdjustHandlePolar> getPolarAdjustHandles() {
if (geometry.isSetAhLst()) {
return Collections.unmodifiableList(geometry
.getAhLst()
.getAhPolarList()
.stream()
.map(guide -> new XDDFAdjustHandlePolar(guide))
.collect(Collectors.toList()));
} else {
return Collections.emptyList();
}
}
public XDDFAdjustHandleXY addXYAdjustHandle() {
if (!geometry.isSetAhLst()) {
geometry.addNewAhLst();
}
return new XDDFAdjustHandleXY(geometry.getAhLst().addNewAhXY());
}
public XDDFAdjustHandleXY insertXYAdjustHandle(int index) {
if (!geometry.isSetAhLst()) {
geometry.addNewAhLst();
}
return new XDDFAdjustHandleXY(geometry.getAhLst().insertNewAhXY(index));
}
public void removeXYAdjustHandle(int index) {
if (geometry.isSetAhLst()) {
geometry.getAhLst().removeAhXY(index);
}
}
public XDDFAdjustHandleXY getXYAdjustHandle(int index) {
if (geometry.isSetAhLst()) {
return new XDDFAdjustHandleXY(geometry.getAhLst().getAhXYArray(index));
} else {
return null;
}
}
public List<XDDFAdjustHandleXY> getXYAdjustHandles() {
if (geometry.isSetAhLst()) {
return Collections.unmodifiableList(geometry
.getAhLst()
.getAhXYList()
.stream()
.map(guide -> new XDDFAdjustHandleXY(guide))
.collect(Collectors.toList()));
} else {
return Collections.emptyList();
}
}
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();
}
}
public XDDFConnectionSite addConnectionSite() {
if (!geometry.isSetCxnLst()) {
geometry.addNewCxnLst();
}
return new XDDFConnectionSite(geometry.getCxnLst().addNewCxn());
}
public XDDFConnectionSite insertConnectionSite(int index) {
if (!geometry.isSetCxnLst()) {
geometry.addNewCxnLst();
}
return new XDDFConnectionSite(geometry.getCxnLst().insertNewCxn(index));
}
public void removeConnectionSite(int index) {
if (geometry.isSetCxnLst()) {
geometry.getCxnLst().removeCxn(index);
}
}
public XDDFConnectionSite getConnectionSite(int index) {
if (geometry.isSetCxnLst()) {
return new XDDFConnectionSite(geometry.getCxnLst().getCxnArray(index));
} else {
return null;
}
}
public List<XDDFConnectionSite> getConnectionSites() {
if (geometry.isSetCxnLst()) {
return Collections.unmodifiableList(geometry
.getCxnLst()
.getCxnList()
.stream()
.map(guide -> new XDDFConnectionSite(guide))
.collect(Collectors.toList()));
} else {
return Collections.emptyList();
}
}
public XDDFGeometryGuide addGuide() {
if (!geometry.isSetGdLst()) {
geometry.addNewGdLst();
}
return new XDDFGeometryGuide(geometry.getGdLst().addNewGd());
}
public XDDFGeometryGuide insertGuide(int index) {
if (!geometry.isSetGdLst()) {
geometry.addNewGdLst();
}
return new XDDFGeometryGuide(geometry.getGdLst().insertNewGd(index));
}
public void removeGuide(int index) {
if (geometry.isSetGdLst()) {
geometry.getGdLst().removeGd(index);
}
}
public XDDFGeometryGuide getGuide(int index) {
if (geometry.isSetGdLst()) {
return new XDDFGeometryGuide(geometry.getGdLst().getGdArray(index));
} else {
return null;
}
}
public List<XDDFGeometryGuide> getGuides() {
if (geometry.isSetGdLst()) {
return Collections.unmodifiableList(geometry
.getGdLst()
.getGdList()
.stream()
.map(guide -> new XDDFGeometryGuide(guide))
.collect(Collectors.toList()));
} else {
return Collections.emptyList();
}
}
public XDDFPath addNewPath() {
return new XDDFPath(geometry.getPathLst().addNewPath());
}
public XDDFPath insertNewPath(int index) {
return new XDDFPath(geometry.getPathLst().insertNewPath(index));
}
public void removePath(int index) {
geometry.getPathLst().removePath(index);
}
public XDDFPath getPath(int index) {
return new XDDFPath(geometry.getPathLst().getPathArray(index));
}
public List<XDDFPath> getPaths() {
return Collections.unmodifiableList(geometry
.getPathLst()
.getPathList()
.stream()
.map(ds -> new XDDFPath(ds))
.collect(Collectors.toList()));
}
}

View File

@ -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.apache.poi.util.Internal;
import org.openxmlformats.schemas.drawingml.x2006.main.CTDashStop;
@Beta
public class XDDFDashStop {
private CTDashStop stop;
@Internal
protected XDDFDashStop(CTDashStop stop) {
this.stop = stop;
}
@Internal
protected CTDashStop getXmlObject() {
return stop;
}
public int getDashLength() {
return stop.getD();
}
public void setDashLength(int length) {
stop.setD(length);
}
public int getSpaceLength() {
return stop.getSp();
}
public void setSpaceLength(int length) {
stop.setSp(length);
}
}

View File

@ -0,0 +1,37 @@
/* ====================================================================
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.CTEffectContainer;
@Beta
public class XDDFEffectContainer {
private CTEffectContainer container;
@Internal
protected XDDFEffectContainer(CTEffectContainer container) {
this.container = container;
}
@Internal
public CTEffectContainer getXmlObject() {
return container;
}
}

View File

@ -0,0 +1,37 @@
/* ====================================================================
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.CTEffectList;
@Beta
public class XDDFEffectList {
private CTEffectList list;
@Internal
protected XDDFEffectList(CTEffectList list) {
this.list = list;
}
@Internal
public CTEffectList getXmlObject() {
return list;
}
}

View File

@ -0,0 +1,37 @@
/* ====================================================================
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.CTOfficeArtExtensionList;
@Beta
public class XDDFExtensionList {
private CTOfficeArtExtensionList list;
@Internal
protected XDDFExtensionList(CTOfficeArtExtensionList list) {
this.list = list;
}
@Internal
public CTOfficeArtExtensionList getXmlObject() {
return list;
}
}

View File

@ -0,0 +1,24 @@
/* ====================================================================
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;
@Beta
public interface XDDFFillProperties {
}

View File

@ -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.apache.poi.util.Internal;
import org.openxmlformats.schemas.drawingml.x2006.main.CTGeomGuide;
@Beta
public class XDDFGeometryGuide {
private CTGeomGuide guide;
@Internal
protected XDDFGeometryGuide(CTGeomGuide guide) {
this.guide = guide;
}
@Internal
protected CTGeomGuide getXmlObject() {
return guide;
}
public String getFormula() {
return guide.getFmla();
}
public void setFormula(String formula) {
guide.setFmla(formula);
}
public String getName() {
return guide.getName();
}
public void setName(String name) {
guide.setName(name);
}
}

View File

@ -0,0 +1,39 @@
/*
* ====================================================================
* 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.CTGeomRect;
@Beta
public class XDDFGeometryRectangle {
private CTGeomRect rectangle;
@Internal
protected XDDFGeometryRectangle(CTGeomRect rectangle) {
this.rectangle = rectangle;
}
@Internal
public CTGeomRect getXmlObject() {
return rectangle;
}
}

View File

@ -0,0 +1,182 @@
/* ====================================================================
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.CTGradientFillProperties;
@Beta
public class XDDFGradientFillProperties implements XDDFFillProperties {
private CTGradientFillProperties props;
public XDDFGradientFillProperties() {
this(CTGradientFillProperties.Factory.newInstance());
}
protected XDDFGradientFillProperties(CTGradientFillProperties properties) {
this.props = properties;
}
@Internal
protected CTGradientFillProperties getXmlObject() {
return props;
}
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 TileFlipMode getTileFlipMode() {
if (props.isSetFlip()) {
return TileFlipMode.valueOf(props.getFlip());
} else {
return null;
}
}
public void setTileFlipMode(TileFlipMode mode) {
if (mode == null) {
if (props.isSetFlip()) {
props.unsetFlip();
}
} else {
props.setFlip(mode.underlying);
}
}
public XDDFGradientStop addGradientStop() {
if (!props.isSetGsLst()) {
props.addNewGsLst();
}
return new XDDFGradientStop(props.getGsLst().addNewGs());
}
public XDDFGradientStop insertGradientStop(int index) {
if (!props.isSetGsLst()) {
props.addNewGsLst();
}
return new XDDFGradientStop(props.getGsLst().insertNewGs(index));
}
public void removeGradientStop(int index) {
if (props.isSetGsLst()) {
props.getGsLst().removeGs(index);
}
}
public XDDFGradientStop getGradientStop(int index) {
if (props.isSetGsLst()) {
return new XDDFGradientStop(props.getGsLst().getGsArray(index));
} else {
return null;
}
}
public List<XDDFGradientStop> getGradientStops() {
if (props.isSetGsLst()) {
return Collections.unmodifiableList(props
.getGsLst()
.getGsList()
.stream()
.map(gs -> new XDDFGradientStop(gs))
.collect(Collectors.toList()));
} else {
return Collections.emptyList();
}
}
public int countGradientStops() {
if (props.isSetGsLst()) {
return props.getGsLst().sizeOfGsArray();
} else {
return 0;
}
}
public XDDFLinearShadeProperties getLinearShadeProperties() {
if (props.isSetLin()) {
return new XDDFLinearShadeProperties(props.getLin());
} else {
return null;
}
}
public void setLinearShadeProperties(XDDFLinearShadeProperties properties) {
if (properties == null) {
if (props.isSetLin()) {
props.unsetLin();
}
} else {
props.setLin(properties.getXmlObject());
}
}
public XDDFPathShadeProperties getPathShadeProperties() {
if (props.isSetPath()) {
return new XDDFPathShadeProperties(props.getPath());
} else {
return null;
}
}
public void setPathShadeProperties(XDDFPathShadeProperties properties) {
if (properties == null) {
if (props.isSetPath()) {
props.unsetPath();
}
} else {
props.setPath(properties.getXmlObject());
}
}
public XDDFRelativeRectangle getTileRectangle() {
if (props.isSetTileRect()) {
return new XDDFRelativeRectangle(props.getTileRect());
} else {
return null;
}
}
public void setTileRectangle(XDDFRelativeRectangle rectangle) {
if (rectangle == null) {
if (props.isSetTileRect()) {
props.unsetTileRect();
}
} else {
props.setTileRect(rectangle.getXmlObject());
}
}
}

View File

@ -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.CTGradientStop;
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.CTSystemColor;
@Beta
public class XDDFGradientStop {
private CTGradientStop stop;
@Internal
protected XDDFGradientStop(CTGradientStop stop) {
this.stop = stop;
}
@Internal
protected CTGradientStop getXmlObject() {
return stop;
}
public int getPosition() {
return stop.getPos();
}
public void setPosition(int position) {
stop.setPos(position);
}
public XDDFColor getColor() {
if (stop.isSetHslClr()) {
return new XDDFColorHsl(stop.getHslClr());
} else if (stop.isSetPrstClr()) {
return new XDDFColorPreset(stop.getPrstClr());
} else if (stop.isSetSchemeClr()) {
return new XDDFColorSchemeBased(stop.getSchemeClr());
} else if (stop.isSetScrgbClr()) {
return new XDDFColorRgbPercent(stop.getScrgbClr());
} else if (stop.isSetSrgbClr()) {
return new XDDFColorRgbBinary(stop.getSrgbClr());
} else if (stop.isSetSysClr()) {
return new XDDFColorSystemDefined(stop.getSysClr());
}
return null;
}
public void setColor(XDDFColor color) {
if (stop.isSetHslClr()) {
stop.unsetHslClr();
}
if (stop.isSetPrstClr()) {
stop.unsetPrstClr();
}
if (stop.isSetSchemeClr()) {
stop.unsetSchemeClr();
}
if (stop.isSetScrgbClr()) {
stop.unsetScrgbClr();
}
if (stop.isSetSrgbClr()) {
stop.unsetSrgbClr();
}
if (stop.isSetSysClr()) {
stop.unsetSysClr();
}
if (color == null) {
return;
}
if (color instanceof XDDFColorHsl) {
stop.setHslClr((CTHslColor) color.getXmlObject());
} else if (color instanceof XDDFColorPreset) {
stop.setPrstClr((CTPresetColor) color.getXmlObject());
} else if (color instanceof XDDFColorSchemeBased) {
stop.setSchemeClr((CTSchemeColor) color.getXmlObject());
} else if (color instanceof XDDFColorRgbPercent) {
stop.setScrgbClr((CTScRgbColor) color.getXmlObject());
} else if (color instanceof XDDFColorRgbBinary) {
stop.setSrgbClr((CTSRgbColor) color.getXmlObject());
} else if (color instanceof XDDFColorSystemDefined) {
stop.setSysClr((CTSystemColor) color.getXmlObject());
}
}
}

View File

@ -0,0 +1,40 @@
/* ====================================================================
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.CTGroupFillProperties;
@Beta
public class XDDFGroupFillProperties implements XDDFFillProperties {
private CTGroupFillProperties props;
public XDDFGroupFillProperties() {
this(CTGroupFillProperties.Factory.newInstance());
}
protected XDDFGroupFillProperties(CTGroupFillProperties properties) {
this.props = properties;
}
@Internal
protected CTGroupFillProperties getXmlObject() {
return props;
}
}

View File

@ -0,0 +1,60 @@
/* ====================================================================
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.CTLineEndProperties;
@Beta
public class XDDFLineEndProperties {
private CTLineEndProperties props;
protected XDDFLineEndProperties(CTLineEndProperties properties) {
this.props = properties;
}
@Internal
protected CTLineEndProperties getXmlObject() {
return props;
}
public LineEndLength getLength() {
return LineEndLength.valueOf(props.getLen());
}
public void setLength(LineEndLength length) {
props.setLen(length.underlying);
}
public LineEndType getType() {
return LineEndType.valueOf(props.getType());
}
public void setType(LineEndType type) {
props.setType(type.underlying);
}
public LineEndWidth getWidth() {
return LineEndWidth.valueOf(props.getW());
}
public void setWidth(LineEndWidth width) {
props.setW(width.underlying);
}
}

View File

@ -0,0 +1,39 @@
/* ====================================================================
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.CTLineJoinBevel;
@Beta
public class XDDFLineJoinBevelProperties implements XDDFLineJoinProperties {
private CTLineJoinBevel join;
public XDDFLineJoinBevelProperties() {
this(CTLineJoinBevel.Factory.newInstance());
}
protected XDDFLineJoinBevelProperties(CTLineJoinBevel join) {
this.join = join;
}
@Internal
protected CTLineJoinBevel getXmlObject() {
return join;
}
}

View File

@ -0,0 +1,58 @@
/* ====================================================================
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.CTLineJoinMiterProperties;
@Beta
public class XDDFLineJoinMiterProperties implements XDDFLineJoinProperties {
private CTLineJoinMiterProperties join;
public XDDFLineJoinMiterProperties() {
this(CTLineJoinMiterProperties.Factory.newInstance());
}
protected XDDFLineJoinMiterProperties(CTLineJoinMiterProperties join) {
this.join = join;
}
@Internal
protected CTLineJoinMiterProperties getXmlObject() {
return join;
}
public Integer getLimit() {
if (join.isSetLim()) {
return join.getLim();
} else {
return null;
}
}
public void setLimit(Integer limit) {
if (limit == null) {
if (join.isSetLim()) {
join.unsetLim();
}
} else {
join.setLim(limit);
}
}
}

View File

@ -0,0 +1,24 @@
/* ====================================================================
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;
@Beta
public interface XDDFLineJoinProperties {
}

View File

@ -0,0 +1,40 @@
/* ====================================================================
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.CTLineJoinRound;
@Beta
public class XDDFLineJoinRoundProperties implements XDDFLineJoinProperties {
private CTLineJoinRound join;
public XDDFLineJoinRoundProperties() {
this(CTLineJoinRound.Factory.newInstance());
}
protected XDDFLineJoinRoundProperties(CTLineJoinRound join) {
this.join = join;
}
@Internal
protected CTLineJoinRound getXmlObject() {
return join;
}
}

View File

@ -0,0 +1,313 @@
/* ====================================================================
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.CTLineProperties;
@Beta
public class XDDFLineProperties {
private CTLineProperties props;
public XDDFLineProperties() {
this(CTLineProperties.Factory.newInstance());
}
@Internal
protected XDDFLineProperties(CTLineProperties properties) {
this.props = properties;
}
@Internal
protected CTLineProperties getXmlObject() {
return props;
}
public PenAlignment getPenAlignment() {
if (props.isSetAlgn()) {
return PenAlignment.valueOf(props.getAlgn());
} else {
return null;
}
}
public void setPenAlignment(PenAlignment alignment) {
if (alignment == null) {
if (props.isSetAlgn()) {
props.unsetAlgn();
}
} else {
props.setAlgn(alignment.underlying);
}
}
public LineCap getLineCap() {
if (props.isSetCap()) {
return LineCap.valueOf(props.getCap());
} else {
return null;
}
}
public void setLineCap(LineCap cap) {
if (cap == null) {
if (props.isSetCap()) {
props.unsetCap();
}
} else {
props.setCap(cap.underlying);
}
}
public CompoundLine getCompoundLine() {
if (props.isSetCmpd()) {
return CompoundLine.valueOf(props.getCmpd());
} else {
return null;
}
}
public void setCompoundLine(CompoundLine compound) {
if (compound == null) {
if (props.isSetCmpd()) {
props.unsetCmpd();
}
} else {
props.setCmpd(compound.underlying);
}
}
public XDDFDashStop addDashStop() {
if (!props.isSetCustDash()) {
props.addNewCustDash();
}
return new XDDFDashStop(props.getCustDash().addNewDs());
}
public XDDFDashStop insertDashStop(int index) {
if (!props.isSetCustDash()) {
props.addNewCustDash();
}
return new XDDFDashStop(props.getCustDash().insertNewDs(index));
}
public void removeDashStop(int index) {
if (props.isSetCustDash()) {
props.getCustDash().removeDs(index);
}
}
public XDDFDashStop getDashStop(int index) {
if (props.isSetCustDash()) {
return new XDDFDashStop(props.getCustDash().getDsArray(index));
} else {
return null;
}
}
public List<XDDFDashStop> getDashStops() {
if (props.isSetCustDash()) {
return Collections.unmodifiableList(props
.getCustDash()
.getDsList()
.stream()
.map(ds -> new XDDFDashStop(ds))
.collect(Collectors.toList()));
} else {
return Collections.emptyList();
}
}
public int countDashStops() {
if (props.isSetCustDash()) {
return props.getCustDash().sizeOfDsArray();
} else {
return 0;
}
}
public XDDFPresetLineDash getPresetDash() {
if (props.isSetPrstDash()) {
return new XDDFPresetLineDash(props.getPrstDash());
} else {
return null;
}
}
public void setPresetDash(XDDFPresetLineDash properties) {
if (properties == null) {
if (props.isSetPrstDash()) {
props.unsetPrstDash();
}
} else {
props.setPrstDash(properties.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 XDDFFillProperties getFillProperties() {
if (props.isSetGradFill()) {
return new XDDFGradientFillProperties(props.getGradFill());
} else if (props.isSetNoFill()) {
return new XDDFNoFillProperties(props.getNoFill());
} else if (props.isSetPattFill()) {
return new XDDFPatternFillProperties(props.getPattFill());
} else if (props.isSetSolidFill()) {
return new XDDFSolidFillProperties(props.getSolidFill());
} else {
return null;
}
}
public void setFillProperties(XDDFFillProperties properties) {
if (props.isSetGradFill()) {
props.unsetGradFill();
}
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 XDDFNoFillProperties) {
props.setNoFill(((XDDFNoFillProperties) properties).getXmlObject());
} else if (properties instanceof XDDFPatternFillProperties) {
props.setPattFill(((XDDFPatternFillProperties) properties).getXmlObject());
} else if (properties instanceof XDDFSolidFillProperties) {
props.setSolidFill(((XDDFSolidFillProperties) properties).getXmlObject());
}
}
public XDDFLineJoinProperties getLineJoinProperties() {
if (props.isSetBevel()) {
return new XDDFLineJoinBevelProperties(props.getBevel());
} else if (props.isSetMiter()) {
return new XDDFLineJoinMiterProperties(props.getMiter());
} else if (props.isSetRound()) {
return new XDDFLineJoinRoundProperties(props.getRound());
} else {
return null;
}
}
public void setLineJoinProperties(XDDFLineJoinProperties properties) {
if (props.isSetBevel()) {
props.unsetBevel();
}
if (props.isSetMiter()) {
props.unsetMiter();
}
if (props.isSetRound()) {
props.unsetRound();
}
if (properties == null) {
return;
}
if (properties instanceof XDDFLineJoinBevelProperties) {
props.setBevel(((XDDFLineJoinBevelProperties) properties).getXmlObject());
} else if (properties instanceof XDDFLineJoinMiterProperties) {
props.setMiter(((XDDFLineJoinMiterProperties) properties).getXmlObject());
} else if (properties instanceof XDDFLineJoinRoundProperties) {
props.setRound(((XDDFLineJoinRoundProperties) properties).getXmlObject());
}
}
public XDDFLineEndProperties getHeadEnd() {
if (props.isSetHeadEnd()) {
return new XDDFLineEndProperties(props.getHeadEnd());
} else {
return null;
}
}
public void setHeadEnd(XDDFLineEndProperties properties) {
if (properties == null) {
if (props.isSetHeadEnd()) {
props.unsetHeadEnd();
}
} else {
props.setHeadEnd(properties.getXmlObject());
}
}
public XDDFLineEndProperties getTailEnd() {
if (props.isSetTailEnd()) {
return new XDDFLineEndProperties(props.getTailEnd());
} else {
return null;
}
}
public void setTailEnd(XDDFLineEndProperties properties) {
if (properties == null) {
if (props.isSetTailEnd()) {
props.unsetTailEnd();
}
} else {
props.setTailEnd(properties.getXmlObject());
}
}
public Integer getWidth() {
if (props.isSetW()) {
return props.getW();
} else {
return null;
}
}
public void setWidth(Integer width) {
if (width == null) {
if (props.isSetW()) {
props.unsetW();
}
} else {
props.setW(width);
}
}
}

View File

@ -0,0 +1,72 @@
/* ====================================================================
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.CTLinearShadeProperties;
@Beta
public class XDDFLinearShadeProperties {
private CTLinearShadeProperties props;
protected XDDFLinearShadeProperties(CTLinearShadeProperties properties) {
this.props = properties;
}
@Internal
protected CTLinearShadeProperties getXmlObject() {
return props;
}
public Integer getAngle() {
if (props.isSetAng()) {
return props.getAng();
} else {
return null;
}
}
public void setAngle(Integer angle) {
if (angle == null) {
if (props.isSetAng()) {
props.unsetAng();
}
} else {
props.setAng(angle);
}
}
public Boolean getScaled() {
if (props.isSetScaled()) {
return props.getScaled();
} else {
return null;
}
}
public void setScaled(Boolean scaled) {
if (scaled == null) {
if (props.isSetScaled()) {
props.unsetScaled();
}
} else {
props.setScaled(scaled);
}
}
}

View File

@ -0,0 +1,40 @@
/* ====================================================================
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.CTNoFillProperties;
@Beta
public class XDDFNoFillProperties implements XDDFFillProperties {
private CTNoFillProperties props;
public XDDFNoFillProperties() {
this(CTNoFillProperties.Factory.newInstance());
}
protected XDDFNoFillProperties(CTNoFillProperties properties) {
this.props = properties;
}
@Internal
protected CTNoFillProperties getXmlObject() {
return props;
}
}

View File

@ -0,0 +1,39 @@
/*
* ====================================================================
* 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.CTPath2D;
@Beta
public class XDDFPath {
private CTPath2D path;
@Internal
protected XDDFPath(CTPath2D path) {
this.path = path;
}
@Internal
public CTPath2D getXmlObject() {
return path;
}
}

View File

@ -0,0 +1,76 @@
/* ====================================================================
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.CTPathShadeProperties;
@Beta
public class XDDFPathShadeProperties {
private CTPathShadeProperties props;
public XDDFPathShadeProperties() {
this(CTPathShadeProperties.Factory.newInstance());
}
protected XDDFPathShadeProperties(CTPathShadeProperties properties) {
this.props = properties;
}
@Internal
protected CTPathShadeProperties getXmlObject() {
return props;
}
public XDDFRelativeRectangle getFillToRectangle() {
if (props.isSetFillToRect()) {
return new XDDFRelativeRectangle(props.getFillToRect());
} else {
return null;
}
}
public void setFillToRectangle(XDDFRelativeRectangle rectangle) {
if (rectangle == null) {
if (props.isSetFillToRect()) {
props.unsetFillToRect();
}
} else {
props.setFillToRect(rectangle.getXmlObject());
}
}
public PathShadeType getPathShadeType() {
if (props.isSetPath()) {
return PathShadeType.valueOf(props.getPath());
} else {
return null;
}
}
public void setPathShadeType(PathShadeType path) {
if (path == null) {
if (props.isSetPath()) {
props.unsetPath();
}
} else {
props.setPath(path.underlying);
}
}
}

View File

@ -0,0 +1,94 @@
/* ====================================================================
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.CTPatternFillProperties;
@Beta
public class XDDFPatternFillProperties implements XDDFFillProperties {
private CTPatternFillProperties props;
public XDDFPatternFillProperties() {
this(CTPatternFillProperties.Factory.newInstance());
}
protected XDDFPatternFillProperties(CTPatternFillProperties properties) {
this.props = properties;
}
@Internal
protected CTPatternFillProperties getXmlObject() {
return props;
}
public PresetPattern getPresetPattern() {
if (props.isSetPrst()) {
return PresetPattern.valueOf(props.getPrst());
} else {
return null;
}
}
public void setPresetPattern(PresetPattern pattern) {
if (pattern == null) {
if (props.isSetPrst()) {
props.unsetPrst();
}
} else {
props.setPrst(pattern.underlying);
}
}
public XDDFColor getBackgroundColor() {
if (props.isSetBgClr()) {
return XDDFColor.forColorContainer(props.getBgClr());
} else {
return null;
}
}
public void setBackgroundColor(XDDFColor color) {
if (color == null) {
if (props.isSetBgClr()) {
props.unsetBgClr();
}
} else {
props.setBgClr(color.getColorContainer());
}
}
public XDDFColor getForegroundColor() {
if (props.isSetFgClr()) {
return XDDFColor.forColorContainer(props.getFgClr());
} else {
return null;
}
}
public void setForegroundColor(XDDFColor color) {
if (color == null) {
if (props.isSetFgClr()) {
props.unsetFgClr();
}
} else {
props.setFgClr(color.getColorContainer());
}
}
}

View File

@ -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());
}
}
}

View File

@ -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();
}
}
}

View File

@ -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();
}
}
}

View File

@ -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();
}
}
}

View File

@ -0,0 +1,59 @@
/* ====================================================================
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.CTPresetLineDashProperties;
@Beta
public class XDDFPresetLineDash {
private CTPresetLineDashProperties props;
public XDDFPresetLineDash(PresetLineDash dash) {
this(CTPresetLineDashProperties.Factory.newInstance());
setValue(dash);
}
protected XDDFPresetLineDash(CTPresetLineDashProperties properties) {
this.props = properties;
}
@Internal
protected CTPresetLineDashProperties getXmlObject() {
return props;
}
public PresetLineDash getValue() {
if (props.isSetVal()) {
return PresetLineDash.valueOf(props.getVal());
} else {
return null;
}
}
public void setValue(PresetLineDash dash) {
if (dash == null) {
if (props.isSetVal()) {
props.unsetVal();
}
} else {
props.setVal(dash.underlying);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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());
}
}
}

View File

@ -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());
}
}
}

View File

@ -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());
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -20,6 +20,7 @@ package org.apache.poi.xddf.usermodel.chart;
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 XDDFChartData {
}
}
@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();

View File

@ -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 XDDFChartAxis {
}
@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 ctCatAx.getMajorGridlines().getSpPr();
return new XDDFShapeProperties(getOrAddLinesProperties(majorGridlines));
}
@Override
@Internal
public CTShapeProperties getLine() {
return ctCatAx.getSpPr();
public XDDFShapeProperties getOrAddMinorGridProperties() {
CTChartLines minorGridlines;
if (ctCatAx.isSetMinorGridlines()) {
minorGridlines = ctCatAx.getMinorGridlines();
} else {
minorGridlines = ctCatAx.addNewMinorGridlines();
}
return new XDDFShapeProperties(getOrAddLinesProperties(minorGridlines));
}
@Override
public XDDFShapeProperties getOrAddShapeProperties() {
CTShapeProperties properties;
if (ctCatAx.isSetSpPr()) {
properties = ctCatAx.getSpPr();
} else {
properties = ctCatAx.addNewSpPr();
}
return new XDDFShapeProperties(properties);
}
@Override

View File

@ -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.drawingml.x2006.chart.CTScatterChart;
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 POIXMLDocumentPart {
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);
}

View File

@ -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.drawingml.x2006.main.CTShapeProperties;
* 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();

View File

@ -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;

View File

@ -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());
}

View File

@ -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.drawingml.x2006.chart.STTickLblPos;
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 XDDFChartAxis {
}
@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 ctDateAx.getMajorGridlines().getSpPr();
return new XDDFShapeProperties(getOrAddLinesProperties(majorGridlines));
}
@Override
@Internal
public CTShapeProperties getLine() {
return ctDateAx.getSpPr();
public XDDFShapeProperties getOrAddMinorGridProperties() {
CTChartLines minorGridlines;
if (ctDateAx.isSetMinorGridlines()) {
minorGridlines = ctDateAx.getMinorGridlines();
} else {
minorGridlines = ctDateAx.addNewMinorGridlines();
}
return new XDDFShapeProperties(getOrAddLinesProperties(minorGridlines));
}
@Override
public XDDFShapeProperties getOrAddShapeProperties() {
CTShapeProperties properties;
if (ctDateAx.isSetSpPr()) {
properties = ctDateAx.getSpPr();
} else {
properties = ctDateAx.addNewSpPr();
}
return new XDDFShapeProperties(properties);
}
@Override

View File

@ -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());
}

View File

@ -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());
}

View File

@ -20,6 +20,7 @@ package org.apache.poi.xddf.usermodel.chart;
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 XDDFChartData {
}
}
@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()) {

View File

@ -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());
}

View File

@ -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 XDDFChartData {
}
}
@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();

View File

@ -20,6 +20,7 @@ package org.apache.poi.xddf.usermodel.chart;
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 XDDFChartData {
}
}
@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();

View File

@ -20,6 +20,7 @@ package org.apache.poi.xddf.usermodel.chart;
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 extends XDDFChartData {
}
}
@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();

View File

@ -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 XDDFChartAxis {
}
@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 ctValAx.getMajorGridlines().getSpPr();
return new XDDFShapeProperties(getOrAddLinesProperties(majorGridlines));
}
@Override
@Internal
public CTShapeProperties getLine() {
return ctValAx.getSpPr();
public XDDFShapeProperties getOrAddMinorGridProperties() {
CTChartLines minorGridlines;
if (ctValAx.isSetMinorGridlines()) {
minorGridlines = ctValAx.getMinorGridlines();
} else {
minorGridlines = ctValAx.addNewMinorGridlines();
}
return new XDDFShapeProperties(getOrAddLinesProperties(minorGridlines));
}
@Override
public XDDFShapeProperties getOrAddShapeProperties() {
CTShapeProperties properties;
if (ctValAx.isSetSpPr()) {
properties = ctValAx.getSpPr();
} else {
properties = ctValAx.addNewSpPr();
}
return new XDDFShapeProperties(properties);
}
@Override

View File

@ -49,12 +49,12 @@ import org.openxmlformats.schemas.drawingml.x2006.main.ThemeDocument;
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 POIXMLDocumentPart {
_theme = doc.getTheme();
initialize();
}
public void importTheme(XSLFTheme theme) {
_theme = theme.getXmlObject();
_schemeColors = theme._schemeColors;
@ -74,7 +74,7 @@ public class XSLFTheme extends POIXMLDocumentPart {
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 POIXMLDocumentPart {
/**
* 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 POIXMLDocumentPart {
return _theme;
}
@Override
protected final void commit() throws IOException {
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
xmlOptions.setSaveSyntheticDocumentElement(

View File

@ -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());
}
}