merged common_sl branch to trunk

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1692593 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2015-07-24 21:47:55 +00:00
commit f5e9adea84
414 changed files with 29920 additions and 13985 deletions

View File

@ -107,6 +107,11 @@ under the License.
<property name="scratchpad.output.test.dir" location="build/scratchpad-test-classes"/>
<property name="scratchpad.testokfile" location="build/scratchpad-testokfile.txt"/>
<!-- Scratchpad/Geometry -->
<property name="geometry.pkg" value="org.apache.poi.sl.draw.binding"/>
<property name="geometry.output.tmpdir" value="build/geometry-java"/>
<!-- Examples: -->
<property name="examples.src" location="src/examples/src"/>
<property name="examples.output.dir" location="build/examples-classes"/>
@ -378,6 +383,7 @@ under the License.
<mkdir dir="${scratchpad.output.dir}"/>
<mkdir dir="${scratchpad.output.test.dir}"/>
<mkdir dir="${scratchpad.reports.test}"/>
<mkdir dir="${geometry.output.tmpdir}"/>
<mkdir dir="${ooxml.output.dir}"/>
<mkdir dir="${ooxml.output.test.dir}"/>
<mkdir dir="${ooxml.reports.test}"/>
@ -702,7 +708,39 @@ under the License.
</copy>
</target>
<target name="compile-scratchpad" depends="compile-main">
<target name="generate-geometry" depends="fetch-ooxml-xsds" if="ignoreme">
<delete dir="${geometry.output.tmpdir}"/>
<!-- taskdef xjc -->
<!-- "D:\Program Files\Java\jdk1.6.0_45\bin\xjc" -p org.apache.poi.sl.model.geom.binding -readOnly -Xlocator -mark-generated ooxml-schemas\dml-shapeGeometry.xsd -->
<unzip src="${ooxml.lib}/${ooxml.xsds.izip.1}" dest="${geometry.output.tmpdir}"/>
<exec executable="${env.JAVA_HOME}/bin/xjc">
<arg value="-p"/>
<arg value="${geometry.pkg}"/>
<arg value="-b"/>
<arg file="src/types/definitions/dml-shapeGeometry.xjb"/>
<arg value="-readOnly"/>
<arg value="-npa"/>
<arg value="-no-header"/>
<!--arg value="-mark-generated"/ -->
<!--arg value="-Xlocator"/ -->
<arg file="${geometry.output.tmpdir}/dml-shapeGeometry.xsd"/>
<arg value="-d"/>
<arg file="${geometry.output.tmpdir}"/>
</exec>
<copy file="src/java/org/apache/poi/POIDocument.java" tofile="${geometry.output.tmpdir}/apache-license.txt">
<filterchain>
<headfilter lines="16"/>
</filterchain>
</copy>
<copy todir="${main.src}">
<fileset dir="${geometry.output.tmpdir}" includes="**/*.java"/>
<filterchain>
<concatfilter prepend="${geometry.output.tmpdir}/apache-license.txt"/>
</filterchain>
</copy>
</target>
<target name="compile-scratchpad" depends="compile-main,generate-geometry">
<javac target="${jdk.version.class}"
source="${jdk.version.source}"
destdir="${scratchpad.output.dir}"
@ -1669,7 +1707,7 @@ under the License.
<exclude name="contrib/testcases/dummy.txt" />
<exclude name="examples/lib/dummy.txt" />
<exclude name="resources/ooxml/org/apache/poi/xslf/usermodel/notesMaster.xml" />
<exclude name="resources/ooxml/org/apache/poi/xslf/usermodel/presetShapeDefinitions.xml" />
<exclude name="resources/main/org/apache/poi/sl/draw/geom/presetShapeDefinitions.xml" />
<exclude name="examples/src/org/apache/poi/xslf/usermodel/pie-chart-data.txt" />
</fileset>
</rat:report>

View File

