diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index ab9a4c796..5722a7be4 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -26,6 +26,7 @@ + @@ -36,6 +37,9 @@ + Implement Sheet.removeShape(Shape shape) in HSLF + Various fixes: Recognising var-arg built-in functions #44675, ExternalNameRecord serialisation bug #44695, PMT() bug #44691 + 30311 - More work on Conditional Formatting Move the Formula Evaluator code out of scratchpad Move the missing record aware eventusermodel code out of scratchpad 44652 / 44603 - Improved handling of Pictures in Word Documents diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 14c7b817a..9d35cb7fd 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -22,6 +22,7 @@ + @@ -33,6 +34,9 @@ + Implement Sheet.removeShape(Shape shape) in HSLF + Various fixes: Recognising var-arg built-in functions #44675, ExternalNameRecord serialisation bug #44695, PMT() bug #44691 + 30311 - More work on Conditional Formatting Move the Formula Evaluator code out of scratchpad Move the missing record aware eventusermodel code out of scratchpad 44652 / 44603 - Improved handling of Pictures in Word Documents diff --git a/src/java/org/apache/poi/hssf/model/FormulaParser.java b/src/java/org/apache/poi/hssf/model/FormulaParser.java index e6eb29670..721928474 100644 --- a/src/java/org/apache/poi/hssf/model/FormulaParser.java +++ b/src/java/org/apache/poi/hssf/model/FormulaParser.java @@ -28,8 +28,6 @@ import org.apache.poi.hssf.record.formula.*; import org.apache.poi.hssf.record.formula.function.FunctionMetadata; import org.apache.poi.hssf.record.formula.function.FunctionMetadataRegistry; - - /** * This class parses a formula string into a List of tokens in RPN order. * Inspired by @@ -48,11 +46,11 @@ import org.apache.poi.hssf.record.formula.function.FunctionMetadataRegistry; * @author Pavel Krupets (pkrupets at palmtreebusiness dot com) */ public final class FormulaParser { - + /** * Specific exception thrown when a supplied formula does not parse properly.
* Primarily used by test cases when testing for specific parsing exceptions.

- * + * */ static final class FormulaParseException extends RuntimeException { // This class was given package scope until it would become clear that it is useful to diff --git a/src/java/org/apache/poi/hssf/record/CFHeaderRecord.java b/src/java/org/apache/poi/hssf/record/CFHeaderRecord.java index 00a8646b4..7f2d5c319 100644 --- a/src/java/org/apache/poi/hssf/record/CFHeaderRecord.java +++ b/src/java/org/apache/poi/hssf/record/CFHeaderRecord.java @@ -15,18 +15,10 @@ limitations under the License. ==================================================================== */ -/* - * ConditionalFormattingHeaderRecord.java - * - * Created on January 17, 2008, 3:05 AM - */ package org.apache.poi.hssf.record; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - import org.apache.poi.hssf.record.cf.CellRange; +import org.apache.poi.hssf.util.Region; import org.apache.poi.util.LittleEndian; /** @@ -34,19 +26,27 @@ import org.apache.poi.util.LittleEndian; * * @author Dmitriy Kumshayev */ -public class CFHeaderRecord extends Record +public final class CFHeaderRecord extends Record { public static final short sid = 0x1B0; + private static final CellRange[] EMPTY_CELL_RANGE_ARRAY = { }; + private int field_1_numcf; private int field_2_need_recalculation; private CellRange field_3_enclosing_cell_range; - private List field_4_cell_ranges; + private CellRange[] field_4_cell_ranges; /** Creates new CFHeaderRecord */ public CFHeaderRecord() { - field_4_cell_ranges = new ArrayList(5); + field_4_cell_ranges = EMPTY_CELL_RANGE_ARRAY; + } + public CFHeaderRecord(Region[] regions) + { + CellRange[] unmergedRanges = CellRange.convertRegionsToCellRanges(regions); + CellRange[] mergeCellRanges = CellRange.mergeCellRanges(unmergedRanges); + setCellRanges(mergeCellRanges); } public CFHeaderRecord(RecordInputStream in) @@ -60,11 +60,12 @@ public class CFHeaderRecord extends Record field_2_need_recalculation = in.readShort(); field_3_enclosing_cell_range = new CellRange(in.readShort(),in.readShort(),in.readShort(),in.readShort()); int numCellRanges = in.readShort(); - field_4_cell_ranges = new ArrayList(5); + CellRange[] crs = new CellRange[numCellRanges]; for( int i=0; i0) + buffer.append(" .id = ").append(Integer.toHexString(sid)).append("\n"); + buffer.append(" .numCF = ").append(getNumberOfConditionalFormats()).append("\n"); + buffer.append(" .needRecalc = ").append(getNeedRecalculation()).append("\n"); + buffer.append(" .enclosingCellRange= ").append(getEnclosingCellRange()).append("\n"); + if( field_4_cell_ranges.length>0) { - buffer.append(" .cfranges=["); - for( int i=0; i