You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2015/02/21 11:56:06 UTC
svn commit: r1661322 [13/14] - in /poi/branches/common_sl: ./
src/examples/src/org/apache/poi/hslf/examples/
src/examples/src/org/apache/poi/xslf/usermodel/
src/java/org/apache/poi/common/usermodel/
src/java/org/apache/poi/hssf/usermodel/ src/java/org/...
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/PresetGeometries.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/PresetGeometries.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/PresetGeometries.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/PresetGeometries.java Sat Feb 21 10:56:03 2015
@@ -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.geom;
+
+import java.io.*;
+import java.nio.charset.Charset;
+import java.util.LinkedHashMap;
+
+import javax.xml.bind.*;
+import javax.xml.stream.*;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+
+import org.apache.poi.sl.draw.binding.CTCustomGeometry2D;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
+
+/**
+ *
+ */
+public class PresetGeometries extends LinkedHashMap<String, CustomGeometry> {
+ private final static POILogger LOG = POILogFactory.getLogger(PresetGeometries.class);
+ protected final static String BINDING_PACKAGE = "org.apache.poi.sl.draw.binding";
+
+ protected static PresetGeometries _inst;
+
+ protected PresetGeometries(){}
+
+ @SuppressWarnings("unused")
+ public void init(InputStream is) throws XMLStreamException, JAXBException {
+ Reader xml = new InputStreamReader( is, Charset.forName("UTF-8") );
+
+
+ // StAX:
+ EventFilter startElementFilter = new EventFilter() {
+ @Override
+ public boolean accept(XMLEvent event) {
+ return event.isStartElement();
+ }
+ };
+
+ long cntElem = 0;
+ XMLInputFactory staxFactory = XMLInputFactory.newInstance();
+ XMLEventReader staxReader = staxFactory.createXMLEventReader(xml);
+ XMLEventReader staxFiltRd = staxFactory.createFilteredReader(staxReader, startElementFilter);
+ // ignore StartElement:
+ XMLEvent evDoc = staxFiltRd.nextEvent();
+ // JAXB:
+ JAXBContext jaxbContext = JAXBContext.newInstance(BINDING_PACKAGE);
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+
+ while (staxFiltRd.peek() != null) {
+ StartElement evRoot = (StartElement)staxFiltRd.peek();
+ String name = evRoot.getName().getLocalPart();
+ JAXBElement<CTCustomGeometry2D> el = unmarshaller.unmarshal(staxReader, CTCustomGeometry2D.class);
+ CTCustomGeometry2D cus = el.getValue();
+ cntElem++;
+
+ if(containsKey(name)) {
+ LOG.log(POILogger.WARN, "Duplicate definoition of " + name);
+ }
+ put(name, new CustomGeometry(cus));
+ }
+ }
+
+ /**
+ * Convert a single CustomGeometry object, i.e. from xmlbeans
+ */
+ public static CustomGeometry convertCustomGeometry(XMLStreamReader staxReader) {
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance(BINDING_PACKAGE);
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ JAXBElement<CTCustomGeometry2D> el = unmarshaller.unmarshal(staxReader, CTCustomGeometry2D.class);
+ return new CustomGeometry(el.getValue());
+ } catch (JAXBException e) {
+ LOG.log(POILogger.ERROR, "Unable to parse single custom geometry", e);
+ return null;
+ }
+ }
+
+ public static synchronized PresetGeometries getInstance(){
+ if(_inst == null) {
+ _inst = new PresetGeometries();
+ try {
+ InputStream is = PresetGeometries.class.
+ getResourceAsStream("presetShapeDefinitions.xml");
+ _inst.init(is);
+ is.close();
+ } catch (Exception e){
+ throw new RuntimeException(e);
+ }
+ }
+
+ return _inst;
+ }
+
+}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/QuadToCommand.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/QuadToCommand.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/QuadToCommand.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/QuadToCommand.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,48 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================
+ */
+
+package org.apache.poi.sl.draw.geom;
+
+import org.apache.poi.sl.draw.binding.CTAdjPoint2D;
+
+import java.awt.geom.GeneralPath;
+
+/**
+ * Date: 10/25/11
+ *
+ * @author Yegor Kozlov
+ */
+public class QuadToCommand implements PathCommand {
+ private String arg1, arg2, arg3, arg4;
+
+ QuadToCommand(CTAdjPoint2D pt1, CTAdjPoint2D pt2){
+ arg1 = pt1.getX().toString();
+ arg2 = pt1.getY().toString();
+ arg3 = pt2.getX().toString();
+ arg4 = pt2.getY().toString();
+ }
+
+ public void execute(GeneralPath path, Context ctx){
+ double x1 = ctx.getValue(arg1);
+ double y1 = ctx.getValue(arg2);
+ double x2 = ctx.getValue(arg3);
+ double y2 = ctx.getValue(arg4);
+ path.quadTo((float)x1, (float)y1, (float)x2, (float)y2);
+ }
+}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/SinArcTanExpression.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/SinArcTanExpression.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/SinArcTanExpression.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/SinArcTanExpression.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,51 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================
+ */
+
+package org.apache.poi.sl.draw.geom;
+
+import java.util.regex.Matcher;
+
+/**
+ * Sine ArcTan Formula:
+ * <gd name="dy1" fmla="sat2 x y z"/>
+ *
+ * <p>
+ * Arguments: 3 (fmla="sat2 x y z")
+ * Usage: "sat2 x y z" = (x*sin(arctan(z / y))) = value of this guide
+ * </p>
+ *
+ * @author Yegor Kozlov
+ */
+public class SinArcTanExpression implements Expression {
+ private String arg1, arg2, arg3;
+
+ SinArcTanExpression(Matcher m){
+ arg1 = m.group(1);
+ arg2 = m.group(2);
+ arg3 = m.group(3);
+ }
+
+ public double evaluate(Context ctx){
+ double x = ctx.getValue(arg1);
+ double y = ctx.getValue(arg2);
+ double z = ctx.getValue(arg3);
+ return x*Math.sin(Math.atan(z / y));
+ }
+
+}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/SinExpression.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/SinExpression.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/SinExpression.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/SinExpression.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,49 @@
+/*
+ * ====================================================================
+ * 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.geom;
+
+import java.util.regex.Matcher;
+
+/**
+ * Sine Formula:
+ * <gd name="z" fmla="sin x y"/>
+ *
+ * <p>
+ * Arguments: 2 (fmla="sin x y")
+ * Usage: "sin x y" = (x * sin( y )) = value of this guide
+ * </p>
+ *
+ * @author Yegor Kozlov
+ */
+public class SinExpression implements Expression {
+ private String arg1, arg2;
+
+ SinExpression(Matcher m){
+ arg1 = m.group(1);
+ arg2 = m.group(2);
+ }
+
+ public double evaluate(Context ctx){
+ double x = ctx.getValue(arg1);
+ double y = ctx.getValue(arg2) / 60000;
+ return x * Math.sin(Math.toRadians(y));
+ }
+
+}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/SqrtExpression.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/SqrtExpression.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/SqrtExpression.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/SqrtExpression.java Sat Feb 21 10:56:03 2015
@@ -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.geom;
+
+import java.util.regex.Matcher;
+
+/**
+ * Square Root Formula:
+ * <gd name="x" fmla="sqrt y"/>
+ *
+ * <p>
+ * Arguments: 1 (fmla="sqrt x")
+ * Usage: "sqrt x" = sqrt(x) = value of this guide
+ * </p>
+ * @author Yegor Kozlov
+ */
+public class SqrtExpression implements Expression {
+ private String arg;
+
+ SqrtExpression(Matcher m){
+ arg =m.group(1);
+ }
+
+ public double evaluate(Context ctx){
+ double val = ctx.getValue(arg);
+ return Math.sqrt(val);
+ }
+
+}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/TanExpression.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/TanExpression.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/TanExpression.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/draw/geom/TanExpression.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,50 @@
+/*
+ * ====================================================================
+ * 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.geom;
+
+import java.util.regex.Matcher;
+
+/**
+ * Tangent Formula:
+ *
+ * <gd name="z" fmla="tan x y"/>
+ *
+ * <p>
+ * Arguments: 2 (fmla="tan x y")
+ * Usage: "tan x y" = (x * tan( y )) = value of this guide
+ * </p>
+ *
+ * @author Yegor Kozlov
+ */
+public class TanExpression implements Expression {
+ private String arg1, arg2;
+
+ TanExpression(Matcher m){
+ arg1 = m.group(1);
+ arg2 = m.group(2);
+ }
+
+ public double evaluate(Context ctx){
+ double x = ctx.getValue(arg1);
+ double y = ctx.getValue(arg2);
+ return x * Math.tan(Math.toRadians(y / 60000));
+ }
+
+}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/AutoShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/AutoShape.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/AutoShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/AutoShape.java Sat Feb 21 10:56:03 2015
@@ -17,6 +17,6 @@
package org.apache.poi.sl.usermodel;
-public interface AutoShape extends SimpleShape {
+public interface AutoShape extends TextShape {
public TextRun getTextRun();
}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ColorStyle.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ColorStyle.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ColorStyle.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ColorStyle.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,69 @@
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+package org.apache.poi.sl.usermodel;
+
+import java.awt.Color;
+
+
+public interface ColorStyle {
+ Color getColor();
+
+ /**
+ * the opacity as expressed by a percentage value
+ *
+ * @return opacity in percents in the range [0..100000]
+ * or -1 if the value is not set
+ */
+ int getAlpha();
+
+ /**
+ * the luminance shift as expressed by a percentage relative to the input color
+ *
+ * @return luminance shift in percents in the range [0..100000]
+ * or -1 if the value is not set
+ */
+ int getLumOff();
+
+ /**
+ * the luminance as expressed by a percentage relative to the input color
+ *
+ * @return luminance in percents in the range [0..100000]
+ * or -1 if the value is not set
+ */
+ int getLumMod();
+
+ /**
+ * specifies a darker version of its input color.
+ * A 10% shade is 10% of the input color combined with 90% black.
+ *
+ * @return the value of the shade specified as percents in the range [0..100000]
+ * with 0% indicating minimal shade and 100% indicating maximum
+ * or -1 if the value is not set
+ */
+ int getShade();
+
+ /**
+ * specifies a lighter version of its input color.
+ * A 10% tint is 10% of the input color combined with 90% white.
+ *
+ * @return the value of the tint specified as percents in the range [0..100000]
+ * with 0% indicating minimal tint and 100% indicating maximum
+ * or -1 if the value is not set
+ */
+ int getTint();
+}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/FillStyle.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/FillStyle.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/FillStyle.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/FillStyle.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,22 @@
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+package org.apache.poi.sl.usermodel;
+
+public interface FillStyle {
+ PaintStyle getPaint();
+}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/FreeformShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/FreeformShape.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/FreeformShape.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/FreeformShape.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,22 @@
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+package org.apache.poi.sl.usermodel;
+
+public interface FreeformShape extends AutoShape {
+
+}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/GradientPaint.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/GradientPaint.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/GradientPaint.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/GradientPaint.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,32 @@
+/* ====================================================================
+ 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 GradientPaint extends PaintStyle {
+ enum GradientType { linear, circular, shape }
+
+ /**
+ * @return the angle of the gradient
+ */
+ double getGradientAngle();
+ ColorStyle[] getGradientColors();
+ float[] getGradientFractions();
+ boolean isRotatedWithShape();
+ GradientType getGradientType();
+}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Insets2D.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Insets2D.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Insets2D.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Insets2D.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,146 @@
+/* ====================================================================
+ 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;
+
+import java.awt.Insets;
+
+/**
+ * This is a replacement for {@link java.awt.Insets} which works on doubles
+ * instead of ints
+ */
+public class Insets2D {
+
+ /**
+ * The inset from the top.
+ * This value is added to the Top of the rectangle
+ * to yield a new location for the Top.
+ */
+ public double top;
+
+ /**
+ * The inset from the left.
+ * This value is added to the Left of the rectangle
+ * to yield a new location for the Left edge.
+ */
+ public double left;
+
+ /**
+ * The inset from the bottom.
+ * This value is subtracted from the Bottom of the rectangle
+ * to yield a new location for the Bottom.
+ */
+ public double bottom;
+
+ /**
+ * The inset from the right.
+ * This value is subtracted from the Right of the rectangle
+ * to yield a new location for the Right edge.
+ */
+ public double right;
+
+ /**
+ * Creates and initializes a new <code>Insets</code> object with the
+ * specified top, left, bottom, and right insets.
+ * @param top the inset from the top.
+ * @param left the inset from the left.
+ * @param bottom the inset from the bottom.
+ * @param right the inset from the right.
+ */
+ public Insets2D(double top, double left, double bottom, double right) {
+ this.top = top;
+ this.left = left;
+ this.bottom = bottom;
+ this.right = right;
+ }
+
+ /**
+ * Set top, left, bottom, and right to the specified values
+ *
+ * @param top the inset from the top.
+ * @param left the inset from the left.
+ * @param bottom the inset from the bottom.
+ * @param right the inset from the right.
+ * @since 1.5
+ */
+ public void set(double top, double left, double bottom, double right) {
+ this.top = top;
+ this.left = left;
+ this.bottom = bottom;
+ this.right = right;
+ }
+
+ /**
+ * Checks whether two insets objects are equal. Two instances
+ * of <code>Insets</code> are equal if the four integer values
+ * of the fields <code>top</code>, <code>left</code>,
+ * <code>bottom</code>, and <code>right</code> are all equal.
+ * @return <code>true</code> if the two insets are equal;
+ * otherwise <code>false</code>.
+ * @since JDK1.1
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof Insets) {
+ Insets insets = (Insets)obj;
+ return ((top == insets.top) && (left == insets.left) &&
+ (bottom == insets.bottom) && (right == insets.right));
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hash code for this Insets.
+ *
+ * @return a hash code for this Insets.
+ */
+ public int hashCode() {
+ double sum1 = left + bottom;
+ double sum2 = right + top;
+ double val1 = sum1 * (sum1 + 1)/2 + left;
+ double val2 = sum2 * (sum2 + 1)/2 + top;
+ double sum3 = val1 + val2;
+ return (int)(sum3 * (sum3 + 1)/2 + val2);
+ }
+
+ /**
+ * Returns a string representation of this <code>Insets</code> object.
+ * This method is intended to be used only for debugging purposes, and
+ * the content and format of the returned string may vary between
+ * implementations. The returned string may be empty but may not be
+ * <code>null</code>.
+ *
+ * @return a string representation of this <code>Insets</code> object.
+ */
+ public String toString() {
+ return getClass().getName() + "[top=" + top + ",left=" + left + ",bottom=" + bottom + ",right=" + right + "]";
+ }
+
+ /**
+ * Create a copy of this object.
+ * @return a copy of this <code>Insets2D</code> object.
+ */
+ public Object clone() {
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ // this shouldn't happen, since we are Cloneable
+ throw new InternalError();
+ }
+ }
+
+
+}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/LineDecoration.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/LineDecoration.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/LineDecoration.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/LineDecoration.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,69 @@
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+package org.apache.poi.sl.usermodel;
+
+public interface LineDecoration {
+ /**
+ * Represents the shape decoration that appears at the ends of lines.
+ */
+ enum DecorationShape {
+ NONE,
+ TRIANGLE,
+ STEALTH,
+ DIAMOND,
+ OVAL,
+ ARROW
+ }
+
+ enum DecorationSize {
+ SMALL,
+ MEDIUM,
+ LARGE
+ }
+
+ /**
+ * @return the line start shape
+ */
+ DecorationShape getHeadShape();
+
+ /**
+ * @return the width of the start shape
+ */
+ DecorationSize getHeadWidth();
+
+ /**
+ * @return the length of the start shape
+ */
+ DecorationSize getHeadLength();
+
+ /**
+ * @return the line end shape
+ */
+ DecorationShape getTailShape();
+
+ /**
+ * @return the width of the end shape
+ */
+ DecorationSize getTailWidth();
+
+ /**
+ * @return the length of the end shape
+ */
+ DecorationSize getTailLength();
+
+}
Copied: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PaintStyle.java (from r1661318, poi/trunk/src/scratchpad/src/org/apache/poi/sl/usermodel/Fill.java)
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PaintStyle.java?p2=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PaintStyle.java&p1=poi/trunk/src/scratchpad/src/org/apache/poi/sl/usermodel/Fill.java&r1=1661318&r2=1661322&rev=1661322&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/sl/usermodel/Fill.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PaintStyle.java Sat Feb 21 10:56:03 2015
@@ -17,5 +17,9 @@
package org.apache.poi.sl.usermodel;
-public interface Fill extends org.apache.poi.common.usermodel.Fill {
+
+
+public interface PaintStyle {
+
+
}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PlaceableShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PlaceableShape.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PlaceableShape.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/PlaceableShape.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,39 @@
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+package org.apache.poi.sl.usermodel;
+
+import java.awt.geom.Rectangle2D;
+
+public interface PlaceableShape {
+ Rectangle2D getAnchor();
+
+ FillStyle getFillStyle();
+
+ StrokeStyle getStrokeStyle();
+
+ /**
+ * Rotation angle in degrees
+ * <p>
+ * Positive angles are clockwise (i.e., towards the positive y axis);
+ * negative angles are counter-clockwise (i.e., towards the negative y axis).
+ * </p>
+ *
+ * @return rotation angle in degrees
+ */
+ double getRotation();
+}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Shadow.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Shadow.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Shadow.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Shadow.java Sat Feb 21 10:56:03 2015
@@ -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.usermodel;
+
+import java.awt.Color;
+
+
+public interface Shadow {
+ /**
+ * @return the offset of this shadow in points
+ */
+ double getDistance();
+
+ /**
+ *
+ * @return the direction to offset the shadow in angles
+ */
+ double getAngle();
+
+ /**
+ *
+ * @return the blur radius of the shadow
+ * TODO: figure out how to make sense of this property when rendering shadows
+ */
+ double getBlur();
+
+ /**
+ * @return the color of this shadow.
+ * Depending whether the parent shape is filled or stroked, this color is used to fill or stroke this shadow
+ */
+ Color getColor();
+}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Shape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Shape.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Shape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Shape.java Sat Feb 21 10:56:03 2015
@@ -19,13 +19,61 @@ package org.apache.poi.sl.usermodel;
import java.awt.geom.Rectangle2D;
-public interface Shape {
- public int getShapeType();
+import org.apache.poi.sl.draw.geom.CustomGeometry;
- public Rectangle2D getAnchor();
- public void setAnchor(Rectangle2D anchor);
+public interface Shape extends PlaceableShape {
+ CustomGeometry getGeometry();
+
+ ShapeType getShapeType();
- public void moveTo(float x, float y);
+ void setAnchor(Rectangle2D anchor);
- public Shape getParent();
+ ShapeContainer getParent();
+
+ boolean isPlaceholder();
+
+ /**
+ *
+ * @return the sheet this shape belongs to
+ */
+ Sheet getSheet();
+
+ /**
+ * Rotate this shape.
+ * <p>
+ * Positive angles are clockwise (i.e., towards the positive y axis);
+ * negative angles are counter-clockwise (i.e., towards the negative y axis).
+ * </p>
+ *
+ * @param theta the rotation angle in degrees.
+ */
+ void setRotation(double theta);
+
+ /**
+ * @param flip whether the shape is horizontally flipped
+ */
+ void setFlipHorizontal(boolean flip);
+
+ /**
+ * Whether the shape is vertically flipped
+ *
+ * @param flip whether the shape is vertically flipped
+ */
+ void setFlipVertical(boolean flip);
+
+ /**
+ * Whether the shape is horizontally flipped
+ *
+ * @return whether the shape is horizontally flipped
+ */
+ boolean getFlipHorizontal();
+
+ /**
+ * Whether the shape is vertically flipped
+ *
+ * @return whether the shape is vertically flipped
+ */
+ boolean getFlipVertical();
+
+
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeContainer.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeContainer.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeContainer.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeContainer.java Sat Feb 21 10:56:03 2015
@@ -17,8 +17,28 @@
package org.apache.poi.sl.usermodel;
-public interface ShapeContainer {
+
+public interface ShapeContainer extends Iterable<Shape>, PlaceableShape {
+ /**
+ * Returns an array containing all of the elements in this container in proper
+ * sequence (from first to last element).
+ *
+ * @return an array containing all of the elements in this container in proper
+ * sequence
+ */
public Shape[] getShapes();
+
public void addShape(Shape shape);
+
+ /**
+ * Removes the specified shape from this sheet, if it is present
+ * (optional operation). If this sheet does not contain the element,
+ * it is unchanged.
+ *
+ * @param xShape shape to be removed from this sheet, if present
+ * @return <tt>true</tt> if this sheet contained the specified element
+ * @throws IllegalArgumentException if the type of the specified shape
+ * is incompatible with this sheet (optional)
+ */
public boolean removeShape(Shape shape);
}
Copied: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeType.java (from r1647885, poi/trunk/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeTypes.java)
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeType.java?p2=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeType.java&p1=poi/trunk/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeTypes.java&r1=1647885&r2=1661322&rev=1661322&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeTypes.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/ShapeType.java Sat Feb 21 10:56:03 2015
@@ -17,208 +17,279 @@
package org.apache.poi.sl.usermodel;
-public interface ShapeTypes {
- public static final int NotPrimitive = 0;
- public static final int Rectangle = 1;
- public static final int RoundRectangle = 2;
- public static final int Ellipse = 3;
- public static final int Diamond = 4;
- public static final int IsocelesTriangle = 5;
- public static final int RightTriangle = 6;
- public static final int Parallelogram = 7;
- public static final int Trapezoid = 8;
- public static final int Hexagon = 9;
- public static final int Octagon = 10;
- public static final int Plus = 11;
- public static final int Star = 12;
- public static final int Arrow = 13;
- public static final int ThickArrow = 14;
- public static final int HomePlate = 15;
- public static final int Cube = 16;
- public static final int Balloon = 17;
- public static final int Seal = 18;
- public static final int Arc = 19;
- public static final int Line = 20;
- public static final int Plaque = 21;
- public static final int Can = 22;
- public static final int Donut = 23;
- public static final int TextSimple = 24;
- public static final int TextOctagon = 25;
- public static final int TextHexagon = 26;
- public static final int TextCurve = 27;
- public static final int TextWave = 28;
- public static final int TextRing = 29;
- public static final int TextOnCurve = 30;
- public static final int TextOnRing = 31;
- public static final int StraightConnector1 = 32;
- public static final int BentConnector2 = 33;
- public static final int BentConnector3 = 34;
- public static final int BentConnector4 = 35;
- public static final int BentConnector5 = 36;
- public static final int CurvedConnector2 = 37;
- public static final int CurvedConnector3 = 38;
- public static final int CurvedConnector4 = 39;
- public static final int CurvedConnector5 = 40;
- public static final int Callout1 = 41;
- public static final int Callout2 = 42;
- public static final int Callout3 = 43;
- public static final int AccentCallout1 = 44;
- public static final int AccentCallout2 = 45;
- public static final int AccentCallout3 = 46;
- public static final int BorderCallout1 = 47;
- public static final int BorderCallout2 = 48;
- public static final int BorderCallout3 = 49;
- public static final int AccentBorderCallout1 = 50;
- public static final int AccentBorderCallout2 = 51;
- public static final int AccentBorderCallout3 = 52;
- public static final int Ribbon = 53;
- public static final int Ribbon2 = 54;
- public static final int Chevron = 55;
- public static final int Pentagon = 56;
- public static final int NoSmoking = 57;
- public static final int Star8 = 58;
- public static final int Star16 = 59;
- public static final int Star32 = 60;
- public static final int WedgeRectCallout = 61;
- public static final int WedgeRRectCallout = 62;
- public static final int WedgeEllipseCallout = 63;
- public static final int Wave = 64;
- public static final int FoldedCorner = 65;
- public static final int LeftArrow = 66;
- public static final int DownArrow = 67;
- public static final int UpArrow = 68;
- public static final int LeftRightArrow = 69;
- public static final int UpDownArrow = 70;
- public static final int IrregularSeal1 = 71;
- public static final int IrregularSeal2 = 72;
- public static final int LightningBolt = 73;
- public static final int Heart = 74;
- public static final int PictureFrame = 75;
- public static final int QuadArrow = 76;
- public static final int LeftArrowCallout = 77;
- public static final int RightArrowCallout = 78;
- public static final int UpArrowCallout = 79;
- public static final int DownArrowCallout = 80;
- public static final int LeftRightArrowCallout = 81;
- public static final int UpDownArrowCallout = 82;
- public static final int QuadArrowCallout = 83;
- public static final int Bevel = 84;
- public static final int LeftBracket = 85;
- public static final int RightBracket = 86;
- public static final int LeftBrace = 87;
- public static final int RightBrace = 88;
- public static final int LeftUpArrow = 89;
- public static final int BentUpArrow = 90;
- public static final int BentArrow = 91;
- public static final int Star24 = 92;
- public static final int StripedRightArrow = 93;
- public static final int NotchedRightArrow = 94;
- public static final int BlockArc = 95;
- public static final int SmileyFace = 96;
- public static final int VerticalScroll = 97;
- public static final int HorizontalScroll = 98;
- public static final int CircularArrow = 99;
- public static final int NotchedCircularArrow = 100;
- public static final int UturnArrow = 101;
- public static final int CurvedRightArrow = 102;
- public static final int CurvedLeftArrow = 103;
- public static final int CurvedUpArrow = 104;
- public static final int CurvedDownArrow = 105;
- public static final int CloudCallout = 106;
- public static final int EllipseRibbon = 107;
- public static final int EllipseRibbon2 = 108;
- public static final int FlowChartProcess = 109;
- public static final int FlowChartDecision = 110;
- public static final int FlowChartInputOutput = 111;
- public static final int FlowChartPredefinedProcess = 112;
- public static final int FlowChartInternalStorage = 113;
- public static final int FlowChartDocument = 114;
- public static final int FlowChartMultidocument = 115;
- public static final int FlowChartTerminator = 116;
- public static final int FlowChartPreparation = 117;
- public static final int FlowChartManualInput = 118;
- public static final int FlowChartManualOperation = 119;
- public static final int FlowChartConnector = 120;
- public static final int FlowChartPunchedCard = 121;
- public static final int FlowChartPunchedTape = 122;
- public static final int FlowChartSummingJunction = 123;
- public static final int FlowChartOr = 124;
- public static final int FlowChartCollate = 125;
- public static final int FlowChartSort = 126;
- public static final int FlowChartExtract = 127;
- public static final int FlowChartMerge = 128;
- public static final int FlowChartOfflineStorage = 129;
- public static final int FlowChartOnlineStorage = 130;
- public static final int FlowChartMagneticTape = 131;
- public static final int FlowChartMagneticDisk = 132;
- public static final int FlowChartMagneticDrum = 133;
- public static final int FlowChartDisplay = 134;
- public static final int FlowChartDelay = 135;
- public static final int TextPlainText = 136;
- public static final int TextStop = 137;
- public static final int TextTriangle = 138;
- public static final int TextTriangleInverted = 139;
- public static final int TextChevron = 140;
- public static final int TextChevronInverted = 141;
- public static final int TextRingInside = 142;
- public static final int TextRingOutside = 143;
- public static final int TextArchUpCurve = 144;
- public static final int TextArchDownCurve = 145;
- public static final int TextCircleCurve = 146;
- public static final int TextButtonCurve = 147;
- public static final int TextArchUpPour = 148;
- public static final int TextArchDownPour = 149;
- public static final int TextCirclePour = 150;
- public static final int TextButtonPour = 151;
- public static final int TextCurveUp = 152;
- public static final int TextCurveDown = 153;
- public static final int TextCascadeUp = 154;
- public static final int TextCascadeDown = 155;
- public static final int TextWave1 = 156;
- public static final int TextWave2 = 157;
- public static final int TextWave3 = 158;
- public static final int TextWave4 = 159;
- public static final int TextInflate = 160;
- public static final int TextDeflate = 161;
- public static final int TextInflateBottom = 162;
- public static final int TextDeflateBottom = 163;
- public static final int TextInflateTop = 164;
- public static final int TextDeflateTop = 165;
- public static final int TextDeflateInflate = 166;
- public static final int TextDeflateInflateDeflate = 167;
- public static final int TextFadeRight = 168;
- public static final int TextFadeLeft = 169;
- public static final int TextFadeUp = 170;
- public static final int TextFadeDown = 171;
- public static final int TextSlantUp = 172;
- public static final int TextSlantDown = 173;
- public static final int TextCanUp = 174;
- public static final int TextCanDown = 175;
- public static final int FlowChartAlternateProcess = 176;
- public static final int FlowChartOffpageConnector = 177;
- public static final int Callout90 = 178;
- public static final int AccentCallout90 = 179;
- public static final int BorderCallout90 = 180;
- public static final int AccentBorderCallout90 = 181;
- public static final int LeftRightUpArrow = 182;
- public static final int Sun = 183;
- public static final int Moon = 184;
- public static final int BracketPair = 185;
- public static final int BracePair = 186;
- public static final int Star4 = 187;
- public static final int DoubleWave = 188;
- public static final int ActionButtonBlank = 189;
- public static final int ActionButtonHome = 190;
- public static final int ActionButtonHelp = 191;
- public static final int ActionButtonInformation = 192;
- public static final int ActionButtonForwardNext = 193;
- public static final int ActionButtonBackPrevious = 194;
- public static final int ActionButtonEnd = 195;
- public static final int ActionButtonBeginning = 196;
- public static final int ActionButtonReturn = 197;
- public static final int ActionButtonDocument = 198;
- public static final int ActionButtonSound = 199;
- public static final int ActionButtonMovie = 200;
- public static final int HostControl = 201;
- public static final int TextBox = 202;
+/**
+ * known preset shape geometries in PresentationML
+ */
+public enum ShapeType {
+ NOT_PRIMITIVE(-1, 0, "NotPrimitive"),
+ LINE(1, 20, "Line"),
+ LINE_INV(2, -1, null),
+ TRIANGLE(3, 5, "IsocelesTriangle"),
+ RT_TRIANGLE(4, 6, "RightTriangle"),
+ RECT(5, 1, "Rectangle"),
+ DIAMOND(6, 4, "Diamond"),
+ PARALLELOGRAM(7, 7, "Parallelogram"),
+ TRAPEZOID(8, 8, "Trapezoid"),
+ NON_ISOSCELES_TRAPEZOID(9, -1, null),
+ PENTAGON(10, 56, "Pentagon"),
+ HEXAGON(11, 9, "Hexagon"),
+ HEPTAGON(12, -1, null),
+ OCTAGON(13, 10, "Octagon"),
+ DECAGON(14, -1, null),
+ DODECAGON(15, -1, null),
+ STAR_4(16, 187, "Star4"),
+ STAR_5(17, 12, "Star"), // aka star in native
+ STAR_6(18, -1, null),
+ STAR_7(19, -1, null),
+ STAR_8(20, 58, "Star8"),
+ STAR_10(21, -1, null),
+ STAR_12(22, -1, null),
+ STAR_16(23, 59, "Star16"),
+ SEAL(23, 18, "Seal"), // same as star_16, but twice in native
+ STAR_24(24, 92, "Star24"),
+ STAR_32(25, 60, "Star32"),
+ ROUND_RECT(26, 2, "RoundRectangle"),
+ ROUND_1_RECT(27, -1, null),
+ ROUND_2_SAME_RECT(28, -1, null),
+ ROUND_2_DIAG_RECT(29, -1, null),
+ SNIP_ROUND_RECT(30, -1, null),
+ SNIP_1_RECT(31, -1, null),
+ SNIP_2_SAME_RECT(32, -1, null),
+ SNIP_2_DIAG_RECT(33, -1, null),
+ PLAQUE(34, 21, "Plaque"),
+ ELLIPSE(35, 3, "Ellipse"),
+ TEARDROP(36, -1, null),
+ HOME_PLATE(37, 15, "HomePlate"),
+ CHEVRON(38, 55, "Chevron"),
+ PIE_WEDGE(39, -1, null),
+ PIE(40, -1, null),
+ BLOCK_ARC(41, 95, "BlockArc"),
+ DONUT(42, 23, "Donut"),
+ NO_SMOKING(43, 57, "NoSmoking"),
+ RIGHT_ARROW(44, 13, "Arrow"), // aka arrow in native
+ LEFT_ARROW(45, 66, "LeftArrow"),
+ UP_ARROW(46, 68, "UpArrow"),
+ DOWN_ARROW(47, 67, "DownArrow"),
+ STRIPED_RIGHT_ARROW(48, 93, "StripedRightArrow"),
+ NOTCHED_RIGHT_ARROW(49, 94, "NotchedRightArrow"),
+ BENT_UP_ARROW(50, 90, "BentUpArrow"),
+ LEFT_RIGHT_ARROW(51, 69, "LeftRightArrow"),
+ UP_DOWN_ARROW(52, 70, "UpDownArrow"),
+ LEFT_UP_ARROW(53, 89, "LeftUpArrow"),
+ LEFT_RIGHT_UP_ARROW(54, 182, "LeftRightUpArrow"),
+ QUAD_ARROW(55, 76, "QuadArrow"),
+ LEFT_ARROW_CALLOUT(56, 77, "LeftArrowCallout"),
+ RIGHT_ARROW_CALLOUT(57, 78, "RightArrowCallout"),
+ UP_ARROW_CALLOUT(58, 79, "UpArrowCallout"),
+ DOWN_ARROW_CALLOUT(59, 80, "DownArrowCallout"),
+ LEFT_RIGHT_ARROW_CALLOUT(60, 81, "LeftRightArrowCallout"),
+ UP_DOWN_ARROW_CALLOUT(61, 82, "UpDownArrowCallout"),
+ QUAD_ARROW_CALLOUT(62, 83, "QuadArrowCallout"),
+ BENT_ARROW(63, 91, "BentArrow"),
+ UTURN_ARROW(64, 101, "UturnArrow"),
+ CIRCULAR_ARROW(65, 99, "CircularArrow"),
+ LEFT_CIRCULAR_ARROW(66, -1, null),
+ LEFT_RIGHT_CIRCULAR_ARROW(67, -1, null),
+ CURVED_RIGHT_ARROW(68, 102, "CurvedRightArrow"),
+ CURVED_LEFT_ARROW(69, 103, "CurvedLeftArrow"),
+ CURVED_UP_ARROW(70, 104, "CurvedUpArrow"),
+ CURVED_DOWN_ARROW(71, 105, "CurvedDownArrow"),
+ SWOOSH_ARROW(72, -1, null),
+ CUBE(73, 16, "Cube"),
+ CAN(74, 22, "Can"),
+ LIGHTNING_BOLT(75, 73, "LightningBolt"),
+ HEART(76, 74, "Heart"),
+ SUN(77, 183, "Sun"),
+ MOON(78, 184, "Moon"),
+ SMILEY_FACE(79, 96, "SmileyFace"),
+ IRREGULAR_SEAL_1(80, 71, "IrregularSeal1"),
+ IRREGULAR_SEAL_2(81, 72, "IrregularSeal2"),
+ FOLDED_CORNER(82, 65, "FoldedCorner"),
+ BEVEL(83, 84, "Bevel"),
+ FRAME(84, 75, "PictureFrame"),
+ HALF_FRAME(85, -1, null),
+ CORNER(86, -1, null),
+ DIAG_STRIPE(87, -1, null),
+ CHORD(88, -1, null),
+ ARC(89, 19, "Arc"),
+ LEFT_BRACKET(90, 85, "LeftBracket"),
+ RIGHT_BRACKET(91, 86, "RightBracket"),
+ LEFT_BRACE(92, 87, "LeftBrace"),
+ RIGHT_BRACE(93, 88, "RightBrace"),
+ BRACKET_PAIR(94, 185, "BracketPair"),
+ BRACE_PAIR(95, 186, "BracePair"),
+ STRAIGHT_CONNECTOR_1(96, 32, "StraightConnector1"),
+ BENT_CONNECTOR_2(97, 33, "BentConnector2"),
+ BENT_CONNECTOR_3(98, 34, "BentConnector3"),
+ BENT_CONNECTOR_4(99, 35, "BentConnector4"),
+ BENT_CONNECTOR_5(100, 36, "BentConnector5"),
+ CURVED_CONNECTOR_2(101, 37, "CurvedConnector2"),
+ CURVED_CONNECTOR_3(102, 38, "CurvedConnector3"),
+ CURVED_CONNECTOR_4(103, 39, "CurvedConnector4"),
+ CURVED_CONNECTOR_5(104, 40, "CurvedConnector5"),
+ CALLOUT_1(105, 41, "Callout1"),
+ CALLOUT_2(106, 42, "Callout2"),
+ CALLOUT_3(107, 43, "Callout3"),
+ ACCENT_CALLOUT_1(108, 44, "AccentCallout1"),
+ ACCENT_CALLOUT_2(109, 45, "AccentCallout2"),
+ ACCENT_CALLOUT_3(110, 46, "AccentCallout3"),
+ BORDER_CALLOUT_1(111, 47, "BorderCallout1"),
+ BORDER_CALLOUT_2(112, 48, "BorderCallout2"),
+ BORDER_CALLOUT_3(113, 49, "BorderCallout3"),
+ ACCENT_BORDER_CALLOUT_1(114, 50, "AccentBorderCallout1"),
+ ACCENT_BORDER_CALLOUT_2(115, 51, "AccentBorderCallout2"),
+ ACCENT_BORDER_CALLOUT_3(116, 52, "AccentBorderCallout3"),
+ WEDGE_RECT_CALLOUT(117, 61, "WedgeRectCallout"),
+ WEDGE_ROUND_RECT_CALLOUT(118, 62, "WedgeRRectCallout"),
+ WEDGE_ELLIPSE_CALLOUT(119, 63, "WedgeEllipseCallout"),
+ CLOUD_CALLOUT(120, 106, "CloudCallout"),
+ CLOUD(121, -1, null),
+ RIBBON(122, 53, "Ribbon"),
+ RIBBON_2(123, 54, "Ribbon2"),
+ ELLIPSE_RIBBON(124, 107, "EllipseRibbon"),
+ ELLIPSE_RIBBON_2(125, 108, "EllipseRibbon2"),
+ LEFT_RIGHT_RIBBON(126, -1, null),
+ VERTICAL_SCROLL(127, 97, "VerticalScroll"),
+ HORIZONTAL_SCROLL(128, 98, "HorizontalScroll"),
+ WAVE(129, 64, "Wave"),
+ DOUBLE_WAVE(130, 188, "DoubleWave"),
+ PLUS(131, 11, "Plus"),
+ FLOW_CHART_PROCESS(132, 109, "FlowChartProcess"),
+ FLOW_CHART_DECISION(133, 110, "FlowChartDecision"),
+ FLOW_CHART_INPUT_OUTPUT(134, 111, "FlowChartInputOutput"),
+ FLOW_CHART_PREDEFINED_PROCESS(135, 112, "FlowChartPredefinedProcess"),
+ FLOW_CHART_INTERNAL_STORAGE(136, 113, "FlowChartInternalStorage"),
+ FLOW_CHART_DOCUMENT(137, 114, "FlowChartDocument"),
+ FLOW_CHART_MULTIDOCUMENT(138, 115, "FlowChartMultidocument"),
+ FLOW_CHART_TERMINATOR(139, 116, "FlowChartTerminator"),
+ FLOW_CHART_PREPARATION(140, 117, "FlowChartPreparation"),
+ FLOW_CHART_MANUAL_INPUT(141, 118, "FlowChartManualInput"),
+ FLOW_CHART_MANUAL_OPERATION(142, 119, "FlowChartManualOperation"),
+ FLOW_CHART_CONNECTOR(143, 120, "FlowChartConnector"),
+ FLOW_CHART_PUNCHED_CARD(144, 121, "FlowChartPunchedCard"),
+ FLOW_CHART_PUNCHED_TAPE(145, 122, "FlowChartPunchedTape"),
+ FLOW_CHART_SUMMING_JUNCTION(146, 123, "FlowChartSummingJunction"),
+ FLOW_CHART_OR(147, 124, "FlowChartOr"),
+ FLOW_CHART_COLLATE(148, 125, "FlowChartCollate"),
+ FLOW_CHART_SORT(149, 126, "FlowChartSort"),
+ FLOW_CHART_EXTRACT(150, 127, "FlowChartExtract"),
+ FLOW_CHART_MERGE(151, 128, "FlowChartMerge"),
+ FLOW_CHART_OFFLINE_STORAGE(152, 129, "FlowChartOfflineStorage"),
+ FLOW_CHART_ONLINE_STORAGE(153, 130, "FlowChartOnlineStorage"),
+ FLOW_CHART_MAGNETIC_TAPE(154, 131, "FlowChartMagneticTape"),
+ FLOW_CHART_MAGNETIC_DISK(155, 132, "FlowChartMagneticDisk"),
+ FLOW_CHART_MAGNETIC_DRUM(156, 133, "FlowChartMagneticDrum"),
+ FLOW_CHART_DISPLAY(157, 134, "FlowChartDisplay"),
+ FLOW_CHART_DELAY(158, 135, "FlowChartDelay"),
+ FLOW_CHART_ALTERNATE_PROCESS(159, 176, "FlowChartAlternateProcess"),
+ FLOW_CHART_OFFPAGE_CONNECTOR(160, 177, "FlowChartOffpageConnector"),
+ ACTION_BUTTON_BLANK(161, 189, "ActionButtonBlank"),
+ ACTION_BUTTON_HOME(162, 190, "ActionButtonHome"),
+ ACTION_BUTTON_HELP(163, 191, "ActionButtonHelp"),
+ ACTION_BUTTON_INFORMATION(164, 192, "ActionButtonInformation"),
+ ACTION_BUTTON_FORWARD_NEXT(165, 193, "ActionButtonForwardNext"),
+ ACTION_BUTTON_BACK_PREVIOUS(166, 194, "ActionButtonBackPrevious"),
+ ACTION_BUTTON_END(167, 195, "ActionButtonEnd"),
+ ACTION_BUTTON_BEGINNING(168, 196, "ActionButtonBeginning"),
+ ACTION_BUTTON_RETURN(169, 197, "ActionButtonReturn"),
+ ACTION_BUTTON_DOCUMENT(170, 198, "ActionButtonDocument"),
+ ACTION_BUTTON_SOUND(171, 199, "ActionButtonSound"),
+ ACTION_BUTTON_MOVIE(172, 200, "ActionButtonMovie"),
+ GEAR_6(173, -1, null),
+ GEAR_9(174, -1, null),
+ FUNNEL(175, -1, null),
+ MATH_PLUS(176, -1, null),
+ MATH_MINUS(177, -1, null),
+ MATH_MULTIPLY(178, -1, null),
+ MATH_DIVIDE(179, -1, null),
+ MATH_EQUAL(180, -1, null),
+ MATH_NOT_EQUAL(181, -1, null),
+ CORNER_TABS(182, -1, null),
+ SQUARE_TABS(183, -1, null),
+ PLAQUE_TABS(184, -1, null),
+ CHART_X(185, -1, null),
+ CHART_STAR(186, -1, null),
+ CHART_PLUS(187, -1, null),
+ // below are shape types only found in native
+ NOTCHED_CIRCULAR_ARROW(-1, 100, "NotchedCircularArrow"),
+ THICK_ARROW(-1, 14, "ThickArrow"),
+ BALLOON(-1, 17, "Balloon"),
+ TEXT_SIMPLE(-1, 24, "TextSimple"),
+ TEXT_OCTAGON(-1, 25, "TextOctagon"),
+ TEXT_HEXAGON(-1, 26, "TextHexagon"),
+ TEXT_CURVE(-1, 27, "TextCurve"),
+ TEXT_WAVE(-1, 28, "TextWave"),
+ TEXT_RING(-1, 29, "TextRing"),
+ TEXT_ON_CURVE(-1, 30, "TextOnCurve"),
+ TEXT_ON_RING(-1, 31, "TextOnRing"),
+ TEXT_PLAIN_TEXT(-1, 136, "TextPlainText"),
+ TEXT_STOP(-1, 137, "TextStop"),
+ TEXT_TRIANGLE(-1, 138, "TextTriangle"),
+ TEXT_TRIANGLE_INVERTED(-1, 139, "TextTriangleInverted"),
+ TEXT_CHEVRON(-1, 140, "TextChevron"),
+ TEXT_CHEVRON_INVERTED(-1, 141, "TextChevronInverted"),
+ TEXT_RING_INSIDE(-1, 142, "TextRingInside"),
+ TEXT_RING_OUTSIDE(-1, 143, "TextRingOutside"),
+ TEXT_ARCH_UP_CURVE(-1, 144, "TextArchUpCurve"),
+ TEXT_ARCH_DOWN_CURVE(-1, 145, "TextArchDownCurve"),
+ TEXT_CIRCLE_CURVE(-1, 146, "TextCircleCurve"),
+ TEXT_BUTTON_CURVE(-1, 147, "TextButtonCurve"),
+ TEXT_ARCH_UP_POUR(-1, 148, "TextArchUpPour"),
+ TEXT_ARCH_DOWN_POUR(-1, 149, "TextArchDownPour"),
+ TEXT_CIRCLE_POUR(-1, 150, "TextCirclePour"),
+ TEXT_BUTTON_POUR(-1, 151, "TextButtonPour"),
+ TEXT_CURVE_UP(-1, 152, "TextCurveUp"),
+ TEXT_CURVE_DOWN(-1, 153, "TextCurveDown"),
+ TEXT_CASCADE_UP(-1, 154, "TextCascadeUp"),
+ TEXT_CASCADE_DOWN(-1, 155, "TextCascadeDown"),
+ TEXT_WAVE_1(-1, 156, "TextWave1"),
+ TEXT_WAVE_2(-1, 157, "TextWave2"),
+ TEXT_WAVE_3(-1, 158, "TextWave3"),
+ TEXT_WAVE_4(-1, 159, "TextWave4"),
+ TEXT_INFLATE(-1, 160, "TextInflate"),
+ TEXT_DEFLATE(-1, 161, "TextDeflate"),
+ TEXT_INFLATE_BOTTOM(-1, 162, "TextInflateBottom"),
+ TEXT_DEFLATE_BOTTOM(-1, 163, "TextDeflateBottom"),
+ TEXT_INFLATE_TOP(-1, 164, "TextInflateTop"),
+ TEXT_DEFLATE_TOP(-1, 165, "TextDeflateTop"),
+ TEXT_DEFLATE_INFLATE(-1, 166, "TextDeflateInflate"),
+ TEXT_DEFLATE_INFLATE_DEFLATE(-1, 167, "TextDeflateInflateDeflate"),
+ TEXT_FADE_RIGHT(-1, 168, "TextFadeRight"),
+ TEXT_FADE_LEFT(-1, 169, "TextFadeLeft"),
+ TEXT_FADE_UP(-1, 170, "TextFadeUp"),
+ TEXT_FADE_DOWN(-1, 171, "TextFadeDown"),
+ TEXT_SLANT_UP(-1, 172, "TextSlantUp"),
+ TEXT_SLANT_DOWN(-1, 173, "TextSlantDown"),
+ TEXT_CAN_UP(-1, 174, "TextCanUp"),
+ TEXT_CAN_DOWN(-1, 175, "TextCanDown"),
+ CALLOUT_90(-1, 178, "Callout90"),
+ ACCENT_CALLOUT_90(-1, 179, "AccentCallout90"),
+ BORDER_CALLOUT_90(-1, 180, "BorderCallout90"),
+ ACCENT_BORDER_CALLOUT_90(-1, 181, "AccentBorderCallout90"),
+ HOST_CONTROL(-1, 201, "HostControl"),
+ TEXT_BOX(-1, 202, "TextBox")
+ ;
+
+ /** Preset-ID for XML-based shapes */
+ public final int ooxmlId;
+
+ /** Preset-ID for binary-based shapes */
+ public final int nativeId;
+
+ /** POI-specific name for the binary-based type */
+ public final String nativeName;
+
+ ShapeType(int ooxmlId, int nativeId, String nativeName){
+ this.ooxmlId = ooxmlId;
+ this.nativeId = nativeId;
+ this.nativeName = nativeName;
+ }
+
+ public static ShapeType forId(int id, boolean isOoxmlId){
+ for(ShapeType t : values()){
+ if((isOoxmlId && t.ooxmlId == id) ||
+ (!isOoxmlId && t.nativeId == id)) return t;
+ }
+ throw new IllegalArgumentException("Unknown shape type: " + id);
+ }
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Sheet.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Sheet.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Sheet.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/Sheet.java Sat Feb 21 10:56:03 2015
@@ -17,13 +17,21 @@
package org.apache.poi.sl.usermodel;
+
/**
* Common parent of Slides, Notes and Masters
*/
public interface Sheet extends ShapeContainer {
- public SlideShow getSlideShow();
+ SlideShow getSlideShow();
- public MasterSheet getMasterSheet();
+ /**
+ * @return whether shapes on the master sheet should be shown. By default master graphics is turned off.
+ * Sheets that support the notion of master (slide, slideLayout) should override it and
+ * check this setting in the sheet XML
+ */
+ boolean getFollowMasterGraphics();
+
+ MasterSheet getMasterSheet();
- public Background getBackground();
+ Background getBackground();
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/SimpleShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/SimpleShape.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/SimpleShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/SimpleShape.java Sat Feb 21 10:56:03 2015
@@ -17,10 +17,14 @@
package org.apache.poi.sl.usermodel;
-public interface SimpleShape extends Shape {
- public Fill getFill();
- public LineStyle getLineStyle();
+import org.apache.poi.sl.draw.geom.IAdjustableShape;
- public Hyperlink getHyperlink();
- public void setHyperlink(Hyperlink hyperlink);
+
+public interface SimpleShape extends Shape, IAdjustableShape {
+ StrokeStyle getStrokeStyle();
+ Shadow getShadow();
+ LineDecoration getLineDecoration();
+
+ Hyperlink getHyperlink();
+ void setHyperlink(Hyperlink hyperlink);
}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/SlideShow.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/SlideShow.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/SlideShow.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/SlideShow.java Sat Feb 21 10:56:03 2015
@@ -17,14 +17,22 @@
package org.apache.poi.sl.usermodel;
+import java.awt.Dimension;
import java.io.IOException;
public interface SlideShow {
- public Slide createSlide() throws IOException;
- public MasterSheet createMasterSheet() throws IOException;
+ Slide createSlide() throws IOException;
+ MasterSheet createMasterSheet() throws IOException;
- public Slide[] getSlides();
- public MasterSheet[] getMasterSheet();
+ Slide[] getSlides();
+ MasterSheet[] getMasterSheet();
- public Resources getResources();
+ Resources getResources();
+
+ /**
+ * Returns the current page size
+ *
+ * @return the page size
+ */
+ Dimension getPageSize();
}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/SolidPaint.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/SolidPaint.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/SolidPaint.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/SolidPaint.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,23 @@
+/* ====================================================================
+ 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 SolidPaint extends PaintStyle {
+ ColorStyle getSolidColor();
+}
Copied: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/StrokeStyle.java (from r1647885, poi/trunk/src/scratchpad/src/org/apache/poi/sl/usermodel/LineStyle.java)
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/StrokeStyle.java?p2=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/StrokeStyle.java&p1=poi/trunk/src/scratchpad/src/org/apache/poi/sl/usermodel/LineStyle.java&r1=1647885&r2=1661322&rev=1661322&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/sl/usermodel/LineStyle.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/StrokeStyle.java Sat Feb 21 10:56:03 2015
@@ -17,5 +17,43 @@
package org.apache.poi.sl.usermodel;
-public interface LineStyle extends org.apache.poi.common.usermodel.LineStyle {
+public interface StrokeStyle {
+ enum LineCap {
+ /** Rounded ends */
+ ROUND,
+ /** Square protrudes by half line width */
+ SQUARE,
+ /** Line ends at end point*/
+ FLAT;
+ }
+
+ /**
+ * The line dash with pattern.
+ * The pattern is derived empirically on PowerPoint 2010 and needs to be multiplied
+ * with actual line width
+ */
+ enum LineDash {
+ SOLID(1),
+ DOT(1,1),
+ DASH(3,4),
+ LG_DASH(8,3),
+ DASH_DOT(4,3,1,3),
+ LG_DASH_DOT(8,3,1,3),
+ LG_DASH_DOT_DOT(8,3,1,3,1,3),
+ SYS_DASH(2,2),
+ SYS_DOT(1,1),
+ SYS_DASH_DOT,
+ SYS_DASH_DOT_DOT;
+
+ public int pattern[];
+
+ LineDash(int... pattern) {
+ this.pattern = (pattern == null || pattern.length == 0) ? new int[]{1} : pattern;
+ }
+ }
+
+ PaintStyle getPaint();
+ LineCap getLineCap();
+ LineDash getLineDash();
+ double getLineWidth();
}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextParagraph.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextParagraph.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextParagraph.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextParagraph.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,132 @@
+/* ====================================================================
+ 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;
+
+import java.awt.Color;
+
+
+public interface TextParagraph extends Iterable<TextRun> {
+ /**
+ * Specified a list of text alignment types
+ */
+ public enum TextAlign {
+ /**
+ * Align text to the left margin.
+ */
+ LEFT,
+ /**
+ * Align text in the center.
+ */
+ CENTER,
+
+ /**
+ * Align text to the right margin.
+ */
+ RIGHT,
+
+ /**
+ * Align text so that it is justified across the whole line. It
+ * is smart in the sense that it will not justify sentences
+ * which are short
+ */
+ JUSTIFY,
+ JUSTIFY_LOW,
+ DIST,
+ THAI_DIST
+ }
+
+ public interface BulletStyle {
+ String getBulletCharacter();
+ String getBulletFont();
+ double getBulletFontSize();
+ Color getBulletFontColor();
+ }
+
+ /**
+ * The amount of vertical white space before the paragraph
+ * This may be specified in two different ways, percentage spacing and font point spacing:
+ * <p>
+ * 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
+ * </p>
+ *
+ * @return the vertical white space before the paragraph
+ */
+ double getSpaceBefore();
+
+ /**
+ * The amount of vertical white space after the paragraph
+ * This may be specified in two different ways, percentage spacing and font point spacing:
+ * <p>
+ * 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
+ * </p>
+ *
+ * @return the vertical white space after the paragraph
+ */
+ double getSpaceAfter();
+
+ /**
+ * @return the left margin (in points) of the paragraph
+ */
+ double getLeftMargin();
+
+ /**
+ * @return the right margin (in points) of the paragraph
+ */
+ double getRightMargin();
+
+ /**
+ * @return the indent applied (in points) to the first line of text in the paragraph.
+ */
+ double getIndent();
+
+ /**
+ * Returns the vertical line spacing that is to be used within a paragraph.
+ * This may be specified in two different ways, percentage spacing and font point spacing:
+ * <p>
+ * If linespacing >= 0, then linespacing is a percentage of normal line height.
+ * If linespacing < 0, the absolute value of linespacing is the spacing in points
+ * </p>
+ *
+ * @return the vertical line spacing.
+ */
+ double getLineSpacing();
+
+ String getDefaultFontFamily();
+
+ /**
+ * @return the default font size, in case its not set in the textrun
+ */
+ double getDefaultFontSize();
+
+ /**
+ * Returns the alignment that is applied to the paragraph.
+ *
+ * If this attribute is omitted, then a value of left is implied.
+ * @return ??? alignment that is applied to the paragraph
+ */
+ TextAlign getTextAlign();
+
+ /**
+ * @return the bullet style of the paragraph, if {@code null} then no bullets are used
+ */
+ BulletStyle getBulletStyle();
+
+ TextShape getParentShape();
+}
Modified: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextRun.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextRun.java?rev=1661322&r1=1661321&r2=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextRun.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextRun.java Sat Feb 21 10:56:03 2015
@@ -17,14 +17,38 @@
package org.apache.poi.sl.usermodel;
+import java.awt.Color;
+
/**
* Some text.
*
* TODO - decide on how we do rich text stuff
*/
public interface TextRun {
- public String getText();
+ enum TextCap {
+ NONE,
+ SMALL,
+ ALL
+ }
+
+ public String getText();
public void setText(String text);
- // TODO - rich text formatting stuff
+ TextCap getTextCap();
+
+ Color getFontColor();
+ double getFontSize();
+ String getFontFamily();
+
+ boolean isBold();
+ boolean isItalic();
+ boolean isUnderline();
+ boolean isStrikethrough();
+ boolean isSubscript();
+ boolean isSuperscript();
+
+ /**
+ * @return the pitch and family id or -1 if not applicable
+ */
+ byte getPitchAndFamily();
}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextShape.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextShape.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextShape.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TextShape.java Sat Feb 21 10:56:03 2015
@@ -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.usermodel;
+
+
+
+public interface TextShape extends SimpleShape, Iterable<TextParagraph> {
+ /**
+ * Vertical Text Types
+ */
+ public enum TextDirection {
+ /**
+ * Horizontal text. This should be default.
+ */
+ HORIZONTAL,
+ /**
+ * Vertical orientation.
+ * (each line is 90 degrees rotated clockwise, so it goes
+ * from top to bottom; each next line is to the left from
+ * the previous one).
+ */
+ VERTICAL,
+ /**
+ * Vertical orientation.
+ * (each line is 270 degrees rotated clockwise, so it goes
+ * from bottom to top; each next line is to the right from
+ * the previous one).
+ */
+ VERTICAL_270,
+ /**
+ * Determines if all of the text is vertical
+ * ("one letter on top of another").
+ */
+ STACKED;
+ }
+
+ /**
+ * Specifies alist of auto-fit types.
+ * <p>
+ * Autofit specofies that a shape should be auto-fit to fully contain the text described within it.
+ * Auto-fitting is when text within a shape is scaled in order to contain all the text inside
+ * </p>
+ */
+ public enum TextAutofit {
+ /**
+ * Specifies that text within the text body should not be auto-fit to the bounding box.
+ * Auto-fitting is when text within a text box is scaled in order to remain inside
+ * the text box.
+ */
+ NONE,
+ /**
+ * Specifies that text within the text body should be normally auto-fit to the bounding box.
+ * Autofitting is when text within a text box is scaled in order to remain inside the text box.
+ *
+ * <p>
+ * <em>Example:</em> Consider the situation where a user is building a diagram and needs
+ * to have the text for each shape that they are using stay within the bounds of the shape.
+ * An easy way this might be done is by using NORMAL autofit
+ * </p>
+ */
+ NORMAL,
+ /**
+ * Specifies that a shape should be auto-fit to fully contain the text described within it.
+ * Auto-fitting is when text within a shape is scaled in order to contain all the text inside.
+ *
+ * <p>
+ * <em>Example:</em> Consider the situation where a user is building a diagram and needs to have
+ * the text for each shape that they are using stay within the bounds of the shape.
+ * An easy way this might be done is by using SHAPE autofit
+ * </p>
+ */
+ SHAPE
+ }
+
+ /**
+ * @return text shape margin
+ */
+ Insets2D getInsets();
+
+ /**
+ * Compute the cumulative height occupied by the text
+ */
+ double getTextHeight();
+
+ /**
+ * Returns the type of vertical alignment for the text.
+ *
+ * @return the type of vertical alignment
+ */
+ VerticalAlignment getVerticalAlignment();
+
+ /**
+ * @return whether to wrap words within the bounding rectangle
+ */
+ boolean getWordWrap();
+
+ /**
+ * @return vertical orientation of the text
+ */
+ TextDirection getTextDirection();
+}
Added: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TexturePaint.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TexturePaint.java?rev=1661322&view=auto
==============================================================================
--- poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TexturePaint.java (added)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/TexturePaint.java Sat Feb 21 10:56:03 2015
@@ -0,0 +1,37 @@
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+package org.apache.poi.sl.usermodel;
+
+import java.io.InputStream;
+
+public interface TexturePaint extends PaintStyle {
+ /**
+ * @return the raw image stream
+ */
+ InputStream getImageData();
+
+ /**
+ * @return the content type of the image data
+ */
+ String getContentType();
+
+ /**
+ * @return the alpha mask in percents [0..100000]
+ */
+ int getAlpha();
+}
Copied: poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/VerticalAlignment.java (from r1661320, poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/VerticalAlignment.java)
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/VerticalAlignment.java?p2=poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/VerticalAlignment.java&p1=poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/VerticalAlignment.java&r1=1661320&r2=1661322&rev=1661322&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xslf/usermodel/VerticalAlignment.java (original)
+++ poi/branches/common_sl/src/scratchpad/src/org/apache/poi/sl/usermodel/VerticalAlignment.java Sat Feb 21 10:56:03 2015
@@ -16,7 +16,7 @@
* limitations under the License.
* ====================================================================
*/
-package org.apache.poi.xslf.usermodel;
+package org.apache.poi.sl.usermodel;
/**
* Specifies a list of available anchoring types for text
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org