poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r683670 [1/4] - in /poi/branches/ooxml: ./ src/java/org/apache/poi/hssf/dev/ src/java/org/apache/poi/hssf/model/ src/java/org/apache/poi/hssf/record/ src/java/org/apache/poi/hssf/record/aggregates/ src/java/org/apache/poi/hssf/record/formul...
Date Thu, 07 Aug 2008 18:21:34 GMT
Author: nick
Date: Thu Aug  7 11:21:32 2008
New Revision: 683670

URL: http://svn.apache.org/viewvc?rev=683670&view=rev
Log:
Merged revisions 638786-638802,638805-638811,638813-638814,638816-639230,639233-639241,639243-639253,639255-639486,639488-639601,639603-639835,639837-639917,639919-640056,640058-640710,640712-641156,641158-641184,641186-641795,641797-641798,641800-641933,641935-641963,641965-641966,641968-641995,641997-642230,642232-642562,642564-642565,642568-642570,642572-642573,642576-642736,642739-642877,642879,642881-642890,642892-642903,642905-642945,642947-643624,643626-643653,643655-643669,643671,643673-643830,643832-643833,643835-644342,644344-644472,644474-644508,644510-645347,645349-645351,645353-645559,645561-645565,645568-645951,645953-646193,646195-646311,646313-646404,646406-646665,646667-646853,646855-646869,646871-647151,647153-647185,647187-647277,647279-647566,647568-647573,647575,647578-647711,647714-647737,647739-647823,647825-648155,648157-648202,648204-648273,648275,648277-648302,648304-648333,648335-648588,648590-648622,648625-648673,648675-649141,649144,649146-649556,
 649558-649795,649799,649801-649910,649912-649913,649915-650128,650131-650132,650134-650137,650140-650914,650916-651991,651993-652284,652286-652287,652289,652291,652293-652297,652299-652328,652330-652425,652427-652445,652447-652560,652562-652933,652935,652937-652993,652995-653116,653118-653124,653126-653483,653487-653519,653522-653550,653552-653607,653609-653667,653669-653674,653676-653814,653817-653830,653832-653891,653893-653944,653946-654055,654057-654355,654357-654365,654367-654648,654651-655215,655217-655277,655279-655281,655283-655911,655913-656212,656214,656216-656251,656253-656698,656700-656756,656758-656892,656894-657135,657137-657165,657168-657179,657181-657354,657356-657357,657359-657701,657703-657874,657876-658032,658034-658284,658286,658288-658301,658303-658307,658309-658321,658323-658335,658337-658348,658351,658353-658832,658834-658983,658985,658987-659066,659068-659402,659404-659428,659430-659451,659453-659454,659456-659461,659463-659477,659479-659524,659526-65
 9571,659574,659576-660255,660257-660262,660264-660279,660281-660343,660345-660473,660475-660827,660829-660833,660835-660888,660890-663321,663323-663435,663437-663764,663766-663854,663856-664219,664221-664489,664494-664514,664516-668013,668015-668142,668144-668152,668154,668156-668256,668258,668260-669139,669141-669455,669457-669657,669659-669808,669810-670189,670191-671321,671323-672229,672231-672549,672551-672552,672554-672561,672563-672566,672568,672571-673049,673051-673852,673854-673862,673864-673986,673988-673996,673998-674347,674349-674890,674892-674910,674912-674936,674938-674952,674954-675078,675080-675085,675087-675217,675219-675660,675662-675670,675672-675716,675718-675726,675728-675733,675735-675775,675777-675782,675784,675786-675791,675794-675852,675854-676200,676202,676204,676206-676220,676222-676309,676311-676456,676458-676994,676996-677027,677030-677040,677042-677056,677058-677375,677377-677968,677970-677971,677973,677975-677994,677996-678286,678288-678538,6785
 40-680393,680395-680469,680471-680529,680531-680852,680854-681529,681531-681571,681573-682224,682226,682228,682231-682281,682283-682335,682337-682507,682509,682512-682517,682519-682532,682534-682619,682622-682777,682779-682998,683000-683019,683021-683286 via svnmerge from 
https://svn.apache.org/repos/asf/poi/trunk

........
  r683023 | josh | 2008-08-06 00:03:33 +0100 (Wed, 06 Aug 2008) | 1 line
  
  Fix JDK 1.4 compilation (after r682511 /bug 45538)
........
  r683081 | josh | 2008-08-06 02:39:44 +0100 (Wed, 06 Aug 2008) | 1 line
  
  refactoring aggregate records to a separate hierarchy. just starting
........
  r683093 | josh | 2008-08-06 04:06:18 +0100 (Wed, 06 Aug 2008) | 1 line
  
  should have been submitted with r683081
........
  r683096 | josh | 2008-08-06 04:23:10 +0100 (Wed, 06 Aug 2008) | 1 line
  
  should have been submitted with r683081
........
  r683128 | josh | 2008-08-06 07:20:59 +0100 (Wed, 06 Aug 2008) | 1 line
  
  removed TODO comment and formatted
........
  r683132 | josh | 2008-08-06 07:27:39 +0100 (Wed, 06 Aug 2008) | 1 line
  
  Partial fix for bug 45570 - Converted instance BitField fields to static 
........
  r683167 | josh | 2008-08-06 09:42:40 +0100 (Wed, 06 Aug 2008) | 1 line
  
  Added conditional format records to BiffViewer
........

Added:
    poi/branches/ooxml/src/java/org/apache/poi/hssf/model/RecordOrderer.java
      - copied unchanged from r683167, poi/trunk/src/java/org/apache/poi/hssf/model/RecordOrderer.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/RecordBase.java
      - copied unchanged from r683167, poi/trunk/src/java/org/apache/poi/hssf/record/RecordBase.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/aggregates/ConditionalFormattingTable.java
      - copied unchanged from r683167, poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/ConditionalFormattingTable.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/aggregates/MergedCellsTable.java
      - copied unchanged from r683167, poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/MergedCellsTable.java
Modified:
    poi/branches/ooxml/   (props changed)
    poi/branches/ooxml/build.xml
    poi/branches/ooxml/src/java/org/apache/poi/hssf/dev/BiffViewer.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/model/Sheet.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/AreaRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/BarRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CFRuleRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/ChartFormatRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/DatRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/DataFormatRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/FormulaRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/FrameRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/HorizontalPageBreakRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/LegendRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/LineFormatRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/LinkedDataRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/MergeCellsRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/PageBreakRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/Record.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/SeriesLabelsRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/SheetPropertiesRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/StyleRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/TableRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/TextObjectBaseRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/TextRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/TickRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/ValueRangeRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/VerticalPageBreakRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/WindowTwoRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/aggregates/CFRecordsAggregate.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/aggregates/DataValidityTable.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/aggregates/RecordAggregate.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
    poi/branches/ooxml/src/java/org/apache/poi/ss/util/CellRangeAddressList.java
    poi/branches/ooxml/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Sheet.java
    poi/branches/ooxml/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
    poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hssf/usermodel/HSSFChart.java
    poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestHSSFChart.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/extractor/TestExcelExtractor.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/model/TestSheet.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/model/TestSheetAdditional.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestMergeCellsRecord.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/aggregates/TestCFRecordsAggregate.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/aggregates/TestColumnInfoRecordsAggregate.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java

Propchange: poi/branches/ooxml/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Aug  7 11:21:32 2008
@@ -1 +1 @@
-/poi/trunk:1-638784,638786-639486,639488-639601,639603-640056,640058-642562,642564-642566,642568-642574,642576-642736,642739-650914,650916-683020
+/poi/trunk:1-638784,638786-639486,639488-639601,639603-640056,640058-642562,642564-642566,642568-642574,642576-642736,642739-650914,650916-683286

Modified: poi/branches/ooxml/build.xml
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/build.xml?rev=683670&r1=683669&r2=683670&view=diff
==============================================================================
--- poi/branches/ooxml/build.xml (original)
+++ poi/branches/ooxml/build.xml Thu Aug  7 11:21:32 2008
@@ -459,7 +459,8 @@
       fork="yes" srcdir="${scratchpad.src.test}">
       <classpath>
         <path refid="scratchpad.classpath"/>
-        <pathelement path="${scratchpad.output.dir}"/>
+        <pathelement location="${main.output.test.dir}"/>
+        <pathelement location="${scratchpad.output.dir}"/>
         <pathelement location="${junit.jar1.dir}"/>
       </classpath>
     </javac>
@@ -694,6 +695,7 @@
             <classpath>
                 <path refid="scratchpad.classpath"/>
                 <pathelement location="${main.output.dir}"/>
+                <pathelement location="${main.output.test.dir}"/>
                 <pathelement location="${scratchpad.output.dir}"/>
                 <pathelement location="${scratchpad.output.test.dir}"/>
                 <pathelement location="${junit.jar1.dir}"/>

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/dev/BiffViewer.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/dev/BiffViewer.java?rev=683670&r1=683669&r2=683670&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/dev/BiffViewer.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/dev/BiffViewer.java Thu Aug  7 11:21:32 2008
@@ -129,6 +129,8 @@
             case BoolErrRecord.sid:        return new BoolErrRecord(in);
             case BottomMarginRecord.sid:   return new BottomMarginRecord(in);
             case BoundSheetRecord.sid:     return new BoundSheetRecord(in);
+            case CFHeaderRecord.sid:       return new CFHeaderRecord(in);
+            case CFRuleRecord.sid:         return new CFRuleRecord(in);
             case CalcCountRecord.sid:      return new CalcCountRecord(in);
             case CalcModeRecord.sid:       return new CalcModeRecord(in);
             case CategorySeriesAxisRecord.sid: return new CategorySeriesAxisRecord(in);
