]> source.dussan.org Git - poi.git/commitdiff
Merged revisions 638786-638802,638805-638811,638813-638814,638816-639230,639233-63924...
authorNick Burch <nick@apache.org>
Mon, 14 Apr 2008 11:54:34 +0000 (11:54 +0000)
committerNick Burch <nick@apache.org>
Mon, 14 Apr 2008 11:54:34 +0000 (11:54 +0000)
https://svn.apache.org:443/repos/asf/poi/trunk

........
  r647712 | yegor | 2008-04-14 10:20:20 +0100 (Mon, 14 Apr 2008) | 1 line

  use commons logging throughout the code
........
  r647713 | yegor | 2008-04-14 10:21:57 +0100 (Mon, 14 Apr 2008) | 1 line

  misc usermodel improvements. Also added the source code for the ApacheconEU08 FFT presentation
........
  r647738 | nick | 2008-04-14 12:47:47 +0100 (Mon, 14 Apr 2008) | 1 line

  Switch to using our own logger, rather than the commons one
........

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

23 files changed:
src/documentation/content/xdocs/changes.xml
src/documentation/content/xdocs/status.xml
src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
src/scratchpad/examples/src/org/apache/poi/hslf/examples/ApacheconEU08.java [new file with mode: 0755]
src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java
src/scratchpad/src/org/apache/poi/hslf/model/Fill.java
src/scratchpad/src/org/apache/poi/hslf/model/Freeform.java [new file with mode: 0755]
src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java
src/scratchpad/src/org/apache/poi/hslf/model/Picture.java
src/scratchpad/src/org/apache/poi/hslf/model/Shape.java
src/scratchpad/src/org/apache/poi/hslf/model/ShapeGroup.java
src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java
src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java
src/scratchpad/src/org/apache/poi/hslf/record/Document.java
src/scratchpad/src/org/apache/poi/hslf/record/ExEmbed.java
src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlink.java
src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java
src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java
src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java
src/scratchpad/src/org/apache/poi/hslf/record/Record.java
src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java
src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java
src/scratchpad/testcases/org/apache/poi/hslf/model/TestPPGraphics2D.java

index b80dad7dbdb92b558d8c3ffa5f90f9c87b279652..d8c366b2be253be904120eb9bfc4860c636793e9 100644 (file)
@@ -44,6 +44,7 @@
            <action dev="POI-DEVELOPERS" type="add">Created a common interface for handling Excel files, irrespective of if they are .xls or .xlsx</action>
         </release>
         <release version="3.0.3-beta1" date="2008-04-??">
+           <action dev="POI-DEVELOPERS" type="fix">Fix the logger used by POIFSFileSystem, so that commons-logging isn't required when not used</action>
            <action dev="POI-DEVELOPERS" type="add">Update HSLFSlideShow and HSSFWorkbook to take advantage of POIFS updates, and allow reading embeded documents</action>
            <action dev="POI-DEVELOPERS" type="add">Improve how POIFS works with directory entries, and update HWPFDocument to support reading an embeded word document</action>
            <action dev="POI-DEVELOPERS" type="add">Initial support for getting and changing chart and series titles</action>
index a729ca242b0423137da60ce1d982e16c6ea6e32c..2b7cf09eb1a510dd7a22e6804f3ec379e697bc69 100644 (file)
@@ -41,6 +41,7 @@
            <action dev="POI-DEVELOPERS" type="add">Created a common interface for handling Excel files, irrespective of if they are .xls or .xlsx</action>
         </release>
         <release version="3.0.3-beta1" date="2008-04-??">
+           <action dev="POI-DEVELOPERS" type="fix">Fix the logger used by POIFSFileSystem, so that commons-logging isn't required when not used</action>
            <action dev="POI-DEVELOPERS" type="add">Update HSLFSlideShow and HSSFWorkbook to take advantage of POIFS updates, and allow reading embeded documents</action>
            <action dev="POI-DEVELOPERS" type="add">Improve how POIFS works with directory entries, and update HWPFDocument to support reading an embeded word document</action>
            <action dev="POI-DEVELOPERS" type="add">Initial support for getting and changing chart and series titles</action>
index 7c693a5de8663fac31d6f3caab3fe0b5532d1ab2..92348ceaffc22eb7f1770144c6169708ec6054c4 100644 (file)
@@ -31,8 +31,6 @@ import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.poifs.dev.POIFSViewable;
 import org.apache.poi.poifs.property.DirectoryProperty;
