]> source.dussan.org Git - poi.git/commitdiff
This commit was manufactured by cvs2svn to create tag tags/REL_1_5_BRANCH_MERGE2@550310
author(no author) <(no author)@unknown>
Sun, 28 Apr 2002 05:22:45 +0000 (05:22 +0000)
committer(no author) <(no author)@unknown>
Sun, 28 Apr 2002 05:22:45 +0000 (05:22 +0000)
'REL_1_5_BRANCH_MERGE2'.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/tags/REL_1_5_BRANCH_MERGE2@352516 13f79535-47bb-0310-9956-ffa450edef68

17 files changed:
src/documentation/images/logoRaPiGmbH1.png [new file with mode: 0644]
src/documentation/images/logoRaPiGmbH2.png [new file with mode: 0644]
src/documentation/images/logoRaPiGmbH3.png [new file with mode: 0644]
src/documentation/images/logoRaPiGmbH4.png [new file with mode: 0644]
src/documentation/images/logoRaPiGmbH5.png [new file with mode: 0644]
src/documentation/images/logoRaPiGmbH6.png [new file with mode: 0644]
src/documentation/images/logoRaPiGmbH7.png [new file with mode: 0644]
src/documentation/xdocs/book.xml
src/documentation/xdocs/branching.xml [new file with mode: 0644]
src/documentation/xdocs/historyandfuture.xml
src/documentation/xdocs/news/logocontest.xml
src/java/org/apache/poi/hssf/dev/BiffViewer.java
src/java/org/apache/poi/hssf/record/RowRecord.java
src/java/org/apache/poi/hssf/usermodel/HSSFRow.java
src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRow.java
src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java

diff --git a/src/documentation/images/logoRaPiGmbH1.png b/src/documentation/images/logoRaPiGmbH1.png
new file mode 100644 (file)
index 0000000..3bef8bb
Binary files /dev/null and b/src/documentation/images/logoRaPiGmbH1.png differ
diff --git a/src/documentation/images/logoRaPiGmbH2.png b/src/documentation/images/logoRaPiGmbH2.png
new file mode 100644 (file)
index 0000000..d842217
Binary files /dev/null and b/src/documentation/images/logoRaPiGmbH2.png differ
diff --git a/src/documentation/images/logoRaPiGmbH3.png b/src/documentation/images/logoRaPiGmbH3.png
new file mode 100644 (file)
index 0000000..0419155
Binary files /dev/null and b/src/documentation/images/logoRaPiGmbH3.png differ
diff --git a/src/documentation/images/logoRaPiGmbH4.png b/src/documentation/images/logoRaPiGmbH4.png
new file mode 100644 (file)
index 0000000..3b8d44d
Binary files /dev/null and b/src/documentation/images/logoRaPiGmbH4.png differ
diff --git a/src/documentation/images/logoRaPiGmbH5.png b/src/documentation/images/logoRaPiGmbH5.png
new file mode 100644 (file)
index 0000000..f96ef9e
Binary files /dev/null and b/src/documentation/images/logoRaPiGmbH5.png differ
diff --git a/src/documentation/images/logoRaPiGmbH6.png b/src/documentation/images/logoRaPiGmbH6.png
new file mode 100644 (file)
index 0000000..53ee5e9
Binary files /dev/null and b/src/documentation/images/logoRaPiGmbH6.png differ
diff --git a/src/documentation/images/logoRaPiGmbH7.png b/src/documentation/images/logoRaPiGmbH7.png
new file mode 100644 (file)
index 0000000..498499d
Binary files /dev/null and b/src/documentation/images/logoRaPiGmbH7.png differ
index e5ab10098e7c0996e7d1446b08c7e8ad32f81f75..1d4b945e38705d5de35d24a3a952ba0cd88b91d8 100644 (file)
@@ -39,6 +39,7 @@
 
   <menu label="Get Involved">
     <menu-item label="Contributing" href="contrib.html"/>
+    <menu-item label="Branching" href="branching.html"/>
     <menu-item label="Bug Database" href="http://nagoya.apache.org/bugzilla/buglist.cgi?product=POI"/>
     <menu-item label="CVS" href="http://jakarta.apache.org/site/cvsindex.html"/>
     <menu-item label="Mail Lists" href="http://jakarta.apache.org/site/mail.html"/>
