You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by on...@apache.org on 2015/11/25 08:16:44 UTC

svn commit: r1716313 - in /poi/trunk/src: examples/src/org/apache/poi/hssf/usermodel/examples/ examples/src/org/apache/poi/ss/examples/ java/org/apache/poi/hssf/model/ java/org/apache/poi/hssf/usermodel/ java/org/apache/poi/ss/usermodel/ ooxml/java/org...

Author: onealj
Date: Wed Nov 25 07:16:43 2015
New Revision: 1716313

URL: http://svn.apache.org/viewvc?rev=1716313&view=rev
Log:
bug 58636: upgrade anchor types from int to AnchorType enum

Modified:
    poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java
    poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/OfficeDrawing.java
    poi/trunk/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java
    poi/trunk/src/java/org/apache/poi/hssf/model/ComboboxShape.java
    poi/trunk/src/java/org/apache/poi/hssf/model/ConvertAnchor.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCombobox.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/ClientAnchor.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFPicture.java
    poi/trunk/src/testcases/org/apache/poi/hssf/model/TestDrawingShapes.java
    poi/trunk/src/testcases/org/apache/poi/hssf/model/TestHSSFAnchor.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPatriarch.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java

Modified: poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java?rev=1716313&r1=1716312&r2=1716313&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java Wed Nov 25 07:16:43 2015
@@ -31,6 +31,7 @@ import org.apache.poi.hssf.usermodel.HSS
 import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
 import org.apache.poi.hssf.usermodel.HSSFPatriarch;
 import org.apache.poi.hssf.util.CellReference;