@@ -51,6 +49,8 @@ import org.apache.poi.poifs.storage.SmallBlockTableReader;
 import org.apache.poi.poifs.storage.SmallBlockTableWriter;
 import org.apache.poi.util.IOUtils;
 import org.apache.poi.util.LongField;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
 
 /**
  * This is the main class of the POIFS system; it manages the entire
@@ -62,7 +62,8 @@ import org.apache.poi.util.LongField;
 public class POIFSFileSystem
     implements POIFSViewable
 {
-    private static final Log _logger = LogFactory.getLog(POIFSFileSystem.class);
+       private static final POILogger _logger =
+               POILogFactory.getLogger(POIFSFileSystem.class);
     
     private static final class CloseIgnoringInputStream extends InputStream {
 
@@ -190,7 +191,7 @@ public class POIFSFileSystem
                     + "This will be a problem for the caller if the stream will still be used.  "
                     + "If that is the case the caller should wrap the input stream to avoid this close logic.  "
                     + "This warning is only temporary and will not be present in future versions of POI.";
-            _logger.warn(msg);
+            _logger.log(POILogger.WARN, msg);
         }
         try {
             stream.close();
diff --git a/src/scratchpad/examples/src/org/apache/poi/hslf/examples/ApacheconEU08.java b/src/scratchpad/examples/src/org/apache/poi/hslf/examples/ApacheconEU08.java
new file mode 100755 (executable)
index 0000000..0f28c2a
--- /dev/null
@@ -0,0 +1,515 @@
+\r
+/* ====================================================================\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.hslf.examples;\r
+\r
+import org.apache.poi.hslf.usermodel.*;\r
+import org.apache.poi.hslf.model.*;\r
+import org.apache.poi.hslf.record.TextHeaderAtom;\r
+\r
+import java.io.IOException;\r
+import java.io.FileOutputStream;\r
+import java.io.File;\r
+import java.awt.*;\r
+\r
+/**\r
+ * Presentation for Fast Feather Track on ApacheconEU 2008\r
+ * \r
+ * @author Yegor Kozlov\r
+ */\r
+public class ApacheconEU08 {\r
+\r
+    public static void main(String[] args) throws IOException {\r
+        SlideShow ppt = new SlideShow();\r
+        ppt.setPageSize(new Dimension(720, 540));\r
+\r
+        slide1(ppt);\r
+        slide2(ppt);\r
+        slide3(ppt);\r
+        slide4(ppt);\r
+        slide5(ppt);\r
+        slide6(ppt);\r
+        slide7(ppt);\r
+        slide8(ppt);\r
+        slide9(ppt);\r
+        slide10(ppt);\r
+        slide11(ppt);\r
+        slide12(ppt);\r
+\r
+        FileOutputStream out = new FileOutputStream("apachecon_eu_08.ppt");\r
+        ppt.write(out);\r
+        out.close();\r
+\r
+    }\r
+\r
+    public static void slide1(SlideShow ppt) throws IOException {\r
+        Slide slide = ppt.createSlide();\r
+\r
+        TextBox box1 = new TextBox();\r
+        TextRun tr1 = box1.getTextRun();\r
+        tr1.setRunType(TextHeaderAtom.CENTER_TITLE_TYPE);\r
+        tr1.setText("POI-HSLF");\r
+        box1.setAnchor(new Rectangle(54, 78, 612, 115));\r
+        slide.addShape(box1);\r
+\r
+        TextBox box2 = new TextBox();\r
+        TextRun tr2 = box2.getTextRun();\r
+        tr2.setRunType(TextHeaderAtom.CENTRE_BODY_TYPE);\r
+        tr2.setText("Java API To Access Microsoft PowerPoint Format Files");\r
+        box2.setAnchor(new Rectangle(108, 204, 504, 138));\r
+        slide.addShape(box2);\r
+\r
+        TextBox box3 = new TextBox();\r
+        TextRun tr3 = box3.getTextRun();\r
+        tr3.getRichTextRuns()[0].setFontSize(32);\r
+        box3.setHorizontalAlignment(TextBox.AlignCenter);\r
+        tr3.setText(\r
+                "Yegor Kozlov\r" +\r
+                "yegor - apache - org");\r
+        box3.setAnchor(new Rectangle(206, 348, 310, 84));\r
+        slide.addShape(box3);\r
+    }\r
+\r
+    public static void slide2(SlideShow ppt) throws IOException {\r
+        Slide slide = ppt.createSlide();\r
+\r
+        TextBox box1 = new TextBox();\r
+        TextRun tr1 = box1.getTextRun();\r
+        tr1.setRunType(TextHeaderAtom.TITLE_TYPE);\r
+        tr1.setText("What is HSLF?");\r
+        box1.setAnchor(new Rectangle(36, 21, 648, 90));\r
+        slide.addShape(box1);\r
+\r
+        TextBox box2 = new TextBox();\r
+        TextRun tr2 = box2.getTextRun();\r
+        tr2.setRunType(TextHeaderAtom.BODY_TYPE);\r
+        tr2.setText("HorribleSLideshowFormat is the POI Project's pure Java implementation " +\r
+                "of the Powerpoint binary file format. \r" +\r
+                "POI sub-project since 2005\r" +\r
+                "Started by Nick Birch, Yegor Kozlov joined soon after");\r
+        box2.setAnchor(new Rectangle(36, 126, 648, 356));\r
+        slide.addShape(box2);\r
+\r
+\r
+    }\r
+\r
+    public static void slide3(SlideShow ppt) throws IOException {\r
+        Slide slide = ppt.createSlide();\r
+\r
+        TextBox box1 = new TextBox();\r
+        TextRun tr1 = box1.getTextRun();\r
+        tr1.setRunType(TextHeaderAtom.TITLE_TYPE);\r
+        tr1.setText("HSLF in a Nutshell");\r
+        box1.setAnchor(new Rectangle(36, 15, 648, 65));\r
+        slide.addShape(box1);\r
+\r
+        TextBox box2 = new TextBox();\r
+        TextRun tr2 = box2.getTextRun();\r
+        tr2.setRunType(TextHeaderAtom.BODY_TYPE);\r
+        tr2.setText(\r
+                "HSLF provides a way to read, create and modify MS PowerPoint presentations\r" +\r
+                "Pure Java API - you don't need PowerPoint to read and write *.ppt files\r" +\r
+                "Comprehensive support of PowerPoint objects");\r
+        tr2.getRichTextRuns()[0].setFontSize(28);\r
+        box2.setAnchor(new Rectangle(36, 80, 648, 200));\r
+        slide.addShape(box2);\r
+\r
+        TextBox box3 = new TextBox();\r
+        TextRun tr3 = box3.getTextRun();\r
+        tr3.setRunType(TextHeaderAtom.BODY_TYPE);\r
+        tr3.setText(\r
+                "Rich text\r" +\r
+                "Tables\r" +\r
+                "Shapes\r" +\r
+                "Pictures\r" +\r
+                "Master slides");\r
+        tr3.getRichTextRuns()[0].setFontSize(24);\r
+        tr3.getRichTextRuns()[0].setIndentLevel(1);\r
+        box3.setAnchor(new Rectangle(36, 265, 648, 150));\r
+        slide.addShape(box3);\r
+\r
+        TextBox box4 = new TextBox();\r
+        TextRun tr4 = box4.getTextRun();\r
+        tr4.setRunType(TextHeaderAtom.BODY_TYPE);\r
+        tr4.setText("Access to low level data structures");\r
+        box4.setAnchor(new Rectangle(36, 430, 648, 50));\r
+        slide.addShape(box4);\r
+    }\r
+\r
+    public static void slide4(SlideShow ppt) throws IOException {\r
+        Slide slide = ppt.createSlide();\r
+\r
+        String[][] txt1 = {\r
+            {"Note"},\r
+            {"This presentation was created programmatically using POI HSLF"}\r
+        };\r
+        Table table1 = new Table(2, 1);\r
+        for (int i = 0; i < txt1.length; i++) {\r
+            for (int j = 0; j < txt1[i].length; j++) {\r
+                TableCell cell = table1.getCell(i, j);\r
+                cell.setText(txt1[i][j]);\r
+                cell.getTextRun().getRichTextRuns()[0].setFontSize(10);\r
+                RichTextRun rt = cell.getTextRun().getRichTextRuns()[0];\r
+                rt.setFontName("Arial");\r
+                rt.setBold(true);\r
+                if(i == 0){\r
+                    rt.setFontSize(32);\r
+                    rt.setFontColor(Color.white);\r
+                    cell.getFill().setForegroundColor(new Color(0, 153, 204));\r
+                } else {\r
+                    rt.setFontSize(28);\r
+                    cell.getFill().setForegroundColor(new Color(235, 239, 241));\r
+                }\r
+                cell.setVerticalAlignment(TextBox.AnchorMiddle);\r
+            }\r
+        }\r
+\r
+        Line border1 = table1.createBorder();\r
+        border1.setLineColor(Color.black);\r
+        border1.setLineWidth(1.0);\r
+        table1.setAllBorders(border1);\r
+\r
+        Line border2 = table1.createBorder();\r
+        border2.setLineColor(Color.black);\r
+        border2.setLineWidth(2.0);\r
+        table1.setOutsideBorders(border2);\r
+\r
+        table1.setColumnWidth(0, 510);\r
+        table1.setRowHeight(0, 60);\r
+        table1.setRowHeight(1, 100);\r
+        slide.addShape(table1);\r
+\r
+        table1.moveTo(100, 100);\r
+\r
+        TextBox box1 = new TextBox();\r
+        box1.setHorizontalAlignment(TextBox.AlignCenter);\r
+        TextRun tr1 = box1.getTextRun();\r
+        tr1.setText("The source code is available at\r" +\r
+                "http://people.apache.org/~yegor/apachecon_eu08/");\r
+        RichTextRun rt = tr1.getRichTextRuns()[0];\r
+        rt.setFontSize(24);\r
+        box1.setAnchor(new Rectangle(80, 356, 553, 65));\r
+        slide.addShape(box1);\r
+\r
+    }\r
+\r
+    public static void slide5(SlideShow ppt) throws IOException {\r
+        Slide slide = ppt.createSlide();\r
+\r
+        TextBox box1 = new TextBox();\r
+        TextRun tr1 = box1.getTextRun();\r
+        tr1.setRunType(TextHeaderAtom.TITLE_TYPE);\r
+        tr1.setText("HSLF in Action - 1\rData Extraction");\r
+        box1.setAnchor(new Rectangle(36, 21, 648, 100));\r
+        slide.addShape(box1);\r
+\r
+        TextBox box2 = new TextBox();\r
+        TextRun tr2 = box2.getTextRun();\r
+        tr2.setRunType(TextHeaderAtom.BODY_TYPE);\r
+        tr2.setText(\r
+                "Text from slides and notes\r" +\r
+                "Images\r" +\r
+                "Shapes and their properties (type, position in the slide, color, font, etc.)");\r
+        box2.setAnchor(new Rectangle(36, 150, 648, 300));\r
+        slide.addShape(box2);\r
+\r
+\r
+    }\r
+\r
+    public static void slide6(SlideShow ppt) throws IOException {\r
+        Slide slide = ppt.createSlide();\r
+\r
+        TextBox box1 = new TextBox();\r
+        TextRun tr1 = box1.getTextRun();\r
+        tr1.setRunType(TextHeaderAtom.TITLE_TYPE);\r
+        tr1.setText("HSLF in Action - 2");\r
+        box1.setAnchor(new Rectangle(36, 20, 648, 90));\r
+        slide.addShape(box1);\r
+\r
+        TextBox box2 = new TextBox();\r
+        TextRun tr2 = box2.getTextRun();\r
+        tr2.getRichTextRuns()[0].setFontSize(18);\r
+        tr2.setText("Creating a simple presentation from scratch");\r
+        box2.setAnchor(new Rectangle(170, 100, 364, 30));\r
+        slide.addShape(box2);\r
+\r
+        TextBox box3 = new TextBox();\r
+        TextRun tr3 = box3.getTextRun();\r
+        RichTextRun rt3 = tr3.getRichTextRuns()[0];\r
+        rt3.setFontName("Courier New");\r
+        rt3.setFontSize(8);\r
+        tr3.setText(\r
+                "        SlideShow ppt = new SlideShow();\r" +\r
+                "        Slide slide = ppt.createSlide();\r" +\r
+                "\r" +\r
+                "        TextBox box2 = new TextBox();\r" +\r
+                "        box2.setHorizontalAlignment(TextBox.AlignCenter);\r" +\r
+                "        box2.setVerticalAlignment(TextBox.AnchorMiddle);\r" +\r
+                "        box2.getTextRun().setText(\"Java Code\");\r" +\r
+                "        box2.getFill().setForegroundColor(new Color(187, 224, 227));\r" +\r
+                "        box2.setLineColor(Color.black);\r" +\r
+                "        box2.setLineWidth(0.75);\r" +\r
+                "        box2.setAnchor(new Rectangle(66, 243, 170, 170));\r" +\r
+                "        slide.addShape(box2);\r" +\r
+                "\r" +\r
+                "        TextBox box3 = new TextBox();\r" +\r
+                "        box3.setHorizontalAlignment(TextBox.AlignCenter);\r" +\r
+                "        box3.setVerticalAlignment(TextBox.AnchorMiddle);\r" +\r
+                "        box3.getTextRun().setText(\"*.ppt file\");\r" +\r
+                "        box3.setLineWidth(0.75);\r" +\r
+                "        box3.setLineColor(Color.black);\r" +\r
+                "        box3.getFill().setForegroundColor(new Color(187, 224, 227));\r" +\r
+                "        box3.setAnchor(new Rectangle(473, 243, 170, 170));\r" +\r
+                "        slide.addShape(box3);\r" +\r
+                "\r" +\r
+                "        AutoShape box4 = new AutoShape(ShapeTypes.Arrow);\r" +\r
+                "        box4.getFill().setForegroundColor(new Color(187, 224, 227));\r" +\r
+                "        box4.setLineWidth(0.75);\r" +\r
+                "        box4.setLineColor(Color.black);\r" +\r
+                "        box4.setAnchor(new Rectangle(253, 288, 198, 85));\r" +\r
+                "        slide.addShape(box4);\r" +\r
+                "\r" +\r
+                "        FileOutputStream out = new FileOutputStream(\"hslf-demo.ppt\");\r" +\r
+                "        ppt.write(out);\r" +\r
+                "        out.close();");\r
+        box3.setAnchor(new Rectangle(30, 150, 618, 411));\r
+        slide.addShape(box3);\r
+    }\r
+\r
+    public static void slide7(SlideShow ppt) throws IOException {\r
+        Slide slide = ppt.createSlide();\r
+\r
+        TextBox box2 = new TextBox();\r
+        box2.setHorizontalAlignment(TextBox.AlignCenter);\r
+        box2.setVerticalAlignment(TextBox.AnchorMiddle);\r
+        box2.getTextRun().setText("Java Code");\r
+        box2.getFill().setForegroundColor(new Color(187, 224, 227));\r
+        box2.setLineColor(Color.black);\r
+        box2.setLineWidth(0.75);\r
+        box2.setAnchor(new Rectangle(66, 243, 170, 170));\r
+        slide.addShape(box2);\r
+\r
+        TextBox box3 = new TextBox();\r
+        box3.setHorizontalAlignment(TextBox.AlignCenter);\r
+        box3.setVerticalAlignment(TextBox.AnchorMiddle);\r
+        box3.getTextRun().setText("*.ppt file");\r
+        box3.setLineWidth(0.75);\r
+        box3.setLineColor(Color.black);\r
+        box3.getFill().setForegroundColor(new Color(187, 224, 227));\r
+        box3.setAnchor(new Rectangle(473, 243, 170, 170));\r
+        slide.addShape(box3);\r
+\r
+        AutoShape box4 = new AutoShape(ShapeTypes.Arrow);\r
+        box4.getFill().setForegroundColor(new Color(187, 224, 227));\r
+        box4.setLineWidth(0.75);\r
+        box4.setLineColor(Color.black);\r
+        box4.setAnchor(new Rectangle(253, 288, 198, 85));\r
+        slide.addShape(box4);\r
+    }\r
+\r
+    public static void slide8(SlideShow ppt) throws IOException {\r
+        Slide slide = ppt.createSlide();\r
+\r
+        TextBox box1 = new TextBox();\r
+        TextRun tr1 = box1.getTextRun();\r
+        tr1.setRunType(TextHeaderAtom.TITLE_TYPE);\r
+        tr1.setText("Wait, there is more!");\r
+        box1.setAnchor(new Rectangle(36, 21, 648, 90));\r
+        slide.addShape(box1);\r
+\r
+        TextBox box2 = new TextBox();\r
+        TextRun tr2 = box2.getTextRun();\r
+        tr2.setRunType(TextHeaderAtom.BODY_TYPE);\r
+        tr2.setText(\r
+                "Rich text\r" +\r
+                "Tables\r" +\r
+                "Pictures (JPEG, PNG, BMP, WMF, PICT)\r" +\r
+                "Comprehensive formatting features");\r
+        box2.setAnchor(new Rectangle(36, 126, 648, 356));\r
+        slide.addShape(box2);\r
+    }\r
+\r
+    public static void slide9(SlideShow ppt) throws IOException {\r
+        Slide slide = ppt.createSlide();\r
+\r
+        TextBox box1 = new TextBox();\r
+        TextRun tr1 = box1.getTextRun();\r
+        tr1.setRunType(TextHeaderAtom.TITLE_TYPE);\r
+        tr1.setText("HSLF in Action - 3");\r
+        box1.setAnchor(new Rectangle(36, 20, 648, 50));\r
+        slide.addShape(box1);\r
+\r
+        TextBox box2 = new TextBox();\r
+        TextRun tr2 = box2.getTextRun();\r
+        tr2.getRichTextRuns()[0].setFontSize(18);\r
+        tr2.setText("PPGraphics2D: PowerPoint Graphics2D driver");\r
+        box2.setAnchor(new Rectangle(178, 70, 387, 30));\r
+        slide.addShape(box2);\r
+\r
+        TextBox box3 = new TextBox();\r
+        TextRun tr3 = box3.getTextRun();\r
+        RichTextRun rt3 = tr3.getRichTextRuns()[0];\r
+        rt3.setFontName("Courier New");\r
+        rt3.setFontSize(8);\r
+        tr3.setText(\r
+                "        //bar chart data. The first value is the bar color, the second is the width\r" +\r
+                "        Object[] def = new Object[]{\r" +\r
+                "            Color.yellow, new Integer(100),\r" +\r
+                "            Color.green, new Integer(150),\r" +\r
+                "            Color.gray, new Integer(75),\r" +\r
+                "            Color.red, new Integer(200),\r" +\r
+                "        };\r" +\r
+                "\r" +\r
+                "        SlideShow ppt = new SlideShow();\r" +\r
+                "        Slide slide = ppt.createSlide();\r" +\r
+                "\r" +\r
+                "        ShapeGroup group = new ShapeGroup();\r" +\r
+                "        //define position of the drawing in the slide\r" +\r
+                "        Rectangle bounds = new java.awt.Rectangle(200, 100, 350, 300);\r" +\r
+                "        group.setAnchor(bounds);\r" +\r
+                "        slide.addShape(group);\r" +\r
+                "        Graphics2D graphics = new PPGraphics2D(group);\r" +\r
+                "\r" +\r
+                "        //draw a simple bar graph\r" +\r
+                "        int x = bounds.x + 50, y = bounds.y + 50;\r" +\r
+                "        graphics.setFont(new Font(\"Arial\", Font.BOLD, 10));\r" +\r
+                "        for (int i = 0, idx = 1; i < def.length; i+=2, idx++) {\r" +\r
+                "            graphics.setColor(Color.black);\r" +\r
+                "            int width = ((Integer)def[i+1]).intValue();\r" +\r
+                "            graphics.drawString(\"Q\" + idx, x-20, y+20);\r" +\r
+                "            graphics.drawString(width + \"%\", x + width + 10, y + 20);\r" +\r
+                "            graphics.setColor((Color)def[i]);\r" +\r
+                "            graphics.fill(new Rectangle(x, y, width, 30));\r" +\r
+                "            y += 40;\r" +\r
+                "        }\r" +\r
+                "        graphics.setColor(Color.black);\r" +\r
+                "        graphics.setFont(new Font(\"Arial\", Font.BOLD, 14));\r" +\r
+                "        graphics.draw(bounds);\r" +\r
+                "        graphics.drawString(\"Performance\", x + 70, y + 40);\r" +\r
+                "\r" +\r
+                "        FileOutputStream out = new FileOutputStream(\"hslf-demo.ppt\");\r" +\r
+                "        ppt.write(out);\r" +\r
+                "        out.close();");\r
+        box3.setAnchor(new Rectangle(96, 110, 499, 378));\r
+        slide.addShape(box3);\r
+    }\r
+\r
+    public static void slide10(SlideShow ppt) throws IOException {\r
+        //bar chart data. The first value is the bar color, the second is the width\r
+        Object[] def = new Object[]{\r
+            Color.yellow, new Integer(100),\r
+            Color.green, new Integer(150),\r
+            Color.gray, new Integer(75),\r
+            Color.red, new Integer(200),\r
+        };\r
+\r
+        Slide slide = ppt.createSlide();\r
+\r
+        ShapeGroup group = new ShapeGroup();\r
+        //define position of the drawing in the slide\r
+        Rectangle bounds = new java.awt.Rectangle(200, 100, 350, 300);\r
+        group.setAnchor(bounds);\r
+        slide.addShape(group);\r
+        Graphics2D graphics = new PPGraphics2D(group);\r
+\r
+        //draw a simple bar graph\r
+        int x = bounds.x + 50, y = bounds.y + 50;\r
+        graphics.setFont(new Font("Arial", Font.BOLD, 10));\r
+        for (int i = 0, idx = 1; i < def.length; i+=2, idx++) {\r
+            graphics.setColor(Color.black);\r
+            int width = ((Integer)def[i+1]).intValue();\r
+            graphics.drawString("Q" + idx, x-20, y+20);\r
+            graphics.drawString(width + "%", x + width + 10, y + 20);\r
+            graphics.setColor((Color)def[i]);\r
+            graphics.fill(new Rectangle(x, y, width, 30));\r
+            y += 40;\r
+        }\r
+        graphics.setColor(Color.black);\r
+        graphics.setFont(new Font("Arial", Font.BOLD, 14));\r
+        graphics.draw(bounds);\r
+        graphics.drawString("Performance", x + 70, y + 40);\r
+\r
+    }\r
+\r
+    public static void slide11(SlideShow ppt) throws IOException {\r
+        Slide slide = ppt.createSlide();\r
+\r
+        TextBox box1 = new TextBox();\r
+        TextRun tr1 = box1.getTextRun();\r
+        tr1.setRunType(TextHeaderAtom.TITLE_TYPE);\r
+        tr1.setText("HSLF Development Plans");\r
+        box1.setAnchor(new Rectangle(36, 21, 648, 90));\r
+        slide.addShape(box1);\r
+\r
+        TextBox box2 = new TextBox();\r
+        TextRun tr2 = box2.getTextRun();\r
+        tr2.setRunType(TextHeaderAtom.BODY_TYPE);\r
+        tr2.setText(\r
+                "Support for more PowerPoint functionality\r" +\r
+                "Rendering slides into java.awt.Graphics2D");\r
+        box2.setAnchor(new Rectangle(36, 126, 648, 100));\r
+        slide.addShape(box2);\r
+\r
+        TextBox box3 = new TextBox();\r
+        TextRun tr3 = box3.getTextRun();\r
+        tr3.setRunType(TextHeaderAtom.BODY_TYPE);\r
+        tr3.getRichTextRuns()[0].setIndentLevel(1);\r
+        tr3.setText(\r
+                "A way to export slides into images or other formats");\r
+        box3.setAnchor(new Rectangle(36, 220, 648, 70));\r
+        slide.addShape(box3);\r
+\r
+        TextBox box4 = new TextBox();\r
+        TextRun tr4 = box4.getTextRun();\r
+        tr4.setRunType(TextHeaderAtom.BODY_TYPE);\r
+        tr4.setText(\r
+                "Integration with Apache FOP - Formatting Objects Processor");\r
+        box4.setAnchor(new Rectangle(36, 290, 648, 90));\r
+        slide.addShape(box4);\r
+\r
+        TextBox box5 = new TextBox();\r
+        TextRun tr5 = box5.getTextRun();\r
+        tr5.setRunType(TextHeaderAtom.BODY_TYPE);\r
+        tr5.getRichTextRuns()[0].setIndentLevel(1);\r
+        tr5.setText(\r
+                "Transformation of XSL-FO into PPT\r" +\r
+                "PPT2PDF transcoder");\r
+        box5.setAnchor(new Rectangle(36, 380, 648, 100));\r
+        slide.addShape(box5);\r
+    }\r
+\r
+    public static void slide12(SlideShow ppt) throws IOException {\r
+        Slide slide = ppt.createSlide();\r
+\r
+        TextBox box1 = new TextBox();\r
+        TextRun tr1 = box1.getTextRun();\r
+        tr1.setRunType(TextHeaderAtom.CENTER_TITLE_TYPE);\r
+        tr1.setText("Questions?");\r
+        box1.setAnchor(new Rectangle(54, 167, 612, 115));\r
+        slide.addShape(box1);\r
+\r
+        TextBox box2 = new TextBox();\r
+        TextRun tr2 = box2.getTextRun();\r
+        tr2.setRunType(TextHeaderAtom.CENTRE_BODY_TYPE);\r
+        tr2.setText(\r
+                "http://poi.apache.org/hslf/\r" +\r
+                "http://people.apache.org/~yegor");\r
+        box2.setAnchor(new Rectangle(108, 306, 504, 138));\r
+        slide.addShape(box2);\r
+    }\r
+}\r
index 716651d1c6c6bb97597472c73e7562ea371373fe..00fc374fccc82d88bfa6bb322c9e80d3eb49f840 100644 (file)
@@ -45,13 +45,15 @@ import org.apache.poi.hslf.record.Record;
 import org.apache.poi.hslf.record.UserEditAtom;
 import org.apache.poi.hslf.usermodel.ObjectData;
 import org.apache.poi.hslf.usermodel.PictureData;