diff --git a/src/documentation/xdocs/branching.xml b/src/documentation/xdocs/branching.xml
new file mode 100644 (file)
index 0000000..4246d83
--- /dev/null
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "./dtd/document-v11.dtd">
+
+<document>
+
+    <header>
+        <title>Branching</title>
+        <authors>
+            <person id="GJS" name="Glen Stampoultzis" email="glens@apache.org"/>
+        </authors>
+    </header>
+
+    <body>
+        <section title="Branching Conventions">
+            <p>
+                Branches are tagged in the following way:
+            </p>
+            <ul>
+                <li>REL_1_5_BRANCH</li>
+                <li>REL_2_0_BRANCH</li>
+            </ul>
+            <p>
+                Merge points should be tagged as follows:
+            </p>
+            <ul>
+                <li>REL_1_5_BRANCH_MERGE1</li>
+                <li>REL_1_5_BRANCH_MERGE2</li>
+                <li>etc...</li>
+            </ul>
+            <p>
+                Releases should be tagged as:
+            </p>
+            <ul>
+                <li>REL_1_5</li>
+                <li>REL_1_5_1</li>
+                <li>REL_1_5_2</li>
+                <li>etc...</li>
+            </ul>
+
+        </section>
+        <section title="Branching Advise">
+            <p>
+              Don't forget which branch you are currently on.  This is critically
+              important.  Committing stuff to the wrong branch causes all sorts of
+              headaches.  Best to name your checkout after the branch you are on.
+            </p>
+        </section>
+        <section title="Who Manages Branching?">
+            <p>
+                All branching is currently managed by Glen Stampoultzis.  If you wish
+                to create your own branch please let him know.  Merging is also
+                handled by Glen.  Just pop him a mail if you feel it's necessary to
+                create a branch or perform a merge.
+            </p>
+            <p>
+                The reason to go through a single point for branching is that it can be
+                an easy thing to get wrong.  Having a single person managing branches
+                means there is less chance of getting getting our wires crossed with this
+                difficult area of CVS.
+            </p>
+        </section>
+        <section title="Currently Active Branches">
+            <p>
+                The following branches are currently active:
+            </p>
+            <table>
+                <tr>
+                    <th>
+                        <b>Branch</b>
+                    </th>
+                    <th>
+                        <b>Description</b>
+                    </th>
+                </tr>
+                <tr>
+                    <td>
+                        HEAD
+                    </td>
+                    <td>
+                    This is the trunk and is always active.  Currently it is being used to continue development
+                    of the 2.0 release.
+                    </td>
+                </tr>
+                <tr>
+                    <td>
+                        REL_1_5_BRANCH
+                    </td>
+                    <td>
+                        All bug fixes not specifically relevant to the 2.0 work should be placed in this branch.
+                        From here they will merged back to the trunk and the merge point marked.
+                    </td>
+                </tr>
+            </table>
+        </section>
+    </body>
+
+</document>
\ No newline at end of file
index 3855480f6949a3d0e98730c594d66622cb1842fe..741f6aad5c151db4e419a0dd0d705d9f2059bc51 100755 (executable)
@@ -3,7 +3,7 @@
 
 <document>
   <header>
-    <title></title>
+    <title>Project History</title>
     <authors>
       <person id="AO" name="Andrew C. Oliver" email="acoliver@apache.org"/>
     </authors>
index 9c45d06c660152353decc55e1bdc4899ef4c8e4c..9d9179c8656d980831f4ee71ddd3e2ba39daaec9 100644 (file)
 <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "document-v11.dtd">
 
 <document>
-  <header>
-    <title></title>
-    <authors>
-      <person id="AO" name="Andrew C. Oliver" email="acoliver@apache.org"/>
-    </authors>
-  </header>
-  
-  <body>
-    <section title="POI logos">
-        <p>
-                Here are the current logo submissions.  Thanks to the artists!
-        </p>
-        <section title="Michael Mosmann">
-                <p>
-                <img src="images/logoMichaelMosmann.png"/>
+    <header>
+        <title></title>
+        <authors>
+            <person id="AO" name="Andrew C. Oliver" email="acoliver@apache.org"/>
+            <person id="GS" name="Glen Stampoultzis" email="glens@apache.org"/>
+        </authors>
+    </header>
+
+    <body>
+        <section title="POI logos">
+            <p>
+                    Here are the current logo submissions.  Thanks to the artists!
+            </p>
+            <section title="Michael Mosmann">
+                <p>
+                    <img src="images/logoMichaelMosmann.png"/>
                 </p>
-        </section>
-        <section title="Loïc Lefèvre">
+            </section>
+            <section title="Loïc Lefèvre">
                 <p>
-                <img src="images/logoLoicLefevre.png"/>&nbsp;&nbsp;&nbsp;
-                <img src="images/logoLoicLefevre2.png"/>
+                    <img src="images/logoLoicLefevre.png"/>&nbsp;&nbsp;&nbsp;
+                    <img src="images/logoLoicLefevre2.png"/>
                 </p>
-        </section>
-        <section title="Glen Stampoultzis">
+            </section>
+            <section title="Glen Stampoultzis">
                 <p>
-                <img src="images/logoGlenStampoutlzis.png"/>
+                    <img src="images/logoGlenStampoutlzis.png"/>
                 </p>
-        </section>
-        <section title="Marcus Gustafsson">
+            </section>
+            <section title="Marcus Gustafsson">
                 <p>
