]> source.dussan.org Git - poi.git/commitdiff
added javadoc and code refactoring
authorEvgeniy Berlog <berlog@apache.org>
Wed, 8 Aug 2012 19:41:14 +0000 (19:41 +0000)
committerEvgeniy Berlog <berlog@apache.org>
Wed, 8 Aug 2012 19:41:14 +0000 (19:41 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/gsoc2012@1370912 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/usermodel/HSSFComment.java
src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java
src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java
src/java/org/apache/poi/hssf/usermodel/HSSFShape.java
src/java/org/apache/poi/hssf/usermodel/HSSFShapeGroup.java
src/java/org/apache/poi/hssf/usermodel/HSSFShapeTypes.java [new file with mode: 0644]
src/java/org/apache/poi/hssf/usermodel/HSSFSimpleShape.java
src/java/org/apache/poi/hssf/usermodel/drawing/HSSFShapeType.java [deleted file]
src/java/org/apache/poi/hssf/usermodel/drawing/ShapeTypes.java [deleted file]

index 8ae7edbe73e8d92f6dd5bef29cdb45f7b60c12a9..8f4795b9bc8fad3ee9b2a88637b915da16aa004f 100644 (file)
@@ -233,14 +233,14 @@ public class HSSFComment extends HSSFTextbox implements Comment {
     public void setBackgroundImage(int pictureIndex){
         setPropertyValue(new EscherSimpleProperty( EscherProperties.FILL__PATTERNTEXTURE, false, true, pictureIndex));
         setPropertyValue(new EscherSimpleProperty( EscherProperties.FILL__FILLTYPE, false, false, FILL_TYPE_PICTURE));
-        EscherBSERecord bse = _patriarch.getSheet().getWorkbook().getWorkbook().getBSERecord(pictureIndex);
+        EscherBSERecord bse = getPatriarch().getSheet().getWorkbook().getWorkbook().getBSERecord(pictureIndex);
         bse.setRef(bse.getRef() + 1);
     }
     
     public void resetBackgroundImage(){
         EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.FILL__PATTERNTEXTURE);
         if (null != property){
-            EscherBSERecord bse = _patriarch.getSheet().getWorkbook().getWorkbook().getBSERecord(property.getPropertyValue());
+            EscherBSERecord bse = getPatriarch().getSheet().getWorkbook().getWorkbook().getBSERecord(property.getPropertyValue());
             bse.setRef(bse.getRef() - 1);
             getOptRecord().removeEscherProperty(EscherProperties.FILL__PATTERNTEXTURE);
         }
index 152762ba4f4e794f44a45b3d4942915642e2a38c..233a798dc7658481fd32449325ef8bb627d353bd 100644 (file)
@@ -90,6 +90,10 @@ public final class HSSFPatriarch implements HSSFShapeContainer, Drawing {
         return newPatriarch;
     }
 
+    /**
+     * @param shape to be removed
+     * @return true of shape is removed
+     */
     public boolean removeShape(HSSFShape shape) {
         boolean  isRemoved = _mainSpgrContainer.removeChildRecord(shape.getEscherContainer());
         if (isRemoved){
@@ -225,7 +229,7 @@ public final class HSSFPatriarch implements HSSFShapeContainer, Drawing {
     }
 
     /**
-     * Returns a list of all shapes contained by the patriarch.
+     * Returns a unmodifiable list of all shapes contained by the patriarch.
      */
     public List<HSSFShape> getChildren() {
         return Collections.unmodifiableList(_shapes);
@@ -236,7 +240,7 @@ public final class HSSFPatriarch implements HSSFShapeContainer, Drawing {
      */
     @Internal
     public void addShape(HSSFShape shape) {
-        shape._patriarch = this;
+        shape.setPatriarch(this);
         _shapes.add(shape);
     }
 
@@ -331,18 +335,30 @@ public final class HSSFPatriarch implements HSSFShapeContainer, Drawing {
         return false;
     }
 
+    /**
+     * @return x coordinate of the left up corner
+     */
     public int getX1() {
         return _spgrRecord.getRectX1();
     }
 
+    /**
+     * @return y coordinate of the left up corner
+     */
     public int getY1() {
         return _spgrRecord.getRectY1();
     }
 
+    /**
+     * @return x coordinate of the right down corner
+     */
     public int getX2() {
         return _spgrRecord.getRectX2();
     }
 
+    /**
+     * @return y coordinate of the right down corner
+     */
     public int getY2() {
         return _spgrRecord.getRectY2();
     }
@@ -377,6 +393,9 @@ public final class HSSFPatriarch implements HSSFShapeContainer, Drawing {
     }
 
 
+    /**
+     * create shape tree from existing escher records tree
+     */
     void buildShapeTree() {
         EscherContainerRecord dgContainer = _boundAggregate.getEscherContainer();
         if (dgContainer == null) {
@@ -397,10 +416,10 @@ public final class HSSFPatriarch implements HSSFShapeContainer, Drawing {
 
     private void setFlipFlags(HSSFShape shape){
         EscherSpRecord sp = shape.getEscherContainer().getChildById(EscherSpRecord.RECORD_ID);
-        if (shape.anchor.isHorizontallyFlipped()) {
+        if (shape.getAnchor().isHorizontallyFlipped()) {
             sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPHORIZ);
         }
-        if (shape.anchor.isVerticallyFlipped()) {
+        if (shape.getAnchor().isVerticallyFlipped()) {
             sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPVERT);
         }
     }
index faffa20f01dbfd2567db8cf046d863ddeda629de..1f20d9f0faab8bc8977744d6b2f3a65cbe9abda7 100644 (file)
@@ -206,7 +206,7 @@ public class HSSFPicture extends HSSFSimpleShape implements Picture {
 
     private float getColumnWidthInPixels(int column){
 
-        int cw = _patriarch.getSheet().getColumnWidth(column);
+        int cw = getPatriarch().getSheet().getColumnWidth(column);
         float px = getPixelWidth(column);
 
         return cw/px;
@@ -214,18 +214,18 @@ public class HSSFPicture extends HSSFSimpleShape implements Picture {
 
     private float getRowHeightInPixels(int i){
 
-        HSSFRow row = _patriarch.getSheet().getRow(i);
+        HSSFRow row = getPatriarch().getSheet().getRow(i);
         float height;
         if(row != null) height = row.getHeight();
-        else height = _patriarch.getSheet().getDefaultRowHeight();
+        else height = getPatriarch().getSheet().getDefaultRowHeight();
 
         return height/PX_ROW;
     }
 
     private float getPixelWidth(int column){
 
-        int def = _patriarch.getSheet().getDefaultColumnWidth()*256;
-        int cw = _patriarch.getSheet().getColumnWidth(column);
+        int def = getPatriarch().getSheet().getDefaultColumnWidth()*256;
+        int cw = getPatriarch().getSheet().getColumnWidth(column);
 
         return cw == def ? PX_DEFAULT : PX_MODIFIED;
     }
@@ -236,7 +236,7 @@ public class HSSFPicture extends HSSFSimpleShape implements Picture {
      * @return image dimension
      */
     public Dimension getImageDimension(){
-        EscherBSERecord bse = _patriarch.getSheet()._book.getBSERecord(getPictureIndex());
+        EscherBSERecord bse = getPatriarch().getSheet()._book.getBSERecord(getPictureIndex());
         byte[] data = bse.getBlipRecord().getPicturedata();
         int type = bse.getBlipTypeWin32();
         return ImageUtils.getImageDimension(new ByteArrayInputStream(data), type);
@@ -248,7 +248,7 @@ public class HSSFPicture extends HSSFSimpleShape implements Picture {
      * @return picture data for this shape
      */
     public HSSFPictureData getPictureData(){
-        InternalWorkbook iwb = _patriarch.getSheet().getWorkbook().getWorkbook();
+        InternalWorkbook iwb = getPatriarch().getSheet().getWorkbook().getWorkbook();
        EscherBlipRecord blipRecord = iwb.getBSERecord(getPictureIndex()).getBlipRecord();
        return new HSSFPictureData(blipRecord);
     }
index daceee09a24d9094111ba9da34a385074ef137db..f20239567ffb3316a283d2992d988b30d7c66e2f 100644 (file)
@@ -54,9 +54,9 @@ public abstract class HSSFShape {
     public static final int LINESTYLE_DEFAULT = LINESTYLE_NONE;
 
     // TODO - make all these fields private
-    HSSFShape parent;
+    private HSSFShape parent;
     HSSFAnchor anchor;
-    HSSFPatriarch _patriarch;
+    private HSSFPatriarch _patriarch;
 
     private final EscherContainerRecord _escherContainer;
     private final ObjRecord _objRecord;
@@ -93,6 +93,12 @@ public abstract class HSSFShape {
 
     protected abstract ObjRecord createObjRecord();
 
+    /**
+     * remove escher container from the patriarch.escherAggregate
+     * remove obj, textObj and note records if it's necessary
+     * in case of ShapeGroup remove all contained shapes
+     * @param patriarch
+     */
     protected abstract void afterRemove(HSSFPatriarch patriarch);
 
     /**
@@ -379,4 +385,16 @@ public abstract class HSSFShape {
     }
 
     protected abstract HSSFShape cloneShape();
+
+    protected void setPatriarch(HSSFPatriarch _patriarch) {
+        this._patriarch = _patriarch;
+    }
+
+    public HSSFPatriarch getPatriarch() {
+        return _patriarch;
+    }
+
+    protected void setParent(HSSFShape parent) {
+        this.parent = parent;
+    }
 }
index a80e5bb98c4a78434de6f55bcb65a57f7a0f97da..9f60d6eae498c6c6fa40a8dd526f26a3dc9f7a1b 100644 (file)
@@ -129,18 +129,18 @@ public class HSSFShapeGroup extends HSSFShape implements HSSFShapeContainer {
         for ( int i=0; i<shapes.size(); i++ ) {
             HSSFShape shape = shapes.get(i);
             removeShape(shape);
-            shape.afterRemove(_patriarch);
+            shape.afterRemove(getPatriarch());
         }
         shapes.clear();
     }
 
     private void onCreate(HSSFShape shape){
-        if(_patriarch != null){
+        if(getPatriarch() != null){
             EscherContainerRecord spContainer = shape.getEscherContainer();
-            int shapeId = _patriarch.newShapeId();
+            int shapeId = getPatriarch().newShapeId();
             shape.setShapeId(shapeId);
             getEscherContainer().addChildRecord(spContainer);
-            shape.afterInsert(_patriarch);
+            shape.afterInsert(getPatriarch());
             EscherSpRecord sp;
             if (shape instanceof HSSFShapeGroup){
                 sp = shape.getEscherContainer().getChildContainers().get(0).getChildById(EscherSpRecord.RECORD_ID);
@@ -159,16 +159,16 @@ public class HSSFShapeGroup extends HSSFShape implements HSSFShapeContainer {
      */
     public HSSFShapeGroup createGroup(HSSFChildAnchor anchor) {
         HSSFShapeGroup group = new HSSFShapeGroup(this, anchor);
-        group.parent = this;
-        group.anchor = anchor;
+        group.setParent(this);
+        group.setAnchor(anchor);
         shapes.add(group);
         onCreate(group);
         return group;
     }
 
     public void addShape(HSSFShape shape) {
-        shape._patriarch = this._patriarch;
-        shape.parent = this;
+        shape.setPatriarch(this.getPatriarch());
+        shape.setParent(this);
         shapes.add(shape);
     }
 
@@ -180,15 +180,15 @@ public class HSSFShapeGroup extends HSSFShape implements HSSFShapeContainer {
      */
     public HSSFSimpleShape createShape(HSSFChildAnchor anchor) {
         HSSFSimpleShape shape = new HSSFSimpleShape(this, anchor);
-        shape.parent = this;
-        shape.anchor = anchor;
+        shape.setParent(this);
+        shape.setAnchor(anchor);
         shapes.add(shape);
         onCreate(shape);
         EscherSpRecord sp = shape.getEscherContainer().getChildById(EscherSpRecord.RECORD_ID);
-        if (shape.anchor.isHorizontallyFlipped()){
+        if (shape.getAnchor().isHorizontallyFlipped()){
             sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPHORIZ);
         }
-        if (shape.anchor.isVerticallyFlipped()){
+        if (shape.getAnchor().isVerticallyFlipped()){
             sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPVERT);
         }
         return shape;
@@ -202,8 +202,8 @@ public class HSSFShapeGroup extends HSSFShape implements HSSFShapeContainer {
      */
     public HSSFTextbox createTextbox(HSSFChildAnchor anchor) {
         HSSFTextbox shape = new HSSFTextbox(this, anchor);
-        shape.parent = this;
-        shape.anchor = anchor;
+        shape.setParent(this);
+        shape.setAnchor(anchor);
         shapes.add(shape);
         onCreate(shape);
         return shape;
@@ -218,8 +218,8 @@ public class HSSFShapeGroup extends HSSFShape implements HSSFShapeContainer {
      */
     public HSSFPolygon createPolygon(HSSFChildAnchor anchor) {
         HSSFPolygon shape = new HSSFPolygon(this, anchor);
-        shape.parent = this;
-        shape.anchor = anchor;
+        shape.setParent(this);
+        shape.setAnchor(anchor);
         shapes.add(shape);
         onCreate(shape);
         return shape;
@@ -234,16 +234,16 @@ public class HSSFShapeGroup extends HSSFShape implements HSSFShapeContainer {
      */
     public HSSFPicture createPicture(HSSFChildAnchor anchor, int pictureIndex) {
         HSSFPicture shape = new HSSFPicture(this, anchor);
-        shape.parent = this;
-        shape.anchor = anchor;
+        shape.setParent(this);
+        shape.setAnchor(anchor);
         shape.setPictureIndex(pictureIndex);
         shapes.add(shape);
         onCreate(shape);
         EscherSpRecord sp = shape.getEscherContainer().getChildById(EscherSpRecord.RECORD_ID);
-        if (shape.anchor.isHorizontallyFlipped()){
+        if (shape.getAnchor().isHorizontallyFlipped()){
             sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPHORIZ);
         }
-        if (shape.anchor.isVerticallyFlipped()){
+        if (shape.getAnchor().isVerticallyFlipped()){
             sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPVERT);
         }
         return shape;
@@ -357,7 +357,7 @@ public class HSSFShapeGroup extends HSSFShape implements HSSFShapeContainer {
         }
 
         HSSFShapeGroup group = new HSSFShapeGroup(spgrContainer, obj);
-        group._patriarch = patriarch;
+        group.setPatriarch(patriarch);
 
         for (HSSFShape shape: getChildren()){
             HSSFShape newShape;
@@ -375,7 +375,7 @@ public class HSSFShapeGroup extends HSSFShape implements HSSFShapeContainer {
     public boolean removeShape(HSSFShape shape) {
         boolean  isRemoved = getEscherContainer().removeChildRecord(shape.getEscherContainer());
         if (isRemoved){
-            shape.afterRemove(this._patriarch);
+            shape.afterRemove(this.getPatriarch());
             shapes.remove(shape);
         }
         return isRemoved;
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFShapeTypes.java b/src/java/org/apache/poi/hssf/usermodel/HSSFShapeTypes.java
new file mode 100644 (file)
index 0000000..d72b400
--- /dev/null
@@ -0,0 +1,224 @@
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
+package org.apache.poi.hssf.usermodel;
+
+public interface HSSFShapeTypes {
+    public static final int NotPrimitive = 0;
+    public static final int Rectangle = 1;
+    public static final int RoundRectangle = 2;
+    public static final int Ellipse = 3;
+    public static final int Diamond = 4;
+    public static final int IsocelesTriangle = 5;
+    public static final int RightTriangle = 6;
+    public static final int Parallelogram = 7;
+    public static final int Trapezoid = 8;
+    public static final int Hexagon = 9;
+    public static final int Octagon = 10;
+    public static final int Plus = 11;
+    public static final int Star = 12;
+    public static final int Arrow = 13;
+    public static final int ThickArrow = 14;
+    public static final int HomePlate = 15;
+    public static final int Cube = 16;
+    public static final int Balloon = 17;
+    public static final int Seal = 18;
+    public static final int Arc = 19;
+    public static final int Line = 20;
+    public static final int Plaque = 21;
+    public static final int Can = 22;
+    public static final int Donut = 23;
+    public static final int TextSimple = 24;
+    public static final int TextOctagon = 25;
+    public static final int TextHexagon = 26;
+    public static final int TextCurve = 27;
+    public static final int TextWave = 28;
+    public static final int TextRing = 29;
+    public static final int TextOnCurve = 30;
+    public static final int TextOnRing = 31;
+    public static final int StraightConnector1 = 32;
+    public static final int BentConnector2 = 33;
+    public static final int BentConnector3 = 34;
+    public static final int BentConnector4 = 35;
+    public static final int BentConnector5 = 36;
+    public static final int CurvedConnector2 = 37;
+    public static final int CurvedConnector3 = 38;
+    public static final int CurvedConnector4 = 39;
+    public static final int CurvedConnector5 = 40;
+    public static final int Callout1 = 41;
+    public static final int Callout2 = 42;
+    public static final int Callout3 = 43;
+    public static final int AccentCallout1 = 44;
+    public static final int AccentCallout2 = 45;
+    public static final int AccentCallout3 = 46;
+    public static final int BorderCallout1 = 47;
+    public static final int BorderCallout2 = 48;
+    public static final int BorderCallout3 = 49;
+    public static final int AccentBorderCallout1 = 50;
+    public static final int AccentBorderCallout2 = 51;
+    public static final int AccentBorderCallout3 = 52;
+    public static final int Ribbon = 53;
+    public static final int Ribbon2 = 54;
+    public static final int Chevron = 55;
+    public static final int Pentagon = 56;
+    public static final int NoSmoking = 57;
+    public static final int Star8 = 58;
+    public static final int Star16 = 59;
+    public static final int Star32 = 60;
+    public static final int WedgeRectCallout = 61;
+    public static final int WedgeRRectCallout = 62;
+    public static final int WedgeEllipseCallout = 63;
+    public static final int Wave = 64;
+    public static final int FoldedCorner = 65;
+    public static final int LeftArrow = 66;
+    public static final int DownArrow = 67;
+    public static final int UpArrow = 68;
+    public static final int LeftRightArrow = 69;
+    public static final int UpDownArrow = 70;
+    public static final int IrregularSeal1 = 71;
+    public static final int IrregularSeal2 = 72;
+    public static final int LightningBolt = 73;
+    public static final int Heart = 74;
+    public static final int PictureFrame = 75;
+    public static final int QuadArrow = 76;
+    public static final int LeftArrowCallout = 77;
+    public static final int RightArrowCallout = 78;
+    public static final int UpArrowCallout = 79;
+    public static final int DownArrowCallout = 80;
+    public static final int LeftRightArrowCallout = 81;
+    public static final int UpDownArrowCallout = 82;
+    public static final int QuadArrowCallout = 83;
+    public static final int Bevel = 84;
+    public static final int LeftBracket = 85;
+    public static final int RightBracket = 86;
+    public static final int LeftBrace = 87;
+    public static final int RightBrace = 88;
+    public static final int LeftUpArrow = 89;
+    public static final int BentUpArrow = 90;
+    public static final int BentArrow = 91;
+    public static final int Star24 = 92;
+    public static final int StripedRightArrow = 93;
+    public static final int NotchedRightArrow = 94;
+    public static final int BlockArc = 95;
+    public static final int SmileyFace = 96;
+    public static final int VerticalScroll = 97;
+    public static final int HorizontalScroll = 98;
+    public static final int CircularArrow = 99;
+    public static final int NotchedCircularArrow = 100;
+    public static final int UturnArrow = 101;
+    public static final int CurvedRightArrow = 102;
+    public static final int CurvedLeftArrow = 103;
+    public static final int CurvedUpArrow = 104;
+    public static final int CurvedDownArrow = 105;
+    public static final int CloudCallout = 106;
+    public static final int EllipseRibbon = 107;
+    public static final int EllipseRibbon2 = 108;
+    public static final int FlowChartProcess = 109;
+    public static final int FlowChartDecision = 110;
+    public static final int FlowChartInputOutput = 111;
+    public static final int FlowChartPredefinedProcess = 112;
+    public static final int FlowChartInternalStorage = 113;
+    public static final int FlowChartDocument = 114;
+    public static final int FlowChartMultidocument = 115;
+    public static final int FlowChartTerminator = 116;
+    public static final int FlowChartPreparation = 117;
+    public static final int FlowChartManualInput = 118;
+    public static final int FlowChartManualOperation = 119;
+    public static final int FlowChartConnector = 120;
+    public static final int FlowChartPunchedCard = 121;
+    public static final int FlowChartPunchedTape = 122;
+    public static final int FlowChartSummingJunction = 123;
+    public static final int FlowChartOr = 124;
+    public static final int FlowChartCollate = 125;
+    public static final int FlowChartSort = 126;
+    public static final int FlowChartExtract = 127;
+    public static final int FlowChartMerge = 128;
+    public static final int FlowChartOfflineStorage = 129;
+    public static final int FlowChartOnlineStorage = 130;
+    public static final int FlowChartMagneticTape = 131;
+    public static final int FlowChartMagneticDisk = 132;
+    public static final int FlowChartMagneticDrum = 133;
+    public static final int FlowChartDisplay = 134;
+    public static final int FlowChartDelay = 135;
+    public static final int TextPlainText = 136;
+    public static final int TextStop = 137;
+    public static final int TextTriangle = 138;
+    public static final int TextTriangleInverted = 139;
+    public static final int TextChevron = 140;
+    public static final int TextChevronInverted = 141;
+    public static final int TextRingInside = 142;
+    public static final int TextRingOutside = 143;
+    public static final int TextArchUpCurve = 144;
+    public static final int TextArchDownCurve = 145;
+    public static final int TextCircleCurve = 146;
+    public static final int TextButtonCurve = 147;
+    public static final int TextArchUpPour = 148;
+    public static final int TextArchDownPour = 149;
+    public static final int TextCirclePour = 150;
+    public static final int TextButtonPour = 151;
+    public static final int TextCurveUp = 152;
+    public static final int TextCurveDown = 153;
+    public static final int TextCascadeUp = 154;
+    public static final int TextCascadeDown = 155;
+    public static final int TextWave1 = 156;
+    public static final int TextWave2 = 157;
+    public static final int TextWave3 = 158;
+    public static final int TextWave4 = 159;
+    public static final int TextInflate = 160;
+    public static final int TextDeflate = 161;
+    public static final int TextInflateBottom = 162;
+    public static final int TextDeflateBottom = 163;
+    public static final int TextInflateTop = 164;
+    public static final int TextDeflateTop = 165;
+    public static final int TextDeflateInflate = 166;
+    public static final int TextDeflateInflateDeflate = 167;
+    public static final int TextFadeRight = 168;
+    public static final int TextFadeLeft = 169;
+    public static final int TextFadeUp = 170;
+    public static final int TextFadeDown = 171;
+    public static final int TextSlantUp = 172;
+    public static final int TextSlantDown = 173;
+    public static final int TextCanUp = 174;
+    public static final int TextCanDown = 175;
+    public static final int FlowChartAlternateProcess = 176;
+    public static final int FlowChartOffpageConnector = 177;
+    public static final int Callout90 = 178;
+    public static final int AccentCallout90 = 179;
+    public static final int BorderCallout90 = 180;
+    public static final int AccentBorderCallout90 = 181;
+    public static final int LeftRightUpArrow = 182;
+    public static final int Sun = 183;
+    public static final int Moon = 184;
+    public static final int BracketPair = 185;
+    public static final int BracePair = 186;
+    public static final int Star4 = 187;
+    public static final int DoubleWave = 188;
+    public static final int ActionButtonBlank = 189;
+    public static final int ActionButtonHome = 190;
+    public static final int ActionButtonHelp = 191;
+    public static final int ActionButtonInformation = 192;
+    public static final int ActionButtonForwardNext = 193;
+    public static final int ActionButtonBackPrevious = 194;
+    public static final int ActionButtonEnd = 195;
+    public static final int ActionButtonBeginning = 196;
+    public static final int ActionButtonReturn = 197;
+    public static final int ActionButtonDocument = 198;
+    public static final int ActionButtonSound = 199;
+    public static final int ActionButtonMovie = 200;
+    public static final int HostControl = 201;
+    public static final int TextBox = 202;
+}
index 3f14ecdf4e2b2da0029561284f11ac5e90a65f1b..ffbcec50e6bda88f09edd4f7641244c9855281c9 100644 (file)
@@ -19,7 +19,6 @@ package org.apache.poi.hssf.usermodel;
 
 import org.apache.poi.ddf.*;
 import org.apache.poi.hssf.record.*;
-import org.apache.poi.hssf.usermodel.drawing.ShapeTypes;
 import org.apache.poi.ss.usermodel.RichTextString;
 
 /**
@@ -32,14 +31,14 @@ public class HSSFSimpleShape extends HSSFShape
     // The commented out ones haven't been tested yet or aren't supported
     // by HSSFSimpleShape.
 
-    public final static short       OBJECT_TYPE_LINE               = ShapeTypes.Line;
-    public final static short       OBJECT_TYPE_RECTANGLE          = ShapeTypes.Rectangle;
-    public final static short       OBJECT_TYPE_OVAL               = ShapeTypes.Ellipse;
-    public final static short       OBJECT_TYPE_ARC                = ShapeTypes.Arc;
+    public final static short       OBJECT_TYPE_LINE               = HSSFShapeTypes.Line;
+    public final static short       OBJECT_TYPE_RECTANGLE          = HSSFShapeTypes.Rectangle;
+    public final static short       OBJECT_TYPE_OVAL               = HSSFShapeTypes.Ellipse;
+    public final static short       OBJECT_TYPE_ARC                = HSSFShapeTypes.Arc;
     //    public final static short       OBJECT_TYPE_CHART              = 5;
 //    public final static short       OBJECT_TYPE_TEXT               = 6;
 //    public final static short       OBJECT_TYPE_BUTTON             = 7;
-    public final static short       OBJECT_TYPE_PICTURE            = ShapeTypes.PictureFrame;
+    public final static short       OBJECT_TYPE_PICTURE            = HSSFShapeTypes.PictureFrame;
 
 //    public final static short       OBJECT_TYPE_POLYGON            = 9;
 //    public final static short       OBJECT_TYPE_CHECKBOX           = 11;
@@ -51,8 +50,8 @@ public class HSSFSimpleShape extends HSSFShape
 //    public final static short       OBJECT_TYPE_SCROLL_BAR         = 17;
 //    public final static short       OBJECT_TYPE_LIST_BOX           = 18;
 //    public final static short       OBJECT_TYPE_GROUP_BOX          = 19;
-    public final static short       OBJECT_TYPE_COMBO_BOX          = ShapeTypes.HostControl;
-    public final static short       OBJECT_TYPE_COMMENT            = ShapeTypes.TextBox;
+    public final static short       OBJECT_TYPE_COMBO_BOX          = HSSFShapeTypes.HostControl;
+    public final static short       OBJECT_TYPE_COMMENT            = HSSFShapeTypes.TextBox;
     public final static short       OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING = 30;
 
     public final static int WRAP_SQUARE = 0;
@@ -124,7 +123,7 @@ public class HSSFSimpleShape extends HSSFShape
 
         spContainer.addChildRecord(sp);
         spContainer.addChildRecord(optRecord);
-        spContainer.addChildRecord(anchor.getEscherAnchor());
+        spContainer.addChildRecord(getAnchor().getEscherAnchor());
         spContainer.addChildRecord(clientData);
         spContainer.addChildRecord(escherTextbox);
         return spContainer;
@@ -226,7 +225,7 @@ public class HSSFSimpleShape extends HSSFShape
     }
 
     /**
-     * @see org.apache.poi.hssf.usermodel.drawing.ShapeTypes
+     * @see HSSFShapeTypes
      * @param value - shapeType
      */
     public void setShapeType(int value){
diff --git a/src/java/org/apache/poi/hssf/usermodel/drawing/HSSFShapeType.java b/src/java/org/apache/poi/hssf/usermodel/drawing/HSSFShapeType.java
deleted file mode 100644 (file)
index 14dacc6..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* ====================================================================\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.hssf.usermodel.drawing;\r
-\r
-import org.apache.poi.hssf.record.EscherAggregate;\r
-import org.apache.poi.hssf.usermodel.HSSFPicture;\r
-import org.apache.poi.hssf.usermodel.HSSFSimpleShape;\r
-import org.apache.poi.hssf.usermodel.HSSFTextbox;\r
-\r
-/**\r
- * @author Evgeniy Berlog\r
- * date: 08.06.12\r
- */\r
-public enum HSSFShapeType {\r
-    NOT_PRIMITIVE((short)0x0, null, (short)0),\r
-    RECTANGLE((short)0x1, HSSFSimpleShape.class, HSSFSimpleShape.OBJECT_TYPE_RECTANGLE),\r
-    PICTURE((short)0x004B, HSSFPicture.class, HSSFSimpleShape.OBJECT_TYPE_PICTURE),\r
-    LINE((short)0x14, HSSFSimpleShape.class, HSSFSimpleShape.OBJECT_TYPE_LINE),\r
-    OVAL(EscherAggregate.ST_ELLIPSE, HSSFSimpleShape.class, HSSFSimpleShape.OBJECT_TYPE_OVAL),\r
-    ARC(EscherAggregate.ST_ARC, HSSFSimpleShape.class, HSSFSimpleShape.OBJECT_TYPE_ARC),\r
-    TEXT((short)202, HSSFTextbox.class, HSSFTextbox.OBJECT_TYPE_TEXT),\r
-    ROUND_RECTANGLE((short)0x2, null, null);\r
-\r
-    private Short type;\r
-    private Class shape;\r
-    private Short objectType;\r
-\r
-    private HSSFShapeType(Short type, Class shape, Short objectType) {\r
-        this.type = type;\r
-        this.shape = shape;\r
-        this.objectType = objectType;\r
-    }\r
-\r
-    public Short getType() {\r
-        return type;\r
-    }\r
-\r
-    public Class getShape() {\r
-        return shape;\r
-    }\r
-\r
-    public Short getObjectType() {\r
-        return objectType;\r
-    }\r
-}\r
diff --git a/src/java/org/apache/poi/hssf/usermodel/drawing/ShapeTypes.java b/src/java/org/apache/poi/hssf/usermodel/drawing/ShapeTypes.java
deleted file mode 100644 (file)
index 3391130..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-/* ====================================================================
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-==================================================================== */
-
-package org.apache.poi.hssf.usermodel.drawing;
-
-public interface ShapeTypes {
-    public static final int NotPrimitive = 0;
-    public static final int Rectangle = 1;
-    public static final int RoundRectangle = 2;
-    public static final int Ellipse = 3;
-    public static final int Diamond = 4;
-    public static final int IsocelesTriangle = 5;
-    public static final int RightTriangle = 6;
-    public static final int Parallelogram = 7;
-    public static final int Trapezoid = 8;
-    public static final int Hexagon = 9;
-    public static final int Octagon = 10;
-    public static final int Plus = 11;
-    public static final int Star = 12;
-    public static final int Arrow = 13;
-    public static final int ThickArrow = 14;
-    public static final int HomePlate = 15;
-    public static final int Cube = 16;
-    public static final int Balloon = 17;
-    public static final int Seal = 18;
-    public static final int Arc = 19;
-    public static final int Line = 20;
-    public static final int Plaque = 21;
-    public static final int Can = 22;
-    public static final int Donut = 23;
-    public static final int TextSimple = 24;
-    public static final int TextOctagon = 25;
-    public static final int TextHexagon = 26;
-    public static final int TextCurve = 27;
-    public static final int TextWave = 28;
-    public static final int TextRing = 29;
-    public static final int TextOnCurve = 30;
-    public static final int TextOnRing = 31;
-    public static final int StraightConnector1 = 32;
-    public static final int BentConnector2 = 33;
-    public static final int BentConnector3 = 34;
-    public static final int BentConnector4 = 35;
-    public static final int BentConnector5 = 36;
-    public static final int CurvedConnector2 = 37;
-    public static final int CurvedConnector3 = 38;
-    public static final int CurvedConnector4 = 39;
-    public static final int CurvedConnector5 = 40;
-    public static final int Callout1 = 41;
-    public static final int Callout2 = 42;
-    public static final int Callout3 = 43;
-    public static final int AccentCallout1 = 44;
-    public static final int AccentCallout2 = 45;
-    public static final int AccentCallout3 = 46;
-    public static final int BorderCallout1 = 47;
-    public static final int BorderCallout2 = 48;
-    public static final int BorderCallout3 = 49;
-    public static final int AccentBorderCallout1 = 50;
-    public static final int AccentBorderCallout2 = 51;
-    public static final int AccentBorderCallout3 = 52;
-    public static final int Ribbon = 53;
-    public static final int Ribbon2 = 54;
-    public static final int Chevron = 55;
-    public static final int Pentagon = 56;
-    public static final int NoSmoking = 57;
-    public static final int Star8 = 58;
-    public static final int Star16 = 59;
-    public static final int Star32 = 60;
-    public static final int WedgeRectCallout = 61;
-    public static final int WedgeRRectCallout = 62;
-    public static final int WedgeEllipseCallout = 63;
-    public static final int Wave = 64;
-    public static final int FoldedCorner = 65;
-    public static final int LeftArrow = 66;
-    public static final int DownArrow = 67;
-    public static final int UpArrow = 68;
-    public static final int LeftRightArrow = 69;
-    public static final int UpDownArrow = 70;
-    public static final int IrregularSeal1 = 71;
-    public static final int IrregularSeal2 = 72;
-    public static final int LightningBolt = 73;
-    public static final int Heart = 74;
-    public static final int PictureFrame = 75;
-    public static final int QuadArrow = 76;
-    public static final int LeftArrowCallout = 77;
-    public static final int RightArrowCallout = 78;
-    public static final int UpArrowCallout = 79;
-    public static final int DownArrowCallout = 80;
-    public static final int LeftRightArrowCallout = 81;
-    public static final int UpDownArrowCallout = 82;
-    public static final int QuadArrowCallout = 83;
-    public static final int Bevel = 84;
-    public static final int LeftBracket = 85;
-    public static final int RightBracket = 86;
-    public static final int LeftBrace = 87;
-    public static final int RightBrace = 88;
-    public static final int LeftUpArrow = 89;
-    public static final int BentUpArrow = 90;
-    public static final int BentArrow = 91;
-    public static final int Star24 = 92;
-    public static final int StripedRightArrow = 93;
-    public static final int NotchedRightArrow = 94;
-    public static final int BlockArc = 95;
-    public static final int SmileyFace = 96;
-    public static final int VerticalScroll = 97;
-    public static final int HorizontalScroll = 98;
-    public static final int CircularArrow = 99;
-    public static final int NotchedCircularArrow = 100;
-    public static final int UturnArrow = 101;
-    public static final int CurvedRightArrow = 102;
-    public static final int CurvedLeftArrow = 103;
-    public static final int CurvedUpArrow = 104;
-    public static final int CurvedDownArrow = 105;
-    public static final int CloudCallout = 106;
-    public static final int EllipseRibbon = 107;
-    public static final int EllipseRibbon2 = 108;
-    public static final int FlowChartProcess = 109;
-    public static final int FlowChartDecision = 110;
-    public static final int FlowChartInputOutput = 111;
-    public static final int FlowChartPredefinedProcess = 112;
-    public static final int FlowChartInternalStorage = 113;
-    public static final int FlowChartDocument = 114;
-    public static final int FlowChartMultidocument = 115;
-    public static final int FlowChartTerminator = 116;
-    public static final int FlowChartPreparation = 117;
-    public static final int FlowChartManualInput = 118;
-    public static final int FlowChartManualOperation = 119;
-    public static final int FlowChartConnector = 120;
-    public static final int FlowChartPunchedCard = 121;
-    public static final int FlowChartPunchedTape = 122;
-    public static final int FlowChartSummingJunction = 123;
-    public static final int FlowChartOr = 124;
-    public static final int FlowChartCollate = 125;
-    public static final int FlowChartSort = 126;
-    public static final int FlowChartExtract = 127;
-    public static final int FlowChartMerge = 128;
-    public static final int FlowChartOfflineStorage = 129;
-    public static final int FlowChartOnlineStorage = 130;
-    public static final int FlowChartMagneticTape = 131;
-    public static final int FlowChartMagneticDisk = 132;
-    public static final int FlowChartMagneticDrum = 133;
-    public static final int FlowChartDisplay = 134;
-    public static final int FlowChartDelay = 135;
-    public static final int TextPlainText = 136;
-    public static final int TextStop = 137;
-    public static final int TextTriangle = 138;
-    public static final int TextTriangleInverted = 139;
-    public static final int TextChevron = 140;
-    public static final int TextChevronInverted = 141;
-    public static final int TextRingInside = 142;
-    public static final int TextRingOutside = 143;
-    public static final int TextArchUpCurve = 144;
-    public static final int TextArchDownCurve = 145;
-    public static final int TextCircleCurve = 146;
-    public static final int TextButtonCurve = 147;
-    public static final int TextArchUpPour = 148;
-    public static final int TextArchDownPour = 149;
-    public static final int TextCirclePour = 150;
-    public static final int TextButtonPour = 151;
-    public static final int TextCurveUp = 152;
-    public static final int TextCurveDown = 153;
-    public static final int TextCascadeUp = 154;
-    public static final int TextCascadeDown = 155;
-    public static final int TextWave1 = 156;
-    public static final int TextWave2 = 157;
-    public static final int TextWave3 = 158;
-    public static final int TextWave4 = 159;
-    public static final int TextInflate = 160;
-    public static final int TextDeflate = 161;
-    public static final int TextInflateBottom = 162;
-    public static final int TextDeflateBottom = 163;
-    public static final int TextInflateTop = 164;
-    public static final int TextDeflateTop = 165;
-    public static final int TextDeflateInflate = 166;
-    public static final int TextDeflateInflateDeflate = 167;
-    public static final int TextFadeRight = 168;
-    public static final int TextFadeLeft = 169;
-    public static final int TextFadeUp = 170;
-    public static final int TextFadeDown = 171;
-    public static final int TextSlantUp = 172;
-    public static final int TextSlantDown = 173;
-    public static final int TextCanUp = 174;
-    public static final int TextCanDown = 175;
-    public static final int FlowChartAlternateProcess = 176;
-    public static final int FlowChartOffpageConnector = 177;
-    public static final int Callout90 = 178;
-    public static final int AccentCallout90 = 179;
-    public static final int BorderCallout90 = 180;
-    public static final int AccentBorderCallout90 = 181;
-    public static final int LeftRightUpArrow = 182;
-    public static final int Sun = 183;
-    public static final int Moon = 184;
-    public static final int BracketPair = 185;
-    public static final int BracePair = 186;
-    public static final int Star4 = 187;
-    public static final int DoubleWave = 188;
-    public static final int ActionButtonBlank = 189;
-    public static final int ActionButtonHome = 190;
-    public static final int ActionButtonHelp = 191;
-    public static final int ActionButtonInformation = 192;
-    public static final int ActionButtonForwardNext = 193;
-    public static final int ActionButtonBackPrevious = 194;
-    public static final int ActionButtonEnd = 195;
-    public static final int ActionButtonBeginning = 196;
-    public static final int ActionButtonReturn = 197;
-    public static final int ActionButtonDocument = 198;
-    public static final int ActionButtonSound = 199;
-    public static final int ActionButtonMovie = 200;
-    public static final int HostControl = 201;
-    public static final int TextBox = 202;
-}