You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2008/03/03 17:09:04 UTC

svn commit: r633151 - in /poi/trunk/src: documentation/content/xdocs/changes.xml documentation/content/xdocs/status.xml java/org/apache/poi/hssf/record/DVALRecord.java testcases/org/apache/poi/hssf/record/TestDVALRecord.java

Author: nick
Date: Mon Mar  3 08:09:02 2008
New Revision: 633151

URL: http://svn.apache.org/viewvc?rev=633151&view=rev
Log:
Patch from Josh from bug #44510 - Fix how DVALRecord works with dropdowns

Added:
    poi/trunk/src/testcases/org/apache/poi/hssf/record/TestDVALRecord.java   (with props)
Modified:
    poi/trunk/src/documentation/content/xdocs/changes.xml
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/java/org/apache/poi/hssf/record/DVALRecord.java

Modified: poi/trunk/src/documentation/content/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/changes.xml?rev=633151&r1=633150&r2=633151&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/changes.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/changes.xml Mon Mar  3 08:09:02 2008
@@ -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>

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=633151&r1=633150&r2=633151&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Mon Mar  3 08:09:02 2008
@@ -36,6 +36,9 @@
            <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>
            <action dev="POI-DEVELOPERS" type="add">44450 - Support for Lookup, HLookup and VLookup functions</action>
            <action dev="POI-DEVELOPERS" type="fix">44449 - Avoid getting confused when two sheets have shared formulas for the same areas, and when the shared formula is set incorrectly</action>
            <action dev="POI-DEVELOPERS" type="fix">44366 - InputStreams passed to POIFSFileSystem are now automatically closed. A warning is generated for people who might've relied on them not being closed before, and a wrapper to restore the old behaviour is supplied</action>

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/DVALRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/DVALRecord.java?rev=633151&r1=633150&r2=633151&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/DVALRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/DVALRecord.java Mon Mar  3 08:09:02 2008
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Copyright 2002-2004   Apache Software Foundation
 
@@ -20,13 +19,11 @@
 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 @@
 	/** 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;
     }
 
     /**

Added: poi/trunk/src/testcases/org/apache/poi/hssf/record/TestDVALRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/TestDVALRecord.java?rev=633151&view=auto
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/TestDVALRecord.java (added)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/TestDVALRecord.java Mon Mar  3 08:09:02 2008
@@ -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());
+    }
+}

Propchange: poi/trunk/src/testcases/org/apache/poi/hssf/record/TestDVALRecord.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: poi/trunk/src/testcases/org/apache/poi/hssf/record/TestDVALRecord.java
------------------------------------------------------------------------------
    svn:executable = *



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org