-                <img src="images/logoGustafsson1.png"/>&nbsp;&nbsp;&nbsp;
-                <img src="images/logoGustafsson2.png"/>
+                    <img src="images/logoGustafsson1.png"/>&nbsp;&nbsp;&nbsp;
+                    <img src="images/logoGustafsson2.png"/>
                 </p>
-        </section>
-        <section title="Adrianus Handoyo">
+            </section>
+            <section title="Adrianus Handoyo">
                 <p>
-                <img src="images/logoAdria1.png"/>&nbsp;&nbsp;&nbsp;
-                <img src="images/logoAdria2.png"/>&nbsp;&nbsp;&nbsp;
-                <img src="images/logoAdria3.png"/>
+                    <img src="images/logoAdria1.png"/>&nbsp;&nbsp;&nbsp;
+                    <img src="images/logoAdria2.png"/>&nbsp;&nbsp;&nbsp;
+                    <img src="images/logoAdria3.png"/>
                 </p>
-        </section>
-        <section title="RussellBeattie">
+            </section>
+            <section title="RussellBeattie">
                 <p>
-                <img src="images/logoRussellBeattie1.png"/>&nbsp;&nbsp;&nbsp;
-                <img src="images/logoRussellBeattie2.png"/>&nbsp;&nbsp;&nbsp;
-                <img src="images/logoRussellBeattie3.png"/>
+                    <img src="images/logoRussellBeattie1.png"/>&nbsp;&nbsp;&nbsp;
+                    <img src="images/logoRussellBeattie2.png"/>&nbsp;&nbsp;&nbsp;
+                    <img src="images/logoRussellBeattie3.png"/>
                 </p>
                 <p>
-                <img src="images/logoRussellBeattie4.png"/>&nbsp;&nbsp;&nbsp;
-                <img src="images/logoRussellBeattie5.png"/>                
+                    <img src="images/logoRussellBeattie4.png"/>&nbsp;&nbsp;&nbsp;
+                    <img src="images/logoRussellBeattie5.png"/>
                 </p>
-        </section>        
-        <section title="Daniel Fernandez">
+            </section>
+            <section title="Daniel Fernandez">
                 <p>
-                <img src="images/logoDanielFernandez.png"/>
+                    <img src="images/logoDanielFernandez.png"/>
                 </p>
-        </section>
-        <section title="Andrew Clements">
+            </section>
+            <section title="Andrew Clements">
                 <p>
-                <img src="images/logoAndrewClements.png"/>&nbsp;&nbsp;&nbsp;
-                <img src="images/logoAndrewClements2.png"/>
+                    <img src="images/logoAndrewClements.png"/>&nbsp;&nbsp;&nbsp;
+                    <img src="images/logoAndrewClements2.png"/>
                 </p>
-        </section>
-        <section title="Wendy Wise">
+            </section>
+            <section title="Wendy Wise">
                 <p>
-                <img src="images/logoWendyWise.png"/>&nbsp;&nbsp;&nbsp;
-                <img src="images/logoWendyWise2.png"/>
+                    <img src="images/logoWendyWise.png"/>&nbsp;&nbsp;&nbsp;
+                    <img src="images/logoWendyWise2.png"/>
                 </p>
-        </section>
-        <section title="Nikhil Karmokar">
+            </section>
+            <section title="Nikhil Karmokar">
                 <p>
-                <img src="images/logoKarmokar1.png"/>&nbsp;&nbsp;&nbsp;
-                <img src="images/logoKarmokar1s.png"/>
+                    <img src="images/logoKarmokar1.png"/>&nbsp;&nbsp;&nbsp;
+                    <img src="images/logoKarmokar1s.png"/>
                 </p>
                 <p>
-                <img src="images/logoKarmokar2.png"/>&nbsp;&nbsp;&nbsp;
-                <img src="images/logoKarmokar2s.png"/>
+                    <img src="images/logoKarmokar2.png"/>&nbsp;&nbsp;&nbsp;
+                    <img src="images/logoKarmokar2s.png"/>
                 </p>
                 <p>
-                <img src="images/logoKarmokar3.png"/>&nbsp;&nbsp;&nbsp;
-                <img src="images/logoKarmokar3s.png"/>
+                    <img src="images/logoKarmokar3.png"/>&nbsp;&nbsp;&nbsp;
+                    <img src="images/logoKarmokar3s.png"/>
                 </p>
                 <p>
-                <img src="images/logoKarmokar4.png"/>&nbsp;&nbsp;&nbsp;
-                <img src="images/logoKarmokar4s.png"/>
+                    <img src="images/logoKarmokar4.png"/>&nbsp;&nbsp;&nbsp;
+                    <img src="images/logoKarmokar4s.png"/>
                 </p>
                 <p>
-                <img src="images/logoKarmokar5.png"/>&nbsp;&nbsp;&nbsp;
-                <img src="images/logoKarmokar5s.png"/>
+                    <img src="images/logoKarmokar5.png"/>&nbsp;&nbsp;&nbsp;
+                    <img src="images/logoKarmokar5s.png"/>
                 </p>
                 <p>