@@ -288,10 +290,10 @@
             }
             PrintStream ps;
             if (false) { // set to true to output to file
-            	OutputStream os = new FileOutputStream(inFileName + ".out");
-            	ps = new PrintStream(os);
+                OutputStream os = new FileOutputStream(inFileName + ".out");
+                ps = new PrintStream(os);
             } else {
-            	ps = System.out;
+                ps = System.out;
             }
             BiffViewer viewer = new BiffViewer(inputFile, ps);
 

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/model/Sheet.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/model/Sheet.java?rev=683670&r1=683669&r2=683670&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/model/Sheet.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/model/Sheet.java Thu Aug  7 11:21:32 2008
@@ -17,23 +17,78 @@
 
 package org.apache.poi.hssf.model;
 
-import org.apache.poi.hssf.record.*; // normally I don't do this, buy we literally mean ALL
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.poi.hssf.record.BOFRecord;
+import org.apache.poi.hssf.record.BottomMarginRecord;
+import org.apache.poi.hssf.record.CFHeaderRecord;
+import org.apache.poi.hssf.record.CalcCountRecord;
+import org.apache.poi.hssf.record.CalcModeRecord;
+import org.apache.poi.hssf.record.CellValueRecordInterface;
+import org.apache.poi.hssf.record.ColumnInfoRecord;
+import org.apache.poi.hssf.record.DBCellRecord;
+import org.apache.poi.hssf.record.DVALRecord;
+import org.apache.poi.hssf.record.DefaultColWidthRecord;
+import org.apache.poi.hssf.record.DefaultRowHeightRecord;
+import org.apache.poi.hssf.record.DeltaRecord;
+import org.apache.poi.hssf.record.DimensionsRecord;
+import org.apache.poi.hssf.record.DrawingRecord;
+import org.apache.poi.hssf.record.EOFRecord;
+import org.apache.poi.hssf.record.EscherAggregate;
+import org.apache.poi.hssf.record.FooterRecord;
+import org.apache.poi.hssf.record.GridsetRecord;
+import org.apache.poi.hssf.record.GutsRecord;
+import org.apache.poi.hssf.record.HCenterRecord;
+import org.apache.poi.hssf.record.HeaderRecord;
+import org.apache.poi.hssf.record.HorizontalPageBreakRecord;
+import org.apache.poi.hssf.record.IndexRecord;
+import org.apache.poi.hssf.record.IterationRecord;
+import org.apache.poi.hssf.record.LeftMarginRecord;
+import org.apache.poi.hssf.record.Margin;
+import org.apache.poi.hssf.record.MergeCellsRecord;
+import org.apache.poi.hssf.record.ObjRecord;
+import org.apache.poi.hssf.record.ObjectProtectRecord;
+import org.apache.poi.hssf.record.PageBreakRecord;
+import org.apache.poi.hssf.record.PaneRecord;
+import org.apache.poi.hssf.record.PasswordRecord;
+import org.apache.poi.hssf.record.PrintGridlinesRecord;
+import org.apache.poi.hssf.record.PrintHeadersRecord;
+import org.apache.poi.hssf.record.PrintSetupRecord;
+import org.apache.poi.hssf.record.ProtectRecord;
+import org.apache.poi.hssf.record.Record;
+import org.apache.poi.hssf.record.RecordBase;
+import org.apache.poi.hssf.record.RefModeRecord;
+import org.apache.poi.hssf.record.RightMarginRecord;
+import org.apache.poi.hssf.record.RowRecord;
+import org.apache.poi.hssf.record.SCLRecord;
+import org.apache.poi.hssf.record.SaveRecalcRecord;
+import org.apache.poi.hssf.record.ScenarioProtectRecord;
+import org.apache.poi.hssf.record.SelectionRecord;
+import org.apache.poi.hssf.record.SharedFormulaRecord;
+import org.apache.poi.hssf.record.StringRecord;
+import org.apache.poi.hssf.record.TopMarginRecord;
+import org.apache.poi.hssf.record.UncalcedRecord;
+import org.apache.poi.hssf.record.VCenterRecord;
+import org.apache.poi.hssf.record.VerticalPageBreakRecord;
+import org.apache.poi.hssf.record.WSBoolRecord;
+import org.apache.poi.hssf.record.WindowTwoRecord;
+import org.apache.poi.hssf.record.aggregates.CFRecordsAggregate;
 import org.apache.poi.hssf.record.aggregates.ColumnInfoRecordsAggregate;
+import org.apache.poi.hssf.record.aggregates.ConditionalFormattingTable;
 import org.apache.poi.hssf.record.aggregates.DataValidityTable;
 import org.apache.poi.hssf.record.aggregates.FormulaRecordAggregate;
+import org.apache.poi.hssf.record.aggregates.MergedCellsTable;
+import org.apache.poi.hssf.record.aggregates.RecordAggregate;
 import org.apache.poi.hssf.record.aggregates.RowRecordsAggregate;
 import org.apache.poi.hssf.record.aggregates.ValueRecordsAggregate;
-import org.apache.poi.hssf.record.aggregates.CFRecordsAggregate;
+import org.apache.poi.hssf.record.aggregates.RecordAggregate.RecordVisitor;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.hssf.util.PaneInformation;
-
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;   
-
 /**
  * Low level model implementation of a Sheet (one workbook contains many sheets)
  * This file contains the low level binary records starting at the sheets BOF and
@@ -72,30 +127,30 @@
     protected DefaultColWidthRecord      defaultcolwidth   =     null;
     protected DefaultRowHeightRecord     defaultrowheight  =     null;
     protected GridsetRecord              gridset           =     null;
+	private   GutsRecord                 _gutsRecord;
     protected PrintSetupRecord           printSetup        =     null;
     protected HeaderRecord               header            =     null;
     protected FooterRecord               footer            =     null;
     protected PrintGridlinesRecord       printGridlines    =     null;
     protected WindowTwoRecord            windowTwo         =     null;
-    protected MergeCellsRecord           merged            =     null;
     protected Margin[]                   margins           =     null;
-    protected List                       mergedRecords     =     new ArrayList();
-    protected int                        numMergedRegions  =     0;
+    private   MergedCellsTable           _mergedCellsTable;
     protected SelectionRecord            selection         =     null;
-    protected ColumnInfoRecordsAggregate columns           =     null;
+    /** always present in this POI object, not always written to Excel file */
+    /*package*/ColumnInfoRecordsAggregate _columnInfos;
     protected ValueRecordsAggregate      cells             =     null;
-    protected RowRecordsAggregate        rows              =     null;
+    protected RowRecordsAggregate        _rowsAggregate              =     null;
     private   Iterator                   valueRecIterator  =     null;
     private   Iterator                   rowRecIterator    =     null;
     protected int                        eofLoc            =     0;
     protected ProtectRecord              protect           =     null;
-    protected PageBreakRecord            rowBreaks         =     null;
-    protected PageBreakRecord            colBreaks         =     null;
+    protected PageBreakRecord            _rowBreaksRecord;
+    protected PageBreakRecord            _columnBreaksRecord;
     private   DataValidityTable          _dataValidityTable=     null;
     protected ObjectProtectRecord        objprotect        =     null;
     protected ScenarioProtectRecord      scenprotect       =     null;
     protected PasswordRecord             password          =     null;
-    protected List                       condFormatting    =     new ArrayList();
+    private   ConditionalFormattingTable condFormatting;
 
     /** Add an UncalcedRecord if not true indicating formulas have not been calculated */
     protected boolean _isUncalced = false;
@@ -139,13 +194,70 @@
         Sheet     retval             = new Sheet();
         ArrayList records            = new ArrayList(recs.size() / 5);
         boolean   isfirstcell        = true;