@ -17,13 +17,29 @@
package org.apache.poi.hslf.examples;
import org.apache.poi.hslf.usermodel.*;
import org.apache.poi.hslf.model.*;
import org.apache.poi.hslf.record.TextHeaderAtom;
import java.io.IOException;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.io.FileOutputStream;
import java.awt.*;
import java.io.IOException;
import java.util.List;
import org.apache.poi.hslf.model.Line;
import org.apache.poi.hslf.model.PPGraphics2D;
import org.apache.poi.hslf.record.TextHeaderAtom;
import org.apache.poi.hslf.usermodel.HSLFAutoShape;
import org.apache.poi.hslf.usermodel.HSLFGroupShape;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.HSLFTable;
import org.apache.poi.hslf.usermodel.HSLFTableCell;
import org.apache.poi.hslf.usermodel.HSLFTextBox;
import org.apache.poi.hslf.usermodel.HSLFTextParagraph;
import org.apache.poi.hslf.usermodel.HSLFTextRun;
import org.apache.poi.sl.usermodel.ShapeType;
import org.apache.poi.sl.usermodel.VerticalAlignment;
/**
* Presentation for Fast Feather Track on ApacheconEU 2008
@ -33,7 +49,7 @@ import java.awt.*;
public final class ApacheconEU08 {
public static void main(String[] args) throws IOException {
SlideShow ppt = new SlideShow();
HSLFSlideShow ppt = new HSLFSlideShow();
ppt.setPageSize(new Dimension(720, 540));
slide1(ppt);
@ -55,48 +71,43 @@ public final class ApacheconEU08 {
}
public static void slide1(SlideShow ppt) throws IOException {
Slide slide = ppt.createSlide();
public static void slide1(HSLFSlideShow ppt) throws IOException {
HSLFSlide slide = ppt.createSlide();
TextBox box1 = new TextBox();
TextRun tr1 = box1.getTextRun();
tr1.setRunType(TextHeaderAtom.CENTER_TITLE_TYPE);
tr1.setText("POI-HSLF");
HSLFTextBox box1 = new HSLFTextBox();
box1.setRunType(TextHeaderAtom.CENTER_TITLE_TYPE);
box1.setText("POI-HSLF");
box1.setAnchor(new Rectangle(54, 78, 612, 115));
slide.addShape(box1);
TextBox box2 = new TextBox();
TextRun tr2 = box2.getTextRun();
tr2.setRunType(TextHeaderAtom.CENTRE_BODY_TYPE);
tr2.setText("Java API To Access Microsoft PowerPoint Format Files");
HSLFTextBox box2 = new HSLFTextBox();
box2.setRunType(TextHeaderAtom.CENTRE_BODY_TYPE);
box2.setText("Java API To Access Microsoft PowerPoint Format Files");
box2.setAnchor(new Rectangle(108, 204, 504, 138));
slide.addShape(box2);
TextBox box3 = new TextBox();
TextRun tr3 = box3.getTextRun();
tr3.getRichTextRuns()[0].setFontSize(32);
box3.setHorizontalAlignment(TextBox.AlignCenter);
tr3.setText(
HSLFTextBox box3 = new HSLFTextBox();
box3.getTextParagraphs().get(0).getTextRuns().get(0).setFontSize(32d);
box3.setText(
"Yegor Kozlov\r" +
"yegor - apache - org");
box3.setHorizontalCentered(true);
box3.setAnchor(new Rectangle(206, 348, 310, 84));
slide.addShape(box3);
}
public static void slide2(SlideShow ppt) throws IOException {
Slide slide = ppt.createSlide();
public static void slide2(HSLFSlideShow ppt) throws IOException {
HSLFSlide slide = ppt.createSlide();
TextBox box1 = new TextBox();
TextRun tr1 = box1.getTextRun();
tr1.setRunType(TextHeaderAtom.TITLE_TYPE);
tr1.setText("What is HSLF?");
HSLFTextBox box1 = new HSLFTextBox();
box1.setRunType(TextHeaderAtom.TITLE_TYPE);
box1.setText("What is HSLF?");
box1.setAnchor(new Rectangle(36, 21, 648, 90));
slide.addShape(box1);
TextBox box2 = new TextBox();
TextRun tr2 = box2.getTextRun();
tr2.setRunType(TextHeaderAtom.BODY_TYPE);
tr2.setText("HorribleSLideshowFormat is the POI Project's pure Java implementation " +
HSLFTextBox box2 = new HSLFTextBox();
box2.setRunType(TextHeaderAtom.BODY_TYPE);
box2.setText("HorribleSLideshowFormat is the POI Project's pure Java implementation " +
"of the Powerpoint binary file format. \r" +
"POI sub-project since 2005\r" +
"Started by Nick Birch, Yegor Kozlov joined soon after");
@ -106,74 +117,66 @@ public final class ApacheconEU08 {
}
public static void slide3(SlideShow ppt) throws IOException {
Slide slide = ppt.createSlide();
public static void slide3(HSLFSlideShow ppt) throws IOException {
HSLFSlide slide = ppt.createSlide();
TextBox box1 = new TextBox();
TextRun tr1 = box1.getTextRun();
tr1.setRunType(TextHeaderAtom.TITLE_TYPE);
tr1.setText("HSLF in a Nutshell");
HSLFTextBox box1 = new HSLFTextBox();
box1.setRunType(TextHeaderAtom.TITLE_TYPE);
box1.setText("HSLF in a Nutshell");
box1.setAnchor(new Rectangle(36, 15, 648, 65));
slide.addShape(box1);
TextBox box2 = new TextBox();
TextRun tr2 = box2.getTextRun();
tr2.setRunType(TextHeaderAtom.BODY_TYPE);
tr2.setText(
"HSLF provides a way to read, create and modify MS PowerPoint presentations\r" +
"Pure Java API - you don't need PowerPoint to read and write *.ppt files\r" +
"Comprehensive support of PowerPoint objects");
tr2.getRichTextRuns()[0].setFontSize(28);
box2.setAnchor(new Rectangle(36, 80, 648, 200));
slide.addShape(box2);
TextBox box3 = new TextBox();
TextRun tr3 = box3.getTextRun();
tr3.setRunType(TextHeaderAtom.BODY_TYPE);
tr3.setText(
HSLFTextBox box2 = new HSLFTextBox();
box2.setRunType(TextHeaderAtom.BODY_TYPE);
box2.setText(
"HSLF provides a way to read, create and modify MS PowerPoint presentations\r" +
"Pure Java API - you don't need PowerPoint to read and write *.ppt files\r" +
"Comprehensive support of PowerPoint objects\r" +
"Rich text\r" +
"Tables\r" +
"Shapes\r" +
"Pictures\r" +
"Master slides");
tr3.getRichTextRuns()[0].setFontSize(24);
tr3.getRichTextRuns()[0].setIndentLevel(1);
box3.setAnchor(new Rectangle(36, 265, 648, 150));
slide.addShape(box3);
"Master slides\r" +
"Access to low level data structures"
);
TextBox box4 = new TextBox();
TextRun tr4 = box4.getTextRun();
tr4.setRunType(TextHeaderAtom.BODY_TYPE);
tr4.setText("Access to low level data structures");
box4.setAnchor(new Rectangle(36, 430, 648, 50));
slide.addShape(box4);
List<HSLFTextParagraph> tp = box2.getTextParagraphs();
for (int i : new byte[]{0,1,2,8}) {
tp.get(i).getTextRuns().get(0).setFontSize(28d);
}
for (int i : new byte[]{3,4,5,6,7}) {
tp.get(i).getTextRuns().get(0).setFontSize(24d);
tp.get(i).setIndentLevel(1);
}
box2.setAnchor(new Rectangle(36, 80, 648, 400));
slide.addShape(box2);
}
public static void slide4(SlideShow ppt) throws IOException {
Slide slide = ppt.createSlide();
public static void slide4(HSLFSlideShow ppt) throws IOException {
HSLFSlide slide = ppt.createSlide();
String[][] txt1 = {
{"Note"},
{"This presentation was created programmatically using POI HSLF"}
};
Table table1 = new Table(2, 1);
HSLFTable table1 = new HSLFTable(2, 1);
for (int i = 0; i < txt1.length; i++) {
for (int j = 0; j < txt1[i].length; j++) {
TableCell cell = table1.getCell(i, j);
HSLFTableCell cell = table1.getCell(i, j);
cell.setText(txt1[i][j]);
cell.getTextRun().getRichTextRuns()[0].setFontSize(10);
RichTextRun rt = cell.getTextRun().getRichTextRuns()[0];
rt.setFontName("Arial");
HSLFTextRun rt = cell.getTextParagraphs().get(0).getTextRuns().get(0);
rt.setFontSize(10d);
rt.setFontFamily("Arial");
rt.setBold(true);
if(i == 0){
rt.setFontSize(32);
rt.setFontSize(32d);
rt.setFontColor(Color.white);
cell.getFill().setForegroundColor(new Color(0, 153, 204));
} else {
rt.setFontSize(28);
rt.setFontSize(28d);
cell.getFill().setForegroundColor(new Color(235, 239, 241));
}
cell.setVerticalAlignment(TextBox.AnchorMiddle);
cell.setVerticalAlignment(VerticalAlignment.MIDDLE);
}
}
@ -194,32 +197,28 @@ public final class ApacheconEU08 {
table1.moveTo(100, 100);
TextBox box1 = new TextBox();
box1.setHorizontalAlignment(TextBox.AlignCenter);
TextRun tr1 = box1.getTextRun();
tr1.setText("The source code is available at\r" +
HSLFTextBox box1 = new HSLFTextBox();
box1.setHorizontalCentered(true);
box1.getTextParagraphs().get(0).getTextRuns().get(0).setFontSize(24d);
box1.setText("The source code is available at\r" +
"http://people.apache.org/~yegor/apachecon_eu08/");
RichTextRun rt = tr1.getRichTextRuns()[0];
rt.setFontSize(24);
box1.setAnchor(new Rectangle(80, 356, 553, 65));
slide.addShape(box1);
}
public static void slide5(SlideShow ppt) throws IOException {
Slide slide = ppt.createSlide();
public static void slide5(HSLFSlideShow ppt) throws IOException {
HSLFSlide slide = ppt.createSlide();
TextBox box1 = new TextBox();
TextRun tr1 = box1.getTextRun();
tr1.setRunType(TextHeaderAtom.TITLE_TYPE);
tr1.setText("HSLF in Action - 1\rData Extraction");
HSLFTextBox box1 = new HSLFTextBox();
box1.setRunType(TextHeaderAtom.TITLE_TYPE);
box1.setText("HSLF in Action - 1\rData Extraction");
box1.setAnchor(new Rectangle(36, 21, 648, 100));
slide.addShape(box1);
TextBox box2 = new TextBox();
TextRun tr2 = box2.getTextRun();
tr2.setRunType(TextHeaderAtom.BODY_TYPE);
tr2.setText(
HSLFTextBox box2 = new HSLFTextBox();
box2.setRunType(TextHeaderAtom.BODY_TYPE);
box2.setText(
"Text from slides and notes\r" +
"Images\r" +
"Shapes and their properties (type, position in the slide, color, font, etc.)");
@ -229,90 +228,88 @@ public final class ApacheconEU08 {
}
public static void slide6(SlideShow ppt) throws IOException {
Slide slide = ppt.createSlide();
public static void slide6(HSLFSlideShow ppt) throws IOException {
HSLFSlide slide = ppt.createSlide();
TextBox box1 = new TextBox();
TextRun tr1 = box1.getTextRun();
tr1.setRunType(TextHeaderAtom.TITLE_TYPE);
tr1.setText("HSLF in Action - 2");
HSLFTextBox box1 = new HSLFTextBox();
box1.setRunType(TextHeaderAtom.TITLE_TYPE);
box1.setText("HSLF in Action - 2");
box1.setAnchor(new Rectangle(36, 20, 648, 90));
slide.addShape(box1);
TextBox box2 = new TextBox();
TextRun tr2 = box2.getTextRun();
tr2.getRichTextRuns()[0].setFontSize(18);
tr2.setText("Creating a simple presentation from scratch");
HSLFTextBox box2 = new HSLFTextBox();
box2.getTextParagraphs().get(0).getTextRuns().get(0).setFontSize(18d);
box2.setText("Creating a simple presentation from scratch");
box2.setAnchor(new Rectangle(170, 100, 364, 30));
slide.addShape(box2);
TextBox box3 = new TextBox();
TextRun tr3 = box3.getTextRun();
RichTextRun rt3 = tr3.getRichTextRuns()[0];
rt3.setFontName("Courier New");
rt3.setFontSize(8);
tr3.setText(
" SlideShow ppt = new SlideShow();\r" +
" Slide slide = ppt.createSlide();\r" +
"\r" +
" TextBox box2 = new TextBox();\r" +
" box2.setHorizontalAlignment(TextBox.AlignCenter);\r" +
" box2.setVerticalAlignment(TextBox.AnchorMiddle);\r" +
" box2.getTextRun().setText(\"Java Code\");\r" +
" box2.getFill().setForegroundColor(new Color(187, 224, 227));\r" +
" box2.setLineColor(Color.black);\r" +
" box2.setLineWidth(0.75);\r" +
" box2.setAnchor(new Rectangle(66, 243, 170, 170));\r" +
" slide.addShape(box2);\r" +
"\r" +
" TextBox box3 = new TextBox();\r" +
" box3.setHorizontalAlignment(TextBox.AlignCenter);\r" +
" box3.setVerticalAlignment(TextBox.AnchorMiddle);\r" +
" box3.getTextRun().setText(\"*.ppt file\");\r" +
" box3.setLineWidth(0.75);\r" +
" box3.setLineColor(Color.black);\r" +
" box3.getFill().setForegroundColor(new Color(187, 224, 227));\r" +
" box3.setAnchor(new Rectangle(473, 243, 170, 170));\r" +
" slide.addShape(box3);\r" +
"\r" +
" AutoShape box4 = new AutoShape(ShapeTypes.Arrow);\r" +
" box4.getFill().setForegroundColor(new Color(187, 224, 227));\r" +
" box4.setLineWidth(0.75);\r" +
" box4.setLineColor(Color.black);\r" +
" box4.setAnchor(new Rectangle(253, 288, 198, 85));\r" +
" slide.addShape(box4);\r" +
"\r" +
" FileOutputStream out = new FileOutputStream(\"hslf-demo.ppt\");\r" +
" ppt.write(out);\r" +
" out.close();");
HSLFTextBox box3 = new HSLFTextBox();
HSLFTextRun rt3 = box3.getTextParagraphs().get(0).getTextRuns().get(0);
rt3.setFontFamily("Courier New");
rt3.setFontSize(8d);
box3.setText(
"SlideShow ppt = new SlideShow();\u000b" +
"Slide slide = ppt.createSlide();\u000b" +
"\u000b" +
"TextBox box2 = new TextBox();\u000b" +
"box2.setHorizontalAlignment(TextBox.AlignCenter);\u000b" +
"box2.setVerticalAlignment(TextBox.AnchorMiddle);\u000b" +
"box2.getTextRun().setText(\"Java Code\");\u000b" +
"box2.getFill().setForegroundColor(new Color(187, 224, 227));\u000b" +
"box2.setLineColor(Color.black);\u000b" +
"box2.setLineWidth(0.75);\u000b" +
"box2.setAnchor(new Rectangle(66, 243, 170, 170));\u000b" +
"slide.addShape(box2);\u000b" +
"\u000b" +
"TextBox box3 = new TextBox();\u000b" +
"box3.setHorizontalAlignment(TextBox.AlignCenter);\u000b" +
"box3.setVerticalAlignment(TextBox.AnchorMiddle);\u000b" +
"box3.getTextRun().setText(\"*.ppt file\");\u000b" +
"box3.setLineWidth(0.75);\u000b" +
"box3.setLineColor(Color.black);\u000b" +
"box3.getFill().setForegroundColor(new Color(187, 224, 227));\u000b" +
"box3.setAnchor(new Rectangle(473, 243, 170, 170));\u000b" +
"slide.addShape(box3);\u000b" +
"\u000b" +
"AutoShape box4 = new AutoShape(ShapeTypes.Arrow);\u000b" +
"box4.getFill().setForegroundColor(new Color(187, 224, 227));\u000b" +
"box4.setLineWidth(0.75);\u000b" +
"box4.setLineColor(Color.black);\u000b" +
"box4.setAnchor(new Rectangle(253, 288, 198, 85));\u000b" +
"slide.addShape(box4);\u000b" +
"\u000b" +
"FileOutputStream out = new FileOutputStream(\"hslf-demo.ppt\");\u000b" +
"ppt.write(out);\u000b" +
"out.close();");
box3.setAnchor(new Rectangle(30, 150, 618, 411));
box3.setHorizontalCentered(true);
slide.addShape(box3);
}
public static void slide7(SlideShow ppt) throws IOException {
Slide slide = ppt.createSlide();
public static void slide7(HSLFSlideShow ppt) throws IOException {
HSLFSlide slide = ppt.createSlide();
TextBox box2 = new TextBox();
box2.setHorizontalAlignment(TextBox.AlignCenter);
box2.setVerticalAlignment(TextBox.AnchorMiddle);
box2.getTextRun().setText("Java Code");
HSLFTextBox box2 = new HSLFTextBox();
box2.setHorizontalCentered(true);
box2.setVerticalAlignment(VerticalAlignment.MIDDLE);
box2.setText("Java Code");
box2.getFill().setForegroundColor(new Color(187, 224, 227));
box2.setLineColor(Color.black);
box2.setLineWidth(0.75);
box2.setAnchor(new Rectangle(66, 243, 170, 170));
slide.addShape(box2);
TextBox box3 = new TextBox();
box3.setHorizontalAlignment(TextBox.AlignCenter);
box3.setVerticalAlignment(TextBox.AnchorMiddle);
box3.getTextRun().setText("*.ppt file");
HSLFTextBox box3 = new HSLFTextBox();
box3.setHorizontalCentered(true);
box3.setVerticalAlignment(VerticalAlignment.MIDDLE);
box3.setText("*.ppt file");
box3.setLineWidth(0.75);
box3.setLineColor(Color.black);
box3.getFill().setForegroundColor(new Color(187, 224, 227));
box3.setAnchor(new Rectangle(473, 243, 170, 170));
slide.addShape(box3);
AutoShape box4 = new AutoShape(ShapeTypes.Arrow);
HSLFAutoShape box4 = new HSLFAutoShape(ShapeType.RIGHT_ARROW);
box4.getFill().setForegroundColor(new Color(187, 224, 227));
box4.setLineWidth(0.75);
box4.setLineColor(Color.black);
@ -320,20 +317,18 @@ public final class ApacheconEU08 {
slide.addShape(box4);
}
public static void slide8(SlideShow ppt) throws IOException {
Slide slide = ppt.createSlide();
public static void slide8(HSLFSlideShow ppt) throws IOException {
HSLFSlide slide = ppt.createSlide();
TextBox box1 = new TextBox();
TextRun tr1 = box1.getTextRun();
tr1.setRunType(TextHeaderAtom.TITLE_TYPE);
tr1.setText("Wait, there is more!");
HSLFTextBox box1 = new HSLFTextBox();
box1.setRunType(TextHeaderAtom.TITLE_TYPE);
box1.setText("Wait, there is more!");
box1.setAnchor(new Rectangle(36, 21, 648, 90));
slide.addShape(box1);
TextBox box2 = new TextBox();
TextRun tr2 = box2.getTextRun();
tr2.setRunType(TextHeaderAtom.BODY_TYPE);
tr2.setText(
HSLFTextBox box2 = new HSLFTextBox();
box2.setRunType(TextHeaderAtom.BODY_TYPE);
box2.setText(
"Rich text\r" +
"Tables\r" +
"Pictures (JPEG, PNG, BMP, WMF, PICT)\r" +
@ -342,72 +337,70 @@ public final class ApacheconEU08 {
slide.addShape(box2);
}
public static void slide9(SlideShow ppt) throws IOException {
Slide slide = ppt.createSlide();
public static void slide9(HSLFSlideShow ppt) throws IOException {
HSLFSlide slide = ppt.createSlide();
TextBox box1 = new TextBox();
TextRun tr1 = box1.getTextRun();
tr1.setRunType(TextHeaderAtom.TITLE_TYPE);
tr1.setText("HSLF in Action - 3");
HSLFTextBox box1 = new HSLFTextBox();
box1.setRunType(TextHeaderAtom.TITLE_TYPE);
box1.setText("HSLF in Action - 3");
box1.setAnchor(new Rectangle(36, 20, 648, 50));
slide.addShape(box1);
TextBox box2 = new TextBox();
TextRun tr2 = box2.getTextRun();
tr2.getRichTextRuns()[0].setFontSize(18);
tr2.setText("PPGraphics2D: PowerPoint Graphics2D driver");
HSLFTextBox box2 = new HSLFTextBox();
box2.getTextParagraphs().get(0).getTextRuns().get(0).setFontSize(18d);
box2.setText("PPGraphics2D: PowerPoint Graphics2D driver");
box2.setAnchor(new Rectangle(178, 70, 387, 30));
slide.addShape(box2);
TextBox box3 = new TextBox();
TextRun tr3 = box3.getTextRun();
RichTextRun rt3 = tr3.getRichTextRuns()[0];
rt3.setFontName("Courier New");
rt3.setFontSize(8);
tr3.setText(
" //bar chart data. The first value is the bar color, the second is the width\r" +
" Object[] def = new Object[]{\r" +
" Color.yellow, new Integer(100),\r" +
" Color.green, new Integer(150),\r" +
" Color.gray, new Integer(75),\r" +
" Color.red, new Integer(200),\r" +
" };\r" +
"\r" +
" SlideShow ppt = new SlideShow();\r" +
" Slide slide = ppt.createSlide();\r" +
"\r" +
" ShapeGroup group = new ShapeGroup();\r" +
" //define position of the drawing in the slide\r" +
" Rectangle bounds = new java.awt.Rectangle(200, 100, 350, 300);\r" +
" group.setAnchor(bounds);\r" +
" slide.addShape(group);\r" +
" Graphics2D graphics = new PPGraphics2D(group);\r" +
"\r" +
" //draw a simple bar graph\r" +
" int x = bounds.x + 50, y = bounds.y + 50;\r" +
" graphics.setFont(new Font(\"Arial\", Font.BOLD, 10));\r" +
" for (int i = 0, idx = 1; i < def.length; i+=2, idx++) {\r" +
" graphics.setColor(Color.black);\r" +
" int width = ((Integer)def[i+1]).intValue();\r" +
" graphics.drawString(\"Q\" + idx, x-20, y+20);\r" +
" graphics.drawString(width + \"%\", x + width + 10, y + 20);\r" +
" graphics.setColor((Color)def[i]);\r" +
" graphics.fill(new Rectangle(x, y, width, 30));\r" +
" y += 40;\r" +
" }\r" +
" graphics.setColor(Color.black);\r" +
" graphics.setFont(new Font(\"Arial\", Font.BOLD, 14));\r" +
" graphics.draw(bounds);\r" +
" graphics.drawString(\"Performance\", x + 70, y + 40);\r" +
"\r" +
" FileOutputStream out = new FileOutputStream(\"hslf-demo.ppt\");\r" +
" ppt.write(out);\r" +
" out.close();");
HSLFTextBox box3 = new HSLFTextBox();
HSLFTextRun rt3 = box3.getTextParagraphs().get(0).getTextRuns().get(0);
rt3.setFontFamily("Courier New");
rt3.setFontSize(8d);
box3.setText(
"//bar chart data. The first value is the bar color, the second is the width\u000b" +
"Object[] def = new Object[]{\u000b" +
" Color.yellow, new Integer(100),\u000b" +
" Color.green, new Integer(150),\u000b" +
" Color.gray, new Integer(75),\u000b" +
" Color.red, new Integer(200),\u000b" +
"};\u000b" +
"\u000b" +
"SlideShow ppt = new SlideShow();\u000b" +
"Slide slide = ppt.createSlide();\u000b" +
"\u000b" +
"ShapeGroup group = new ShapeGroup();\u000b" +
"//define position of the drawing in the slide\u000b" +
"Rectangle bounds = new java.awt.Rectangle(200, 100, 350, 300);\u000b" +
"group.setAnchor(bounds);\u000b" +
"slide.addShape(group);\u000b" +
"Graphics2D graphics = new PPGraphics2D(group);\u000b" +
"\u000b" +
"//draw a simple bar graph\u000b" +
"int x = bounds.x + 50, y = bounds.y + 50;\u000b" +
"graphics.setFont(new Font(\"Arial\", Font.BOLD, 10));\u000b" +
"for (int i = 0, idx = 1; i < def.length; i+=2, idx++) {\u000b" +
" graphics.setColor(Color.black);\u000b" +
" int width = ((Integer)def[i+1]).intValue();\u000b" +
" graphics.drawString(\"Q\" + idx, x-20, y+20);\u000b" +
" graphics.drawString(width + \"%\", x + width + 10, y + 20);\u000b" +
" graphics.setColor((Color)def[i]);\u000b" +
" graphics.fill(new Rectangle(x, y, width, 30));\u000b" +
" y += 40;\u000b" +
"}\u000b" +
"graphics.setColor(Color.black);\u000b" +
"graphics.setFont(new Font(\"Arial\", Font.BOLD, 14));\u000b" +
"graphics.draw(bounds);\u000b" +
"graphics.drawString(\"Performance\", x + 70, y + 40);\u000b" +
"\u000b" +
"FileOutputStream out = new FileOutputStream(\"hslf-demo.ppt\");\u000b" +
"ppt.write(out);\u000b" +
"out.close();");
box3.setAnchor(new Rectangle(96, 110, 499, 378));
box3.setHorizontalCentered(true);
slide.addShape(box3);
}
public static void slide10(SlideShow ppt) throws IOException {
public static void slide10(HSLFSlideShow ppt) throws IOException {
//bar chart data. The first value is the bar color, the second is the width
Object[] def = new Object[]{
Color.yellow, new Integer(100),
@ -416,9 +409,9 @@ public final class ApacheconEU08 {
Color.red, new Integer(200),
};
Slide slide = ppt.createSlide();
HSLFSlide slide = ppt.createSlide();
ShapeGroup group = new ShapeGroup();
HSLFGroupShape group = new HSLFGroupShape();
//define position of the drawing in the slide
Rectangle bounds = new java.awt.Rectangle(200, 100, 350, 300);
group.setAnchor(bounds);
@ -444,69 +437,51 @@ public final class ApacheconEU08 {
}
public static void slide11(SlideShow ppt) throws IOException {
Slide slide = ppt.createSlide();
public static void slide11(HSLFSlideShow ppt) throws IOException {
HSLFSlide slide = ppt.createSlide();
TextBox box1 = new TextBox();
TextRun tr1 = box1.getTextRun();
tr1.setRunType(TextHeaderAtom.TITLE_TYPE);
tr1.setText("HSLF Development Plans");
HSLFTextBox box1 = new HSLFTextBox();
box1.setRunType(TextHeaderAtom.TITLE_TYPE);
box1.setText("HSLF Development Plans");
box1.setAnchor(new Rectangle(36, 21, 648, 90));
slide.addShape(box1);
TextBox box2 = new TextBox();
TextRun tr2 = box2.getTextRun();
tr2.setRunType(TextHeaderAtom.BODY_TYPE);
tr2.getRichTextRuns()[0].setFontSize(32);
tr2.setText(
"Support for more PowerPoint functionality\r" +
"Rendering slides into java.awt.Graphics2D");
box2.setAnchor(new Rectangle(36, 126, 648, 100));
slide.addShape(box2);
TextBox box3 = new TextBox();
TextRun tr3 = box3.getTextRun();
tr3.setRunType(TextHeaderAtom.BODY_TYPE);
tr3.getRichTextRuns()[0].setIndentLevel(1);
tr3.setText(
"A way to export slides into images or other formats");
box3.setAnchor(new Rectangle(36, 220, 648, 70));
slide.addShape(box3);
TextBox box4 = new TextBox();
TextRun tr4 = box4.getTextRun();
tr4.setRunType(TextHeaderAtom.BODY_TYPE);
tr4.getRichTextRuns()[0].setFontSize(32);
tr4.setText(
"Integration with Apache FOP - Formatting Objects Processor");
box4.setAnchor(new Rectangle(36, 290, 648, 90));
slide.addShape(box4);
TextBox box5 = new TextBox();
TextRun tr5 = box5.getTextRun();
tr5.setRunType(TextHeaderAtom.BODY_TYPE);
tr5.getRichTextRuns()[0].setIndentLevel(1);
tr5.setText(
HSLFTextBox box2 = new HSLFTextBox();
box2.setRunType(TextHeaderAtom.BODY_TYPE);
box2.setText(
"Support for more PowerPoint functionality\r" +
"Rendering slides into java.awt.Graphics2D\r" +
"A way to export slides into images or other formats\r" +
"Integration with Apache FOP - Formatting Objects Processor\r" +
"Transformation of XSL-FO into PPT\r" +
"PPT2PDF transcoder");
box5.setAnchor(new Rectangle(36, 380, 648, 100));
slide.addShape(box5);
"PPT2PDF transcoder"
);
List<HSLFTextParagraph> tp = box2.getTextParagraphs();
for (int i : new byte[]{0,1,3}) {
tp.get(i).getTextRuns().get(0).setFontSize(28d);
}
for (int i : new byte[]{2,4,5}) {
tp.get(i).getTextRuns().get(0).setFontSize(24d);
tp.get(i).setIndentLevel(1);
}
box2.setAnchor(new Rectangle(36, 126, 648, 400));
slide.addShape(box2);
}
public static void slide12(SlideShow ppt) throws IOException {
Slide slide = ppt.createSlide();
public static void slide12(HSLFSlideShow ppt) throws IOException {
HSLFSlide slide = ppt.createSlide();
TextBox box1 = new TextBox();
TextRun tr1 = box1.getTextRun();
tr1.setRunType(TextHeaderAtom.CENTER_TITLE_TYPE);
tr1.setText("Questions?");
HSLFTextBox box1 = new HSLFTextBox();
box1.setRunType(TextHeaderAtom.CENTER_TITLE_TYPE);
box1.setText("Questions?");
box1.setAnchor(new Rectangle(54, 167, 612, 115));
slide.addShape(box1);
TextBox box2 = new TextBox();
TextRun tr2 = box2.getTextRun();
tr2.setRunType(TextHeaderAtom.CENTRE_BODY_TYPE);
tr2.setText(
HSLFTextBox box2 = new HSLFTextBox();
box2.setRunType(TextHeaderAtom.CENTRE_BODY_TYPE);
box2.setText(
"http://poi.apache.org/hslf/\r" +
"http://people.apache.org/~yegor");
box2.setAnchor(new Rectangle(108, 306, 504, 138));

View File

@ -17,13 +17,13 @@
package org.apache.poi.hslf.examples;
import org.apache.poi.hslf.usermodel.SlideShow;
import org.apache.poi.hslf.usermodel.RichTextRun;
import org.apache.poi.hslf.model.Slide;
import org.apache.poi.hslf.model.TextBox;
import java.io.FileOutputStream;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.HSLFTextBox;
import org.apache.poi.hslf.usermodel.HSLFTextParagraph;
/**
* How to create a single-level bulleted list
* and change some of the bullet attributes
@ -34,22 +34,22 @@ public final class BulletsDemo {
public static void main(String[] args) throws Exception {
SlideShow ppt = new SlideShow();
HSLFSlideShow ppt = new HSLFSlideShow();
Slide slide = ppt.createSlide();
HSLFSlide slide = ppt.createSlide();
TextBox shape = new TextBox();
RichTextRun rt = shape.getTextRun().getRichTextRuns()[0];
HSLFTextBox shape = new HSLFTextBox();
HSLFTextParagraph rt = shape.getTextParagraphs().get(0);
rt.getTextRuns().get(0).setFontSize(42d);
rt.setBullet(true);
rt.setIndent(0d); //bullet offset
rt.setLeftMargin(50d); //text offset (should be greater than bullet offset)
rt.setBulletChar('\u263A'); //bullet character
shape.setText(
"January\r" +
"February\r" +
"March\r" +
"April");
rt.setFontSize(42);
rt.setBullet(true);
rt.setBulletOffset(0); //bullet offset
rt.setTextOffset(50); //text offset (should be greater than bullet offset)
rt.setBulletChar('\u263A'); //bullet character
slide.addShape(shape);
shape.setAnchor(new java.awt.Rectangle(50, 50, 500, 300)); //position of the text box in the slide

View File

@ -17,11 +17,13 @@
package org.apache.poi.hslf.examples;
import org.apache.poi.hslf.usermodel.SlideShow;
import org.apache.poi.hslf.model.*;
import java.awt.Rectangle;
import java.io.FileOutputStream;
import java.awt.*;
import org.apache.poi.hslf.usermodel.HSLFHyperlink;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.HSLFTextBox;
/**
* Demonstrates how to create hyperlinks in PowerPoint presentations
@ -30,20 +32,21 @@ import java.awt.*;
*/
public final class CreateHyperlink {
@SuppressWarnings("unused")
public static void main(String[] args) throws Exception {
SlideShow ppt = new SlideShow();
HSLFSlideShow ppt = new HSLFSlideShow();
Slide slideA = ppt.createSlide();
Slide slideB = ppt.createSlide();
Slide slideC = ppt.createSlide();
HSLFSlide slideA = ppt.createSlide();
HSLFSlide slideB = ppt.createSlide();
HSLFSlide slideC = ppt.createSlide();
// link to a URL
TextBox textBox1 = new TextBox();
HSLFTextBox textBox1 = new HSLFTextBox();
textBox1.setText("Apache POI");
textBox1.setAnchor(new Rectangle(100, 100, 200, 50));
String text = textBox1.getText();
Hyperlink link = new Hyperlink();
HSLFHyperlink link = new HSLFHyperlink();
link.setAddress("http://www.apache.org");
link.setTitle(textBox1.getText());
int linkId = ppt.addHyperlink(link);
@ -54,11 +57,11 @@ public final class CreateHyperlink {
slideA.addShape(textBox1);
// link to another slide
TextBox textBox2 = new TextBox();
HSLFTextBox textBox2 = new HSLFTextBox();
textBox2.setText("Go to slide #3");
textBox2.setAnchor(new Rectangle(100, 300, 200, 50));
Hyperlink link2 = new Hyperlink();
HSLFHyperlink link2 = new HSLFHyperlink();
link2.setAddress(slideC);
ppt.addHyperlink(link2);

View File

@ -17,14 +17,22 @@
package org.apache.poi.hslf.examples;
import org.apache.poi.hslf.usermodel.*;
import org.apache.poi.hslf.model.*;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import org.apache.poi.hslf.model.OLEShape;
import org.apache.poi.hslf.usermodel.HSLFObjectData;
import org.apache.poi.hslf.usermodel.HSLFPictureData;
import org.apache.poi.hslf.usermodel.HSLFPictureShape;
import org.apache.poi.hslf.usermodel.HSLFShape;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.HSLFSoundData;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.usermodel.Range;
import org.apache.poi.hwpf.usermodel.Paragraph;
import java.io.*;
import org.apache.poi.hwpf.usermodel.Range;
/**
* Demonstrates how you can extract misc embedded data from a ppt file
@ -41,11 +49,11 @@ public final class DataExtraction {
}
FileInputStream is = new FileInputStream(args[0]);
SlideShow ppt = new SlideShow(is);
HSLFSlideShow ppt = new HSLFSlideShow(is);
is.close();
//extract all sound files embedded in this presentation
SoundData[] sound = ppt.getSoundData();
HSLFSoundData[] sound = ppt.getSoundData();
for (int i = 0; i < sound.length; i++) {
String type = sound[i].getSoundType(); //*.wav
String name = sound[i].getSoundName(); //typically file name
@ -57,14 +65,14 @@ public final class DataExtraction {
out.close();
}
//extract embedded OLE documents
Slide[] slide = ppt.getSlides();
for (int i = 0; i < slide.length; i++) {
Shape[] shape = slide[i].getShapes();
for (int j = 0; j < shape.length; j++) {
if (shape[j] instanceof OLEShape) {
OLEShape ole = (OLEShape) shape[j];
ObjectData data = ole.getObjectData();
int oleIdx=-1, picIdx=-1;
for (HSLFSlide slide : ppt.getSlides()) {
//extract embedded OLE documents
for (HSLFShape shape : slide.getShapes()) {
if (shape instanceof OLEShape) {
oleIdx++;
OLEShape ole = (OLEShape) shape;
HSLFObjectData data = ole.getObjectData();
String name = ole.getInstanceName();
if ("Worksheet".equals(name)) {
@ -81,11 +89,11 @@ public final class DataExtraction {
}
//save on disk
FileOutputStream out = new FileOutputStream(name + "-("+(j)+").doc");
FileOutputStream out = new FileOutputStream(name + "-("+(oleIdx)+").doc");
doc.write(out);
out.close();
} else {
FileOutputStream out = new FileOutputStream(ole.getProgID() + "-"+(j+1)+".dat");
FileOutputStream out = new FileOutputStream(ole.getProgID() + "-"+(oleIdx+1)+".dat");
InputStream dis = data.getData();
byte[] chunk = new byte[2048];
int count;
@ -96,50 +104,44 @@ public final class DataExtraction {
out.close();
}
}
}
}
//Pictures
for (int i = 0; i < slide.length; i++) {
Shape[] shape = slide[i].getShapes();
for (int j = 0; j < shape.length; j++) {
if (shape[j] instanceof Picture) {
Picture p = (Picture) shape[j];
PictureData data = p.getPictureData();
//Pictures
else if (shape instanceof HSLFPictureShape) {
picIdx++;
HSLFPictureShape p = (HSLFPictureShape) shape;
HSLFPictureData data = p.getPictureData();
String name = p.getPictureName();
int type = data.getType();
String ext;
switch (type) {
case Picture.JPEG:
case HSLFPictureShape.JPEG:
ext = ".jpg";
break;
case Picture.PNG:
case HSLFPictureShape.PNG:
ext = ".png";
break;
case Picture.WMF:
case HSLFPictureShape.WMF:
ext = ".wmf";
break;
case Picture.EMF:
case HSLFPictureShape.EMF:
ext = ".emf";
break;
case Picture.PICT:
case HSLFPictureShape.PICT:
ext = ".pict";
break;
case Picture.DIB:
case HSLFPictureShape.DIB:
ext = ".dib";
break;
default:
continue;
}
FileOutputStream out = new FileOutputStream("pict-" + j + ext);
FileOutputStream out = new FileOutputStream("pict-" + picIdx + ext);
out.write(data.getData());
out.close();
}
}
}
}
}
private static void usage(){

View File

@ -17,12 +17,17 @@
package org.apache.poi.hslf.examples;
import org.apache.poi.hslf.usermodel.SlideShow;
import org.apache.poi.hslf.model.*;
import java.awt.*;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.io.FileOutputStream;
import org.apache.poi.hslf.model.PPGraphics2D;
import org.apache.poi.hslf.usermodel.HSLFGroupShape;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
/**
* Demonstrates how to draw into a slide using the HSLF Graphics2D driver.
*
@ -34,7 +39,7 @@ public final class Graphics2DDemo {
* A simple bar chart demo
*/
public static void main(String[] args) throws Exception {
SlideShow ppt = new SlideShow();
HSLFSlideShow ppt = new HSLFSlideShow();
//bar chart data. The first value is the bar color, the second is the width
Object[] def = new Object[]{
@ -44,13 +49,13 @@ public final class Graphics2DDemo {
Color.red, new Integer(80),
};
Slide slide = ppt.createSlide();
HSLFSlide slide = ppt.createSlide();
ShapeGroup group = new ShapeGroup();
HSLFGroupShape group = new HSLFGroupShape();
//define position of the drawing in the slide
Rectangle bounds = new java.awt.Rectangle(200, 100, 350, 300);
group.setAnchor(bounds);
group.setCoordinates(new java.awt.Rectangle(0, 0, 100, 100));
group.setInteriorAnchor(new java.awt.Rectangle(0, 0, 100, 100));
slide.addShape(group);
Graphics2D graphics = new PPGraphics2D(group);
@ -68,7 +73,7 @@ public final class Graphics2DDemo {
}
graphics.setColor(Color.black);
graphics.setFont(new Font("Arial", Font.BOLD, 14));
graphics.draw(group.getCoordinates());
graphics.draw(group.getInteriorAnchor());
graphics.drawString("Performance", x + 30, y + 10);
FileOutputStream out = new FileOutputStream("hslf-graphics.ppt");

View File

@ -16,12 +16,12 @@
==================================================================== */
package org.apache.poi.hslf.examples;
import org.apache.poi.hslf.usermodel.SlideShow;
import org.apache.poi.hslf.model.HeadersFooters;
import org.apache.poi.hslf.model.Slide;
import java.io.FileOutputStream;
import org.apache.poi.hslf.model.HeadersFooters;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
/**
* Demonstrates how to set headers / footers
*
@ -29,7 +29,7 @@ import java.io.FileOutputStream;
*/
public class HeadersFootersDemo {
public static void main(String[] args) throws Exception {
SlideShow ppt = new SlideShow();
HSLFSlideShow ppt = new HSLFSlideShow();
HeadersFooters slideHeaders = ppt.getSlideHeadersFooters();
slideHeaders.setFootersText("Created by POI-HSLF");
@ -40,7 +40,7 @@ public class HeadersFootersDemo {
notesHeaders.setFootersText("My notes footers");
notesHeaders.setHeaderText("My notes header");
Slide slide = ppt.createSlide();
HSLFSlide slide = ppt.createSlide();
FileOutputStream out = new FileOutputStream("headers_footers.ppt");
ppt.write(out);

View File

@ -17,13 +17,14 @@
package org.apache.poi.hslf.examples;
import org.apache.poi.hslf.usermodel.SlideShow;
import org.apache.poi.hslf.model.Slide;
import org.apache.poi.hslf.model.TextRun;
import org.apache.poi.hslf.model.Hyperlink;
import org.apache.poi.hslf.model.Shape;
import java.io.FileInputStream;
import java.util.List;
import org.apache.poi.hslf.usermodel.HSLFHyperlink;
import org.apache.poi.hslf.usermodel.HSLFShape;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.HSLFTextParagraph;
/**
* Demonstrates how to read hyperlinks from a presentation
@ -35,47 +36,40 @@ public final class Hyperlinks {
public static void main(String[] args) throws Exception {
for (int i = 0; i < args.length; i++) {
FileInputStream is = new FileInputStream(args[i]);
SlideShow ppt = new SlideShow(is);
HSLFSlideShow ppt = new HSLFSlideShow(is);
is.close();
Slide[] slide = ppt.getSlides();
for (int j = 0; j < slide.length; j++) {
System.out.println("slide " + slide[j].getSlideNumber());
for (HSLFSlide slide : ppt.getSlides()) {
System.out.println("\nslide " + slide.getSlideNumber());
//read hyperlinks from the slide's text runs
System.out.println("reading hyperlinks from the text runs");
TextRun[] txt = slide[j].getTextRuns();
for (int k = 0; k < txt.length; k++) {
String text = txt[k].getText();
Hyperlink[] links = txt[k].getHyperlinks();
if(links != null) for (int l = 0; l < links.length; l++) {
Hyperlink link = links[l];
String title = link.getTitle();
String address = link.getAddress();
System.out.println(" " + title);
System.out.println(" " + address);
String substring = text.substring(link.getStartIndex(), link.getEndIndex()-1);//in ppt end index is inclusive
System.out.println(" " + substring);
// read hyperlinks from the slide's text runs
System.out.println("- reading hyperlinks from the text runs");
for (List<HSLFTextParagraph> txtParas : slide.getTextParagraphs()) {
List<HSLFHyperlink> links = HSLFHyperlink.find(txtParas);
String text = HSLFTextParagraph.getRawText(txtParas);
for (HSLFHyperlink link : links) {
System.out.println(toStr(link, text));
}
}
//in PowerPoint you can assign a hyperlink to a shape without text,
//for example to a Line object. The code below demonstrates how to
//read such hyperlinks
System.out.println(" reading hyperlinks from the slide's shapes");
Shape[] sh = slide[j].getShapes();
for (int k = 0; k < sh.length; k++) {
Hyperlink link = sh[k].getHyperlink();
if(link != null) {
String title = link.getTitle();
String address = link.getAddress();
System.out.println(" " + title);
System.out.println(" " + address);
}
// in PowerPoint you can assign a hyperlink to a shape without text,
// for example to a Line object. The code below demonstrates how to
// read such hyperlinks
System.out.println("- reading hyperlinks from the slide's shapes");
for (HSLFShape sh : slide.getShapes()) {
HSLFHyperlink link = HSLFHyperlink.find(sh);
if (link == null) continue;
System.out.println(toStr(link, null));
}
}
}
}
static String toStr(HSLFHyperlink link, String rawText) {
//in ppt end index is inclusive
String formatStr = "title: %1$s, address: %2$s" + (rawText == null ? "" : ", start: %3$s, end: %4$s, substring: %5$s");
String substring = (rawText == null) ? "" : rawText.substring(link.getStartIndex(), link.getEndIndex()-1);
return String.format(formatStr, link.getTitle(), link.getAddress(), link.getStartIndex(), link.getEndIndex(), substring);
}
}

View File

@ -17,15 +17,19 @@
package org.apache.poi.hslf.examples;
import org.apache.poi.hslf.usermodel.*;
import org.apache.poi.hslf.model.*;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import javax.imageio.ImageIO;
import java.io.FileOutputStream;
import java.io.FileInputStream;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.geom.Rectangle2D;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
/**
* Demonstrates how you can use HSLF to convert each slide into a PNG image
@ -62,19 +66,18 @@ public final class PPT2PNG {
}
FileInputStream is = new FileInputStream(file);
SlideShow ppt = new SlideShow(is);
HSLFSlideShow ppt = new HSLFSlideShow(is);
is.close();
Dimension pgsize = ppt.getPageSize();
int width = (int)(pgsize.width*scale);
int height = (int)(pgsize.height*scale);
Slide[] slide = ppt.getSlides();
for (int i = 0; i < slide.length; i++) {
if (slidenum != -1 && slidenum != (i+1)) continue;
for (HSLFSlide slide : ppt.getSlides()) {
if (slidenum != -1 && slidenum != slide.getSlideNumber()) continue;
String title = slide[i].getTitle();
System.out.println("Rendering slide "+slide[i].getSlideNumber() + (title == null ? "" : ": " + title));
String title = slide.getTitle();
System.out.println("Rendering slide "+slide.getSlideNumber() + (title == null ? "" : ": " + title));
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = img.createGraphics();
@ -88,9 +91,9 @@ public final class PPT2PNG {
graphics.scale((double)width/pgsize.width, (double)height/pgsize.height);
slide[i].draw(graphics);
slide.draw(graphics);
String fname = file.replaceAll("\\.ppt", "-" + (i+1) + ".png");
String fname = file.replaceAll("\\.ppt", "-" + slide.getSlideNumber() + ".png");
FileOutputStream out = new FileOutputStream(fname);
ImageIO.write(img, "png", out);
out.close();

View File

@ -15,15 +15,18 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
import org.apache.poi.ddf.*;
import org.apache.poi.hslf.model.*;
import java.io.FileInputStream;
import org.apache.poi.ddf.EscherClientDataRecord;
import org.apache.poi.ddf.EscherContainerRecord;
import org.apache.poi.ddf.EscherRecord;
import org.apache.poi.hslf.record.InteractiveInfo;
import org.apache.poi.hslf.record.InteractiveInfoAtom;
import org.apache.poi.hslf.record.Record;
import org.apache.poi.hslf.usermodel.*;
import java.io.FileInputStream;
import java.util.Iterator;
import java.util.List;
import org.apache.poi.hslf.usermodel.HSLFShape;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.HSLFSoundData;
/**
* For each slide iterate over shapes and found associated sound data.
@ -32,19 +35,18 @@ import java.util.List;
*/
public class SoundFinder {
public static void main(String[] args) throws Exception {
SlideShow ppt = new SlideShow(new FileInputStream(args[0]));
SoundData[] sounds = ppt.getSoundData();
HSLFSlideShow ppt = new HSLFSlideShow(new FileInputStream(args[0]));
HSLFSoundData[] sounds = ppt.getSoundData();
Slide[] slide = ppt.getSlides();
for (int i = 0; i < slide.length; i++) {
Shape[] shape = slide[i].getShapes();
for (int j = 0; j < shape.length; j++) {
int soundRef = getSoundReference(shape[j]);
if(soundRef != -1) {
System.out.println("Slide["+i+"], shape["+j+"], soundRef: "+soundRef);
System.out.println(" " + sounds[soundRef].getSoundName());
System.out.println(" " + sounds[soundRef].getSoundType());
}
for (HSLFSlide slide : ppt.getSlides()) {
for (HSLFShape shape : slide.getShapes()) {
int soundRef = getSoundReference(shape);
if(soundRef == -1) continue;
System.out.println("Slide["+slide.getSlideNumber()+"], shape["+shape.getShapeId()+"], soundRef: "+soundRef);
System.out.println(" " + sounds[soundRef].getSoundName());
System.out.println(" " + sounds[soundRef].getSoundType());
}
}
}
@ -54,20 +56,16 @@ public class SoundFinder {
* @return 0-based reference to a sound in the sound collection
* or -1 if the shape is not associated with a sound
*/
protected static int getSoundReference(Shape shape){
protected static int getSoundReference(HSLFShape shape){
int soundRef = -1;
//dive into the shape container and search for InteractiveInfoAtom
EscherContainerRecord spContainer = shape.getSpContainer();
List spchild = spContainer.getChildRecords();
for (Iterator it = spchild.iterator(); it.hasNext();) {
EscherRecord obj = (EscherRecord) it.next();
for (EscherRecord obj : spContainer.getChildRecords()) {
if (obj.getRecordId() == EscherClientDataRecord.RECORD_ID) {
byte[] data = obj.serialize();
Record[] records = Record.findChildRecords(data, 8,
data.length - 8);
for (int j = 0; j < records.length; j++) {
if (records[j] instanceof InteractiveInfo) {
InteractiveInfoAtom info = ((InteractiveInfo)records[j]).getInteractiveInfoAtom();
for (Record record : Record.findChildRecords(data, 8, data.length - 8)) {
if (record instanceof InteractiveInfo) {
InteractiveInfoAtom info = ((InteractiveInfo)record).getInteractiveInfoAtom();
if (info.getAction() == InteractiveInfoAtom.ACTION_MEDIA) {
soundRef = info.getSoundRef();
}

View File

@ -17,13 +17,18 @@
package org.apache.poi.hslf.examples;
import org.apache.poi.hslf.usermodel.SlideShow;
import org.apache.poi.hslf.usermodel.RichTextRun;
import org.apache.poi.hslf.model.*;
import java.awt.*;
import java.awt.Color;
import java.io.FileOutputStream;
import org.apache.poi.hslf.model.Line;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.HSLFTable;
import org.apache.poi.hslf.usermodel.HSLFTableCell;
import org.apache.poi.hslf.usermodel.HSLFTextRun;
import org.apache.poi.sl.usermodel.TextParagraph.TextAlign;
import org.apache.poi.sl.usermodel.VerticalAlignment;
/**
* Demonstrates how to create tables
*
@ -43,26 +48,26 @@ public final class TableDemo {
{"Total PO History Spend", "$10,172,038"}
};
SlideShow ppt = new SlideShow();
HSLFSlideShow ppt = new HSLFSlideShow();
Slide slide = ppt.createSlide();
HSLFSlide slide = ppt.createSlide();
//six rows, two columns
Table table1 = new Table(6, 2);
HSLFTable table1 = new HSLFTable(6, 2);
for (int i = 0; i < txt1.length; i++) {
for (int j = 0; j < txt1[i].length; j++) {
TableCell cell = table1.getCell(i, j);
cell.setText(txt1[i][j]);
RichTextRun rt = cell.getTextRun().getRichTextRuns()[0];
rt.setFontName("Arial");
rt.setFontSize(10);
HSLFTableCell cell = table1.getCell(i, j);
HSLFTextRun rt = cell.getTextParagraphs().get(0).getTextRuns().get(0);
rt.setFontFamily("Arial");
rt.setFontSize(10d);
if(i == 0){
cell.getFill().setForegroundColor(new Color(227, 227, 227));
} else {
rt.setBold(true);
}
cell.setVerticalAlignment(TextBox.AnchorMiddle);
cell.setHorizontalAlignment(TextBox.AlignCenter);
cell.setVerticalAlignment(VerticalAlignment.MIDDLE);
cell.setHorizontalCentered(true);
cell.setText(txt1[i][j]);
}
}
@ -87,26 +92,27 @@ public final class TableDemo {
};
//two rows, one column
Table table2 = new Table(2, 1);
HSLFTable table2 = new HSLFTable(2, 1);
for (int i = 0; i < txt2.length; i++) {
for (int j = 0; j < txt2[i].length; j++) {
TableCell cell = table2.getCell(i, j);
cell.setText(txt2[i][j]);
RichTextRun rt = cell.getTextRun().getRichTextRuns()[0];
rt.setFontSize(10);
rt.setFontName("Arial");
HSLFTableCell cell = table2.getCell(i, j);
HSLFTextRun rt = cell.getTextParagraphs().get(0).getTextRuns().get(0);
rt.setFontSize(10d);
rt.setFontFamily("Arial");
if(i == 0){
cell.getFill().setForegroundColor(new Color(0, 51, 102));
rt.setFontColor(Color.white);
rt.setBold(true);
rt.setFontSize(14);
cell.setHorizontalAlignment(TextBox.AlignCenter);
rt.setFontSize(14d);
cell.setHorizontalCentered(true);
} else {
rt.setBullet(true);
rt.setFontSize(12);
cell.setHorizontalAlignment(TextBox.AlignLeft);
rt.getTextParagraph().setBullet(true);
rt.setFontSize(12d);
rt.getTextParagraph().setAlignment(TextAlign.LEFT);
cell.setHorizontalCentered(false);
}
cell.setVerticalAlignment(TextBox.AnchorMiddle);
cell.setVerticalAlignment(VerticalAlignment.MIDDLE);
cell.setText(txt2[i][j]);
}
}
table2.setColumnWidth(0, 300);

View File

@ -16,21 +16,23 @@
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
import org.apache.poi.hssf.usermodel.*;
import java.io.FileInputStream;
import java.util.Iterator;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl;
import org.apache.poi.hssf.usermodel.HSSFObjectData;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.Entry;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.SlideShow;
import java.io.FileInputStream;
import java.util.Iterator;
/**
* Demonstrates how you can extract embedded data from a .xls file
*/
public class EmeddedObjects {
@SuppressWarnings("unused")
public static void main(String[] args) throws Exception {
POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(args[0]));
HSSFWorkbook workbook = new HSSFWorkbook(fs);
@ -41,20 +43,21 @@ public class EmeddedObjects {
DirectoryNode dn = (DirectoryNode) obj.getDirectory();
HSSFWorkbook embeddedWorkbook = new HSSFWorkbook(dn, fs, false);
//System.out.println(entry.getName() + ": " + embeddedWorkbook.getNumberOfSheets());
embeddedWorkbook.close();
} else if (oleName.equals("Document")) {
DirectoryNode dn = (DirectoryNode) obj.getDirectory();
HWPFDocument embeddedWordDocument = new HWPFDocument(dn);
//System.out.println(entry.getName() + ": " + embeddedWordDocument.getRange().text());
} else if (oleName.equals("Presentation")) {
DirectoryNode dn = (DirectoryNode) obj.getDirectory();
SlideShow embeddedPowerPointDocument = new SlideShow(new HSLFSlideShow(dn));
HSLFSlideShow embeddedPowerPointDocument = new HSLFSlideShow(new HSLFSlideShowImpl(dn));
//System.out.println(entry.getName() + ": " + embeddedPowerPointDocument.getSlides().length);
} else {
if(obj.hasDirectoryEntry()){
// The DirectoryEntry is a DocumentNode. Examine its entries to find out what it is
DirectoryNode dn = (DirectoryNode) obj.getDirectory();
for (Iterator entries = dn.getEntries(); entries.hasNext();) {
Entry entry = (Entry) entries.next();
for (Iterator<Entry> entries = dn.getEntries(); entries.hasNext();) {
Entry entry = entries.next();
//System.out.println(oleName + "." + entry.getName());
}
} else {
@ -64,5 +67,6 @@ public class EmeddedObjects {
}
}
}
workbook.close();
}
}

View File

@ -19,14 +19,13 @@
package org.apache.poi.xslf.usermodel;
import org.apache.poi.openxml4j.opc.PackagePart;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.awt.Dimension;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.List;
import org.apache.poi.openxml4j.opc.PackagePart;
/**
* Demonstrates how you can extract data from a .pptx file
*
@ -34,6 +33,7 @@ import java.util.List;
*/
public final class DataExtraction {
@SuppressWarnings("unused")
public static void main(String args[]) throws Exception {
if (args.length == 0) {
@ -76,7 +76,6 @@ public final class DataExtraction {
Dimension pageSize = ppt.getPageSize(); // size of the canvas in points
for(XSLFSlide slide : ppt.getSlides()) {
for(XSLFShape shape : slide){
Rectangle2D anchor = shape.getAnchor(); // position on the canvas
if(shape instanceof XSLFTextShape) {
XSLFTextShape txShape = (XSLFTextShape)shape;
System.out.println(txShape.getText());
@ -89,6 +88,8 @@ public final class DataExtraction {
}
}
}
ppt.close();
}
}

View File

@ -40,11 +40,15 @@ public final class MergePresentations {
for(XSLFSlide srcSlide : src.getSlides()){
ppt.createSlide().importContent(srcSlide);
}
src.close();
}
FileOutputStream out = new FileOutputStream("merged.pptx");
ppt.write(out);
out.close();
ppt.close();
}
}

View File

@ -63,11 +63,12 @@ public class PieChartDemo {
}
BufferedReader modelReader = new BufferedReader(new FileReader(args[1]));
XMLSlideShow pptx = null;
try {
String chartTitle = modelReader.readLine(); // first line is chart title
XMLSlideShow pptx = new XMLSlideShow(new FileInputStream(args[0]));
XSLFSlide slide = pptx.getSlides()[0];
pptx = new XMLSlideShow(new FileInputStream(args[0]));
XSLFSlide slide = pptx.getSlides().get(0);
// find chart in the slide
XSLFChart chart = null;
@ -157,6 +158,7 @@ public class PieChartDemo {
wb.close();
}
} finally {
if (pptx != null) pptx.close();
modelReader.close();
}
}

View File

@ -37,7 +37,7 @@ public class Tutorial1 {
/*XSLFSlide blankSlide =*/ ppt.createSlide();
XSLFSlideMaster master = ppt.getSlideMasters()[0];
XSLFSlideMaster master = ppt.getSlideMasters().get(0);
XSLFSlideLayout layout1 = master.getLayout(SlideLayout.TITLE);
XSLFSlide slide1 = ppt.createSlide(layout1) ;
@ -56,17 +56,19 @@ public class Tutorial1 {
// we are going to add text by paragraphs. Clear the default placehoder text before that
bodyPlaceholder.clearText();
XSLFTextParagraph p1 = bodyPlaceholder.addNewTextParagraph();
p1.setLevel(0);
p1.setIndentLevel(0);
p1.addNewTextRun().setText("Level1 text");
XSLFTextParagraph p2 = bodyPlaceholder.addNewTextParagraph();
p2.setLevel(1);
p2.setIndentLevel(1);
p2.addNewTextRun().setText("Level2 text");
XSLFTextParagraph p3 = bodyPlaceholder.addNewTextParagraph();
p3.setLevel(3);
p3.setIndentLevel(2);
p3.addNewTextRun().setText("Level3 text");
FileOutputStream out = new FileOutputStream("slides.pptx");
ppt.write(out);
out.close();
ppt.close();
}
}

View File

@ -19,7 +19,8 @@
package org.apache.poi.xslf.usermodel;
import java.awt.*;
import java.awt.Color;
import java.awt.Rectangle;
import java.io.FileOutputStream;
import java.io.IOException;
@ -42,30 +43,30 @@ public class Tutorial2 {
XSLFTextParagraph p1 = shape1.addNewTextParagraph();
XSLFTextRun r1 = p1.addNewTextRun();
r1.setText("Paragraph Formatting");
r1.setFontSize(24);
r1.setFontSize(24d);
r1.setFontColor(new Color(85, 142, 213));
XSLFTextParagraph p2 = shape1.addNewTextParagraph();
// If spaceBefore >= 0, then space is a percentage of normal line height.
// If spaceBefore < 0, the absolute value of linespacing is the spacing in points
p2.setSpaceBefore(-20); // 20 pt from the previous paragraph
p2.setSpaceAfter(300); // 3 lines after the paragraph
p2.setSpaceBefore(-20d); // 20 pt from the previous paragraph
p2.setSpaceAfter(300d); // 3 lines after the paragraph
XSLFTextRun r2 = p2.addNewTextRun();
r2.setText("Paragraph properties apply to all text residing within the corresponding paragraph.");
r2.setFontSize(16);
r2.setFontSize(16d);
XSLFTextParagraph p3 = shape1.addNewTextParagraph();
XSLFTextRun r3 = p3.addNewTextRun();
r3.setText("Run Formatting");
r3.setFontSize(24);
r3.setFontSize(24d);
r3.setFontColor(new Color(85, 142, 213));
XSLFTextParagraph p4 = shape1.addNewTextParagraph();
p4.setSpaceBefore(-20); // 20 pt from the previous paragraph
p4.setSpaceAfter(300); // 3 lines after the paragraph
p4.setSpaceBefore(-20d); // 20 pt from the previous paragraph
p4.setSpaceAfter(300d); // 3 lines after the paragraph
XSLFTextRun r4 = p4.addNewTextRun();
r4.setFontSize(16);
r4.setFontSize(16d);
r4.setText(
"Run level formatting is the most granular property level and allows " +
"for the specifying of all low level text properties. The text run is " +
@ -78,5 +79,7 @@ public class Tutorial2 {
FileOutputStream out = new FileOutputStream("text.pptx");
ppt.write(out);
out.close();
ppt.close();
}
}

View File

@ -19,7 +19,7 @@
package org.apache.poi.xslf.usermodel;
import java.awt.*;
import java.awt.Rectangle;
import java.io.FileOutputStream;
import java.io.IOException;
@ -43,5 +43,7 @@ public class Tutorial3 {
FileOutputStream out = new FileOutputStream("title.pptx");
ppt.write(out);
out.close();
ppt.close();
}
}

View File

@ -19,11 +19,13 @@
package org.apache.poi.xslf.usermodel;
import java.awt.*;
import java.awt.Color;
import java.awt.geom.Rectangle2D;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.sl.usermodel.TextParagraph.TextAlign;
/**
* PPTX Tables
*
@ -85,5 +87,7 @@ public class Tutorial4 {
FileOutputStream out = new FileOutputStream("table.pptx");
ppt.write(out);
out.close();
ppt.close();
}
}

View File

@ -46,5 +46,7 @@ public class Tutorial5 {
FileOutputStream out = new FileOutputStream("images.pptx");
ppt.write(out);
out.close();
ppt.close();
}
}

View File

@ -19,7 +19,7 @@
package org.apache.poi.xslf.usermodel;
import java.awt.*;
import java.awt.Rectangle;
import java.io.FileOutputStream;
import java.io.IOException;
@ -55,5 +55,7 @@ public class Tutorial6 {
FileOutputStream out = new FileOutputStream("hyperlinks.pptx");
ppt.write(out);
out.close();
ppt.close();
}
}

View File

@ -19,10 +19,13 @@
package org.apache.poi.xslf.usermodel;
import java.awt.*;
import java.awt.Color;
import java.awt.Rectangle;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.sl.usermodel.AutoNumberingScheme;
/**
* Bullets and numbering
*
@ -38,41 +41,41 @@ public class Tutorial7 {
shape.setAnchor(new Rectangle(50, 50, 400, 200));
XSLFTextParagraph p1 = shape.addNewTextParagraph();
p1.setLevel(0);
p1.setIndentLevel(0);
p1.setBullet(true);
XSLFTextRun r1 = p1.addNewTextRun();
r1.setText("Bullet1");
XSLFTextParagraph p2 = shape.addNewTextParagraph();
// indentation before text
p2.setLeftMargin(60);
p2.setLeftMargin(60d);
// the bullet is set 40 pt before the text
p2.setIndent(-40);
p2.setIndent(-40d);
p2.setBullet(true);
// customize bullets
p2.setBulletFontColor(Color.red);
p2.setBulletFont("Wingdings");
p2.setBulletCharacter("\u0075");
p2.setLevel(1);
p2.setIndentLevel(1);
XSLFTextRun r2 = p2.addNewTextRun();
r2.setText("Bullet2");
// the next three paragraphs form an auto-numbered list
XSLFTextParagraph p3 = shape.addNewTextParagraph();
p3.setBulletAutoNumber(ListAutoNumber.ALPHA_LC_PARENT_R, 1);
p3.setLevel(2);
p3.setBulletAutoNumber(AutoNumberingScheme.alphaLcParenRight, 1);
p3.setIndentLevel(2);
XSLFTextRun r3 = p3.addNewTextRun();
r3.setText("Numbered List Item - 1");
XSLFTextParagraph p4 = shape.addNewTextParagraph();
p4.setBulletAutoNumber(ListAutoNumber.ALPHA_LC_PARENT_R, 2);
p4.setLevel(2);
p4.setBulletAutoNumber(AutoNumberingScheme.alphaLcParenRight, 2);
p4.setIndentLevel(2);
XSLFTextRun r4 = p4.addNewTextRun();
r4.setText("Numbered List Item - 2");
XSLFTextParagraph p5 = shape.addNewTextParagraph();
p5.setBulletAutoNumber(ListAutoNumber.ALPHA_LC_PARENT_R, 3);
p5.setLevel(2);
p5.setBulletAutoNumber(AutoNumberingScheme.alphaLcParenRight, 3);
p5.setIndentLevel(2);
XSLFTextRun r5 = p5.addNewTextRun();
r5.setText("Numbered List Item - 3");
@ -81,5 +84,7 @@ public class Tutorial7 {
FileOutputStream out = new FileOutputStream("list.pptx");
ppt.write(out);
out.close();
ppt.close();
}
}

View File

@ -50,12 +50,12 @@ public class Step1 {
if(shape instanceof XSLFTextShape) {
XSLFTextShape tsh = (XSLFTextShape)shape;
for(XSLFTextParagraph p : tsh){
System.out.println("Paragraph level: " + p.getLevel());
System.out.println("Paragraph level: " + p.getIndentLevel());
for(XSLFTextRun r : p){
System.out.println(r.getText());
System.out.println(r.getRawText());
System.out.println(" bold: " + r.isBold());
System.out.println(" italic: " + r.isItalic());
System.out.println(" underline: " + r.isUnderline());
System.out.println(" underline: " + r.isUnderlined());
System.out.println(" font.family: " + r.getFontFamily());
System.out.println(" font.size: " + r.getFontSize());
System.out.println(" font.color: " + r.getFontColor());

View File

@ -49,7 +49,7 @@ public class Step2 {
// blank slide
/*XSLFSlide blankSlide =*/ ppt.createSlide();
XSLFSlideMaster defaultMaster = ppt.getSlideMasters()[0];
XSLFSlideMaster defaultMaster = ppt.getSlideMasters().get(0);
// title slide
XSLFSlideLayout titleLayout = defaultMaster.getLayout(SlideLayout.TITLE);

View File

@ -20,7 +20,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.xslf.XSLFSlideShow;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@ -54,7 +54,7 @@ public class EmbeddedObjects {
}
// PowerPoint Document - binary file format
else if (contentType.equals("application/vnd.ms-powerpoint")) {
HSLFSlideShow slideShow = new HSLFSlideShow(pPart.getInputStream());
HSLFSlideShowImpl slideShow = new HSLFSlideShowImpl(pPart.getInputStream());
}
// PowerPoint Document - OpenXML file format
else if (contentType.equals("application/vnd.openxmlformats-officedocument.presentationml.presentation")) {

View File

@ -22,14 +22,14 @@ import static org.junit.Assert.assertTrue;
import java.io.FileInputStream;
import java.io.InputStream;
import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.record.Record;
import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl;
import org.junit.Test;
public class HSLFFileHandler extends POIFSFileHandler {
@Override
public void handleFile(InputStream stream) throws Exception {
HSLFSlideShow slide = new HSLFSlideShow(stream);
HSLFSlideShowImpl slide = new HSLFSlideShowImpl(stream);
assertNotNull(slide.getCurrentUserAtom());
assertNotNull(slide.getEmbeddedObjects());
assertNotNull(slide.getUnderlyingBytes());

View File

@ -29,6 +29,8 @@ import java.io.IOException;
import java.io.InputStream;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.sl.draw.DrawFactory;
import org.apache.poi.sl.draw.Drawable;
import org.apache.poi.xslf.XSLFSlideShow;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFNotes;
@ -61,9 +63,7 @@ public class XSLFFileHandler extends AbstractFileHandler {
private void createBitmaps(ByteArrayOutputStream out) throws IOException {
XMLSlideShow ppt = new XMLSlideShow(new ByteArrayInputStream(out.toByteArray()));
Dimension pgsize = ppt.getPageSize();
XSLFSlide[] xmlSlide = ppt.getSlides();
int slideSize = xmlSlide.length;
for (int i = 0; i < slideSize; i++) {
for (XSLFSlide xmlSlide : ppt.getSlides()) {
// System.out.println("slide-" + (i + 1));
// System.out.println("" + xmlSlide[i].getTitle());
@ -71,13 +71,15 @@ public class XSLFFileHandler extends AbstractFileHandler {
Graphics2D graphics = img.createGraphics();
// draw stuff
xmlSlide[i].draw(graphics);
xmlSlide.draw(graphics);
// Also try to read notes
XSLFNotes notes = xmlSlide[i].getNotes();
XSLFNotes notes = xmlSlide.getNotes();
if(notes != null) {
for (XSLFShape note : notes) {
note.draw(graphics);
DrawFactory df = DrawFactory.getInstance(graphics);
Drawable d = df.getDrawable(note);
d.draw(graphics);
if (note instanceof XSLFTextShape) {
XSLFTextShape txShape = (XSLFTextShape) note;

View File

@ -1,24 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.common.usermodel;
import java.awt.Color;
public interface Fill {
public Color getColor();
public void setColor(Color color);
}

View File

@ -117,7 +117,7 @@ public class DefaultEscherRecordFactory implements EscherRecordFactory {
* @param recClasses The records to convert
* @return The map containing the id/constructor pairs.
*/
private static Map<Short, Constructor<? extends EscherRecord>> recordsToMap(Class<?>[] recClasses) {
protected static Map<Short, Constructor<? extends EscherRecord>> recordsToMap(Class<?>[] recClasses) {
Map<Short, Constructor<? extends EscherRecord>> result = new HashMap<Short, Constructor<? extends EscherRecord>>();
final Class<?>[] EMPTY_CLASS_ARRAY = new Class[0];

View File

@ -40,13 +40,26 @@ public class EscherChildAnchorRecord
private int field_4_dy2;
public int fillFields(byte[] data, int offset, EscherRecordFactory recordFactory) {
/*int bytesRemaining =*/ readHeader( data, offset );
int bytesRemaining = readHeader( data, offset );
int pos = offset + 8;
int size = 0;
field_1_dx1 = LittleEndian.getInt( data, pos + size );size+=4;
field_2_dy1 = LittleEndian.getInt( data, pos + size );size+=4;
field_3_dx2 = LittleEndian.getInt( data, pos + size );size+=4;
field_4_dy2 = LittleEndian.getInt( data, pos + size );size+=4;
switch (bytesRemaining) {
case 16: // RectStruct
field_1_dx1 = LittleEndian.getInt( data, pos + size );size+=4;
field_2_dy1 = LittleEndian.getInt( data, pos + size );size+=4;
field_3_dx2 = LittleEndian.getInt( data, pos + size );size+=4;
field_4_dy2 = LittleEndian.getInt( data, pos + size );size+=4;
break;
case 8: // SmallRectStruct
field_1_dx1 = LittleEndian.getShort( data, pos + size );size+=2;
field_2_dy1 = LittleEndian.getShort( data, pos + size );size+=2;
field_3_dx2 = LittleEndian.getShort( data, pos + size );size+=2;
field_4_dy2 = LittleEndian.getShort( data, pos + size );size+=2;
break;
default:
throw new RuntimeException("Invalid EscherChildAnchorRecord - neither 8 nor 16 bytes.");
}
return 8 + size;
}
@ -58,8 +71,8 @@ public class EscherChildAnchorRecord
LittleEndian.putInt( data, pos, getRecordSize()-8 ); pos += 4;
LittleEndian.putInt( data, pos, field_1_dx1 ); pos += 4;
LittleEndian.putInt( data, pos, field_2_dy1 ); pos += 4;
LittleEndian.putInt( data, pos, field_3_dx2 ); pos += 4;
LittleEndian.putInt( data, pos, field_4_dy2 ); pos += 4;
LittleEndian.putInt( data, pos, field_3_dx2 ); pos += 4;
LittleEndian.putInt( data, pos, field_4_dy2 ); pos += 4;
listener.afterRecordSerialize( pos, getRecordId(), pos - offset, this );
return pos - offset;

View File

@ -18,10 +18,7 @@
package org.apache.poi.ddf;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.*;
import org.apache.poi.util.HexDump;
import org.apache.poi.util.LittleEndian;
@ -154,30 +151,9 @@ public final class EscherContainerRecord extends EscherRecord {
}
public Iterator<EscherRecord> getChildIterator() {
return new ReadOnlyIterator(_childRecords);
return Collections.unmodifiableList(_childRecords).iterator();
}
private static final class ReadOnlyIterator implements Iterator<EscherRecord> {
private final List<EscherRecord> _list;
private int _index;
public ReadOnlyIterator(List<EscherRecord> list) {
_list = list;
_index = 0;
}
public boolean hasNext() {
return _index < _list.size();
}
public EscherRecord next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
return _list.get(_index++);
}
public void remove() {
throw new UnsupportedOperationException();
}
}
/**
* replaces the internal child list with the contents of the supplied <tt>childRecords</tt>
*/

View File

@ -507,7 +507,7 @@ public final class EscherProperties {
addProp(m, SHADOWSTYLE__ORIGINX, "shadowstyle.originx");
addProp(m, SHADOWSTYLE__ORIGINY, "shadowstyle.originy");
addProp(m, SHADOWSTYLE__SHADOW, "shadowstyle.shadow");
addProp(m, SHADOWSTYLE__SHADOWOBSURED, "shadowstyle.shadowobsured");
addProp(m, SHADOWSTYLE__SHADOWOBSURED, "shadowstyle.shadowobscured");
addProp(m, PERSPECTIVE__TYPE, "perspective.type");
addProp(m, PERSPECTIVE__OFFSETX, "perspective.offsetx");
addProp(m, PERSPECTIVE__OFFSETY, "perspective.offsety");

View File

@ -28,6 +28,7 @@ import java.awt.image.ImageObserver;
import java.awt.image.RenderedImage;
import java.awt.image.renderable.RenderableImage;
import java.text.AttributedCharacterIterator;
import java.util.Arrays;
import java.util.Map;
public class DummyGraphics2d
@ -262,7 +263,7 @@ public class DummyGraphics2d
public void setPaint( Paint paint )
{
System.out.println( "setPain(Paint):" );
System.out.println( "setPaint(Paint):" );
System.out.println( "paint = " + paint );
g2D.setPaint( paint );
}
@ -285,7 +286,19 @@ public class DummyGraphics2d
public void setStroke(Stroke s)
{
System.out.println( "setStroke(Stoke):" );
System.out.println( "s = " + s );
if (s instanceof BasicStroke) {
BasicStroke bs = (BasicStroke)s;
StringBuilder str = new StringBuilder("s = BasicStroke(");
str.append("dash[]: "+Arrays.toString(bs.getDashArray())+", ");
str.append("dashPhase: "+bs.getDashPhase()+", ");
str.append("endCap: "+bs.getEndCap()+", ");
str.append("lineJoin: "+bs.getLineJoin()+", ");
str.append("width: "+bs.getLineWidth()+", ");
str.append("miterLimit: "+bs.getMiterLimit()+")");
System.out.println(str.toString());
} else {
System.out.println( "s = " + s );
}
g2D.setStroke( s );
}

View File

@ -0,0 +1,27 @@
/* ====================================================================
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.sl.draw;
import org.apache.poi.sl.usermodel.*;
public class DrawAutoShape<T extends AutoShape<? extends TextParagraph<? extends TextRun>>> extends DrawTextShape<T> {
public DrawAutoShape(T shape) {
super(shape);
}
}

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.sl.draw;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import org.apache.poi.sl.usermodel.*;
import org.apache.poi.sl.usermodel.Shape;
public class DrawBackground<T extends Background> extends DrawShape<T> {
public DrawBackground(T shape) {
super(shape);
}
public void draw(Graphics2D graphics) {
Dimension pg = shape.getSheet().getSlideShow().getPageSize();
final Rectangle2D anchor = new Rectangle2D.Double(0, 0, pg.getWidth(), pg.getHeight());
PlaceableShape ps = new PlaceableShape(){
public ShapeContainer<? extends Shape> getParent() { return null; }
public Rectangle2D getAnchor() { return anchor; }
public void setAnchor(Rectangle2D anchor) {}
public double getRotation() { return 0; }
public void setRotation(double theta) {}
public void setFlipHorizontal(boolean flip) {}
public void setFlipVertical(boolean flip) {}
public boolean getFlipHorizontal() { return false; }
public boolean getFlipVertical() { return false; }
};
DrawFactory drawFact = DrawFactory.getInstance(graphics);
DrawPaint dp = drawFact.getPaint(ps);
Paint fill = dp.getPaint(graphics, shape.getFillStyle().getPaint());
Rectangle2D anchor2 = getAnchor(graphics, anchor);
if(fill != null) {
graphics.setPaint(fill);
graphics.fill(anchor2);
}
}
}

View File

@ -1,28 +1,26 @@
/* ====================================================================
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.hslf.model;
/**
* Date: Apr 17, 2008
*
* @author Yegor Kozlov
*/
public interface ShapeOutline {
java.awt.Shape getOutline(Shape shape);
}
/* ====================================================================
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.sl.draw;
import org.apache.poi.sl.usermodel.*;
public class DrawConnectorShape<T extends ConnectorShape> extends DrawSimpleShape<T> {
public DrawConnectorShape(T shape) {
super(shape);
}
}

View File

@ -0,0 +1,148 @@
/* ====================================================================
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.sl.draw;
import static org.apache.poi.sl.draw.Drawable.DRAW_FACTORY;
import java.awt.Graphics2D;
import java.awt.font.TextLayout;
import java.text.AttributedString;
import org.apache.poi.sl.usermodel.*;
public class DrawFactory {
protected static ThreadLocal<DrawFactory> defaultFactory = new ThreadLocal<DrawFactory>();
/**
* Set a custom draw factory for the current thread.
* This is a fallback, for operations where usercode can't set a graphics context.
* Preferably use the rendering hint {@link Drawable#DRAW_FACTORY} to set the factory.
*
* @param factory
*/
public static void setDefaultFactory(DrawFactory factory) {
defaultFactory.set(factory);
}
public static DrawFactory getInstance(Graphics2D graphics) {
// first try to find the factory over the rendering hint
DrawFactory factory = null;
boolean isHint = false;
if (graphics != null) {
factory = (DrawFactory)graphics.getRenderingHint(DRAW_FACTORY);
isHint = (factory != null);
}
// secondly try the thread local default
if (factory == null) {
factory = defaultFactory.get();
}
// and at last, use the default factory
if (factory == null) {
factory = new DrawFactory();
}
if (graphics != null && !isHint) {
graphics.setRenderingHint(DRAW_FACTORY, factory);
}
return factory;
}
@SuppressWarnings("unchecked")
public Drawable getDrawable(Shape shape) {
if (shape instanceof TextBox) {
return getDrawable((TextBox<? extends TextParagraph<? extends TextRun>>)shape);
} else if (shape instanceof FreeformShape) {
return getDrawable((FreeformShape<? extends TextParagraph<? extends TextRun>>)shape);
} else if (shape instanceof TextShape) {
return getDrawable((TextShape<? extends TextParagraph<? extends TextRun>>)shape);
} else if (shape instanceof GroupShape) {
return getDrawable((GroupShape<? extends Shape>)shape);
} else if (shape instanceof PictureShape) {
return getDrawable((PictureShape)shape);
} else if (shape instanceof Background) {
return getDrawable((Background)shape);
} else if (shape instanceof ConnectorShape) {
return getDrawable((ConnectorShape)shape);
} else if (shape instanceof TableShape) {
return getDrawable((TableShape)shape);
} else if (shape instanceof Slide) {
return getDrawable((Slide<? extends Shape, ? extends SlideShow, ? extends Notes<?,?>>)shape);
} else if (shape instanceof MasterSheet) {
return getDrawable((MasterSheet<? extends Shape, ? extends SlideShow>)shape);
} else if (shape instanceof Sheet) {
return getDrawable((Sheet<? extends Shape, ? extends SlideShow>)shape);
}
throw new IllegalArgumentException("Unsupported shape type: "+shape.getClass());
}
public <T extends Slide<? extends Shape, ? extends SlideShow, ? extends Notes<?,?>>> DrawSlide<T> getDrawable(T sheet) {
return new DrawSlide<T>(sheet);
}
public <T extends Sheet<? extends Shape, ? extends SlideShow>> DrawSheet<T> getDrawable(T sheet) {
return new DrawSheet<T>(sheet);
}
public <T extends MasterSheet<? extends Shape, ? extends SlideShow>> DrawMasterSheet<T> getDrawable(T sheet) {
return new DrawMasterSheet<T>(sheet);
}
public <T extends TextBox<? extends TextParagraph<?>>> DrawTextBox<T> getDrawable(T shape) {
return new DrawTextBox<T>(shape);
}
public <T extends FreeformShape<? extends TextParagraph<? extends TextRun>>> DrawFreeformShape<T> getDrawable(T shape) {
return new DrawFreeformShape<T>(shape);
}
public <T extends ConnectorShape> DrawConnectorShape<T> getDrawable(T shape) {
return new DrawConnectorShape<T>(shape);
}
public <T extends TableShape> DrawTableShape<T> getDrawable(T shape) {
return new DrawTableShape<T>(shape);
}
public <T extends TextShape<? extends TextParagraph<? extends TextRun>>> DrawTextShape<T> getDrawable(T shape) {
return new DrawTextShape<T>(shape);
}
public <T extends GroupShape<? extends Shape>> DrawGroupShape<T> getDrawable(T shape) {
return new DrawGroupShape<T>(shape);
}
public <T extends PictureShape> DrawPictureShape<T> getDrawable(T shape) {
return new DrawPictureShape<T>(shape);
}
public <T extends TextRun> DrawTextParagraph<T> getDrawable(TextParagraph<T> paragraph) {
return new DrawTextParagraph<T>(paragraph);
}
public <T extends Background> DrawBackground<T> getDrawable(T shape) {
return new DrawBackground<T>(shape);
}
public DrawTextFragment getTextFragment(TextLayout layout, AttributedString str) {
return new DrawTextFragment(layout, str);
}
public DrawPaint getPaint(PlaceableShape shape) {
return new DrawPaint(shape);
}
}

View File

@ -17,13 +17,22 @@
* ====================================================================
*/
package org.apache.poi.xslf.usermodel;
package org.apache.poi.sl.draw;
/**
* @author Yegor Kozlov
* Manages fonts when rendering slides.
*
* Use this class to handle unknown / missing fonts or to substitute fonts
*/
public enum TextCap {
NONE,
SMALL,
ALL
public interface DrawFontManager {
/**
* select a font to be used to paint text
*
* @param typeface the font family as defined in the .pptx file.
* This can be unknown or missing in the graphic environment.
*
* @return the font to be used to paint text
*/
String getRendererableFont(String typeface, int pitchFamily);
}

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.sl.draw;
import java.awt.Graphics2D;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.poi.sl.draw.geom.Outline;
import org.apache.poi.sl.draw.geom.Path;
import org.apache.poi.sl.usermodel.FillStyle;
import org.apache.poi.sl.usermodel.FreeformShape;
import org.apache.poi.sl.usermodel.StrokeStyle;
import org.apache.poi.sl.usermodel.TextParagraph;
import org.apache.poi.sl.usermodel.TextRun;
public class DrawFreeformShape<T extends FreeformShape<? extends TextParagraph<? extends TextRun>>> extends DrawAutoShape<T> {
public DrawFreeformShape(T shape) {
super(shape);
}
protected Collection<Outline> computeOutlines(Graphics2D graphics) {
List<Outline> lst = new ArrayList<Outline>();
java.awt.Shape sh = shape.getPath();
FillStyle fs = shape.getFillStyle();
StrokeStyle ss = shape.getStrokeStyle();
Path path = new Path(fs != null, ss != null);
lst.add(new Outline(sh, path));
return lst;
}
}

View File

@ -0,0 +1,70 @@
/* ====================================================================
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.sl.draw;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import org.apache.poi.sl.usermodel.*;
public class DrawGroupShape<T extends GroupShape<? extends Shape>> extends DrawShape<T> implements Drawable {
public DrawGroupShape(T shape) {
super(shape);
}
public void draw(Graphics2D graphics) {
// the coordinate system of this group of shape
Rectangle2D interior = shape.getInteriorAnchor();
// anchor of this group relative to the parent shape
Rectangle2D exterior = shape.getAnchor();
AffineTransform tx = (AffineTransform)graphics.getRenderingHint(Drawable.GROUP_TRANSFORM);
AffineTransform tx0 = new AffineTransform(tx);
double scaleX = interior.getWidth() == 0. ? 1.0 : exterior.getWidth() / interior.getWidth();
double scaleY = interior.getHeight() == 0. ? 1.0 : exterior.getHeight() / interior.getHeight();
tx.translate(exterior.getX(), exterior.getY());
tx.scale(scaleX, scaleY);
tx.translate(-interior.getX(), -interior.getY());
DrawFactory drawFact = DrawFactory.getInstance(graphics);
AffineTransform at2 = graphics.getTransform();
for (Shape child : shape) {
// remember the initial transform and restore it after we are done with the drawing
AffineTransform at = graphics.getTransform();
graphics.setRenderingHint(Drawable.GSAVE, true);
Drawable draw = drawFact.getDrawable(child);
draw.applyTransform(graphics);
draw.draw(graphics);
// restore the coordinate system
graphics.setTransform(at);
graphics.setRenderingHint(Drawable.GRESTORE, true);
}
graphics.setTransform(at2);
graphics.setRenderingHint(Drawable.GROUP_TRANSFORM, tx0);
}
}

View File

@ -0,0 +1,38 @@
/* ====================================================================
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.sl.draw;
import org.apache.poi.sl.usermodel.*;
public class DrawMasterSheet<T extends MasterSheet<? extends Shape, ? extends SlideShow>> extends DrawSheet<T> {
public DrawMasterSheet(T sheet) {
super(sheet);
}
/**
* Checks if this <code>sheet</code> displays the specified shape.
*
* Subclasses can override it and skip certain shapes from drawings,
* for instance, slide masters and layouts don't display placeholders
*/
protected boolean canDraw(Shape shape){
return !(shape instanceof SimpleShape) || !((SimpleShape)shape).isPlaceholder();
}
}

View File

@ -0,0 +1,444 @@
/* ====================================================================
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.sl.draw;
import static org.apache.poi.sl.usermodel.PaintStyle.TRANSPARENT_PAINT;
import java.awt.*;
import java.awt.MultipleGradientPaint.ColorSpaceType;
import java.awt.MultipleGradientPaint.CycleMethod;
import java.awt.geom.*;
import java.io.IOException;
import java.io.InputStream;
import org.apache.poi.sl.usermodel.*;
import org.apache.poi.sl.usermodel.PaintStyle.GradientPaint;
import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
import org.apache.poi.sl.usermodel.PaintStyle.TexturePaint;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
/**
* This class handles color transformations
*
* @see HSL code taken from <a href="https://tips4java.wordpress.com/2009/07/05/hsl-color/">Java Tips Weblog</a>
*/
public class DrawPaint {
// HSL code is public domain - see https://tips4java.wordpress.com/contact-us/
private final static POILogger LOG = POILogFactory.getLogger(DrawPaint.class);
protected PlaceableShape shape;
public DrawPaint(PlaceableShape shape) {
this.shape = shape;
}
public static SolidPaint createSolidPaint(final Color color) {
return new SolidPaint() {
public ColorStyle getSolidColor() {
return new ColorStyle(){
public Color getColor() { return color; }
public int getAlpha() { return -1; }
public int getLumOff() { return -1; }
public int getLumMod() { return -1; }
public int getShade() { return -1; }
public int getTint() { return -1; }
};
}
};
}
public Paint getPaint(Graphics2D graphics, PaintStyle paint) {
if (paint instanceof SolidPaint) {
return getSolidPaint((SolidPaint)paint, graphics);
} else if (paint instanceof GradientPaint) {
return getGradientPaint((GradientPaint)paint, graphics);
} else if (paint instanceof TexturePaint) {
return getTexturePaint((TexturePaint)paint, graphics);
}
return null;
}
protected Paint getSolidPaint(SolidPaint fill, Graphics2D graphics) {
return applyColorTransform(fill.getSolidColor());
}
protected Paint getGradientPaint(GradientPaint fill, Graphics2D graphics) {
switch (fill.getGradientType()) {
case linear:
return createLinearGradientPaint(fill, graphics);
case circular:
return createRadialGradientPaint(fill, graphics);
case shape:
return createPathGradientPaint(fill, graphics);
default:
throw new UnsupportedOperationException("gradient fill of type "+fill+" not supported.");
}
}
protected Paint getTexturePaint(TexturePaint fill, Graphics2D graphics) {
InputStream is = fill.getImageData();
if (is == null) return TRANSPARENT_PAINT.getSolidColor().getColor();
assert(graphics != null);
ImageRenderer renderer = (ImageRenderer)graphics.getRenderingHint(Drawable.IMAGE_RENDERER);
if (renderer == null) renderer = new ImageRenderer();
try {
renderer.loadImage(fill.getImageData(), fill.getContentType());
} catch (IOException e) {
LOG.log(POILogger.ERROR, "Can't load image data - using transparent color", e);
return TRANSPARENT_PAINT.getSolidColor().getColor();
}
int alpha = fill.getAlpha();
if (alpha != -1) {
renderer.setAlpha(alpha/100000.f);
}
Dimension dim = renderer.getDimension();
Rectangle2D textAnchor = new Rectangle2D.Double(0, 0, dim.getWidth(), dim.getHeight());
Paint paint = new java.awt.TexturePaint(renderer.getImage(), textAnchor);
return paint;
}
/**
* Convert color transformations in {@link ColorStyle} to a {@link Color} instance
*/
public static Color applyColorTransform(ColorStyle color){
Color result = color.getColor();
if (result == null || color.getAlpha() == 100) {
return TRANSPARENT_PAINT.getSolidColor().getColor();
}
result = applyAlpha(result, color);
result = applyLuminance(result, color);
result = applyShade(result, color);
result = applyTint(result, color);
return result;
}
protected static Color applyAlpha(Color c, ColorStyle fc) {
int alpha = c.getAlpha();
return (alpha == 255) ? c : new Color(c.getRed(), c.getGreen(), c.getBlue(), alpha);
}
/**
* Apply lumMod / lumOff adjustments
*
* @param c the color to modify
* @param lumMod luminance modulation in the range [0..100000]
* @param lumOff luminance offset in the range [0..100000]
* @return modified color
*
* @see <a href="https://msdn.microsoft.com/en-us/library/dd560821%28v=office.12%29.aspx">Using Office Open XML to Customize Document Formatting in the 2007 Office System</a>
*/
protected static Color applyLuminance(Color c, ColorStyle fc) {
int lumMod = fc.getLumMod();
if (lumMod == -1) lumMod = 100000;
int lumOff = fc.getLumOff();
if (lumOff == -1) lumOff = 0;
if (lumMod == 100000 && lumOff == 0) return c;
// The lumMod value is the percent luminance. A lumMod value of "60000",
// is 60% of the luminance of the original color.
// When the color is a shade of the original theme color, the lumMod
// attribute is the only one of the tags shown here that appears.
// The <a:lumOff> tag appears after the <a:lumMod> tag when the color is a
// tint of the original. The lumOff value always equals 1-lumMod, which is used in the tint calculation
//
// Despite having different ways to display the tint and shade percentages,
// all of the programs use the same method to calculate the resulting color.
// Convert the original RGB value to HSL ... and then adjust the luminance (L)
// with one of the following equations before converting the HSL value back to RGB.
// (The % tint in the following equations refers to the tint, themetint, themeshade,
// or lumMod values, as applicable.)
//
// For a shade, the equation is luminance * %tint.
//
// For a tint, the equation is luminance * %tint + (1-%tint).
// (Note that 1-%tint is equal to the lumOff value in DrawingML.)
double fLumOff = lumOff / 100000d;
double fLumMod = lumMod / 100000d;
double hsl[] = RGB2HSL(c);
hsl[2] = hsl[2]*fLumMod+fLumOff;
Color c2 = HSL2RGB(hsl[0], hsl[1], hsl[2], c.getAlpha()/255d);
return c2;
}
/**
* This algorithm returns result different from PowerPoint.
* TODO: revisit and improve
*/
protected static Color applyShade(Color c, ColorStyle fc) {
int shade = fc.getShade();
if (shade == -1) return c;
float fshade = shade / 100000.f;
float red = c.getRed() * fshade;
float green = c.getGreen() * fshade;
float blue = c.getGreen() * fshade;
return new Color(Math.round(red), Math.round(green), Math.round(blue), c.getAlpha());
}
/**
* This algorithm returns result different from PowerPoint.
* TODO: revisit and improve
*/
protected static Color applyTint(Color c, ColorStyle fc) {
int tint = fc.getTint();
if (tint == -1) return c;
float ftint = tint / 100000.f;
float red = ftint * c.getRed() + (1.f - ftint) * 255.f;
float green = ftint * c.getGreen() + (1.f - ftint) * 255.f;
float blue = ftint * c.getBlue() + (1.f - ftint) * 255.f;
return new Color(Math.round(red), Math.round(green), Math.round(blue), c.getAlpha());
}
protected Paint createLinearGradientPaint(GradientPaint fill, Graphics2D graphics) {
double angle = fill.getGradientAngle();
Rectangle2D anchor = DrawShape.getAnchor(graphics, shape);
AffineTransform at = AffineTransform.getRotateInstance(
Math.toRadians(angle),
anchor.getX() + anchor.getWidth() / 2,
anchor.getY() + anchor.getHeight() / 2);
double diagonal = Math.sqrt(anchor.getHeight() * anchor.getHeight() + anchor.getWidth() * anchor.getWidth());
Point2D p1 = new Point2D.Double(anchor.getX() + anchor.getWidth() / 2 - diagonal / 2,
anchor.getY() + anchor.getHeight() / 2);
p1 = at.transform(p1, null);
Point2D p2 = new Point2D.Double(anchor.getX() + anchor.getWidth(), anchor.getY() + anchor.getHeight() / 2);
p2 = at.transform(p2, null);
snapToAnchor(p1, anchor);
snapToAnchor(p2, anchor);
float[] fractions = fill.getGradientFractions();
Color[] colors = new Color[fractions.length];
int i = 0;
for (ColorStyle fc : fill.getGradientColors()) {
colors[i++] = applyColorTransform(fc);
}
AffineTransform grAt = new AffineTransform();
if(fill.isRotatedWithShape()) {
double rotation = shape.getRotation();
if (rotation != 0.) {
double centerX = anchor.getX() + anchor.getWidth() / 2;
double centerY = anchor.getY() + anchor.getHeight() / 2;
grAt.translate(centerX, centerY);
grAt.rotate(Math.toRadians(-rotation));
grAt.translate(-centerX, -centerY);
}
}
return new LinearGradientPaint
(p1, p2, fractions, colors, CycleMethod.NO_CYCLE, ColorSpaceType.SRGB, grAt);
}
protected Paint createRadialGradientPaint(GradientPaint fill, Graphics2D graphics) {
Rectangle2D anchor = DrawShape.getAnchor(graphics, shape);
Point2D pCenter = new Point2D.Double(anchor.getX() + anchor.getWidth()/2,
anchor.getY() + anchor.getHeight()/2);
float radius = (float)Math.max(anchor.getWidth(), anchor.getHeight());
float[] fractions = fill.getGradientFractions();
Color[] colors = new Color[fractions.length];
int i=0;
for (ColorStyle fc : fill.getGradientColors()) {
colors[i++] = applyColorTransform(fc);
}
return new RadialGradientPaint(pCenter, radius, fractions, colors);
}
protected Paint createPathGradientPaint(GradientPaint fill, Graphics2D graphics) {
// currently we ignore an eventually center setting
float[] fractions = fill.getGradientFractions();
Color[] colors = new Color[fractions.length];
int i=0;
for (ColorStyle fc : fill.getGradientColors()) {
colors[i++] = applyColorTransform(fc);
}
return new PathGradientPaint(colors, fractions);
}
protected void snapToAnchor(Point2D p, Rectangle2D anchor) {
if (p.getX() < anchor.getX()) {
p.setLocation(anchor.getX(), p.getY());
} else if (p.getX() > (anchor.getX() + anchor.getWidth())) {
p.setLocation(anchor.getX() + anchor.getWidth(), p.getY());
}
if (p.getY() < anchor.getY()) {
p.setLocation(p.getX(), anchor.getY());
} else if (p.getY() > (anchor.getY() + anchor.getHeight())) {
p.setLocation(p.getX(), anchor.getY() + anchor.getHeight());
}
}
/**
* Convert HSL values to a RGB Color.
*
* @param h Hue is specified as degrees in the range 0 - 360.
* @param s Saturation is specified as a percentage in the range 1 - 100.
* @param l Luminance is specified as a percentage in the range 1 - 100.
* @param alpha the alpha value between 0 - 1
*
* @returns the RGB Color object
*/
private static Color HSL2RGB(double h, double s, double l, double alpha) {
if (s <0.0f || s > 100.0f) {
String message = "Color parameter outside of expected range - Saturation";
throw new IllegalArgumentException( message );
}
if (l <0.0f || l > 100.0f) {
String message = "Color parameter outside of expected range - Luminance";
throw new IllegalArgumentException( message );
}
if (alpha <0.0f || alpha > 1.0f) {
String message = "Color parameter outside of expected range - Alpha";
throw new IllegalArgumentException( message );
}
// Formula needs all values between 0 - 1.
h = h % 360.0f;
h /= 360f;
s /= 100f;
l /= 100f;
double q = (l < 0.5d)
? l * (1d + s)
: (l + s) - (s * l);
double p = 2d * l - q;
double r = Math.max(0, HUE2RGB(p, q, h + (1.0d / 3.0d)));
double g = Math.max(0, HUE2RGB(p, q, h));
double b = Math.max(0, HUE2RGB(p, q, h - (1.0d / 3.0d)));
r = Math.min(r, 1.0d);
g = Math.min(g, 1.0d);
b = Math.min(b, 1.0d);
return new Color((float)r, (float)g, (float)b, (float)alpha);
}
private static double HUE2RGB(double p, double q, double h) {
if (h < 0d) h += 1d;
if (h > 1d) h -= 1d;
if (6d * h < 1d) {
return p + ((q - p) * 6d * h);
}
if (2d * h < 1d) {
return q;
}
if (3d * h < 2d) {
return p + ( (q - p) * 6d * ((2.0d / 3.0d) - h) );
}
return p;
}
/**
* Convert a RGB Color to it corresponding HSL values.
*
* @return an array containing the 3 HSL values.
*/
private static double[] RGB2HSL(Color color)
{
// Get RGB values in the range 0 - 1
float[] rgb = color.getRGBColorComponents( null );
double r = rgb[0];
double g = rgb[1];
double b = rgb[2];
// Minimum and Maximum RGB values are used in the HSL calculations
double min = Math.min(r, Math.min(g, b));
double max = Math.max(r, Math.max(g, b));
// Calculate the Hue
double h = 0;
if (max == min) {
h = 0;
} else if (max == r) {
h = ((60d * (g - b) / (max - min)) + 360d) % 360d;
} else if (max == g) {
h = (60d * (b - r) / (max - min)) + 120d;
} else if (max == b) {
h = (60d * (r - g) / (max - min)) + 240d;
}
// Calculate the Luminance
double l = (max + min) / 2d;
// Calculate the Saturation
double s = 0;
if (max == min) {
s = 0;
} else if (l <= .5d) {
s = (max - min) / (max + min);
} else {
s = (max - min) / (2d - max - min);
}
return new double[] {h, s * 100, l * 100};
}
}

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.sl.draw;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import org.apache.poi.sl.usermodel.PictureData;
import org.apache.poi.sl.usermodel.PictureShape;
public class DrawPictureShape<T extends PictureShape> extends DrawSimpleShape<T> {
public DrawPictureShape(T shape) {
super(shape);
}
@Override
public void drawContent(Graphics2D graphics) {
PictureData data = shape.getPictureData();
if(data == null) return;
ImageRenderer renderer = (ImageRenderer)graphics.getRenderingHint(Drawable.IMAGE_RENDERER);
if (renderer == null) renderer = new ImageRenderer();
Rectangle2D anchor = getAnchor(graphics, shape);
Insets insets = shape.getClipping();
try {
renderer.loadImage(data.getData(), data.getContentType());
renderer.drawImage(graphics, anchor, insets);
} catch (IOException e) {
// TODO: draw specific runtime exception?
throw new RuntimeException(e);
}
}
}

View File

@ -0,0 +1,143 @@
/* ====================================================================
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.sl.draw;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import org.apache.poi.sl.usermodel.PlaceableShape;
import org.apache.poi.sl.usermodel.Shape;
public class DrawShape<T extends Shape> implements Drawable {
protected final T shape;
public DrawShape(T shape) {
this.shape = shape;
}
/**
* Apply 2-D transforms before drawing this shape. This includes rotation and flipping.
*
* @param graphics the graphics whos transform matrix will be modified
*/
public void applyTransform(Graphics2D graphics) {
if (!(shape instanceof PlaceableShape)) return;
PlaceableShape ps = (PlaceableShape)shape;
AffineTransform tx = (AffineTransform)graphics.getRenderingHint(Drawable.GROUP_TRANSFORM);
if (tx == null) tx = new AffineTransform();
final Rectangle2D anchor = tx.createTransformedShape(ps.getAnchor()).getBounds2D();
// rotation
double rotation = ps.getRotation();
if (rotation != 0.) {
// PowerPoint rotates shapes relative to the geometric center
double centerX = anchor.getCenterX();
double centerY = anchor.getCenterY();
// normalize rotation
rotation %= 360.;
if (rotation < 0) rotation += 360.;
int quadrant = (((int)rotation+45)/90)%4;
double scaleX = 1.0, scaleY = 1.0;
// scale to bounding box (bug #53176)
if (quadrant == 1 || quadrant == 3) {
// In quadrant 1 and 3, which is basically a shape in a more or less portrait orientation
// (45-135 degrees and 225-315 degrees), we need to first rotate the shape by a multiple
// of 90 degrees and then resize the bounding box to its original bbox. After that we can
// rotate the shape to the exact rotation amount.
// It's strange that you'll need to rotate the shape back and forth again, but you can
// think of it, as if you paint the shape on a canvas. First you rotate the canvas, which might
// be already (differently) scaled, so you can paint the shape in its default orientation
// and later on, turn it around again to compare it with its original size ...
AffineTransform txs;
if (ps.getClass().getCanonicalName().toLowerCase().contains("hslf")) {
txs = new AffineTransform(tx);
} else {
// this handling is only based on try and error ... not sure why xslf is handled differently.
txs = new AffineTransform();
txs.translate(centerX, centerY);
txs.rotate(Math.PI/2.); // actually doesn't matter if +/- 90 degrees
txs.translate(-centerX, -centerY);
txs.concatenate(tx);
}
txs.translate(centerX, centerY);
txs.rotate(Math.PI/2.);
txs.translate(-centerX, -centerY);
Rectangle2D anchor2 = txs.createTransformedShape(ps.getAnchor()).getBounds2D();
scaleX = anchor.getWidth() == 0. ? 1.0 : anchor.getWidth() / anchor2.getWidth();
scaleY = anchor.getHeight() == 0. ? 1.0 : anchor.getHeight() / anchor2.getHeight();
} else {
quadrant = 0;
}
// transformation is applied reversed ...
graphics.translate(centerX, centerY);
graphics.rotate(Math.toRadians(rotation-quadrant*90.));
graphics.scale(scaleX, scaleY);
graphics.rotate(Math.toRadians(quadrant*90));
graphics.translate(-centerX, -centerY);
}
//flip horizontal
if (ps.getFlipHorizontal()) {
graphics.translate(anchor.getX() + anchor.getWidth(), anchor.getY());
graphics.scale(-1, 1);
graphics.translate(-anchor.getX(), -anchor.getY());
}
//flip vertical
if (ps.getFlipVertical()) {
graphics.translate(anchor.getX(), anchor.getY() + anchor.getHeight());
graphics.scale(1, -1);
graphics.translate(-anchor.getX(), -anchor.getY());
}
}
public void draw(Graphics2D graphics) {
}
public void drawContent(Graphics2D context) {
}
public static Rectangle2D getAnchor(Graphics2D graphics, PlaceableShape shape) {
return getAnchor(graphics, shape.getAnchor());
}
public static Rectangle2D getAnchor(Graphics2D graphics, Rectangle2D anchor) {
if(graphics == null) {
return anchor;
}
AffineTransform tx = (AffineTransform)graphics.getRenderingHint(Drawable.GROUP_TRANSFORM);
if(tx != null) {
anchor = tx.createTransformedShape(anchor).getBounds2D();
}
return anchor;
}
}

View File

@ -0,0 +1,91 @@
/* ====================================================================
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.sl.draw;
import java.awt.Dimension;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import org.apache.poi.sl.usermodel.*;
public class DrawSheet<T extends Sheet<? extends Shape, ? extends SlideShow>> implements Drawable {
protected final T sheet;
public DrawSheet(T sheet) {
this.sheet = sheet;
}
public void draw(Graphics2D graphics) {
Dimension dim = sheet.getSlideShow().getPageSize();
Color whiteTrans = new Color(1f,1f,1f,0f);
graphics.setColor(whiteTrans);
graphics.fillRect(0, 0, (int)dim.getWidth(), (int)dim.getHeight());
DrawFactory drawFact = DrawFactory.getInstance(graphics);
MasterSheet<? extends Shape, ? extends SlideShow> master = sheet.getMasterSheet();
if(sheet.getFollowMasterGraphics() && master != null) {
Drawable drawer = drawFact.getDrawable(master);
drawer.draw(graphics);
}
graphics.setRenderingHint(Drawable.GROUP_TRANSFORM, new AffineTransform());
for (Shape shape : sheet.getShapes()) {
if(!canDraw(shape)) continue;
// remember the initial transform and restore it after we are done with drawing
AffineTransform at = graphics.getTransform();
// concrete implementations can make sense of this hint,
// for example PSGraphics2D or PDFGraphics2D would call gsave() / grestore
graphics.setRenderingHint(Drawable.GSAVE, true);
// apply rotation and flipping
Drawable drawer = drawFact.getDrawable(shape);
drawer.applyTransform(graphics);
// draw stuff
drawer.draw(graphics);
// restore the coordinate system
graphics.setTransform(at);
graphics.setRenderingHint(Drawable.GRESTORE, true);
}
}
public void applyTransform(Graphics2D context) {
}
public void drawContent(Graphics2D context) {
}
/**
* Checks if this <code>sheet</code> displays the specified shape.
*
* Subclasses can override it and skip certain shapes from drawings,
* for instance, slide masters and layouts don't display placeholders
*/
protected boolean canDraw(Shape shape){
return true;
}
}

View File

@ -0,0 +1,417 @@
/* ====================================================================
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.sl.draw;
import java.awt.*;
import java.awt.geom.*;
import java.io.*;
import java.nio.charset.Charset;
import java.util.*;
import java.util.List;
import javax.xml.bind.*;
import javax.xml.stream.*;
import javax.xml.stream.EventFilter;
import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
import org.apache.poi.sl.draw.binding.CTCustomGeometry2D;
import org.apache.poi.sl.draw.geom.*;
import org.apache.poi.sl.usermodel.*;
import org.apache.poi.sl.usermodel.LineDecoration.DecorationSize;
import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
import org.apache.poi.sl.usermodel.StrokeStyle.*;
import org.apache.poi.util.Units;
public class DrawSimpleShape<T extends SimpleShape> extends DrawShape<T> {
public DrawSimpleShape(T shape) {
super(shape);
}
@Override
public void draw(Graphics2D graphics) {
// RenderableShape rShape = new RenderableShape(this);
// rShape.render(graphics);
DrawPaint drawPaint = DrawFactory.getInstance(graphics).getPaint(shape);
Paint fill = drawPaint.getPaint(graphics, shape.getFillStyle().getPaint());
Paint line = drawPaint.getPaint(graphics, shape.getStrokeStyle().getPaint());
BasicStroke stroke = getStroke(); // the stroke applies both to the shadow and the shape
graphics.setStroke(stroke);
Collection<Outline> elems = computeOutlines(graphics);
// first paint the shadow
drawShadow(graphics, elems, fill, line);
// then fill the shape interior
if (fill != null) {
graphics.setPaint(fill);
for (Outline o : elems) {
if (o.getPath().isFilled()){
java.awt.Shape s = o.getOutline();
graphics.setRenderingHint(Drawable.GRADIENT_SHAPE, s);
graphics.fill(s);
}
}
}
// then draw any content within this shape (text, image, etc.)
drawContent(graphics);
// then stroke the shape outline
if(line != null) {
graphics.setPaint(line);
for(Outline o : elems){
if(o.getPath().isStroked()){
java.awt.Shape s = o.getOutline();
graphics.setRenderingHint(Drawable.GRADIENT_SHAPE, s);
graphics.draw(s);
}
}
}
// draw line decorations
drawDecoration(graphics, line, stroke);
}
protected void drawDecoration(Graphics2D graphics, Paint line, BasicStroke stroke) {
if(line == null) return;
graphics.setPaint(line);
List<Outline> lst = new ArrayList<Outline>();
LineDecoration deco = shape.getLineDecoration();
Outline head = getHeadDecoration(graphics, deco, stroke);
if (head != null) lst.add(head);
Outline tail = getTailDecoration(graphics, deco, stroke);
if (tail != null) lst.add(tail);
for(Outline o : lst){
java.awt.Shape s = o.getOutline();
Path p = o.getPath();
graphics.setRenderingHint(Drawable.GRADIENT_SHAPE, s);
if(p.isFilled()) graphics.fill(s);
if(p.isStroked()) graphics.draw(s);
}
}
protected Outline getTailDecoration(Graphics2D graphics, LineDecoration deco, BasicStroke stroke) {
DecorationSize tailLength = deco.getTailLength();
DecorationSize tailWidth = deco.getTailWidth();
double lineWidth = Math.max(2.5, stroke.getLineWidth());
Rectangle2D anchor = getAnchor(graphics, shape);
double x2 = anchor.getX() + anchor.getWidth(),
y2 = anchor.getY() + anchor.getHeight();
double alpha = Math.atan(anchor.getHeight() / anchor.getWidth());
AffineTransform at = new AffineTransform();
java.awt.Shape shape = null;
Path p = null;
Rectangle2D bounds;
final double scaleY = Math.pow(2, tailWidth.ordinal()+1);
final double scaleX = Math.pow(2, tailLength.ordinal()+1);
switch (deco.getTailShape()) {
case OVAL:
p = new Path();
shape = new Ellipse2D.Double(0, 0, lineWidth * scaleX, lineWidth * scaleY);
bounds = shape.getBounds2D();
at.translate(x2 - bounds.getWidth() / 2, y2 - bounds.getHeight() / 2);
at.rotate(alpha, bounds.getX() + bounds.getWidth() / 2, bounds.getY() + bounds.getHeight() / 2);
break;
case STEALTH:
case ARROW:
p = new Path(false, true);
GeneralPath arrow = new GeneralPath();
arrow.moveTo((float) (-lineWidth * scaleX), (float) (-lineWidth * scaleY / 2));
arrow.lineTo(0, 0);
arrow.lineTo((float) (-lineWidth * scaleX), (float) (lineWidth * scaleY / 2));
shape = arrow;
at.translate(x2, y2);
at.rotate(alpha);
break;
case TRIANGLE:
p = new Path();
GeneralPath triangle = new GeneralPath();
triangle.moveTo((float) (-lineWidth * scaleX), (float) (-lineWidth * scaleY / 2));
triangle.lineTo(0, 0);
triangle.lineTo((float) (-lineWidth * scaleX), (float) (lineWidth * scaleY / 2));
triangle.closePath();
shape = triangle;
at.translate(x2, y2);
at.rotate(alpha);
break;
default:
break;
}
if (shape != null) {
shape = at.createTransformedShape(shape);
}
return shape == null ? null : new Outline(shape, p);
}
protected Outline getHeadDecoration(Graphics2D graphics, LineDecoration deco, BasicStroke stroke) {
DecorationSize headLength = deco.getHeadLength();
DecorationSize headWidth = deco.getHeadWidth();
double lineWidth = Math.max(2.5, stroke.getLineWidth());
Rectangle2D anchor = getAnchor(graphics, shape);
double x1 = anchor.getX(),
y1 = anchor.getY();
double alpha = Math.atan(anchor.getHeight() / anchor.getWidth());
AffineTransform at = new AffineTransform();
java.awt.Shape shape = null;
Path p = null;
Rectangle2D bounds;
final double scaleY = Math.pow(2, headWidth.ordinal()+1);
final double scaleX = Math.pow(2, headLength.ordinal()+1);
switch (deco.getHeadShape()) {
case OVAL:
p = new Path();
shape = new Ellipse2D.Double(0, 0, lineWidth * scaleX, lineWidth * scaleY);
bounds = shape.getBounds2D();
at.translate(x1 - bounds.getWidth() / 2, y1 - bounds.getHeight() / 2);
at.rotate(alpha, bounds.getX() + bounds.getWidth() / 2, bounds.getY() + bounds.getHeight() / 2);
break;
case STEALTH:
case ARROW:
p = new Path(false, true);
GeneralPath arrow = new GeneralPath();
arrow.moveTo((float) (lineWidth * scaleX), (float) (-lineWidth * scaleY / 2));
arrow.lineTo(0, 0);
arrow.lineTo((float) (lineWidth * scaleX), (float) (lineWidth * scaleY / 2));
shape = arrow;
at.translate(x1, y1);
at.rotate(alpha);
break;
case TRIANGLE:
p = new Path();
GeneralPath triangle = new GeneralPath();
triangle.moveTo((float) (lineWidth * scaleX), (float) (-lineWidth * scaleY / 2));
triangle.lineTo(0, 0);
triangle.lineTo((float) (lineWidth * scaleX), (float) (lineWidth * scaleY / 2));
triangle.closePath();
shape = triangle;
at.translate(x1, y1);
at.rotate(alpha);
break;
default:
break;
}
if (shape != null) {
shape = at.createTransformedShape(shape);
}
return shape == null ? null : new Outline(shape, p);
}
public BasicStroke getStroke() {
StrokeStyle strokeStyle = shape.getStrokeStyle();
float lineWidth = (float) strokeStyle.getLineWidth();
if (lineWidth == 0.0f) lineWidth = 0.25f; // Both PowerPoint and OOo draw zero-length lines as 0.25pt
LineDash lineDash = strokeStyle.getLineDash();
if (lineDash == null) {
lineDash = LineDash.SOLID;
}
int dashPatI[] = lineDash.pattern;
final float dash_phase = 0;
float[] dashPatF = null;
if (dashPatI != null) {
dashPatF = new float[dashPatI.length];
for (int i=0; i<dashPatI.length; i++) {
dashPatF[i] = dashPatI[i]*Math.max(1, lineWidth);
}
}
LineCap lineCapE = strokeStyle.getLineCap();
if (lineCapE == null) lineCapE = LineCap.FLAT;
int lineCap;
switch (lineCapE) {
case ROUND:
lineCap = BasicStroke.CAP_ROUND;
break;
case SQUARE:
lineCap = BasicStroke.CAP_SQUARE;
break;
default:
case FLAT:
lineCap = BasicStroke.CAP_BUTT;
break;
}
int lineJoin = BasicStroke.JOIN_ROUND;
return new BasicStroke(lineWidth, lineCap, lineJoin, lineWidth, dashPatF, dash_phase);
}
protected void drawShadow(
Graphics2D graphics
, Collection<Outline> outlines
, Paint fill
, Paint line
) {
Shadow shadow = shape.getShadow();
if (shadow == null || (fill == null && line == null)) return;
SolidPaint shadowPaint = shadow.getFillStyle();
Color shadowColor = DrawPaint.applyColorTransform(shadowPaint.getSolidColor());
double shapeRotation = shape.getRotation();
if(shape.getFlipVertical()) {
shapeRotation += 180;
}
double angle = shadow.getAngle() - shapeRotation;
double dist = shadow.getDistance();
double dx = dist * Math.cos(Math.toRadians(angle));
double dy = dist * Math.sin(Math.toRadians(angle));
graphics.translate(dx, dy);
for(Outline o : outlines){
java.awt.Shape s = o.getOutline();
Path p = o.getPath();
graphics.setRenderingHint(Drawable.GRADIENT_SHAPE, s);
graphics.setPaint(shadowColor);
if(fill != null && p.isFilled()){
graphics.fill(s);
} else if (line != null && p.isStroked()) {
graphics.draw(s);
}
}
graphics.translate(-dx, -dy);
}
protected static CustomGeometry getCustomGeometry(String name) {
return getCustomGeometry(name, null);
}
protected static CustomGeometry getCustomGeometry(String name, Graphics2D graphics) {
@SuppressWarnings("unchecked")
Map<String, CustomGeometry> presets = (graphics == null)
? null
: (Map<String, CustomGeometry>)graphics.getRenderingHint(Drawable.PRESET_GEOMETRY_CACHE);
if (presets == null) {
presets = new HashMap<String,CustomGeometry>();
if (graphics != null) {
graphics.setRenderingHint(Drawable.PRESET_GEOMETRY_CACHE, presets);
}
String packageName = "org.apache.poi.sl.draw.binding";
InputStream presetIS = Drawable.class.getResourceAsStream("presetShapeDefinitions.xml");
Reader xml = new InputStreamReader( presetIS, Charset.forName("UTF-8") );
// StAX:
EventFilter startElementFilter = new EventFilter() {
@Override
public boolean accept(XMLEvent event) {
return event.isStartElement();
}
};
try {
XMLInputFactory staxFactory = XMLInputFactory.newInstance();
XMLEventReader staxReader = staxFactory.createXMLEventReader(xml);
XMLEventReader staxFiltRd = staxFactory.createFilteredReader(staxReader, startElementFilter);
// Ignore StartElement:
staxFiltRd.nextEvent();
// JAXB:
JAXBContext jaxbContext = JAXBContext.newInstance(packageName);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
while (staxFiltRd.peek() != null) {
StartElement evRoot = (StartElement)staxFiltRd.peek();
String cusName = evRoot.getName().getLocalPart();
// XMLEvent ev = staxReader.nextEvent();
JAXBElement<org.apache.poi.sl.draw.binding.CTCustomGeometry2D> el = unmarshaller.unmarshal(staxReader, CTCustomGeometry2D.class);
CTCustomGeometry2D cusGeom = el.getValue();
presets.put(cusName, new CustomGeometry(cusGeom));
}
} catch (Exception e) {
throw new RuntimeException("Unable to load preset geometries.", e);
}
}
return presets.get(name);
}
protected Collection<Outline> computeOutlines(Graphics2D graphics) {
List<Outline> lst = new ArrayList<Outline>();
CustomGeometry geom = shape.getGeometry();
if(geom == null) {
return lst;
}
Rectangle2D anchor = getAnchor(graphics, shape);
for (Path p : geom) {
double w = p.getW() == -1 ? anchor.getWidth() * Units.EMU_PER_POINT : p.getW();
double h = p.getH() == -1 ? anchor.getHeight() * Units.EMU_PER_POINT : p.getH();
// the guides in the shape definitions are all defined relative to each other,
// so we build the path starting from (0,0).
final Rectangle2D pathAnchor = new Rectangle2D.Double(0,0,w,h);
Context ctx = new Context(geom, pathAnchor, shape);
java.awt.Shape gp = p.getPath(ctx);
// translate the result to the canvas coordinates in points
AffineTransform at = new AffineTransform();
at.translate(anchor.getX(), anchor.getY());
double scaleX, scaleY;
if (p.getW() != -1) {
scaleX = anchor.getWidth() / p.getW();
} else {
scaleX = 1.0 / Units.EMU_PER_POINT;
}
if (p.getH() != -1) {
scaleY = anchor.getHeight() / p.getH();
} else {
scaleY = 1.0 / Units.EMU_PER_POINT;
}
at.scale(scaleX, scaleY);
java.awt.Shape canvasShape = at.createTransformedShape(gp);
lst.add(new Outline(canvasShape, p));
}
return lst;
}
}

View File

@ -0,0 +1,41 @@
/* ====================================================================
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.sl.draw;
import java.awt.Graphics2D;
import org.apache.poi.sl.usermodel.*;
public class DrawSlide<T extends Slide<? extends Shape, ? extends SlideShow, ? extends Notes<?,?>>> extends DrawSheet<T> {
public DrawSlide(T slide) {
super(slide);
}
public void draw(Graphics2D graphics) {
Background bg = sheet.getBackground();
if(bg != null) {
DrawFactory drawFact = DrawFactory.getInstance(graphics);
Drawable db = drawFact.getDrawable(bg);
db.draw(graphics);
}
super.draw(graphics);
}
}

View File

@ -1,21 +1,27 @@
/* ====================================================================
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.sl.usermodel;
public interface LineStyle extends org.apache.poi.common.usermodel.LineStyle {
}
/* ====================================================================
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.sl.draw;
import org.apache.poi.sl.usermodel.*;
public class DrawTableShape<T extends TableShape> extends DrawShape<T> {
// to be implemented ...
public DrawTableShape(T shape) {
super(shape);
}
}

View File

@ -0,0 +1,26 @@
/* ====================================================================
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.sl.draw;
import org.apache.poi.sl.usermodel.*;
public class DrawTextBox<T extends TextBox<? extends TextParagraph<? extends TextRun>>> extends DrawAutoShape<T> {
public DrawTextBox(T shape) {
super(shape);
}
}

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.sl.draw;
import java.awt.Graphics2D;
import java.awt.font.TextLayout;
import java.text.*;
public class DrawTextFragment implements Drawable {
final TextLayout layout;
final AttributedString str;
double x, y;
public DrawTextFragment(TextLayout layout, AttributedString str) {
this.layout = layout;
this.str = str;
}
public void setPosition(double x, double y) {
// TODO: replace it, by applyTransform????
this.x = x;
this.y = y;
}
public void draw(Graphics2D graphics){
if(str == null) {
return;
}
double yBaseline = y + layout.getAscent();
Integer textMode = (Integer)graphics.getRenderingHint(Drawable.TEXT_RENDERING_MODE);
if(textMode != null && textMode == Drawable.TEXT_AS_SHAPES){
layout.draw(graphics, (float)x, (float)yBaseline);
} else {
graphics.drawString(str.getIterator(), (float)x, (float)yBaseline );
}
}
public void applyTransform(Graphics2D graphics) {
}
public void drawContent(Graphics2D graphics) {
}
public TextLayout getLayout() {
return layout;
}
public AttributedString getAttributedString() {
return str;
}
/**
* @return full height of this text run which is sum of ascent, descent and leading
*/
public float getHeight(){
double h = Math.ceil(layout.getAscent()) + Math.ceil(layout.getDescent()) + layout.getLeading();
return (float)h;
}
/**
*
* @return width if this text run
*/
public float getWidth(){
return layout.getAdvance();
}
/**
*
* @return the string to be painted
*/
public String getString(){
if (str == null) return "";
AttributedCharacterIterator it = str.getIterator();
StringBuilder buf = new StringBuilder();
for (char c = it.first(); c != CharacterIterator.DONE; c = it.next()) {
buf.append(c);
}
return buf.toString();
}
@Override
public String toString(){
return "[" + getClass().getSimpleName() + "] " + getString();
}
}

View File

@ -0,0 +1,462 @@
/* ====================================================================
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.sl.draw;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.font.*;
import java.awt.geom.Rectangle2D;
import java.text.*;
import java.text.AttributedCharacterIterator.Attribute;
import java.util.*;
import org.apache.poi.sl.usermodel.*;
import org.apache.poi.sl.usermodel.TextParagraph.BulletStyle;
import org.apache.poi.sl.usermodel.TextParagraph.TextAlign;
import org.apache.poi.sl.usermodel.TextRun.TextCap;
import org.apache.poi.util.Units;
public class DrawTextParagraph<T extends TextRun> implements Drawable {
protected TextParagraph<T> paragraph;
double x, y;
protected List<DrawTextFragment> lines = new ArrayList<DrawTextFragment>();
protected String rawText;
protected DrawTextFragment bullet;
protected int autoNbrIdx = 0;
/**
* the highest line in this paragraph. Used for line spacing.
*/
protected double maxLineHeight;
public DrawTextParagraph(TextParagraph<T> paragraph) {
this.paragraph = paragraph;
}
public void setPosition(double x, double y) {
// TODO: replace it, by applyTransform????
this.x = x;
this.y = y;
}
public double getY() {
return y;
}
/**
* Sets the auto numbering index of the handled paragraph
* @param index the auto numbering index
*/
public void setAutoNumberingIdx(int index) {
autoNbrIdx = index;
}
public void draw(Graphics2D graphics){
if (lines.isEmpty()) return;
Insets2D insets = paragraph.getParentShape().getInsets();
double leftInset = insets.left;
double rightInset = insets.right;
double penY = y;
boolean firstLine = true;
int indentLevel = paragraph.getIndentLevel();
Double leftMargin = paragraph.getLeftMargin();
if (leftMargin == null) {
// if the marL attribute is omitted, then a value of 347663 is implied
leftMargin = Units.toPoints(347663*(indentLevel+1));
}
Double indent = paragraph.getIndent();
if (indent == null) {
indent = Units.toPoints(347663*indentLevel);
}
Double rightMargin = paragraph.getRightMargin();
if (rightMargin == null) {
rightMargin = 0d;
}
//The vertical line spacing
Double spacing = paragraph.getLineSpacing();
if (spacing == null) spacing = 100d;
for(DrawTextFragment line : lines){
double penX;
if(firstLine) {
if (!isEmptyParagraph()) {
// TODO: find out character style for empty, but bulleted/numbered lines
bullet = getBullet(graphics, line.getAttributedString().getIterator());
}
if (bullet != null){
bullet.setPosition(x + indent, penY);
bullet.draw(graphics);
// don't let text overlay the bullet and advance by the bullet width
double bulletWidth = bullet.getLayout().getAdvance() + 1;
penX = x + Math.max(leftMargin, indent+bulletWidth);
} else {
penX = x + indent;
}
} else {
penX = x + leftMargin;
}
Rectangle2D anchor = DrawShape.getAnchor(graphics, paragraph.getParentShape());
TextAlign ta = paragraph.getTextAlign();
if (ta == null) ta = TextAlign.LEFT;
switch (ta) {
case CENTER:
penX += (anchor.getWidth() - leftMargin - line.getWidth() - leftInset - rightInset) / 2;
break;
case RIGHT:
penX += (anchor.getWidth() - line.getWidth() - leftInset - rightInset);
break;
default:
break;
}
line.setPosition(penX, penY);
line.draw(graphics);
if(spacing > 0) {
// If linespacing >= 0, then linespacing is a percentage of normal line height.
penY += spacing*0.01* line.getHeight();
} else {
// negative value means absolute spacing in points
penY += -spacing;
}
firstLine = false;
}
y = penY - y;
}
public float getFirstLineHeight() {
return (lines.isEmpty()) ? 0 : lines.get(0).getHeight();
}
public float getLastLineHeight() {
return (lines.isEmpty()) ? 0 : lines.get(lines.size()-1).getHeight();
}
public boolean isEmptyParagraph() {
return (lines.isEmpty() || rawText.trim().isEmpty());
}
public void applyTransform(Graphics2D graphics) {
}
public void drawContent(Graphics2D graphics) {
}
/**
* break text into lines, each representing a line of text that fits in the wrapping width
*
* @param graphics
*/
protected void breakText(Graphics2D graphics){
lines.clear();
DrawFactory fact = DrawFactory.getInstance(graphics);
StringBuilder text = new StringBuilder();
AttributedString at = getAttributedString(graphics, text);
boolean emptyParagraph = ("".equals(text.toString().trim()));
AttributedCharacterIterator it = at.getIterator();
LineBreakMeasurer measurer = new LineBreakMeasurer(it, graphics.getFontRenderContext());
for (;;) {
int startIndex = measurer.getPosition();
double wrappingWidth = getWrappingWidth(lines.size() == 0, graphics) + 1; // add a pixel to compensate rounding errors
// shape width can be smaller that the sum of insets (this was proved by a test file)
if(wrappingWidth < 0) wrappingWidth = 1;
int nextBreak = text.indexOf("\n", startIndex + 1);
if (nextBreak == -1) nextBreak = it.getEndIndex();
TextLayout layout = measurer.nextLayout((float)wrappingWidth, nextBreak, true);
if (layout == null) {
// layout can be null if the entire word at the current position
// does not fit within the wrapping width. Try with requireNextWord=false.
layout = measurer.nextLayout((float)wrappingWidth, nextBreak, false);
}
if(layout == null) {
// exit if can't break any more
break;
}
int endIndex = measurer.getPosition();
// skip over new line breaks (we paint 'clear' text runs not starting or ending with \n)
if(endIndex < it.getEndIndex() && text.charAt(endIndex) == '\n'){
measurer.setPosition(endIndex + 1);
}
TextAlign hAlign = paragraph.getTextAlign();
if(hAlign == TextAlign.JUSTIFY || hAlign == TextAlign.JUSTIFY_LOW) {
layout = layout.getJustifiedLayout((float)wrappingWidth);
}
AttributedString str = (emptyParagraph)
? null // we will not paint empty paragraphs
: new AttributedString(it, startIndex, endIndex);
DrawTextFragment line = fact.getTextFragment(layout, str);
lines.add(line);
maxLineHeight = Math.max(maxLineHeight, line.getHeight());
if(endIndex == it.getEndIndex()) break;
}
rawText = text.toString();
}
protected DrawTextFragment getBullet(Graphics2D graphics, AttributedCharacterIterator firstLineAttr) {
BulletStyle bulletStyle = paragraph.getBulletStyle();
if (bulletStyle == null) return null;
String buCharacter;
AutoNumberingScheme ans = bulletStyle.getAutoNumberingScheme();
if (ans != null) {
buCharacter = ans.format(autoNbrIdx);
} else {
buCharacter = bulletStyle.getBulletCharacter();
}
if (buCharacter == null) return null;
String buFont = bulletStyle.getBulletFont();
if (buFont == null) buFont = paragraph.getDefaultFontFamily();
assert(buFont != null);
Color buColor = bulletStyle.getBulletFontColor();
if (buColor == null) buColor = (Color)firstLineAttr.getAttribute(TextAttribute.FOREGROUND);
float fontSize = (Float)firstLineAttr.getAttribute(TextAttribute.SIZE);
Double buSz = bulletStyle.getBulletFontSize();
if (buSz == null) buSz = 100d;
if (buSz > 0) fontSize *= buSz* 0.01;
else fontSize = (float)-buSz;
AttributedString str = new AttributedString(buCharacter);
str.addAttribute(TextAttribute.FOREGROUND, buColor);
str.addAttribute(TextAttribute.FAMILY, buFont);
str.addAttribute(TextAttribute.SIZE, fontSize);
TextLayout layout = new TextLayout(str.getIterator(), graphics.getFontRenderContext());
DrawFactory fact = DrawFactory.getInstance(graphics);
return fact.getTextFragment(layout, str);
}
protected String getRenderableText(TextRun tr) {
StringBuilder buf = new StringBuilder();
TextCap cap = tr.getTextCap();
String tabs = null;
for (char c : tr.getRawText().toCharArray()) {
if(c == '\t') {
if (tabs == null) {
tabs = tab2space(tr);
}
buf.append(tabs);
continue;
}
switch (cap) {
case ALL: c = Character.toUpperCase(c); break;
case SMALL: c = Character.toLowerCase(c); break;
case NONE: break;
}
buf.append(c);
}
return buf.toString();
}
/**
* Replace a tab with the effective number of white spaces.
*/
private String tab2space(TextRun tr) {
AttributedString string = new AttributedString(" ");
String typeFace = tr.getFontFamily();
if (typeFace == null) typeFace = "Lucida Sans";
string.addAttribute(TextAttribute.FAMILY, typeFace);
Double fs = tr.getFontSize();
if (fs == null) fs = 12d;
string.addAttribute(TextAttribute.SIZE, fs.floatValue());
TextLayout l = new TextLayout(string.getIterator(), new FontRenderContext(null, true, true));
double wspace = l.getAdvance();
Double tabSz = paragraph.getDefaultTabSize();
if (tabSz == null) tabSz = wspace*4;
int numSpaces = (int)Math.ceil(tabSz / wspace);
StringBuilder buf = new StringBuilder();
for(int i = 0; i < numSpaces; i++) {
buf.append(' ');
}
return buf.toString();
}
/**
* Returns wrapping width to break lines in this paragraph
*
* @param firstLine whether the first line is breaking
*
* @return wrapping width in points
*/
protected double getWrappingWidth(boolean firstLine, Graphics2D graphics){
// internal margins for the text box
Insets2D insets = paragraph.getParentShape().getInsets();
double leftInset = insets.left;
double rightInset = insets.right;
Rectangle2D anchor = DrawShape.getAnchor(graphics, paragraph.getParentShape());
int indentLevel = paragraph.getIndentLevel();
Double leftMargin = paragraph.getLeftMargin();
if (leftMargin == null) {
// if the marL attribute is omitted, then a value of 347663 is implied
leftMargin = Units.toPoints(347663*(indentLevel+1));
}
Double indent = paragraph.getIndent();
if (indent == null) {
indent = Units.toPoints(347663*indentLevel);
}
Double rightMargin = paragraph.getRightMargin();
if (rightMargin == null) {
rightMargin = 0d;
}
double width;
TextShape<? extends TextParagraph<T>> ts = paragraph.getParentShape();
if (!ts.getWordWrap()) {
// if wordWrap == false then we return the advance to the right border of the sheet
width = ts.getSheet().getSlideShow().getPageSize().getWidth() - anchor.getX();
} else {
width = anchor.getWidth() - leftInset - rightInset - leftMargin - rightMargin;
if (firstLine) {
if (bullet != null){
if (indent > 0) width -= indent;
} else {
if (indent > 0) width -= indent; // first line indentation
else if (indent < 0) { // hanging indentation: the first line start at the left margin
width += leftMargin;
}
}
}
}
return width;
}
private static class AttributedStringData {
Attribute attribute;
Object value;
int beginIndex, endIndex;
AttributedStringData(Attribute attribute, Object value, int beginIndex, int endIndex) {
this.attribute = attribute;
this.value = value;
this.beginIndex = beginIndex;
this.endIndex = endIndex;
}
}
protected AttributedString getAttributedString(Graphics2D graphics, StringBuilder text){
List<AttributedStringData> attList = new ArrayList<AttributedStringData>();
if (text == null) text = new StringBuilder();
DrawFontManager fontHandler = (DrawFontManager)graphics.getRenderingHint(Drawable.FONT_HANDLER);
for (TextRun run : paragraph){
String runText = getRenderableText(run);
// skip empty runs
if (runText.isEmpty()) continue;
int beginIndex = text.length();
text.append(runText);
int endIndex = text.length();
Color fgColor = run.getFontColor();
if (fgColor == null) fgColor = Color.BLACK;
attList.add(new AttributedStringData(TextAttribute.FOREGROUND, fgColor, beginIndex, endIndex));
// user can pass an custom object to convert fonts
String fontFamily = run.getFontFamily();
@SuppressWarnings("unchecked")
Map<String,String> fontMap = (Map<String,String>)graphics.getRenderingHint(Drawable.FONT_MAP);
if (fontMap != null && fontMap.containsKey(fontFamily)) {
fontFamily = fontMap.get(fontFamily);
}
if(fontHandler != null) {
fontFamily = fontHandler.getRendererableFont(fontFamily, run.getPitchAndFamily());
}
if (fontFamily == null) {
fontFamily = paragraph.getDefaultFontFamily();
}
attList.add(new AttributedStringData(TextAttribute.FAMILY, fontFamily, beginIndex, endIndex));
Double fontSz = run.getFontSize();
if (fontSz == null) fontSz = paragraph.getDefaultFontSize();
attList.add(new AttributedStringData(TextAttribute.SIZE, fontSz.floatValue(), beginIndex, endIndex));
if(run.isBold()) {
attList.add(new AttributedStringData(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD, beginIndex, endIndex));
}
if(run.isItalic()) {
attList.add(new AttributedStringData(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE, beginIndex, endIndex));
}
if(run.isUnderlined()) {
attList.add(new AttributedStringData(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON, beginIndex, endIndex));
attList.add(new AttributedStringData(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_TWO_PIXEL, beginIndex, endIndex));
}
if(run.isStrikethrough()) {
attList.add(new AttributedStringData(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON, beginIndex, endIndex));
}
if(run.isSubscript()) {
attList.add(new AttributedStringData(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUB, beginIndex, endIndex));
}
if(run.isSuperscript()) {
attList.add(new AttributedStringData(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUPER, beginIndex, endIndex));
}
}
// ensure that the paragraph contains at least one character
// We need this trick to correctly measure text
if (text.length() == 0) {
Double fontSz = paragraph.getDefaultFontSize();
text.append(" ");
attList.add(new AttributedStringData(TextAttribute.SIZE, fontSz.floatValue(), 0, 1));
}
AttributedString string = new AttributedString(text.toString());
for (AttributedStringData asd : attList) {
string.addAttribute(asd.attribute, asd.value, asd.beginIndex, asd.endIndex);
}
return string;
}
}

View File

@ -0,0 +1,184 @@
/* ====================================================================
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.sl.draw;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.util.*;
import org.apache.poi.sl.usermodel.*;
import org.apache.poi.sl.usermodel.TextParagraph.BulletStyle;
import org.apache.poi.util.JvmBugs;
public class DrawTextShape<T extends TextShape<? extends TextParagraph<? extends TextRun>>> extends DrawSimpleShape<T> {
public DrawTextShape(T shape) {
super(shape);
}
@Override
public void drawContent(Graphics2D graphics) {
fixFonts(graphics);
Rectangle2D anchor = DrawShape.getAnchor(graphics, shape);
Insets2D insets = shape.getInsets();
double x = anchor.getX() + insets.left;
double y = anchor.getY();
// remember the initial transform
AffineTransform tx = graphics.getTransform();
// Transform of text in flipped shapes is special.
// At this point the flip and rotation transform is already applied
// (see DrawShape#applyTransform ), but we need to restore it to avoid painting "upside down".
// See Bugzilla 54210.
if(shape.getFlipVertical()){
graphics.translate(anchor.getX(), anchor.getY() + anchor.getHeight());
graphics.scale(1, -1);
graphics.translate(-anchor.getX(), -anchor.getY());
// text in vertically flipped shapes is rotated by 180 degrees
double centerX = anchor.getX() + anchor.getWidth()/2;
double centerY = anchor.getY() + anchor.getHeight()/2;
graphics.translate(centerX, centerY);
graphics.rotate(Math.toRadians(180));
graphics.translate(-centerX, -centerY);
}
// Horizontal flipping applies only to shape outline and not to the text in the shape.
// Applying flip second time restores the original not-flipped transform
if(shape.getFlipHorizontal()){
graphics.translate(anchor.getX() + anchor.getWidth(), anchor.getY());
graphics.scale(-1, 1);
graphics.translate(-anchor.getX() , -anchor.getY());
}
// first dry-run to calculate the total height of the text
double textHeight = shape.getTextHeight();
switch (shape.getVerticalAlignment()){
case TOP:
y += insets.top;
break;
case BOTTOM:
y += anchor.getHeight() - textHeight - insets.bottom;
break;
default:
case MIDDLE:
double delta = anchor.getHeight() - textHeight - insets.top - insets.bottom;
y += insets.top + delta/2;
break;
}
drawParagraphs(graphics, x, y);
// restore the transform
graphics.setTransform(tx);
}
/**
* paint the paragraphs starting from top left (x,y)
*
* @return the vertical advance, i.e. the cumulative space occupied by the text
*/
public double drawParagraphs(Graphics2D graphics, double x, double y) {
DrawFactory fact = DrawFactory.getInstance(graphics);
Insets2D shapePadding = shape.getInsets();
double y0 = y;
Iterator<? extends TextParagraph<? extends TextRun>> paragraphs = shape.iterator();
boolean isFirstLine = true;
for (int autoNbrIdx=0; paragraphs.hasNext(); autoNbrIdx++){
TextParagraph<? extends TextRun> p = paragraphs.next();
DrawTextParagraph<? extends TextRun> dp = fact.getDrawable(p);
BulletStyle bs = p.getBulletStyle();
if (bs == null || bs.getAutoNumberingScheme() == null) {
autoNbrIdx = -1;
} else {
Integer startAt = bs.getAutoNumberingStartAt();
if (startAt == null) startAt = 1;
// TODO: handle reset auto number indexes
if (startAt > autoNbrIdx) autoNbrIdx = startAt;
}
dp.setAutoNumberingIdx(autoNbrIdx);
dp.breakText(graphics);
if (!isFirstLine) {
// the amount of vertical white space before the paragraph
Double spaceBefore = p.getSpaceBefore();
if (spaceBefore == null) spaceBefore = 0d;
if(spaceBefore > 0) {
// positive value means percentage spacing of the height of the first line, e.g.
// the higher the first line, the bigger the space before the paragraph
y += spaceBefore*0.01*dp.getFirstLineHeight();
} else {
// negative value means the absolute spacing in points
y += -spaceBefore;
}
}
isFirstLine = false;
dp.setPosition(x, y);
dp.draw(graphics);
y += dp.getY();
if (paragraphs.hasNext()) {
Double spaceAfter = p.getSpaceAfter();
if (spaceAfter == null) spaceAfter = 0d;
if(spaceAfter > 0) {
// positive value means percentage spacing of the height of the last line, e.g.
// the higher the last line, the bigger the space after the paragraph
y += spaceAfter*0.01*dp.getLastLineHeight();
} else {
// negative value means the absolute spacing in points
y += -spaceAfter;
}
}
}
return y - y0;
}
/**
* Compute the cumulative height occupied by the text
*/
public double getTextHeight(){
// dry-run in a 1x1 image and return the vertical advance
BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = img.createGraphics();
fixFonts(graphics);
return drawParagraphs(graphics, 0, 0);
}
@SuppressWarnings("unchecked")
private static void fixFonts(Graphics2D graphics) {
if (!JvmBugs.hasLineBreakMeasurerBug()) return;
Map<String,String> fontMap = (Map<String,String>)graphics.getRenderingHint(Drawable.FONT_MAP);
if (fontMap == null) {
fontMap = new HashMap<String,String>();
graphics.setRenderingHint(Drawable.FONT_MAP, fontMap);
}
if (!fontMap.containsKey("Calibri")) fontMap.put("Calibri", "Lucida Sans");
if (!fontMap.containsKey("Cambria")) fontMap.put("Cambria", "Lucida Bright");
}
}

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.sl.draw;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import org.apache.poi.util.Internal;
public interface Drawable {
class DrawableHint extends RenderingHints.Key {
protected DrawableHint(int id) {
super(id);
}
public boolean isCompatibleValue(Object val) {
return true;
}
public String toString() {
switch (intKey()) {
case 1: return "DRAW_FACTORY";
case 2: return "GROUP_TRANSFORM";
case 3: return "IMAGE_RENDERER";
case 4: return "TEXT_RENDERING_MODE";
case 5: return "GRADIENT_SHAPE";
case 6: return "PRESET_GEOMETRY_CACHE";
case 7: return "FONT_HANDLER";
case 8: return "FONT_FALLBACK";
case 9: return "FONT_MAP";
case 10: return "GSAVE";
case 11: return "GRESTORE";
default: return "UNKNOWN_ID "+intKey();
}
}
}
/**
* {@link DrawFactory} which will be used to draw objects into this graphics context
*/
DrawableHint DRAW_FACTORY = new DrawableHint(1);
/**
* Key will be internally used to store affine transformation temporarily within group shapes
*/
@Internal
DrawableHint GROUP_TRANSFORM = new DrawableHint(2);
/**
* Use a custom image renderer of an instance of {@link ImageRenderer}
*/
DrawableHint IMAGE_RENDERER = new DrawableHint(3);
/**
* how to render text:
*
* {@link #TEXT_AS_CHARACTERS} (default) means to draw via
* {@link java.awt.Graphics2D#drawString(java.text.AttributedCharacterIterator, float, float)}.
* This mode draws text as characters. Use it if the target graphics writes the actual
* character codes instead of glyph outlines (PDFGraphics2D, SVGGraphics2D, etc.)
*
* {@link #TEXT_AS_SHAPES} means to render via
* {@link java.awt.font.TextLayout#draw(java.awt.Graphics2D, float, float)}.
* This mode draws glyphs as shapes and provides some advanced capabilities such as
* justification and font substitution. Use it if the target graphics is an image.
*
*/
DrawableHint TEXT_RENDERING_MODE = new DrawableHint(4);
/**
* PathGradientPaint needs the shape to be set.
* It will be achieved through setting it in the rendering hints
*/
DrawableHint GRADIENT_SHAPE = new DrawableHint(5);
/**
* Internal key for caching the preset geometries
*/
DrawableHint PRESET_GEOMETRY_CACHE = new DrawableHint(6);
/**
* draw text via {@link java.awt.Graphics2D#drawString(java.text.AttributedCharacterIterator, float, float)}
*/
int TEXT_AS_CHARACTERS = 1;
/**
* draw text via {@link java.awt.font.TextLayout#draw(java.awt.Graphics2D, float, float)}
*/
int TEXT_AS_SHAPES = 2;
/**
* Use this object to resolve unknown / missing fonts when rendering slides
*/
DrawableHint FONT_HANDLER = new DrawableHint(7);
DrawableHint FONT_FALLBACK = new DrawableHint(8);
DrawableHint FONT_MAP = new DrawableHint(9);
DrawableHint GSAVE = new DrawableHint(10);
DrawableHint GRESTORE = new DrawableHint(11);
/**
* Apply 2-D transforms before drawing this shape. This includes rotation and flipping.
*
* @param graphics the graphics whos transform matrix will be modified
*/
void applyTransform(Graphics2D graphics);
/**
* Draw this shape into the supplied canvas
*
* @param graphics the graphics to draw into
*/
void draw(Graphics2D graphics);
/**
* draw any content within this shape (image, text, etc.).
*
* @param graphics the graphics to draw into
*/
void drawContent(Graphics2D graphics);
}

View File

@ -0,0 +1,192 @@
/*
* ====================================================================
* 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.sl.draw;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.RescaleOp;
import java.io.*;
import javax.imageio.ImageIO;
/**
* For now this class renders only images supported by the javax.imageio.ImageIO
* framework. Subclasses can override this class to support other formats, for
* example, use Apache Batik to render WMF, PICT can be rendered using Apple QuickTime API for Java:
*
* <pre>
* <code>
* public class MyImageRendener extends ImageRendener {
* InputStream data;
*
* public boolean drawImage(Graphics2D graphics,Rectangle2D anchor,Insets clip) {
* // draw image
* DataInputStream is = new DataInputStream(data);
* org.apache.batik.transcoder.wmf.tosvg.WMFRecordStore wmfStore =
* new org.apache.batik.transcoder.wmf.tosvg.WMFRecordStore();
* try {
* wmfStore.read(is);
* } catch (IOException e){
* return;
* }
*
* float scale = (float)anchor.width/wmfStore.getWidthPixels();
*
* org.apache.batik.transcoder.wmf.tosvg.WMFPainter painter =
* new org.apache.batik.transcoder.wmf.tosvg.WMFPainter(wmfStore, 0, 0, scale);
* graphics.translate(anchor.x, anchor.y);
* painter.paint(graphics);
* }
*
* public void loadImage(InputStream data, String contentType) throws IOException {
* if ("image/wmf".equals(contentType)) {
* this.data = data;
* // use Apache Batik to handle WMF
* } else {
* super.loadImage(data,contentType);
* }
* }
* }
* </code>
* </pre>
*
* and then pass this class to your instance of java.awt.Graphics2D:
*
* <pre>
* <code>
* graphics.setRenderingHint(Drawable.IMAGE_RENDERER, new MyImageRendener());
* </code>
* </pre>
*/
public class ImageRenderer {
protected BufferedImage img;
/**
* Load and buffer the image
*
* @param data the raw image stream
* @param contentType the content type
*/
public void loadImage(InputStream data, String contentType) throws IOException {
img = convertBufferedImage(ImageIO.read(data));
}
/**
* Load and buffer the image
*
* @param data the raw image stream
* @param contentType the content type
*/
public void loadImage(byte data[], String contentType) throws IOException {
img = convertBufferedImage(ImageIO.read(new ByteArrayInputStream(data)));
}
protected static BufferedImage convertBufferedImage(BufferedImage img) {
BufferedImage bi = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics g = bi.getGraphics();
g.drawImage(img, 0, 0, null);
g.dispose();
return bi;
}
/**
* @return the buffered image
*/
public BufferedImage getImage() {
return img;
}
/**
* @return the dimension of the buffered image
*/
public Dimension getDimension() {
return (img == null)
? new Dimension(0,0)
: new Dimension(img.getWidth(),img.getHeight());
}
/**
* @param alpha the alpha [0..1] to be added to the image (possibly already containing an alpha channel)
*/
public void setAlpha(double alpha) {
if (img == null) return;
Dimension dim = getDimension();
BufferedImage newImg = new BufferedImage((int)dim.getWidth(), (int)dim.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g = newImg.createGraphics();
RescaleOp op = new RescaleOp(new float[]{1.0f, 1.0f, 1.0f, (float)alpha}, new float[]{0,0,0,0}, null);
g.drawImage(img, op, 0, 0);
g.dispose();
img = newImg;
}
/**
* Render picture data into the supplied graphics
*
* @return true if the picture data was successfully rendered
*/
public boolean drawImage(
Graphics2D graphics,
Rectangle2D anchor) {
return drawImage(graphics, anchor, null);
}
/**
* Render picture data into the supplied graphics
*
* @return true if the picture data was successfully rendered
*/
public boolean drawImage(
Graphics2D graphics,
Rectangle2D anchor,
Insets clip) {
if (img == null) return false;
boolean isClipped = true;
if (clip == null) {
isClipped = false;
clip = new Insets(0,0,0,0);
}
int iw = img.getWidth();
int ih = img.getHeight();
double cw = (100000-clip.left-clip.right) / 100000.0;
double ch = (100000-clip.top-clip.bottom) / 100000.0;
double sx = anchor.getWidth()/(iw*cw);
double sy = anchor.getHeight()/(ih*ch);
double tx = anchor.getX()-(iw*sx*clip.left/100000.0);
double ty = anchor.getY()-(ih*sy*clip.top/100000.0);
AffineTransform at = new AffineTransform(sx, 0, 0, sy, tx, ty) ;
Shape clipOld = graphics.getClip();
if (isClipped) graphics.clip(anchor.getBounds2D());
graphics.drawRenderedImage(img, at);
graphics.setClip(clipOld);
return true;
}
}

View File

@ -0,0 +1,186 @@
/* ====================================================================
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.sl.draw;
import java.awt.*;
import java.awt.MultipleGradientPaint.ColorSpaceType;
import java.awt.MultipleGradientPaint.CycleMethod;
import java.awt.geom.*;
import java.awt.image.*;
class PathGradientPaint implements Paint {
// http://asserttrue.blogspot.de/2010/01/how-to-iimplement-custom-paint-in-50.html
protected final Color colors[];
protected final float fractions[];
protected final int capStyle;
protected final int joinStyle;
protected final int transparency;
public PathGradientPaint(Color colors[], float fractions[]) {
this(colors,fractions,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND);
}
public PathGradientPaint(Color colors[], float fractions[], int capStyle, int joinStyle) {
this.colors = colors;
this.fractions = fractions;
this.capStyle = capStyle;
this.joinStyle = joinStyle;
// determine transparency
boolean opaque = true;
for (int i = 0; i < colors.length; i++){
opaque = opaque && (colors[i].getAlpha() == 0xff);
}
this.transparency = opaque ? OPAQUE : TRANSLUCENT;
}
public PaintContext createContext(ColorModel cm,
Rectangle deviceBounds,
Rectangle2D userBounds,
AffineTransform transform,
RenderingHints hints) {
return new PathGradientContext(cm, deviceBounds, userBounds, transform, hints);
}
public int getTransparency() {
return transparency;
}
class PathGradientContext implements PaintContext {
protected final Rectangle deviceBounds;
protected final Rectangle2D userBounds;
protected final AffineTransform xform;
protected final RenderingHints hints;
/**
* for POI: the shape will be only known when the subclasses determines the concrete implementation
* in the draw/-content method, so we need to postpone the setting/creation as long as possible
**/
protected final Shape shape;
protected final PaintContext pCtx;
protected final int gradientSteps;
WritableRaster raster;
public PathGradientContext(
ColorModel cm
, Rectangle deviceBounds
, Rectangle2D userBounds
, AffineTransform xform
, RenderingHints hints
) {
shape = (Shape)hints.get(Drawable.GRADIENT_SHAPE);
if (shape == null) {
throw new IllegalPathStateException("PathGradientPaint needs a shape to be set via the rendering hint PathGradientPaint.GRADIANT_SHAPE.");
}
this.deviceBounds = deviceBounds;
this.userBounds = userBounds;
this.xform = xform;
this.hints = hints;
gradientSteps = getGradientSteps(shape);
Point2D start = new Point2D.Double(0, 0);
Point2D end = new Point2D.Double(gradientSteps, 0);
LinearGradientPaint gradientPaint = new LinearGradientPaint(start, end, fractions, colors, CycleMethod.NO_CYCLE, ColorSpaceType.SRGB, new AffineTransform());
Rectangle bounds = new Rectangle(0, 0, gradientSteps, 1);
pCtx = gradientPaint.createContext(cm, bounds, bounds, new AffineTransform(), hints);
}
public void dispose() {}
public ColorModel getColorModel() {
return pCtx.getColorModel();
}
public Raster getRaster(int xOffset, int yOffset, int w, int h) {
ColorModel cm = getColorModel();
if (raster == null) createRaster();
// TODO: eventually use caching here
WritableRaster childRaster = cm.createCompatibleWritableRaster(w, h);
Rectangle2D childRect = new Rectangle2D.Double(xOffset, yOffset, w, h);
if (!childRect.intersects(deviceBounds)) {
// usually doesn't happen ...
return childRaster;
}
Rectangle2D destRect = new Rectangle2D.Double();
Rectangle2D.intersect(childRect, deviceBounds, destRect);
int dx = (int)(destRect.getX()-deviceBounds.getX());
int dy = (int)(destRect.getY()-deviceBounds.getY());
int dw = (int)destRect.getWidth();
int dh = (int)destRect.getHeight();
Object data = raster.getDataElements(dx, dy, dw, dh, null);
dx = (int)(destRect.getX()-childRect.getX());
dy = (int)(destRect.getY()-childRect.getY());
childRaster.setDataElements(dx, dy, dw, dh, data);
return childRaster;
}
protected int getGradientSteps(Shape shape) {
Rectangle rect = shape.getBounds();
int lower = 1;
int upper = (int)(Math.max(rect.getWidth(),rect.getHeight())/2.0);
while (lower < upper-1) {
int mid = lower + (upper - lower) / 2;
BasicStroke bs = new BasicStroke(mid, capStyle, joinStyle);
Area area = new Area(bs.createStrokedShape(shape));
if (area.isSingular()) {
upper = mid;
} else {
lower = mid;
}
}
return upper;
}
protected void createRaster() {
ColorModel cm = getColorModel();
raster = cm.createCompatibleWritableRaster((int)deviceBounds.getWidth(), (int)deviceBounds.getHeight());
BufferedImage img = new BufferedImage(cm, raster, false, null);
Graphics2D graphics = img.createGraphics();
graphics.setRenderingHints(hints);
graphics.translate(-deviceBounds.getX(), -deviceBounds.getY());
graphics.transform(xform);
Raster img2 = pCtx.getRaster(0, 0, gradientSteps, 1);
int rgb[] = new int[cm.getNumComponents()];
for (int i = gradientSteps-1; i>=0; i--) {
img2.getPixel(i, 0, rgb);
Color c = new Color(rgb[0],rgb[1],rgb[2]);
if (rgb.length == 4) {
// it doesn't work to use just a color with transparency ...
graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC, rgb[3]/255.0f));
}
graphics.setStroke(new BasicStroke(i+1, capStyle, joinStyle));
graphics.setColor(c);
graphics.draw(shape);
}
graphics.dispose();
}
}
}

View File

@ -0,0 +1,109 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_AdjPoint2D complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_AdjPoint2D">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="x" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjCoordinate" />
* &lt;attribute name="y" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjCoordinate" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_AdjPoint2D", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTAdjPoint2D {
@XmlAttribute(required = true)
protected String x;
@XmlAttribute(required = true)
protected String y;
/**
* Gets the value of the x property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getX() {
return x;
}
/**
* Sets the value of the x property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setX(String value) {
this.x = value;
}
public boolean isSetX() {
return (this.x!= null);
}
/**
* Gets the value of the y property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getY() {
return y;
}
/**
* Sets the value of the y property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setY(String value) {
this.y = value;
}
public boolean isSetY() {
return (this.y!= null);
}
}

View File

@ -0,0 +1,99 @@
/* ====================================================================
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.sl.draw.binding;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_AdjustHandleList complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_AdjustHandleList">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;choice maxOccurs="unbounded" minOccurs="0">
* &lt;element name="ahXY" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_XYAdjustHandle"/>
* &lt;element name="ahPolar" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_PolarAdjustHandle"/>
* &lt;/choice>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_AdjustHandleList", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"ahXYOrAhPolar"
})
public class CTAdjustHandleList {
@XmlElements({
@XmlElement(name = "ahXY", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = CTXYAdjustHandle.class),
@XmlElement(name = "ahPolar", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = CTPolarAdjustHandle.class)
})
protected List<Object> ahXYOrAhPolar;
/**
* Gets the value of the ahXYOrAhPolar property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the ahXYOrAhPolar property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAhXYOrAhPolar().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CTXYAdjustHandle }
* {@link CTPolarAdjustHandle }
*
*
*/
public List<Object> getAhXYOrAhPolar() {
if (ahXYOrAhPolar == null) {
ahXYOrAhPolar = new ArrayList<Object>();
}
return this.ahXYOrAhPolar;
}
public boolean isSetAhXYOrAhPolar() {
return ((this.ahXYOrAhPolar!= null)&&(!this.ahXYOrAhPolar.isEmpty()));
}
public void unsetAhXYOrAhPolar() {
this.ahXYOrAhPolar = null;
}
}

View File

@ -0,0 +1,70 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_Angle complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_Angle">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="val" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_Angle" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_Angle", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTAngle {
@XmlAttribute(required = true)
protected int val;
/**
* Gets the value of the val property.
*
*/
public int getVal() {
return val;
}
/**
* Sets the value of the val property.
*
*/
public void setVal(int value) {
this.val = value;
}
public boolean isSetVal() {
return true;
}
}

View File

@ -0,0 +1,237 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_Color complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_Color">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;group ref="{http://schemas.openxmlformats.org/drawingml/2006/main}EG_ColorChoice"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_Color", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"scrgbClr",
"srgbClr",
"hslClr",
"sysClr",
"schemeClr",
"prstClr"
})
public class CTColor {
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTScRgbColor scrgbClr;
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTSRgbColor srgbClr;
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTHslColor hslClr;
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTSystemColor sysClr;
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTSchemeColor schemeClr;
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTPresetColor prstClr;
/**
* Gets the value of the scrgbClr property.
*
* @return
* possible object is
* {@link CTScRgbColor }
*
*/
public CTScRgbColor getScrgbClr() {
return scrgbClr;
}
/**
* Sets the value of the scrgbClr property.
*
* @param value
* allowed object is
* {@link CTScRgbColor }
*
*/
public void setScrgbClr(CTScRgbColor value) {
this.scrgbClr = value;
}
public boolean isSetScrgbClr() {
return (this.scrgbClr!= null);
}
/**
* Gets the value of the srgbClr property.
*
* @return
* possible object is
* {@link CTSRgbColor }
*
*/
public CTSRgbColor getSrgbClr() {
return srgbClr;
}
/**
* Sets the value of the srgbClr property.
*
* @param value
* allowed object is
* {@link CTSRgbColor }
*
*/
public void setSrgbClr(CTSRgbColor value) {
this.srgbClr = value;
}
public boolean isSetSrgbClr() {
return (this.srgbClr!= null);
}
/**
* Gets the value of the hslClr property.
*
* @return
* possible object is
* {@link CTHslColor }
*
*/
public CTHslColor getHslClr() {
return hslClr;
}
/**
* Sets the value of the hslClr property.
*
* @param value
* allowed object is
* {@link CTHslColor }
*
*/
public void setHslClr(CTHslColor value) {
this.hslClr = value;
}
public boolean isSetHslClr() {
return (this.hslClr!= null);
}
/**
* Gets the value of the sysClr property.
*
* @return
* possible object is
* {@link CTSystemColor }
*
*/
public CTSystemColor getSysClr() {
return sysClr;
}
/**
* Sets the value of the sysClr property.
*
* @param value
* allowed object is
* {@link CTSystemColor }
*
*/
public void setSysClr(CTSystemColor value) {
this.sysClr = value;
}
public boolean isSetSysClr() {
return (this.sysClr!= null);
}
/**
* Gets the value of the schemeClr property.
*
* @return
* possible object is
* {@link CTSchemeColor }
*
*/
public CTSchemeColor getSchemeClr() {
return schemeClr;
}
/**
* Sets the value of the schemeClr property.
*
* @param value
* allowed object is
* {@link CTSchemeColor }
*
*/
public void setSchemeClr(CTSchemeColor value) {
this.schemeClr = value;
}
public boolean isSetSchemeClr() {
return (this.schemeClr!= null);
}
/**
* Gets the value of the prstClr property.
*
* @return
* possible object is
* {@link CTPresetColor }
*
*/
public CTPresetColor getPrstClr() {
return prstClr;
}
/**
* Sets the value of the prstClr property.
*
* @param value
* allowed object is
* {@link CTPresetColor }
*
*/
public void setPrstClr(CTPresetColor value) {
this.prstClr = value;
}
public boolean isSetPrstClr() {
return (this.prstClr!= null);
}
}

View File

@ -0,0 +1,106 @@
/* ====================================================================
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.sl.draw.binding;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_ColorMRU complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_ColorMRU">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;group ref="{http://schemas.openxmlformats.org/drawingml/2006/main}EG_ColorChoice" maxOccurs="10" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_ColorMRU", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"egColorChoice"
})
public class CTColorMRU {
@XmlElements({
@XmlElement(name = "prstClr", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = CTPresetColor.class),
@XmlElement(name = "sysClr", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = CTSystemColor.class),
@XmlElement(name = "hslClr", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = CTHslColor.class),
@XmlElement(name = "srgbClr", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = CTSRgbColor.class),
@XmlElement(name = "scrgbClr", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = CTScRgbColor.class),
@XmlElement(name = "schemeClr", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = CTSchemeColor.class)
})
protected List<Object> egColorChoice;
/**
* Gets the value of the egColorChoice property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the egColorChoice property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getEGColorChoice().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CTPresetColor }
* {@link CTSystemColor }
* {@link CTHslColor }
* {@link CTSRgbColor }
* {@link CTScRgbColor }
* {@link CTSchemeColor }
*
*
*/
public List<Object> getEGColorChoice() {
if (egColorChoice == null) {
egColorChoice = new ArrayList<Object>();
}
return this.egColorChoice;
}
public boolean isSetEGColorChoice() {
return ((this.egColorChoice!= null)&&(!this.egColorChoice.isEmpty()));
}
public void unsetEGColorChoice() {
this.egColorChoice = null;
}
}

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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_ComplementTransform complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_ComplementTransform">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_ComplementTransform", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTComplementTransform {
}

View File

@ -0,0 +1,95 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_Connection complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_Connection">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="id" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_DrawingElementId" />
* &lt;attribute name="idx" use="required" type="{http://www.w3.org/2001/XMLSchema}unsignedInt" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_Connection", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTConnection {
@XmlAttribute(required = true)
protected long id;
@XmlAttribute(required = true)
@XmlSchemaType(name = "unsignedInt")
protected long idx;
/**
* Gets the value of the id property.
*
*/
public long getId() {
return id;
}
/**
* Sets the value of the id property.
*
*/
public void setId(long value) {
this.id = value;
}
public boolean isSetId() {
return true;
}
/**
* Gets the value of the idx property.
*
*/
public long getIdx() {
return idx;
}
/**
* Sets the value of the idx property.
*
*/
public void setIdx(long value) {
this.idx = value;
}
public boolean isSetIdx() {
return true;
}
}

View File

@ -0,0 +1,114 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_ConnectionSite complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_ConnectionSite">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="pos" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_AdjPoint2D"/>
* &lt;/sequence>
* &lt;attribute name="ang" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjAngle" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_ConnectionSite", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"pos"
})
public class CTConnectionSite {
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", required = true)
protected CTAdjPoint2D pos;
@XmlAttribute(required = true)
protected String ang;
/**
* Gets the value of the pos property.
*
* @return
* possible object is
* {@link CTAdjPoint2D }
*
*/
public CTAdjPoint2D getPos() {
return pos;
}
/**
* Sets the value of the pos property.
*
* @param value
* allowed object is
* {@link CTAdjPoint2D }
*
*/
public void setPos(CTAdjPoint2D value) {
this.pos = value;
}
public boolean isSetPos() {
return (this.pos!= null);
}
/**
* Gets the value of the ang property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAng() {
return ang;
}
/**
* Sets the value of the ang property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAng(String value) {
this.ang = value;
}
public boolean isSetAng() {
return (this.ang!= null);
}
}

View File

@ -0,0 +1,93 @@
/* ====================================================================
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.sl.draw.binding;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_ConnectionSiteList complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_ConnectionSiteList">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="cxn" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_ConnectionSite" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_ConnectionSiteList", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"cxn"
})
public class CTConnectionSiteList {
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected List<CTConnectionSite> cxn;
/**
* Gets the value of the cxn property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the cxn property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getCxn().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CTConnectionSite }
*
*
*/
public List<CTConnectionSite> getCxn() {
if (cxn == null) {
cxn = new ArrayList<CTConnectionSite>();
}
return this.cxn;
}
public boolean isSetCxn() {
return ((this.cxn!= null)&&(!this.cxn.isEmpty()));
}
public void unsetCxn() {
this.cxn = null;
}
}

View File

@ -0,0 +1,242 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_CustomGeometry2D complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_CustomGeometry2D">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="avLst" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_GeomGuideList" minOccurs="0"/>
* &lt;element name="gdLst" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_GeomGuideList" minOccurs="0"/>
* &lt;element name="ahLst" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_AdjustHandleList" minOccurs="0"/>
* &lt;element name="cxnLst" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_ConnectionSiteList" minOccurs="0"/>
* &lt;element name="rect" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_GeomRect" minOccurs="0"/>
* &lt;element name="pathLst" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_Path2DList"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_CustomGeometry2D", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"avLst",
"gdLst",
"ahLst",
"cxnLst",
"rect",
"pathLst"
})
public class CTCustomGeometry2D {
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTGeomGuideList avLst;
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTGeomGuideList gdLst;
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTAdjustHandleList ahLst;
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTConnectionSiteList cxnLst;
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTGeomRect rect;
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", required = true)
protected CTPath2DList pathLst;
/**
* Gets the value of the avLst property.
*
* @return
* possible object is
* {@link CTGeomGuideList }
*
*/
public CTGeomGuideList getAvLst() {
return avLst;
}
/**
* Sets the value of the avLst property.
*
* @param value
* allowed object is
* {@link CTGeomGuideList }
*
*/
public void setAvLst(CTGeomGuideList value) {
this.avLst = value;
}
public boolean isSetAvLst() {
return (this.avLst!= null);
}
/**
* Gets the value of the gdLst property.
*
* @return
* possible object is
* {@link CTGeomGuideList }
*
*/
public CTGeomGuideList getGdLst() {
return gdLst;
}
/**
* Sets the value of the gdLst property.
*
* @param value
* allowed object is
* {@link CTGeomGuideList }
*
*/
public void setGdLst(CTGeomGuideList value) {
this.gdLst = value;
}
public boolean isSetGdLst() {
return (this.gdLst!= null);
}
/**
* Gets the value of the ahLst property.
*
* @return
* possible object is
* {@link CTAdjustHandleList }
*
*/
public CTAdjustHandleList getAhLst() {
return ahLst;
}
/**
* Sets the value of the ahLst property.
*
* @param value
* allowed object is
* {@link CTAdjustHandleList }
*
*/
public void setAhLst(CTAdjustHandleList value) {
this.ahLst = value;
}
public boolean isSetAhLst() {
return (this.ahLst!= null);
}
/**
* Gets the value of the cxnLst property.
*
* @return
* possible object is
* {@link CTConnectionSiteList }
*
*/
public CTConnectionSiteList getCxnLst() {
return cxnLst;
}
/**
* Sets the value of the cxnLst property.
*
* @param value
* allowed object is
* {@link CTConnectionSiteList }
*
*/
public void setCxnLst(CTConnectionSiteList value) {
this.cxnLst = value;
}
public boolean isSetCxnLst() {
return (this.cxnLst!= null);
}
/**
* Gets the value of the rect property.
*
* @return
* possible object is
* {@link CTGeomRect }
*
*/
public CTGeomRect getRect() {
return rect;
}
/**
* Sets the value of the rect property.
*
* @param value
* allowed object is
* {@link CTGeomRect }
*
*/
public void setRect(CTGeomRect value) {
this.rect = value;
}
public boolean isSetRect() {
return (this.rect!= null);
}
/**
* Gets the value of the pathLst property.
*
* @return
* possible object is
* {@link CTPath2DList }
*
*/
public CTPath2DList getPathLst() {
return pathLst;
}
/**
* Sets the value of the pathLst property.
*
* @param value
* allowed object is
* {@link CTPath2DList }
*
*/
public void setPathLst(CTPath2DList value) {
this.pathLst = value;
}
public boolean isSetPathLst() {
return (this.pathLst!= null);
}
}

View File

@ -0,0 +1,152 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_EmbeddedWAVAudioFile complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_EmbeddedWAVAudioFile">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute ref="{http://schemas.openxmlformats.org/officeDocument/2006/relationships}embed use="required""/>
* &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
* &lt;attribute name="builtIn" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_EmbeddedWAVAudioFile", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTEmbeddedWAVAudioFile {
@XmlAttribute(namespace = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", required = true)
protected String embed;
@XmlAttribute
protected String name;
@XmlAttribute
protected Boolean builtIn;
/**
* Embedded Audio File Relationship ID
*
* @return
* possible object is
* {@link String }
*
*/
public String getEmbed() {
return embed;
}
/**
* Sets the value of the embed property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEmbed(String value) {
this.embed = value;
}
public boolean isSetEmbed() {
return (this.embed!= null);
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
if (name == null) {
return "";
} else {
return name;
}
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
public boolean isSetName() {
return (this.name!= null);
}
/**
* Gets the value of the builtIn property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public boolean isBuiltIn() {
if (builtIn == null) {
return false;
} else {
return builtIn;
}
}
/**
* Sets the value of the builtIn property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setBuiltIn(boolean value) {
this.builtIn = value;
}
public boolean isSetBuiltIn() {
return (this.builtIn!= null);
}
public void unsetBuiltIn() {
this.builtIn = null;
}
}

View File

@ -0,0 +1,70 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_FixedPercentage complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_FixedPercentage">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="val" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_FixedPercentage" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_FixedPercentage", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTFixedPercentage {
@XmlAttribute(required = true)
protected int val;
/**
* Gets the value of the val property.
*
*/
public int getVal() {
return val;
}
/**
* Sets the value of the val property.
*
*/
public void setVal(int value) {
this.val = value;
}
public boolean isSetVal() {
return true;
}
}

View File

@ -14,16 +14,33 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xslf.usermodel;
package org.apache.poi.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* Represents the shape decoration that appears at the ends of lines.
* <p>Java class for CT_GammaTransform complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_GammaTransform">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
public enum LineDecoration {
NONE,
TRIANGLE,
STEALTH,
DIAMOND,
OVAL,
ARROW
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_GammaTransform", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTGammaTransform {
}

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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* <p>Java class for CT_GeomGuide complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_GeomGuide">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="name" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_GeomGuideName" />
* &lt;attribute name="fmla" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_GeomGuideFormula" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_GeomGuide", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTGeomGuide {
@XmlAttribute(required = true)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
protected String name;
@XmlAttribute(required = true)
protected String fmla;
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
public boolean isSetName() {
return (this.name!= null);
}
/**
* Gets the value of the fmla property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFmla() {
return fmla;
}
/**
* Sets the value of the fmla property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFmla(String value) {
this.fmla = value;
}
public boolean isSetFmla() {
return (this.fmla!= null);
}
}

View File

@ -0,0 +1,93 @@
/* ====================================================================
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.sl.draw.binding;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_GeomGuideList complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_GeomGuideList">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="gd" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_GeomGuide" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_GeomGuideList", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"gd"
})
public class CTGeomGuideList {
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected List<CTGeomGuide> gd;
/**
* Gets the value of the gd property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the gd property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getGd().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CTGeomGuide }
*
*
*/
public List<CTGeomGuide> getGd() {
if (gd == null) {
gd = new ArrayList<CTGeomGuide>();
}
return this.gd;
}
public boolean isSetGd() {
return ((this.gd!= null)&&(!this.gd.isEmpty()));
}
public void unsetGd() {
this.gd = null;
}
}

View File

@ -0,0 +1,171 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_GeomRect complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_GeomRect">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="l" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjCoordinate" />
* &lt;attribute name="t" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjCoordinate" />
* &lt;attribute name="r" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjCoordinate" />
* &lt;attribute name="b" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjCoordinate" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_GeomRect", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTGeomRect {
@XmlAttribute(required = true)
protected String l;
@XmlAttribute(required = true)
protected String t;
@XmlAttribute(required = true)
protected String r;
@XmlAttribute(required = true)
protected String b;
/**
* Gets the value of the l property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getL() {
return l;
}
/**
* Sets the value of the l property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setL(String value) {
this.l = value;
}
public boolean isSetL() {
return (this.l!= null);
}
/**
* Gets the value of the t property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getT() {
return t;
}
/**
* Sets the value of the t property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setT(String value) {
this.t = value;
}
public boolean isSetT() {
return (this.t!= null);
}
/**
* Gets the value of the r property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getR() {
return r;
}
/**
* Sets the value of the r property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setR(String value) {
this.r = value;
}
public boolean isSetR() {
return (this.r!= null);
}
/**
* Gets the value of the b property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getB() {
return b;
}
/**
* Sets the value of the b property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setB(String value) {
this.b = value;
}
public boolean isSetB() {
return (this.b!= null);
}
}

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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_GrayscaleTransform complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_GrayscaleTransform">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_GrayscaleTransform", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTGrayscaleTransform {
}

View File

@ -0,0 +1,296 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_GroupTransform2D complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_GroupTransform2D">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="off" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_Point2D" minOccurs="0"/>
* &lt;element name="ext" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_PositiveSize2D" minOccurs="0"/>
* &lt;element name="chOff" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_Point2D" minOccurs="0"/>
* &lt;element name="chExt" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_PositiveSize2D" minOccurs="0"/>
* &lt;/sequence>
* &lt;attribute name="rot" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_Angle" default="0" />
* &lt;attribute name="flipH" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
* &lt;attribute name="flipV" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_GroupTransform2D", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"off",
"ext",
"chOff",
"chExt"
})
public class CTGroupTransform2D {
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTPoint2D off;
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTPositiveSize2D ext;
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTPoint2D chOff;
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTPositiveSize2D chExt;
@XmlAttribute
protected Integer rot;
@XmlAttribute
protected Boolean flipH;
@XmlAttribute
protected Boolean flipV;
/**
* Gets the value of the off property.
*
* @return
* possible object is
* {@link CTPoint2D }
*
*/
public CTPoint2D getOff() {
return off;
}
/**
* Sets the value of the off property.
*
* @param value
* allowed object is
* {@link CTPoint2D }
*
*/
public void setOff(CTPoint2D value) {
this.off = value;
}
public boolean isSetOff() {
return (this.off!= null);
}
/**
* Gets the value of the ext property.
*
* @return
* possible object is
* {@link CTPositiveSize2D }
*
*/
public CTPositiveSize2D getExt() {
return ext;
}
/**
* Sets the value of the ext property.
*
* @param value
* allowed object is
* {@link CTPositiveSize2D }
*
*/
public void setExt(CTPositiveSize2D value) {
this.ext = value;
}
public boolean isSetExt() {
return (this.ext!= null);
}
/**
* Gets the value of the chOff property.
*
* @return
* possible object is
* {@link CTPoint2D }
*
*/
public CTPoint2D getChOff() {
return chOff;
}
/**
* Sets the value of the chOff property.
*
* @param value
* allowed object is
* {@link CTPoint2D }
*
*/
public void setChOff(CTPoint2D value) {
this.chOff = value;
}
public boolean isSetChOff() {
return (this.chOff!= null);
}
/**
* Gets the value of the chExt property.
*
* @return
* possible object is
* {@link CTPositiveSize2D }
*
*/
public CTPositiveSize2D getChExt() {
return chExt;
}
/**
* Sets the value of the chExt property.
*
* @param value
* allowed object is
* {@link CTPositiveSize2D }
*
*/
public void setChExt(CTPositiveSize2D value) {
this.chExt = value;
}
public boolean isSetChExt() {
return (this.chExt!= null);
}
/**
* Gets the value of the rot property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public int getRot() {
if (rot == null) {
return 0;
} else {
return rot;
}
}
/**
* Sets the value of the rot property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setRot(int value) {
this.rot = value;
}
public boolean isSetRot() {
return (this.rot!= null);
}
public void unsetRot() {
this.rot = null;
}
/**
* Gets the value of the flipH property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public boolean isFlipH() {
if (flipH == null) {
return false;
} else {
return flipH;
}
}
/**
* Sets the value of the flipH property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setFlipH(boolean value) {
this.flipH = value;
}
public boolean isSetFlipH() {
return (this.flipH!= null);
}
public void unsetFlipH() {
this.flipH = null;
}
/**
* Gets the value of the flipV property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public boolean isFlipV() {
if (flipV == null) {
return false;
} else {
return flipV;
}
}
/**
* Sets the value of the flipV property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setFlipV(boolean value) {
this.flipV = value;
}
public boolean isSetFlipV() {
return (this.flipV!= null);
}
public void unsetFlipV() {
this.flipV = null;
}
}

View File

@ -0,0 +1,221 @@
/* ====================================================================
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.sl.draw.binding;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementRefs;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_HslColor complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_HslColor">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;group ref="{http://schemas.openxmlformats.org/drawingml/2006/main}EG_ColorTransform" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;attribute name="hue" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_PositiveFixedAngle" />
* &lt;attribute name="sat" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_Percentage" />
* &lt;attribute name="lum" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_Percentage" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_HslColor", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"egColorTransform"
})
public class CTHslColor {
@XmlElementRefs({
@XmlElementRef(name = "comp", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "satMod", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "tint", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "satOff", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "lum", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "gray", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "gamma", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "inv", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "red", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "alpha", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "greenOff", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "green", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "greenMod", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "blueOff", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "lumMod", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "redOff", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "hueOff", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "invGamma", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "alphaOff", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "hue", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "redMod", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "alphaMod", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "lumOff", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "blue", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "hueMod", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "blueMod", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "sat", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "shade", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class)
})
protected List<JAXBElement<?>> egColorTransform;
@XmlAttribute(required = true)
protected int hue;
@XmlAttribute(required = true)
protected int sat;
@XmlAttribute(required = true)
protected int lum;
/**
* Gets the value of the egColorTransform property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the egColorTransform property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getEGColorTransform().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link JAXBElement }{@code <}{@link CTComplementTransform }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPositiveFixedPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTGrayscaleTransform }{@code >}
* {@link JAXBElement }{@code <}{@link CTGammaTransform }{@code >}
* {@link JAXBElement }{@code <}{@link CTInverseTransform }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPositiveFixedPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTAngle }{@code >}
* {@link JAXBElement }{@code <}{@link CTInverseGammaTransform }{@code >}
* {@link JAXBElement }{@code <}{@link CTFixedPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPositiveFixedAngle }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPositivePercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPositivePercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPositiveFixedPercentage }{@code >}
*
*
*/
public List<JAXBElement<?>> getEGColorTransform() {
if (egColorTransform == null) {
egColorTransform = new ArrayList<JAXBElement<?>>();
}
return this.egColorTransform;
}
public boolean isSetEGColorTransform() {
return ((this.egColorTransform!= null)&&(!this.egColorTransform.isEmpty()));
}
public void unsetEGColorTransform() {
this.egColorTransform = null;
}
/**
* Gets the value of the hue property.
*
*/
public int getHue() {
return hue;
}
/**
* Sets the value of the hue property.
*
*/
public void setHue(int value) {
this.hue = value;
}
public boolean isSetHue() {
return true;
}
/**
* Gets the value of the sat property.
*
*/
public int getSat() {
return sat;
}
/**
* Sets the value of the sat property.
*
*/
public void setSat(int value) {
this.sat = value;
}
public boolean isSetSat() {
return true;
}
/**
* Gets the value of the lum property.
*
*/
public int getLum() {
return lum;
}
/**
* Sets the value of the lum property.
*
*/
public void setLum(int value) {
this.lum = value;
}
public boolean isSetLum() {
return true;
}
}

View File

@ -0,0 +1,403 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_Hyperlink complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_Hyperlink">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="snd" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_EmbeddedWAVAudioFile" minOccurs="0"/>
* &lt;element name="extLst" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_OfficeArtExtensionList" minOccurs="0"/>
* &lt;/sequence>
* &lt;attribute ref="{http://schemas.openxmlformats.org/officeDocument/2006/relationships}id"/>
* &lt;attribute name="invalidUrl" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
* &lt;attribute name="action" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
* &lt;attribute name="tgtFrame" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
* &lt;attribute name="tooltip" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
* &lt;attribute name="history" type="{http://www.w3.org/2001/XMLSchema}boolean" default="true" />
* &lt;attribute name="highlightClick" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
* &lt;attribute name="endSnd" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_Hyperlink", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"snd",
"extLst"
})
public class CTHyperlink {
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTEmbeddedWAVAudioFile snd;
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTOfficeArtExtensionList extLst;
@XmlAttribute(namespace = "http://schemas.openxmlformats.org/officeDocument/2006/relationships")
protected String id;
@XmlAttribute
protected String invalidUrl;
@XmlAttribute
protected String action;
@XmlAttribute
protected String tgtFrame;
@XmlAttribute
protected String tooltip;
@XmlAttribute
protected Boolean history;
@XmlAttribute
protected Boolean highlightClick;
@XmlAttribute
protected Boolean endSnd;
/**
* Gets the value of the snd property.
*
* @return
* possible object is
* {@link CTEmbeddedWAVAudioFile }
*
*/
public CTEmbeddedWAVAudioFile getSnd() {
return snd;
}
/**
* Sets the value of the snd property.
*
* @param value
* allowed object is
* {@link CTEmbeddedWAVAudioFile }
*
*/
public void setSnd(CTEmbeddedWAVAudioFile value) {
this.snd = value;
}
public boolean isSetSnd() {
return (this.snd!= null);
}
/**
* Gets the value of the extLst property.
*
* @return
* possible object is
* {@link CTOfficeArtExtensionList }
*
*/
public CTOfficeArtExtensionList getExtLst() {
return extLst;
}
/**
* Sets the value of the extLst property.
*
* @param value
* allowed object is
* {@link CTOfficeArtExtensionList }
*
*/
public void setExtLst(CTOfficeArtExtensionList value) {
this.extLst = value;
}
public boolean isSetExtLst() {
return (this.extLst!= null);
}
/**
* Drawing Object Hyperlink Target
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
public boolean isSetId() {
return (this.id!= null);
}
/**
* Gets the value of the invalidUrl property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getInvalidUrl() {
if (invalidUrl == null) {
return "";
} else {
return invalidUrl;
}
}
/**
* Sets the value of the invalidUrl property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setInvalidUrl(String value) {
this.invalidUrl = value;
}
public boolean isSetInvalidUrl() {
return (this.invalidUrl!= null);
}
/**
* Gets the value of the action property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAction() {
if (action == null) {
return "";
} else {
return action;
}
}
/**
* Sets the value of the action property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAction(String value) {
this.action = value;
}
public boolean isSetAction() {
return (this.action!= null);
}
/**
* Gets the value of the tgtFrame property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTgtFrame() {
if (tgtFrame == null) {
return "";
} else {
return tgtFrame;
}
}
/**
* Sets the value of the tgtFrame property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTgtFrame(String value) {
this.tgtFrame = value;
}
public boolean isSetTgtFrame() {
return (this.tgtFrame!= null);
}
/**
* Gets the value of the tooltip property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTooltip() {
if (tooltip == null) {
return "";
} else {
return tooltip;
}
}
/**
* Sets the value of the tooltip property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTooltip(String value) {
this.tooltip = value;
}
public boolean isSetTooltip() {
return (this.tooltip!= null);
}
/**
* Gets the value of the history property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public boolean isHistory() {
if (history == null) {
return true;
} else {
return history;
}
}
/**
* Sets the value of the history property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setHistory(boolean value) {
this.history = value;
}
public boolean isSetHistory() {
return (this.history!= null);
}
public void unsetHistory() {
this.history = null;
}
/**
* Gets the value of the highlightClick property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public boolean isHighlightClick() {
if (highlightClick == null) {
return false;
} else {
return highlightClick;
}
}
/**
* Sets the value of the highlightClick property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setHighlightClick(boolean value) {
this.highlightClick = value;
}
public boolean isSetHighlightClick() {
return (this.highlightClick!= null);
}
public void unsetHighlightClick() {
this.highlightClick = null;
}
/**
* Gets the value of the endSnd property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public boolean isEndSnd() {
if (endSnd == null) {
return false;
} else {
return endSnd;
}
}
/**
* Sets the value of the endSnd property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setEndSnd(boolean value) {
this.endSnd = value;
}
public boolean isSetEndSnd() {
return (this.endSnd!= null);
}
public void unsetEndSnd() {
this.endSnd = null;
}
}

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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_InverseGammaTransform complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_InverseGammaTransform">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_InverseGammaTransform", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTInverseGammaTransform {
}

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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_InverseTransform complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_InverseTransform">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_InverseTransform", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTInverseTransform {
}

View File

@ -0,0 +1,122 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.w3c.dom.Element;
/**
* <p>Java class for CT_OfficeArtExtension complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_OfficeArtExtension">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;any processContents='lax'/>
* &lt;/sequence>
* &lt;attribute name="uri" type="{http://www.w3.org/2001/XMLSchema}token" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_OfficeArtExtension", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"any"
})
public class CTOfficeArtExtension {
@XmlAnyElement(lax = true)
protected Object any;
@XmlAttribute
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlSchemaType(name = "token")
protected String uri;
/**
* Gets the value of the any property.
*
* @return
* possible object is
* {@link Object }
* {@link Element }
*
*/
public Object getAny() {
return any;
}
/**
* Sets the value of the any property.
*
* @param value
* allowed object is
* {@link Object }
* {@link Element }
*
*/
public void setAny(Object value) {
this.any = value;
}
public boolean isSetAny() {
return (this.any!= null);
}
/**
* Gets the value of the uri property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUri() {
return uri;
}
/**
* Sets the value of the uri property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUri(String value) {
this.uri = value;
}
public boolean isSetUri() {
return (this.uri!= null);
}
}

View File

@ -0,0 +1,93 @@
/* ====================================================================
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.sl.draw.binding;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_OfficeArtExtensionList complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_OfficeArtExtensionList">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;group ref="{http://schemas.openxmlformats.org/drawingml/2006/main}EG_OfficeArtExtensionList"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_OfficeArtExtensionList", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"ext"
})
public class CTOfficeArtExtensionList {
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected List<CTOfficeArtExtension> ext;
/**
* Gets the value of the ext property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the ext property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getExt().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CTOfficeArtExtension }
*
*
*/
public List<CTOfficeArtExtension> getExt() {
if (ext == null) {
ext = new ArrayList<CTOfficeArtExtension>();
}
return this.ext;
}
public boolean isSetExt() {
return ((this.ext!= null)&&(!this.ext.isEmpty()));
}
public void unsetExt() {
this.ext = null;
}
}

View File

@ -0,0 +1,303 @@
/* ====================================================================
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.sl.draw.binding;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_Path2D complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_Path2D">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;choice maxOccurs="unbounded" minOccurs="0">
* &lt;element name="close" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_Path2DClose"/>
* &lt;element name="moveTo" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_Path2DMoveTo"/>
* &lt;element name="lnTo" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_Path2DLineTo"/>
* &lt;element name="arcTo" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_Path2DArcTo"/>
* &lt;element name="quadBezTo" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_Path2DQuadBezierTo"/>
* &lt;element name="cubicBezTo" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_Path2DCubicBezierTo"/>
* &lt;/choice>
* &lt;attribute name="w" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_PositiveCoordinate" default="0" />
* &lt;attribute name="h" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_PositiveCoordinate" default="0" />
* &lt;attribute name="fill" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_PathFillMode" default="norm" />
* &lt;attribute name="stroke" type="{http://www.w3.org/2001/XMLSchema}boolean" default="true" />
* &lt;attribute name="extrusionOk" type="{http://www.w3.org/2001/XMLSchema}boolean" default="true" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_Path2D", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"closeOrMoveToOrLnTo"
})
public class CTPath2D {
@XmlElements({
@XmlElement(name = "lnTo", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = CTPath2DLineTo.class),
@XmlElement(name = "close", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = CTPath2DClose.class),
@XmlElement(name = "cubicBezTo", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = CTPath2DCubicBezierTo.class),
@XmlElement(name = "quadBezTo", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = CTPath2DQuadBezierTo.class),
@XmlElement(name = "arcTo", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = CTPath2DArcTo.class),
@XmlElement(name = "moveTo", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = CTPath2DMoveTo.class)
})
protected List<Object> closeOrMoveToOrLnTo;
@XmlAttribute
protected Long w;
@XmlAttribute
protected Long h;
@XmlAttribute
protected STPathFillMode fill;
@XmlAttribute
protected Boolean stroke;
@XmlAttribute
protected Boolean extrusionOk;
/**
* Gets the value of the closeOrMoveToOrLnTo property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the closeOrMoveToOrLnTo property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getCloseOrMoveToOrLnTo().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CTPath2DLineTo }
* {@link CTPath2DClose }
* {@link CTPath2DCubicBezierTo }
* {@link CTPath2DQuadBezierTo }
* {@link CTPath2DArcTo }
* {@link CTPath2DMoveTo }
*
*
*/
public List<Object> getCloseOrMoveToOrLnTo() {
if (closeOrMoveToOrLnTo == null) {
closeOrMoveToOrLnTo = new ArrayList<Object>();
}
return this.closeOrMoveToOrLnTo;
}
public boolean isSetCloseOrMoveToOrLnTo() {
return ((this.closeOrMoveToOrLnTo!= null)&&(!this.closeOrMoveToOrLnTo.isEmpty()));
}
public void unsetCloseOrMoveToOrLnTo() {
this.closeOrMoveToOrLnTo = null;
}
/**
* Gets the value of the w property.
*
* @return
* possible object is
* {@link Long }
*
*/
public long getW() {
if (w == null) {
return 0L;
} else {
return w;
}
}
/**
* Sets the value of the w property.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setW(long value) {
this.w = value;
}
public boolean isSetW() {
return (this.w!= null);
}
public void unsetW() {
this.w = null;
}
/**
* Gets the value of the h property.
*
* @return
* possible object is
* {@link Long }
*
*/
public long getH() {
if (h == null) {
return 0L;
} else {
return h;
}
}
/**
* Sets the value of the h property.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setH(long value) {
this.h = value;
}
public boolean isSetH() {
return (this.h!= null);
}
public void unsetH() {
this.h = null;
}
/**
* Gets the value of the fill property.
*
* @return
* possible object is
* {@link STPathFillMode }
*
*/
public STPathFillMode getFill() {
if (fill == null) {
return STPathFillMode.NORM;
} else {
return fill;
}
}
/**
* Sets the value of the fill property.
*
* @param value
* allowed object is
* {@link STPathFillMode }
*
*/
public void setFill(STPathFillMode value) {
this.fill = value;
}
public boolean isSetFill() {
return (this.fill!= null);
}
/**
* Gets the value of the stroke property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public boolean isStroke() {
if (stroke == null) {
return true;
} else {
return stroke;
}
}
/**
* Sets the value of the stroke property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setStroke(boolean value) {
this.stroke = value;
}
public boolean isSetStroke() {
return (this.stroke!= null);
}
public void unsetStroke() {
this.stroke = null;
}
/**
* Gets the value of the extrusionOk property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public boolean isExtrusionOk() {
if (extrusionOk == null) {
return true;
} else {
return extrusionOk;
}
}
/**
* Sets the value of the extrusionOk property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setExtrusionOk(boolean value) {
this.extrusionOk = value;
}
public boolean isSetExtrusionOk() {
return (this.extrusionOk!= null);
}
public void unsetExtrusionOk() {
this.extrusionOk = null;
}
}

View File

@ -0,0 +1,171 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_Path2DArcTo complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_Path2DArcTo">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="wR" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjCoordinate" />
* &lt;attribute name="hR" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjCoordinate" />
* &lt;attribute name="stAng" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjAngle" />
* &lt;attribute name="swAng" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjAngle" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_Path2DArcTo", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTPath2DArcTo {
@XmlAttribute(name = "wR", required = true)
protected String wr;
@XmlAttribute(name = "hR", required = true)
protected String hr;
@XmlAttribute(required = true)
protected String stAng;
@XmlAttribute(required = true)
protected String swAng;
/**
* Gets the value of the wr property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getWR() {
return wr;
}
/**
* Sets the value of the wr property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setWR(String value) {
this.wr = value;
}
public boolean isSetWR() {
return (this.wr!= null);
}
/**
* Gets the value of the hr property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHR() {
return hr;
}
/**
* Sets the value of the hr property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHR(String value) {
this.hr = value;
}
public boolean isSetHR() {
return (this.hr!= null);
}
/**
* Gets the value of the stAng property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getStAng() {
return stAng;
}
/**
* Sets the value of the stAng property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStAng(String value) {
this.stAng = value;
}
public boolean isSetStAng() {
return (this.stAng!= null);
}
/**
* Gets the value of the swAng property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSwAng() {
return swAng;
}
/**
* Sets the value of the swAng property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSwAng(String value) {
this.swAng = value;
}
public boolean isSetSwAng() {
return (this.swAng!= null);
}
}

View File

@ -14,21 +14,33 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xslf.usermodel;
package org.apache.poi.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* @author Yegor Kozlov
* <p>Java class for CT_Path2DClose complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_Path2DClose">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
public enum LineDash {
SOLID,
DOT,
DASH,
LG_DASH,
DASH_DOT,
LG_DASH_DOT,
LG_DASH_DOT_DOT,
SYS_DASH,
SYS_DOT,
SYS_DASH_DOT,
SYS_DASH_DOT_DOT;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_Path2DClose", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTPath2DClose {
}

View File

@ -0,0 +1,93 @@
/* ====================================================================
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.sl.draw.binding;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_Path2DCubicBezierTo complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_Path2DCubicBezierTo">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="pt" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_AdjPoint2D" maxOccurs="3" minOccurs="3"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_Path2DCubicBezierTo", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"pt"
})
public class CTPath2DCubicBezierTo {
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", required = true)
protected List<CTAdjPoint2D> pt;
/**
* Gets the value of the pt property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the pt property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPt().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CTAdjPoint2D }
*
*
*/
public List<CTAdjPoint2D> getPt() {
if (pt == null) {
pt = new ArrayList<CTAdjPoint2D>();
}
return this.pt;
}
public boolean isSetPt() {
return ((this.pt!= null)&&(!this.pt.isEmpty()));
}
public void unsetPt() {
this.pt = null;
}
}

View File

@ -0,0 +1,82 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_Path2DLineTo complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_Path2DLineTo">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="pt" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_AdjPoint2D"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_Path2DLineTo", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"pt"
})
public class CTPath2DLineTo {
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", required = true)
protected CTAdjPoint2D pt;
/**
* Gets the value of the pt property.
*
* @return
* possible object is
* {@link CTAdjPoint2D }
*
*/
public CTAdjPoint2D getPt() {
return pt;
}
/**
* Sets the value of the pt property.
*
* @param value
* allowed object is
* {@link CTAdjPoint2D }
*
*/
public void setPt(CTAdjPoint2D value) {
this.pt = value;
}
public boolean isSetPt() {
return (this.pt!= null);
}
}

View File

@ -0,0 +1,93 @@
/* ====================================================================
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.sl.draw.binding;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_Path2DList complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_Path2DList">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="path" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_Path2D" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_Path2DList", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"path"
})
public class CTPath2DList {
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected List<CTPath2D> path;
/**
* Gets the value of the path property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the path property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPath().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CTPath2D }
*
*
*/
public List<CTPath2D> getPath() {
if (path == null) {
path = new ArrayList<CTPath2D>();
}
return this.path;
}
public boolean isSetPath() {
return ((this.path!= null)&&(!this.path.isEmpty()));
}
public void unsetPath() {
this.path = null;
}
}

View File

@ -0,0 +1,82 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_Path2DMoveTo complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_Path2DMoveTo">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="pt" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_AdjPoint2D"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_Path2DMoveTo", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"pt"
})
public class CTPath2DMoveTo {
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", required = true)
protected CTAdjPoint2D pt;
/**
* Gets the value of the pt property.
*
* @return
* possible object is
* {@link CTAdjPoint2D }
*
*/
public CTAdjPoint2D getPt() {
return pt;
}
/**
* Sets the value of the pt property.
*
* @param value
* allowed object is
* {@link CTAdjPoint2D }
*
*/
public void setPt(CTAdjPoint2D value) {
this.pt = value;
}
public boolean isSetPt() {
return (this.pt!= null);
}
}

View File

@ -0,0 +1,93 @@
/* ====================================================================
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.sl.draw.binding;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_Path2DQuadBezierTo complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_Path2DQuadBezierTo">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="pt" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_AdjPoint2D" maxOccurs="2" minOccurs="2"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_Path2DQuadBezierTo", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"pt"
})
public class CTPath2DQuadBezierTo {
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", required = true)
protected List<CTAdjPoint2D> pt;
/**
* Gets the value of the pt property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the pt property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPt().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CTAdjPoint2D }
*
*
*/
public List<CTAdjPoint2D> getPt() {
if (pt == null) {
pt = new ArrayList<CTAdjPoint2D>();
}
return this.pt;
}
public boolean isSetPt() {
return ((this.pt!= null)&&(!this.pt.isEmpty()));
}
public void unsetPt() {
this.pt = null;
}
}

View File

@ -0,0 +1,70 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_Percentage complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_Percentage">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="val" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_Percentage" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_Percentage", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTPercentage {
@XmlAttribute(required = true)
protected int val;
/**
* Gets the value of the val property.
*
*/
public int getVal() {
return val;
}
/**
* Sets the value of the val property.
*
*/
public void setVal(int value) {
this.val = value;
}
public boolean isSetVal() {
return true;
}
}

View File

@ -0,0 +1,93 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_Point2D complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_Point2D">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="x" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_Coordinate" />
* &lt;attribute name="y" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_Coordinate" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_Point2D", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTPoint2D {
@XmlAttribute(required = true)
protected long x;
@XmlAttribute(required = true)
protected long y;
/**
* Gets the value of the x property.
*
*/
public long getX() {
return x;
}
/**
* Sets the value of the x property.
*
*/
public void setX(long value) {
this.x = value;
}
public boolean isSetX() {
return true;
}
/**
* Gets the value of the y property.
*
*/
public long getY() {
return y;
}
/**
* Sets the value of the y property.
*
*/
public void setY(long value) {
this.y = value;
}
public boolean isSetY() {
return true;
}
}

View File

@ -0,0 +1,116 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_Point3D complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_Point3D">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="x" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_Coordinate" />
* &lt;attribute name="y" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_Coordinate" />
* &lt;attribute name="z" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_Coordinate" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_Point3D", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTPoint3D {
@XmlAttribute(required = true)
protected long x;
@XmlAttribute(required = true)
protected long y;
@XmlAttribute(required = true)
protected long z;
/**
* Gets the value of the x property.
*
*/
public long getX() {
return x;
}
/**
* Sets the value of the x property.
*
*/
public void setX(long value) {
this.x = value;
}
public boolean isSetX() {
return true;
}
/**
* Gets the value of the y property.
*
*/
public long getY() {
return y;
}
/**
* Sets the value of the y property.
*
*/
public void setY(long value) {
this.y = value;
}
public boolean isSetY() {
return true;
}
/**
* Gets the value of the z property.
*
*/
public long getZ() {
return z;
}
/**
* Sets the value of the z property.
*
*/
public void setZ(long value) {
this.z = value;
}
public boolean isSetZ() {
return true;
}
}

View File

@ -0,0 +1,273 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* <p>Java class for CT_PolarAdjustHandle complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_PolarAdjustHandle">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="pos" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_AdjPoint2D"/>
* &lt;/sequence>
* &lt;attribute name="gdRefR" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_GeomGuideName" />
* &lt;attribute name="minR" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjCoordinate" />
* &lt;attribute name="maxR" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjCoordinate" />
* &lt;attribute name="gdRefAng" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_GeomGuideName" />
* &lt;attribute name="minAng" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjAngle" />
* &lt;attribute name="maxAng" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjAngle" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_PolarAdjustHandle", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"pos"
})
public class CTPolarAdjustHandle {
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", required = true)
protected CTAdjPoint2D pos;
@XmlAttribute
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
protected String gdRefR;
@XmlAttribute
protected String minR;
@XmlAttribute
protected String maxR;
@XmlAttribute
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
protected String gdRefAng;
@XmlAttribute
protected String minAng;
@XmlAttribute
protected String maxAng;
/**
* Gets the value of the pos property.
*
* @return
* possible object is
* {@link CTAdjPoint2D }
*
*/
public CTAdjPoint2D getPos() {
return pos;
}
/**
* Sets the value of the pos property.
*
* @param value
* allowed object is
* {@link CTAdjPoint2D }
*
*/
public void setPos(CTAdjPoint2D value) {
this.pos = value;
}
public boolean isSetPos() {
return (this.pos!= null);
}
/**
* Gets the value of the gdRefR property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getGdRefR() {
return gdRefR;
}
/**
* Sets the value of the gdRefR property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setGdRefR(String value) {
this.gdRefR = value;
}
public boolean isSetGdRefR() {
return (this.gdRefR!= null);
}
/**
* Gets the value of the minR property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMinR() {
return minR;
}
/**
* Sets the value of the minR property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMinR(String value) {
this.minR = value;
}
public boolean isSetMinR() {
return (this.minR!= null);
}
/**
* Gets the value of the maxR property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMaxR() {
return maxR;
}
/**
* Sets the value of the maxR property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMaxR(String value) {
this.maxR = value;
}
public boolean isSetMaxR() {
return (this.maxR!= null);
}
/**
* Gets the value of the gdRefAng property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getGdRefAng() {
return gdRefAng;
}
/**
* Sets the value of the gdRefAng property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setGdRefAng(String value) {
this.gdRefAng = value;
}
public boolean isSetGdRefAng() {
return (this.gdRefAng!= null);
}
/**
* Gets the value of the minAng property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMinAng() {
return minAng;
}
/**
* Sets the value of the minAng property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMinAng(String value) {
this.minAng = value;
}
public boolean isSetMinAng() {
return (this.minAng!= null);
}
/**
* Gets the value of the maxAng property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMaxAng() {
return maxAng;
}
/**
* Sets the value of the maxAng property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMaxAng(String value) {
this.maxAng = value;
}
public boolean isSetMaxAng() {
return (this.maxAng!= null);
}
}

View File

@ -0,0 +1,70 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_PositiveFixedAngle complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_PositiveFixedAngle">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="val" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_PositiveFixedAngle" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_PositiveFixedAngle", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTPositiveFixedAngle {
@XmlAttribute(required = true)
protected int val;
/**
* Gets the value of the val property.
*
*/
public int getVal() {
return val;
}
/**
* Sets the value of the val property.
*
*/
public void setVal(int value) {
this.val = value;
}
public boolean isSetVal() {
return true;
}
}

View File

@ -0,0 +1,70 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_PositiveFixedPercentage complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_PositiveFixedPercentage">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="val" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_PositiveFixedPercentage" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_PositiveFixedPercentage", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTPositiveFixedPercentage {
@XmlAttribute(required = true)
protected int val;
/**
* Gets the value of the val property.
*
*/
public int getVal() {
return val;
}
/**
* Sets the value of the val property.
*
*/
public void setVal(int value) {
this.val = value;
}
public boolean isSetVal() {
return true;
}
}

View File

@ -0,0 +1,70 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_PositivePercentage complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_PositivePercentage">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="val" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_PositivePercentage" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_PositivePercentage", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTPositivePercentage {
@XmlAttribute(required = true)
protected int val;
/**
* Gets the value of the val property.
*
*/
public int getVal() {
return val;
}
/**
* Sets the value of the val property.
*
*/
public void setVal(int value) {
this.val = value;
}
public boolean isSetVal() {
return true;
}
}

View File

@ -0,0 +1,93 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_PositiveSize2D complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_PositiveSize2D">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="cx" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_PositiveCoordinate" />
* &lt;attribute name="cy" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_PositiveCoordinate" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_PositiveSize2D", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTPositiveSize2D {
@XmlAttribute(required = true)
protected long cx;
@XmlAttribute(required = true)
protected long cy;
/**
* Gets the value of the cx property.
*
*/
public long getCx() {
return cx;
}
/**
* Sets the value of the cx property.
*
*/
public void setCx(long value) {
this.cx = value;
}
public boolean isSetCx() {
return true;
}
/**
* Gets the value of the cy property.
*
*/
public long getCy() {
return cy;
}
/**
* Sets the value of the cy property.
*
*/
public void setCy(long value) {
this.cy = value;
}
public boolean isSetCy() {
return true;
}
}

View File

@ -0,0 +1,183 @@
/* ====================================================================
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.sl.draw.binding;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementRefs;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_PresetColor complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_PresetColor">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;group ref="{http://schemas.openxmlformats.org/drawingml/2006/main}EG_ColorTransform" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;attribute name="val" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_PresetColorVal" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_PresetColor", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"egColorTransform"
})
public class CTPresetColor {
@XmlElementRefs({
@XmlElementRef(name = "shade", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "hue", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "blue", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "satOff", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "alphaMod", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "blueOff", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "green", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "red", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "gray", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "lum", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "invGamma", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "comp", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "lumOff", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "greenOff", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "sat", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "redMod", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "greenMod", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "lumMod", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "alpha", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "alphaOff", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "hueMod", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "inv", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "hueOff", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "gamma", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "tint", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "satMod", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "redOff", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class),
@XmlElementRef(name = "blueMod", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", type = JAXBElement.class)
})
protected List<JAXBElement<?>> egColorTransform;
@XmlAttribute
protected STPresetColorVal val;
/**
* Gets the value of the egColorTransform property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the egColorTransform property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getEGColorTransform().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link JAXBElement }{@code <}{@link CTPositiveFixedPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPositiveFixedAngle }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPositivePercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTGrayscaleTransform }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTInverseGammaTransform }{@code >}
* {@link JAXBElement }{@code <}{@link CTComplementTransform }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPositiveFixedPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTFixedPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPositivePercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTInverseTransform }{@code >}
* {@link JAXBElement }{@code <}{@link CTAngle }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTGammaTransform }{@code >}
* {@link JAXBElement }{@code <}{@link CTPositiveFixedPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
* {@link JAXBElement }{@code <}{@link CTPercentage }{@code >}
*
*
*/
public List<JAXBElement<?>> getEGColorTransform() {
if (egColorTransform == null) {
egColorTransform = new ArrayList<JAXBElement<?>>();
}
return this.egColorTransform;
}
public boolean isSetEGColorTransform() {
return ((this.egColorTransform!= null)&&(!this.egColorTransform.isEmpty()));
}
public void unsetEGColorTransform() {
this.egColorTransform = null;
}
/**
* Gets the value of the val property.
*
* @return
* possible object is
* {@link STPresetColorVal }
*
*/
public STPresetColorVal getVal() {
return val;
}
/**
* Sets the value of the val property.
*
* @param value
* allowed object is
* {@link STPresetColorVal }
*
*/
public void setVal(STPresetColorVal value) {
this.val = value;
}
public boolean isSetVal() {
return (this.val!= null);
}
}

View File

@ -0,0 +1,114 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_PresetGeometry2D complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_PresetGeometry2D">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="avLst" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_GeomGuideList" minOccurs="0"/>
* &lt;/sequence>
* &lt;attribute name="prst" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_ShapeType" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_PresetGeometry2D", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"avLst"
})
public class CTPresetGeometry2D {
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTGeomGuideList avLst;
@XmlAttribute(required = true)
protected STShapeType prst;
/**
* Gets the value of the avLst property.
*
* @return
* possible object is
* {@link CTGeomGuideList }
*
*/
public CTGeomGuideList getAvLst() {
return avLst;
}
/**
* Sets the value of the avLst property.
*
* @param value
* allowed object is
* {@link CTGeomGuideList }
*
*/
public void setAvLst(CTGeomGuideList value) {
this.avLst = value;
}
public boolean isSetAvLst() {
return (this.avLst!= null);
}
/**
* Gets the value of the prst property.
*
* @return
* possible object is
* {@link STShapeType }
*
*/
public STShapeType getPrst() {
return prst;
}
/**
* Sets the value of the prst property.
*
* @param value
* allowed object is
* {@link STShapeType }
*
*/
public void setPrst(STShapeType value) {
this.prst = value;
}
public boolean isSetPrst() {
return (this.prst!= null);
}
}

View File

@ -0,0 +1,114 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_PresetTextShape complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_PresetTextShape">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="avLst" type="{http://schemas.openxmlformats.org/drawingml/2006/main}CT_GeomGuideList" minOccurs="0"/>
* &lt;/sequence>
* &lt;attribute name="prst" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_TextShapeType" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_PresetTextShape", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main", propOrder = {
"avLst"
})
public class CTPresetTextShape {
@XmlElement(namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
protected CTGeomGuideList avLst;
@XmlAttribute(required = true)
protected STTextShapeType prst;
/**
* Gets the value of the avLst property.
*
* @return
* possible object is
* {@link CTGeomGuideList }
*
*/
public CTGeomGuideList getAvLst() {
return avLst;
}
/**
* Sets the value of the avLst property.
*
* @param value
* allowed object is
* {@link CTGeomGuideList }
*
*/
public void setAvLst(CTGeomGuideList value) {
this.avLst = value;
}
public boolean isSetAvLst() {
return (this.avLst!= null);
}
/**
* Gets the value of the prst property.
*
* @return
* possible object is
* {@link STTextShapeType }
*
*/
public STTextShapeType getPrst() {
return prst;
}
/**
* Sets the value of the prst property.
*
* @param value
* allowed object is
* {@link STTextShapeType }
*
*/
public void setPrst(STTextShapeType value) {
this.prst = value;
}
public boolean isSetPrst() {
return (this.prst!= null);
}
}

View File

@ -0,0 +1,93 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_Ratio complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_Ratio">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="n" use="required" type="{http://www.w3.org/2001/XMLSchema}long" />
* &lt;attribute name="d" use="required" type="{http://www.w3.org/2001/XMLSchema}long" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_Ratio", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTRatio {
@XmlAttribute(required = true)
protected long n;
@XmlAttribute(required = true)
protected long d;
/**
* Gets the value of the n property.
*
*/
public long getN() {
return n;
}
/**
* Sets the value of the n property.
*
*/
public void setN(long value) {
this.n = value;
}
public boolean isSetN() {
return true;
}
/**
* Gets the value of the d property.
*
*/
public long getD() {
return d;
}
/**
* Sets the value of the d property.
*
*/
public void setD(long value) {
this.d = value;
}
public boolean isSetD() {
return true;
}
}

View File

@ -0,0 +1,203 @@
/* ====================================================================
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.sl.draw.binding;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CT_RelativeRect complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="CT_RelativeRect">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="l" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_Percentage" default="0" />
* &lt;attribute name="t" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_Percentage" default="0" />
* &lt;attribute name="r" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_Percentage" default="0" />
* &lt;attribute name="b" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_Percentage" default="0" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_RelativeRect", namespace = "http://schemas.openxmlformats.org/drawingml/2006/main")
public class CTRelativeRect {
@XmlAttribute
protected Integer l;
@XmlAttribute
protected Integer t;
@XmlAttribute
protected Integer r;
@XmlAttribute
protected Integer b;
/**
* Gets the value of the l property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public int getL() {
if (l == null) {
return 0;
} else {
return l;
}
}
/**
* Sets the value of the l property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setL(int value) {
this.l = value;
}
public boolean isSetL() {
return (this.l!= null);
}
public void unsetL() {
this.l = null;
}
/**
* Gets the value of the t property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public int getT() {
if (t == null) {
return 0;
} else {
return t;
}
}
/**
* Sets the value of the t property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setT(int value) {
this.t = value;
}
public boolean isSetT() {
return (this.t!= null);
}
public void unsetT() {
this.t = null;
}
/**
* Gets the value of the r property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public int getR() {
if (r == null) {
return 0;
} else {
return r;
}
}
/**
* Sets the value of the r property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setR(int value) {
this.r = value;
}
public boolean isSetR() {
return (this.r!= null);
}
public void unsetR() {
this.r = null;
}
/**
* Gets the value of the b property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public int getB() {
if (b == null) {
return 0;
} else {
return b;
}
}
/**
* Sets the value of the b property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setB(int value) {
this.b = value;
}
public boolean isSetB() {
return (this.b!= null);
}
public void unsetB() {
this.b = null;
}
}

Some files were not shown because too many files have changed in this diff Show More