]> source.dussan.org Git - poi.git/commitdiff
added ASL header to drawing classes
authorAndreas Beeker <kiwiwings@apache.org>
Thu, 9 Jul 2015 22:46:29 +0000 (22:46 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Thu, 9 Jul 2015 22:46:29 +0000 (22:46 +0000)
fixed a few rendering NPEs
added dummy interfaces for table / connector shapes

git-svn-id: https://svn.apache.org/repos/asf/poi/branches/common_sl@1690185 13f79535-47bb-0310-9956-ffa450edef68

23 files changed:
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFConnectorShape.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java
src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTable.java
src/scratchpad/src/org/apache/poi/sl/draw/DrawAutoShape.java
src/scratchpad/src/org/apache/poi/sl/draw/DrawBackground.java
src/scratchpad/src/org/apache/poi/sl/draw/DrawConnectorShape.java [new file with mode: 0644]
src/scratchpad/src/org/apache/poi/sl/draw/DrawFactory.java
src/scratchpad/src/org/apache/poi/sl/draw/DrawFreeformShape.java
src/scratchpad/src/org/apache/poi/sl/draw/DrawGroupShape.java
src/scratchpad/src/org/apache/poi/sl/draw/DrawMasterSheet.java
src/scratchpad/src/org/apache/poi/sl/draw/DrawPictureShape.java
src/scratchpad/src/org/apache/poi/sl/draw/DrawShape.java
src/scratchpad/src/org/apache/poi/sl/draw/DrawSheet.java
src/scratchpad/src/org/apache/poi/sl/draw/DrawSimpleShape.java
src/scratchpad/src/org/apache/poi/sl/draw/DrawSlide.java
src/scratchpad/src/org/apache/poi/sl/draw/DrawTableShape.java [new file with mode: 0644]
src/scratchpad/src/org/apache/poi/sl/draw/DrawTextBox.java
src/scratchpad/src/org/apache/poi/sl/draw/DrawTextFragment.java
src/scratchpad/src/org/apache/poi/sl/draw/DrawTextParagraph.java
src/scratchpad/src/org/apache/poi/sl/draw/DrawTextShape.java
src/scratchpad/src/org/apache/poi/sl/usermodel/ConnectorShape.java [new file with mode: 0644]
src/scratchpad/src/org/apache/poi/sl/usermodel/TableShape.java [new file with mode: 0644]

index 8cc1c927459eb59010a6222f80d5fdc98d96ddb9..b894cd080df28c39bc29beeb77ce32cbbc4aeed9 100644 (file)
@@ -19,6 +19,7 @@
 \r
 package org.apache.poi.xslf.usermodel;\r
 \r
+import org.apache.poi.sl.usermodel.ConnectorShape;\r
 import org.apache.poi.util.Beta;\r
 import org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties;\r
 import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps;\r
@@ -34,7 +35,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.CTConnectorNonVisual
  * @author Yegor Kozlov\r
  */\r
 @Beta\r
-public class XSLFConnectorShape extends XSLFSimpleShape {\r
+public class XSLFConnectorShape extends XSLFSimpleShape implements ConnectorShape {\r
 \r
     /*package*/ XSLFConnectorShape(CTConnector shape, XSLFSheet sheet) {\r
         super(shape, sheet);\r
@@ -43,6 +44,7 @@ public class XSLFConnectorShape extends XSLFSimpleShape {
     /**\r
      * @param shapeId 1-based shapeId\r
      */\r
+    @SuppressWarnings("unused")\r
     static CTConnector prototype(int shapeId) {\r
         CTConnector ct = CTConnector.Factory.newInstance();\r
         CTConnectorNonVisual nvSpPr = ct.addNewNvCxnSpPr();\r
index fb971806056a3964e3f49fbabad354c09e7ceca5..ee374602e1add5f8924c487c777ac28d16c507b0 100644 (file)
@@ -77,7 +77,7 @@ public abstract class XSLFSimpleShape extends XSLFShape implements SimpleShape {
     protected CTTransform2D getXfrm() {\r
         PropertyFetcher<CTTransform2D> fetcher = new PropertyFetcher<CTTransform2D>() {\r
             public boolean fetch(XSLFShape shape) {\r
-                CTShapeProperties pr = getSpPr();\r
+                CTShapeProperties pr = shape.getSpPr();\r
                 if (pr.isSetXfrm()) {\r
                     setValue(pr.getXfrm());\r
                     return true;\r
index a6ec8bcfe774d4a033be21e94a52fdeee1b4ed39..9f2bb490327f1258209cf78762a378ee4580f0a4 100644 (file)
@@ -27,6 +27,7 @@ import java.util.List;
 import javax.xml.namespace.QName;\r
 \r
 import org.apache.poi.POIXMLException;\r
+import org.apache.poi.sl.usermodel.TableShape;\r
 import org.apache.poi.util.Internal;\r
 import org.apache.poi.util.Units;\r
 import org.apache.xmlbeans.XmlCursor;\r
@@ -45,7 +46,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.CTGraphicalObjectFra
  *\r
  * @author Yegor Kozlov\r
  */\r
-public class XSLFTable extends XSLFGraphicFrame implements Iterable<XSLFTableRow> {\r
+public class XSLFTable extends XSLFGraphicFrame implements Iterable<XSLFTableRow>, TableShape {\r
     static String TABLE_URI = "http://schemas.openxmlformats.org/drawingml/2006/table";\r
 \r
     private CTTable _table;\r
index 69a89555c8fc34c191a684b82390ad01ffd385e2..29fdee2dc5e16354eb0621cbf6fb1dad1e442506 100644 (file)
@@ -21,6 +21,7 @@ import org.apache.poi.ddf.*;
 import org.apache.poi.hslf.model.Line;
 import org.apache.poi.hslf.usermodel.*;
 import org.apache.poi.sl.usermodel.ShapeContainer;
+import org.apache.poi.sl.usermodel.TableShape;
 import org.apache.poi.util.LittleEndian;
 
 import java.util.*;
@@ -32,7 +33,7 @@ import java.awt.*;
  *
  * @author Yegor Kozlov
  */
-public final class HSLFTable extends HSLFGroupShape {
+public final class HSLFTable extends HSLFGroupShape implements TableShape {
 
     protected static final int BORDER_TOP = 1;
     protected static final int BORDER_RIGHT = 2;
index f9fc966575a60cd7f0470314ffed6b88a73f48e6..6af2b4b9c18d56669483edee04e7c9504f98b8d9 100644 (file)
@@ -1,3 +1,20 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
 package org.apache.poi.sl.draw;\r
 \r
 import org.apache.poi.sl.usermodel.*;\r
index 7b78c69aa363d522b841cd7ae8cd7b7d4c19428c..35c844d8d053682810a9136ff6f9cc095df7af08 100644 (file)
@@ -1,3 +1,20 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
 package org.apache.poi.sl.draw;\r
 \r
 import java.awt.*;\r
diff --git a/src/scratchpad/src/org/apache/poi/sl/draw/DrawConnectorShape.java b/src/scratchpad/src/org/apache/poi/sl/draw/DrawConnectorShape.java
new file mode 100644 (file)
index 0000000..0fee07c
--- /dev/null
@@ -0,0 +1,26 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
+package org.apache.poi.sl.draw;\r
+\r
+import org.apache.poi.sl.usermodel.*;\r
+\r
+public class DrawConnectorShape<T extends ConnectorShape> extends DrawSimpleShape<T> {\r
+    public DrawConnectorShape(T shape) {\r
+        super(shape);\r
+    }\r
+}\r
index 6eb30eb7078001d69fc09f03d43521b8fd8cc751..97b3f52147c678c8f92024596a6c3346c4e37495 100644 (file)
@@ -75,6 +75,10 @@ public class DrawFactory {
             return getDrawable((PictureShape)shape);\r
         } else if (shape instanceof Background) {\r
             return getDrawable((Background)shape);\r
+        } else if (shape instanceof ConnectorShape) {\r
+            return getDrawable((ConnectorShape)shape);\r
+        } else if (shape instanceof TableShape) {\r
+            return getDrawable((TableShape)shape);\r
         } else if (shape instanceof Slide) {\r
             return getDrawable((Slide<? extends Shape, ? extends SlideShow, ? extends Notes<?,?>>)shape);\r
         } else if (shape instanceof MasterSheet) {\r
@@ -106,6 +110,14 @@ public class DrawFactory {
         return new DrawFreeformShape<T>(shape);\r
     }\r
 \r
+    public <T extends ConnectorShape> DrawConnectorShape<T> getDrawable(T shape) {\r
+        return new DrawConnectorShape<T>(shape);\r
+    }\r
+    \r
+    public <T extends TableShape> DrawTableShape<T> getDrawable(T shape) {\r
+        return new DrawTableShape<T>(shape);\r
+    }\r
+    \r
     public <T extends TextShape<? extends TextParagraph<? extends TextRun>>> DrawTextShape<T> getDrawable(T shape) {\r
         return new DrawTextShape<T>(shape);\r
     }\r
index ed237997a6ec577faa8b9d148d201065ec708e9f..b8dd7c3f203948e794b1e3ceb03dc37632988987 100644 (file)
@@ -1,3 +1,20 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
 package org.apache.poi.sl.draw;\r
 \r
 import org.apache.poi.sl.usermodel.*;\r
index 31f2496b32f4d0bb9413cd1359ef11a7ef8effea..60af5f710e636c6cc4c2a12b545d628e3f9c8878 100644 (file)
@@ -1,3 +1,20 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
 package org.apache.poi.sl.draw;\r
 \r
 import java.awt.Graphics2D;\r
index 452704a757bdede56562dd855c20c3c85a9d3c05..6b5d0781dfec2cc9a7415ad1b7324b7db07b116e 100644 (file)
@@ -1,3 +1,20 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
 package org.apache.poi.sl.draw;\r
 \r
 import org.apache.poi.sl.usermodel.*;\r
index 72a59b8b6035eb2f595aad195f3d3521596c405f..3d00b4ec6bfdf69beb52996004add0d278a0e9ee 100644 (file)
@@ -1,3 +1,20 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
 package org.apache.poi.sl.draw;\r
 \r
 import java.awt.Graphics2D;\r
index 70307578bfe28576f061a289928ab3894388e866..c2c9b5f680dc54d17302dbd85ad7947cb09cdbb6 100644 (file)
@@ -1,3 +1,20 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
 package org.apache.poi.sl.draw;\r
 \r
 import java.awt.Graphics2D;\r
index 551d0527d6611923d93c508892ee17037cab9133..e4c7e185e8a4e09818338841a79ddcccc3254700 100644 (file)
@@ -1,3 +1,20 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
 package org.apache.poi.sl.draw;\r
 \r
 import java.awt.Dimension;\r
index 4ff0034eba640b76f5b8313375a776cc3c359642..bdd65df6b22f89251fe8465a3fe76fea394cd410 100644 (file)
@@ -1,3 +1,20 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
 package org.apache.poi.sl.draw;\r
 \r
 import java.awt.*;\r
index 4f5f631aee889607b442a7752e730260883ea286..70c54d18f7dea8c31aedda9a2cfba44ea71faafc 100644 (file)
@@ -1,3 +1,20 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
 package org.apache.poi.sl.draw;\r
 \r
 import java.awt.Graphics2D;\r
diff --git a/src/scratchpad/src/org/apache/poi/sl/draw/DrawTableShape.java b/src/scratchpad/src/org/apache/poi/sl/draw/DrawTableShape.java
new file mode 100644 (file)
index 0000000..ceb6450
--- /dev/null
@@ -0,0 +1,27 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
+package org.apache.poi.sl.draw;\r
+\r
+import org.apache.poi.sl.usermodel.*;\r
+\r
+public class DrawTableShape<T extends TableShape> extends DrawShape<T> {\r
+    // to be implemented ...\r
+    public DrawTableShape(T shape) {\r
+        super(shape);\r
+    }\r
+}\r
index 3c228686f17bd6430660ee6f51adf46000b352e1..89d69223ff10537acdd274aa85966c9d63f9f78a 100644 (file)
@@ -1,3 +1,20 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
 package org.apache.poi.sl.draw;\r
 \r
 import org.apache.poi.sl.usermodel.*;\r
index 4b2c79e37834ffbe29a8c6da66ae36aff391117b..acb6b4c766fd493c9748a0fafac89731d3c36c13 100644 (file)
@@ -1,3 +1,20 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
 package org.apache.poi.sl.draw;\r
 \r
 import java.awt.Graphics2D;\r
index c83abbd5a597b68e5ca77e8c033ed1bb7d154efc..6b118617e7ba14169e30e26f0947452b15d78c24 100644 (file)
@@ -1,3 +1,20 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
 package org.apache.poi.sl.draw;\r
 \r
 import java.awt.Color;\r
index 2212935115f059c427ecadc91d5b739cc069d088..77927bdc69b07558fc902f217ad0f50cb38b848e 100644 (file)
@@ -1,13 +1,31 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
 package org.apache.poi.sl.draw;\r
 \r
 import java.awt.Graphics2D;\r
 import java.awt.geom.AffineTransform;\r
 import java.awt.geom.Rectangle2D;\r
 import java.awt.image.BufferedImage;\r
-import java.util.Iterator;\r
+import java.util.*;\r
 \r
 import org.apache.poi.sl.usermodel.*;\r
 import org.apache.poi.sl.usermodel.TextParagraph.BulletStyle;\r
+import org.apache.poi.util.JvmBugs;\r
 \r
 public class DrawTextShape<T extends TextShape<? extends TextParagraph<? extends TextRun>>> extends DrawSimpleShape<T> {\r
 \r
@@ -146,6 +164,17 @@ public class DrawTextShape<T extends TextShape<? extends TextParagraph<? extends
         // dry-run in a 1x1 image and return the vertical advance\r
         BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);\r
         Graphics2D graphics = img.createGraphics();\r
+        fixFonts(graphics);\r
         return drawParagraphs(graphics, 0, 0);\r
     }\r
+    \r
+    @SuppressWarnings("unchecked")\r
+    private static void fixFonts(Graphics2D graphics) {\r
+        if (!JvmBugs.hasLineBreakMeasurerBug()) return;\r
+        Map<String,String> fontMap = (Map<String,String>)graphics.getRenderingHint(Drawable.FONT_MAP);\r
+        if (fontMap == null) fontMap = new HashMap<String,String>();\r
+        fontMap.put("Calibri", "Lucida Sans");\r
+        fontMap.put("Cambria", "Lucida Bright");\r
+        graphics.setRenderingHint(Drawable.FONT_MAP, fontMap);        \r
+    }\r
 }\r
diff --git a/src/scratchpad/src/org/apache/poi/sl/usermodel/ConnectorShape.java b/src/scratchpad/src/org/apache/poi/sl/usermodel/ConnectorShape.java
new file mode 100644 (file)
index 0000000..7e2bbf0
--- /dev/null
@@ -0,0 +1,22 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
+package org.apache.poi.sl.usermodel;\r
+\r
+public interface ConnectorShape extends SimpleShape {\r
+\r
+}\r
diff --git a/src/scratchpad/src/org/apache/poi/sl/usermodel/TableShape.java b/src/scratchpad/src/org/apache/poi/sl/usermodel/TableShape.java
new file mode 100644 (file)
index 0000000..48744ec
--- /dev/null
@@ -0,0 +1,22 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
+package org.apache.poi.sl.usermodel;\r
+\r
+public interface TableShape extends Shape {\r
+    // to be defined ...\r
+}\r