-        boolean   isfirstrow         = true;
         int       bofEofNestingLevel = 0;
 
         for (int k = offset; k < recs.size(); k++)
         {
             Record rec = ( Record ) recs.get(k);
+            if (rec.isValue() != (rec instanceof CellValueRecordInterface)) {
+            	if (rec instanceof SharedFormulaRecord) {
+            		
+            	} else {
+            	"".length();
+            	}
+            }
 
+            if ( rec.getSid() == DBCellRecord.sid ) {
+                continue;
+            }
+            if ( rec.getSid() == IndexRecord.sid ) {
+                // ignore INDEX record because it is only needed by Excel, 
+                // and POI always re-calculates its contents 
+                continue;
+            }
+            if ( rec.getSid() == StringRecord.sid ) {
+                continue;
+            }
+            
+            if ( rec.getSid() == CFHeaderRecord.sid ) {
+                RecordStream rs = new RecordStream(recs, k);
+                retval.condFormatting = new ConditionalFormattingTable(rs);
+                k += rs.getCountRead()-1;
+                records.add(retval.condFormatting);
+                continue;
+            }
+            
+            if (rec.getSid() == ColumnInfoRecord.sid) {
+                RecordStream rs = new RecordStream(recs, k);
+                retval._columnInfos = new ColumnInfoRecordsAggregate(rs);
+                k += rs.getCountRead()-1;
+                records.add(retval._columnInfos);
+                continue;
+            }
+            if ( rec.getSid() == DVALRecord.sid) {
+                RecordStream rs = new RecordStream(recs, k);
+                retval._dataValidityTable = new DataValidityTable(rs);
+                k += rs.getCountRead() - 1; // TODO - convert this method result to be zero based
+                records.add(retval._dataValidityTable);
+                continue; // TODO
+            }
+            if ( rec.getSid() == RowRecord.sid )
+            {
+                RowRecord row = (RowRecord)rec;
+                if (retval._rowsAggregate == null) {
+                    retval._rowsAggregate = new RowRecordsAggregate();
+                    records.add(retval._rowsAggregate); //only add the aggregate once
+				}
+                retval._rowsAggregate.insertRow(row);
+                continue;
+            }
+            if (rec.getSid() == MergeCellsRecord.sid) {
+                RecordStream rs = new RecordStream(recs, k);
+                retval._mergedCellsTable = new MergedCellsTable(rs);
+                records.add(retval._mergedCellsTable);
+                continue; // TODO
+            }
+            
             if (rec.getSid() == BOFRecord.sid)
             {
                 bofEofNestingLevel++;
@@ -169,53 +281,15 @@
             else if (rec.getSid() == DimensionsRecord.sid)
             {
                 // Make a columns aggregate if one hasn't ready been created.
-                if (retval.columns == null)
+                if (retval._columnInfos == null)
                 {
-                    retval.columns = new ColumnInfoRecordsAggregate();
-                    records.add(retval.columns);
+                    retval._columnInfos = new ColumnInfoRecordsAggregate();
+                    records.add(retval._columnInfos);
                 }
 
                 retval.dims    = ( DimensionsRecord ) rec;
                 retval.dimsloc = records.size();
             }
-            else if (rec.getSid() == MergeCellsRecord.sid)
-            {
-                retval.mergedRecords.add(rec);
-                retval.merged = ( MergeCellsRecord ) rec;
-                retval.numMergedRegions += retval.merged.getNumAreas();
-            }
-            else if ( rec.getSid() == CFHeaderRecord.sid )
-            {
-                CFRecordsAggregate cfAgg = CFRecordsAggregate.createCFAggregate(recs, k);
-                retval.condFormatting.add(cfAgg);
-                rec = cfAgg;
-            }
-            else if ( rec.getSid() == CFRuleRecord.sid )
-            {
-                // Skip it since it is processed by CFRecordsAggregate
-                rec = null;
-            }
-            else if (rec.getSid() == ColumnInfoRecord.sid)
-            {
-                ColumnInfoRecord col = (ColumnInfoRecord)rec;
-                if (retval.columns != null)
-                {
-                    rec = null; //only add the aggregate once
-                }
-                else
-                {
-                    rec = retval.columns = new ColumnInfoRecordsAggregate();
-                }
-                retval.columns.insertColumn(col);
-            }
-            else if (rec.getSid() == DefaultColWidthRecord.sid)
-            {
-                retval.defaultcolwidth = ( DefaultColWidthRecord ) rec;
-            }
-            else if (rec.getSid() == DefaultRowHeightRecord.sid)
-            {
-                retval.defaultrowheight = ( DefaultRowHeightRecord ) rec;
-            }
             else if ( rec.isValue() && bofEofNestingLevel == 1 )
             {
                 if ( isfirstcell )
@@ -230,22 +304,13 @@
                     rec = null;
                 }
             }
-            else if ( rec.getSid() == StringRecord.sid )
+            else  if (rec.getSid() == DefaultColWidthRecord.sid)
             {
-                rec = null;
+                retval.defaultcolwidth = ( DefaultColWidthRecord ) rec;
             }
-            else if ( rec.getSid() == RowRecord.sid )
+            else if (rec.getSid() == DefaultRowHeightRecord.sid)
             {
-                RowRecord row = (RowRecord)rec;
-                if (!isfirstrow) rec = null; //only add the aggregate once
-
-                if ( isfirstrow )
-                {
-                    retval.rows = new RowRecordsAggregate();
-                    rec = retval.rows;
-                    isfirstrow = false;
-                }
-                retval.rows.insertRow(row);
+                retval.defaultrowheight = ( DefaultRowHeightRecord ) rec;
             }
             else if ( rec.getSid() == PrintGridlinesRecord.sid )
             {
@@ -291,22 +356,6 @@
             {
                 retval.windowTwo = (WindowTwoRecord) rec;
             }
-            else if ( rec.getSid() == DBCellRecord.sid )
-            {
-                rec = null;
-            }
-            else if ( rec.getSid() == IndexRecord.sid )
-            {
-                // ignore INDEX record because it is only needed by Excel, 
-                // and POI always re-calculates its contents 
-                rec = null;
-            }
-            else if ( rec.getSid() == DVALRecord.sid) {
-                RecordStream rs = new RecordStream(recs, k);
-                retval._dataValidityTable = new DataValidityTable(rs);
-                k += rs.getCountRead() - 1; // TODO - convert this method result to be zero based
-                rec = retval._dataValidityTable;
-            }
             else if ( rec.getSid() == ProtectRecord.sid )
             {
                 retval.protect = (ProtectRecord) rec;
@@ -323,13 +372,13 @@
             {
                 retval.password = (PasswordRecord) rec;
             }
-            else if (rec.getSid() == PageBreakRecord.HORIZONTAL_SID)
+            else if (rec.getSid() == HorizontalPageBreakRecord.sid)
             {
-                retval.rowBreaks = (PageBreakRecord)rec;
+                retval._rowBreaksRecord = (HorizontalPageBreakRecord)rec;
             }
-            else if (rec.getSid() == PageBreakRecord.VERTICAL_SID)
+            else if (rec.getSid() == VerticalPageBreakRecord.sid)
             {
-                retval.colBreaks = (PageBreakRecord)rec;
+                retval._columnBreaksRecord = (VerticalPageBreakRecord)rec;
             }
 
             if (rec != null)
@@ -337,6 +386,9 @@
                 records.add(rec);
             }
         }
+        if (retval.dimsloc < 0) {
+        	throw new RuntimeException("DimensionsRecord was not found");
+        }
         retval.records = records;
         retval.checkRows();
         retval.checkCells();
@@ -345,6 +397,17 @@
         return retval;
     }
 