+import org.apache.poi.hslf.model.Shape;
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.DocumentEntry;
 import org.apache.poi.poifs.filesystem.DocumentInputStream;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * This class contains the main functionality for the Powerpoint file 
@@ -63,7 +65,7 @@ import org.apache.poi.util.POILogger;
 public class HSLFSlideShow extends POIDocument
 {
     // For logging
-    protected POILogger logger = POILogFactory.getLogger(this.getClass());
+    private static final Log logger = LogFactory.getLog(HSLFSlideShow.class);
 
        private InputStream istream;
 
@@ -289,7 +291,7 @@ public class HSLFSlideShow extends POIDocument
                try {
                        currentUser = new CurrentUserAtom(directory);
                } catch(IOException ie) {
-                       logger.log(POILogger.ERROR, "Error finding Current User Atom:\n" + ie);
+                       logger.error("Error finding Current User Atom:\n" + ie);
                        currentUser = new CurrentUserAtom();
                }
        }
@@ -344,8 +346,8 @@ public class HSLFSlideShow extends POIDocument
 
                        // If they type (including the bonus 0xF018) is 0, skip it
                        if(type == 0) {
-                               logger.log(POILogger.ERROR, "Problem reading picture: Invalid image type 0, on picture with length " + imgsize + ".\nYou document will probably become corrupted if you save it!");
-                               logger.log(POILogger.ERROR, "" + pos);
+                               logger.error("Problem reading picture: Invalid image type 0, on picture with length " + imgsize + ".\nYou document will probably become corrupted if you save it!");
+                               logger.error("" + pos);
                        } else {
                    // Copy the data, ready to pass to PictureData
                    byte[] imgdata = new byte[imgsize];
@@ -360,7 +362,7 @@ public class HSLFSlideShow extends POIDocument
                                        pict.setOffset(offset);
                                        p.add(pict);
                                } catch(IllegalArgumentException e) {
-                                       logger.log(POILogger.ERROR, "Problem reading picture: " + e + "\nYou document will probably become corrupted if you save it!");
+                                       logger.error("Problem reading picture: " + e + "\nYou document will probably become corrupted if you save it!");
                                }
                        }
             
