]> source.dussan.org Git - poi.git/commitdiff
Bug id 21027
authorAvik Sengupta <avik@apache.org>
Tue, 1 Jul 2003 14:47:34 +0000 (14:47 +0000)
committerAvik Sengupta <avik@apache.org>
Tue, 1 Jul 2003 14:47:34 +0000 (14:47 +0000)
Patch to fix misc clone issues, submitted by Nial Pemberton .. thanks!

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/branches/REL_2_BRANCH@353182 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/record/ContinueRecord.java
src/java/org/apache/poi/hssf/record/FormulaRecord.java
src/java/org/apache/poi/hssf/record/PasswordRecord.java
src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java
src/java/org/apache/poi/hssf/record/formula/AreaPtg.java
src/java/org/apache/poi/hssf/record/formula/FuncPtg.java
src/java/org/apache/poi/hssf/record/formula/FuncVarPtg.java
src/java/org/apache/poi/hssf/record/formula/NamePtg.java
src/java/org/apache/poi/hssf/record/formula/NameXPtg.java
src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java
src/java/org/apache/poi/hssf/record/formula/ReferencePtg.java

index dbe00e52eb19f9ce6ca7fed796bbf4059e736769..8d7eee7f72f1bc5f6430b9153284bd3eaa740b6b 100644 (file)
@@ -267,4 +267,14 @@ public class ContinueRecord
     protected void fillFields(byte [] ignored_parm1, short ignored_parm2, int ignored_parm3)
     {
     }
+
+    /**
+     * Clone this record.
+     */
+    public Object clone() {
+      ContinueRecord clone = new ContinueRecord();
+      clone.setData(field_1_data);
+      return clone;
+    }
+
 }
index c1ed74a9d54cf5bff15c37f2a52c8a9044da2843..050558739b60b3301c0885e19e941636a7902026 100644 (file)
@@ -557,8 +557,13 @@ public class FormulaRecord
                 .append("\n");
             buffer.append("    .xf              = ")
                 .append(Integer.toHexString(getXFIndex())).append("\n");
-            buffer.append("    .value           = ").append(getValue())
-                .append("\n");
+            if (Double.isNaN(this.getValue()) && value_data != null)
+              buffer.append("    .value (NaN)     = ")
+                  .append(org.apache.poi.util.HexDump.dump(value_data,0,0))
+                  .append("\n");
+            else
+              buffer.append("    .value           = ").append(getValue())
+                  .append("\n");
             buffer.append("    .options         = ").append(getOptions())
                 .append("\n");
             buffer.append("    .zero            = ").append(field_6_zero)
@@ -610,6 +615,7 @@ public class FormulaRecord
         Ptg ptg = (Ptg)((Ptg)field_8_parsed_expr.get(i)).clone();        
         rec.field_8_parsed_expr.add(i, ptg);
       }
+      rec.value_data = value_data;
       rec.all_data = all_data;
       return rec;
     }
index 9feb6a2cbdd79500fc42b8e19c478331ed5e4a85..ba9cbfc5f0882c4e325208f2ee43cd8ac70f85ff 100644 (file)
@@ -166,4 +166,14 @@ public class PasswordRecord
     {
         return this.sid;
     }
+
+    /**
+     * Clone this record.
+     */
+    public Object clone() {
+      PasswordRecord clone = new PasswordRecord();
+      clone.setPassword(field_1_password);
+      return clone;
+    }
+
 }
index 1e425669dbd8faaecb9ece8facd80932b48c216e..311ba893992bab55b035d8e75922c99a569d248d 100644 (file)
@@ -318,6 +318,7 @@ public class Area3DPtg extends Ptg
                ptg.field_3_last_row = field_3_last_row;
                ptg.field_4_first_column = field_4_first_column;
                ptg.field_5_last_column = field_5_last_column;
+            ptg.setClass(ptgClass);
                return ptg;
        }
 
