poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jhei...@apache.org
Subject svn commit: r425402 - in /jakarta/poi/trunk/src/java/org/apache/poi/hssf/record: ./ aggregates/ formula/
Date Tue, 25 Jul 2006 14:30:35 GMT
Author: jheight
Date: Tue Jul 25 07:30:34 2006
New Revision: 425402

URL: http://svn.apache.org/viewvc?rev=425402&view=rev
Log:
SHARED FORMULA SUPPORT:

Implemented my long standing (but incomplete) patch attached to Bug 26502.

Now shared formula conversion is working. Tested against file attached to Bug 26502 and Bug 18311.

TestValueRecordAggregate fails with the patch at the moment, too tired to look at. Will do tomorrow.

Jason

Added:
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaAPtg.java
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaNAPtg.java
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaNPtg.java
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaNVPtg.java
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaVPtg.java
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefAPtg.java
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefNAPtg.java
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefNPtg.java
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefNVPtg.java
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefVPtg.java
Modified:
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/FormulaRecord.java
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaPtg.java
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/ExpPtg.java
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/Ptg.java
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/ReferencePtg.java

Modified: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/FormulaRecord.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/FormulaRecord.java?rev=425402&r1=425401&r2=425402&view=diff
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/FormulaRecord.java (original)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/FormulaRecord.java Tue Jul 25 07:30:34 2006
@@ -27,6 +27,8 @@
 import java.util.Stack;
 
 import org.apache.poi.hssf.record.formula.Ptg;