index f9cc43a7eac6f98f779ce0edbb909b0261b3e6be..436b5188f3d57ae6fd0c493bc3949e7508ed77a3 100644 (file)
@@ -23,8 +23,8 @@ import org.apache.poi.hslf.record.*;
 import org.apache.poi.hslf.usermodel.PictureData;
 import org.apache.poi.hslf.usermodel.SlideShow;
 import org.apache.poi.hslf.exceptions.HSLFException;
-import org.apache.poi.util.POILogger;
-import org.apache.poi.util.POILogFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import java.awt.*;
 import java.util.*;
@@ -36,7 +36,7 @@ import java.util.*;
  */
 public class Fill {
     // For logging
-    protected POILogger logger = POILogFactory.getLogger(this.getClass());
+    protected Log log = LogFactory.getLog(this.getClass());
 
     /**
      *  Fill with a solid color
@@ -154,8 +154,7 @@ public class Fill {
     public void setForegroundColor(Color color){
         EscherOptRecord opt = (EscherOptRecord)Shape.getEscherChild(shape.getSpContainer(), EscherOptRecord.RECORD_ID);
         if (color == null) {
-            Shape.setEscherProperty(opt, EscherProperties.FILL__FILLCOLOR, -1);
-            Shape.setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST, 0x150010);
+            Shape.setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST, 0x150000);
         }
         else {
             int rgb = new Color(color.getBlue(), color.getGreen(), color.getRed(), 0).getRGB();
@@ -214,7 +213,7 @@ public class Fill {
         java.util.List lst = bstore.getChildRecords();
         int idx = p.getPropertyValue();
         if (idx == 0){
-            logger.log(POILogger.ERROR, "no reference to picture data found ");
+            log.error("no reference to picture data found ");
         } else {
             EscherBSERecord bse = (EscherBSERecord)lst.get(idx - 1);
             for ( int i = 0; i < pict.length; i++ ) {
diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/Freeform.java b/src/scratchpad/src/org/apache/poi/hslf/model/Freeform.java
new file mode 100755 (executable)
index 0000000..5023633
--- /dev/null
@@ -0,0 +1,149 @@
+/* ====================================================================\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
+package org.apache.poi.hslf.model;\r
+\r
+import org.apache.poi.ddf.*;\r
+import org.apache.poi.util.LittleEndian;\r
+\r
+import java.awt.geom.*;\r
+import java.util.ArrayList;\r
+\r
+/**\r
+ * A "Freeform" shape.\r
+ *\r
+ * <p>\r
+ * Shapes drawn with the "Freeform" tool have cubic bezier curve segments in the smooth sections\r
+ * and straight-line segments in the straight sections. This object closely corresponds to <code>java.awt.geom.GeneralPath</code>.\r
+ * </p>\r
+ * @author Yegor Kozlov\r
+ */\r
+public class Freeform extends AutoShape {\r
+    /**\r
+     * Create a Freeform object and initialize it from the supplied Record container.\r
+     *\r
+     * @param escherRecord       <code>EscherSpContainer</code> container which holds information about this shape\r
+     * @param parent    the parent of the shape\r
+     */\r
+   protected Freeform(EscherContainerRecord escherRecord, Shape parent){\r
+        super(escherRecord, parent);\r
+\r
+    }\r
+\r
+    /**\r
+     * Create a new Freeform. This constructor is used when a new shape is created.\r
+     *\r
+     * @param parent    the parent of this Shape. For example, if this text box is a cell\r
+     * in a table then the parent is Table.\r
+     */\r
+    public Freeform(Shape parent){\r
+        super(null, parent);\r
+        _escherContainer = createSpContainer(ShapeTypes.NotPrimitive, parent instanceof ShapeGroup);\r
+    }\r
+\r
+    /**\r
+     * Create a new Freeform. This constructor is used when a new shape is created.\r
+     *\r
+     */\r
+    public Freeform(){\r
+        this(null);\r
+    }\r
+\r
+    /**\r
+     * Set the shape path\r
+     *\r
+     * @param path\r
+     */\r
+    public void setPath(GeneralPath path)\r
+    {\r
+        Rectangle2D bounds = path.getBounds2D();\r
+        PathIterator it = path.getPathIterator(new AffineTransform());\r
+\r
+        ArrayList segInfo = new ArrayList();\r
+        ArrayList pntInfo = new ArrayList();\r
+        boolean isClosed = false;\r
+        while (!it.isDone()) {\r
+            double[] vals = new double[6];\r
+            int type = it.currentSegment(vals);\r
+            switch (type) {\r
+                case PathIterator.SEG_MOVETO:\r
+                    pntInfo.add(new Point2D.Double(vals[0], vals[1]));\r
+                    segInfo.add(new byte[]{0x00, 0x40});\r
+                    break;\r
+                case PathIterator.SEG_LINETO:\r
+                    pntInfo.add(new Point2D.Double(vals[0], vals[1]));\r
+                    segInfo.add(new byte[]{0x00, (byte)0xAC});\r
+                    segInfo.add(new byte[]{0x01, 0x00 });\r
+                    break;\r
+                case PathIterator.SEG_CUBICTO:\r
+                    pntInfo.add(new Point2D.Double(vals[0], vals[1]));\r
+                    pntInfo.add(new Point2D.Double(vals[2], vals[3]));\r
+                    pntInfo.add(new Point2D.Double(vals[4], vals[5]));\r
+                    segInfo.add(new byte[]{0x00, (byte)0xAD});\r
+                    segInfo.add(new byte[]{0x01, 0x20 });\r
+                    break;\r
+                case PathIterator.SEG_QUADTO:\r
+                    System.err.println("SEG_QUADTO is not supported");\r
+                    break;\r
+                case PathIterator.SEG_CLOSE:\r
+                    pntInfo.add(pntInfo.get(0));\r
+                    segInfo.add(new byte[]{0x00, (byte)0xAC});\r
+                    segInfo.add(new byte[]{0x01, 0x00 });\r
+                    segInfo.add(new byte[]{0x00, (byte)0xAC});\r
+                    segInfo.add(new byte[]{0x01, (byte)0x60});\r
+                    isClosed = true;\r
+                    break;\r
+            }\r
+\r
+            it.next();\r
+        }\r
+        if(!isClosed) segInfo.add(new byte[]{0x00, (byte)0xAC});\r
+        segInfo.add(new byte[]{0x00, (byte)0x80});\r
+\r
+        EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID);\r
+        opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__SHAPEPATH, 0x4));\r
+\r
+        EscherArrayProperty verticesProp = new EscherArrayProperty((short)(EscherProperties.GEOMETRY__VERTICES + 0x4000), false, null);\r
+        verticesProp.setNumberOfElementsInArray(pntInfo.size());\r
+        verticesProp.setNumberOfElementsInMemory(pntInfo.size());\r
+        verticesProp.setSizeOfElements(0xFFF0);\r
+        for (int i = 0; i < pntInfo.size(); i++) {\r
+            Point2D.Double pnt = (Point2D.Double)pntInfo.get(i);\r
+            byte[] data = new byte[4];\r
+            LittleEndian.putShort(data, 0, (short)((pnt.getX() - bounds.getX())*MASTER_DPI/POINT_DPI));\r
+            LittleEndian.putShort(data, 2, (short)((pnt.getY() - bounds.getY())*MASTER_DPI/POINT_DPI));\r
+            verticesProp.setElement(i, data);\r
+        }\r
+        opt.addEscherProperty(verticesProp);\r
+\r
+        EscherArrayProperty segmentsProp = new EscherArrayProperty((short)(EscherProperties.GEOMETRY__SEGMENTINFO + 0x4000), false, null);\r
+        segmentsProp.setNumberOfElementsInArray(segInfo.size());\r
+        segmentsProp.setNumberOfElementsInMemory(segInfo.size());\r
+        segmentsProp.setSizeOfElements(0x2);\r
+        for (int i = 0; i < segInfo.size(); i++) {\r
+            byte[] seg = (byte[])segInfo.get(i);\r
+            segmentsProp.setElement(i, seg);\r
+        }\r
+        opt.addEscherProperty(segmentsProp);\r
+\r
+        opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__RIGHT, (int)(bounds.getWidth()*MASTER_DPI/POINT_DPI)));\r
+        opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__BOTTOM, (int)(bounds.getHeight()*MASTER_DPI/POINT_DPI)));\r
+\r
+        opt.sortProperties();\r
+\r
+        setAnchor(bounds);\r
+    }\r
+}\r
index 4aad44d75d0028d27403217c4aca3e94a917b3fb..cb001ccf9c7e8e972e9a536136840ec304253fcc 100644 (file)
@@ -53,11 +53,6 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
     private Color background;
     private RenderingHints hints;
 
