You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ye...@apache.org on 2008/01/25 16:48:23 UTC
svn commit: r615249 [1/3] - in /poi/tags/REL_3_0_2_BETA3: ./
src/documentation/content/xdocs/ src/documentation/content/xdocs/hssf/
src/java/org/apache/poi/ddf/ src/java/org/apache/poi/hssf/model/
src/java/org/apache/poi/hssf/record/ src/java/org/apach...
Author: yegor
Date: Fri Jan 25 07:48:14 2008
New Revision: 615249
URL: http://svn.apache.org/viewvc?rev=615249&view=rev
Log:
merge BETA3 with trunk r615229. OOXML is excluded
Added:
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/UncalcedRecord.java
- copied unchanged from r614961, poi/trunk/src/java/org/apache/poi/hssf/record/UncalcedRecord.java
poi/tags/REL_3_0_2_BETA3/src/scratchpad/testcases/org/apache/poi/hslf/data/SampleShow.ppt
- copied unchanged from r614961, poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/data/SampleShow.ppt
poi/tags/REL_3_0_2_BETA3/src/scratchpad/testcases/org/apache/poi/hslf/data/SampleShow.pptx
- copied unchanged from r614961, poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/data/SampleShow.pptx
poi/tags/REL_3_0_2_BETA3/src/scratchpad/testcases/org/apache/poi/hslf/data/SampleShow.txt
- copied unchanged from r614961, poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/data/SampleShow.txt
poi/tags/REL_3_0_2_BETA3/src/scratchpad/testcases/org/apache/poi/hssf/data/42464-ExpPtg-bad.xls
- copied unchanged from r614961, poi/trunk/src/scratchpad/testcases/org/apache/poi/hssf/data/42464-ExpPtg-bad.xls
poi/tags/REL_3_0_2_BETA3/src/scratchpad/testcases/org/apache/poi/hssf/data/42464-ExpPtg-ok.xls
- copied unchanged from r614961, poi/trunk/src/scratchpad/testcases/org/apache/poi/hssf/data/42464-ExpPtg-ok.xls
poi/tags/REL_3_0_2_BETA3/src/scratchpad/testcases/org/apache/poi/hssf/model/
- copied from r614961, poi/trunk/src/scratchpad/testcases/org/apache/poi/hssf/model/
poi/tags/REL_3_0_2_BETA3/src/scratchpad/testcases/org/apache/poi/hssf/model/TestFormulaParserSP.java
- copied unchanged from r614961, poi/trunk/src/scratchpad/testcases/org/apache/poi/hssf/model/TestFormulaParserSP.java
poi/tags/REL_3_0_2_BETA3/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestBug42464.java
- copied unchanged from r614961, poi/trunk/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestBug42464.java
poi/tags/REL_3_0_2_BETA3/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestFormulaEvaluatorDocs.java
- copied unchanged from r614961, poi/trunk/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestFormulaEvaluatorDocs.java
poi/tags/REL_3_0_2_BETA3/src/scratchpad/testcases/org/apache/poi/hwpf/data/Bug44292.doc
- copied unchanged from r615229, poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/data/Bug44292.doc
poi/tags/REL_3_0_2_BETA3/src/scratchpad/testcases/org/apache/poi/hwpf/data/SampleDoc.doc
- copied unchanged from r614961, poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/data/SampleDoc.doc
poi/tags/REL_3_0_2_BETA3/src/scratchpad/testcases/org/apache/poi/hwpf/data/SampleDoc.docx
- copied unchanged from r614961, poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/data/SampleDoc.docx
poi/tags/REL_3_0_2_BETA3/src/scratchpad/testcases/org/apache/poi/hwpf/data/SampleDoc.txt
- copied unchanged from r614961, poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/data/SampleDoc.txt
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/37684-1.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/37684-1.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/37684-2.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/37684-2.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/42464-ExpPtg-bad.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/42464-ExpPtg-bad.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/42464-ExpPtg-ok.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/42464-ExpPtg-ok.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/43493.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/43493.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/43902.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/43902.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/44010-SingleChart.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/44010-SingleChart.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/44010-TwoCharts.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/44010-TwoCharts.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/44167.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/44167.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/44200.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/44200.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/44201.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/44201.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/Booleans.xlsx
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/Booleans.xlsx
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/ForShifting.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/ForShifting.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/NoGutsRecords.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/NoGutsRecords.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/SampleSS.txt
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/SampleSS.txt
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/SampleSS.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/SampleSS.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/SampleSS.xlsx
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/SampleSS.xlsx
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/SharedFormulaTest.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/SharedFormulaTest.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/SheetWithDrawing.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/SheetWithDrawing.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/UncalcedRecord.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/UncalcedRecord.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/WithChart.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/WithChart.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/WithChart.xlsx
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/WithChart.xlsx
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/WithTwoCharts.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/WithTwoCharts.xls
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/WithTwoCharts.xlsx
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/WithTwoCharts.xlsx
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/data/comments.xls
- copied unchanged from r614961, poi/trunk/src/testcases/org/apache/poi/hssf/data/comments.xls
Modified:
poi/tags/REL_3_0_2_BETA3/build.xml
poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/changes.xml
poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/hssf/eval.xml
poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/hssf/quick-guide.xml
poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/index.xml
poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/status.xml
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/ddf/EscherContainerRecord.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/ddf/EscherOptRecord.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/DrawingManager2.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/FormulaParser.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/Sheet.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/Workbook.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DVALRecord.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DVRecord.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DrawingRecord.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/EscherAggregate.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/FormulaRecord.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/NameRecord.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/NoteRecord.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/Record.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/RecordFactory.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/RecordInputStream.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/TextObjectRecord.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/aggregates/FormulaRecordAggregate.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/formula/ErrPtg.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/formula/ExpPtg.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/usermodel/HSSFShapeGroup.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/util/AreaReference.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/util/CellReference.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/poifs/common/POIFSConstants.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/poifs/storage/HeaderBlockReader.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/poifs/storage/RawDataBlock.java
poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/util/IOUtils.java
poi/tags/REL_3_0_2_BETA3/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java
poi/tags/REL_3_0_2_BETA3/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java
poi/tags/REL_3_0_2_BETA3/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java
poi/tags/REL_3_0_2_BETA3/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java
poi/tags/REL_3_0_2_BETA3/src/scratchpad/src/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java
poi/tags/REL_3_0_2_BETA3/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableRow.java
poi/tags/REL_3_0_2_BETA3/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TextExtractor.java
poi/tags/REL_3_0_2_BETA3/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java
poi/tags/REL_3_0_2_BETA3/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/ddf/TestEscherContainerRecord.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/HSSFTests.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/record/TestNoteRecord.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/record/TestNoteStructureSubRecord.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/record/TestTextObjectRecord.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRow.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/usermodel/TestNamedRange.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/usermodel/TestSheetHiding.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/usermodel/TestSheetShiftRows.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/hssf/util/TestAreaReference.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/poifs/filesystem/TestOffice2007XMLException.java
poi/tags/REL_3_0_2_BETA3/src/testcases/org/apache/poi/poifs/storage/TestRawDataBlock.java
Modified: poi/tags/REL_3_0_2_BETA3/build.xml
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/build.xml?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/build.xml (original)
+++ poi/tags/REL_3_0_2_BETA3/build.xml Fri Jan 25 07:48:14 2008
@@ -137,7 +137,7 @@
<property name="ooxml.jar4.dir" location="${ooxml.lib}/jsr173_1.0_api.jar"/>
<property name="ooxml.jar4.url" value="${repository}/xmlbeans/jars/jsr173_1.0_api.jar"/>
<!-- No official release of openxml4j yet -->
- <property name="ooxml.jar5.dir" location="${ooxml.lib}/openxml4j-bin-prealpha-071224.jar"/>
+ <property name="ooxml.jar5.dir" location="${ooxml.lib}/openxml4j-bin-alpha-080124.jar"/>
<property name="ooxml.jar5.url" value="http://people.apache.org/~nick/openxml4j-bin-prealpha-071224.jar"/>
<!-- See http://www.ecma-international.org/publications/standards/Ecma-376.htm -->
@@ -159,7 +159,7 @@
<property name="mavendist.poi.dir" location="build/maven-dist/poi"/>
<property name="mavendist.oap.dir" location="build/maven-dist/org.apache.poi"/>
<property name="jar.name" value="poi"/>
- <property name="version.id" value="3.0.2-beta2"/>
+ <property name="version.id" value="3.0.2-FINAL"/>
<property name="halt.on.test.failure" value="true"/>
<property name="jdk.version.source" value="1.3"
description="JDK version of source code"/>
@@ -368,6 +368,8 @@
destfile="${ooxml.xsds.jar}"
javasource="1.4"
failonerror="false"
+ fork="true"
+ memoryMaximumSize="512m"
>
<classpath refid="ooxml.classpath"/>
</xmlbean>
@@ -460,6 +462,16 @@
<javac target="1.5" source="1.5"
destdir="${ooxml.output.dir}" debug="on" srcdir="${ooxml.src}">
<classpath refid="ooxml.classpath"/>
+ </javac>
+
+ <javac target="1.5" source="1.5"
+ failonerror="true" destdir="${ooxml.output.test.dir}" debug="on"
+ fork="yes" srcdir="${ooxml.src.test}">
+ <classpath>
+ <path refid="ooxml.classpath"/>
+ <pathelement location="${ooxml.output.dir}"/>
+ <pathelement location="${junit.jar1.dir}"/>
+ </classpath>
</javac>
</target>
Modified: poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/changes.xml?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/changes.xml (original)
+++ poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/changes.xml Fri Jan 25 07:48:14 2008
@@ -36,6 +36,27 @@
<!-- Don't forget to update status.xml too! -->
<release version="3.0.2-FINAL" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">44292 - Correctly process the last paragraph in a word file</action>
+ <action dev="POI-DEVELOPERS" type="fix">44254 - Avoid some unread byte warnings, and properly understand DVALRecord</action>
+ <action dev="POI-DEVELOPERS" type="add">Add another formula evaluation method, evaluateFormulaCell(cell), which will re-calculate the value for a formula, without affecting the formula itself.</action>
+ <action dev="POI-DEVELOPERS" type="fix">41726 - Fix how we handle signed cell offsets in relative areas and references</action>
+ <action dev="POI-DEVELOPERS" type="add">44233 - Support for getting and setting a flag on the sheet, which tells excel to re-calculate all formulas on it at next reload</action>
+ <action dev="POI-DEVELOPERS" type="fix">44201 - Enable cloning of sheets with data validation rules</action>
+ <action dev="POI-DEVELOPERS" type="fix">44200 - Enable cloning of sheets with notes</action>
+ <action dev="POI-DEVELOPERS" type="add">43008 - Add a moveCell method to HSSFRow, and deprecate setCellNum(), which didn't update things properly</action>
+ <action dev="POI-DEVELOPERS" type="fix">43058 - Support setting row grouping on files from CR IX, which lack GutsRecords</action>
+ <action dev="POI-DEVELOPERS" type="fix">31795 - Support cloning of sheets with certain drawing objects on them</action>
+ <action dev="POI-DEVELOPERS" type="fix">43902 - Don't consider merged regions when auto-sizing columns</action>
+ <action dev="POI-DEVELOPERS" type="fix">42464 - Avoid "Expected ExpPtg to be converted from Shared to Non-Shared Formula" on large, formula heavy worksheets</action>
+ <action dev="POI-DEVELOPERS" type="add">42033 - Add support for named ranges with unicode names</action>
+ <action dev="POI-DEVELOPERS" type="add">34023 - When shifting rows, update formulas on that sheet to point to the new location of those rows</action>
+ <action dev="POI-DEVELOPERS" type="add">Support getting all the cells referenced by an AreaReference, not just the corner ones</action>
+ <action dev="POI-DEVELOPERS" type="add">43510 - Add support for named ranges in formulas, including non-contiguous named ranges</action>
+ <action dev="POI-DEVELOPERS" type="add">43937 - Add support for hiding and un-hiding sheets, and checking their current hidden status</action>
+ <action dev="POI-DEVELOPERS" type="fix">44167 - Fix for non-contiguous named ranges</action>
+ <action dev="POI-DEVELOPERS" type="fix">44070 - Fix for shifting comments when shifting rows</action>
+ </release>
+ <release version="3.0.2-BETA2" date="2008-01-12">
<action dev="POI-DEVELOPERS" type="add">Support for tables in HSLF</action>
<action dev="POI-DEVELOPERS" type="fix">43781 - Fix for extracting text from TextBoxes HSLF in</action>
<action dev="POI-DEVELOPERS" type="fix">Improve JavaDocs relating to hssf font and fill colourings</action>
@@ -45,7 +66,6 @@
<action dev="POI-DEVELOPERS" type="add">41064 - [PATCH] Support for String continue records</action>
<action dev="POI-DEVELOPERS" type="add">27511 - [PATCH] Support for data validation, via DVRecord and DVALRecord</action>
</release>
-
<release version="3.0.2-BETA1" date="2007-12-04">
<action dev="POI-DEVELOPERS" type="fix">43877 and 39512 - Fix for handling mixed OBJ and CONTINUE records.</action>
<action dev="POI-DEVELOPERS" type="fix">43807 - Throw an IllegalArgumentException if asked to create a merged region with invalid columns or rows, rather than writing out a corrupt file</action>
Modified: poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/hssf/eval.xml
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/hssf/eval.xml?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/hssf/eval.xml (original)
+++ poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/hssf/eval.xml Fri Jan 25 07:48:14 2008
@@ -32,14 +32,18 @@
formulas in Excels sheets read-in, or created in POI. This document explains
how to use the API to evaluate your formulas.
</p>
- <note> This code currently lives the scratchpad area of the POI CVS repository.
+ <note> This code currently lives the scratchpad area of the POI SVN repository.
Ensure that you have the scratchpad jar or the scratchpad build area in your
- classpath before experimenting with this code.
+ classpath before experimenting with this code. You are advised
+ to make use of a recent SVN checkout, as new functions are
+ being supported fairly frequently.
</note>
</section>
+
+ <anchor id="Status"/>
<section><title>Status</title>
<p> The code currently provides implementations for all the arithmatic operators.
- It also provides implementations for approx. 20 built in
+ It also provides implementations for approx. 100 built in
functions in Excel. The framework however makes is easy to add
implementation of new functions. See the <link href="eval-devguide.html"> Formula
evaluation development guide</link> for details. </p>
@@ -51,8 +55,12 @@
<p>The following code demonstrates how to use the HSSFFormulaEvaluator
in the context of other POI excel reading code.
</p>
- <p>There are two ways in which you can use the HSSFFormulaEvalutator API.</p>
+ <p>There are several ways in which you can use the HSSFFormulaEvalutator API.</p>
+
+ <anchor id="Evaluate"/>
<section><title>Using HSSFFormulaEvaluator.<strong>evaluate</strong>(HSSFCell cell)</title>
+ <p>This evaluates a given cell, and returns the new value,
+ without affecting the cell</p>
<source>
FileInputStream fis = new FileInputStream("c:/temp/test.xls");
HSSFWorkbook wb = new HSSFWorkbook(fis);
@@ -94,10 +102,62 @@
a simple value object and does not maintain reference
to the original cell.
</p>
-
</section>
- <section><title>Using HSSFFormulaEvaluator.<strong>evaluateInCell</strong>(HSSFCell cell)
- </title>
+
+ <anchor id="EvaluateFormulaCell"/>
+ <section><title>Using HSSFFormulaEvaluator.<strong>evaluateFormulaCell</strong>(HSSFCell cell)</title>
+ <p><strong>evaluateFormulaCell</strong>(HSSFCell cell)
+ will check to see if the supplied cell is a formula cell.
+ If it isn't, then no changes will be made to it. If it is,
+ then the formula is evaluated. The value for the formula
+ is saved alongside it, to be displayed in excel. The
+ formula remains in the cell, just with a new value</p>
+ <p>The return of the function is the type of the
+ formula result, such as HSSFCell.CELL_TYPE_BOOLEAN</p>
+ <source>
+FileInputStream fis = new FileInputStream("/somepath/test.xls");
+HSSFWorkbook wb = new HSSFWorkbook(fis);
+HSSFSheet sheet = wb.getSheetAt(0);
+HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(sheet, wb);
+
+// suppose your formula is in B3
+CellReference cellReference = new CellReference("B3");
+HSSFRow row = sheet.getRow(cellReference.getRow());
+HSSFCell cell = row.getCell(cellReference.getCol());
+evaluator.setCurrentRow(row);
+
+if (cell!=null) {
+ switch (<strong>evaluator.evaluateFormulaCell</strong>(cell)) {
+ case HSSFCell.CELL_TYPE_BOOLEAN:
+ System.out.println(cell.getBooleanCellValue());
+ break;
+ case HSSFCell.CELL_TYPE_NUMERIC:
+ System.out.println(cell.getNumberCellValue());
+ break;
+ case HSSFCell.CELL_TYPE_STRING:
+ System.out.println(cell.getStringCellValue());
+ break;
+ case HSSFCell.CELL_TYPE_BLANK:
+ break;
+ case HSSFCell.CELL_TYPE_ERROR:
+ System.out.println(cell.getErrorCellValue());
+ break;
+
+ // CELL_TYPE_FORMULA will never occur
+ case HSSFCell.CELL_TYPE_FORMULA:
+ break;
+ }
+}
+ </source>
+ </section>
+
+ <anchor id="EvaluateInCell"/>
+ <section><title>Using HSSFFormulaEvaluator.<strong>evaluateInCell</strong>(HSSFCell cell)</title>
+ <p><strong>evaluateInCell</strong>(HSSFCell cell) will check to
+ see if the supplied cell is a formula cell. If it isn't,
+ then no changes will be made to it. If it is, then the
+ formula is evaluated, and the new value saved into the cell,
+ in place of the old formula.</p>
<source>
FileInputStream fis = new FileInputStream("/somepath/test.xls");
HSSFWorkbook wb = new HSSFWorkbook(fis);
@@ -132,11 +192,36 @@
break;
}
}
- </source>
+ </source>
+ </section>
- </section>
+ <anchor id="EvaluateAll"/>
+ <section><title>Re-calculating all formulas in a Workbook</title>
+ <source>
+FileInputStream fis = new FileInputStream("/somepath/test.xls");
+HSSFWorkbook wb = new HSSFWorkbook(fis);
+for(int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++) {
+ HSSFSheet sheet = wb.getSheetAt(sheetNum);
+ HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(sheet, wb);
+
+ for(Iterator rit = sheet.rowIterator(); rit.hasNext();) {
+ HSSFRow r = (HSSFRow)rit.next();
+ evaluator.setCurrentRow(r);
+
+ for(Iterator cit = r.cellIterator(); cit.hasNext();) {
+ HSSFCell c = (HSSFCell)cit.next();
+ if(c.getCellType() == HSSFCell.CELL_TYPE_FORMULA) {
+ evaluator.evaluateFormulaCell(c);
+ }
+ }
+ }
+}
+wb.write(new FileOutputStream("/somepath/changed.xls"));
+ </source>
+ </section>
</section>
+ <anchor id="Performance"/>
<section><title>Performance Notes</title>
<ul>
<li>Generally you should have to create only one HSSFFormulaEvaluator
Modified: poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/hssf/quick-guide.xml
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/hssf/quick-guide.xml?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/hssf/quick-guide.xml (original)
+++ poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/hssf/quick-guide.xml Fri Jan 25 07:48:14 2008
@@ -1151,7 +1151,7 @@
// retrieve the cell at the named range and test its contents
AreaReference aref = new AreaReference(aNamedCell.getReference());
- CellReference[] crefs = aref.getCells();
+ CellReference[] crefs = aref.getAllReferencedCells();
for (int i=0; i<crefs.length; i++) {
HSSFSheet s = wb.getSheet(crefs[i].getSheetName());
HSSFRow r = sheet.getRow(crefs[i].getRow());
@@ -1159,7 +1159,36 @@
// extract the cell contents based on cell type etc.
}
</source>
+ <p>
+ Reading from non-contiguous Named Ranges
+ </p>
+ <source>
+ // Setup code
+ String cname = "TestName";
+ HSSFWorkbook wb = getMyWorkbook(); // retrieve workbook
+ // Retrieve the named range
+ // Will be something like "$C$10,$D$12:$D$14";
+ int namedCellIdx = wb.getNameIndex(cellName);
+ HSSFName aNamedCell = wb.getNameAt(namedCellIdx);
+
+ // Retrieve the cell at the named range and test its contents
+ // Will get back one AreaReference for C10, and
+ // another for D12 to D14
+ AreaReference[] arefs = AreaReference.generateContiguous(aNamedCell.getReference());
+ for (int i=0; i<arefs.length; i++) {
+ // Only get the corners of the Area
+ // (use arefs[i].getAllReferencedCells() to get all cells)
+ CellReference[] crefs = arefs[i].getCells();
+ for (int j=0; j<crefs.length; j++) {
+ // Check it turns into real stuff
+ HSSFSheet s = wb.getSheet(crefs[j].getSheetName());
+ HSSFRow r = s.getRow(crefs[j].getRow());
+ HSSFCell c = r.getCell(crefs[j].getCol());
+ // Do something with this corner cell
+ }
+ }
+ </source>
</section>
<anchor id="CellComments"/>
<section><title>Cell Comments</title>
Modified: poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/index.xml
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/index.xml?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/index.xml (original)
+++ poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/index.xml Fri Jan 25 07:48:14 2008
@@ -31,14 +31,14 @@
</header>
<body>
- <section><title>POI 3.0.2 BETA1 Release</title>
- <p>The latest release of Apache POI is 3.0.2 BETA1 which was promoted to "Beta" on 04 December 2007. It contains a mixture of
+ <section><title>POI 3.0.2 BETA2 Release</title>
+ <p>The latest release of Apache POI is 3.0.2 BETA2 which was promoted to "Beta" on 12 January 2008. It contains a mixture of
new features and bug fixes, compared to 3.0.1. A full list of changes
is available in
<link href="./changes.html">the changelog</link>, and
- <link href="http://www.apache.org/dyn/closer.cgi/poi/release/">download</link>
+ <link href="http://www.apache.org/dyn/closer.cgi/poi/dev/">download</link>
the source and binaries from your
- <link href="http://www.apache.org/dyn/closer.cgi/poi/release/">local mirror</link>.
+ <link href="http://www.apache.org/dyn/closer.cgi/poi/dev/">local mirror</link>.
The release is also available from the central Maven repository under Group ID "org.apache.poi".
</p>
</section>
Modified: poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/status.xml?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/status.xml (original)
+++ poi/tags/REL_3_0_2_BETA3/src/documentation/content/xdocs/status.xml Fri Jan 25 07:48:14 2008
@@ -33,6 +33,27 @@
<!-- Don't forget to update changes.xml too! -->
<changes>
<release version="3.0.2-FINAL" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">44292 - Correctly process the last paragraph in a word file</action>
+ <action dev="POI-DEVELOPERS" type="fix">44254 - Avoid some unread byte warnings, and properly understand DVALRecord</action>
+ <action dev="POI-DEVELOPERS" type="add">Add another formula evaluation method, evaluateFormulaCell(cell), which will re-calculate the value for a formula, without affecting the formula itself.</action>
+ <action dev="POI-DEVELOPERS" type="fix">41726 - Fix how we handle signed cell offsets in relative areas and references</action>
+ <action dev="POI-DEVELOPERS" type="add">44233 - Support for getting and setting a flag on the sheet, which tells excel to re-calculate all formulas on it at next reload</action>
+ <action dev="POI-DEVELOPERS" type="fix">44201 - Enable cloning of sheets with data validation rules</action>
+ <action dev="POI-DEVELOPERS" type="fix">44200 - Enable cloning of sheets with notes</action>
+ <action dev="POI-DEVELOPERS" type="add">43008 - Add a moveCell method to HSSFRow, and deprecate setCellNum(), which didn't update things properly</action>
+ <action dev="POI-DEVELOPERS" type="fix">43058 - Support setting row grouping on files from CR IX, which lack GutsRecords</action>
+ <action dev="POI-DEVELOPERS" type="fix">31795 - Support cloning of sheets with certain drawing objects on them</action>
+ <action dev="POI-DEVELOPERS" type="fix">43902 - Don't consider merged regions when auto-sizing columns</action>
+ <action dev="POI-DEVELOPERS" type="fix">42464 - Avoid "Expected ExpPtg to be converted from Shared to Non-Shared Formula" on large, formula heavy worksheets</action>
+ <action dev="POI-DEVELOPERS" type="add">42033 - Add support for named ranges with unicode names</action>
+ <action dev="POI-DEVELOPERS" type="add">34023 - When shifting rows, update formulas on that sheet to point to the new location of those rows</action>
+ <action dev="POI-DEVELOPERS" type="add">Support getting all the cells referenced by an AreaReference, not just the corner ones</action>
+ <action dev="POI-DEVELOPERS" type="add">43510 - Add support for named ranges in formulas, including non-contiguous named ranges</action>
+ <action dev="POI-DEVELOPERS" type="add">43937 - Add support for hiding and un-hiding sheets, and checking their current hidden status</action>
+ <action dev="POI-DEVELOPERS" type="fix">44167 - Fix for non-contiguous named ranges</action>
+ <action dev="POI-DEVELOPERS" type="fix">44070 - Fix for shifting comments when shifting rows</action>
+ </release>
+ <release version="3.0.2-BETA2" date="2008-01-12">
<action dev="POI-DEVELOPERS" type="add">Support for tables in HSLF</action>
<action dev="POI-DEVELOPERS" type="fix">43781 - Fix for extracting text from TextBoxes HSLF in</action>
<action dev="POI-DEVELOPERS" type="fix">Improve JavaDocs relating to hssf font and fill colourings</action>
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/ddf/EscherContainerRecord.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/ddf/EscherContainerRecord.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/ddf/EscherContainerRecord.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/ddf/EscherContainerRecord.java Fri Jan 25 07:48:14 2008
@@ -100,11 +100,47 @@
}
return 8 + childRecordsSize;
}
+
+ /**
+ * Do any of our (top level) children have the
+ * given recordId?
+ */
+ public boolean hasChildOfType(short recordId) {
+ for ( Iterator iterator = getChildRecords().iterator(); iterator.hasNext(); )
+ {
+ EscherRecord r = (EscherRecord) iterator.next();
+ if(r.getRecordId() == recordId) {
+ return true;
+ }
+ }
+ return false;
+ }
+ /**
+ * Returns a list of all the child (escher) records
+ * of the container.
+ */
public List getChildRecords()
{
return childRecords;
}
+
+ /**
+ * Returns all of our children which are also
+ * EscherContainers (may be 0, 1, or vary rarely
+ * 2 or 3)
+ */
+ public List getChildContainers() {
+ List containers = new ArrayList();
+ for ( Iterator iterator = getChildRecords().iterator(); iterator.hasNext(); )
+ {
+ EscherRecord r = (EscherRecord) iterator.next();
+ if(r instanceof EscherContainerRecord) {
+ containers.add(r);
+ }
+ }
+ return containers;
+ }
public void setChildRecords( List childRecords )
{
@@ -149,26 +185,42 @@
public String toString()
{
+ return toString("");
+ }
+ public String toString(String indent)
+ {
String nl = System.getProperty( "line.separator" );
StringBuffer children = new StringBuffer();
if ( getChildRecords().size() > 0 )
{
children.append( " children: " + nl );
+
+ int count = 0;
for ( Iterator iterator = getChildRecords().iterator(); iterator.hasNext(); )
{
+ String newIndent = indent + " ";
+
EscherRecord record = (EscherRecord) iterator.next();
- children.append( record.toString() );
-// children.append( nl );
+ children.append(newIndent + "Child " + count + ":" + nl);
+
+ if(record instanceof EscherContainerRecord) {
+ EscherContainerRecord ecr = (EscherContainerRecord)record;
+ children.append( ecr.toString(newIndent));
+ } else {
+ children.append( record.toString() );
+ }
+ count++;
}
}
- return getClass().getName() + " (" + getRecordName() + "):" + nl +
- " isContainer: " + isContainerRecord() + nl +
- " options: 0x" + HexDump.toHex( getOptions() ) + nl +
- " recordId: 0x" + HexDump.toHex( getRecordId() ) + nl +
- " numchildren: " + getChildRecords().size() + nl +
- children.toString();
+ return
+ indent + getClass().getName() + " (" + getRecordName() + "):" + nl +
+ indent + " isContainer: " + isContainerRecord() + nl +
+ indent + " options: 0x" + HexDump.toHex( getOptions() ) + nl +
+ indent + " recordId: 0x" + HexDump.toHex( getRecordId() ) + nl +
+ indent + " numchildren: " + getChildRecords().size() + nl +
+ indent + children.toString();
}
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/ddf/EscherOptRecord.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/ddf/EscherOptRecord.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/ddf/EscherOptRecord.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/ddf/EscherOptRecord.java Fri Jan 25 07:48:14 2008
@@ -18,11 +18,14 @@
package org.apache.poi.ddf;
-import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.HexDump;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
-import java.util.*;
-import java.io.IOException;
+import org.apache.poi.util.HexDump;
+import org.apache.poi.util.LittleEndian;
/**
* The opt record is used to store property values for a shape. It is the key to determining
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/DrawingManager2.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/DrawingManager2.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/DrawingManager2.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/DrawingManager2.java Fri Jan 25 07:48:14 2008
@@ -39,6 +39,13 @@
{
this.dgg = dgg;
}
+
+ /**
+ * Clears the cached list of drawing groups
+ */
+ public void clearDrawingGroups() {
+ drawingGroups.clear();
+ }
public EscherDgRecord createDgRecord()
{
@@ -93,9 +100,13 @@
}
//////////// Non-public methods /////////////
+
+ /**
+ * Finds the next available (1 based) drawing group id
+ */
short findNewDrawingGroupId()
{
- short dgId = 1;
+ short dgId = 1;
while ( drawingGroupExists( dgId ) )
dgId++;
return dgId;
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/FormulaParser.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/FormulaParser.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/FormulaParser.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/FormulaParser.java Fri Jan 25 07:48:14 2008
@@ -24,6 +24,7 @@
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import java.util.regex.Pattern;
//import PTG's .. since we need everything, import *
import org.apache.poi.hssf.record.formula.*;
@@ -65,6 +66,12 @@
* Using an unsynchronized linkedlist to implement a stack since we're not multi-threaded.
*/
private List functionTokens = new LinkedList();
+
+ /**
+ * Used for spotting if we have a cell reference,
+ * or a named range
+ */
+ private final static Pattern CELL_REFERENCE_PATTERN = Pattern.compile("(?:('?)[^:\\\\/\\?\\*\\[\\]]+\\1!)?\\$?[A-Za-z]+\\$?[\\d]+");
private static char TAB = '\t';
private static char CR = '\n';
@@ -306,15 +313,27 @@
tokens.add(new Ref3DPtg(first,externIdx));
}
} else {
- //this can be either a cell ref or a named range !!
- boolean cellRef = true ; //we should probably do it with reg exp??
+ // This can be either a cell ref or a named range
+ // Try to spot which it is
+ boolean cellRef = CELL_REFERENCE_PATTERN.matcher(name).matches();
boolean boolLit = (name.equals("TRUE") || name.equals("FALSE"));
+
if (boolLit) {
tokens.add(new BoolPtg(name));
} else if (cellRef) {
tokens.add(new ReferencePtg(name));
- }else {
- //handle after named range is integrated!!
+ } else {
+ boolean nameRecordExists = false;
+ for(int i = 0; i < book.getNumNames(); i++) {
+ // Our formula will by now contain an upper-cased
+ // version of any named range names
+ if(book.getNameRecord(i).getNameText().toUpperCase().equals(name)) {
+ nameRecordExists = true;
+ }
+ }
+ if(!nameRecordExists)
+ Abort("Found reference to named range \"" + name + "\", but that named range wasn't defined!");
+ tokens.add(new NamePtg(name, book));
}
}
}
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/Sheet.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/Sheet.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/Sheet.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/Sheet.java Fri Jan 25 07:48:14 2008
@@ -97,6 +97,8 @@
protected ScenarioProtectRecord scenprotect = null;
protected PasswordRecord password = null;
+ /** 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;
public static final byte PANE_UPPER_RIGHT = (byte)1;
@@ -161,6 +163,9 @@
break;
}
}
+ else if (rec.getSid() == UncalcedRecord.sid) {
+ retval.uncalced = true;
+ }
else if (rec.getSid() == DimensionsRecord.sid)
{
// Make a columns aggregate if one hasn't ready been created.
@@ -736,8 +741,14 @@
{
Record record = (( Record ) records.get(k));
- //Once the rows have been found in the list of records, start
- //writing out the blocked row information. This includes the DBCell references
+ // Don't write out UncalcedRecord entries, as
+ // we handle those specially just below
+ if (record instanceof UncalcedRecord) {
+ 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) {
pos += ((RowRecordsAggregate)record).serialize(pos, data, cells); // rec.length;
} else if (record instanceof ValueRecordsAggregate) {
@@ -745,8 +756,14 @@
} else {
pos += record.serialize(pos, data ); // rec.length;
}
- //If the BOF record was just serialized then add the IndexRecord
+
+ // 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);
+ }
//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 && !haveSerializedIndex) {
@@ -2184,6 +2201,11 @@
retval += 2;
}
}
+ // Add space for UncalcedRecord
+ if (uncalced) {
+ retval += UncalcedRecord.getStaticRecordSize();
+ }
+
return retval;
}
@@ -2651,8 +2673,22 @@
public boolean isDisplayRowColHeadings() {
return windowTwo.getDisplayRowColHeadings();
}
+
/**
+ * @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;
+ }
+
+ /**
* Returns the array of margins. If not created, will create.
*
* @return the array of marings.
@@ -2663,12 +2699,26 @@
return margins;
}
- public int aggregateDrawingRecords(DrawingManager2 drawingManager)
+ /**
+ * Finds the DrawingRecord for our sheet, and
+ * attaches it to the DrawingManager (which knows about
+ * the overall DrawingGroup for our workbook).
+ * If requested, will create a new DrawRecord
+ * if none currently exist
+ * @param drawingManager The DrawingManager2 for our workbook
+ * @param createIfMissing Should one be created if missing?
+ */
+ public int aggregateDrawingRecords(DrawingManager2 drawingManager, boolean createIfMissing)
{
int loc = findFirstRecordLocBySid(DrawingRecord.sid);
- boolean noDrawingRecordsFound = loc == -1;
+ boolean noDrawingRecordsFound = (loc == -1);
if (noDrawingRecordsFound)
{
+ if(!createIfMissing) {
+ // None found, and not allowed to add in
+ return -1;
+ }
+
EscherAggregate aggregate = new EscherAggregate( drawingManager );
loc = findFirstRecordLocBySid(EscherAggregate.sid);
if (loc == -1)
@@ -3144,7 +3194,13 @@
maxLevel = Math.max(rowRecord.getOutlineLevel(), maxLevel);
}
+ // Grab the guts record, adding if needed
GutsRecord guts = (GutsRecord) findFirstRecordBySid( GutsRecord.sid );
+ if(guts == null) {
+ guts = new GutsRecord();
+ records.add(guts);
+ }
+ // Set the levels onto it
guts.setRowLevelMax( (short) ( maxLevel + 1 ) );
guts.setLeftRowGutter( (short) ( 29 + (12 * (maxLevel)) ) );
}
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/Workbook.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/Workbook.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/Workbook.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/model/Workbook.java Fri Jan 25 07:48:14 2008
@@ -543,6 +543,29 @@
}
/**
+ * gets the hidden flag for a given sheet.
+ *
+ * @param sheetnum the sheet number (0 based)
+ * @return True if sheet is hidden
+ */
+
+ public boolean isSheetHidden(int sheetnum) {
+ BoundSheetRecord bsr = ( BoundSheetRecord ) boundsheets.get(sheetnum);
+ return bsr.isHidden();
+ }
+
+ /**
+ * Hide or unhide a sheet
+ *
+ * @param sheetnum The sheet number
+ * @param hidden True to mark the sheet as hidden, false otherwise
+ */
+
+ public void setSheetHidden(int sheetnum, boolean hidden) {
+ BoundSheetRecord bsr = ( BoundSheetRecord ) boundsheets.get(sheetnum);
+ bsr.setHidden(hidden);
+ }
+ /**
* get the sheet's index
* @param name sheet name
* @return sheet index or -1 if it was not found.
@@ -2142,13 +2165,68 @@
}
return palette;
}
+
+ /**
+ * Finds the primary drawing group, if one already exists
+ */
+ public void findDrawingGroup() {
+ // Need to find a DrawingGroupRecord that
+ // contains a EscherDggRecord
+ for(Iterator rit = records.iterator(); rit.hasNext();) {
+ Record r = (Record)rit.next();
+
+ if(r instanceof DrawingGroupRecord) {
+ DrawingGroupRecord dg = (DrawingGroupRecord)r;
+ dg.processChildRecords();
+
+ EscherContainerRecord cr =
+ dg.getEscherContainer();
+ if(cr == null) {
+ continue;
+ }
+
+ EscherDggRecord dgg = null;
+ for(Iterator it = cr.getChildRecords().iterator(); it.hasNext();) {
+ Object er = it.next();
+ if(er instanceof EscherDggRecord) {
+ dgg = (EscherDggRecord)er;
+ }
+ }
+
+ if(dgg != null) {
+ drawingManager = new DrawingManager2(dgg);
+ return;
+ }
+ }
+ }
+
+ // Look for the DrawingGroup record
+ int dgLoc = findFirstRecordLocBySid(DrawingGroupRecord.sid);
+
+ // If there is one, does it have a EscherDggRecord?
+ if(dgLoc != -1) {
+ DrawingGroupRecord dg =
+ (DrawingGroupRecord)records.get(dgLoc);
+ EscherDggRecord dgg = null;
+ for(Iterator it = dg.getEscherRecords().iterator(); it.hasNext();) {
+ Object er = it.next();
+ if(er instanceof EscherDggRecord) {
+ dgg = (EscherDggRecord)er;
+ }
+ }
+
+ if(dgg != null) {
+ drawingManager = new DrawingManager2(dgg);
+ }
+ }
+ }
/**
- * Creates a drawing group record. If it already exists then it's modified.
+ * Creates a primary drawing group record. If it already
+ * exists then it's modified.
*/
public void createDrawingGroup()
{
-
if (drawingManager == null)
{
EscherContainerRecord dggContainer = new EscherContainerRecord();
@@ -2212,7 +2290,6 @@
}
}
-
}
public WindowOneRecord getWindowOne() {
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java Fri Jan 25 07:48:14 2008
@@ -18,16 +18,17 @@
package org.apache.poi.hssf.record;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
import org.apache.poi.ddf.DefaultEscherRecordFactory;
+import org.apache.poi.ddf.EscherContainerRecord;
import org.apache.poi.ddf.EscherRecord;
import org.apache.poi.ddf.EscherRecordFactory;
import org.apache.poi.ddf.NullEscherSerializationListener;
import org.apache.poi.util.LittleEndian;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
/**
* The escher container record is used to hold escher records. It is abstract and
* must be subclassed for maximum benefit.
@@ -76,7 +77,7 @@
{
if (id != getSid())
{
- throw new RecordFormatException("Not an escher record");
+ throw new RecordFormatException("Not an escher record! (sid was " + id + ", expecting " + getSid() + ")");
}
}
@@ -94,6 +95,9 @@
}
}
+ protected void convertRawBytesToEscherRecords() {
+ convertToEscherRecords(0, rawData.length, rawData);
+ }
private void convertToEscherRecords( int offset, int size, byte[] data )
{
EscherRecordFactory recordFactory = new DefaultEscherRecordFactory();
@@ -227,7 +231,7 @@
public Object clone()
{
- throw new IllegalStateException("Not implemented yet.");
+ return cloneViaReserialise();
}
public void addEscherRecord(int index, EscherRecord element)
@@ -248,6 +252,54 @@
public void clearEscherRecords()
{
escherRecords.clear();
+ }
+
+ /**
+ * If we have a EscherContainerRecord as one of our
+ * children (and most top level escher holders do),
+ * then return that.
+ */
+ public EscherContainerRecord getEscherContainer() {
+ for(Iterator it = escherRecords.iterator(); it.hasNext();) {
+ Object er = it.next();
+ if(er instanceof EscherContainerRecord) {
+ return (EscherContainerRecord)er;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Descends into all our children, returning the
+ * first EscherRecord with the given id, or null
+ * if none found
+ */
+ public EscherRecord findFirstWithId(short id) {
+ return findFirstWithId(id, getEscherRecords());
+ }
+ private EscherRecord findFirstWithId(short id, List records) {
+ // Check at our level
+ for(Iterator it = records.iterator(); it.hasNext();) {
+ EscherRecord r = (EscherRecord)it.next();
+ if(r.getRecordId() == id) {
+ return r;
+ }
+ }
+
+ // Then check our children in turn
+ for(Iterator it = records.iterator(); it.hasNext();) {
+ EscherRecord r = (EscherRecord)it.next();
+ if(r.isContainerRecord()) {
+ EscherRecord found =
+ findFirstWithId(id, r.getChildRecords());
+ if(found != null) {
+ return found;
+ }
+ }
+ }
+
+ // Not found in this lot
+ return null;
}
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java Fri Jan 25 07:48:14 2008
@@ -19,6 +19,7 @@
package org.apache.poi.hssf.record;
+import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.StringUtil;
@@ -36,6 +37,7 @@
public class BoundSheetRecord
extends Record
{
+ private static final short HIDDEN_FLAG_MASK = 0x01;
public final static short sid = 0x85;
private int field_1_position_of_BOF;
private short field_2_option_flags;
@@ -300,5 +302,13 @@
public short getSid()
{
return sid;
+ }
+
+ public boolean isHidden() {
+ return BitFieldFactory.getInstance(HIDDEN_FLAG_MASK).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);
}
}
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DVALRecord.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DVALRecord.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DVALRecord.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DVALRecord.java Fri Jan 25 07:48:14 2008
@@ -29,19 +29,22 @@
public class DVALRecord extends Record
{
- public final static short sid = 0x01B2;
+ public final static short sid = 0x01B2;
- //unknown field ; it's size should be 10
- private short field_unknown = 0x0000;
+ /** Options of the DVAL */
+ private short field_1_options;
+ /** Horizontal position of the dialog */
+ private int field_2_horiz_pos;
+ /** Vertical position of the dialog */
+ private int field_3_vert_pos;
+
+ /** Object ID of the drop down arrow object for list boxes ;
+ * in our case this will be always FFFF , until
+ * MSODrawingGroup and MSODrawing records are implemented */
+ private int field_cbo_id = 0xFFFFFFFF;
- //Object ID of the drop down arrow object for list boxes ;
- //in our case this will be always FFFF , until
- //MSODrawingGroup and MSODrawing records are implemented
- private int field_cbo_id = 0xFFFFFFFF;
-
- //Number of following DV records
- //Default value is 1
- private int field_3_dv_no = 0x00000000;
+ /** Number of following DV Records */
+ private int field_5_dv_no = 0x00000000;
public DVALRecord()
{
@@ -66,17 +69,38 @@
}
}
- protected void fillFields(RecordInputStream in)
- {
- for ( int i=0; i<5; i++)
- {
- this.field_unknown = in.readShort();
- }
+ protected void fillFields(RecordInputStream in)
+ {
+ this.field_1_options = in.readShort();
+ this.field_2_horiz_pos = in.readInt();
+ this.field_3_vert_pos = in.readInt();
this.field_cbo_id = in.readInt();
- this.field_3_dv_no = in.readInt();
- }
+ this.field_5_dv_no = in.readInt();
+ }
+
/**
+ * @param field_1_options the options of the dialog
+ */
+ public void setOptions(short field_1_options) {
+ this.field_1_options = field_1_options;
+ }
+
+ /**
+ * @param field_2_horiz_pos the Horizontal position of the dialog
+ */
+ public void setHorizontalPos(int field_2_horiz_pos) {
+ this.field_2_horiz_pos = field_2_horiz_pos;
+ }
+
+ /**
+ * @param field_3_vert_pos the Vertical position of the dialog
+ */
+ public void setVerticalPos(int field_3_vert_pos) {
+ this.field_3_vert_pos = field_3_vert_pos;
+ }
+
+ /**
* set the object ID of the drop down arrow object for list boxes
* @param cboID - Object ID
*/
@@ -91,10 +115,33 @@
*/
public void setDVRecNo(int dvNo)
{
- this.field_3_dv_no = dvNo;
+ this.field_5_dv_no = dvNo;
}
+
+
/**
+ * @return the field_1_options
+ */
+ public short getOptions() {
+ return field_1_options;
+ }
+
+ /**
+ * @return the Horizontal position of the dialog
+ */
+ public int getHorizontalPos() {
+ return field_2_horiz_pos;
+ }
+
+ /**
+ * @return the the Vertical position of the dialog
+ */
+ public int getVerticalPos() {
+ return field_3_vert_pos;
+ }
+
+ /**
* get Object ID of the drop down arrow object for list boxes
*/
public int getObjectID( )
@@ -107,29 +154,32 @@
*/
public int getDVRecNo( )
{
- return this.field_3_dv_no;
+ return this.field_5_dv_no;
}
- public String toString()
- {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("[DVAL]\n");
- buffer.append(" .comboObjectID = ").append(Integer.toHexString(this.getObjectID())).append("\n");
- buffer.append(" .DVRecordsNumber = ").append(Integer.toHexString(this.getDVRecNo())).append("\n");
- buffer.append("[/DVAL]\n");
- return buffer.toString();
- }
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("[DVAL]\n");
+ buffer.append(" .options = ").append(this.getOptions()).append('\n');
+ buffer.append(" .horizPos = ").append(this.getHorizontalPos()).append('\n');
+ buffer.append(" .vertPos = ").append(this.getVerticalPos()).append('\n');
+ buffer.append(" .comboObjectID = ").append(Integer.toHexString(this.getObjectID())).append("\n");
+ buffer.append(" .DVRecordsNumber = ").append(Integer.toHexString(this.getDVRecNo())).append("\n");
+ buffer.append("[/DVAL]\n");
+ return buffer.toString();
+ }
public int serialize(int offset, byte [] data)
{
LittleEndian.putShort(data, 0 + offset, this.sid);
LittleEndian.putShort(data, 2 + offset, ( short)(this.getRecordSize()-4));
- for ( int i=0; i<5; i++)
- {
- LittleEndian.putShort(data, 4 + i*2 + offset, (short)this.field_unknown);
- }
+
+ LittleEndian.putShort(data, 4 + offset, this.getOptions());
+ LittleEndian.putInt(data, 6 + offset, this.getHorizontalPos());
+ LittleEndian.putInt(data, 10 + offset, this.getVerticalPos());
LittleEndian.putInt(data, 14 + offset, this.getObjectID());
LittleEndian.putInt(data, 18 + offset, this.getDVRecNo());
return getRecordSize();
@@ -149,9 +199,11 @@
public Object clone()
{
DVALRecord rec = new DVALRecord();
- rec.field_unknown = this.field_unknown;
+ rec.field_1_options = field_1_options;
+ rec.field_2_horiz_pos = field_2_horiz_pos;
+ rec.field_3_vert_pos = field_3_vert_pos;
rec.field_cbo_id = this.field_cbo_id;
- rec.field_3_dv_no = this.field_3_dv_no;
+ rec.field_5_dv_no = this.field_5_dv_no;
return rec;
}
-}
\ No newline at end of file
+}
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DVRecord.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DVRecord.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DVRecord.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DVRecord.java Fri Jan 25 07:48:14 2008
@@ -16,16 +16,16 @@
package org.apache.poi.hssf.record;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Stack;
+
+import org.apache.poi.hssf.record.formula.Ptg;
+import org.apache.poi.hssf.util.HSSFCellRangeAddress;
import org.apache.poi.util.BitField;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.StringUtil;
-import org.apache.poi.hssf.util.HSSFCellRangeAddress;
-import org.apache.poi.hssf.record.formula.Ptg;
-
-import java.io.IOException;
-import java.util.Stack;
-import java.util.Hashtable;
-import java.util.Enumeration;
/**
* Title: DV Record<P>
@@ -187,10 +187,13 @@
this.field_not_used_2 = in.readShort();
//read sec formula data condition
- // Not sure if this was needed or not...
+ //Not sure if this was needed or not...
try {
in.skip(this.field_size_sec_formula);
- } catch(IOException e) { throw new IllegalStateException(e); }
+ } catch(IOException e) {
+ e.printStackTrace();
+ throw new IllegalStateException(e.getMessage());
+ }
token_pos = 0;
while (token_pos < this.field_size_sec_formula)
@@ -501,6 +504,14 @@
public short getSid()
{
return this.sid;
+ }
+
+ /**
+ * Clones the object. Uses serialisation, as the
+ * contents are somewhat complex
+ */
+ public Object clone() {
+ return cloneViaReserialise();
}
/**@todo DVRecord = Serializare */
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java Fri Jan 25 07:48:14 2008
@@ -72,6 +72,16 @@
return writeData( offset, data, buffer );
}
}
+
+ /**
+ * Process the bytes into escher records.
+ * (Not done by default in case we break things,
+ * unless you set the "poi.deserialize.escher"
+ * system property)
+ */
+ public void processChildRecords() {
+ convertRawBytesToEscherRecords();
+ }
/**
* Size of record (including 4 byte headers for all sections)
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DrawingRecord.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DrawingRecord.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DrawingRecord.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/DrawingRecord.java Fri Jan 25 07:48:14 2008
@@ -106,4 +106,18 @@
this.recordData = thedata;
}
-}
+ public Object clone() {
+ DrawingRecord rec = new DrawingRecord();
+
+ if (recordData != null) {
+ rec.recordData = new byte[ recordData.length ];
+ System.arraycopy(recordData, 0, rec.recordData, 0, recordData.length);
+ }
+ if (contd != null) {
+ System.arraycopy(contd, 0, rec.contd, 0, contd.length);
+ rec.contd = new byte[ contd.length ];
+ }
+
+ return rec;
+ }
+}
\ No newline at end of file
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/EscherAggregate.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/EscherAggregate.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/EscherAggregate.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/EscherAggregate.java Fri Jan 25 07:48:14 2008
@@ -24,6 +24,8 @@
import org.apache.poi.hssf.model.DrawingManager2;
import org.apache.poi.hssf.model.ConvertAnchor;
import org.apache.poi.hssf.model.CommentShape;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
import java.util.*;
@@ -47,6 +49,7 @@
public class EscherAggregate extends AbstractEscherHolderRecord
{
public static final short sid = 9876;
+ private static POILogger log = POILogFactory.getLogger(EscherAggregate.class);
public static final short ST_MIN = (short) 0;
public static final short ST_NOT_PRIMATIVE = ST_MIN;
@@ -523,7 +526,146 @@
{
this.patriarch = patriarch;
}
-
+
+ /**
+ * Converts the Records into UserModel
+ * objects on the bound HSSFPatriarch
+ */
+ public void convertRecordsToUserModel() {
+ if(patriarch == null) {
+ throw new IllegalStateException("Must call setPatriarch() first");
+ }
+
+ // The top level container ought to have
+ // the DgRecord and the container of one container
+ // per shape group (patriach overall first)
+ EscherContainerRecord topContainer =
+ (EscherContainerRecord)getEscherContainer();
+ if(topContainer == null) {
+ return;
+ }
+ topContainer = (EscherContainerRecord)
+ topContainer.getChildContainers().get(0);
+
+ List tcc = topContainer.getChildContainers();
+ if(tcc.size() == 0) {
+ throw new IllegalStateException("No child escher containers at the point that should hold the patriach data, and one container per top level shape!");
+ }
+
+ // First up, get the patriach position
+ // This is in the first EscherSpgrRecord, in
+ // the first container, with a EscherSRecord too
+ EscherContainerRecord patriachContainer =
+ (EscherContainerRecord)tcc.get(0);
+ EscherSpgrRecord spgr = null;
+ for(Iterator it = patriachContainer.getChildRecords().iterator(); it.hasNext();) {
+ EscherRecord r = (EscherRecord)it.next();
+ if(r instanceof EscherSpgrRecord) {
+ spgr = (EscherSpgrRecord)r;
+ break;
+ }
+ }
+ if(spgr != null) {
+ patriarch.setCoordinates(
+ spgr.getRectX1(), spgr.getRectY1(),
+ spgr.getRectX2(), spgr.getRectY2()
+ );
+ }
+
+ // Now process the containers for each group
+ // and objects
+ for(int i=1; i<tcc.size(); i++) {
+ EscherContainerRecord shapeContainer =
+ (EscherContainerRecord)tcc.get(i);
+ //System.err.println("\n\n*****\n\n");
+ //System.err.println(shapeContainer);
+
+ // Could be a group, or a base object
+ if(shapeContainer.getChildRecords().size() == 1 &&
+ shapeContainer.getChildContainers().size() == 1) {
+ // Group
+ HSSFShapeGroup group =
+ new HSSFShapeGroup(null, new HSSFClientAnchor());
+ patriarch.getChildren().add(group);
+
+ EscherContainerRecord groupContainer =
+ (EscherContainerRecord)shapeContainer.getChild(0);
+ convertRecordsToUserModel(groupContainer, group);
+ } else if(shapeContainer.hasChildOfType((short)0xF00D)) {
+ // TextBox
+ HSSFTextbox box =
+ new HSSFTextbox(null, new HSSFClientAnchor());
+ patriarch.getChildren().add(box);
+
+ convertRecordsToUserModel(shapeContainer, box);
+ } else if(shapeContainer.hasChildOfType((short)0xF011)) {
+ // Not yet supporting EscherClientDataRecord stuff
+ } else {
+ // Base level
+ convertRecordsToUserModel(shapeContainer, patriarch);
+ }
+ }
+
+ // Now, clear any trace of what records make up
+ // the patriarch
+ // Otherwise, everything will go horribly wrong
+ // when we try to write out again....
+// clearEscherRecords();
+ drawingManager.getDgg().setFileIdClusters(new EscherDggRecord.FileIdCluster[0]);
+
+ // TODO: Support converting our records
+ // back into shapes
+ log.log(POILogger.WARN, "Not processing objects into Patriarch!");
+ }
+
+ private void convertRecordsToUserModel(EscherContainerRecord shapeContainer, Object model) {
+ for(Iterator it = shapeContainer.getChildRecords().iterator(); it.hasNext();) {
+ EscherRecord r = (EscherRecord)it.next();
+ if(r instanceof EscherSpgrRecord) {
+ // This may be overriden by a later EscherClientAnchorRecord
+ EscherSpgrRecord spgr = (EscherSpgrRecord)r;
+
+ if(model instanceof HSSFShapeGroup) {
+ HSSFShapeGroup g = (HSSFShapeGroup)model;
+ g.setCoordinates(
+ spgr.getRectX1(), spgr.getRectY1(),
+ spgr.getRectX2(), spgr.getRectY2()
+ );
+ } else {
+ throw new IllegalStateException("Got top level anchor but not processing a group");
+ }
+ }
+ else if(r instanceof EscherClientAnchorRecord) {
+ EscherClientAnchorRecord car = (EscherClientAnchorRecord)r;
+
+ if(model instanceof HSSFShape) {
+ HSSFShape g = (HSSFShape)model;
+ g.getAnchor().setDx1(car.getDx1());
+ g.getAnchor().setDx2(car.getDx2());
+ g.getAnchor().setDy1(car.getDy1());
+ g.getAnchor().setDy2(car.getDy2());
+ } else {
+ throw new IllegalStateException("Got top level anchor but not processing a group or shape");
+ }
+ }
+ else if(r instanceof EscherTextboxRecord) {
+ EscherTextboxRecord tbr = (EscherTextboxRecord)r;
+
+ // Also need to find the TextObjectRecord too
+ // TODO
+ }
+ else if(r instanceof EscherSpRecord) {
+ // Use flags if needed
+ }
+ else if(r instanceof EscherOptRecord) {
+ // Use properties if needed
+ }
+ else {
+ //System.err.println(r);
+ }
+ }
+ }
+
public void clear()
{
clearEscherRecords();
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/FormulaRecord.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/FormulaRecord.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/FormulaRecord.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/FormulaRecord.java Fri Jan 25 07:48:14 2008
@@ -179,7 +179,6 @@
*
* @return calculated value
*/
-
public double getValue()
{
return field_4_value;
@@ -190,7 +189,6 @@
*
* @return bitmask
*/
-
public short getOptions()
{
return field_5_options;
@@ -199,9 +197,25 @@
public boolean isSharedFormula() {
return sharedFormula.isSet(field_5_options);
}
-
public void setSharedFormula(boolean flag) {
- sharedFormula.setBoolean(field_5_options, flag);
+ field_5_options =
+ sharedFormula.setShortBoolean(field_5_options, flag);
+ }
+
+ public boolean isAlwaysCalc() {
+ return alwaysCalc.isSet(field_5_options);
+ }
+ public void setAlwaysCalc(boolean flag) {
+ field_5_options =
+ alwaysCalc.setShortBoolean(field_5_options, flag);
+ }
+
+ public boolean isCalcOnLoad() {
+ return calcOnLoad.isSet(field_5_options);
+ }
+ public void setCalcOnLoad(boolean flag) {
+ field_5_options =
+ calcOnLoad.setShortBoolean(field_5_options, flag);
}
/**
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/NameRecord.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/NameRecord.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/NameRecord.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/NameRecord.java Fri Jan 25 07:48:14 2008
@@ -20,13 +20,11 @@
import java.util.List;
import java.util.Stack;
+import java.util.Iterator;
import org.apache.poi.hssf.model.Workbook;
-import org.apache.poi.hssf.record.formula.Area3DPtg;
-import org.apache.poi.hssf.record.formula.DeletedArea3DPtg;
-import org.apache.poi.hssf.record.formula.DeletedRef3DPtg;
-import org.apache.poi.hssf.record.formula.Ptg;
-import org.apache.poi.hssf.record.formula.Ref3DPtg;
+import org.apache.poi.hssf.record.formula.*;
+import org.apache.poi.hssf.util.AreaReference;
import org.apache.poi.hssf.util.RangeAddress;
import org.apache.poi.util.HexDump;
import org.apache.poi.util.LittleEndian;
@@ -272,6 +270,9 @@
*/
public void setNameText(String name){
field_12_name_text = name;
+ setCompressedUnicodeFlag(
+ StringUtil.hasMultibyte(name) ? (byte)1 : (byte)0
+ );
}
// public void setNameDefintion(String definition){
@@ -320,12 +321,24 @@
return field_2_keyboard_shortcut ;
}
- /** gets the name length
+ /**
+ * gets the name length, in characters
* @return name length
*/
public byte getNameTextLength(){
return field_3_length_name_text;
}
+
+ /**
+ * gets the name length, in bytes
+ * @return raw name length
+ */
+ public byte getRawNameTextLength(){
+ if( (field_11_compressed_unicode_flag & 0x01) == 1 ) {
+ return (byte)(2 * field_3_length_name_text);
+ }
+ return field_3_length_name_text;
+ }
/** get the definition length
* @return definition length
@@ -513,27 +526,16 @@
data[17 + offset] = getStatusBarLength();
data[18 + offset] = getCompressedUnicodeFlag();
- /* temp: gjs
- if (isBuiltInName())
- {
- LittleEndian.putShort( data, 2 + offset, (short) ( 16 + field_13_raw_name_definition.length ) );
-
- data[19 + offset] = field_12_builtIn_name;
- System.arraycopy( field_13_raw_name_definition, 0, data, 20 + offset, field_13_raw_name_definition.length );
-
- return 20 + field_13_raw_name_definition.length;
- }
- else
- { */
-
int start_of_name_definition = 19 + field_3_length_name_text;
if (this.isBuiltInName()) {
//can send the builtin name directly in
data [19 + offset] = this.getBuiltInName();
+ } else if ((this.getCompressedUnicodeFlag() & 0x01) == 1) {
+ StringUtil.putUnicodeLE( getNameText(), data, 19 + offset );
+ start_of_name_definition = 19 + (2 * field_3_length_name_text);
} else {
StringUtil.putCompressedUnicode( getNameText(), data, 19 + offset );
-
}
@@ -556,15 +558,15 @@
/* } */
}
- /** gets the length of all texts
+ /**
+ * Gets the length of all texts, in bytes
* @return total length
*/
public int getTextsLength(){
int result;
- result = getNameTextLength() + getDescriptionTextLength() +
- getHelpTopicLength() + getStatusBarLength();
-
+ result = getRawNameTextLength() + getDescriptionTextLength() +
+ getHelpTopicLength() + getStatusBarLength();
return result;
}
@@ -648,15 +650,44 @@
Ptg ptg = (Ptg) field_13_name_definition.peek();
String result = "";
- if (ptg.getClass() == Area3DPtg.class){
- result = ptg.toFormulaString(book);
+ // If it's a union, descend in and process
+ if (ptg.getClass() == UnionPtg.class) {
+ Iterator it =field_13_name_definition.iterator();
+ while( it.hasNext() ) {
+ Ptg p = (Ptg)it.next();
+
+ String thisRes = getAreaRefString(p, book);
+ if(thisRes.length() > 0) {
+ // Add a comma to the end if needed
+ if(result.length() > 0 && !result.endsWith(",")) {
+ result += ",";
+ }
+ // And add the string it corresponds to
+ result += thisRes;
+ }
+ }
+ } else {
+ // Otherwise just get the string
+ result = getAreaRefString(ptg, book);
+ }
+
+ return result;
+ }
+ /**
+ * Turn the given ptg into a string, or
+ * return an empty string if nothing is possible
+ * for it.
+ */
+ private String getAreaRefString(Ptg ptg,Workbook book) {
+ if (ptg.getClass() == Area3DPtg.class){
+ return ptg.toFormulaString(book);
} else if (ptg.getClass() == Ref3DPtg.class){
- result = ptg.toFormulaString(book);
+ return ptg.toFormulaString(book);
} else if (ptg.getClass() == DeletedArea3DPtg.class || ptg.getClass() == DeletedRef3DPtg.class) {
- result = "#REF!" ; }
-
- return result;
+ return "#REF!";
+ }
+ return "";
}
/** sets the reference , the area only (range)
@@ -686,19 +717,32 @@
}
if (ra.hasRange()) {
- ptg = new Area3DPtg();
- ((Area3DPtg) ptg).setExternSheetIndex(externSheetIndex);
- ((Area3DPtg) ptg).setArea(ref);
- this.setDefinitionTextLength((short)ptg.getSize());
+ // Is it contiguous or not?
+ AreaReference[] refs =
+ AreaReference.generateContiguous(ref);
+ this.setDefinitionTextLength((short)0);
+
+ // Add the area reference(s)
+ for(int i=0; i<refs.length; i++) {
+ ptg = new Area3DPtg();
+ ((Area3DPtg) ptg).setExternSheetIndex(externSheetIndex);
+ ((Area3DPtg) ptg).setArea(refs[i].toString());
+ field_13_name_definition.push(ptg);
+ this.setDefinitionTextLength( (short)(getDefinitionLength() + ptg.getSize()) );
+ }
+ // And then a union if we had more than one area
+ if(refs.length > 1) {
+ ptg = new UnionPtg();
+ field_13_name_definition.push(ptg);
+ this.setDefinitionTextLength( (short)(getDefinitionLength() + ptg.getSize()) );
+ }
} else {
ptg = new Ref3DPtg();
((Ref3DPtg) ptg).setExternSheetIndex(externSheetIndex);
((Ref3DPtg) ptg).setArea(ref);
+ field_13_name_definition.push(ptg);
this.setDefinitionTextLength((short)ptg.getSize());
}
-
- field_13_name_definition.push(ptg);
-
}
/**
@@ -832,6 +876,15 @@
.append("\n");
buffer.append(" .Name (Unicode text) = ").append( getNameText() )
.append("\n");
+
+ buffer.append(" .Parts (" + field_13_name_definition.size() +"):")
+ .append("\n");
+ Iterator it = field_13_name_definition.iterator();
+ while(it.hasNext()) {
+ Ptg ptg = (Ptg)it.next();
+ buffer.append(" " + ptg.toString()).append("\n");
+ }
+
buffer.append(" .Menu text (Unicode string without length field) = ").append( field_14_custom_menu_text )
.append("\n");
buffer.append(" .Description text (Unicode string without length field) = ").append( field_15_description_text )
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/NoteRecord.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/NoteRecord.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/NoteRecord.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/NoteRecord.java Fri Jan 25 07:48:14 2008
@@ -243,4 +243,15 @@
public void setAuthor(String author){
field_5_author = author;
}
+
+ public Object clone() {
+ NoteRecord rec = new NoteRecord();
+ rec.field_1_row = field_1_row;
+ rec.field_2_col = field_2_col;
+ rec.field_3_flags = field_3_flags;
+ rec.field_4_shapeid = field_4_shapeid;
+ rec.field_5_author = field_5_author;
+ return rec;
+ }
+
}
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/NoteStructureSubRecord.java Fri Jan 25 07:48:14 2008
@@ -125,6 +125,15 @@
{
return sid;
}
+
+ public Object clone() {
+ NoteStructureSubRecord rec = new NoteStructureSubRecord();
+ byte[] recdata = new byte[reserved.length];
+ System.arraycopy(reserved, 0, recdata, 0, recdata.length);
+ rec.reserved = recdata;
+ return rec;
+ }
+
}
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/Record.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/Record.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/Record.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/Record.java Fri Jan 25 07:48:14 2008
@@ -19,6 +19,8 @@
package org.apache.poi.hssf.record;
+import java.io.ByteArrayInputStream;
+
/**
* Title: Record
* Description: All HSSF Records inherit from this class. It
@@ -146,5 +148,31 @@
public Object clone() {
throw new RuntimeException("The class "+getClass().getName()+" needs to define a clone method");
+ }
+
+ /**
+ * Clone the current record, via a call to serialise
+ * it, and another to create a new record from the
+ * bytes.
+ * May only be used for classes which don't have
+ * internal counts / ids in them. For those which
+ * do, a full record-aware serialise is needed, which
+ * allocates new ids / counts as needed.
+ */
+ public Record cloneViaReserialise()
+ {
+ // Do it via a re-serialise
+ // It's a cheat, but it works...
+ byte[] b = serialize();
+ RecordInputStream rinp = new RecordInputStream(
+ new ByteArrayInputStream(b)
+ );
+ rinp.nextRecord();
+
+ Record[] r = RecordFactory.createRecord(rinp);
+ if(r.length != 1) {
+ throw new IllegalStateException("Re-serialised a record to clone it, but got " + r.length + " records back!");
+ }
+ return r[0];
}
}
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/RecordFactory.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/RecordFactory.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/RecordFactory.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/RecordFactory.java Fri Jan 25 07:48:14 2008
@@ -76,7 +76,7 @@
WriteProtectRecord.class, FilePassRecord.class, PaneRecord.class,
NoteRecord.class, ObjectProtectRecord.class, ScenarioProtectRecord.class,
FileSharingRecord.class, ChartTitleFormatRecord.class,
- DVRecord.class, DVALRecord.class
+ DVRecord.class, DVALRecord.class, UncalcedRecord.class
};
}
private static Map recordsMap = recordsToMap(records);
Modified: poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/RecordInputStream.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/RecordInputStream.java?rev=615249&r1=615248&r2=615249&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/RecordInputStream.java (original)
+++ poi/tags/REL_3_0_2_BETA3/src/java/org/apache/poi/hssf/record/RecordInputStream.java Fri Jan 25 07:48:14 2008
@@ -133,6 +133,9 @@
}
}
+ /**
+ * Reads an 8 bit, signed value
+ */
public byte readByte() {
checkRecordPosition();
@@ -141,7 +144,10 @@
pos += 1;
return result;
}
-
+
+ /**
+ * Reads a 16 bit, signed value
+ */
public short readShort() {
checkRecordPosition();
@@ -169,6 +175,21 @@
return result;
}
+ /**
+ * Reads an 8 bit, unsigned value
+ */
+ public short readUByte() {
+ short s = readByte();
+ if(s < 0) {
+ s += 256;
+ }
+ return s;
+ }
+
+ /**
+ * Reads a 16 bit,un- signed value.
+ * @return
+ */
public int readUShort() {
checkRecordPosition();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org