+import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
 import org.apache.poi.util.LittleEndian;
 
 /**
@@ -53,6 +55,9 @@
     private short             field_3_xf;
     private double            field_4_value;
     private short             field_5_options;
+    private BitField          alwaysCalc = BitFieldFactory.getInstance(0x0001);
+    private BitField          calcOnLoad = BitFieldFactory.getInstance(0x0002);
+    private BitField          sharedFormula = BitFieldFactory.getInstance(0x0008);    
     private int               field_6_zero;
     private short             field_7_expression_len;
     private Stack             field_8_parsed_expr;
@@ -191,7 +196,11 @@
     {
         return field_5_options;
     }
-
+    
+    public boolean isSharedFormula() {
+        return sharedFormula.isSet(field_5_options);
+    }
+    
     /**
      * get the length (in number of tokens) of the expression
      * @return  expression length
@@ -262,6 +271,10 @@
     {
         return field_8_parsed_expr;
     }
+    
+    public void setParsedExpression(Stack ptgs) {
+      field_8_parsed_expr = ptgs;
+    }
 
     /**
      * called by constructor, should throw runtime exception in the event of a
@@ -474,6 +487,12 @@
                   .append("\n");
             buffer.append("    .options         = ").append(getOptions())
                 .append("\n");
+            buffer.append("      .alwaysCalc         = ").append(alwaysCalc.isSet(getOptions()))
+                .append("\n");
+            buffer.append("      .calcOnLoad         = ").append(calcOnLoad.isSet(getOptions()))
+                .append("\n");
+            buffer.append("      .sharedFormula         = ").append(sharedFormula.isSet(getOptions()))
+                .append("\n");
             buffer.append("    .zero            = ").append(field_6_zero)
                 .append("\n");
             buffer.append("    .expressionlength= ").append(getExpressionLength())
@@ -485,9 +504,9 @@
             
 
                 for (int k = 0; k < field_8_parsed_expr.size(); k++ ) {
-                   buffer.append("Formula ")
+                   buffer.append("     Ptg(")
                         .append(k)
-                        .append("=")
+                        .append(")=")
                         .append(field_8_parsed_expr.get(k).toString())
                         .append("\n")
                         .append(((Ptg)field_8_parsed_expr.get(k)).toDebugString())

Modified: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java?rev=425402&r1=425401&r2=425402&view=diff
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java (original)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java Tue Jul 25 07:30:34 2006
@@ -18,6 +18,10 @@
 
 package org.apache.poi.hssf.record;
 
+import java.util.Stack;
+import java.util.List;
+
+import org.apache.poi.hssf.record.formula.*;
 import org.apache.poi.util.LittleEndian;
 
 /**
@@ -36,9 +40,14 @@
     extends Record
 {
 	 public final static short   sid = 0x4BC;
-    private short  size    = 0;
-    private byte[] thedata = null;
-    int             offset  = 0;
+    
+    private int               field_1_first_row;
+    private int               field_2_last_row;
+    private short             field_3_first_column;
+    private short             field_4_last_column;
+    private int               field_5_reserved;
+    private short             field_6_expression_len;
+    private Stack             field_7_parsed_expr;    
 
     public SharedFormulaRecord()
     {
@@ -55,6 +64,35 @@
     {
     	  super(in);
     }
+    
+    protected void validateSid(short id)
+    {
+		if (id != this.sid)
+		{
+			throw new RecordFormatException("Not a valid SharedFormula");
+		}        
+    }    
+    
+    public int getFirstRow() {
+      return field_1_first_row;
+    }
+
+    public int getLastRow() {
+      return field_2_last_row;
+    }
+
+    public short getFirstColumn() {
+      return field_3_first_column;
+    }
+
+    public short getLastColumn() {
+      return field_4_last_column;
+    }
+
+    public short getExpressionLength()
+    {
+        return field_6_expression_len;
+    }
 
     /**
      * spit the record out AS IS.  no interperatation or identification
@@ -62,38 +100,15 @@
 
     public int serialize(int offset, byte [] data)
     {
-        if (thedata == null)
-        {
-            thedata = new byte[ 0 ];
-        }
-        LittleEndian.putShort(data, 0 + offset, sid);
-        LittleEndian.putShort(data, 2 + offset, ( short ) (thedata.length));
-        if (thedata.length > 0)
-        {
-            System.arraycopy(thedata, 0, data, 4 + offset, thedata.length);
-        }
-        return getRecordSize();
+    	//Because this record is converted to individual Formula records, this method is not required.
+    	throw new UnsupportedOperationException("Cannot serialize a SharedFormulaRecord");
     }
 
     public int getRecordSize()
     {
-        int retval = 4;
+    	//Because this record is converted to individual Formula records, this method is not required.
+    	throw new UnsupportedOperationException("Cannot get the size for a SharedFormulaRecord");
 
-        if (thedata != null)
-        {
-            retval += thedata.length;
-        }
-        return retval;
-    }
-
-
-    protected void validateSid(short id)
-    {
-		if (id != this.sid)
-		{
-			throw new RecordFormatException("Not a valid SharedFormula");
-		}
-        
     }
 
     /**
@@ -107,6 +122,33 @@
         buffer.append("[SHARED FORMULA RECORD:" + Integer.toHexString(sid) + "]\n");
         buffer.append("    .id        = ").append(Integer.toHexString(sid))
             .append("\n");
+        buffer.append("    .first_row       = ")
+            .append(Integer.toHexString(getFirstRow())).append("\n");
+        buffer.append("    .last_row    = ")
+            .append(Integer.toHexString(getLastRow()))
+            .append("\n");
+        buffer.append("    .first_column       = ")
+            .append(Integer.toHexString(getFirstColumn())).append("\n");
+        buffer.append("    .last_column    = ")
+            .append(Integer.toHexString(getLastColumn()))
+            .append("\n");
+        buffer.append("    .reserved    = ")
+            .append(Integer.toHexString(field_5_reserved))
+            .append("\n");
+        buffer.append("    .expressionlength= ").append(getExpressionLength())
+            .append("\n");
+
+        buffer.append("    .numptgsinarray  = ").append(field_7_parsed_expr.size())
+              .append("\n");
+
+        for (int k = 0; k < field_7_parsed_expr.size(); k++ ) {
+           buffer.append("Formula ")
+                .append(k)
+                .append("\n")
+                .append(field_7_parsed_expr.get(k).toString())
+                .append("\n");
+        }
+        
         buffer.append("[/SHARED FORMULA RECORD]\n");
         return buffer.toString();
     }
@@ -121,7 +163,99 @@
 	  */
     protected void fillFields(RecordInputStream in)
     {
-      thedata = in.readRemainder();
+      field_1_first_row       = in.readShort();
+      field_2_last_row        = in.readShort();
+      field_3_first_column    = in.readByte();
+      field_4_last_column     = in.readByte();
+      field_5_reserved        = in.readShort();
+      field_6_expression_len = in.readShort();
+      field_7_parsed_expr    = getParsedExpressionTokens(in);
+    }
+
+    private Stack getParsedExpressionTokens(RecordInputStream in)
+    {
+        Stack stack = new Stack();
+        
+        while (in.remaining() != 0) {
+            Ptg ptg = Ptg.createPtg(in);
+            stack.push(ptg);
+        }
+        return stack;
+    }
+
+    public boolean isFormulaInShared(FormulaRecord formula) {
+      final int formulaRow = formula.getRow();
+      final int formulaColumn = formula.getColumn();
+      return ((getFirstRow() <= formulaRow) && (getLastRow() >= formulaRow) &&
+          (getFirstColumn() <= formulaColumn) && (getLastColumn() >= formulaColumn));
+    }
+
+    /** Creates a non shared formula from the shared formula counter part*/
+    public void convertSharedFormulaRecord(FormulaRecord formula) {
+      //Sanity checks
+      final int formulaRow = formula.getRow();
+      final int formulaColumn = formula.getColumn();
+      if (isFormulaInShared(formula)) {
+        formula.setExpressionLength(getExpressionLength());
+        Stack newPtgStack = new Stack();
+
+        for (int k = 0; k < field_7_parsed_expr.size(); k++) {
+          Ptg ptg = (Ptg) field_7_parsed_expr.get(k);
+          if (ptg instanceof RefNPtg) {
+            RefNPtg refNPtg = (RefNPtg)ptg;
+            ptg = new ReferencePtg( (short)(formulaRow + refNPtg.getRow()),
+                                    (byte)(formulaColumn + refNPtg.getColumn()),
+                                   refNPtg.isRowRelative(),
+                                   refNPtg.isColRelative());
+          } else if (ptg instanceof RefNVPtg) {
+            RefNVPtg refNVPtg = (RefNVPtg)ptg;
+            ptg = new RefVPtg( (short)(formulaRow + refNVPtg.getRow()),
+                               (byte)(formulaColumn + refNVPtg.getColumn()),
+                               refNVPtg.isRowRelative(),
+                               refNVPtg.isColRelative());
+          } else if (ptg instanceof RefNAPtg) {
+            RefNAPtg refNAPtg = (RefNAPtg)ptg;
+            ptg = new RefAPtg( (short)(formulaRow + refNAPtg.getRow()),
+                               (byte)(formulaColumn + refNAPtg.getColumn()),
+                               refNAPtg.isRowRelative(),
+                               refNAPtg.isColRelative());
+          } else if (ptg instanceof AreaNPtg) {
+            AreaNPtg areaNPtg = (AreaNPtg)ptg;
+            ptg = new AreaPtg((short)(formulaRow + areaNPtg.getFirstRow()),
+                              (short)(formulaRow + areaNPtg.getLastRow()),
+                              (short)(formulaColumn + areaNPtg.getFirstColumn()),
+                              (short)(formulaColumn + areaNPtg.getLastColumn()),
+                              areaNPtg.isFirstRowRelative(),
+                              areaNPtg.isLastRowRelative(),
+                              areaNPtg.isFirstColRelative(),
+                              areaNPtg.isLastColRelative());
+          } else if (ptg instanceof AreaNVPtg) {
+            AreaNVPtg areaNVPtg = (AreaNVPtg)ptg;
+            ptg = new AreaVPtg((short)(formulaRow + areaNVPtg.getFirstRow()),
+                              (short)(formulaRow + areaNVPtg.getLastRow()),
+                              (short)(formulaColumn + areaNVPtg.getFirstColumn()),
+                              (short)(formulaColumn + areaNVPtg.getLastColumn()),
+                              areaNVPtg.isFirstRowRelative(),
+                              areaNVPtg.isLastRowRelative(),
+                              areaNVPtg.isFirstColRelative(),
+                              areaNVPtg.isLastColRelative());
+          } else if (ptg instanceof AreaNAPtg) {
+            AreaNAPtg areaNAPtg = (AreaNAPtg)ptg;
+            ptg = new AreaAPtg((short)(formulaRow + areaNAPtg.getFirstRow()),
+                              (short)(formulaRow + areaNAPtg.getLastRow()),
+                              (short)(formulaColumn + areaNAPtg.getFirstColumn()),
+                              (short)(formulaColumn + areaNAPtg.getLastColumn()),
+                              areaNAPtg.isFirstRowRelative(),
+                              areaNAPtg.isLastRowRelative(),
+                              areaNAPtg.isFirstColRelative(),
+                              areaNAPtg.isLastColRelative());
+          }
+          newPtgStack.add(ptg);
+        }
+        formula.setParsedExpression(newPtgStack);
+      } else {
+        throw new RuntimeException("Shared Formula Conversion: Coding Error");
+      }
     }
 
 	/**
@@ -141,10 +275,7 @@
 	 }
 
     public Object clone() {
-      SharedFormulaRecord rec = new SharedFormulaRecord();
-      rec.offset = offset;      
-      rec.size = size;
-      rec.thedata = thedata;
-      return rec;
+    	//Because this record is converted to individual Formula records, this method is not required.
+    	throw new UnsupportedOperationException("Cannot clone a SharedFormulaRecord");
     }
 }

Modified: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java?rev=425402&r1=425401&r2=425402&view=diff
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java (original)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java Tue Jul 25 07:30:34 2006
@@ -125,6 +125,7 @@
         int k = 0;
 
         FormulaRecordAggregate lastFormulaAggregate = null;
+        SharedFormulaRecord lastSharedFormula = null;
 
         for (k = offset; k < records.size(); k++)
         {
@@ -136,6 +137,26 @@
             }
             if (rec instanceof FormulaRecord)
             {
+              FormulaRecord formula = (FormulaRecord)rec;
+              if (formula.isSharedFormula()) {
+                if ((lastSharedFormula != null) && (lastSharedFormula.isFormulaInShared(formula))) {
+                  //Convert this Formula Record from a shared formula to a real formula
+                  lastSharedFormula.convertSharedFormulaRecord(formula);
+                } else {
+                  Record nextRecord = (Record) records.get(k + 1);
+                  if (nextRecord instanceof SharedFormulaRecord) {
+                    k++;
+                    lastSharedFormula = (SharedFormulaRecord) nextRecord;
+
+                    //Convert this Formula Record from a shared formula to a real formula
+                    lastSharedFormula.convertSharedFormulaRecord(formula);
+                  }
+                  else
+                    throw new RuntimeException(
+                        "Shared formula bit set but next record is not a Shared Formula??");
+                }
+              }
+            	
                 lastFormulaAggregate = new FormulaRecordAggregate((FormulaRecord)rec, null);
                 insertCell( lastFormulaAggregate );
             }
@@ -143,11 +164,11 @@
             {
                 lastFormulaAggregate.setStringRecord((StringRecord)rec);
             }
-            else if (rec instanceof SharedFormulaRecord)
-            {
-            	//these follow the first formula in a group
-            	lastFormulaAggregate.setSharedFormulaRecord((SharedFormulaRecord)rec);
-            }
+            //else if (rec instanceof SharedFormulaRecord)
+            //{
+            //	//these follow the first formula in a group
+            //	lastFormulaAggregate.setSharedFormulaRecord((SharedFormulaRecord)rec);
+            //}
             else if (rec.isValue())
             {
                 insertCell(( CellValueRecordInterface ) rec);

Added: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaAPtg.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaAPtg.java?rev=425402&view=auto
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaAPtg.java (added)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaAPtg.java Tue Jul 25 07:30:34 2006
@@ -0,0 +1,107 @@
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2003 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ *    "Apache POI" must not be used to endorse or promote products
+ *    derived from this software without prior written permission. For
+ *    written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    "Apache POI", nor may "Apache" appear in their name, without
+ *    prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+/*
+ * AreaPtg.java
+ *
+ * Created on November 17, 2001, 9:30 PM
+ */
+package org.apache.poi.hssf.record.formula;
+
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.BitField;
+
+import org.apache.poi.hssf.record.RecordInputStream;
+import org.apache.poi.hssf.util.AreaReference;
+import org.apache.poi.hssf.util.CellReference;
+import org.apache.poi.hssf.model.Workbook;
+
+/**
+ * Specifies a rectangular area of cells A1:A4 for instance.
+ * @author Jason Height (jheight at chariot dot net dot au)
+ */
+
+public class AreaAPtg
+    extends AreaPtg
+{
+    public final static short sid  = 0x65;
+
+    protected AreaAPtg() {
+      //Required for clone methods
+    }
+
+    public AreaAPtg(short firstRow, short lastRow, short firstColumn, short lastColumn, boolean firstRowRelative, boolean lastRowRelative, boolean firstColRelative, boolean lastColRelative) {
+      super(firstRow, lastRow, firstColumn, lastColumn, firstRowRelative, lastRowRelative, firstColRelative, lastColRelative);
+    }
+
+    public AreaAPtg(RecordInputStream in)
+    {
+      super(in);
+    }
+
+    public String getAreaPtgName() {
+      return "AreaAPtg";
+    }
+
+    public Object clone() {
+      AreaAPtg ptg = new AreaAPtg();
+      ptg.setFirstRow(getFirstRow());
+      ptg.setLastRow(getLastRow());
+      ptg.setFirstColumnRaw(getFirstColumnRaw());
+      ptg.setLastColumnRaw(getLastColumnRaw());
+      ptg.setClass(ptgClass);
+      return ptg;
+    }
+}