-    /**
-     * the maximum distance that the line segments used to approximate the curved segments
-     */
-    public static final float FLATNESS = 0.1f;
-
     /**
      * Construct Java Graphics object which translates graphic calls in ppt drawing layer.
      *
@@ -218,29 +213,12 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      * @see #setComposite
      */
     public void draw(Shape shape){
-
-        PathIterator it = shape.getPathIterator(transform, FLATNESS);
-        double[] prev = null;
-        double[] coords = new double[6];
-        double[] first = new double[6];
-        if(!it.isDone()) it.currentSegment(first); //first point
-        while(!it.isDone()){
-            int type = it.currentSegment(coords);
-            if (prev != null ){
-                Line line = new Line(group);
-                applyPaint(line);
-                applyStroke(line);
-                if (type == PathIterator.SEG_LINETO) {
-                    line.setAnchor(new Rectangle2D.Double(prev[0],  prev[1], (coords[0] - prev[0]), (coords[1] - prev[1])));
-                } else if (type == PathIterator.SEG_CLOSE){
-                    line.setAnchor(new Rectangle2D.Double(coords[0],  coords[1], (first[0] - coords[0]), (first[1] - coords[1])));
-                }
-                group.addShape(line);
-            }
-            prev = new double[]{coords[0],  coords[1]};
-            it.next();
-        }
-
+        GeneralPath path = new GeneralPath(transform.createTransformedShape(shape));
+        Freeform p = new Freeform(group);
+        p.setPath(path);
+        p.getFill().setForegroundColor(null);
+        applyStroke(p);
+        group.addShape(p);
     }
 
     /**
@@ -299,7 +277,7 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
          * Even if top and bottom margins are set to 0 PowerPoint
          * always sets extra space between the text and its bounding box.
          *
-         * Approximation height = ascent*2 works good enough in most cases
+         * The approximation height = ascent*2 works good enough in most cases
          */
         float height = ascent * 2;
 