index 87ebb2c7692eae2c64813d545e6c96dde8fdaec4..4f994151d60691bb4f98f47212d83943a290b1f2 100644 (file)
@@ -321,6 +321,7 @@ public class AreaPtg
       ptg.field_2_last_row = field_2_last_row;
       ptg.field_3_first_column = field_3_first_column;
       ptg.field_4_last_column = field_4_last_column;
+      ptg.setClass(ptgClass);
       return ptg;
     }
 
index 1c230c95a4220d5b2f79a7af944675259fbd475a..713d200b2d4fbab6340622dd78228ba1951f3774 100644 (file)
@@ -63,7 +63,8 @@ public class FuncPtg extends AbstractFunctionPtg{
       FuncPtg ptg = new FuncPtg();
       //ptg.field_1_num_args = field_1_num_args;
       ptg.field_2_fnc_index = field_2_fnc_index;
-      return ptg;
+      ptg.setClass(ptgClass);
+     return ptg;
     }
     
     public int getSize() {
index f333ba694e3cd3d3dc4044d8e879783e59782a4d..6bf4d7f540a82e1a6c69b852a61a006ca9ef9157 100644 (file)
@@ -52,6 +52,7 @@ public class FuncVarPtg extends AbstractFunctionPtg{
       FuncVarPtg ptg = new FuncVarPtg();
       ptg.field_1_num_args = field_1_num_args;
       ptg.field_2_fnc_index = field_2_fnc_index;
+      ptg.setClass(ptgClass);
       return ptg;
     }
     
index c926d511a1f607e3f5c890e4ae11b441c0ee4138..57c6dccb5964047a634ef33faaf45262aa6069cf 100644 (file)
@@ -121,6 +121,7 @@ public class NamePtg
       ptg.field_1_ixti = field_1_ixti;
       ptg.field_2_label_index = field_2_label_index;
       ptg.field_3_zero = field_3_zero;
+      ptg.setClass(ptgClass);
       return ptg;
     }
 }
index b913f438a482f160c89b0b72d154ecee536540ed..58fa096866d83e203b9c9f71f79959883f1621c5 100644 (file)
@@ -102,7 +102,7 @@ public class NameXPtg extends Ptg
 
     public void writeBytes(byte [] array, int offset)
     {
-        array[ offset + 0 ] = sid;
+        array[ offset + 0 ] = (byte)(sid + ptgClass);
         LittleEndian.putShort(array, offset + 1, field_1_ixals);
         LittleEndian.putShort(array,offset+3, field_2_ilbl);
         LittleEndian.putShort(array, offset + 5, field_3_reserved);
@@ -125,6 +125,7 @@ public class NameXPtg extends Ptg
       ptg.field_1_ixals = field_1_ixals;
       ptg.field_3_reserved = field_3_reserved;
       ptg.field_2_ilbl = field_2_ilbl;
+      ptg.setClass(ptgClass);
       return ptg;
     }
 }
index a330c1bc024eac14780a6b364def3b9cce729041..13ae2ef238d5a8e9f3af5fd971a072a8aea629cb 100644 (file)
@@ -210,6 +210,7 @@ public class Ref3DPtg extends Ptg {
      ptg.field_1_index_extern_sheet = field_1_index_extern_sheet;
      ptg.field_2_row = field_2_row;
      ptg.field_3_column = field_3_column;
+     ptg.setClass(ptgClass);
      return ptg;
    }
 
index 90f7d899c8b7c1e7d5874d817455354e56ba3ae1..2ec380a4adede0ab24fe13c4bba5019d67aab307 100644 (file)
@@ -193,6 +193,7 @@ public class ReferencePtg extends Ptg
       ReferencePtg ptg = new ReferencePtg();
       ptg.field_1_row = field_1_row;
       ptg.field_2_col = field_2_col;
+      ptg.setClass(ptgClass);
       return ptg;
     }
 }