-                <img src="images/logoKarmokar6.png"/>&nbsp;&nbsp;&nbsp;
-                <img src="images/logoKarmokar6s.png"/>
+                    <img src="images/logoKarmokar6.png"/>&nbsp;&nbsp;&nbsp;
+                    <img src="images/logoKarmokar6s.png"/>
                 </p>
-        </section>
-        <section title="Lieven Janssen">
+            </section>
+            <section title="Lieven Janssen">
+                <p>
+                    <img src="images/logoJanssen1.png"/>&nbsp;&nbsp;&nbsp;
+                    <img src="images/logoJanssen2.png"/>
+                </p>
+            </section>
+            <section title="RaPi GmbH">
                 <p>
-                <img src="images/logoJanssen1.png"/>&nbsp;&nbsp;&nbsp;
-                <img src="images/logoJanssen2.png"/>
+                    Contact Person: Fancy at: fancy at my-feiqi.com
                 </p>
+                <p>
+                    <img src="images/logoRaPiGmbH1.png"/>&nbsp;&nbsp;&nbsp;
+                    <img src="images/logoRaPiGmbH2.png"/>
+                </p>
+                <p>
+                    <img src="images/logoRaPiGmbH3.png"/>
+                </p>
+                <p>
+                    <img src="images/logoRaPiGmbH4.png"/>
+                </p>
+                <p>
+                    <img src="images/logoRaPiGmbH5.png"/>
+                </p>
+                <p>
+                    <img src="images/logoRaPiGmbH6.png"/>
+                </p>
+                <p>
+                    <img src="images/logoRaPiGmbH7.png"/>
+                </p>
+            </section>
+
         </section>
-        
-    </section>    
-  </body>
-  <footer>
-    <legal>
-      Copyright (c) @year@ The Apache Software Foundation All rights reserved.
-      $Revision$ $Date$
-    </legal>
-  </footer>
+    </body>
+    <footer>
+        <legal>
+          Copyright (c) @year@ The Apache Software Foundation All rights reserved.
+          $Revision$ $Date$
+        </legal>
+    </footer>
 </document>
index 12267d23d88f641d7b86953b2ddf537981ae2745..7d366f14554c282beb9edd9d2a5f4aff12e6d826 100644 (file)
@@ -631,12 +631,12 @@ public class BiffViewer
                 retval = new LinkedDataRecord(rectype, size, data);
                 break;
                 
-            case FormulaRecord.sid:
-                retval = new FormulaRecord(rectype, size, data);
-                break;
+//            case FormulaRecord.sid:
+//                retval = new FormulaRecord(rectype, size, data);
+//                break;
                 
             case SheetPropertiesRecord.sid:
-                retval = new FormulaRecord(rectype, size, data);
+                retval = new SheetPropertiesRecord(rectype, size, data);
                 break;
 
 
index 65b627ea55c5871373bc822045348740150df272..fc29fcbd264a12d0731862ceb05aec5c4abb743c 100644 (file)
@@ -452,8 +452,8 @@ public class RowRecord
         LittleEndian.putShort(data, 0 + offset, sid);
         LittleEndian.putShort(data, 2 + offset, ( short ) 16);
         LittleEndian.putShort(data, 4 + offset, getRowNumber());
-        LittleEndian.putShort(data, 6 + offset, getFirstCol());
-        LittleEndian.putShort(data, 8 + offset, getLastCol());
+        LittleEndian.putShort(data, 6 + offset, getFirstCol() == -1 ? (short)0 : getFirstCol());
+        LittleEndian.putShort(data, 8 + offset, getLastCol() == -1 ? (short)0 : getLastCol());
         LittleEndian.putShort(data, 10 + offset, getHeight());
         LittleEndian.putShort(data, 12 + offset, getOptimize());
         LittleEndian.putShort(data, 14 + offset, field_6_reserved);
index 39da13e42c08223e8f0b8a24868615a0a8d66602..e9209800e34d1b84b74124a17da98f53b062e065 100644 (file)
@@ -126,8 +126,8 @@ public class HSSFRow
         this.sheet = sheet;
         row = new RowRecord();
         row.setHeight((short) 0xff);
-        row.setLastCol((short)-1);
-        row.setFirstCol((short)-1);
+        row.setLastCol((short) -1);
+        row.setFirstCol((short) -1);
 
         // row.setRowNumber(rowNum);
         setRowNum(rowNum);
@@ -213,11 +213,11 @@ public class HSSFRow
 
         if (cell.getCellNum() == row.getLastCol())
         {
-            row.setLastCol( findLastCell(row.getLastCol()) );
+            row.setLastCol(findLastCell(row.getLastCol()));
         }
         if (cell.getCellNum() == row.getFirstCol())
         {
-            row.setFirstCol( findFirstCell(row.getFirstCol()) );
+            row.setFirstCol(findFirstCell(row.getFirstCol()));
         }
     }
 