@@ -335,28 +313,12 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      * @see #setClip
      */
     public void fill(Shape shape){
-        PathIterator it = shape.getPathIterator(transform, FLATNESS);
-        ArrayList pnt = new ArrayList();
-        double[] coords = new double[6];
-        while(!it.isDone()){
-            int type = it.currentSegment(coords);
-            if (type != PathIterator.SEG_CLOSE) {
-                pnt.add(new Point2D.Double(coords[0], coords[1]));
-            }
-            it.next();
-        }
-        if(pnt.size() > 0){
-            Point2D[] points = (Point2D[])pnt.toArray(new Point2D[pnt.size()]);
-            Polygon p = new Polygon(group);
-            p.setPoints(points);
-            applyPaint(p);
-
-            p.setLineColor(null);   //Fills must be "No Line"
-
-            Rectangle2D bounds = transform.createTransformedShape(shape).getBounds2D();
-            p.setAnchor(bounds);
-            group.addShape(p);
-        }
+        GeneralPath path = new GeneralPath(transform.createTransformedShape(shape));
+        Freeform p = new Freeform(group);
+        p.setPath(path);
+        applyPaint(p);
+        p.setLineColor(null);   //Fills must be "No Line"
+        group.addShape(p);
     }
 
     /**
@@ -459,11 +421,8 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      */
     public void drawRoundRect(int x, int y, int width, int height,
                               int arcWidth, int arcHeight){
-        AutoShape shape = new AutoShape(ShapeTypes.RoundRectangle, group);
-        shape.setFillColor(null);
-        applyStroke(shape);
-        shape.setAnchor(new Rectangle2D.Double(x,  y, width, height));
-        group.addShape(shape);
+        RoundRectangle2D rect = new RoundRectangle2D.Float(x, y, width, height, arcWidth, arcHeight);
+        draw(rect);
      }
 
     /**
@@ -493,11 +452,8 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      * @see         java.awt.Graphics#drawOval
      */
     public void fillOval(int x, int y, int width, int height){
-        AutoShape shape = new AutoShape(ShapeTypes.Ellipse, group);
-        applyPaint(shape);
-        applyStroke(shape);
-        shape.setAnchor(new Rectangle2D.Double(x,  y, width, height));
-        group.addShape(shape);
+        Ellipse2D oval = new Ellipse2D.Float(x, y, width, height);
+        fill(oval);
     }
 
     /**
@@ -518,11 +474,9 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      */
     public void fillRoundRect(int x, int y, int width, int height,
                               int arcWidth, int arcHeight){
-        AutoShape shape = new AutoShape(ShapeTypes.RoundRectangle, group);
-        applyPaint(shape);
-        applyStroke(shape);
-        shape.setAnchor(new Rectangle2D.Double(x,  y, width, height));
-        group.addShape(shape);
+
+        RoundRectangle2D rect = new RoundRectangle2D.Float(x, y, width, height, arcWidth, arcHeight);
+        fill(rect);
     }
 
     /**
@@ -563,11 +517,8 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      */
     public void fillArc(int x, int y, int width, int height,
                         int startAngle, int arcAngle){
-        AutoShape shape = new AutoShape(ShapeTypes.Arc, group);
-        applyPaint(shape);
-        applyStroke(shape);
-        shape.setAnchor(new Rectangle2D.Double(x,  y, width, height));
-        group.addShape(shape);
+        Arc2D arc = new Arc2D.Float(x, y, width, height, startAngle, arcAngle, Arc2D.PIE);
+        fill(arc);
     }
 
     /**
@@ -609,11 +560,8 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      */
     public void drawArc(int x, int y, int width, int height,
                         int startAngle, int arcAngle) {
-        AutoShape shape = new AutoShape(ShapeTypes.Arc, group);
-        shape.setFillColor(null);
-        applyStroke(shape);
-        shape.setAnchor(new Rectangle2D.Double(x,  y, width, height));
-        group.addShape(shape);
+        Arc2D arc = new Arc2D.Float(x, y, width, height, startAngle, arcAngle, Arc2D.OPEN);
+        draw(arc);
     }
 
 
@@ -659,11 +607,8 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      * @see         java.awt.Graphics#fillOval
      */
     public void drawOval(int x, int y, int width, int height){
-        AutoShape shape = new AutoShape(ShapeTypes.Ellipse, group);
-        shape.setFillColor(null);
-        applyStroke(shape);
-        shape.setAnchor(new Rectangle2D.Double(x,  y, width, height));
-        group.addShape(shape);
+        Ellipse2D oval = new Ellipse2D.Float(x, y, width, height);
+        draw(oval);
     }
 
     /**
@@ -998,11 +943,8 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      * @see           java.awt.Graphics#drawRect
      */
     public void fillRect(int x, int y, int width, int height){
-        AutoShape shape = new AutoShape(ShapeTypes.Rectangle, group);
-        applyPaint(shape);
-        applyStroke(shape);
-        shape.setAnchor(new Rectangle2D.Double(x,  y, width, height));
-        group.addShape(shape);
+        Rectangle rect = new Rectangle(x, y, width, height);
+        fill(rect);
     }
 
     /**
@@ -1022,12 +964,8 @@ public class PPGraphics2D extends Graphics2D implements Cloneable {
      * @see          java.awt.Graphics#clearRect
      */
     public void drawRect(int x, int y, int width, int height) {
-        AutoShape shape = new AutoShape(ShapeTypes.Rectangle, group);
-        shape.setFillColor(null);
-        applyStroke(shape);
-        shape.setAnchor(new Rectangle2D.Double(x,  y, width, height));
-        group.addShape(shape);
-
+        Rectangle rect = new Rectangle(x, y, width, height);
+        draw(rect);
     }
 
     /**
index 90efd5f3ee5a1f41348ede304f5097b43861fc97..4866779b92cfc6a04f2e42213a07f7673a2b7b70 100644 (file)
@@ -21,7 +21,6 @@ import org.apache.poi.hslf.usermodel.PictureData;
 import org.apache.poi.hslf.usermodel.SlideShow;
 import org.apache.poi.hslf.record.Document;
 import org.apache.poi.hslf.blip.Bitmap;
-import org.apache.poi.util.POILogger;
 
 import javax.imageio.ImageIO;
 import java.awt.image.BufferedImage;
@@ -179,7 +178,7 @@ public class Picture extends SimpleShape {
         List lst = bstore.getChildRecords();
         int idx = getPictureIndex();
         if (idx == 0){
-            logger.log(POILogger.ERROR, "no reference to picture data found ");
+            log.error("no reference to picture data found ");
         } else {
             EscherBSERecord bse = (EscherBSERecord)lst.get(idx-1);
             for ( int i = 0; i < pict.length; i++ ) {
@@ -187,7 +186,7 @@ public class Picture extends SimpleShape {
                     return pict[i];
                 }
             }
-            logger.log(POILogger.ERROR, "no picture found for our BSE offset " + bse.getOffset());
+            log.error("no picture found for our BSE offset " + bse.getOffset());
         }
         return null;
     }
index 2e23c5926ee4462e62a7b048b6a4ee877771980d..220a512dc5ee14ad588cb58584f5f49cff63503a 100644 (file)
@@ -19,8 +19,8 @@ package org.apache.poi.hslf.model;
 import org.apache.poi.ddf.*;
 import org.apache.poi.hslf.model.ShapeTypes;
 import org.apache.poi.hslf.record.ColorSchemeAtom;
-import org.apache.poi.util.POILogger;
-import org.apache.poi.util.POILogFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import java.util.Iterator;
 import java.awt.*;
@@ -45,7 +45,7 @@ import java.awt.geom.Rectangle2D;
 public abstract class Shape {
 
     // For logging
-    protected POILogger logger = POILogFactory.getLogger(this.getClass());
+    protected Log log = LogFactory.getLog(this.getClass());
 
     /**
      * In Escher absolute distances are specified in
@@ -89,6 +89,11 @@ public abstract class Shape {
      */
     protected Sheet _sheet;
 
+    /**
+     * Fill
+     */
+    protected Fill _fill;
+
     /**
      * Create a Shape object. This constructor is used when an existing Shape is read from from a PowerPoint document.
      *
@@ -344,7 +349,8 @@ public abstract class Shape {
      * @return fill properties of this shape
      */
     public Fill getFill(){
-        return new Fill(this);
+        if(_fill == null) _fill = new Fill(this);
+        return _fill;
     }
 
 
index dbcc8069c24e04a2702f9858c848f0aeb55055f8..7b79ebad976463449ef5f7bc87c7a2e71c2113a4 100644 (file)
@@ -18,7 +18,6 @@ package org.apache.poi.hslf.model;
 
 import org.apache.poi.ddf.*;
 import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -71,7 +70,7 @@ public class ShapeGroup extends Shape{
                } else {
                        // Should we do anything special with these non
                        //  Container records?
-                       logger.log(POILogger.ERROR, "Shape contained non container escher record, was " + r.getClass().getName());
+                       log.error("Shape contained non container escher record, was " + r.getClass().getName());
                }
         }
         