Added: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaNAPtg.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaNAPtg.java?rev=425402&view=auto
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaNAPtg.java (added)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaNAPtg.java Tue Jul 25 07:30:34 2006
@@ -0,0 +1,106 @@
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2003 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ *    "Apache POI" must not be used to endorse or promote products
+ *    derived from this software without prior written permission. For
+ *    written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    "Apache POI", nor may "Apache" appear in their name, without
+ *    prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+/*
+ * AreaPtg.java
+ *
+ * Created on November 17, 2001, 9:30 PM
+ */
+package org.apache.poi.hssf.record.formula;
+
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.BitField;
+
+import org.apache.poi.hssf.record.RecordInputStream;
+import org.apache.poi.hssf.util.AreaReference;
+import org.apache.poi.hssf.util.CellReference;
+import org.apache.poi.hssf.model.Workbook;
+
+/**
+ * Specifies a rectangular area of cells A1:A4 for instance.
+ * @author Jason Height (jheight at chariot dot net dot au)
+ */
+
+public class AreaNAPtg
+    extends AreaPtg
+{
+    public final static short sid  = 0x6D;
+
+    protected AreaNAPtg() {
+      //Required for clone methods
+    }
+
+    public AreaNAPtg(RecordInputStream in)
+    {
+      super(in);
+    }
+
+    public void writeBytes(byte [] array, int offset) {
+      throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted");
+    }
+
+    public String getAreaPtgName() {
+      return "AreaNAPtg";
+    }
+
+    public String toFormulaString(Workbook book)
+    {
+      throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted");
+    }
+
+    public Object clone() {
+      throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted");
+    }
+}