@@ -270,11 +270,11 @@ public class HSSFRow
     {
         if (row.getFirstCol() == -1)
         {
-            row.setFirstCol( cell.getCellNum() );
+            row.setFirstCol(cell.getCellNum());
         }
         if (row.getLastCol() == -1)
         {
-            row.setLastCol( cell.getCellNum() );
+            row.setLastCol(cell.getCellNum());
         }
         cells.put(new Integer(cell.getCellNum()), cell);
 
@@ -292,8 +292,8 @@ public class HSSFRow
      * get the hssfcell representing a given column (logical cell) 0-based.  If you
      * ask for a cell that is not defined....you get a null.
      *
-     * @param cellnum - 0 based column number
-     * @returns HSSFCell representing that column or null if undefined.
+     * @param cellnum  0 based column number
+     * @return HSSFCell representing that column or null if undefined.
      */
 
     public HSSFCell getCell(short cellnum)
@@ -318,7 +318,10 @@ public class HSSFRow
 
     public short getFirstCellNum()
     {
-        return row.getFirstCol();
+        if (getPhysicalNumberOfCells() == 0)
+            return -1;
+        else
+            return row.getFirstCol();
     }
 
     /**
@@ -328,7 +331,10 @@ public class HSSFRow
 
     public short getLastCellNum()
     {
-        return row.getLastCol();
+        if (getPhysicalNumberOfCells() == 0)
+            return -1;
+        else
+            return row.getLastCol();
     }
 
 
@@ -441,7 +447,7 @@ public class HSSFRow
     }
 
     /**
-     * @returns cell iterator of the physically defined cells.  Note element 4 may
+     * @return cell iterator of the physically defined cells.  Note element 4 may
      * actually be row cell depending on how many are defined!
      */
 
index ddb5dc8a653550a2d34662ed18997fac8fc93470..c6cb967622c56f7830668abd6585c0bbc09230c7 100644 (file)
@@ -1,4 +1,3 @@
-
 /* ====================================================================
  * The Apache Software License, Version 1.1
  *
  */
 package org.apache.poi.hssf.usermodel;
 
-import org.apache.poi.util.POILogFactory;
 import org.apache.poi.hssf.model.Sheet;
 import org.apache.poi.hssf.model.Workbook;
-import org.apache.poi.hssf.record.*;
+import org.apache.poi.hssf.record.CellValueRecordInterface;
+import org.apache.poi.hssf.record.RowRecord;
+import org.apache.poi.hssf.record.VCenterRecord;
+import org.apache.poi.hssf.record.WSBoolRecord;
 import org.apache.poi.hssf.util.Region;
+import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
 
 import java.util.Iterator;
@@ -74,12 +76,12 @@ import java.util.TreeMap;
  * High level representation of a worksheet.
  * @author  Andrew C. Oliver (acoliver at apache dot org)
  * @author  Glen Stampoultzis (glens at apache.org)
- * @version 1.0-pre
+ * @author  Libin Roman (romal at vistaportal.com)
  */
 
 public class HSSFSheet
 {
-    private static final int DEBUG            = POILogger.DEBUG;
+    private static final int DEBUG = POILogger.DEBUG;
 
     /**
      * Used for compile-time optimization.  This is the initial size for the collection of
@@ -87,17 +89,17 @@ public class HSSFSheet
      * by setting this to a higher number and recompiling a custom edition of HSSFSheet.
      */
 
-    public final static int  INITIAL_CAPACITY = 20;
+    public final static int INITIAL_CAPACITY = 20;
 
     /**
      * reference to the low level Sheet object
      */
 
-    private Sheet            sheet;
-    private TreeMap          rows;
-    private Workbook         book;
-    private int              firstrow;
-    private int              lastrow;
+    private Sheet sheet;
+    private TreeMap rows;
+    private Workbook book;
+    private int firstrow;
+    private int lastrow;
     private static POILogger log = POILogFactory.getLogger(HSSFSheet.class);
 
     /**
@@ -110,8 +112,8 @@ public class HSSFSheet
 
     protected HSSFSheet(Workbook book)
     {
-        sheet     = Sheet.createSheet();
-        rows      = new TreeMap();   // new ArrayList(INITIAL_CAPACITY);
+        sheet = Sheet.createSheet();
+        rows = new TreeMap();   // new ArrayList(INITIAL_CAPACITY);
         this.book = book;
     }
 
@@ -127,16 +129,11 @@ public class HSSFSheet
     protected HSSFSheet(Workbook book, Sheet sheet)
     {
         this.sheet = sheet;
-        rows       = new TreeMap();
-        this.book  = book;
+        rows = new TreeMap();
+        this.book = book;
         setPropertiesFromSheet(sheet);
     }
 
-    /** private default constructor prevents bogus initializationless construction */
-
-    private HSSFSheet()
-    {
-    }
 
     /**
      * used internally to set the properties given a Sheet object
@@ -144,8 +141,8 @@ public class HSSFSheet
 
     private void setPropertiesFromSheet(Sheet sheet)
     {
-        int       sloc = sheet.getLoc();
-        RowRecord row  = sheet.getNextRow();
+        int sloc = sheet.getLoc();
+        RowRecord row = sheet.getNextRow();
 
         while (row != null)
         {
@@ -154,8 +151,8 @@ public class HSSFSheet
             row = sheet.getNextRow();
         }
         sheet.setLoc(sloc);
-        CellValueRecordInterface cval      = sheet.getNextValueRecord();
-        long                     timestart = System.currentTimeMillis();
+        CellValueRecordInterface cval = sheet.getNextValueRecord();
+        long timestart = System.currentTimeMillis();
 
         log.log(DEBUG, "Time at start of cell creating in HSSF sheet = ",
                 new Long(timestart));
@@ -163,8 +160,8 @@ public class HSSFSheet
 
         while (cval != null)
         {
-            long    cellstart = System.currentTimeMillis();
-            HSSFRow hrow      = lastrow;
+            long cellstart = System.currentTimeMillis();
+            HSSFRow hrow = lastrow;
 
             if ((lastrow == null) || (lastrow.getRowNum() != cval.getRow()))
             {
@@ -236,10 +233,10 @@ public class HSSFSheet
 
             while (iter.hasNext())
             {
-                HSSFCell cell = ( HSSFCell ) iter.next();
+                HSSFCell cell = (HSSFCell) iter.next();
 
                 sheet.removeValueRecord(row.getRowNum(),
-                                        cell.getCellValueRecord());
+                        cell.getCellValueRecord());
             }
             sheet.removeRow(row.getRowRecord());
         }
@@ -251,10 +248,10 @@ public class HSSFSheet
 
     private int findLastRow(int lastrow)
     {
-        int     rownum = lastrow - 1;
-        HSSFRow r      = getRow(rownum);
+        int rownum = lastrow - 1;
+        HSSFRow r = getRow(rownum);
 
-        while (r == null)
+        while (r == null && rownum >= 0)
         {
             r = getRow(--rownum);
         }
@@ -267,13 +264,17 @@ public class HSSFSheet
 
     private int findFirstRow(int firstrow)
     {
-        int     rownum = firstrow + 1;
-        HSSFRow r      = getRow(rownum);
+        int rownum = firstrow + 1;
+        HSSFRow r = getRow(rownum);
 
-        while (r == null)
+        while (r == null && rownum <= getLastRowNum())
         {
             r = getRow(++rownum);
         }
+
+        if (rownum > getLastRowNum())
+            return -1;
+
         return rownum;
     }
 
@@ -311,8 +312,8 @@ public class HSSFSheet
     {
         HSSFRow row = new HSSFRow();
 
-        row.setRowNum(( short ) rownum);
-        return ( HSSFRow ) rows.get(row);
+        row.setRowNum((short) rownum);
+        return (HSSFRow) rows.get(row);
     }
 
     /**
@@ -344,26 +345,6 @@ public class HSSFSheet
         return lastrow;
     }
 
-    /**
-     * Seems to be unused (gjs)
-     *
-     * used internally to add cells from a high level row to the low level model
-     * @param row  the row object to represent in low level RowRecord.
-     */
-    private void addCellsFromRow(HSSFRow row)
-    {
-        Iterator iter = row.cellIterator();
-
-        // for (int k = 0; k < row.getPhysicalNumberOfCells(); k++)
-        while (iter.hasNext())
-        {
-            HSSFCell cell =
-                ( HSSFCell ) iter.next();   // row.getPhysicalCellAt(k);
-
-            sheet.addValueRecord(row.getRowNum(), cell.getCellValueRecord());
-        }
-    }
-
     /**
      * set the width (in units of 1/256th of a character width)
      * @param column - the column to set (0-based)
@@ -400,7 +381,7 @@ public class HSSFSheet
     /**
      * get the default row height for the sheet (if the rows do not define their own height) in
      * twips (1/20 of  a point)
-     * @retun  default row height
+     * @return  default row height
      */
 
     public short getDefaultRowHeight()
@@ -449,7 +430,7 @@ public class HSSFSheet
 
     public void setDefaultRowHeightInPoints(float height)
     {
-        sheet.setDefaultRowHeight(( short ) (height * 20));
+        sheet.setDefaultRowHeight((short) (height * 20));
     }
 
     /**
@@ -480,10 +461,10 @@ public class HSSFSheet
 
     public int addMergedRegion(Region region)
     {
-        return sheet.addMergedRegion(( short ) region.getRowFrom(),
-                                     region.getColumnFrom(),
-                                     ( short ) region.getRowTo(),
-                                     region.getColumnTo());
+        return sheet.addMergedRegion((short) region.getRowFrom(),
+                region.getColumnFrom(),
+                (short) region.getRowTo(),
+                region.getColumnTo());
     }
 
     /**
@@ -494,7 +475,7 @@ public class HSSFSheet
     public void setVerticallyCenter(boolean value)
     {
         VCenterRecord record =
-            ( VCenterRecord ) sheet.findFirstRecordBySid(VCenterRecord.sid);
+                (VCenterRecord) sheet.findFirstRecordBySid(VCenterRecord.sid);
 
         record.setVCenter(value);
     }
@@ -506,7 +487,7 @@ public class HSSFSheet
     public boolean getVerticallyCenter(boolean value)
     {
         VCenterRecord record =
-            ( VCenterRecord ) sheet.findFirstRecordBySid(VCenterRecord.sid);
+                (VCenterRecord) sheet.findFirstRecordBySid(VCenterRecord.sid);
 
         return record.getVCenter();
     }
@@ -543,7 +524,7 @@ public class HSSFSheet
     }
 
     /**
-     * @returns an iterator of the PHYSICAL rows.  Meaning the 3rd element may not
+     * @return an iterator of the PHYSICAL rows.  Meaning the 3rd element may not
      * be the third row if say for instance the second row is undefined.
      */
 
@@ -571,7 +552,7 @@ public class HSSFSheet
     public void setAlternativeExpression(boolean b)
     {
         WSBoolRecord record =
-            ( WSBoolRecord ) sheet.findFirstRecordBySid(WSBoolRecord.sid);
+                (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
 
         record.setAlternateExpression(b);
     }
@@ -584,7 +565,7 @@ public class HSSFSheet
     public void setAlternativeFormula(boolean b)
     {
         WSBoolRecord record =
-            ( WSBoolRecord ) sheet.findFirstRecordBySid(WSBoolRecord.sid);
+                (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
 
         record.setAlternateFormula(b);
     }
@@ -597,7 +578,7 @@ public class HSSFSheet
     public void setAutobreaks(boolean b)
     {
         WSBoolRecord record =
-            ( WSBoolRecord ) sheet.findFirstRecordBySid(WSBoolRecord.sid);
+                (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
 
         record.setAutobreaks(b);
     }
@@ -610,7 +591,7 @@ public class HSSFSheet
     public void setDialog(boolean b)
     {
         WSBoolRecord record =
-            ( WSBoolRecord ) sheet.findFirstRecordBySid(WSBoolRecord.sid);
+                (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
 
         record.setDialog(b);
     }
@@ -624,7 +605,7 @@ public class HSSFSheet
     public void setDisplayGuts(boolean b)
     {
         WSBoolRecord record =
-            ( WSBoolRecord ) sheet.findFirstRecordBySid(WSBoolRecord.sid);
+                (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
 
         record.setDisplayGuts(b);
     }
@@ -637,7 +618,7 @@ public class HSSFSheet
     public void setFitToPage(boolean b)
     {
         WSBoolRecord record =
-            ( WSBoolRecord ) sheet.findFirstRecordBySid(WSBoolRecord.sid);
+                (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
 
         record.setFitToPage(b);
     }
@@ -650,7 +631,7 @@ public class HSSFSheet
     public void setRowSumsBelow(boolean b)
     {
         WSBoolRecord record =
-            ( WSBoolRecord ) sheet.findFirstRecordBySid(WSBoolRecord.sid);
+                (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
 
         record.setRowSumsBelow(b);
     }
@@ -663,7 +644,7 @@ public class HSSFSheet
     public void setRowSumsRight(boolean b)
     {
         WSBoolRecord record =
-            ( WSBoolRecord ) sheet.findFirstRecordBySid(WSBoolRecord.sid);
+                (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
 
         record.setRowSumsRight(b);
     }
@@ -675,8 +656,8 @@ public class HSSFSheet
 
     public boolean getAlternateExpression()
     {
-        return (( WSBoolRecord ) sheet.findFirstRecordBySid(WSBoolRecord.sid))
-            .getAlternateExpression();
+        return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
+                .getAlternateExpression();
     }
 
     /**
@@ -686,8 +667,8 @@ public class HSSFSheet
 
     public boolean getAlternateFormula()
     {
-        return (( WSBoolRecord ) sheet.findFirstRecordBySid(WSBoolRecord.sid))
-            .getAlternateFormula();
+        return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
+                .getAlternateFormula();
     }
 
     /**
@@ -697,8 +678,8 @@ public class HSSFSheet
 
     public boolean getAutobreaks()
     {
-        return (( WSBoolRecord ) sheet.findFirstRecordBySid(WSBoolRecord.sid))
-            .getAutobreaks();
+        return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
+                .getAutobreaks();
     }
 
     /**
@@ -708,8 +689,8 @@ public class HSSFSheet
 
     public boolean getDialog()
     {
-        return (( WSBoolRecord ) sheet.findFirstRecordBySid(WSBoolRecord.sid))
-            .getDialog();
+        return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
+                .getDialog();
     }
 
     /**
@@ -720,8 +701,8 @@ public class HSSFSheet
 
     public boolean getDisplayGuts()
     {
-        return (( WSBoolRecord ) sheet.findFirstRecordBySid(WSBoolRecord.sid))
-            .getDisplayGuts();
+        return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
+                .getDisplayGuts();
     }
 
     /**
@@ -731,8 +712,8 @@ public class HSSFSheet
 
     public boolean getFitToPage()
     {
-        return (( WSBoolRecord ) sheet.findFirstRecordBySid(WSBoolRecord.sid))
-            .getFitToPage();
+        return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
+                .getFitToPage();
     }
 
     /**
@@ -742,8 +723,8 @@ public class HSSFSheet
 
     public boolean getRowSumsBelow()
     {
-        return (( WSBoolRecord ) sheet.findFirstRecordBySid(WSBoolRecord.sid))
-            .getRowSumsBelow();
+        return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
+                .getRowSumsBelow();
     }
 
     /**
@@ -753,7 +734,7 @@ public class HSSFSheet
 
     public boolean getRowSumsRight()
     {
-        return (( WSBoolRecord ) sheet.findFirstRecordBySid(WSBoolRecord.sid))
-            .getRowSumsRight();
+        return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
+                .getRowSumsRight();
     }
 }
index f8c584839a892720b5ac60dbf0dddd688f3e36ee..3c7fb5163669ce5027c24a26838fb486bfdfd54d 100644 (file)
 package org.apache.poi.hssf.usermodel;
 
 import junit.framework.TestCase;
-import org.apache.poi.hssf.record.RowRecord;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 
 /**
  * Test HSSFRow is okay.
@@ -87,33 +90,47 @@ public class TestHSSFRow
         assertEquals(1, row.getFirstCellNum());
         assertEquals(2, row.getLastCellNum());
 
-        RowRecord rowRecord = new RowRecord();
-        rowRecord.setFirstCol((short) 2);
-        rowRecord.setLastCol((short) 5);
-        row = new HSSFRow(workbook.getWorkbook(), sheet.getSheet(), rowRecord);
-        assertEquals(2, row.getFirstCellNum());
-        assertEquals(5, row.getLastCellNum());
     }
 
     public void testRemoveCell()
+            throws Exception
     {
         HSSFWorkbook workbook = new HSSFWorkbook();
         HSSFSheet sheet = workbook.createSheet();
         HSSFRow row = sheet.createRow((short) 0);
         assertEquals(-1, row.getLastCellNum());
         assertEquals(-1, row.getFirstCellNum());
-        row.createCell((short)1);
+        row.createCell((short) 1);
         assertEquals(1, row.getLastCellNum());
         assertEquals(1, row.getFirstCellNum());
-        row.createCell((short)3);
+        row.createCell((short) 3);
         assertEquals(3, row.getLastCellNum());
         assertEquals(1, row.getFirstCellNum());
-        row.removeCell(row.getCell((short)3));
+        row.removeCell(row.getCell((short) 3));
         assertEquals(1, row.getLastCellNum());
         assertEquals(1, row.getFirstCellNum());
-        row.removeCell(row.getCell((short)1));
+        row.removeCell(row.getCell((short) 1));
         assertEquals(-1, row.getLastCellNum());
         assertEquals(-1, row.getFirstCellNum());
 
+        // check the row record actually writes it out as 0's
+        byte[] data = new byte[100];
+        row.getRowRecord().serialize(0, data);
+        assertEquals(0, data[6]);
+        assertEquals(0, data[8]);
+
+        File file = File.createTempFile("XXX", "XLS");
+        FileOutputStream stream = new FileOutputStream(file);
+        workbook.write(stream);
+        stream.close();
+        FileInputStream inputStream = new FileInputStream(file);
+        workbook = new HSSFWorkbook(inputStream);
+        sheet = workbook.getSheetAt(0);
+        stream.close();
+        file.delete();
+        assertEquals(-1, sheet.getRow((short) 0).getLastCellNum());
+        assertEquals(-1, sheet.getRow((short) 0).getFirstCellNum());
+
+
     }
 }
index 4868aee042b93d33b116141da378f37cd89151f0..ddaedd922e89dd2623cb18f5b40872fb904756c8 100644 (file)
@@ -58,7 +58,6 @@ import junit.framework.TestCase;
 import org.apache.poi.hssf.model.Sheet;
 import org.apache.poi.hssf.record.VCenterRecord;
 import org.apache.poi.hssf.record.WSBoolRecord;
-import org.apache.poi.hssf.dev.BiffViewer;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -190,7 +189,14 @@ public class TestHSSFSheet
         tempFile.delete();
         assertNotNull(row);
         assertEquals(2, row.getPhysicalNumberOfCells());
+    }
 
-
+    public void testRemoveRow()
+    {
+        HSSFWorkbook workbook = new HSSFWorkbook();
+        HSSFSheet sheet = workbook.createSheet("Test boolean");
+        HSSFRow row = sheet.createRow((short) 2);
+        sheet.removeRow(row);
     }
+
 }