]> source.dussan.org Git - poi.git/commitdiff
Patch from Josh from bug #44510 - Fix how DVALRecord works with dropdowns
authorNick Burch <nick@apache.org>
Mon, 3 Mar 2008 16:09:02 +0000 (16:09 +0000)
committerNick Burch <nick@apache.org>
Mon, 3 Mar 2008 16:09:02 +0000 (16:09 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@633151 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/changes.xml
src/documentation/content/xdocs/status.xml
src/java/org/apache/poi/hssf/record/DVALRecord.java
src/testcases/org/apache/poi/hssf/record/TestDVALRecord.java [new file with mode: 0755]

index d85e3a3a71bb6631e6f2292845e4571ebff53188..23143a1bde795a6bfce1e1a5d6fad126b6d5276c 100644 (file)
@@ -36,6 +36,7 @@
 
                <!-- Don't forget to update status.xml too! -->
         <release version="3.1-beta1" date="2008-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">44510 - Fix how DVALRecord works with dropdowns</action>
            <action dev="POI-DEVELOPERS" type="fix">44495 - Handle named cell ranges in formulas that have lower case parts</action>
            <action dev="POI-DEVELOPERS" type="fix">44491 - Don't have the new-style "HPSF properties are always available" affect the old-style use of HPSF alongside HSSF</action>
            <action dev="POI-DEVELOPERS" type="fix">44471 - Crystal Reports generates files with short StyleRecords, which isn't allowed in the spec. Work around this</action>
index 4b836f6a9645cbe282b17442e6deb59b923c080c..ae32a1cc7a301fb1c635f7af099fa25b8fdceac6 100644 (file)
@@ -33,6 +33,9 @@
        <!-- Don't forget to update changes.xml too! -->
     <changes>
         <release version="3.1-beta1" date="2008-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">44495 - Handle named cell ranges in formulas that have lower case parts</action>
+           <action dev="POI-DEVELOPERS" type="fix">44491 - Don't have the new-style "HPSF properties are always available" affect the old-style use of HPSF alongside HSSF</action>
+           <action dev="POI-DEVELOPERS" type="fix">44471 - Crystal Reports generates files with short StyleRecords, which isn't allowed in the spec. Work around this</action>
            <action dev="POI-DEVELOPERS" type="fix">44495 - Handle named cell ranges in formulas that have lower case parts</action>
            <action dev="POI-DEVELOPERS" type="fix">44491 - Don't have the new-style "HPSF properties are always available" affect the old-style use of HPSF alongside HSSF</action>
            <action dev="POI-DEVELOPERS" type="fix">44471 - Crystal Reports generates files with short StyleRecords, which isn't allowed in the spec. Work around this</action>
index 2846f5066c3b93df9ab2d904d6cbb19f04ad9abc..011c0a435557efab9fc1ae33deb473f4ab3556a8 100644 (file)
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Copyright 2002-2004   Apache Software Foundation
 
@@ -20,13 +19,11 @@ package org.apache.poi.hssf.record;
 import org.apache.poi.util.LittleEndian;
 
 /**
- * Title:        DVAL Record<P>
+ * Title:        DATAVALIDATIONS Record<P>
  * Description:  used in data validation ;
- *               This record is the list header of all data validation records in the current sheet.
+ *               This record is the list header of all data validation records (0x01BE) in the current sheet.
  * @author Dragos Buleandra (dragos.buleandra@trade2b.ro)
- * @version 2.0-pre
  */
-
 public class DVALRecord extends Record
 {
        public final static short sid = 0x01B2;
@@ -41,13 +38,14 @@ public class DVALRecord extends Record
        /** Object ID of the drop down arrow object for list boxes ;
         * in our case this will be always FFFF , until
         * MSODrawingGroup and MSODrawing records are implemented */
-       private int  field_cbo_id      = 0xFFFFFFFF;
+       private int  field_cbo_id;
 
        /** Number of following DV Records */
-       private int  field_5_dv_no     = 0x00000000;
+       private int  field_5_dv_no;
 
-    public DVALRecord()
-    {
+    public DVALRecord() {
+        field_cbo_id = 0xFFFFFFFF;
+        field_5_dv_no = 0x00000000;
     }
 
     /**
diff --git a/src/testcases/org/apache/poi/hssf/record/TestDVALRecord.java b/src/testcases/org/apache/poi/hssf/record/TestDVALRecord.java
new file mode 100755 (executable)
index 0000000..bcfb766
--- /dev/null
@@ -0,0 +1,55 @@
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
+package org.apache.poi.hssf.record;
+
+import java.io.ByteArrayInputStream;
+
+import org.apache.poi.util.LittleEndian;
+
+import junit.framework.TestCase;
+
+/**
+ * 
+ * @author Josh Micich
+ */
+public final class TestDVALRecord extends TestCase {
+    public void testRead() {
+        
+        byte[] data = new byte[22];
+        LittleEndian.putShort(data, 0, DVALRecord.sid);
+        LittleEndian.putShort(data, 2, (short)18);
+        LittleEndian.putShort(data, 4, (short)55);
+        LittleEndian.putInt(data, 6, 56);
+        LittleEndian.putInt(data, 10, 57);
+        LittleEndian.putInt(data, 14, 58);
+        LittleEndian.putInt(data, 18, 59);
+       
+        RecordInputStream in = new RecordInputStream(new ByteArrayInputStream(data));
+        in.nextRecord();
+        DVALRecord dv = new DVALRecord(in);
+        
+        assertEquals(55, dv.getOptions());
+        assertEquals(56, dv.getHorizontalPos());
+        assertEquals(57, dv.getVerticalPos());
+        assertEquals(58, dv.getObjectID());
+        if(dv.getDVRecNo() == 0) {
+            fail("Identified bug 44510");
+        }
+        assertEquals(59, dv.getDVRecNo());
+    }
+}