Added: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaNPtg.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaNPtg.java?rev=425402&view=auto
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaNPtg.java (added)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaNPtg.java Tue Jul 25 07:30:34 2006
@@ -0,0 +1,106 @@
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2003 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ *    "Apache POI" must not be used to endorse or promote products
+ *    derived from this software without prior written permission. For
+ *    written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    "Apache POI", nor may "Apache" appear in their name, without
+ *    prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+/*
+ * AreaPtg.java
+ *
+ * Created on November 17, 2001, 9:30 PM
+ */
+package org.apache.poi.hssf.record.formula;
+
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.BitField;
+
+import org.apache.poi.hssf.record.RecordInputStream;
+import org.apache.poi.hssf.util.AreaReference;
+import org.apache.poi.hssf.util.CellReference;
+import org.apache.poi.hssf.model.Workbook;
+
+/**
+ * Specifies a rectangular area of cells A1:A4 for instance.
+ * @author Jason Height (jheight at chariot dot net dot au)
+ */
+
+public class AreaNPtg
+    extends AreaPtg
+{
+  public final static short sid  = 0x2D;
+
+  protected AreaNPtg() {
+    //Required for clone methods
+  }
+
+  public AreaNPtg(RecordInputStream in)
+  {
+    super(in);
+  }
+
+  public void writeBytes(byte [] array, int offset) {
+    throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted");
+  }
+
+  public String getAreaPtgName() {
+    return "AreaNPtg";
+  }
+
+  public String toFormulaString(Workbook book)
+  {
+    throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted");
+  }
+
+  public Object clone() {
+    throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted");
+  }
+}

