Save This Page
Home » jexcelapi_2_6_8 » jxl.write » [javadoc | source]
    1   /*********************************************************************
    2   *
    3   *      Copyright (C) 2003 Andrew Khan
    4   *
    5   * This library is free software; you can redistribute it and/or
    6   * modify it under the terms of the GNU Lesser General Public
    7   * License as published by the Free Software Foundation; either
    8   * version 2.1 of the License, or (at your option) any later version.
    9   *
   10   * This library is distributed in the hope that it will be useful,
   11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13   * Lesser General Public License for more details.
   14   *
   15   * You should have received a copy of the GNU Lesser General Public
   16   * License along with this library; if not, write to the Free Software
   17   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
   18   ***************************************************************************/
   19   
   20   package jxl.write;
   21   
   22   import java.io.File;
   23   
   24   import jxl.biff.drawing.Drawing;
   25   import jxl.biff.drawing.DrawingGroup;
   26   import jxl.biff.drawing.DrawingGroupObject;
   27   
   28   /**
   29    * Allows an image to be created, or an existing image to be manipulated
   30    * Note that co-ordinates and dimensions are given in cells, so that if for
   31    * example the width or height of a cell which the image spans is altered,
   32    * the image will have a correspondign distortion
   33    */
   34   public class WritableImage extends Drawing
   35   {
   36     // Shadow these values from the superclass.  The only practical reason
   37     // for doing this is that they  appear nicely in the javadoc
   38   
   39     /**
   40      * Image anchor properties which will move and resize an image
   41      * along with the cells
   42      */
   43     public static ImageAnchorProperties MOVE_AND_SIZE_WITH_CELLS = 
   44       Drawing.MOVE_AND_SIZE_WITH_CELLS;
   45   
   46     /**
   47      * Image anchor properties which will move an image
   48      * when cells are inserted or deleted
   49      */
   50     public static ImageAnchorProperties MOVE_WITH_CELLS = 
   51       Drawing.MOVE_WITH_CELLS;
   52   
   53     /**
   54      * Image anchor properties which will leave an image unaffected when
   55      * other cells are inserted, removed or resized
   56      */
   57     public static ImageAnchorProperties NO_MOVE_OR_SIZE_WITH_CELLS = 
   58       Drawing.NO_MOVE_OR_SIZE_WITH_CELLS;
   59   
   60     /**
   61      * Constructor
   62      *
   63      * @param x the column number at which to position the image
   64      * @param y the row number at which to position the image
   65      * @param width the number of columns cells which the image spans
   66      * @param height the number of rows which the image spans
   67      * @param image the source image file
   68      */
   69     public WritableImage(double x, double y,
   70                          double width, double height,
   71                          File image)
   72     {
   73       super(x, y, width, height, image);
   74     }
   75   
   76     /**
   77      * Constructor
   78      *
   79      * @param x the column number at which to position the image
   80      * @param y the row number at which to position the image
   81      * @param width the number of columns cells which the image spans
   82      * @param height the number of rows which the image spans
   83      * @param imageData the image data
   84      */
   85     public WritableImage(double x,
   86                          double y,
   87                          double width,
   88                          double height,
   89                          byte[] imageData)
   90     {
   91       super(x, y, width, height, imageData);
   92     }
   93   
   94     /**
   95      * Constructor, used when copying sheets
   96      *
   97      * @param d the image to copy
   98      * @param dg the drawing group
   99      */
  100     public WritableImage(DrawingGroupObject d, DrawingGroup dg)
  101     {
  102       super(d, dg);
  103     }
  104   
  105     /**
  106      * Accessor for the image position
  107      *
  108      * @return the column number at which the image is positioned
  109      */
  110     public double getColumn()
  111     {
  112       return super.getX();
  113     }
  114   
  115     /**
  116      * Accessor for the image position
  117      *
  118      * @param c the column number at which the image should be positioned
  119      */
  120     public void setColumn(double c)
  121     {
  122       super.setX(c);
  123     }
  124   
  125     /**
  126      * Accessor for the image position
  127      *
  128      * @return the row number at which the image is positions
  129      */
  130     public double getRow()
  131     {
  132       return super.getY();
  133     }
  134   
  135     /**
  136      * Accessor for the image position
  137      *
  138      * @param c the row number at which the image should be positioned
  139      */
  140     public void setRow(double c)
  141     {
  142       super.setY(c);
  143     }
  144   
  145     /**
  146      * Accessor for the image dimensions
  147      *
  148      * @return  the number of columns this image spans
  149      */
  150     public double getWidth()
  151     {
  152       return super.getWidth();
  153     }
  154   
  155     /**
  156      * Accessor for the image dimensions
  157      * Note that the actual size of the rendered image will depend on the
  158      * width of the columns it spans
  159      *
  160      * @param c the number of columns which this image spans
  161      */
  162     public void setWidth(double c)
  163     {
  164       super.setWidth(c);
  165     }
  166   
  167     /**
  168      * Accessor for the image dimensions
  169      *
  170      * @return the number of rows which this image spans
  171      */
  172     public double getHeight()
  173     {
  174       return super.getHeight();
  175     }
  176   
  177     /**
  178      * Accessor for the image dimensions
  179      * Note that the actual size of the rendered image will depend on the
  180      * height of the rows it spans
  181      *
  182      * @param c the number of rows which this image should span
  183      */
  184     public void setHeight(double c)
  185     {
  186       super.setHeight(c);
  187     }
  188   
  189     /**
  190      * Accessor for the image file
  191      *
  192      * @return the file which the image references
  193      */
  194     public File getImageFile()
  195     {
  196       return super.getImageFile();
  197     }
  198   
  199     /**
  200      * Accessor for the image data
  201      *
  202      * @return the image data
  203      */
  204     public byte[] getImageData()
  205     {
  206       return super.getImageData();
  207     }
  208   
  209     /**
  210      * Accessor for the anchor properties
  211      */
  212     public void setImageAnchor(ImageAnchorProperties iap)
  213     {
  214       super.setImageAnchor(iap);
  215     }
  216   
  217     /**
  218      * Accessor for the anchor properties
  219      */
  220     public ImageAnchorProperties getImageAnchor()
  221     {
  222       return super.getImageAnchor();
  223     }
  224   }

Save This Page
Home » jexcelapi_2_6_8 » jxl.write » [javadoc | source]