index 58fc3330531c82407e5dda14a6877e9f3270015f..85d672fe899aa2757ea020529a04a6a4adfa825a 100644 (file)
@@ -187,26 +187,7 @@ public class SimpleShape extends Shape {
      * The color used to fill this shape.
      */
     public Color getFillColor(){
-        EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID);
-        EscherSimpleProperty p1 = (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.FILL__FILLCOLOR);
-        EscherSimpleProperty p2= (EscherSimpleProperty)getEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST);
-
-        int p2val = p2 == null ? 0 : p2.getPropertyValue();
-
-        Color clr = null;
-        if (p1 != null && (p2val  & 0x10) != 0){
-            int rgb = p1.getPropertyValue();
-            if (rgb >= 0x8000000) {
-                int idx = rgb % 0x8000000;
-                if(getSheet() != null) {
-                    ColorSchemeAtom ca = getSheet().getColorScheme();
-                    rgb = ca.getColor(idx);
-                }
-            }
-            Color tmp = new Color(rgb, true);
-            clr = new Color(tmp.getBlue(), tmp.getGreen(), tmp.getRed());
-        }
-        return clr;
+        return getFill().getForegroundColor();
     }
 
     /**
@@ -215,14 +196,7 @@ public class SimpleShape extends Shape {
      * @param color the background color
      */
     public void setFillColor(Color color){
-        EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID);
-        if(color == null) {
-            setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST, 0x150000);
-        } else {
-            int rgb = new Color(color.getBlue(), color.getGreen(), color.getRed(), 0).getRGB();
-            setEscherProperty(opt, EscherProperties.FILL__FILLCOLOR, rgb);
-            setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST, 0x150011);
-        }
+        getFill().setForegroundColor(color);
     }
 
 }
index 1f9a489a78be29eb2b08babd6e1922e6a487a5f0..8a54e079c694d439eb210bfba6b0de1ec7bd03ab 100644 (file)
@@ -22,7 +22,6 @@ import org.apache.poi.ddf.*;
 import org.apache.poi.hslf.record.*;
 import org.apache.poi.hslf.usermodel.RichTextRun;
 import org.apache.poi.hslf.exceptions.HSLFException;
-import org.apache.poi.util.POILogger;
 
 import java.awt.*;
 import java.awt.font.FontRenderContext;