Added: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaNVPtg.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaNVPtg.java?rev=425402&view=auto
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaNVPtg.java (added)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaNVPtg.java Tue Jul 25 07:30:34 2006
@@ -0,0 +1,107 @@
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2003 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ *    "Apache POI" must not be used to endorse or promote products
+ *    derived from this software without prior written permission. For
+ *    written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    "Apache POI", nor may "Apache" appear in their name, without
+ *    prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+/*
+ * AreaPtg.java
+ *
+ * Created on November 17, 2001, 9:30 PM
+ */
+package org.apache.poi.hssf.record.formula;
+
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.BitField;
+
+import org.apache.poi.hssf.record.RecordInputStream;
+import org.apache.poi.hssf.util.AreaReference;
+import org.apache.poi.hssf.util.CellReference;
+import org.apache.poi.hssf.model.Workbook;
+
+/**
+ * Specifies a rectangular area of cells A1:A4 for instance.
+ * @author  andy
+ * @author Jason Height (jheight at chariot dot net dot au)
+ */
+
+public class AreaNVPtg
+    extends AreaPtg
+{
+  public final static short sid  = 0x4D;
+
+  protected AreaNVPtg() {
+    //Required for clone methods
+  }
+
+  public AreaNVPtg(RecordInputStream in)
+  {
+    super(in);
+  }
+
+  public void writeBytes(byte [] array, int offset) {
+    throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted");
+  }
+
+  public String getAreaPtgName() {
+    return "AreaNVPtg";
+  }
+
+  public String toFormulaString(Workbook book)
+  {
+    throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted");
+  }
+
+  public Object clone() {
+    throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted");
+  }
+}

Modified: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaPtg.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaPtg.java?rev=425402&r1=425401&r2=425402&view=diff
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaPtg.java (original)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaPtg.java Tue Jul 25 07:30:34 2006
@@ -46,7 +46,7 @@
     private BitField         colRelative = BitFieldFactory.getInstance(0x4000);
     private BitField         column      = BitFieldFactory.getInstance(0x3FFF);
 
-    private AreaPtg() {
+    protected AreaPtg() {
       //Required for clone methods
     }
    
@@ -59,9 +59,19 @@
         setFirstColRelative(!ar.getCells()[0].isColAbsolute());
         setLastColRelative(!ar.getCells()[1].isColAbsolute());
         setFirstRowRelative(!ar.getCells()[0].isRowAbsolute());
-        setLastRowRelative(!ar.getCells()[1].isRowAbsolute());
-        
+        setLastRowRelative(!ar.getCells()[1].isRowAbsolute());        
     }
+    
+    public AreaPtg(short firstRow, short lastRow, short firstColumn, short lastColumn, boolean firstRowRelative, boolean lastRowRelative, boolean firstColRelative, boolean lastColRelative) {
+      setFirstRow(firstRow);
+      setLastRow(lastRow);
+      setFirstColumn(firstColumn);
+      setLastColumn(lastColumn);
+      setFirstRowRelative(firstRowRelative);
+      setLastRowRelative(lastRowRelative);
+      setFirstColRelative(firstColRelative);
+      setLastColRelative(lastColRelative);
+    }    
 
     public AreaPtg(RecordInputStream in)
     {
@@ -71,12 +81,17 @@
         field_4_last_column  = in.readShort();
         //System.out.println(toString());
     }