+import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType;
 
 
 /**
@@ -291,7 +292,7 @@ public class AddDimensionedImage {
         // image as the size of the row/column is adjusted. This could easilly
         // become another parameter passed to the method.
         //anchor.setAnchorType(HSSFClientAnchor.DONT_MOVE_AND_RESIZE);
-        anchor.setAnchorType(HSSFClientAnchor.MOVE_AND_RESIZE);
+        anchor.setAnchorType(AnchorType.MOVE_AND_RESIZE);
         
         // Now, add the picture to the workbook. Note that the type is assumed
         // to be a JPEG/JPG, this could easily (and should) be parameterised

Modified: poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/OfficeDrawing.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/OfficeDrawing.java?rev=1716313&r1=1716312&r2=1716313&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/OfficeDrawing.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/OfficeDrawing.java Wed Nov 25 07:16:43 2015
@@ -18,6 +18,7 @@
 package org.apache.poi.hssf.usermodel.examples;
 
 import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType;
 
 import java.io.*;
 
@@ -152,15 +153,15 @@ public class OfficeDrawing {
 
         HSSFClientAnchor anchor;
         anchor = new HSSFClientAnchor(0,0,0,255,(short)2,2,(short)4,7);
-        anchor.setAnchorType( 2 );
+        anchor.setAnchorType( AnchorType.MOVE_DONT_RESIZE );
         patriarch.createPicture(anchor, loadPicture( "src/resources/logos/logoKarmokar4.png", wb ));
 
         anchor = new HSSFClientAnchor(0,0,0,255,(short)4,2,(short)5,7);
-        anchor.setAnchorType( 2 );
+        anchor.setAnchorType( AnchorType.MOVE_DONT_RESIZE );
         patriarch.createPicture(anchor, loadPicture( "src/resources/logos/logoKarmokar4edited.png", wb ));
 
         anchor = new HSSFClientAnchor(0,0,1023,255,(short)6,2,(short)8,7);
-        anchor.setAnchorType( 2 );
+        anchor.setAnchorType( AnchorType.MOVE_DONT_RESIZE );
         HSSFPicture picture = patriarch.createPicture(anchor, loadPicture( "src/resources/logos/logoKarmokar4s.png", wb ));
         //Reset the image to the original size.
         picture.resize();

Modified: poi/trunk/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java?rev=1716313&r1=1716312&r2=1716313&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/ss/examples/AddDimensionedImage.java Wed Nov 25 07:16:43 2015
@@ -28,6 +28,7 @@ import java.util.Locale;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.ss.usermodel.ClientAnchor;
+import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType;
 import org.apache.poi.ss.usermodel.Drawing;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
@@ -373,10 +374,10 @@ public class AddDimensionedImage {
         anchor.setRow2(rowClientAnchorDetail.getToIndex());
 
         // For now, set the anchor type to do not move or resize the
-        // image as the size of the row/column is adjusted. This could easilly
+        // image as the size of the row/column is adjusted. This could easily
         // become another parameter passed to the method. Please read the note
         // above regarding the behaviour of image resizing.
-        anchor.setAnchorType(ClientAnchor.MOVE_AND_RESIZE);
+        anchor.setAnchorType(AnchorType.MOVE_AND_RESIZE);
 
         // Now, add the picture to the workbook. Note that unlike the similar
         // method in the HSSF Examples section, the image type is checked. First,
@@ -400,14 +401,14 @@ public class AddDimensionedImage {
     }
 
     /**
-     * Determines whether the sheets columns should be re-sized to accomodate
+     * Determines whether the sheets columns should be re-sized to accommodate
      * the image, adjusts the columns width if necessary and creates then
      * returns a ClientAnchorDetail object that facilitates construction of
      * an ClientAnchor that will fix the image on the sheet and establish
      * it's size.
      *
      * @param sheet A reference to the sheet that will 'contain' the image.
-     * @param colNumber A primtive int that contains the index number of a
+     * @param colNumber A primitive int that contains the index number of a
      *                  column on the sheet.
      * @param reqImageWidthMM A primitive double that contains the required
      *                        width of the image in millimetres

Modified: poi/trunk/src/java/org/apache/poi/hssf/model/ComboboxShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/model/ComboboxShape.java?rev=1716313&r1=1716312&r2=1716313&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/model/ComboboxShape.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/model/ComboboxShape.java Wed Nov 25 07:16:43 2015
@@ -21,6 +21,7 @@ package org.apache.poi.hssf.model;
 import org.apache.poi.ddf.*;
 import org.apache.poi.hssf.record.*;
 import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType;
 
 /**
  * Represents a combobox shape.
@@ -92,7 +93,7 @@ public class ComboboxShape
         opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, 0x00020000));
 
         HSSFClientAnchor userAnchor = (HSSFClientAnchor) shape.getAnchor();
-        userAnchor.setAnchorType(1);
+        userAnchor.setAnchorType(AnchorType.DONT_MOVE_DO_RESIZE);
         EscherRecord anchor = createAnchor(userAnchor);
         clientData.setRecordId(EscherClientDataRecord.RECORD_ID);
         clientData.setOptions((short) 0x0000);

Modified: poi/trunk/src/java/org/apache/poi/hssf/model/ConvertAnchor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/model/ConvertAnchor.java?rev=1716313&r1=1716312&r2=1716313&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/model/ConvertAnchor.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/model/ConvertAnchor.java Wed Nov 25 07:16:43 2015
@@ -38,7 +38,7 @@ public class ConvertAnchor
             EscherClientAnchorRecord anchor = new EscherClientAnchorRecord();
             anchor.setRecordId( EscherClientAnchorRecord.RECORD_ID );
             anchor.setOptions( (short) 0x0000 );
-            anchor.setFlag( (short) a.getAnchorType() );
+            anchor.setFlag( a.getAnchorType().value );
             anchor.setCol1( (short) Math.min(a.getCol1(), a.getCol2()) );
             anchor.setDx1( (short) a.getDx1() );
             anchor.setRow1( (short) Math.min(a.getRow1(), a.getRow2()) );

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java?rev=1716313&r1=1716312&r2=1716313&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java Wed Nov 25 07:16:43 2015
@@ -250,20 +250,20 @@ public final class HSSFClientAnchor exte
 
     /**
      * Gets the anchor type
-     * <p/>
-     * 0 = Move and size with Cells, 2 = Move but don't size with cells, 3 = Don't move or size with cells.
+     * @return the anchor type
      */