@@ -480,7 +479,7 @@ public class TextBox extends SimpleShape {
                 }
             }
             if(_txtrun == null) {
-                logger.log(POILogger.WARN, "text run not found for OutlineTextRefAtom.TextIndex=" + idx);
+                log.warn("text run not found for OutlineTextRefAtom.TextIndex=" + idx);
             }
         } else {
             int shapeId = _escherContainer.getChildById(EscherSpRecord.RECORD_ID).getShapeId();
index f6252840ccd40040f7e74f13baa3069e97b12d55..c5b217b367dba147162ff082a2640cbd20d5dc13 100644 (file)
@@ -19,8 +19,6 @@
 
 package org.apache.poi.hslf.record;
 
-import org.apache.poi.util.POILogger;
-
 import java.io.IOException;
 import java.io.OutputStream;
 
@@ -134,10 +132,10 @@ public class Document extends PositionDependentRecordContainer
                //  (normally it's 2, or 3 if you have notes)
                // Complain if it's not
                if(slwtcount == 0) {
-                       logger.log(POILogger.WARN, "No SlideListWithText's found - there should normally be at least one!");
+                       logger.warn("No SlideListWithText's found - there should normally be at least one!");
                }
                if(slwtcount > 3) {
-                       logger.log(POILogger.WARN, "Found " + slwtcount + " SlideListWithTexts - normally there should only be three!");
+                       logger.warn("Found " + slwtcount + " SlideListWithTexts - normally there should only be three!");
                }
                
                // Now grab all the SLWTs
index a021d6b10db8eec8c5e0dfa12cd65c87ed337534..57c79afe111c28a54a1a568805bc46e383b001be 100644 (file)
@@ -21,7 +21,6 @@ import java.io.OutputStream;
 import java.io.IOException;
 
 import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
 
 /**
  * This data represents an embedded object in the document.
@@ -94,14 +93,14 @@ public class ExEmbed extends RecordContainer {
         if(_children[0] instanceof ExEmbedAtom) {
             embedAtom = (ExEmbedAtom)_children[0];
         } else {
-            logger.log(POILogger.ERROR, "First child record wasn't a ExEmbedAtom, was of type " + _children[0].getRecordType());
+            logger.error("First child record wasn't a ExEmbedAtom, was of type " + _children[0].getRecordType());
         }
 
         // Second child should be the ExOleObjAtom
         if (_children[1] instanceof ExOleObjAtom) {
             oleObjAtom = (ExOleObjAtom)_children[1];
         } else {
-            logger.log(POILogger.ERROR, "Second child record wasn't a ExOleObjAtom, was of type " + _children[1].getRecordType());
+            logger.error("Second child record wasn't a ExOleObjAtom, was of type " + _children[1].getRecordType());
         }
 
         for (int i = 2; i < _children.length; i++) {
@@ -110,15 +109,15 @@ public class ExEmbed extends RecordContainer {
                 else if (progId == null) progId = (CString)_children[i];
                 else if (clipboardName == null) clipboardName = (CString)_children[i];
             } else {
-                logger.log(POILogger.ERROR, "Record after atoms wasn't a CString, was of type " + _children[i].getRecordType());
+                logger.error("Record after atoms wasn't a CString, was of type " + _children[i].getRecordType());
             }
         }
     }
 
     /**
-     * Gets the {@code ExEmbedAtom}.
+     * Gets the {@link ExEmbedAtom}.
      *
-     * @return the {@code ExEmbedAtom}.
+     * @return the {@link ExEmbedAtom}.
      */
     public ExEmbedAtom getExEmbedAtom()
     {
@@ -126,9 +125,9 @@ public class ExEmbed extends RecordContainer {
     }
 
     /**
-     * Gets the {@code ExOleObjAtom}.
+     * Gets the {@link ExOleObjAtom}.
      *
-     * @return the {@code ExOleObjAtom}.
+     * @return the {@link ExOleObjAtom}.
      */
     public ExOleObjAtom getExOleObjAtom()
     {
index 8ba58cdb61efaef31b13eee0da202a0cebd5f01c..1832e090199e7c6d590c8fd61e94d27c34b55023 100644 (file)
@@ -20,7 +20,6 @@ import java.io.IOException;
 import java.io.OutputStream;
 
 import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
 
 /**
  * This class represents the data of a link in the document. 
@@ -108,7 +107,7 @@ public class ExHyperlink extends RecordContainer {
                if(_children[0] instanceof ExHyperlinkAtom) {
                        linkAtom = (ExHyperlinkAtom)_children[0];
                } else {
-                       logger.log(POILogger.ERROR, "First child record wasn't a ExHyperlinkAtom, was of type " + _children[0].getRecordType());
+                       logger.error("First child record wasn't a ExHyperlinkAtom, was of type " + _children[0].getRecordType());
                }
 
         for (int i = 1; i < _children.length; i++) {
@@ -116,7 +115,7 @@ public class ExHyperlink extends RecordContainer {
                 if ( linkDetailsA == null) linkDetailsA = (CString)_children[i];
                 else linkDetailsB = (CString)_children[i];
             } else {
-                logger.log(POILogger.ERROR, "Record after ExHyperlinkAtom wasn't a CString, was of type " + _children[1].getRecordType());
+                logger.error("Record after ExHyperlinkAtom wasn't a CString, was of type " + _children[1].getRecordType());
             }
 
         }
index e4ee95657cdb2e1034a6e9f10c6c7e024d40e82a..17ab338414d5adf3016c253d77d1abbcceea338e 100644 (file)
@@ -18,9 +18,6 @@
 
 package org.apache.poi.hslf.record;
 
-import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
-
 import java.io.*;
 import java.util.*;
 
@@ -49,7 +46,7 @@ public class FontCollection extends RecordContainer {
                    FontEntityAtom atom = (FontEntityAtom)_children[i];
                    fonts.add(atom.getFontName());
                        } else {
-                               logger.log(POILogger.WARN, "Warning: FontCollection child wasn't a FontEntityAtom, was " + _children[i]);
+                               logger.warn("Warning: FontCollection child wasn't a FontEntityAtom, was " + _children[i]);
                        }
                }
        }
index e42b358b89df78cf2230de8ac01e160473faa166..b0602bc4605919060e7b01174ac2cf8937788a0c 100644 (file)
@@ -20,7 +20,6 @@
 package org.apache.poi.hslf.record;
 
 import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
 
 import org.apache.poi.ddf.*;
 import org.apache.poi.hslf.model.ShapeTypes;
@@ -132,7 +131,7 @@ public class PPDrawing extends RecordAtom
                // Wind on
                int size = r.getRecordSize();
                if(size < 8) {
-                       logger.log(POILogger.WARN, "Hit short DDF record at " + startPos + " - " + size);
+                       logger.warn("Hit short DDF record at " + startPos + " - " + size);
                }
 
         /**
@@ -142,7 +141,7 @@ public class PPDrawing extends RecordAtom
          * Sometimes it is not so, see an example in bug #44770. Most likely reason is that one of ddf records calculates wrong size. 
          */
         if(size != escherBytes){
-            logger.log(POILogger.WARN, "Record length=" + escherBytes + " but getRecordSize() returned " + r.getRecordSize() + "; record: " + r.getClass());
+            logger.warn("Record length=" + escherBytes + " but getRecordSize() returned " + r.getRecordSize() + "; record: " + r.getClass());
             size = escherBytes;
         }
                startPos += size;
index 68b8b7cafee2fb6394dc42cfb58e4832d6c5e2ac..7f9d6468025a0c1698fcc2d439ff083a0ceb83e1 100644 (file)
@@ -20,7 +20,6 @@
 package org.apache.poi.hslf.record;
 
 import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
 
 import java.io.IOException;
 import java.io.OutputStream;
@@ -195,8 +194,8 @@ public class PersistPtrHolder extends PositionDependentRecordAtom
                        Integer newPos = (Integer)oldToNewReferencesLookup.get(oldPos);
 
                        if(newPos == null) {
-                               logger.log(POILogger.WARN, "Couldn't find the new location of the \"slide\" with id " + id + " that used to be at " + oldPos);
-                               logger.log(POILogger.WARN, "Not updating the position of it, you probably won't be able to find it any more (if you ever could!)");
+                               logger.warn("Couldn't find the new location of the \"slide\" with id " + id + " that used to be at " + oldPos);
+                               logger.warn("Not updating the position of it, you probably won't be able to find it any more (if you ever could!)");
                                newPos = oldPos;
                        }
 
index 1aface94cdc19d449bde46bef5946b931662194b..44cde7595bdae9027ae854b936156a7d4b93f1b9 100644 (file)
@@ -24,9 +24,9 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.util.Vector;
 import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
-import org.apache.poi.util.POILogFactory;
 import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 
 /**
@@ -40,7 +40,7 @@ import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
 public abstract class Record
 {
     // For logging
-    protected POILogger logger = POILogFactory.getLogger(this.getClass());
+    protected Log logger = LogFactory.getLog(this.getClass());
 
        /**
         * Is this record type an Atom record (only has data),
index fdaa9eec2c41f3a3134466bf430638ced4d42fb6..72e17722ce8a628c5468031e5a8a33c3857afaef 100644 (file)
@@ -31,7 +31,6 @@ import org.apache.poi.hslf.model.textproperties.ParagraphFlagsTextProp;
 import org.apache.poi.hslf.model.textproperties.TextProp;
 import org.apache.poi.hslf.model.textproperties.TextPropCollection;
 import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
 
 /**
  * A StyleTextPropAtom (type 4001). Holds basic character properties 
@@ -293,7 +292,7 @@ public class StyleTextPropAtom extends RecordAtom
 
                }
         if (rawContents.length > 0 && textHandled != (size+1)){
-            logger.log(POILogger.WARN, "Problem reading paragraph style runs: textHandled = " + textHandled + ", text.size+1 = " + (size+1));
+            logger.warn("Problem reading paragraph style runs: textHandled = " + textHandled + ", text.size+1 = " + (size+1));
         }
 
                // Now do the character stylings
@@ -328,7 +327,7 @@ public class StyleTextPropAtom extends RecordAtom
                        }
                }
         if (rawContents.length > 0 && textHandled != (size+1)){
-            logger.log(POILogger.WARN, "Problem reading character style runs: textHandled = " + textHandled + ", text.size+1 = " + (size+1));
+            logger.warn("Problem reading character style runs: textHandled = " + textHandled + ", text.size+1 = " + (size+1));
         }
 
                // Handle anything left over
index 02db3567ccb97c979188c20f1930cdd9f5ec183d..105bca5d43b13a824f5f19a2f236da1523a46450 100644 (file)
@@ -37,8 +37,8 @@ import org.apache.poi.hslf.record.*;
 import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
 import org.apache.poi.hslf.exceptions.HSLFException;
 import org.apache.poi.util.ArrayUtil;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * This class is a friendly wrapper on top of the more scary HSLFSlideShow.
@@ -80,7 +80,7 @@ public class SlideShow
   private FontCollection _fonts;
 
   // For logging
-  private POILogger logger = POILogFactory.getLogger(this.getClass());
+  private static final Log logger = LogFactory.getLog(SlideShow.class);
 
   
   /* ===============================================================
@@ -275,7 +275,7 @@ public class SlideShow
                        Record r = _mostRecentCoreRecords[coreRecordId.intValue()];
                        return r;
                } else {
-                       logger.log(POILogger.ERROR, "We tried to look up a reference to a core record, but there was no core ID for reference ID " + refID);
+                       logger.error("We tried to look up a reference to a core record, but there was no core ID for reference ID " + refID);
                        return null;
                }
        }
@@ -378,7 +378,7 @@ public class SlideShow
                 Integer slideId = new Integer(spa.getSlideIdentifier());
                 slideIdToNotes.put(slideId, new Integer(i));
                        } else {
-                               logger.log(POILogger.ERROR, "A Notes SlideAtomSet at " + i + " said its record was at refID " + notesSets[i].getSlidePersistAtom().getRefID() + ", but that was actually a " + r);
+                               logger.error("A Notes SlideAtomSet at " + i + " said its record was at refID " + notesSets[i].getSlidePersistAtom().getRefID() + ", but that was actually a " + r);
                        }
                }
                notesRecords = new org.apache.poi.hslf.record.Notes[notesRecordsL.size()];
@@ -404,7 +404,7 @@ public class SlideShow
                        if(r instanceof org.apache.poi.hslf.record.Slide) {
                                slidesRecords[i] = (org.apache.poi.hslf.record.Slide)r;
                        } else {
-                               logger.log(POILogger.ERROR, "A Slide SlideAtomSet at " + i + " said its record was at refID " + slidesSets[i].getSlidePersistAtom().getRefID() + ", but that was actually a " + r);
+                               logger.error("A Slide SlideAtomSet at " + i + " said its record was at refID " + slidesSets[i].getSlidePersistAtom().getRefID() + ", but that was actually a " + r);
                        }
                }
        }
@@ -429,7 +429,7 @@ public class SlideShow
         if (noteId != 0){
             Integer notesPos = (Integer)slideIdToNotes.get(new Integer(noteId));
             if (notesPos != null) notes = _notes[notesPos.intValue()];
-            else logger.log(POILogger.ERROR, "Notes not found for noteId=" + noteId);
+            else logger.error("Notes not found for noteId=" + noteId);
         }
 
                // Now, build our slide
@@ -622,7 +622,7 @@ public class SlideShow
                System.arraycopy(_slides, 0, s, 0, _slides.length);
                s[_slides.length] = slide;
                _slides = s;
-               logger.log(POILogger.INFO, "Added slide " + _slides.length + " with ref " + sp.getRefID() + " and identifier " + sp.getSlideIdentifier());
+               logger.info("Added slide " + _slides.length + " with ref " + sp.getRefID() + " and identifier " + sp.getSlideIdentifier());
                
                // Add the core records for this new Slide to the record tree
                org.apache.poi.hslf.record.Slide slideRecord = slide.getSlideRecord();
@@ -658,7 +658,7 @@ public class SlideShow
                // (Also need to tell it where it is)
                slideRecord.setLastOnDiskOffset(slideOffset);
                ptr.addSlideLookup(sp.getRefID(), slideOffset);
-               logger.log(POILogger.INFO, "New slide ended up at " + slideOffset);
+               logger.info("New slide ended up at " + slideOffset);
 
                // Last view is now of the slide
                usr.setLastViewType((short)UserEditAtom.LAST_VIEW_SLIDE_VIEW);
index 12aca6fa3c17232994e137e2c4a773520fa64890..7efe956e201ab033e07e74d226918850349118d5 100644 (file)
@@ -83,7 +83,7 @@ public class TestPPGraphics2D extends TestCase {
 
         group = (ShapeGroup)shape[0];
         shape = group.getShapes();
-        assertEquals(shape.length, 7);
+        assertEquals(shape.length, 3);
     }
 
 }