+    
+    public String getAreaPtgName() {
+      return "AreaPtg";
+    }    
 
     public String toString()
     {
         StringBuffer buffer = new StringBuffer();
 
-        buffer.append("AreaPtg\n");
+        buffer.append(getAreaPtgName());
+        buffer.append("\n");
         buffer.append("firstRow = " + getFirstRow()).append("\n");
         buffer.append("lastRow  = " + getLastRow()).append("\n");
         buffer.append("firstCol = " + getFirstColumn()).append("\n");

Added: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaVPtg.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaVPtg.java?rev=425402&view=auto
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaVPtg.java (added)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaVPtg.java Tue Jul 25 07:30:34 2006
@@ -0,0 +1,108 @@
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2003 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ *    "Apache POI" must not be used to endorse or promote products
+ *    derived from this software without prior written permission. For
+ *    written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    "Apache POI", nor may "Apache" appear in their name, without
+ *    prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+/*
+ * AreaPtg.java
+ *
+ * Created on November 17, 2001, 9:30 PM
+ */
+package org.apache.poi.hssf.record.formula;
+
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.BitField;
+
+import org.apache.poi.hssf.record.RecordInputStream;
+import org.apache.poi.hssf.util.AreaReference;
+import org.apache.poi.hssf.util.CellReference;
+import org.apache.poi.hssf.model.Workbook;
+
+/**
+ * Specifies a rectangular area of cells A1:A4 for instance.
+ * @author Jason Height (jheight at chariot dot net dot au)
+ */
+
+public class AreaVPtg
+    extends AreaPtg
+{
+    public final static short sid  = 0x45;
+
+    protected AreaVPtg() {
+      //Required for clone methods
+    }
+
+    public AreaVPtg(short firstRow, short lastRow, short firstColumn, short lastColumn, boolean firstRowRelative, boolean lastRowRelative, boolean firstColRelative, boolean lastColRelative) {
+      super(firstRow, lastRow, firstColumn, lastColumn, firstRowRelative, lastRowRelative, firstColRelative, lastColRelative);
+    }
+
+
+    public AreaVPtg(RecordInputStream in)
+    {
+      super(in);
+    }
+
+    public String getAreaPtgName() {
+      return "AreaVPtg";
+    }
+
+    public Object clone() {
+      AreaVPtg ptg = new AreaVPtg();
+      ptg.setFirstRow(getFirstRow());
+      ptg.setLastRow(getLastRow());
+      ptg.setFirstColumnRaw(getFirstColumnRaw());
+      ptg.setLastColumnRaw(getLastColumnRaw());
+      ptg.setClass(ptgClass);
+      return ptg;
+    }
+}

Modified: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/ExpPtg.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/ExpPtg.java?rev=425402&r1=425401&r2=425402&view=diff
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/ExpPtg.java (original)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/ExpPtg.java Tue Jul 25 07:30:34 2006
@@ -62,11 +62,27 @@
     {
         return SIZE;
     }
+    
+    public short getRow() {
+      return field_1_first_row;
+    }
+
+    public short getColumn() {
+      return field_2_first_col;
+    }    
 
     public String toFormulaString(Workbook book)
     {
         return "NO IDEA SHARED FORMULA EXP PTG";
     }
+    
+    public String toString()
+    {
+        StringBuffer buffer = new StringBuffer("[Array Formula or Shared Formula]\n");
+        buffer.append("row = ").append(getRow()).append("\n");
+        buffer.append("col = ").append(getColumn()).append("\n");
+        return buffer.toString();
+    }    
     
     public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
     

Modified: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/Ptg.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/Ptg.java?rev=425402&r1=425401&r2=425402&view=diff
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/Ptg.java (original)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/Ptg.java Tue Jul 25 07:30:34 2006
@@ -112,19 +112,15 @@
         return stack;
     }
     
