Home » JCraft » jxl » biff » formula » [javadoc | source]

    1   /*********************************************************************
    2   *
    3   *      Copyright (C) 2005 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.biff.formula;
   21   
   22   import jxl.common.Logger;
   23   
   24   /**
   25    * An cell reference error which occurs in a formula
   26    */
   27   class CellReferenceError extends Operand implements ParsedThing
   28   {
   29     /**
   30      * The logger
   31      */
   32     private static Logger logger = Logger.getLogger(CellReferenceError.class);
   33   
   34     /**
   35      * Constructor
   36      */
   37     public CellReferenceError()
   38     {
   39     }
   40   
   41     /**
   42      * Reads the ptg data from the array starting at the specified position
   43      *
   44      * @param data the RPN array
   45      * @param pos the current position in the array, excluding the ptg identifier
   46      * @return the number of bytes read
   47      */
   48     public int read(byte[] data, int pos)
   49     {
   50       // the data is unused - just return the four bytes
   51   
   52       return 4;
   53     }
   54   
   55     /**
   56      * Gets the cell reference as a string for this item
   57      *
   58      * @param buf the string buffer to populate
   59      */
   60     public void getString(StringBuffer buf)
   61     {
   62       buf.append(FormulaErrorCode.REF.getDescription());
   63     }
   64   
   65     /**
   66      * Gets the token representation of this item in RPN
   67      *
   68      * @return the bytes applicable to this formula
   69      */
   70     byte[] getBytes()
   71     {
   72       byte[] data = new byte[5];
   73       data[0] = Token.REFERR.getCode();
   74   
   75       // bytes 1-5 are unused
   76   
   77       return data;
   78     }
   79   
   80    /**
   81      * If this formula was on an imported sheet, check that
   82      * cell references to another sheet are warned appropriately
   83      * Does nothing
   84      */
   85     void handleImportedCellReferences()
   86     {
   87     }
   88   }

Home » JCraft » jxl » biff » formula » [javadoc | source]