+    private static final class RecordCloner implements RecordVisitor {
+
+		private final List _destList;
+
+		public RecordCloner(List destList) {
+			_destList = destList;
+		}
+		public void visitRecord(Record r) {
+			_destList.add(r.clone());
+		}
+    }
     /**
      * Clones the low level records of this sheet and returns the new sheet instance.
      * This method is implemented by adding methods for deep cloning to all records that
@@ -356,7 +419,13 @@
     {
       ArrayList clonedRecords = new ArrayList(this.records.size());
       for (int i=0; i<this.records.size();i++) {
-        Record rec = (Record)((Record)this.records.get(i)).clone();
+        RecordBase rb = (RecordBase) this.records.get(i);
+        if (rb instanceof RecordAggregate) {
+        	((RecordAggregate)rb).visitContainedRecords(new RecordCloner(clonedRecords));
+        	// TODO - make sure this logic works for the other RecordAggregates
+        	continue;
+        }
+		Record rec = (Record)((Record)rb).clone();
         //Need to pull out the Row record and the Value records from their
         //Aggregates.
         //This is probably the best way to do it since we probably dont want the createSheet
@@ -452,10 +521,10 @@
         records.add( retval.createWSBool() );
         
         // 'Page Settings Block'
-        retval.rowBreaks = new PageBreakRecord(PageBreakRecord.HORIZONTAL_SID);
-        records.add(retval.rowBreaks);
-        retval.colBreaks = new PageBreakRecord(PageBreakRecord.VERTICAL_SID);
-        records.add(retval.colBreaks);
+        retval._rowBreaksRecord = new HorizontalPageBreakRecord();
+        records.add(retval._rowBreaksRecord);
+        retval._columnBreaksRecord = new VerticalPageBreakRecord();
+        records.add(retval._columnBreaksRecord);
 
         retval.header = createHeader();
         records.add( retval.header );
@@ -473,7 +542,7 @@
         records.add( retval.defaultcolwidth);
         ColumnInfoRecordsAggregate columns = new ColumnInfoRecordsAggregate();
         records.add( columns );
-        retval.columns = columns;
+        retval._columnInfos = columns;
         retval.dims    =  createDimensions();
         records.add(retval.dims);
         retval.dimsloc = records.size()-1;
@@ -509,14 +578,23 @@
 
     private void checkRows()
     {
-        if (rows == null)
+        if (_rowsAggregate == null)
         {
-            rows = new RowRecordsAggregate();
-            records.add(getDimsLoc() + 1, rows);
+            _rowsAggregate = new RowRecordsAggregate();
+            records.add(getDimsLoc() + 1, _rowsAggregate);
         }
     }
+    private MergedCellsTable getMergedRecords() {
+    	if (_mergedCellsTable == null) {
+    		MergedCellsTable mct = new MergedCellsTable();
+    		RecordOrderer.addNewSheetRecord(records, mct);
+    		_mergedCellsTable = mct;
+    	}
+    	return _mergedCellsTable;
+    }
+
 
-    public int addMergedRegion(int rowFrom, int colFrom, int rowTo, int colTo) {
+	public int addMergedRegion(int rowFrom, int colFrom, int rowTo, int colTo) {
         // Validate input
         if (rowTo < rowFrom) {
             throw new IllegalArgumentException("The 'to' row (" + rowTo
@@ -527,159 +605,57 @@
                     + ") must not be less than the 'from' col (" + colFrom + ")");
         }
 
-        if (merged == null || merged.getNumAreas() == 1027)
-        {
-            merged = createMergedCells();
-            mergedRecords.add(merged);
-            records.add(records.size() - 1, merged);
-        }
-        merged.addArea(rowFrom, colFrom, rowTo, colTo);
-        return numMergedRegions++;
+        MergedCellsTable mrt = getMergedRecords();
+		mrt.addArea(rowFrom, colFrom, rowTo, colTo);
+        return mrt.getNumberOfMergedRegions()-1;
     }
 
     public void removeMergedRegion(int index)
     {
         //safety checks
-        if (index >= numMergedRegions || mergedRecords.size() == 0)
-           return;
-
-        int pos = 0;
-        int startNumRegions = 0;
-
-        //optimisation for current record
-        if (numMergedRegions - index < merged.getNumAreas())
-        {
-            pos = mergedRecords.size() - 1;
-            startNumRegions = numMergedRegions - merged.getNumAreas();
-        }
-        else
-        {
-            for (int n = 0; n < mergedRecords.size(); n++)
-            {
-                MergeCellsRecord record = (MergeCellsRecord) mergedRecords.get(n);
-                if (startNumRegions + record.getNumAreas() > index)
-                {
-                    pos = n;
-                    break;
-                }
-                startNumRegions += record.getNumAreas();
-            }
-        }
-
-        MergeCellsRecord rec = (MergeCellsRecord) mergedRecords.get(pos);
-        rec.removeAreaAt(index - startNumRegions);
-        numMergedRegions--;
-        if (rec.getNumAreas() == 0)
-        {
-            mergedRecords.remove(pos);
-            //get rid of the record from the sheet
-            records.remove(merged);
-            if (merged == rec) {
-                //pull up the LAST record for operations when we finally
-                //support continue records for mergedRegions
-                if (mergedRecords.size() > 0) {
-                    merged = (MergeCellsRecord) mergedRecords.get(mergedRecords.size() - 1);
-                } else {
-                    merged = null;
-                }
-            }
-        }
+        MergedCellsTable mrt = getMergedRecords();
+		if (index >= mrt.getNumberOfMergedRegions()) {
+			return;
+		}
+		mrt.remove(index);
     }
 
-    public CellRangeAddress getMergedRegionAt(int index)
-    {
+    public CellRangeAddress getMergedRegionAt(int index) {
         //safety checks
-        if (index >= numMergedRegions || mergedRecords.size() == 0)
-            return null;
-
-        int pos = 0;
-        int startNumRegions = 0;
-
-        //optimisation for current record
-        if (numMergedRegions - index < merged.getNumAreas())
-        {
-            pos = mergedRecords.size() - 1;
-            startNumRegions = numMergedRegions - merged.getNumAreas();
-        }
-        else
-        {
-            for (int n = 0; n < mergedRecords.size(); n++)
-            {
-                MergeCellsRecord record = (MergeCellsRecord) mergedRecords.get(n);
-                if (startNumRegions + record.getNumAreas() > index)
-                {
-                    pos = n;
-                    break;
-                }
-                startNumRegions += record.getNumAreas();
-            }
-        }
-        return ((MergeCellsRecord) mergedRecords.get(pos)).getAreaAt(index - startNumRegions);
+        MergedCellsTable mrt = getMergedRecords();
+		if (index >=  mrt.getNumberOfMergedRegions()) {
+			return null;
+		}
+		return mrt.get(index);
     }
 
-    public int getNumMergedRegions()
-    {
-        return numMergedRegions;
+    public int getNumMergedRegions() {
+        return getMergedRecords().getNumberOfMergedRegions();
+    }
+    private ConditionalFormattingTable getConditionalFormattingTable() {
+    	if (condFormatting == null) {
+        	condFormatting = new ConditionalFormattingTable();
+        	RecordOrderer.addNewSheetRecord(records, condFormatting);
+    	}
+		return condFormatting;
     }
-    // Find correct position to add new CF record
-    private int findConditionalFormattingPosition()
-    {
-        // This is default.
-        // If the algorithm does not find the right position,
-        // this one will be used (this is a position before EOF record)
-        int index = records.size()-2;
-
-        for( int i=index; i>=0; i-- )
-        {
-            Record rec = (Record)records.get(i);
-            short sid = rec.getSid();
-
-            // CFRecordsAggregate records already exist, just add to the end
-            if (rec instanceof CFRecordsAggregate)    { return i+1; }
 
-            if( sid == (short)0x00ef )                { return i+1; }// PHONETICPR
-            if( sid == (short)0x015f )                { return i+1; }// LABELRANGES
-            if( sid == MergeCellsRecord.sid )        { return i+1; }
-            if( sid == (short)0x0099 )                { return i+1; }// STANDARDWIDTH
-            if( sid == SelectionRecord.sid )        { return i+1; }
-            if( sid == PaneRecord.sid )                { return i+1; }
-            if( sid == SCLRecord.sid )                 { return i+1; }
-            if( sid == WindowTwoRecord.sid )        { return i+1; }
-        }
 
-        return index;
+	public int addConditionalFormatting(CFRecordsAggregate cfAggregate) {
+		ConditionalFormattingTable cft = getConditionalFormattingTable();
+        return cft.add(cfAggregate);
     }
 
-    public int addConditionalFormatting(CFRecordsAggregate cfAggregate)
-    {
-        int index = findConditionalFormattingPosition();
-        records.add(index, cfAggregate);
-        condFormatting.add(cfAggregate);
-        return condFormatting.size()-1;
+    public void removeConditionalFormatting(int index) {
+    	getConditionalFormattingTable().remove(index);
     }
 
-    public void removeConditionalFormatting(int index)
-    {
-        if (index >= 0 && index <= condFormatting.size()-1 )
-        {
-            CFRecordsAggregate cfAggregate = getCFRecordsAggregateAt(index);
-            records.remove(cfAggregate);
-            condFormatting.remove(index);
-        }
-    }
-
-    public CFRecordsAggregate getCFRecordsAggregateAt(int index)
-    {
-        if (index >= 0 && index <= condFormatting.size()-1 )
-        {
-            return (CFRecordsAggregate) condFormatting.get(index);
-        }
-        return null;
+    public CFRecordsAggregate getCFRecordsAggregateAt(int index) {
+    	return getConditionalFormattingTable().get(index);
     }
 
-    public int getNumConditionalFormattings()
-    {
-        return condFormatting.size();
+    public int getNumConditionalFormattings() {
+        return getConditionalFormattingTable().size();
     }
 
     /**
@@ -699,13 +675,13 @@
             log.logFormatted(POILogger.DEBUG, "returning % + % + % - 2 = %", new int[]
             {
                 records.size(), cells.getPhysicalNumberOfCells(),
-                rows.getPhysicalNumberOfRows(),
+                _rowsAggregate.getPhysicalNumberOfRows(),
                 records.size() + cells.getPhysicalNumberOfCells()
-                + rows.getPhysicalNumberOfRows() - 2
+                + _rowsAggregate.getPhysicalNumberOfRows() - 2
             });
         }
         return records.size() + cells.getPhysicalNumberOfCells()
-               + rows.getPhysicalNumberOfRows() - 2;
+               + _rowsAggregate.getPhysicalNumberOfRows() - 2;
     }
 
     /**
@@ -814,7 +790,7 @@
 
         for (int k = 0; k < records.size(); k++)
         {
-            Record record = (( Record ) records.get(k));
+        	RecordBase record = (RecordBase) records.get(k);
 
             // Don't write out UncalcedRecord entries, as
             //  we handle those specially just below
@@ -833,7 +809,7 @@
             }
 
             // If the BOF record was just serialized then add the IndexRecord
-            if (record.getSid() == BOFRecord.sid) {
+            if (record instanceof BOFRecord) {
               if (!haveSerializedIndex) {
                 haveSerializedIndex = true;
                 // Add an optional UncalcedRecord. However, we should add
@@ -846,7 +822,7 @@
                 }
                 //Can there be more than one BOF for a sheet? If not then we can
                 //remove this guard. So be safe it is left here.
-                if (rows != null) {
+                if (_rowsAggregate != null) {
                   pos += serializeIndexRecord(k, pos, data);
                 }
               }
@@ -865,8 +841,8 @@
     private int serializeIndexRecord(final int bofRecordIndex, final int indexRecordOffset,
             byte[] data) {
         IndexRecord index = new IndexRecord();
-        index.setFirstRow(rows.getFirstRowNum());
-        index.setLastRowAdd1(rows.getLastRowNum() + 1);
+        index.setFirstRow(_rowsAggregate.getFirstRowNum());
+        index.setLastRowAdd1(_rowsAggregate.getLastRowNum() + 1);
         // Calculate the size of the records from the end of the BOF
         // and up to the RowRecordsAggregate...
 
@@ -874,7 +850,7 @@
         int sizeOfInitialSheetRecords = 0;
         // start just after BOF record (INDEX is not present in this list)
         for (int j = bofRecordIndex + 1; j < records.size(); j++) {
-            Record tmpRec = ((Record) records.get(j));
+            RecordBase tmpRec = ((RecordBase) records.get(j));
             if (tmpRec instanceof UncalcedRecord) {
                 continue;
             }
@@ -891,7 +867,7 @@
         // Note: The offsets are relative to the Workbook BOF. Assume that this is
         // 0 for now.....
 
-        int blockCount = rows.getRowBlockCount();
+        int blockCount = _rowsAggregate.getRowBlockCount();
         // Calculate the size of this IndexRecord
         int indexRecSize = IndexRecord.getRecordSizeForBlockCount(blockCount);
 
@@ -902,15 +878,15 @@
             // The offset of each DBCELL record needs to be updated in the INDEX record
 
             // account for row records in this row-block
-            currentOffset += rows.getRowBlockSize(block);
+            currentOffset += _rowsAggregate.getRowBlockSize(block);
             // account for cell value records after those
-            currentOffset += null == cells ? 0 : cells.getRowCellBlockSize(rows
-                    .getStartRowNumberForBlock(block), rows.getEndRowNumberForBlock(block));
+            currentOffset += null == cells ? 0 : cells.getRowCellBlockSize(_rowsAggregate
+                    .getStartRowNumberForBlock(block), _rowsAggregate.getEndRowNumberForBlock(block));
 
             // currentOffset is now the location of the DBCELL record for this row-block
             index.addDbcell(currentOffset);
             // Add space required to write the DBCELL record (whose reference was just added).
-            currentOffset += (8 + (rows.getRowCountForBlock(block) * 2));
+            currentOffset += (8 + (_rowsAggregate.getRowCountForBlock(block) * 2));
         }
         return index.serialize(indexRecordOffset, data);
     }
@@ -1031,11 +1007,11 @@
         }
         //IndexRecord index = null;
          //If the row exists remove it, so that any cells attached to the row are removed
-         RowRecord existingRow = rows.getRow(row.getRowNumber());
+         RowRecord existingRow = _rowsAggregate.getRow(row.getRowNumber());
          if (existingRow != null)
-           rows.removeRow(existingRow);
+           _rowsAggregate.removeRow(existingRow);
 
-        rows.insertRow(row);
+        _rowsAggregate.insertRow(row);
 
         if (log.check( POILogger.DEBUG ))
             log.log(POILogger.DEBUG, "exit addRow");
@@ -1054,7 +1030,7 @@
         checkRows();
 
         setLoc(getDimsLoc());
-        rows.removeRow(row);
+        _rowsAggregate.removeRow(row);
     }
 
     /**
@@ -1108,7 +1084,7 @@
             log.log(POILogger.DEBUG, "getNextRow loc= " + loc);
         if (rowRecIterator == null)
         {
-            rowRecIterator = rows.getIterator();
+            rowRecIterator = _rowsAggregate.getIterator();
         }
         if (!rowRecIterator.hasNext())
         {
@@ -1136,7 +1112,7 @@
     public RowRecord getRow(int rownum) {
         if (log.check( POILogger.DEBUG ))
             log.log(POILogger.DEBUG, "getNextRow loc= " + loc);
-        return rows.getRow(rownum);
+        return _rowsAggregate.getRow(rownum);
     }
 
     /**
@@ -1258,6 +1234,15 @@
         retval.setColLevelMax(( short ) 0);
         return retval;
     }
+    private GutsRecord getGutsRecord() {
+    	if (_gutsRecord == null) {
+    		GutsRecord result = createGuts();
+    		RecordOrderer.addNewSheetRecord(records, result);
+			_gutsRecord = result;
+		}
+
+		return _gutsRecord;
+    }
 
     /**
      * creates the DefaultRowHeight Record and sets its options to 0 and rowheight to 0xff
@@ -1422,43 +1407,22 @@
 
     /**
      * get the width of a given column in units of 1/256th of a character width
-     * @param column index
+     * @param columnIndex index
      * @see org.apache.poi.hssf.record.DefaultColWidthRecord
      * @see org.apache.poi.hssf.record.ColumnInfoRecord
      * @see #setColumnWidth(short,short)
      * @return column width in units of 1/256th of a character width
      */
 