-    private static Ptg createPtg(RecordInputStream in)
+    public static Ptg createPtg(RecordInputStream in)
     {
         byte id     = in.readByte();
         Ptg  retval = null;
 
-        final byte valueRef = ReferencePtg.sid + 0x20;
-        final byte arrayRef = ReferencePtg.sid + 0x40;
         final byte valueFunc = FuncPtg.sid + 0x20;
         final byte arrayFunc = FuncPtg.sid + 0x40;
         final byte valueFuncVar = FuncVarPtg.sid +0x20;
         final byte arrayFuncVar = FuncVarPtg.sid+0x40;
-        final byte valueArea = AreaPtg.sid + 0x20;
-        final byte arrayArea = AreaPtg.sid + 0x40;
 
         switch (id)
         {
@@ -197,12 +193,22 @@
             case AreaPtg.sid :
                 retval = new AreaPtg(in);
                 break;
-            case valueArea:
-                retval = new AreaPtg(in);
+            case AreaAPtg.sid:
+                retval = new AreaAPtg(in);
                 break;
-            case arrayArea:
-                retval = new AreaPtg(in);
+            case AreaVPtg.sid:
+                retval = new AreaVPtg(in);
+                break;
+            case AreaNAPtg.sid :
+                retval = new AreaNAPtg(in);
+                 break;
+            case AreaNPtg.sid :
+                retval = new AreaNPtg(in);
                 break;
+            case AreaNVPtg.sid :
+               retval = new AreaNVPtg(in);
+               break;
+                
             case MemErrPtg.sid :        // 0x27       These 3 values 
             case MemErrPtg.sid+0x20 :   // 0x47       documented in 
             case MemErrPtg.sid+0x40 :   // 0x67       openOffice.org doc.
@@ -216,12 +222,21 @@
             case ReferencePtg.sid :
                 retval = new ReferencePtg(in);
                 break;   
-            case valueRef :
-                retval = new ReferencePtg(in);
+            case RefAPtg.sid :
+                retval = new RefAPtg(in);
                 break;   
-            case arrayRef :
-                retval = new ReferencePtg(in);
+            case RefVPtg.sid :
+                retval = new RefVPtg(in);
                 break;   
+            case RefNAPtg.sid :
+                retval = new RefNAPtg(in);
+                break;
+            case RefNPtg.sid :
+                retval = new RefNPtg(in);
+                break;
+            case RefNVPtg.sid :
+                retval = new RefNVPtg(in);
+                break;                   
             case RefErrorPtg.sid:
                 retval = new RefErrorPtg(in);
                 break;   

Added: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefAPtg.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefAPtg.java?rev=425402&view=auto
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefAPtg.java (added)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefAPtg.java Tue Jul 25 07:30:34 2006
@@ -0,0 +1,104 @@
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2003 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ *    "Apache POI" must not be used to endorse or promote products
+ *    derived from this software without prior written permission. For
+ *    written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    "Apache POI", nor may "Apache" appear in their name, without
+ *    prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+/*
+ * ValueReferencePtg.java
+ *
+ * Created on November 21, 2001, 5:27 PM
+ */
+package org.apache.poi.hssf.record.formula;
+
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.BitField;
+
+import org.apache.poi.hssf.record.RecordInputStream;
+import org.apache.poi.hssf.util.CellReference;
+import org.apache.poi.hssf.model.Workbook;
+
+/**
+ * RefNAPtg
+ * @author Jason Height (jheight at chariot dot net dot au)
+ */
+
+public class RefAPtg extends ReferencePtg
+{
+    public final static byte sid  = 0x64;
+
+    protected RefAPtg() {
+      super();
+    }
+
+    public RefAPtg(short row, short column, boolean isRowRelative, boolean isColumnRelative) {
+      super(row, column, isRowRelative, isColumnRelative);
+    }
+
+    public RefAPtg(RecordInputStream in)
+    {
+      super(in);
+    }
+
+
+    public String getRefPtgName() {
+      return "RefAPtg";
+    }
+
+    public Object clone() {
+      RefAPtg ptg = new RefAPtg();
+      ptg.setRow(getRow());
+      ptg.setColumnRaw(getColumnRaw());
+      ptg.setClass(ptgClass);
+      return ptg;
+    }
+}

Added: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefNAPtg.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefNAPtg.java?rev=425402&view=auto
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefNAPtg.java (added)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefNAPtg.java Tue Jul 25 07:30:34 2006
@@ -0,0 +1,105 @@
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2003 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ *    "Apache POI" must not be used to endorse or promote products
+ *    derived from this software without prior written permission. For
+ *    written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    "Apache POI", nor may "Apache" appear in their name, without
+ *    prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+/*
+ * ValueReferencePtg.java
+ *
+ * Created on November 21, 2001, 5:27 PM
+ */
+package org.apache.poi.hssf.record.formula;
+
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.BitField;
+
+import org.apache.poi.hssf.record.RecordInputStream;
+import org.apache.poi.hssf.util.CellReference;
+import org.apache.poi.hssf.model.Workbook;
+
+/**
+ * RefNAPtg
+ * @author Jason Height (jheight at chariot dot net dot au)
+ */
+
+public class RefNAPtg extends ReferencePtg
+{
+    public final static byte sid  = 0x6C;
+
+    protected RefNAPtg() {
+      //Required for clone methods
+    }
+
+    public RefNAPtg(RecordInputStream in)
+    {
+      super(in);
+    }
+
+    public void writeBytes(byte [] array, int offset)
+    {
+      throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted");
+    }
+
+    public String getRefPtgName() {
+      return "RefNAPtg";
+    }
+
+    public String toFormulaString(Workbook book)
+    {
+      throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted");
+    }
+
+    public Object clone() {
+      throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted");
+    }
+}

Added: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefNPtg.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefNPtg.java?rev=425402&view=auto
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefNPtg.java (added)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefNPtg.java Tue Jul 25 07:30:34 2006
@@ -0,0 +1,106 @@
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2003 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ *    "Apache POI" must not be used to endorse or promote products
+ *    derived from this software without prior written permission. For
+ *    written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    "Apache POI", nor may "Apache" appear in their name, without
+ *    prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+/*
+ * RefNPtg.java
+ *
+ */
+package org.apache.poi.hssf.record.formula;
+
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.BitField;
+
+import org.apache.poi.hssf.record.RecordInputStream;
+import org.apache.poi.hssf.util.CellReference;
+import org.apache.poi.hssf.model.Workbook;
+
+/**
+ * RefNPtg
+ * @author Jason Height (jheight at apache dot com)
+ */
+
+public class RefNPtg extends ReferencePtg
+{
+    public final static byte sid  = 0x2C;
+
+    protected RefNPtg() {
+      //Required for clone methods
+    }
+
+    /** Creates new ValueReferencePtg */
+
+    public RefNPtg(RecordInputStream in)
+    {
+      super(in);
+    }
+
+    public void writeBytes(byte [] array, int offset)
+    {
+      throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted");
+    }
+
+    public String getRefPtgName() {
+      return "RefNPtg";
+    }
+
+    public String toFormulaString(Workbook book)
+    {
+      throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted");
+    }
+
+    public Object clone() {
+      throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted");
+    }
+}

Added: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefNVPtg.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefNVPtg.java?rev=425402&view=auto
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefNVPtg.java (added)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefNVPtg.java Tue Jul 25 07:30:34 2006
@@ -0,0 +1,102 @@
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2003 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ *    "Apache POI" must not be used to endorse or promote products
+ *    derived from this software without prior written permission. For
+ *    written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    "Apache POI", nor may "Apache" appear in their name, without
+ *    prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+package org.apache.poi.hssf.record.formula;
+
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.BitField;
+
+import org.apache.poi.hssf.record.RecordInputStream;
+import org.apache.poi.hssf.util.CellReference;
+import org.apache.poi.hssf.model.Workbook;
+
+/**
+ * RefNVPtg
+ * @author Jason Height (jheight at chariot dot net dot au)
+ */
+
+public class RefNVPtg extends ReferencePtg
+{
+  public final static byte sid  = 0x4C;
+
+  protected RefNVPtg() {
+    //Required for clone methods
+  }
+
+  /** Creates new ValueReferencePtg */
+
+  public RefNVPtg(RecordInputStream in)
+  {
+    super(in);
+  }
+
+  public void writeBytes(byte [] array, int offset)
+  {
+    throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted");
+  }
+
+  public String getRefPtgName() {
+    return "RefNVPtg";
+  }
+
+  public String toFormulaString(Workbook book)
+  {
+    throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted");
+  }
+
+  public Object clone() {
+    throw new RuntimeException("Coding Error: This method should never be called. This ptg should be converted");
+  }
+}

Added: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefVPtg.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefVPtg.java?rev=425402&view=auto
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefVPtg.java (added)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/RefVPtg.java Tue Jul 25 07:30:34 2006
@@ -0,0 +1,101 @@
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2003 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ *    "Apache POI" must not be used to endorse or promote products
+ *    derived from this software without prior written permission. For
+ *    written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    "Apache POI", nor may "Apache" appear in their name, without
+ *    prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+package org.apache.poi.hssf.record.formula;
+
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.BitField;
+
+import org.apache.poi.hssf.record.RecordInputStream;
+import org.apache.poi.hssf.util.CellReference;
+import org.apache.poi.hssf.model.Workbook;
+
+/**
+ * RefVPtg
+ * @author Jason Height (jheight at chariot dot net dot au)
+ */
+
+public class RefVPtg extends ReferencePtg
+{
+  public final static byte sid  = 0x44;
+
+  protected RefVPtg() {
+    super();
+  }
+
+  public RefVPtg(short row, short column, boolean isRowRelative, boolean isColumnRelative) {
+    super(row, column, isRowRelative, isColumnRelative);
+  }
+
+
+  /** Creates new ValueReferencePtg */
+
+  public RefVPtg(RecordInputStream in)
+  {
+    super(in);
+  }
+
+  public String getRefPtgName() {
+    return "RefVPtg";
+  }
+
+  public Object clone() {
+    RefVPtg ptg = new RefVPtg();
+    ptg.setRow(getRow());
+    ptg.setColumnRaw(getColumnRaw());
+    ptg.setClass(ptgClass);
+    return ptg;
+  }
+}

Modified: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/ReferencePtg.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/ReferencePtg.java?rev=425402&r1=425401&r2=425402&view=diff
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/ReferencePtg.java (original)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/ReferencePtg.java Tue Jul 25 07:30:34 2006
@@ -39,8 +39,9 @@
     private short            field_2_col;
     private BitField         rowRelative = BitFieldFactory.getInstance(0x8000);
     private BitField         colRelative = BitFieldFactory.getInstance(0x4000);
+    private BitField         column      = BitFieldFactory.getInstance(0x3FFF);
 
-    private ReferencePtg() {
+    protected ReferencePtg() {
       //Required for clone methods
     }
     
@@ -55,6 +56,13 @@
         setColRelative(!c.isColAbsolute());
         setRowRelative(!c.isRowAbsolute());
     }
+    
+    public ReferencePtg(short row, short column, boolean isRowRelative, boolean isColumnRelative) {
+      setRow(row);
+      setColumn(column);
+      setRowRelative(isRowRelative);
+      setColRelative(isColumnRelative);
+    }    
 
     /** Creates new ValueReferencePtg */
 
@@ -62,15 +70,20 @@
     {
         field_1_row = in.readShort();
         field_2_col = in.readShort();
-
     }
+    
+    public String getRefPtgName() {
+      return "ReferencePtg";
+    }    
 
     public String toString()
     {
-        StringBuffer buffer = new StringBuffer("[ValueReferencePtg]\n");
+        StringBuffer buffer = new StringBuffer("[");
+        buffer.append(getRefPtgName());
+        buffer.append("]\n");
 
         buffer.append("row = ").append(getRow()).append("\n");
-        buffer.append("col = ").append(getColumnRaw()).append("\n");
+        buffer.append("col = ").append(getColumn()).append("\n");
         buffer.append("rowrelative = ").append(isRowRelative()).append("\n");
         buffer.append("colrelative = ").append(isColRelative()).append("\n");
         return buffer.toString();
@@ -123,12 +136,12 @@
 
     public void setColumn(short col)
     {
-        field_2_col = col;   // fix this
+    	field_2_col = column.setShortValue(field_2_col, col);
     }
 
     public short getColumn()
     {
-        return rowRelative.setShortBoolean(colRelative.setShortBoolean(field_2_col,false),false);
+    	return column.getShortValue(field_2_col);
     }
 
     public int getSize()



---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


Mime
View raw message