You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2008/05/16 19:08:42 UTC
svn commit: r657135 [1/3] - in /poi/branches/ooxml: ./ src/documentation/
src/documentation/content/xdocs/ 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/...
Author: nick
Date: Fri May 16 10:08:40 2008
New Revision: 657135
URL: http://svn.apache.org/viewvc?rev=657135&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-657131 via svnmerge from
https://svn.apache.org:443/repos/asf/poi/trunk
........
r653892 | josh | 2008-05-06 20:48:55 +0100 (Tue, 06 May 2008) | 1 line
Another attempt to fix unicode problems in functionMetadata.txt. Made that file pure ascii.
........
r653945 | nick | 2008-05-06 23:51:28 +0100 (Tue, 06 May 2008) | 1 line
Add disabled test for bug #44898, and slightly improve a few poifs related error messages
........
r654056 | nick | 2008-05-07 10:41:03 +0100 (Wed, 07 May 2008) | 1 line
Update a test to match the new warning on short files
........
r654356 | josh | 2008-05-08 01:52:05 +0100 (Thu, 08 May 2008) | 1 line
44950 - fixed HSSFFormulaEvaluator.evaluateInCell() and Area3DEval.getValue() also added validation for number of elements in AreaEvals
........
r654366 | josh | 2008-05-08 02:06:56 +0100 (Thu, 08 May 2008) | 1 line
tiny clean-up after r654356 (bug 44950)
........
r654649 | josh | 2008-05-09 00:02:43 +0100 (Fri, 09 May 2008) | 1 line
fixed mistake in FuncPtg.clone(), added test case, cleaned up outdated (since bug 13292) test method.
........
r654650 | josh | 2008-05-09 00:06:30 +0100 (Fri, 09 May 2008) | 1 line
removed unused constructor and old comment after r654649
........
r655216 | josh | 2008-05-11 02:30:56 +0100 (Sun, 11 May 2008) | 1 line
bug 23630 - fixed spelling mistake in constant name
........
r655278 | josh | 2008-05-11 09:15:39 +0100 (Sun, 11 May 2008) | 1 line
41187 - fixed HSSFSheet to properly read xls files without ROW records
........
r655282 | yegor | 2008-05-11 10:03:24 +0100 (Sun, 11 May 2008) | 1 line
Added boolean flag to turn on use of merged columns in autosize
........
r655912 | josh | 2008-05-13 16:25:51 +0100 (Tue, 13 May 2008) | 1 line
added test case for reported bug 44987
........
r656213 | yegor | 2008-05-14 11:15:00 +0100 (Wed, 14 May 2008) | 1 line
properly update TextSpecInfoAtom when parent text is changed
........
r656215 | yegor | 2008-05-14 11:18:00 +0100 (Wed, 14 May 2008) | 1 line
Support for embedded ActiveX objects: PowerPoint references them similar to embedded documents but in a different container: ExControl instead of ExEmbed
........
r656252 | yegor | 2008-05-14 13:42:30 +0100 (Wed, 14 May 2008) | 1 line
convert line breaks into internal ppt represenatation when changing text
........
r656699 | yegor | 2008-05-15 16:23:38 +0100 (Thu, 15 May 2008) | 1 line
added a set accessor for embedded ole data
........
r656757 | josh | 2008-05-15 18:49:23 +0100 (Thu, 15 May 2008) | 1 line
bug 45000 - Fixed NPE in ListLevel when numberText is null
........
r656893 | josh | 2008-05-16 00:30:08 +0100 (Fri, 16 May 2008) | 1 line
44523 - fixed workbook sheet selection and focus
........
Added:
poi/branches/ooxml/src/java/org/apache/poi/hssf/record/formula/eval/AreaEvalBase.java
- copied unchanged from r656893, poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/AreaEvalBase.java
poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/record/ExControl.java
- copied unchanged from r656893, poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExControl.java
poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/record/ExControlAtom.java
- copied unchanged from r656893, poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExControlAtom.java
poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextSpecInfoAtom.java
- copied unchanged from r656893, poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextSpecInfoAtom.java
poi/branches/ooxml/src/testcases/org/apache/poi/hssf/data/ex41187-19267.xls
- copied unchanged from r656893, poi/trunk/src/testcases/org/apache/poi/hssf/data/ex41187-19267.xls
poi/branches/ooxml/src/testcases/org/apache/poi/hssf/model/AllModelTests.java
- copied unchanged from r656893, poi/trunk/src/testcases/org/apache/poi/hssf/model/AllModelTests.java
poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/eval/TestAreaEval.java
- copied unchanged from r656893, poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/eval/TestAreaEval.java
poi/branches/ooxml/src/testcases/org/apache/poi/poifs/data/ShortLastBlock.qwp
- copied unchanged from r656893, poi/trunk/src/testcases/org/apache/poi/poifs/data/ShortLastBlock.qwp
poi/branches/ooxml/src/testcases/org/apache/poi/poifs/data/ShortLastBlock.wps
- copied unchanged from r656893, poi/trunk/src/testcases/org/apache/poi/poifs/data/ShortLastBlock.wps
Modified:
poi/branches/ooxml/ (props changed)
poi/branches/ooxml/src/documentation/content/xdocs/changes.xml
poi/branches/ooxml/src/documentation/content/xdocs/status.xml
poi/branches/ooxml/src/documentation/release-guide.txt
poi/branches/ooxml/src/java/org/apache/poi/hssf/model/Sheet.java
poi/branches/ooxml/src/java/org/apache/poi/hssf/record/PaneRecord.java
poi/branches/ooxml/src/java/org/apache/poi/hssf/record/RowRecord.java
poi/branches/ooxml/src/java/org/apache/poi/hssf/record/WindowOneRecord.java
poi/branches/ooxml/src/java/org/apache/poi/hssf/record/WindowTwoRecord.java
poi/branches/ooxml/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java
poi/branches/ooxml/src/java/org/apache/poi/hssf/record/formula/FuncPtg.java
poi/branches/ooxml/src/java/org/apache/poi/hssf/record/formula/eval/Area2DEval.java
poi/branches/ooxml/src/java/org/apache/poi/hssf/record/formula/eval/Area3DEval.java
poi/branches/ooxml/src/java/org/apache/poi/hssf/record/formula/function/FunctionMetadataReader.java
poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java
poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
poi/branches/ooxml/src/java/org/apache/poi/poifs/storage/BlockListImpl.java
poi/branches/ooxml/src/java/org/apache/poi/poifs/storage/RawDataBlock.java
poi/branches/ooxml/src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java
poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Cell.java
poi/branches/ooxml/src/records/definitions/pane_record.xml
poi/branches/ooxml/src/resources/main/org/apache/poi/hssf/record/formula/function/functionMetadata-asGenerated.txt
poi/branches/ooxml/src/resources/main/org/apache/poi/hssf/record/formula/function/functionMetadata.txt
poi/branches/ooxml/src/scratchpad/examples/src/org/apache/poi/hslf/examples/DataExtraction.java
poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/model/ShapeFactory.java
poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java
poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/record/ExEmbed.java
poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java
poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java
poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoAtom.java
poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/usermodel/ObjectData.java
poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java
poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/ListLevel.java
poi/branches/ooxml/src/testcases/org/apache/poi/hssf/HSSFTests.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/aggregates/TestRowRecordsAggregate.java
poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/TestFuncPtg.java
poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/eval/AllFormulaEvalTests.java
poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/ExcelFileFormatDocFunctionExtractor.java
poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestCountFuncs.java
poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestIndex.java
poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/AllUserModelTests.java
poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestFormulaEvaluatorBugs.java
poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRow.java
poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java
poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java
poi/branches/ooxml/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java
poi/branches/ooxml/src/testcases/org/apache/poi/poifs/storage/TestRawDataBlock.java
Propchange: poi/branches/ooxml/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri May 16 10:08:40 2008
@@ -1 +1 @@
-/poi/trunk:1-638784,638786-639486,639488-639601,639603-640056,640058-642562,642564-642566,642568-642574,642576-642736,642739-650914,650916-653831
+/poi/trunk:1-638784,638786-639486,639488-639601,639603-640056,640058-642562,642564-642566,642568-642574,642576-642736,642739-650914,650916-657131
Modified: poi/branches/ooxml/src/documentation/content/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/documentation/content/xdocs/changes.xml?rev=657135&r1=657134&r2=657135&view=diff
==============================================================================
--- poi/branches/ooxml/src/documentation/content/xdocs/changes.xml (original)
+++ poi/branches/ooxml/src/documentation/content/xdocs/changes.xml Fri May 16 10:08:40 2008
@@ -44,6 +44,11 @@
<action dev="POI-DEVELOPERS" type="add">Created a common interface for handling Excel files, irrespective of if they are .xls or .xlsx</action>
</release>
<release version="3.1-beta2" date="2008-05-??">
+ <action dev="POI-DEVELOPERS" type="fix">44523 - fixed workbook sheet selection and focus</action>
+ <action dev="POI-DEVELOPERS" type="fix">45000 - Fixed NPE in ListLevel when numberText is null</action>
+ <action dev="POI-DEVELOPERS" type="fix">44985 - Properly update TextSpecInfoAtom when the parent text is changed</action>
+ <action dev="POI-DEVELOPERS" type="fix">41187 - fixed HSSFSheet to properly read xls files without ROW records</action>
+ <action dev="POI-DEVELOPERS" type="fix">44950 - fixed HSSFFormulaEvaluator.evaluateInCell() and Area3DEval.getValue() also added validation for number of elements in AreaEvals</action>
<action dev="POI-DEVELOPERS" type="fix">42570 - fixed LabelRecord to use empty string instead of null when the length is zero.</action>
<action dev="POI-DEVELOPERS" type="fix">42564 - fixed ArrayPtg to use ConstantValueParser. Fixed a few other ArrayPtg encoding issues.</action>
<action dev="POI-DEVELOPERS" type="fix">Follow-on from 28754 - StringPtg.toFormulaString() should escape double quotes</action>
Modified: poi/branches/ooxml/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/documentation/content/xdocs/status.xml?rev=657135&r1=657134&r2=657135&view=diff
==============================================================================
--- poi/branches/ooxml/src/documentation/content/xdocs/status.xml (original)
+++ poi/branches/ooxml/src/documentation/content/xdocs/status.xml Fri May 16 10:08:40 2008
@@ -41,6 +41,11 @@
<action dev="POI-DEVELOPERS" type="add">Created a common interface for handling Excel files, irrespective of if they are .xls or .xlsx</action>
</release>
<release version="3.1-beta2" date="2008-05-??">
+ <action dev="POI-DEVELOPERS" type="fix">44523 - fixed workbook sheet selection and focus</action>
+ <action dev="POI-DEVELOPERS" type="fix">45000 - Fixed NPE in ListLevel when numberText is null</action>
+ <action dev="POI-DEVELOPERS" type="fix">44985 - Properly update TextSpecInfoAtom when the parent text is changed</action>
+ <action dev="POI-DEVELOPERS" type="fix">41187 - fixed HSSFSheet to properly read xls files without ROW records</action>
+ <action dev="POI-DEVELOPERS" type="fix">44950 - fixed HSSFFormulaEvaluator.evaluateInCell() and Area3DEval.getValue() also added validation for number of elements in AreaEvals</action>
<action dev="POI-DEVELOPERS" type="fix">42570 - fixed LabelRecord to use empty string instead of null when the length is zero.</action>
<action dev="POI-DEVELOPERS" type="fix">42564 - fixed ArrayPtg to use ConstantValueParser. Fixed a few other ArrayPtg encoding issues.</action>
<action dev="POI-DEVELOPERS" type="fix">Follow-on from 28754 - StringPtg.toFormulaString() should escape double quotes</action>
Modified: poi/branches/ooxml/src/documentation/release-guide.txt
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/documentation/release-guide.txt?rev=657135&r1=657134&r2=657135&view=diff
==============================================================================
--- poi/branches/ooxml/src/documentation/release-guide.txt (original)
+++ poi/branches/ooxml/src/documentation/release-guide.txt Fri May 16 10:08:40 2008
@@ -37,14 +37,14 @@
3. Checkout the tagged version
{code}
cd tags
-svn checkout https://svn.apache.org/repos/asf/poi/tags/TAG
+svn checkout https://svn.apache.org/repos/asf/poi/tags/$TAG
{code}
4. Merge (if required)
{code}
cd $TAG
-$ svn merge https://svn.apache.org/repos/asf/poi/tags/TAG \
+$ svn merge https://svn.apache.org/repos/asf/poi/tags/$TAG \
https://svn.apache.org/repos/asf/poi/trunk
{code}
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=657135&r1=657134&r2=657135&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 Fri May 16 10:08:40 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
@@ -16,7 +15,6 @@
limitations under the License.
==================================================================== */
-
package org.apache.poi.hssf.model;
import org.apache.poi.hssf.record.*;
@@ -57,9 +55,7 @@
* @see org.apache.poi.hssf.usermodel.HSSFSheet
* @version 1.0-pre
*/
-
-public class Sheet implements Model
-{
+public final class Sheet implements Model {
public static final short LeftMargin = 0;
public static final short RightMargin = 1;
public static final short TopMargin = 2;
@@ -97,9 +93,9 @@
protected ObjectProtectRecord objprotect = null;
protected ScenarioProtectRecord scenprotect = null;
protected PasswordRecord password = null;
- protected List condFormatting = new ArrayList();;
+ protected List condFormatting = new ArrayList();
- /** Add an UncalcedRecord if not true indicating formulas have not been calculated */
+ /** Add an UncalcedRecord if not true indicating formulas have not been calculated */
protected boolean uncalced = false;
public static final byte PANE_LOWER_RIGHT = (byte)0;
@@ -108,7 +104,7 @@
public static final byte PANE_UPPER_LEFT = (byte)3;
/**
- * Creates new Sheet with no intialization --useless at this point
+ * Creates new Sheet with no initialization --useless at this point
* @see #createSheet(List,int,int)
*/
public Sheet()
@@ -166,7 +162,7 @@
}
}
else if (rec.getSid() == UncalcedRecord.sid) {
- retval.uncalced = true;
+ retval.uncalced = true;
}
else if (rec.getSid() == DimensionsRecord.sid)
{
@@ -188,14 +184,14 @@
}
else if ( rec.getSid() == CFHeaderRecord.sid )
{
- CFRecordsAggregate cfAgg = CFRecordsAggregate.createCFAggregate(recs, k);
- retval.condFormatting.add(cfAgg);
- rec = cfAgg;
+ 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;
+ // Skip it since it is processed by CFRecordsAggregate
+ rec = null;
}
else if (rec.getSid() == ColumnInfoRecord.sid)
{
@@ -244,7 +240,7 @@
if ( isfirstrow )
{
retval.rows = new RowRecordsAggregate();
- rec = retval.rows;
+ rec = retval.rows;
isfirstrow = false;
}
retval.rows.insertRow(row);
@@ -256,7 +252,7 @@
else if ( rec.getSid() == GridsetRecord.sid )
{
retval.gridset = (GridsetRecord) rec;
- }
+ }
else if ( rec.getSid() == HeaderRecord.sid && bofEofNestingLevel == 1)
{
retval.header = (HeaderRecord) rec;
@@ -301,32 +297,32 @@
{
rec = null;
}
-
- else if ( rec.getSid() == ProtectRecord.sid )
- {
- retval.protect = (ProtectRecord) rec;
- }
- else if ( rec.getSid() == ObjectProtectRecord.sid )
- {
- retval.objprotect = (ObjectProtectRecord) rec;
- }
- else if ( rec.getSid() == ScenarioProtectRecord.sid )
- {
- retval.scenprotect = (ScenarioProtectRecord) rec;
- }
- else if ( rec.getSid() == PasswordRecord.sid )
- {
- retval.password = (PasswordRecord) rec;
- }
- else if (rec.getSid() == PageBreakRecord.HORIZONTAL_SID)
- {
- retval.rowBreaks = (PageBreakRecord)rec;
- }
- else if (rec.getSid() == PageBreakRecord.VERTICAL_SID)
- {
- retval.colBreaks = (PageBreakRecord)rec;
- }
-
+
+ else if ( rec.getSid() == ProtectRecord.sid )
+ {
+ retval.protect = (ProtectRecord) rec;
+ }
+ else if ( rec.getSid() == ObjectProtectRecord.sid )
+ {
+ retval.objprotect = (ObjectProtectRecord) rec;
+ }
+ else if ( rec.getSid() == ScenarioProtectRecord.sid )
+ {
+ retval.scenprotect = (ScenarioProtectRecord) rec;
+ }
+ else if ( rec.getSid() == PasswordRecord.sid )
+ {
+ retval.password = (PasswordRecord) rec;
+ }
+ else if (rec.getSid() == PageBreakRecord.HORIZONTAL_SID)
+ {
+ retval.rowBreaks = (PageBreakRecord)rec;
+ }
+ else if (rec.getSid() == PageBreakRecord.VERTICAL_SID)
+ {
+ retval.colBreaks = (PageBreakRecord)rec;
+ }
+
if (rec != null)
{
records.add(rec);
@@ -351,9 +347,9 @@
/**
* 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
- * can be added to a sheet. The <b>Record</b> object does not implement cloneable.
+ * can be added to a sheet. The <b>Record</b> object does not implement cloneable.
* When adding a new record, implement a public clone method if and only if the record
- * belongs to a sheet.
+ * belongs to a sheet.
*/
public Sheet cloneSheet()
{
@@ -374,7 +370,7 @@
ValueRecordsAggregate vrAgg = (ValueRecordsAggregate)rec;
for (Iterator cellIter = vrAgg.getIterator();cellIter.hasNext();) {
Record valRec = (Record)cellIter.next();
-
+
if (valRec instanceof FormulaRecordAggregate) {
FormulaRecordAggregate fmAgg = (FormulaRecordAggregate)valRec;
Record fmAggRec = fmAgg.getFormulaRecord();
@@ -459,9 +455,9 @@
records.add(retval.rowBreaks);
retval.colBreaks = new PageBreakRecord(PageBreakRecord.VERTICAL_SID);
records.add(retval.colBreaks);
-
+
retval.header = (HeaderRecord) retval.createHeader();
- records.add( retval.header );
+ records.add( retval.header );
retval.footer = (FooterRecord) retval.createFooter();
records.add( retval.footer );
records.add( retval.createHCenter() );
@@ -479,11 +475,11 @@
retval.dimsloc = records.size()-1;
records.add(retval.windowTwo = retval.createWindowTwo());
retval.setLoc(records.size() - 1);
- retval.selection =
+ retval.selection =
(SelectionRecord) retval.createSelection();
records.add(retval.selection);
- retval.protect = (ProtectRecord) retval.createProtect();
- records.add(retval.protect);
+ retval.protect = (ProtectRecord) retval.createProtect();
+ records.add(retval.protect);
records.add(retval.createEOF());
@@ -511,26 +507,25 @@
}
}
- //public int addMergedRegion(short rowFrom, short colFrom, short rowTo,
- public int addMergedRegion(int rowFrom, short colFrom, int rowTo,
- short colTo)
- {
- // Validate input
- if(rowTo < rowFrom) {
- throw new IllegalArgumentException("The row to ("+rowTo+") must be >= the row from ("+rowFrom+")");
- }
- if(colTo < colFrom) {
- throw new IllegalArgumentException("The col to ("+colTo+") must be >= the col from ("+colFrom+")");
- }
-
+ public int addMergedRegion(int rowFrom, short colFrom, int rowTo, short colTo) {
+ // Validate input
+ if (rowTo < rowFrom) {
+ throw new IllegalArgumentException("The 'to' row (" + rowTo
+ + ") must not be less than the 'from' row (" + rowFrom + ")");
+ }
+ if (colTo < colFrom) {
+ throw new IllegalArgumentException("The 'to' col (" + colTo
+ + ") must not be less than the 'from' col (" + colFrom + ")");
+ }
+
if (merged == null || merged.getNumAreas() == 1027)
{
merged = ( MergeCellsRecord ) createMergedCells();
- mergedRecords.add(merged);
+ mergedRecords.add(merged);
records.add(records.size() - 1, merged);
}
merged.addArea(rowFrom, colFrom, rowTo, colTo);
- return numMergedRegions++;
+ return numMergedRegions++;
}
public void removeMergedRegion(int index)
@@ -538,15 +533,15 @@
//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();
+ startNumRegions = numMergedRegions - merged.getNumAreas();
}
else
{
@@ -558,7 +553,7 @@
pos = n;
break;
}
- startNumRegions += record.getNumAreas();
+ startNumRegions += record.getNumAreas();
}
}
@@ -567,17 +562,17 @@
numMergedRegions--;
if (rec.getNumAreas() == 0)
{
- mergedRecords.remove(pos);
- //get rid of the record from the sheet
- records.remove(merged);
+ 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;
- }
+ //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;
+ }
}
}
}
@@ -587,10 +582,10 @@
//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())
{
@@ -607,7 +602,7 @@
pos = n;
break;
}
- startNumRegions += record.getNumAreas();
+ startNumRegions += record.getNumAreas();
}
}
return ((MergeCellsRecord) mergedRecords.get(pos)).getAreaAt(index - startNumRegions);
@@ -620,62 +615,62 @@
// 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;
+ // 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)
{
- int index = findConditionalFormattingPosition();
- records.add(index, cfAggregate);
- condFormatting.add(cfAggregate);
- return condFormatting.size()-1;
+ int index = findConditionalFormattingPosition();
+ records.add(index, cfAggregate);
+ condFormatting.add(cfAggregate);
+ return condFormatting.size()-1;
}
public void removeConditionalFormatting(int index)
{
if (index >= 0 && index <= condFormatting.size()-1 )
{
- CFRecordsAggregate cfAggregate = getCFRecordsAggregateAt(index);
- records.remove(cfAggregate);
- condFormatting.remove(index);
+ 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 (CFRecordsAggregate) condFormatting.get(index);
}
return null;
}
-
+
public int getNumConditionalFormattings()
{
- return condFormatting.size();
+ return condFormatting.size();
}
/**
@@ -711,8 +706,6 @@
*
* @see org.apache.poi.hssf.record.DimensionsRecord
*/
-
- //public void setDimensions(short firstrow, short firstcol, short lastrow,
public void setDimensions(int firstrow, short firstcol, int lastrow,
short lastcol)
{
@@ -735,7 +728,7 @@
/**
* set the locator for where we should look for the next value record. The
- * algorythm will actually start here and find the correct location so you
+ * algorithm will actually start here and find the correct location so you
* can set this to 0 and watch performance go down the tubes but it will work.
* After a value is set this is automatically advanced. Its also set by the
* create method. So you probably shouldn't mess with this unless you have
@@ -813,13 +806,13 @@
for (int k = 0; k < records.size(); k++)
{
Record record = (( Record ) records.get(k));
-
+
// Don't write out UncalcedRecord entries, as
// we handle those specially just below
if (record instanceof UncalcedRecord) {
- continue;
+ continue;
}
-
+
// Once the rows have been found in the list of records, start
// writing out the blocked row information. This includes the DBCell references
if (record instanceof RowRecordsAggregate) {
@@ -829,13 +822,13 @@
} else {
pos += record.serialize(pos, data ); // rec.length;
}
-
+
// If the BOF record was just serialized then add the IndexRecord
if (record.getSid() == BOFRecord.sid) {
// Add an optional UncalcedRecord
if (uncalced) {
- UncalcedRecord rec = new UncalcedRecord();
- pos += rec.serialize(pos, data);
+ UncalcedRecord rec = new UncalcedRecord();
+ pos += rec.serialize(pos, data);
}
//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.
@@ -871,7 +864,7 @@
log.log(POILogger.DEBUG, "Sheet.serialize returning ");
return pos-offset;
}
-
+
private int serializeIndexRecord(final int BOFRecordIndex, final int offset, byte[] data) {
IndexRecord index = new IndexRecord();
index.setFirstRow(rows.getFirstRowNum());
@@ -906,7 +899,7 @@
}
return index.serialize(offset, data);
}
-
+
/**
* Create a row record. (does not add it to the records contained in this sheet)
@@ -930,8 +923,6 @@
* @return LabelSSTRecord newly created containing your SST Index, row,col.
* @see org.apache.poi.hssf.record.SSTRecord
*/
-
- //public LabelSSTRecord createLabelSST(short row, short col, int index)
public LabelSSTRecord createLabelSST(int row, short col, int index)
{
log.logFormatted(POILogger.DEBUG, "create labelsst row,col,index %,%,%",
@@ -957,8 +948,6 @@
*
* @return NumberRecord for that row, col containing that value as added to the sheet
*/
-
- //public NumberRecord createNumber(short row, short col, double value)
public NumberRecord createNumber(int row, short col, double value)
{
log.logFormatted(POILogger.DEBUG, "create number row,col,value %,%,%",
@@ -968,7 +957,6 @@
});
NumberRecord rec = new NumberRecord();
- //rec.setRow(( short ) row);
rec.setRow(row);
rec.setColumn(col);
rec.setValue(value);
@@ -982,18 +970,14 @@
* @param row - the row the BlankRecord is a member of
* @param col - the column the BlankRecord is a member of
*/
-
- //public BlankRecord createBlank(short row, short col)
public BlankRecord createBlank(int row, short col)
{
- //log.logFormatted(POILogger.DEBUG, "create blank row,col %,%", new short[]
log.logFormatted(POILogger.DEBUG, "create blank row,col %,%", new int[]
{
row, col
});
BlankRecord rec = new BlankRecord();
- //rec.setRow(( short ) row);
rec.setRow(row);
rec.setColumn(col);
rec.setXFIndex(( short ) 0x0f);
@@ -1009,12 +993,9 @@
* @param formula - a String representing the formula. To be parsed to PTGs
* @return bogus/useless formula record
*/
-
- //public FormulaRecord createFormula(short row, short col, String formula)
public FormulaRecord createFormula(int row, short col, String formula)
{
log.logFormatted(POILogger.DEBUG, "create formula row,col,formula %,%,%",
- //new short[]
new int[]
{
row, col
@@ -1052,8 +1033,6 @@
* @param row the row to add the cell value to
* @param col the cell value record itself.
*/
-
- //public void addValueRecord(short row, CellValueRecordInterface col)
public void addValueRecord(int row, CellValueRecordInterface col)
{
checkCells();
@@ -1075,29 +1054,6 @@
d.setFirstCol(col.getColumn());
}
cells.insertCell(col);
-
- /*
- * for (int k = loc; k < records.size(); k++)
- * {
- * Record rec = ( Record ) records.get(k);
- *
- * if (rec.getSid() == RowRecord.sid)
- * {
- * RowRecord rowrec = ( RowRecord ) rec;
- *
- * if (rowrec.getRowNumber() == col.getRow())
- * {
- * records.add(k + 1, col);
- * loc = k;
- * if (rowrec.getLastCol() <= col.getColumn())
- * {
- * rowrec.setLastCol((( short ) (col.getColumn() + 1)));
- * }
- * break;
- * }
- * }
- * }
- */
}
/**
@@ -1109,8 +1065,6 @@
* @param col - a record supporting the CellValueRecordInterface.
* @see org.apache.poi.hssf.record.CellValueRecordInterface
*/
-
- //public void removeValueRecord(short row, CellValueRecordInterface col)
public void removeValueRecord(int row, CellValueRecordInterface col)
{
checkCells();
@@ -1118,27 +1072,6 @@
new int[]{row, dimsloc} );
loc = dimsloc;
cells.removeCell(col);
-
- /*
- * for (int k = loc; k < records.size(); k++)
- * {
- * Record rec = ( Record ) records.get(k);
- *
- * // checkDimsLoc(rec,k);
- * if (rec.isValue())
- * {
- * CellValueRecordInterface cell =
- * ( CellValueRecordInterface ) rec;
- *
- * if ((cell.getRow() == col.getRow())
- * && (cell.getColumn() == col.getColumn()))
- * {
- * records.remove(k);
- * break;
- * }
- * }
- * }
- */
}
/**
@@ -1160,26 +1093,10 @@
//The ValueRecordsAggregate use a tree map underneath.
//The tree Map uses the CellValueRecordInterface as both the
//key and the value, if we dont do a remove, then
- //the previous instance of the key is retained, effectively using
+ //the previous instance of the key is retained, effectively using
//double the memory
cells.removeCell(newval);
cells.insertCell(newval);
-
- /*
- * CellValueRecordInterface oldval = getNextValueRecord();
- *
- * while (oldval != null)
- * {
- * if (oldval.isEqual(newval))
- * {
- * records.set(( short ) (getLoc() - 1), newval);
- * return;
- * }
- * oldval = getNextValueRecord();
- * }
- * addValueRecord(newval.getRow(), newval);
- * setLoc(dimsloc);
- */
}
/**
@@ -1218,41 +1135,6 @@
rows.insertRow(row);
- /*
- * for (int k = loc; k < records.size(); k++)
- * {
- * Record rec = ( Record ) records.get(k);
- *
- * if (rec.getSid() == IndexRecord.sid)
- * {
- * index = ( IndexRecord ) rec;
- * }
- * if (rec.getSid() == RowRecord.sid)
- * {
- * RowRecord rowrec = ( RowRecord ) rec;
- *
- * if (rowrec.getRowNumber() > row.getRowNumber())
- * {
- * records.add(k, row);
- * loc = k;
- * break;
- * }
- * }
- * if (rec.getSid() == WindowTwoRecord.sid)
- * {
- * records.add(k, row);
- * loc = k;
- * break;
- * }
- * }
- * if (index != null)
- * {
- * if (index.getLastRowAdd1() <= row.getRowNumber())
- * {
- * index.setLastRowAdd1(row.getRowNumber() + 1);
- * }
- * }
- */
if (log.check( POILogger.DEBUG ))
log.log(POILogger.DEBUG, "exit addRow");
}
@@ -1268,33 +1150,9 @@
public void removeRow(RowRecord row)
{
checkRows();
- // IndexRecord index = null;
setLoc(getDimsLoc());
rows.removeRow(row);
-
- /*
- * for (int k = loc; k < records.size(); k++)
- * {
- * Record rec = ( Record ) records.get(k);
- *
- * // checkDimsLoc(rec,k);
- * if (rec.getSid() == RowRecord.sid)
- * {
- * RowRecord rowrec = ( RowRecord ) rec;
- *
- * if (rowrec.getRowNumber() == row.getRowNumber())
- * {
- * records.remove(k);
- * break;
- * }
- * }
- * if (rec.getSid() == WindowTwoRecord.sid)
- * {
- * break;
- * }
- * }
- */
}
/**
@@ -1325,67 +1183,9 @@
return null;
}
return ( CellValueRecordInterface ) valueRecIterator.next();
-
- /*
- * if (this.getLoc() < records.size())
- * {
- * for (int k = getLoc(); k < records.size(); k++)
- * {
- * Record rec = ( Record ) records.get(k);
- *
- * this.setLoc(k + 1);
- * if (rec instanceof CellValueRecordInterface)
- * {
- * return ( CellValueRecordInterface ) rec;
- * }
- * }
- * }
- * return null;
- */
}
/**
- * get the NEXT RowRecord or CellValueRecord(from LOC). The first record that
- * is a Row record or CellValueRecord(starting at LOC) will be returned.
- * <P>
- * This method is "loc" sensitive. Meaning you need to set LOC to where you
- * want it to start searching. If you don't know do this: setLoc(getDimsLoc).
- * When adding several rows you can just start at the last one by leaving loc
- * at what this sets it to. For this method, set loc to dimsloc to start with.
- * subsequent calls will return rows in (physical) sequence or NULL when you get to the end.
- *
- * @return RowRecord representing the next row record or CellValueRecordInterface
- * representing the next cellvalue or NULL if there are no more
- * @see #setLoc(int)
- *
- */
-
-/* public Record getNextRowOrValue()
- {
- POILogger.DEBUG((new StringBuffer("getNextRow loc= ")).append(loc)
- .toString());
- if (this.getLoc() < records.size())
- {
- for (int k = this.getLoc(); k < records.size(); k++)
- {
- Record rec = ( Record ) records.get(k);
-
- this.setLoc(k + 1);
- if (rec.getSid() == RowRecord.sid)
- {
- return rec;
- }
- else if (rec.isValue())
- {
- return rec;
- }
- }
- }
- return null;
- }
- */
-
- /**
* get the NEXT RowRecord (from LOC). The first record that is a Row record
* (starting at LOC) will be returned.
* <P>
@@ -1413,20 +1213,6 @@
return null;
}
return ( RowRecord ) rowRecIterator.next();
-
-/* if (this.getLoc() < records.size())
- {
- for (int k = this.getLoc(); k < records.size(); k++)
- {
- Record rec = ( Record ) records.get(k);
-
- this.setLoc(k + 1);
- if (rec.getSid() == RowRecord.sid)
- {
- return ( RowRecord ) rec;
- }
- }
- }*/
}
/**
@@ -1445,34 +1231,10 @@
* @see #setLoc(int)
*
*/
-
- //public RowRecord getRow(short rownum)
- public RowRecord getRow(int rownum)
- {
+ public RowRecord getRow(int rownum) {
if (log.check( POILogger.DEBUG ))
log.log(POILogger.DEBUG, "getNextRow loc= " + loc);
return rows.getRow(rownum);
-
- /*
- * if (this.getLoc() < records.size())
- * {
- * for (int k = this.getLoc(); k < records.size(); k++)
- * {
- * Record rec = ( Record ) records.get(k);
- *
- * this.setLoc(k + 1);
- * if (rec.getSid() == RowRecord.sid)
- * {
- * if ((( RowRecord ) rec).getRowNumber() == rownum)
- * {
- * return ( RowRecord ) rec;
- * }
- * }
- * }
- * }
- */
-
- // return null;
}
/**
@@ -1489,7 +1251,6 @@
retval.setVersion(( short ) 0x600);
retval.setType(( short ) 0x010);
- // retval.setBuild((short)0x10d3);
retval.setBuild(( short ) 0x0dbb);
retval.setBuildYear(( short ) 1996);
retval.setHistoryBitMask(0xc1);
@@ -1807,7 +1568,7 @@
* @see org.apache.poi.hssf.record.ColumnInfoRecord
* @return record containing a ColumnInfoRecord
*/
-
+ // TODO change return type to ColumnInfoRecord
protected Record createColInfo()
{
return ColumnInfoRecordsAggregate.createColInfo();
@@ -1830,12 +1591,12 @@
public boolean isGridsPrinted()
{
- if (gridset == null) {
- gridset = (GridsetRecord)createGridset();
- //Insert the newlycreated Gridset record at the end of the record (just before the EOF)
- int loc = findFirstRecordLocBySid(EOFRecord.sid);
- records.add(loc, gridset);
- }
+ if (gridset == null) {
+ gridset = (GridsetRecord)createGridset();
+ //Insert the newlycreated Gridset record at the end of the record (just before the EOF)
+ int loc = findFirstRecordLocBySid(EOFRecord.sid);
+ records.add(loc, gridset);
+ }
return !gridset.getGridset();
}
@@ -1918,16 +1679,16 @@
}
return retval;
}
-
+
/**
- * get the index to the ExtendedFormatRecord "associated" with
- * the column at specified 0-based index. (In this case, an
- * ExtendedFormatRecord index is actually associated with a
+ * get the index to the ExtendedFormatRecord "associated" with
+ * the column at specified 0-based index. (In this case, an
+ * ExtendedFormatRecord index is actually associated with a
* ColumnInfoRecord which spans 1 or more columns)
* <br/>
* Returns the index to the default ExtendedFormatRecord (0xF)
* if no ColumnInfoRecord exists that includes the column
- * index specified.
+ * index specified.
* @param column
* @return index of ExtendedFormatRecord associated with
* ColumnInfoRecord that includes the column index or the
@@ -2116,38 +1877,38 @@
retval.setNumRefs(( short ) 0x0);
return retval;
}
-
- public short getTopRow()
+
+ public short getTopRow()
{
- return (windowTwo==null) ? (short) 0 : windowTwo.getTopRow();
+ return (windowTwo==null) ? (short) 0 : windowTwo.getTopRow();
}
-
- public void setTopRow(short topRow)
+
+ public void setTopRow(short topRow)
{
- if (windowTwo!=null)
- {
- windowTwo.setTopRow(topRow);
- }
+ if (windowTwo!=null)
+ {
+ windowTwo.setTopRow(topRow);
+ }
}
-
+
/**
* Sets the left column to show in desktop window pane.
* @param leftCol the left column to show in desktop window pane
*/
public void setLeftCol(short leftCol){
- if (windowTwo!=null)
- {
- windowTwo.setLeftCol(leftCol);
- }
- }
-
- public short getLeftCol()
- {
- return (windowTwo==null) ? (short) 0 : windowTwo.getLeftCol();
- }
-
-
-
+ if (windowTwo!=null)
+ {
+ windowTwo.setLeftCol(leftCol);
+ }
+ }
+
+ public short getLeftCol()
+ {
+ return (windowTwo==null) ? (short) 0 : windowTwo.getLeftCol();
+ }
+
+
+
/**
* Returns the active row
*
@@ -2162,7 +1923,7 @@
}
return selection.getActiveCellRow();
}
-
+
/**
* Sets the active row
*
@@ -2177,7 +1938,7 @@
selection.setActiveCellRow(row);
}
}
-
+
/**
* Returns the active column
*
@@ -2192,7 +1953,7 @@
}
return selection.getActiveCellCol();
}
-
+
/**
* Sets the active column
*
@@ -2278,9 +2039,9 @@
}
// Add space for UncalcedRecord
if (uncalced) {
- retval += UncalcedRecord.getStaticRecordSize();
+ retval += UncalcedRecord.getStaticRecordSize();
}
-
+
return retval;
}
@@ -2367,16 +2128,19 @@
*/
public HeaderRecord getHeader ()
{
- return header;
+ return header;
}
+ public WindowTwoRecord getWindowTwo() {
+ return windowTwo;
+ }
/**
* Sets the HeaderRecord.
* @param newHeader The new HeaderRecord for the sheet.
*/
public void setHeader (HeaderRecord newHeader)
{
- header = newHeader;
+ header = newHeader;
}
/**
@@ -2385,7 +2149,7 @@
*/
public FooterRecord getFooter ()
{
- return footer;
+ return footer;
}
/**
@@ -2394,7 +2158,7 @@
*/
public void setFooter (FooterRecord newFooter)
{
- footer = newFooter;
+ footer = newFooter;
}
/**
@@ -2403,7 +2167,7 @@
*/
public PrintSetupRecord getPrintSetup ()
{
- return printSetup;
+ return printSetup;
}
/**
@@ -2412,7 +2176,7 @@
*/
public void setPrintSetup (PrintSetupRecord newPrintSetup)
{
- printSetup = newPrintSetup;
+ printSetup = newPrintSetup;
}
/**
@@ -2421,7 +2185,7 @@
*/
public PrintGridlinesRecord getPrintGridlines ()
{
- return printGridlines;
+ return printGridlines;
}
/**
@@ -2430,7 +2194,7 @@
*/
public void setPrintGridlines (PrintGridlinesRecord newPrintGridlines)
{
- printGridlines = newPrintGridlines;
+ printGridlines = newPrintGridlines;
}
/**
@@ -2447,23 +2211,23 @@
* @return the size of the margin
*/
public double getMargin(short margin) {
- if (getMargins()[margin] != null)
- return margins[margin].getMargin();
- else {
- switch ( margin )
- {
- case LeftMargin:
- return .75;
- case RightMargin:
- return .75;
- case TopMargin:
- return 1.0;
- case BottomMargin:
- return 1.0;
- default :
- throw new RuntimeException( "Unknown margin constant: " + margin );
- }
- }
+ if (getMargins()[margin] != null)
+ return margins[margin].getMargin();
+ else {
+ switch ( margin )
+ {
+ case LeftMargin:
+ return .75;
+ case RightMargin:
+ return .75;
+ case TopMargin:
+ return 1.0;
+ case BottomMargin:
+ return 1.0;
+ default :
+ throw new RuntimeException( "Unknown margin constant: " + margin );
+ }
+ }
}
/**
@@ -2472,32 +2236,32 @@
* @param size the size of the margin
*/
public void setMargin(short margin, double size) {
- Margin m = getMargins()[margin];
- if (m == null) {
- switch ( margin )
- {
- case LeftMargin:
- m = new LeftMarginRecord();
- records.add( getDimsLoc() + 1, m );
- break;
- case RightMargin:
- m = new RightMarginRecord();
- records.add( getDimsLoc() + 1, m );
- break;
- case TopMargin:
- m = new TopMarginRecord();
- records.add( getDimsLoc() + 1, m );
- break;
- case BottomMargin:
- m = new BottomMarginRecord();
- records.add( getDimsLoc() + 1, m );
- break;
- default :
- throw new RuntimeException( "Unknown margin constant: " + margin );
- }
- margins[margin] = m;
- }
- m.setMargin( size );
+ Margin m = getMargins()[margin];
+ if (m == null) {
+ switch ( margin )
+ {
+ case LeftMargin:
+ m = new LeftMarginRecord();
+ records.add( getDimsLoc() + 1, m );
+ break;
+ case RightMargin:
+ m = new RightMarginRecord();
+ records.add( getDimsLoc() + 1, m );
+ break;
+ case TopMargin:
+ m = new TopMarginRecord();
+ records.add( getDimsLoc() + 1, m );
+ break;
+ case BottomMargin:
+ m = new BottomMarginRecord();
+ records.add( getDimsLoc() + 1, m );
+ break;
+ default :
+ throw new RuntimeException( "Unknown margin constant: " + margin );
+ }
+ margins[margin] = m;
+ }
+ m.setMargin( size );
}
public int getEofLoc()
@@ -2514,10 +2278,10 @@
*/
public void createFreezePane(int colSplit, int rowSplit, int topRow, int leftmostColumn )
{
- int paneLoc = findFirstRecordLocBySid(PaneRecord.sid);
- if (paneLoc != -1)
- records.remove(paneLoc);
-
+ int paneLoc = findFirstRecordLocBySid(PaneRecord.sid);
+ if (paneLoc != -1)
+ records.remove(paneLoc);
+
int loc = findFirstRecordLocBySid(WindowTwoRecord.sid);
PaneRecord pane = new PaneRecord();
pane.setX((short)colSplit);
@@ -2563,10 +2327,10 @@
*/
public void createSplitPane(int xSplitPos, int ySplitPos, int topRow, int leftmostColumn, int activePane )
{
- int paneLoc = findFirstRecordLocBySid(PaneRecord.sid);
- if (paneLoc != -1)
- records.remove(paneLoc);
-
+ int paneLoc = findFirstRecordLocBySid(PaneRecord.sid);
+ if (paneLoc != -1)
+ records.remove(paneLoc);
+
int loc = findFirstRecordLocBySid(WindowTwoRecord.sid);
PaneRecord r = new PaneRecord();
r.setX((short)xSplitPos);
@@ -2583,7 +2347,7 @@
sel.setPane(PANE_LOWER_RIGHT);
}
-
+
/**
* Returns the information regarding the currently configured pane (split or freeze).
* @return null if no pane configured, or the pane information.
@@ -2592,9 +2356,9 @@
PaneRecord rec = (PaneRecord)findFirstRecordBySid(PaneRecord.sid);
if (rec == null)
return null;
-
+
return new PaneInformation(rec.getX(), rec.getY(), rec.getTopRow(),
- rec.getLeftColumn(), (byte)rec.getActivePane(), windowTwo.getFreezePanes());
+ rec.getLeftColumn(), (byte)rec.getActivePane(), windowTwo.getFreezePanes());
}
public SelectionRecord getSelection()
@@ -2660,12 +2424,12 @@
*/
public ProtectRecord getProtect()
{
- if (protect == null) {
- protect = (ProtectRecord)createProtect();
- //Insert the newlycreated protect record at the end of the record (just before the EOF)
- int loc = findFirstRecordLocBySid(EOFRecord.sid);
- records.add(loc, protect);
- }
+ if (protect == null) {
+ protect = (ProtectRecord)createProtect();
+ //Insert the newlycreated protect record at the end of the record (just before the EOF)
+ int loc = findFirstRecordLocBySid(EOFRecord.sid);
+ records.add(loc, protect);
+ }
return protect;
}
@@ -2674,12 +2438,12 @@
*/
public PasswordRecord getPassword()
{
- if (password == null) {
- password = createPassword();
- //Insert the newly created password record at the end of the record (just before the EOF)
- int loc = findFirstRecordLocBySid(EOFRecord.sid);
- records.add(loc, password);
- }
+ if (password == null) {
+ password = createPassword();
+ //Insert the newly created password record at the end of the record (just before the EOF)
+ int loc = findFirstRecordLocBySid(EOFRecord.sid);
+ records.add(loc, password);
+ }
return password;
}
@@ -2714,7 +2478,7 @@
* @return whether gridlines are displayed
*/
public boolean isDisplayGridlines() {
- return windowTwo.getDisplayGridlines();
+ return windowTwo.getDisplayGridlines();
}
/**
@@ -2730,7 +2494,7 @@
* @return whether formulas are displayed
*/
public boolean isDisplayFormulas() {
- return windowTwo.getDisplayFormulas();
+ return windowTwo.getDisplayFormulas();
}
/**
@@ -2746,24 +2510,24 @@
* @return whether RowColHeadings are displayed
*/
public boolean isDisplayRowColHeadings() {
- return windowTwo.getDisplayRowColHeadings();
+ return windowTwo.getDisplayRowColHeadings();
}
-
+
+ /**
+ * @return whether an uncalced record must be inserted or not at generation
+ */
+ public boolean getUncalced() {
+ return uncalced;
+ }
/**
- * @return whether an uncalced record must be inserted or not at generation
- */
- public boolean getUncalced() {
- return uncalced;
- }
- /**
- * @param uncalced whether an uncalced record must be inserted or not at generation
- */
- public void setUncalced(boolean uncalced) {
- this.uncalced = uncalced;
- }
+ * @param uncalced whether an uncalced record must be inserted or not at generation
+ */
+ public void setUncalced(boolean uncalced) {
+ this.uncalced = uncalced;
+ }
- /**
+ /**
* Returns the array of margins. If not created, will create.
*
* @return the array of marings.
@@ -2771,7 +2535,7 @@
protected Margin[] getMargins() {
if (margins == null)
margins = new Margin[4];
- return margins;
+ return margins;
}
/**
@@ -2789,11 +2553,11 @@
boolean noDrawingRecordsFound = (loc == -1);
if (noDrawingRecordsFound)
{
- if(!createIfMissing) {
- // None found, and not allowed to add in
- return -1;
- }
-
+ if(!createIfMissing) {
+ // None found, and not allowed to add in
+ return -1;
+ }
+
EscherAggregate aggregate = new EscherAggregate( drawingManager );
loc = findFirstRecordLocBySid(EscherAggregate.sid);
if (loc == -1)
@@ -2847,43 +2611,43 @@
* @param breaks The page record to be shifted
* @param start Starting "main" value to shift breaks
* @param stop Ending "main" value to shift breaks
- * @param count number of units (rows/columns) to shift by
+ * @param count number of units (rows/columns) to shift by
*/
public void shiftBreaks(PageBreakRecord breaks, short start, short 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;
- boolean inStart = (breakLocation >= start);
- boolean inEnd = (breakLocation <= stop);
- if(inStart && inEnd)
- shiftedBreak.add(breakItem);
- }
-
- iterator = shiftedBreak.iterator();
- while (iterator.hasNext()) {
- PageBreakRecord.Break breakItem = (PageBreakRecord.Break)iterator.next();
- breaks.removeBreak(breakItem.main);
- breaks.addBreak((short)(breakItem.main+count), breakItem.subFrom, breakItem.subTo);
- }
+
+ 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;
+ boolean inStart = (breakLocation >= start);
+ boolean inEnd = (breakLocation <= stop);
+ if(inStart && inEnd)
+ shiftedBreak.add(breakItem);
+ }
+
+ iterator = shiftedBreak.iterator();
+ while (iterator.hasNext()) {
+ PageBreakRecord.Break breakItem = (PageBreakRecord.Break)iterator.next();
+ breaks.removeBreak(breakItem.main);
+ breaks.addBreak((short)(breakItem.main+count), breakItem.subFrom, breakItem.subTo);
+ }
}
-
+
/**
* Sets a page break at the indicated row
* @param row
*/
- public void setRowBreak(int row, short fromCol, short toCol) {
- if (rowBreaks == null) {
+ 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);
+ }
+ rowBreaks.addBreak((short)row, fromCol, toCol);
}
/**
@@ -2891,9 +2655,9 @@
* @param row
*/
public void removeRowBreak(int row) {
- if (rowBreaks == null)
- throw new IllegalArgumentException("Sheet does not define any row breaks");
- rowBreaks.removeBreak((short)row);
+ if (rowBreaks == null)
+ throw new IllegalArgumentException("Sheet does not define any row breaks");
+ rowBreaks.removeBreak((short)row);
}
/**
@@ -2902,7 +2666,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 (rowBreaks == null) ? false : rowBreaks.getBreak((short)row) != null;
}
/**
@@ -2910,12 +2674,12 @@
*
*/
public void setColumnBreak(short column, short fromRow, short toRow) {
- if (colBreaks == null) {
+ if (colBreaks == null) {
int loc = findFirstRecordLocBySid(WindowTwoRecord.sid);
colBreaks = new PageBreakRecord(PageBreakRecord.VERTICAL_SID);
records.add(loc, colBreaks);
- }
- colBreaks.addBreak(column, fromRow, toRow);
+ }
+ colBreaks.addBreak(column, fromRow, toRow);
}
/**
@@ -2923,10 +2687,10 @@
*
*/
public void removeColumnBreak(short column) {
- if (colBreaks == null)
- throw new IllegalArgumentException("Sheet does not define any column breaks");
-
- colBreaks.removeBreak(column);
+ if (colBreaks == null)
+ throw new IllegalArgumentException("Sheet does not define any column breaks");
+
+ colBreaks.removeBreak(column);
}
/**
@@ -2935,9 +2699,9 @@
* @return true if the specified column has a page break
*/
public boolean isColumnBroken(short column) {
- return (colBreaks == null) ? false : colBreaks.getBreak(column) != null;
+ return (colBreaks == null) ? false : colBreaks.getBreak(column) != null;
}
-
+
/**
* Shifts the horizontal page breaks for the indicated count
* @param startingRow
@@ -2945,7 +2709,7 @@
* @param count
*/
public void shiftRowBreaks(int startingRow, int endingRow, int count) {
- shiftBreaks(rowBreaks, (short)startingRow, (short)endingRow, (short)count);
+ shiftBreaks(rowBreaks, (short)startingRow, (short)endingRow, (short)count);
}
/**
@@ -2955,39 +2719,39 @@
* @param count
*/
public void shiftColumnBreaks(short startingCol, short endingCol, short count) {
- shiftBreaks(colBreaks, startingCol, endingCol, count);
+ shiftBreaks(colBreaks, startingCol, endingCol, count);
}
-
+
/**
* Returns all the row page breaks
* @return all the row page breaks
*/
public Iterator getRowBreaks() {
- return rowBreaks.getBreaksIterator();
+ return rowBreaks.getBreaksIterator();
}
-
+
/**
* 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 (rowBreaks == null) ? 0 : (int)rowBreaks.getNumBreaks();
}
-
+
/**
* Returns all the column page breaks
* @return all the column page breaks
*/
public Iterator getColumnBreaks(){
- return colBreaks.getBreaksIterator();
+ return colBreaks.getBreaksIterator();
}
-
+
/**
* 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 (colBreaks == null) ? 0 : (int)colBreaks.getNumBreaks();
}
public void setColumnGroupCollapsed( short columnNumber, boolean collapsed )
@@ -3030,213 +2794,40 @@
records.add(protIdx+2,srec);
scenprotect = srec;
}
- }
+ }
/**
- * unprotect objects in the sheet (will not protect them, but any set to false are
+ * unprotect objects in the sheet (will not protect them, but any set to false are
* unprotected.
* @param sheet is unprotected (false = unprotect)
* @param objects are unprotected (false = unprotect)
* @param scenarios are unprotected (false = unprotect)
*/
public void unprotectSheet( boolean sheet, boolean objects, boolean scenarios ) {
- int protIdx = -1;
+
if (!sheet) {
ProtectRecord prec = getProtect();
prec.setProtect(sheet);
PasswordRecord pass = getPassword();
pass.setPassword((short)00);
- }
+ }
if(objprotect != null && !objects) {
objprotect.setProtect(false);
}
if(scenprotect != null && !scenarios) {
scenprotect.setProtect(false);
}
- }
+ }
/**
* @return {sheet is protected, objects are proteced, scenarios are protected}
*/
public boolean[] isProtected() {
- return new boolean[] { (protect != null && protect.getProtect()),
+ return new boolean[] { (protect != null && protect.getProtect()),
(objprotect != null && objprotect.getProtect()),
(scenprotect != null && scenprotect.getProtect())};
}
-
-// private void collapseColumn( short columnNumber )
-// {
-// int idx = findColumnIdx( columnNumber, 0 );
-// if (idx == -1)
-// return;
-//
-// // Find the start of the group.
-// ColumnInfoRecord columnInfo = (ColumnInfoRecord) columnSizes.get( findStartOfColumnOutlineGroup( idx ) );
-//
-// // Hide all the columns until the end of the group
-// columnInfo = writeHidden( columnInfo, idx, true );
-//
-// // Write collapse field
-// setColumn( (short) ( columnInfo.getLastColumn() + 1 ), null, null, null, Boolean.TRUE);
-// }
-
-// private void expandColumn( short columnNumber )
-// {
-// int idx = findColumnIdx( columnNumber, 0 );
-// if (idx == -1)
-// return;
-//
-// // If it is already exapanded do nothing.
-// if (!isColumnGroupCollapsed(idx))
-// return;
-//
-// // Find the start of the group.
-// int startIdx = findStartOfColumnOutlineGroup( idx );
-// ColumnInfoRecord columnInfo = getColInfo( startIdx );
-//
-// // Find the end of the group.
-// int endIdx = findEndOfColumnOutlineGroup( idx );
-// ColumnInfoRecord endColumnInfo = getColInfo( endIdx );
-//
-// // expand:
-// // colapsed bit must be unset
-// // hidden bit gets unset _if_ surrounding groups are expanded you can determine
-// // this by looking at the hidden bit of the enclosing group. You will have
-// // to look at the start and the end of the current group to determine which
-// // is the enclosing group
-// // hidden bit only is altered for this outline level. ie. don't uncollapse contained groups
-// if (!isColumnGroupHiddenByParent( idx ))
-// {
-// for (int i = startIdx; i <= endIdx; i++)
-// {
-// if (columnInfo.getOutlineLevel() == getColInfo(i).getOutlineLevel())
-// getColInfo(i).setHidden( false );
-// }
-// }
-//
-// // Write collapse field
-// setColumn( (short) ( columnInfo.getLastColumn() + 1 ), null, null, null, Boolean.FALSE);
-// }
-
-// private boolean isColumnGroupCollapsed( int idx )
-// {
-// int endOfOutlineGroupIdx = findEndOfColumnOutlineGroup( idx );
-// if (endOfOutlineGroupIdx >= columnSizes.size())
-// return false;
-// if (getColInfo(endOfOutlineGroupIdx).getLastColumn() + 1 != getColInfo(endOfOutlineGroupIdx + 1).getFirstColumn())
-// return false;
-// else
-// return getColInfo(endOfOutlineGroupIdx+1).getCollapsed();
-// }
-
-// private boolean isColumnGroupHiddenByParent( int idx )
-// {
-// // Look out outline details of end
-// int endLevel;
-// boolean endHidden;
-// int endOfOutlineGroupIdx = findEndOfColumnOutlineGroup( idx );
-// if (endOfOutlineGroupIdx >= columnSizes.size())
-// {
-// endLevel = 0;
-// endHidden = false;
-// }
-// else if (getColInfo(endOfOutlineGroupIdx).getLastColumn() + 1 != getColInfo(endOfOutlineGroupIdx + 1).getFirstColumn())
-// {
-// endLevel = 0;
-// endHidden = false;
-// }
-// else
-// {
-// endLevel = getColInfo( endOfOutlineGroupIdx + 1).getOutlineLevel();
-// endHidden = getColInfo( endOfOutlineGroupIdx + 1).getHidden();
-// }
-//
-// // Look out outline details of start
-// int startLevel;
-// boolean startHidden;
-// int startOfOutlineGroupIdx = findStartOfColumnOutlineGroup( idx );
-// if (startOfOutlineGroupIdx <= 0)
-// {
-// startLevel = 0;
-// startHidden = false;
-// }
-// else if (getColInfo(startOfOutlineGroupIdx).getFirstColumn() - 1 != getColInfo(startOfOutlineGroupIdx - 1).getLastColumn())
-// {
-// startLevel = 0;
-// startHidden = false;
-// }
-// else
-// {
-// startLevel = getColInfo( startOfOutlineGroupIdx - 1).getOutlineLevel();
-// startHidden = getColInfo( startOfOutlineGroupIdx - 1 ).getHidden();
-// }
-//
-// if (endLevel > startLevel)
-// {
-// return endHidden;
-// }
-// else
-// {
-// return startHidden;
-// }
-// }
-// private ColumnInfoRecord getColInfo(int idx)
-// {
-// return columns.getColInfo( idx );
-// }
-
-// private int findStartOfColumnOutlineGroup(int idx)
-// {
-// // Find the start of the group.
-// ColumnInfoRecord columnInfo = (ColumnInfoRecord) columnSizes.get( idx );
-// int level = columnInfo.getOutlineLevel();
-// while (idx != 0)
-// {
-// ColumnInfoRecord prevColumnInfo = (ColumnInfoRecord) columnSizes.get( idx - 1 );
-// if (columnInfo.getFirstColumn() - 1 == prevColumnInfo.getLastColumn())
-// {
-// if (prevColumnInfo.getOutlineLevel() < level)
-// {
-// break;
-// }
-// idx--;
-// columnInfo = prevColumnInfo;
-// }
-// else
-// {
-// break;
-// }
-// }
-//
-// return idx;
-// }
-
-// private int findEndOfColumnOutlineGroup(int idx)
-// {
-// // Find the end of the group.
-// ColumnInfoRecord columnInfo = (ColumnInfoRecord) columnSizes.get( idx );
-// int level = columnInfo.getOutlineLevel();
-// while (idx < columnSizes.size() - 1)
-// {
-// ColumnInfoRecord nextColumnInfo = (ColumnInfoRecord) columnSizes.get( idx + 1 );
-// if (columnInfo.getLastColumn() + 1 == nextColumnInfo.getFirstColumn())
-// {
-// if (nextColumnInfo.getOutlineLevel() < level)
-// {
-// break;
-// }
-// idx++;
-// columnInfo = nextColumnInfo;
-// }
-// else
-// {
-// break;
-// }
-// }
-//
-// return idx;
-// }
public void groupRowRange(int fromRow, int toRow, boolean indent)
{
@@ -3272,8 +2863,8 @@
// Grab the guts record, adding if needed
GutsRecord guts = (GutsRecord) findFirstRecordBySid( GutsRecord.sid );
if(guts == null) {
- guts = new GutsRecord();
- records.add(guts);
+ guts = new GutsRecord();
+ records.add(guts);
}
// Set the levels onto it
guts.setRowLevelMax( (short) ( maxLevel + 1 ) );
@@ -3291,126 +2882,4 @@
rows.expandRow( row );
}
}
-
-
-// private void collapseRow( int rowNumber )
-// {
-//
-// // Find the start of the group.
-// int startRow = rows.findStartOfRowOutlineGroup( rowNumber );
-// RowRecord rowRecord = (RowRecord) rows.getRow( startRow );
-//
-// // Hide all the columns until the end of the group
-// int lastRow = rows.writeHidden( rowRecord, startRow, true );
-//
-// // Write collapse field
-// if (getRow(lastRow + 1) != null)
-// {
-// getRow(lastRow + 1).setColapsed( true );
-// }
-// else
-// {
-// RowRecord row = createRow( lastRow + 1);
-// row.setColapsed( true );
-// rows.insertRow( row );
-// }
-// }
-
-// private int findStartOfRowOutlineGroup(int row)
-// {
-// // Find the start of the group.
-// RowRecord rowRecord = rows.getRow( row );
-// int level = rowRecord.getOutlineLevel();
-// int currentRow = row;
-// while (rows.getRow( currentRow ) != null)
-// {
-// rowRecord = rows.getRow( currentRow );
-// if (rowRecord.getOutlineLevel() < level)
-// return currentRow + 1;
-// currentRow--;
-// }
-//
-// return currentRow + 1;
-// }
-
-// private int writeHidden( RowRecord rowRecord, int row, boolean hidden )
-// {
-// int level = rowRecord.getOutlineLevel();
-// while (rowRecord != null && rows.getRow(row).getOutlineLevel() >= level)
-// {
-// rowRecord.setZeroHeight( hidden );
-// row++;
-// rowRecord = rows.getRow( row );
-// }
-// return row - 1;
-// }
-
-// private int findEndOfRowOutlineGroup( int row )
-// {
-// int level = getRow( row ).getOutlineLevel();
-// int currentRow;
-// for (currentRow = row; currentRow < rows.getLastRowNum(); currentRow++)
-// {
-// if (getRow(currentRow) == null || getRow(currentRow).getOutlineLevel() < level)
-// {
-// break;
-// }
-// }
-//
-// return currentRow-1;
-// }
-
-// private boolean isRowGroupCollapsed( int row )
-// {
-// int collapseRow = rows.findEndOfRowOutlineGroup( row ) + 1;
-//
-// if (getRow(collapseRow) == null)
-// return false;
-// else
-// return getRow( collapseRow ).getColapsed();
-// }
-
-
-// private boolean isRowGroupHiddenByParent( int row )
-// {
-// // Look out outline details of end
-// int endLevel;
-// boolean endHidden;
-// int endOfOutlineGroupIdx = rows.findEndOfRowOutlineGroup( row );
-// if (getRow( endOfOutlineGroupIdx + 1 ) == null)
-// {
-// endLevel = 0;
-// endHidden = false;
-// }
-// else
-// {
-// endLevel = getRow( endOfOutlineGroupIdx + 1).getOutlineLevel();
-// endHidden = getRow( endOfOutlineGroupIdx + 1).getZeroHeight();
-// }
-//
-// // Look out outline details of start
-// int startLevel;
-// boolean startHidden;
-// int startOfOutlineGroupIdx = rows.findStartOfRowOutlineGroup( row );
-// if (startOfOutlineGroupIdx - 1 < 0 || getRow(startOfOutlineGroupIdx - 1) == null)
-// {
-// startLevel = 0;
-// startHidden = false;
-// }
-// else
-// {
-// startLevel = getRow( startOfOutlineGroupIdx - 1).getOutlineLevel();
-// startHidden = getRow( startOfOutlineGroupIdx - 1 ).getZeroHeight();
-// }
-//
-// if (endLevel > startLevel)
-// {
-// return endHidden;
-// }
-// else
-// {
-// return startHidden;
-// }
-// }
-
}
Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/record/PaneRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/record/PaneRecord.java?rev=657135&r1=657134&r2=657135&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/record/PaneRecord.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/record/PaneRecord.java Fri May 16 10:08:40 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.*;
+import org.apache.poi.util.HexDump;
+import org.apache.poi.util.LittleEndian;
/**
* Describes the frozen and unfozen panes.
@@ -30,9 +28,7 @@
* @author Glen Stampoultzis (glens at apache.org)
*/
-public class PaneRecord
- extends Record
-{
+public final class PaneRecord extends Record {
public final static short sid = 0x41;
private short field_1_x;
private short field_2_y;
@@ -42,7 +38,10 @@
public final static short ACTIVE_PANE_LOWER_RIGHT = 0;
public final static short ACTIVE_PANE_UPPER_RIGHT = 1;
public final static short ACTIVE_PANE_LOWER_LEFT = 2;
+ // TODO - remove obsolete field (it was deprecated May-2008 v3.1)
+ /** @deprecated use ACTIVE_PANE_UPPER_LEFT */
public final static short ACTIVE_PANE_UPER_LEFT = 3;
+ public final static short ACTIVE_PANE_UPPER_LEFT = 3;
public PaneRecord()
@@ -82,7 +81,6 @@
field_3_topRow = in.readShort();
field_4_leftColumn = in.readShort();
field_5_activePane = in.readShort();
-
}
public String toString()
@@ -229,7 +227,7 @@
* ACTIVE_PANE_LOWER_RIGHT
* ACTIVE_PANE_UPPER_RIGHT
* ACTIVE_PANE_LOWER_LEFT
- * ACTIVE_PANE_UPER_LEFT
+ * ACTIVE_PANE_UPPER_LEFT
*/
public short getActivePane()
{
@@ -244,16 +242,10 @@
* ACTIVE_PANE_LOWER_RIGHT
* ACTIVE_PANE_UPPER_RIGHT
* ACTIVE_PANE_LOWER_LEFT
- * ACTIVE_PANE_UPER_LEFT
+ * ACTIVE_PANE_UPPER_LEFT
*/
public void setActivePane(short field_5_activePane)
{
this.field_5_activePane = field_5_activePane;
}
-
-
-} // END OF CLASS
-
-
-
-
+}
Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/record/RowRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/record/RowRecord.java?rev=657135&r1=657134&r2=657135&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/record/RowRecord.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/record/RowRecord.java Fri May 16 10:08:40 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,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hssf.record;
@@ -31,20 +29,18 @@
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
-
-public class RowRecord
- extends Record
- implements Comparable
-{
- public final static short sid = 0x208;
+public final class RowRecord extends Record implements Comparable {
+ public final static short sid = 0x208;
- /** The maximum row number that excel can handle (zero bazed) ie 65536 rows is
+ private static final int OPTION_BITS_ALWAYS_SET = 0x0100;
+ private static final int DEFAULT_HEIGHT_BIT = 0x8000;
+
+ /** The maximum row number that excel can handle (zero based) ie 65536 rows is
* max number of rows.
*/
public final static int MAX_ROW_NUMBER = 65535;
- //private short field_1_row_number;
- private int field_1_row_number;
+ private int field_1_row_number;
private short field_2_first_col;
private short field_3_last_col; // plus 1
private short field_4_height;
@@ -52,7 +48,8 @@
// for generated sheets.
private short field_6_reserved;
- private short field_7_option_flags;
+ /** 16 bit options flags */
+ private int field_7_option_flags;
private static final BitField outlineLevel = BitFieldFactory.getInstance(0x07);
// bit 3 reserved
@@ -62,8 +59,17 @@
private static final BitField formatted = BitFieldFactory.getInstance(0x80);
private short field_8_xf_index; // only if isFormatted
- public RowRecord()
- {
+ public RowRecord(int rowNumber) {
+ field_1_row_number = rowNumber;
+ field_2_first_col = -1;
+ field_3_last_col = -1;
+ field_4_height = (short)DEFAULT_HEIGHT_BIT;
+ field_4_height = (short)DEFAULT_HEIGHT_BIT;
+ field_5_optimize = ( short ) 0;
+ field_6_reserved = ( short ) 0;
+ field_7_option_flags = OPTION_BITS_ALWAYS_SET; // seems necessary for outlining
+
+ field_8_xf_index = ( short ) 0xf;
}
/**
@@ -86,7 +92,6 @@
protected void fillFields(RecordInputStream in)
{
- //field_1_row_number = LittleEndian.getShort(data, 0 + offset);
field_1_row_number = in.readUShort();
field_2_first_col = in.readShort();
field_3_last_col = in.readShort();
@@ -156,7 +161,7 @@
public void setOptionFlags(short options)
{
- field_7_option_flags = options;
+ field_7_option_flags = options | OPTION_BITS_ALWAYS_SET;
}
// option bitfields
@@ -169,20 +174,18 @@
public void setOutlineLevel(short ol)
{
- field_7_option_flags =
- outlineLevel.setShortValue(field_7_option_flags, ol);
+ field_7_option_flags = outlineLevel.setValue(field_7_option_flags, ol);
}
/**
- * set whether or not to colapse this row
- * @param c - colapse or not
+ * set whether or not to collapse this row
+ * @param c - collapse or not
* @see #setOptionFlags(short)
*/
public void setColapsed(boolean c)
{
- field_7_option_flags = colapsed.setShortBoolean(field_7_option_flags,
- c);
+ field_7_option_flags = colapsed.setBoolean(field_7_option_flags, c);
}
/**
@@ -193,8 +196,7 @@
public void setZeroHeight(boolean z)
{
- field_7_option_flags =
- zeroHeight.setShortBoolean(field_7_option_flags, z);
+ field_7_option_flags = zeroHeight.setBoolean(field_7_option_flags, z);
}
/**
@@ -205,8 +207,7 @@
public void setBadFontHeight(boolean f)
{
- field_7_option_flags =
- badFontHeight.setShortBoolean(field_7_option_flags, f);
+ field_7_option_flags = badFontHeight.setBoolean(field_7_option_flags, f);
}
/**
@@ -217,8 +218,7 @@
public void setFormatted(boolean f)
{
- field_7_option_flags = formatted.setShortBoolean(field_7_option_flags,
- f);
+ field_7_option_flags = formatted.setBoolean(field_7_option_flags, f);
}
// end bitfields
@@ -293,7 +293,7 @@
public short getOptionFlags()
{
- return field_7_option_flags;
+ return (short)field_7_option_flags;
}
// option bitfields
@@ -306,7 +306,7 @@
public short getOutlineLevel()
{
- return outlineLevel.getShortValue(field_7_option_flags);
+ return (short)outlineLevel.getValue(field_7_option_flags);
}
/**
@@ -410,7 +410,6 @@
{
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, ( short ) 16);
- //LittleEndian.putShort(data, 4 + offset, getRowNumber());
LittleEndian.putShort(data, 4 + offset, ( short ) getRowNumber());
LittleEndian.putShort(data, 6 + offset, getFirstCol() == -1 ? (short)0 : getFirstCol());
LittleEndian.putShort(data, 8 + offset, getLastCol() == -1 ? (short)0 : getLastCol());
@@ -419,7 +418,6 @@
LittleEndian.putShort(data, 14 + offset, field_6_reserved);
LittleEndian.putShort(data, 16 + offset, getOptionFlags());
-// LittleEndian.putShort(data,18,getOutlineLevel());
LittleEndian.putShort(data, 18 + offset, getXFIndex());
return getRecordSize();
}
@@ -469,8 +467,7 @@
}
public Object clone() {
- RowRecord rec = new RowRecord();
- rec.field_1_row_number = field_1_row_number;
+ RowRecord rec = new RowRecord(field_1_row_number);
rec.field_2_first_col = field_2_first_col;
rec.field_3_last_col = field_3_last_col;
rec.field_4_height = field_4_height;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org