diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index ab9a4c796..9be4485ae 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -26,6 +26,7 @@ + @@ -36,6 +37,7 @@ + 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..f8712cc30 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -22,6 +22,7 @@ + @@ -33,6 +34,7 @@ + 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/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