-    public short getColumnWidth(short column)
-    {
-        short            retval = 0;
-        ColumnInfoRecord ci     = null;
+    public short getColumnWidth(short columnIndex) {
 
-        if (columns != null)
-        {
-            int count=columns.getNumColumns();
-            for ( int k=0;k<count;k++ )
-            {
-                ci = columns.getColInfo(k);
-                if ((ci.getFirstColumn() <= column)
-                        && (column <= ci.getLastColumn()))
-                {
-                    break;
-                }
-                ci = null;
-            }
-        }
-        if (ci != null)
-        {
-            retval = ci.getColumnWidth();
-        }
-        else
-        {
-            //default column width is measured in characters
-            //multiply
-            retval = (short)(256*defaultcolwidth.getColWidth());
-        }
-        return retval;
+        ColumnInfoRecord ci = _columnInfos.findColumnInfo(columnIndex);
+        if (ci != null) {
+        	return ci.getColumnWidth();
+        }
+        //default column width is measured in characters
+        //multiply
+        return (short)(256*defaultcolwidth.getColWidth());
     }
 
     /**
@@ -1470,37 +1434,28 @@
      * Returns the index to the default ExtendedFormatRecord (0xF)
      * if no ColumnInfoRecord exists that includes the column
      * index specified.
-     * @param column
+     * @param columnIndex
      * @return index of ExtendedFormatRecord associated with
      * ColumnInfoRecord that includes the column index or the
      * index of the default ExtendedFormatRecord (0xF)
      */
-    public short getXFIndexForColAt(short column) {
-        short retval = 0;
-        ColumnInfoRecord ci = null;
-        if (columns != null) {
-          int count=columns.getNumColumns();
-          for ( int k=0;k<count;k++ )
-          {
-                ci = columns.getColInfo(k);
-                if ((ci.getFirstColumn() <= column)
-                        && (column <= ci.getLastColumn())) {
-                    break;
-                }
-                ci = null;
-            }
-        }
-        retval = (ci != null) ? ci.getXFIndex() : 0xF;
-        return retval;
-    }
-
-    /**
-     * set the width for a given column in 1/256th of a character width units
-     * @param column - the column number
-     * @param width (in units of 1/256th of a character width)
-     */
-    public void setColumnWidth(short column, short width)
-    {
+    public short getXFIndexForColAt(short columnIndex) {
+        ColumnInfoRecord ci = _columnInfos.findColumnInfo(columnIndex);
+        if (ci != null) {
+            return ci.getXFIndex();
+ 	    }
+	    return 0xF;
+	}
+
+    /**
+	 * set the width for a given column in 1/256th of a character width units
+	 * 
+	 * @param column -
+	 *            the column number
+	 * @param width
+	 *            (in units of 1/256th of a character width)
+	 */
+    public void setColumnWidth(short column, short width) {
         setColumn( column, new Short(width), null, null, null);
     }
 
@@ -1512,30 +1467,12 @@
      * @see #setColumnHidden(short,boolean)
      * @return whether the column is hidden or not.
      */
-
-    public boolean isColumnHidden(short column)
-    {
-        boolean          retval = false;
-        ColumnInfoRecord ci     = null;
-
-        if (columns != null)
-        {
-            for ( Iterator iterator = columns.getIterator(); iterator.hasNext(); )
-            {
-                ci = ( ColumnInfoRecord ) iterator.next();
-                if ((ci.getFirstColumn() <= column)
-                        && (column <= ci.getLastColumn()))
-                {
-                    break;
-                }
-                ci = null;
-            }
-        }
-        if (ci != null)
-        {
-            retval = ci.getHidden();
-        }
-        return retval;
+    public boolean isColumnHidden(short columnIndex) {
+    	ColumnInfoRecord cir = _columnInfos.findColumnInfo(columnIndex);
+    	if (cir == null) {
+    		return false;
+    	}
+    	return cir.getHidden();
     }
 
     /**
@@ -1548,20 +1485,12 @@
         setColumn( column, null, null, new Boolean(hidden), null);
     }
 
-    public void setColumn(short column, Short width, Integer level, Boolean hidden, Boolean collapsed)
-    {
-        if (columns == null)
-            columns = new ColumnInfoRecordsAggregate();
-
-        columns.setColumn( column, null, width, level, hidden, collapsed );
+    public void setColumn(short column, Short width, Integer level, Boolean hidden, Boolean collapsed) {
+        _columnInfos.setColumn( column, null, width, level, hidden, collapsed );
     }
 
-    public void setColumn(short column, Short xfStyle, Short width, Integer level, Boolean hidden, Boolean collapsed)
-    {
-        if (columns == null)
-            columns = new ColumnInfoRecordsAggregate();
-
-        columns.setColumn( column, xfStyle, width, level, hidden, collapsed );
+    public void setColumn(short column, Short xfStyle, Short width, Integer level, Boolean hidden, Boolean collapsed) {
+        _columnInfos.setColumn( column, xfStyle, width, level, hidden, collapsed );
     }
 
 
@@ -1576,18 +1505,12 @@
     {
 
         // Set the level for each column
-        columns.groupColumnRange( fromColumn, toColumn, indent);
+        _columnInfos.groupColumnRange( fromColumn, toColumn, indent);
 
         // Determine the maximum overall level
-        int maxLevel = 0;
-        int count=columns.getNumColumns();
-        for ( int k=0;k<count;k++ )
-        {
-            ColumnInfoRecord columnInfoRecord = columns.getColInfo(k);
-            maxLevel = Math.max(columnInfoRecord.getOutlineLevel(), maxLevel);
-        }
+        int maxLevel = _columnInfos.getMaxOutlineLevel();
 
-        GutsRecord guts = (GutsRecord) findFirstRecordBySid( GutsRecord.sid );
+        GutsRecord guts = getGutsRecord();
         guts.setColLevelMax( (short) ( maxLevel+1 ) );
         if (maxLevel == 0) {
             guts.setTopColGutter( (short)0 );
@@ -1721,10 +1644,6 @@
         }
     }
 
-    private static  MergeCellsRecord createMergedCells() {
-        return new MergeCellsRecord();
-    }
-
     /**
      * get the location of the DimensionsRecord (which is the last record before the value section)
      * @return location in the array of records of the DimensionsRecord
@@ -1750,24 +1669,27 @@
         }
     }
 
+    /**
+     * @return the serialized size of this sheet
+     */
     public int getSize()
     {
         int retval = 0;
 
         for ( int k = 0; k < records.size(); k++) {
-            Record record = (Record) records.get(k);
+        	RecordBase record = (RecordBase) records.get(k);
             if (record instanceof UncalcedRecord) {
                 // skip the UncalcedRecord if present, it's only encoded if the isUncalced flag is set
                 continue;
             }
             retval += record.getRecordSize();
         }
-        if (rows != null) {
+        if (_rowsAggregate != null) {
             // Add space for the IndexRecord and DBCell records
-            final int nBlocks = rows.getRowBlockCount();
+            final int nBlocks = _rowsAggregate.getRowBlockCount();
             int nRows = 0;
             if (cells != null) {
-                for (Iterator itr = rows.getIterator(); itr.hasNext();) {
+                for (Iterator itr = _rowsAggregate.getIterator(); itr.hasNext();) {
                     RowRecord row = (RowRecord)itr.next();
                     if (cells.rowHasCells(row.getRowNumber())) {
                         nRows++;
@@ -1804,16 +1726,11 @@
 
     public Record findFirstRecordBySid(short sid)
     {
-        for (Iterator iterator = records.iterator(); iterator.hasNext(); )
-        {
-            Record record = ( Record ) iterator.next();
-
-            if (record.getSid() == sid)
-            {
-                return record;
-            }
-        }
-        return null;
+    	int ix = findFirstRecordLocBySid(sid);
+    	if (ix < 0) {
+    		return null;
+    	}
+    	return (Record) records.get(ix);
     }
 
     /**
@@ -1839,24 +1756,23 @@
     }
 
     /**
-     * Finds the first occurance of a record matching a particular sid and
+     * Finds the first occurrence of a record matching a particular sid and
      * returns it's position.
      * @param sid   the sid to search for
      * @return  the record position of the matching record or -1 if no match
      *          is made.
      */
-    public int findFirstRecordLocBySid( short sid )
-    {
-        int index = 0;
-        for (Iterator iterator = records.iterator(); iterator.hasNext(); )
-        {
-            Record record = ( Record ) iterator.next();
-
-            if (record.getSid() == sid)
-            {
-                return index;
+    public int findFirstRecordLocBySid( short sid ) { // TODO - remove this method
+        int max = records.size();
+        for (int i=0; i< max; i++) {
+        	Object rb = records.get(i);
+            if (!(rb instanceof Record)) {
+            	continue;
+            }
+            Record record = (Record) rb;
+            if (record.getSid() == sid) {
+                return i;
             }
-            index++;
         }
         return -1;
     }
@@ -2324,7 +2240,7 @@
     {
         for ( Iterator iterator = getRecords().iterator(); iterator.hasNext(); )
         {
-            Record r = (Record) iterator.next();
+            RecordBase r = (RecordBase) iterator.next();
             if (r instanceof EscherAggregate)
                 r.getRecordSize();   // Trigger flatterning of user model and corresponding update of dgg record.
         }
@@ -2337,16 +2253,14 @@
      * @param stop Ending "main" value to shift breaks
      * @param count number of units (rows/columns) to shift by
      */
-    public void shiftBreaks(PageBreakRecord breaks, short start, short stop, int count) {
+    private static void shiftBreaks(PageBreakRecord breaks, int start, int stop, int count) {
 
-        if(rowBreaks == null)
-            return;
         Iterator iterator = breaks.getBreaksIterator();
         List shiftedBreak = new ArrayList();
         while(iterator.hasNext())
         {
             PageBreakRecord.Break breakItem = (PageBreakRecord.Break)iterator.next();
-            short breakLocation = breakItem.main;
+            int breakLocation = breakItem.main;
             boolean inStart = (breakLocation >= start);
             boolean inEnd = (breakLocation <= stop);
             if(inStart && inEnd)
@@ -2361,17 +2275,31 @@
         }
     }
 
+    private PageBreakRecord getRowBreaksRecord() {
+    	if (_rowBreaksRecord == null) {
+			_rowBreaksRecord = new HorizontalPageBreakRecord();
+			RecordOrderer.addNewSheetRecord(records, _rowBreaksRecord);
+			dimsloc++;
+		}
+		return _rowBreaksRecord;
+    }
+    
+    private PageBreakRecord getColumnBreaksRecord() {
+    	if (_columnBreaksRecord == null) {
+    		_columnBreaksRecord = new VerticalPageBreakRecord();
+			RecordOrderer.addNewSheetRecord(records, _columnBreaksRecord);
+			dimsloc++;
+		}
+		return _columnBreaksRecord;
+    }
+    
+    
     /**
      * Sets a page break at the indicated row
      * @param row
      */
     public void setRowBreak(int row, short fromCol, short toCol) {
-        if (rowBreaks == null) {
-            int loc = findFirstRecordLocBySid(WindowTwoRecord.sid);
-            rowBreaks = new PageBreakRecord(PageBreakRecord.HORIZONTAL_SID);
-            records.add(loc, rowBreaks);
-        }
-        rowBreaks.addBreak((short)row, fromCol, toCol);
+        getRowBreaksRecord().addBreak((short)row, fromCol, toCol);
     }
 
     /**
@@ -2379,9 +2307,9 @@
      * @param row
      */
     public void removeRowBreak(int row) {
-        if (rowBreaks == null)
+        if (getRowBreaks() == null)
             throw new IllegalArgumentException("Sheet does not define any row breaks");
-        rowBreaks.removeBreak((short)row);
+        getRowBreaksRecord().removeBreak((short)row);
     }
 
     /**
@@ -2390,7 +2318,7 @@
      * @return true if the specified row has a page break
      */
     public boolean isRowBroken(int row) {
-        return (rowBreaks == null) ? false : rowBreaks.getBreak((short)row) != null;
+        return getRowBreaksRecord().getBreak(row) != null;
     }
 
     /**
@@ -2398,12 +2326,7 @@
      *
      */
     public void setColumnBreak(short column, short fromRow, short toRow) {
-        if (colBreaks == null) {
-            int loc = findFirstRecordLocBySid(WindowTwoRecord.sid);
-            colBreaks = new PageBreakRecord(PageBreakRecord.VERTICAL_SID);
-            records.add(loc, colBreaks);
-        }
-        colBreaks.addBreak(column, fromRow, toRow);
+        getColumnBreaksRecord().addBreak(column, fromRow, toRow);
     }
 
     /**
@@ -2411,19 +2334,16 @@
      *
      */
     public void removeColumnBreak(short column) {
-        if (colBreaks == null)
-            throw new IllegalArgumentException("Sheet does not define any column breaks");
-
-        colBreaks.removeBreak(column);
+    	getColumnBreaksRecord().removeBreak(column);
     }
 
     /**
      * Queries if the specified column has a page break
      *
-     * @return true if the specified column has a page break
+     * @return <code>true</code> if the specified column has a page break
      */
     public boolean isColumnBroken(short column) {
-        return (colBreaks == null) ? false : colBreaks.getBreak(column) != null;
+        return getColumnBreaksRecord().getBreak(column) != null;
     }
 
     /**
@@ -2433,7 +2353,7 @@
      * @param count
      */
     public void shiftRowBreaks(int startingRow, int endingRow, int count) {
-        shiftBreaks(rowBreaks, (short)startingRow, (short)endingRow, (short)count);
+        shiftBreaks(getRowBreaksRecord(), startingRow, endingRow, count);
     }
 
     /**
@@ -2443,50 +2363,46 @@
      * @param count
      */
     public void shiftColumnBreaks(short startingCol, short endingCol, short count) {
-        shiftBreaks(colBreaks, startingCol, endingCol, count);
+        shiftBreaks(getColumnBreaksRecord(), startingCol, endingCol, count);
     }
 
     /**
-     * Returns all the row page breaks
-     * @return all the row page breaks
+     * @return all the horizontal page breaks, never <code>null</code>
      */
-    public Iterator getRowBreaks() {
-        return rowBreaks.getBreaksIterator();
+    public int[] getRowBreaks() {
+        return getRowBreaksRecord().getBreaks();
     }
 
     /**
-     * Returns the number of row page breaks
      * @return the number of row page breaks
      */
     public int getNumRowBreaks(){
-        return (rowBreaks == null) ? 0 : (int)rowBreaks.getNumBreaks();
+        return getRowBreaksRecord().getNumBreaks();
     }
 
     /**
-     * Returns all the column page breaks
-     * @return all the column page breaks
+     * @return all the column page breaks, never <code>null</code>
      */
-    public Iterator getColumnBreaks(){
-        return colBreaks.getBreaksIterator();
+    public int[] getColumnBreaks(){
+        return getColumnBreaksRecord().getBreaks();
     }
 
     /**
-     * Returns the number of column page breaks
      * @return the number of column page breaks
      */
     public int getNumColumnBreaks(){
-        return (colBreaks == null) ? 0 : (int)colBreaks.getNumBreaks();
+        return getColumnBreaksRecord().getNumBreaks();
     }
 
     public void setColumnGroupCollapsed( short columnNumber, boolean collapsed )
     {
         if (collapsed)
         {
-            columns.collapseColumn( columnNumber );
+            _columnInfos.collapseColumn( columnNumber );
         }
         else
         {
-            columns.expandColumn( columnNumber );
+            _columnInfos.expandColumn( columnNumber );
         }
     }
 
@@ -2577,7 +2493,7 @@
     private void recalcRowGutter()
     {
         int maxLevel = 0;
-        Iterator iterator = rows.getIterator();
+        Iterator iterator = _rowsAggregate.getIterator();
         while ( iterator.hasNext() )
         {
             RowRecord rowRecord = (RowRecord) iterator.next();
@@ -2585,11 +2501,7 @@
         }
 
         // Grab the guts record, adding if needed
-        GutsRecord guts = (GutsRecord) findFirstRecordBySid( GutsRecord.sid );
-        if(guts == null) {
-            guts = new GutsRecord();
-            records.add(guts);
-        }
+        GutsRecord guts = getGutsRecord();
         // Set the levels onto it
         guts.setRowLevelMax( (short) ( maxLevel + 1 ) );
         guts.setLeftRowGutter( (short) ( 29 + (12 * (maxLevel)) ) );
@@ -2599,16 +2511,18 @@
     {
         if (collapse)
         {
-            rows.collapseRow( row );
+            _rowsAggregate.collapseRow( row );
         }
         else
         {
-            rows.expandRow( row );
+            _rowsAggregate.expandRow( row );
         }
     }
     public DataValidityTable getOrCreateDataValidityTable() {
         if (_dataValidityTable == null) {
-            _dataValidityTable = DataValidityTable.createForSheet(records);
+    		DataValidityTable result = new DataValidityTable();
+    		RecordOrderer.addNewSheetRecord(records, result);
+            _dataValidityTable = result;
         }
         return _dataValidityTable;
     }

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java?rev=683670&r1=683669&r2=683670&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java Thu Aug  7 11:21:32 2008
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,13 +14,13 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.hssf.record;
 
-
-
-import org.apache.poi.util.*;
+import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
+import org.apache.poi.util.HexDump;
+import org.apache.poi.util.LittleEndian;
 
 /**
  * The area format record is used to define the colours and patterns for an area.
@@ -30,16 +29,16 @@
 
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public class AreaFormatRecord
-    extends Record
-{
-    public final static short      sid                             = 0x100a;
+public final class AreaFormatRecord extends Record {
+    public final static short sid = 0x100A;
+    
+    private static final BitField automatic = BitFieldFactory.getInstance(0x1);
+    private static final BitField invert    = BitFieldFactory.getInstance(0x2);
+    
     private  int        field_1_foregroundColor;
     private  int        field_2_backgroundColor;
     private  short      field_3_pattern;
     private  short      field_4_formatFlags;
-    private  BitField   automatic                                   = BitFieldFactory.getInstance(0x1);
-    private  BitField   invert                                      = BitFieldFactory.getInstance(0x2);
     private  short      field_5_forecolorIndex;
     private  short      field_6_backcolorIndex;
 
@@ -297,10 +296,4 @@
     {
         return invert.isSet(field_4_formatFlags);
     }
-
-
-}  // END OF CLASS
-
-
-
-
+}

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/record/AreaRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/record/AreaRecord.java?rev=683670&r1=683669&r2=683670&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/record/AreaRecord.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/record/AreaRecord.java Thu Aug  7 11:21:32 2008
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,13 +14,13 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.hssf.record;
 
-
-
-import org.apache.poi.util.*;
+import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
+import org.apache.poi.util.HexDump;
+import org.apache.poi.util.LittleEndian;
 
 /**
  * The area record is used to define a area chart.
@@ -30,14 +29,12 @@
 
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public class AreaRecord
-    extends Record
-{
+public final class AreaRecord extends Record {
     public final static short      sid                             = 0x101A;
     private  short      field_1_formatFlags;
-    private  BitField   stacked                                     = BitFieldFactory.getInstance(0x1);
-    private  BitField   displayAsPercentage                         = BitFieldFactory.getInstance(0x2);
-    private  BitField   shadow                                      = BitFieldFactory.getInstance(0x4);
+    private static final BitField stacked             = BitFieldFactory.getInstance(0x1);
+    private static final BitField displayAsPercentage = BitFieldFactory.getInstance(0x2);
+    private static final BitField shadow              = BitFieldFactory.getInstance(0x4);
 
 
     public AreaRecord()
@@ -197,10 +194,4 @@
     {
         return shadow.isSet(field_1_formatFlags);
     }
-
-
-}  // END OF CLASS
-
-
-
-
+}

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java?rev=683670&r1=683669&r2=683670&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java Thu Aug  7 11:21:32 2008
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,13 +14,13 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.hssf.record;
 
-
-
-import org.apache.poi.util.*;
+import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
+import org.apache.poi.util.HexDump;
+import org.apache.poi.util.LittleEndian;
 
 /**
  * The axis options record provides unit information and other various tidbits about the axis.
@@ -30,27 +29,27 @@
 
  * @author Andrew C. Oliver(acoliver at apache.org)
  */
-public class AxisOptionsRecord
-    extends Record
-{
-    public final static short      sid                             = 0x1062;
-    private  short      field_1_minimumCategory;
-    private  short      field_2_maximumCategory;
-    private  short      field_3_majorUnitValue;
-    private  short      field_4_majorUnit;
-    private  short      field_5_minorUnitValue;
-    private  short      field_6_minorUnit;
-    private  short      field_7_baseUnit;
-    private  short      field_8_crossingPoint;
-    private  short      field_9_options;
-    private  BitField   defaultMinimum                              = BitFieldFactory.getInstance(0x1);
-    private  BitField   defaultMaximum                              = BitFieldFactory.getInstance(0x2);
-    private  BitField   defaultMajor                                = BitFieldFactory.getInstance(0x4);
-    private  BitField   defaultMinorUnit                            = BitFieldFactory.getInstance(0x8);
-    private  BitField   isDate                                      = BitFieldFactory.getInstance(0x10);
-    private  BitField   defaultBase                                 = BitFieldFactory.getInstance(0x20);
-    private  BitField   defaultCross                                = BitFieldFactory.getInstance(0x40);
-    private  BitField   defaultDateSettings                         = BitFieldFactory.getInstance(0x80);
+public final class AxisOptionsRecord extends Record {
+    public final static short sid = 0x1062;
+
+    private static final BitField defaultMinimum      = BitFieldFactory.getInstance(0x01);
+    private static final BitField defaultMaximum      = BitFieldFactory.getInstance(0x02);
+    private static final BitField defaultMajor        = BitFieldFactory.getInstance(0x04);
+    private static final BitField defaultMinorUnit    = BitFieldFactory.getInstance(0x08);
+    private static final BitField isDate              = BitFieldFactory.getInstance(0x10);
+    private static final BitField defaultBase         = BitFieldFactory.getInstance(0x20);
+    private static final BitField defaultCross        = BitFieldFactory.getInstance(0x40);
+    private static final BitField defaultDateSettings = BitFieldFactory.getInstance(0x80);
+
+    private short field_1_minimumCategory;
+    private short field_2_maximumCategory;
+    private short field_3_majorUnitValue;
+    private short field_4_majorUnit;
+    private short field_5_minorUnitValue;
+    private short field_6_minorUnit;
+    private short field_7_baseUnit;
+    private short field_8_crossingPoint;
+    private short field_9_options;
 
 
     public AxisOptionsRecord()
@@ -488,10 +487,4 @@
     {
         return defaultDateSettings.isSet(field_9_options);
     }
-
-
-}  // END OF CLASS
-
-
-
-
+}

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/record/BarRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/record/BarRecord.java?rev=683670&r1=683669&r2=683670&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/record/BarRecord.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/record/BarRecord.java Thu Aug  7 11:21:32 2008
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,13 +14,13 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.hssf.record;
 
-
-
-import org.apache.poi.util.*;
+import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
+import org.apache.poi.util.HexDump;
+import org.apache.poi.util.LittleEndian;
 
 /**
  * The bar record is used to define a bar chart.
@@ -30,17 +29,17 @@
 
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public class BarRecord
-    extends Record
-{
-    public final static short      sid                             = 0x1017;
+public final class BarRecord extends Record {
+    public final static short sid = 0x1017;
+
+    private static final BitField   horizontal          = BitFieldFactory.getInstance(0x1);
+    private static final BitField   stacked             = BitFieldFactory.getInstance(0x2);
+    private static final BitField   displayAsPercentage = BitFieldFactory.getInstance(0x4);
+    private static final BitField   shadow              = BitFieldFactory.getInstance(0x8);
+
     private  short      field_1_barSpace;
     private  short      field_2_categorySpace;
     private  short      field_3_formatFlags;
-    private  BitField   horizontal                                  = BitFieldFactory.getInstance(0x1);
-    private  BitField   stacked                                     = BitFieldFactory.getInstance(0x2);
-    private  BitField   displayAsPercentage                         = BitFieldFactory.getInstance(0x4);
-    private  BitField   shadow                                      = BitFieldFactory.getInstance(0x8);
 
 
     public BarRecord()
@@ -264,10 +263,4 @@
     {
         return shadow.isSet(field_3_formatFlags);
     }
-
-
-}  // END OF CLASS
-
-
-
-
+}

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java?rev=683670&r1=683669&r2=683670&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java Thu Aug  7 11:21:32 2008
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,10 +14,10 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.hssf.record;
 
+import org.apache.poi.util.BitField;
 import org.apache.poi.util.BitFieldFactory;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.StringUtil;
@@ -33,12 +32,10 @@
  * @author Sergei Kozello (sergeikozello at mail.ru)
  * @version 2.0-pre
  */
+public final class BoundSheetRecord extends Record {
+    public final static short sid = 0x0085;
 
-public class BoundSheetRecord
-        extends Record
-{
-    private static final short HIDDEN_FLAG_MASK = 0x01;
-    public final static short sid = 0x85;
+	private static final BitField hiddenFlag = BitFieldFactory.getInstance(0x01);
     private int field_1_position_of_BOF;
     private short field_2_option_flags;
     private byte field_3_sheetname_length;
@@ -305,10 +302,10 @@
     }
 
     public boolean isHidden() {
-	    return BitFieldFactory.getInstance(HIDDEN_FLAG_MASK).isSet(field_2_option_flags);
+	    return hiddenFlag.isSet(field_2_option_flags);
     }
 
     public void setHidden(boolean hidden) {
-	    field_2_option_flags = BitFieldFactory.getInstance(HIDDEN_FLAG_MASK).setShortBoolean(field_2_option_flags, hidden);
+	    field_2_option_flags = hiddenFlag.setShortBoolean(field_2_option_flags, hidden);
     }
 }

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CFRuleRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CFRuleRecord.java?rev=683670&r1=683669&r2=683670&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CFRuleRecord.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CFRuleRecord.java Thu Aug  7 11:21:32 2008
@@ -31,8 +31,7 @@
  * Conditional Formatting Rule Record.
  * @author Dmitriy Kumshayev
  */
-public final class CFRuleRecord extends Record
-{
+public final class CFRuleRecord extends Record {
 
 	public static final short sid = 0x01B1;
 

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java?rev=683670&r1=683669&r2=683670&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java Thu Aug  7 11:21:32 2008
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,13 +14,13 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.hssf.record;
 
-
-
-import org.apache.poi.util.*;
+import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
+import org.apache.poi.util.HexDump;
+import org.apache.poi.util.LittleEndian;
 
 /**
  * This record refers to a category or series axis and is used to specify label/tickmark frequency.
@@ -30,17 +29,17 @@
 
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public class CategorySeriesAxisRecord
-    extends Record
-{
-    public final static short      sid                             = 0x1020;
+public final class CategorySeriesAxisRecord extends Record {
+    public final static short sid = 0x1020;
+
+    private static final BitField valueAxisCrossing = BitFieldFactory.getInstance(0x1);
+    private static final BitField crossesFarRight   = BitFieldFactory.getInstance(0x2);
+    private static final BitField reversed          = BitFieldFactory.getInstance(0x4);
+    
     private  short      field_1_crossingPoint;
     private  short      field_2_labelFrequency;
     private  short      field_3_tickMarkFrequency;
     private  short      field_4_options;
-    private  BitField   valueAxisCrossing                           = BitFieldFactory.getInstance(0x1);
-    private  BitField   crossesFarRight                             = BitFieldFactory.getInstance(0x2);
-    private  BitField   reversed                                    = BitFieldFactory.getInstance(0x4);
 
 
     public CategorySeriesAxisRecord()
@@ -268,10 +267,4 @@
     {
         return reversed.isSet(field_4_options);
     }
-
-
-}  // END OF CLASS
-
-
-
-
+}

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/record/ChartFormatRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/record/ChartFormatRecord.java?rev=683670&r1=683669&r2=683670&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/record/ChartFormatRecord.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/record/ChartFormatRecord.java Thu Aug  7 11:21:32 2008
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,13 +14,12 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.hssf.record;
 
-import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.BitField;
 import org.apache.poi.util.BitFieldFactory;
+import org.apache.poi.util.LittleEndian;
 
 /**
  * Class ChartFormatRecord
@@ -30,19 +28,17 @@
  * @author Glen Stampoultzis (glens at apache.org)
  * @version %I%, %G%
  */
-
-public class ChartFormatRecord
-    extends Record
-{
+public final class ChartFormatRecord extends Record {
     public static final short sid = 0x1014;
 
+    private static final BitField varyDisplayPattern = BitFieldFactory.getInstance(0x01);
+
     // ignored?
     private int               field1_x_position;   // lower left
     private int               field2_y_position;   // lower left
     private int               field3_width;
     private int               field4_height;
     private short             field5_grbit;
-    private BitField          varyDisplayPattern = BitFieldFactory.getInstance(0x01);
 
     public ChartFormatRecord()
     {

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java?rev=683670&r1=683669&r2=683670&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CommonObjectDataSubRecord.java Thu Aug  7 11:21:32 2008
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,63 +14,64 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.hssf.record;
 
-
-
-import org.apache.poi.util.*;
+import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
+import org.apache.poi.util.HexDump;
+import org.apache.poi.util.LittleEndian;
 
 /**
  * The common object data record is used to store all common preferences for an excel object.
  * NOTE: This source is automatically generated please do not modify this file.  Either subclass or
  *       remove the record in src/records/definitions.
-
+ *
  * @author Glen Stampoultzis (glens at apache.org)
  */
-public class CommonObjectDataSubRecord
-    extends SubRecord
-{
-    public final static short      sid                             = 0x15;
+public final class CommonObjectDataSubRecord extends SubRecord {
+    public final static short sid = 0x0015;
+
+    private static final BitField locked    = BitFieldFactory.getInstance(0x0001);
+    private static final BitField printable = BitFieldFactory.getInstance(0x0010);
+    private static final BitField autofill  = BitFieldFactory.getInstance(0x2000);
+    private static final BitField autoline  = BitFieldFactory.getInstance(0x4000);
+
+    public final static short OBJECT_TYPE_GROUP              = 0;
+    public final static short OBJECT_TYPE_LINE               = 1;
+    public final static short OBJECT_TYPE_RECTANGLE          = 2;
+    public final static short OBJECT_TYPE_OVAL               = 3;
+    public final static short OBJECT_TYPE_ARC                = 4;
+    public final static short OBJECT_TYPE_CHART              = 5;
+    public final static short OBJECT_TYPE_TEXT               = 6;
+    public final static short OBJECT_TYPE_BUTTON             = 7;
+    public final static short OBJECT_TYPE_PICTURE            = 8;
+    public final static short OBJECT_TYPE_POLYGON            = 9;
+    public final static short OBJECT_TYPE_RESERVED1          = 10;
+    public final static short OBJECT_TYPE_CHECKBOX           = 11;
+    public final static short OBJECT_TYPE_OPTION_BUTTON      = 12;
+    public final static short OBJECT_TYPE_EDIT_BOX           = 13;
+    public final static short OBJECT_TYPE_LABEL              = 14;
+    public final static short OBJECT_TYPE_DIALOG_BOX         = 15;
+    public final static short OBJECT_TYPE_SPINNER            = 16;
+    public final static short OBJECT_TYPE_SCROLL_BAR         = 17;
+    public final static short OBJECT_TYPE_LIST_BOX           = 18;
+    public final static short OBJECT_TYPE_GROUP_BOX          = 19;
+    public final static short OBJECT_TYPE_COMBO_BOX          = 20;
+    public final static short OBJECT_TYPE_RESERVED2          = 21;
+    public final static short OBJECT_TYPE_RESERVED3          = 22;
+    public final static short OBJECT_TYPE_RESERVED4          = 23;
+    public final static short OBJECT_TYPE_RESERVED5          = 24;
+    public final static short OBJECT_TYPE_COMMENT            = 25;
+    public final static short OBJECT_TYPE_RESERVED6          = 26;
+    public final static short OBJECT_TYPE_RESERVED7          = 27;
+    public final static short OBJECT_TYPE_RESERVED8          = 28;
+    public final static short OBJECT_TYPE_RESERVED9          = 29;
+    public final static short OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING = 30;
+    
     private  short      field_1_objectType;
-    public final static short       OBJECT_TYPE_GROUP              = 0;
-    public final static short       OBJECT_TYPE_LINE               = 1;
-    public final static short       OBJECT_TYPE_RECTANGLE          = 2;
-    public final static short       OBJECT_TYPE_OVAL               = 3;
-    public final static short       OBJECT_TYPE_ARC                = 4;
-    public final static short       OBJECT_TYPE_CHART              = 5;
-    public final static short       OBJECT_TYPE_TEXT               = 6;
-    public final static short       OBJECT_TYPE_BUTTON             = 7;
-    public final static short       OBJECT_TYPE_PICTURE            = 8;
-    public final static short       OBJECT_TYPE_POLYGON            = 9;
-    public final static short       OBJECT_TYPE_RESERVED1          = 10;
-    public final static short       OBJECT_TYPE_CHECKBOX           = 11;
-    public final static short       OBJECT_TYPE_OPTION_BUTTON      = 12;
-    public final static short       OBJECT_TYPE_EDIT_BOX           = 13;
-    public final static short       OBJECT_TYPE_LABEL              = 14;
-    public final static short       OBJECT_TYPE_DIALOG_BOX         = 15;
-    public final static short       OBJECT_TYPE_SPINNER            = 16;
-    public final static short       OBJECT_TYPE_SCROLL_BAR         = 17;
-    public final static short       OBJECT_TYPE_LIST_BOX           = 18;
-    public final static short       OBJECT_TYPE_GROUP_BOX          = 19;
-    public final static short       OBJECT_TYPE_COMBO_BOX          = 20;
-    public final static short       OBJECT_TYPE_RESERVED2          = 21;
-    public final static short       OBJECT_TYPE_RESERVED3          = 22;
-    public final static short       OBJECT_TYPE_RESERVED4          = 23;
-    public final static short       OBJECT_TYPE_RESERVED5          = 24;
-    public final static short       OBJECT_TYPE_COMMENT            = 25;
-    public final static short       OBJECT_TYPE_RESERVED6          = 26;
-    public final static short       OBJECT_TYPE_RESERVED7          = 27;
-    public final static short       OBJECT_TYPE_RESERVED8          = 28;
-    public final static short       OBJECT_TYPE_RESERVED9          = 29;
-    public final static short       OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING = 30;
     private  short      field_2_objectId;
     private  short      field_3_option;
-    private  BitField   locked                                      = BitFieldFactory.getInstance(0x1);
-    private  BitField   printable                                   = BitFieldFactory.getInstance(0x10);
-    private  BitField   autofill                                    = BitFieldFactory.getInstance(0x2000);
-    private  BitField   autoline                                    = BitFieldFactory.getInstance(0x4000);
     private  int        field_4_reserved1;
     private  int        field_5_reserved2;
     private  int        field_6_reserved3;
@@ -431,8 +431,4 @@
     {
         return autoline.isSet(field_3_option);
     }
-
-
-}  // END OF CLASS
-
-
+}



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


Mime
View raw message