-    public int getAnchorType() {
-        return _escherClientAnchor.getFlag();
+    @Override
+    public AnchorType getAnchorType() {
+        return AnchorType.byId(_escherClientAnchor.getFlag());
     }
 
     /**
      * Sets the anchor type
-     * <p/>
-     * 0 = Move and size with Cells, 2 = Move but don't size with cells, 3 = Don't move or size with cells.
+     * @param anchorType the anchor type to set
      */
-    public void setAnchorType(int anchorType) {
-        _escherClientAnchor.setFlag(Integer.valueOf(anchorType).shortValue());
+    @Override
+    public void setAnchorType(AnchorType anchorType) {
+        _escherClientAnchor.setFlag(anchorType.value);
     }
 
     private void checkRange(int value, int minRange, int maxRange, String varName) {

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCombobox.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCombobox.java?rev=1716313&r1=1716312&r2=1716313&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCombobox.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCombobox.java Wed Nov 25 07:16:43 2015
@@ -19,6 +19,7 @@ package org.apache.poi.hssf.usermodel;
 
 import org.apache.poi.ddf.*;
 import org.apache.poi.hssf.record.*;
+import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType;
 
 /**
  * 
@@ -61,7 +62,7 @@ public class HSSFCombobox extends HSSFSi
         opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, 0x00020000));
 
         HSSFClientAnchor userAnchor = (HSSFClientAnchor) getAnchor();
-        userAnchor.setAnchorType(1);
+        userAnchor.setAnchorType(AnchorType.DONT_MOVE_DO_RESIZE);
         EscherRecord anchor = userAnchor.getEscherAnchor();
         clientData.setRecordId(EscherClientDataRecord.RECORD_ID);
         clientData.setOptions((short) 0x0000);

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java?rev=1716313&r1=1716312&r2=1716313&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java Wed Nov 25 07:16:43 2015
@@ -34,6 +34,7 @@ import org.apache.poi.hssf.model.Interna
 import org.apache.poi.hssf.record.CommonObjectDataSubRecord;
 import org.apache.poi.hssf.record.EscherAggregate;
 import org.apache.poi.hssf.record.ObjRecord;
+import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType;
 import org.apache.poi.ss.usermodel.Picture;
 import org.apache.poi.ss.util.ImageUtils;
 import org.apache.poi.util.POILogFactory;
@@ -134,7 +135,7 @@ public class HSSFPicture extends HSSFSim
      */
     public void resize(double scaleX, double scaleY) {
         HSSFClientAnchor anchor = getClientAnchor();
-        anchor.setAnchorType(2);
+        anchor.setAnchorType(AnchorType.MOVE_DONT_RESIZE);
 
         HSSFClientAnchor pref = getPreferredSize(scaleX,scaleY);
 

Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/ClientAnchor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/ClientAnchor.java?rev=1716313&r1=1716312&r2=1716313&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/ClientAnchor.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/ClientAnchor.java Wed Nov 25 07:16:43 2015
@@ -23,6 +23,7 @@ package org.apache.poi.ss.usermodel;
  * @author Yegor Kozlov
  */
 public interface ClientAnchor {
+    
     /**
      * Move and Resize With Anchor Cells
      * <p>
@@ -30,9 +31,10 @@ public interface ClientAnchor {
      * resize to maintain its row and column anchors (i.e. the
      * object is anchored to the actual from and to row and column)
      * </p>
+     * @deprecated since POI 3.14beta1 (circa 2015-11-24). Use {@link AnchorType.MOVE_AND_RESIZE} instead.
      */
-    public static final int MOVE_AND_RESIZE = 0;
-
+    public static final AnchorType MOVE_AND_RESIZE = AnchorType.MOVE_AND_RESIZE;
+    
     /**
      * Move With Cells but Do Not Resize
      * <p>
@@ -44,8 +46,9 @@ public interface ClientAnchor {
      * If additional rows/columns are added between the from and to locations of the drawing,
      * the drawing shall move its to anchors as needed to maintain this same absolute size.
      * </p>
+     * @deprecated since POI 3.14beta1 (circa 2015-11-24). Use {@link AnchorType.MOVE_DONT_RESIZE} instead.
      */
-    public static final int MOVE_DONT_RESIZE = 2;
+    public static final AnchorType MOVE_DONT_RESIZE = AnchorType.MOVE_DONT_RESIZE;
 
     /**
      * Do Not Move or Resize With Underlying Rows/Columns
@@ -59,9 +62,73 @@ public interface ClientAnchor {
      * drawing, the drawing shall move its anchors as needed
      * to maintain this same absolute position.
      * </p>
+     * @deprecated since POI 3.14beta1 (circa 2015-11-24). Use {@link AnchorType.DONT_MOVE_AND_RESIZE} instead.
      */
-    public static final int DONT_MOVE_AND_RESIZE = 3;
-
+    public static final AnchorType DONT_MOVE_AND_RESIZE = AnchorType.DONT_MOVE_AND_RESIZE;
+    
+    /**
+     * @since POI 3.14beta1
+     */
+    public static enum AnchorType {
+        /**
+         * Move and Resize With Anchor Cells (0)
+         * <p>
+         * Specifies that the current drawing shall move and
+         * resize to maintain its row and column anchors (i.e. the
+         * object is anchored to the actual from and to row and column)
+         * </p>
+         */
+        MOVE_AND_RESIZE(0),
+        
+        /**
+         * Don't Move but do Resize With Anchor Cells (1)
+         * <p>
+         * Specifies that the current drawing shall not move with its
+         * row and column, but should be resized. This option is not normally
+         * used, but is included for completeness.
+         * </p>
+         */
+        DONT_MOVE_DO_RESIZE(1),
+        
+        /**
+         * Move With Cells but Do Not Resize (2)
+         * <p>
+         * Specifies that the current drawing shall move with its
+         * row and column (i.e. the object is anchored to the
+         * actual from row and column), but that the size shall remain absolute.
+         * </p>
+         * <p>
+         * If additional rows/columns are added between the from and to locations of the drawing,
+         * the drawing shall move its to anchors as needed to maintain this same absolute size.
+         * </p>
+         */
+        MOVE_DONT_RESIZE(2),
+        
+        /**
+         * Do Not Move or Resize With Underlying Rows/Columns (3)
+         * <p>
+         * Specifies that the current start and end positions shall
+         * be maintained with respect to the distances from the
+         * absolute start point of the worksheet.
+         * </p>
+         * <p>
+         * If additional rows/columns are added before the
+         * drawing, the drawing shall move its anchors as needed
+         * to maintain this same absolute position.
+         * </p>
+         */
+        DONT_MOVE_AND_RESIZE(3);
+        
+        public final short value;
+        AnchorType(int value) {
+            this.value = (short) value;
+        }
+        
+        public static AnchorType byId(int value) {
+            return values()[value];
+        }
+    }
+    
     /**
      * Returns the column (0 based) of the first cell.
      *
@@ -209,26 +276,14 @@ public interface ClientAnchor {
 
     /**
      * Sets the anchor type
-     * <p>
-     * 0 = Move and size with Cells, 2 = Move but don't size with cells, 3 = Don't move or size with cells.
-     * </p>
-     * @param anchorType the anchor type
-     * @see #MOVE_AND_RESIZE
-     * @see #MOVE_DONT_RESIZE
-     * @see #DONT_MOVE_AND_RESIZE
+     * @param anchorType the anchor type to set
      */
-    public void setAnchorType( int anchorType );
+    public void setAnchorType( AnchorType anchorType );
 
     /**
      * Gets the anchor type
-     * <p>
-     * 0 = Move and size with Cells, 2 = Move but don't size with cells, 3 = Don't move or size with cells.
-     * </p>
      * @return the anchor type
-     * @see #MOVE_AND_RESIZE
-     * @see #MOVE_DONT_RESIZE
-     * @see #DONT_MOVE_AND_RESIZE
      */
-    public int getAnchorType();
+    public AnchorType getAnchorType();
 
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java?rev=1716313&r1=1716312&r2=1716313&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java Wed Nov 25 07:16:43 2015
@@ -28,7 +28,8 @@ import org.openxmlformats.schemas.drawin
  * @author Yegor Kozlov
  */
 public final class XSSFClientAnchor extends XSSFAnchor implements ClientAnchor {
-    private int anchorType;
+    private AnchorType DEFAULT_ANCHOR_TYPE = AnchorType.MOVE_AND_RESIZE;
+    private AnchorType anchorType;
 
     /**
      * Starting anchor point
@@ -44,6 +45,7 @@ public final class XSSFClientAnchor exte
      * Creates a new client anchor and defaults all the anchor positions to 0.
      */
     public XSSFClientAnchor() {
+        anchorType = DEFAULT_ANCHOR_TYPE;
         cell1 = CTMarker.Factory.newInstance();
         cell1.setCol(0);
         cell1.setColOff(0);
@@ -88,6 +90,7 @@ public final class XSSFClientAnchor exte
      * @param cell2 ending anchor point
      */
     protected XSSFClientAnchor(CTMarker cell1, CTMarker cell2) {
+        anchorType = DEFAULT_ANCHOR_TYPE;
         this.cell1 = cell1;
         this.cell2 = cell2;
     }
@@ -214,20 +217,20 @@ public final class XSSFClientAnchor exte
 
     /**
      * Sets the anchor type
-     * <p>
-     * 0 = Move and size with Cells, 2 = Move but don't size with cells, 3 = Don't move or size with cells.
+     * @param anchorType the anchor type to set
      */
-    public void setAnchorType( int anchorType )
+    @Override
+    public void setAnchorType( AnchorType anchorType )
     {
         this.anchorType = anchorType;
     }
 
     /**
      * Gets the anchor type
-     * <p>
-     * 0 = Move and size with Cells, 2 = Move but don't size with cells, 3 = Don't move or size with cells.
+     * @return the anchor type
      */
-    public int getAnchorType()
+    @Override
+    public AnchorType getAnchorType()
     {
         return anchorType;
     }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java?rev=1716313&r1=1716312&r2=1716313&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java Wed Nov 25 07:16:43 2015
@@ -34,7 +34,6 @@ import org.apache.poi.openxml4j.opc.Targ
 import org.apache.poi.ss.usermodel.ClientAnchor;
 import org.apache.poi.ss.usermodel.Drawing;
 import org.apache.poi.ss.util.CellAddress;
-import org.apache.poi.ss.util.CellReference;
 import org.apache.poi.util.Internal;
 import org.apache.poi.util.Units;
 import org.apache.poi.xssf.model.CommentsTable;
@@ -373,9 +372,9 @@ public final class XSSFDrawing extends P
         anchor.setFrom(ctAnchor.getFrom());
         STEditAs.Enum aditAs;
         switch(anchor.getAnchorType()) {
-            case ClientAnchor.DONT_MOVE_AND_RESIZE: aditAs = STEditAs.ABSOLUTE; break;
-            case ClientAnchor.MOVE_AND_RESIZE: aditAs = STEditAs.TWO_CELL; break;
-            case ClientAnchor.MOVE_DONT_RESIZE: aditAs = STEditAs.ONE_CELL; break;
+            case DONT_MOVE_AND_RESIZE: aditAs = STEditAs.ABSOLUTE; break;
+            case MOVE_AND_RESIZE: aditAs = STEditAs.TWO_CELL; break;
+            case MOVE_DONT_RESIZE: aditAs = STEditAs.ONE_CELL; break;
             default: aditAs = STEditAs.ONE_CELL;
         }
         ctAnchor.setEditAs(aditAs);

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFPicture.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFPicture.java?rev=1716313&r1=1716312&r2=1716313&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFPicture.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFPicture.java Wed Nov 25 07:16:43 2015
@@ -23,7 +23,7 @@ import java.io.IOException;
 import java.util.List;
 
 import org.apache.poi.ss.usermodel.BaseTestPicture;
-import org.apache.poi.ss.usermodel.ClientAnchor;
+import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType;
 import org.apache.poi.util.LocaleUtil;
 import org.apache.poi.xssf.XSSFITestDataProvider;
 import org.apache.poi.xssf.XSSFTestDataSamples;
@@ -70,9 +70,9 @@ public final class TestXSSFPicture exten
         assertArrayEquals(jpegData, pictures.get(jpegIdx).getData());
 
         XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, 1, 1, 10, 30);
-        assertEquals(ClientAnchor.MOVE_AND_RESIZE, anchor.getAnchorType());
-        anchor.setAnchorType(ClientAnchor.DONT_MOVE_AND_RESIZE);
-        assertEquals(ClientAnchor.DONT_MOVE_AND_RESIZE, anchor.getAnchorType());
+        assertEquals(AnchorType.MOVE_AND_RESIZE, anchor.getAnchorType());
+        anchor.setAnchorType(AnchorType.DONT_MOVE_AND_RESIZE);
+        assertEquals(AnchorType.DONT_MOVE_AND_RESIZE, anchor.getAnchorType());
 
         XSSFPicture shape = drawing.createPicture(anchor, jpegIdx);
         assertTrue(anchor.equals(shape.getAnchor()));

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/model/TestDrawingShapes.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/model/TestDrawingShapes.java?rev=1716313&r1=1716312&r2=1716313&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/model/TestDrawingShapes.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/model/TestDrawingShapes.java Wed Nov 25 07:16:43 2015
@@ -35,6 +35,7 @@ import org.apache.poi.hssf.record.Common
 import org.apache.poi.hssf.record.EscherAggregate;
 import org.apache.poi.hssf.record.ObjRecord;
 import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.util.HexDump;
 
@@ -148,8 +149,8 @@ public class TestDrawingShapes extends T
 
         HSSFPatriarch drawing = sheet.createDrawingPatriarch();
         HSSFClientAnchor anchor = new HSSFClientAnchor(10, 10, 50, 50, (short) 2, 2, (short) 4, 4);
-        anchor.setAnchorType(2);
-        assertEquals(anchor.getAnchorType(), 2);
+        anchor.setAnchorType(AnchorType.MOVE_DONT_RESIZE);
+        assertEquals(AnchorType.MOVE_DONT_RESIZE, anchor.getAnchorType());
 
         HSSFSimpleShape rectangle = drawing.createSimpleShape(anchor);
         rectangle.setShapeType(HSSFSimpleShape.OBJECT_TYPE_RECTANGLE);

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/model/TestHSSFAnchor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/model/TestHSSFAnchor.java?rev=1716313&r1=1716312&r2=1716313&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/model/TestHSSFAnchor.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/model/TestHSSFAnchor.java Wed Nov 25 07:16:43 2015
@@ -21,6 +21,7 @@ import junit.framework.TestCase;
 import org.apache.poi.ddf.*;
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType;
 
 /**
  * @author Evgeniy Berlog
@@ -30,7 +31,7 @@ public class TestHSSFAnchor extends Test
 
     public void testDefaultValues(){
         HSSFClientAnchor clientAnchor = new HSSFClientAnchor();
-        assertEquals(clientAnchor.getAnchorType(), 0);
+        assertEquals(clientAnchor.getAnchorType(), AnchorType.MOVE_AND_RESIZE);
         assertEquals(clientAnchor.getCol1(), 0);
         assertEquals(clientAnchor.getCol2(), 0);
         assertEquals(clientAnchor.getDx1(), 0);
@@ -41,7 +42,7 @@ public class TestHSSFAnchor extends Test
         assertEquals(clientAnchor.getRow2(), 0);
 
         clientAnchor = new HSSFClientAnchor(new EscherClientAnchorRecord());
-        assertEquals(clientAnchor.getAnchorType(), 0);
+        assertEquals(clientAnchor.getAnchorType(), AnchorType.MOVE_AND_RESIZE);
         assertEquals(clientAnchor.getCol1(), 0);
         assertEquals(clientAnchor.getCol2(), 0);
         assertEquals(clientAnchor.getDx1(), 0);
@@ -143,7 +144,7 @@ public class TestHSSFAnchor extends Test
 
         HSSFPatriarch drawing = sheet.createDrawingPatriarch();
         HSSFClientAnchor anchor = new HSSFClientAnchor(10, 10, 200, 200, (short)2, 2, (short)15, 15);
-        anchor.setAnchorType(2);
+        anchor.setAnchorType(AnchorType.MOVE_DONT_RESIZE);
 
         HSSFSimpleShape rectangle = drawing.createSimpleShape(anchor);
         rectangle.setShapeType(HSSFSimpleShape.OBJECT_TYPE_RECTANGLE);
@@ -362,9 +363,9 @@ public class TestHSSFAnchor extends Test
         clientAnchor2.setRow2(7);
         assertEquals(clientAnchor1, clientAnchor2);
 
-        clientAnchor2.setAnchorType(3);
+        clientAnchor2.setAnchorType(AnchorType.DONT_MOVE_AND_RESIZE);
         assertNotSame(clientAnchor1, clientAnchor2);
-        clientAnchor2.setAnchorType(0);
+        clientAnchor2.setAnchorType(AnchorType.MOVE_AND_RESIZE);
         assertEquals(clientAnchor1, clientAnchor2);
 
         HSSFChildAnchor childAnchor1 = new HSSFChildAnchor(0, 1, 2, 3);

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java?rev=1716313&r1=1716312&r2=1716313&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java Wed Nov 25 07:16:43 2015
@@ -70,6 +70,7 @@ import org.apache.poi.ss.formula.ptg.Ptg
 import org.apache.poi.ss.usermodel.BaseTestBugzillaIssues;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType;
 import org.apache.poi.ss.usermodel.DataFormatter;
 import org.apache.poi.ss.usermodel.FormulaEvaluator;
 import org.apache.poi.ss.usermodel.Name;
@@ -2966,7 +2967,7 @@ public final class TestBugs extends Base
         assertNotNull("Did not find sheet", sheet);
         HSSFPatriarch patriarch = (HSSFPatriarch) sheet.createDrawingPatriarch();
         HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short) 1, 1, (short) 10, 22);
-        anchor.setAnchorType(2);
+        anchor.setAnchorType(AnchorType.MOVE_DONT_RESIZE);
         patriarch.createPicture(anchor, pict);
 
         // Write out destination file

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPatriarch.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPatriarch.java?rev=1716313&r1=1716312&r2=1716313&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPatriarch.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPatriarch.java Wed Nov 25 07:16:43 2015
@@ -18,6 +18,7 @@
 package org.apache.poi.hssf.usermodel;
 
 import org.apache.poi.hssf.HSSFTestDataSamples;
+import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType;
 
 import junit.framework.AssertionFailedError;
 import junit.framework.TestCase;
@@ -56,7 +57,7 @@ public final class TestHSSFPatriarch ext
 
 		// 3. Use patriarch
 		HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 600, 245, (short) 1, 1, (short) 1, 2);
-		anchor.setAnchorType(3);
+		anchor.setAnchorType(AnchorType.DONT_MOVE_AND_RESIZE);
 		byte[] pictureData = HSSFTestDataSamples.getTestDataFileContent("logoKarmokar4.png");
 		int idx1 = wb.addPicture(pictureData, HSSFWorkbook.PICTURE_TYPE_PNG);
 		patr.createPicture(anchor, idx1);

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java?rev=1716313&r1=1716312&r2=1716313&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java Wed Nov 25 07:16:43 2015
@@ -31,7 +31,7 @@ import org.apache.poi.hssf.HSSFTestDataS
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.Ole10Native;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
-import org.apache.poi.ss.usermodel.ClientAnchor;
+import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType;
 import org.apache.poi.ss.usermodel.CreationHelper;
 import org.apache.poi.util.LocaleUtil;
 import org.junit.Test;
@@ -88,25 +88,25 @@ public final class TestOLE2Embeding {
         CreationHelper ch = wb1.getCreationHelper();
         HSSFClientAnchor anchor = (HSSFClientAnchor)ch.createClientAnchor();
         anchor.setAnchor((short)(2+coloffset), 1+rowoffset, 0, 0, (short)(3+coloffset), 5+rowoffset, 0, 0);
-        anchor.setAnchorType(ClientAnchor.DONT_MOVE_AND_RESIZE);
+        anchor.setAnchorType(AnchorType.DONT_MOVE_AND_RESIZE);
     	
         patriarch.createObjectData(anchor, pptIdx, imgPPT);
 
         anchor = (HSSFClientAnchor)ch.createClientAnchor();
         anchor.setAnchor((short)(5+coloffset), 1+rowoffset, 0, 0, (short)(6+coloffset), 5+rowoffset, 0, 0);
-        anchor.setAnchorType(ClientAnchor.DONT_MOVE_AND_RESIZE);
+        anchor.setAnchorType(AnchorType.DONT_MOVE_AND_RESIZE);
         
         patriarch.createObjectData(anchor, xlsIdx, imgIdx);
         
         anchor = (HSSFClientAnchor)ch.createClientAnchor();
         anchor.setAnchor((short)(3+coloffset), 10+rowoffset, 0, 0, (short)(5+coloffset), 11+rowoffset, 0, 0);
-        anchor.setAnchorType(ClientAnchor.DONT_MOVE_AND_RESIZE);
+        anchor.setAnchorType(AnchorType.DONT_MOVE_AND_RESIZE);
         
         patriarch.createObjectData(anchor, txtIdx, imgIdx);
         
         anchor = (HSSFClientAnchor)ch.createClientAnchor();
         anchor.setAnchor((short)(1+coloffset), -2+rowoffset, 0, 0, (short)(7+coloffset), 14+rowoffset, 0, 0);
-        anchor.setAnchorType(ClientAnchor.DONT_MOVE_AND_RESIZE);
+        anchor.setAnchorType(AnchorType.DONT_MOVE_AND_RESIZE);
 
         HSSFSimpleShape circle = patriarch.createSimpleShape(anchor);
         circle.setShapeType(HSSFSimpleShape.OBJECT_TYPE_OVAL);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org