setLoc(dimsloc);
if (log.check( POILogger.DEBUG ))
log.log(POILogger.DEBUG, "replaceValueRecord ");
+ //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
+ //double the memory
+ cells.removeCell(newval);
cells.insertCell(newval);
/*
if (log.check( POILogger.DEBUG ))
log.log(DEBUG, "found palette record at " + k);
retval.records.setPalettepos( k );
+ break;
case WindowOneRecord.sid:
if (log.check( POILogger.DEBUG ))
log.log(DEBUG, "found WindowOneRecord at " + k);
private int field_2_backgroundColor;
private short field_3_pattern;
private short field_4_formatFlags;
- private BitField automatic = new BitField(0x1);
- private BitField invert = new BitField(0x2);
+ private BitField automatic = BitFieldFactory.getInstance(0x1);
+ private BitField invert = BitFieldFactory.getInstance(0x2);
private short field_5_forecolorIndex;
private short field_6_backcolorIndex;
{
public final static short sid = 0x101A;
private short field_1_formatFlags;
- private BitField stacked = new BitField(0x1);
- private BitField displayAsPercentage = new BitField(0x2);
- private BitField shadow = new BitField(0x4);
+ private BitField stacked = BitFieldFactory.getInstance(0x1);
+ private BitField displayAsPercentage = BitFieldFactory.getInstance(0x2);
+ private BitField shadow = BitFieldFactory.getInstance(0x4);
public AreaRecord()
private short field_7_baseUnit;
private short field_8_crossingPoint;
private short field_9_options;
- private BitField defaultMinimum = new BitField(0x1);
- private BitField defaultMaximum = new BitField(0x2);
- private BitField defaultMajor = new BitField(0x4);
- private BitField defaultMinorUnit = new BitField(0x8);
- private BitField isDate = new BitField(0x10);
- private BitField defaultBase = new BitField(0x20);
- private BitField defaultCross = new BitField(0x40);
- private BitField defaultDateSettings = new BitField(0x80);
+ private BitField defaultMinimum = BitFieldFactory.getInstance(0x1);
+ private BitField defaultMaximum = BitFieldFactory.getInstance(0x2);
+ private BitField defaultMajor = BitFieldFactory.getInstance(0x4);
+ private BitField defaultMinorUnit = BitFieldFactory.getInstance(0x8);
+ private BitField isDate = BitFieldFactory.getInstance(0x10);
+ private BitField defaultBase = BitFieldFactory.getInstance(0x20);
+ private BitField defaultCross = BitFieldFactory.getInstance(0x40);
+ private BitField defaultDateSettings = BitFieldFactory.getInstance(0x80);
public AxisOptionsRecord()
private short field_1_barSpace;
private short field_2_categorySpace;
private short field_3_formatFlags;
- private BitField horizontal = new BitField(0x1);
- private BitField stacked = new BitField(0x2);
- private BitField displayAsPercentage = new BitField(0x4);
- private BitField shadow = new BitField(0x8);
+ private BitField horizontal = BitFieldFactory.getInstance(0x1);
+ private BitField stacked = BitFieldFactory.getInstance(0x2);
+ private BitField displayAsPercentage = BitFieldFactory.getInstance(0x4);
+ private BitField shadow = BitFieldFactory.getInstance(0x8);
public BarRecord()
private short field_2_labelFrequency;
private short field_3_tickMarkFrequency;
private short field_4_options;
- private BitField valueAxisCrossing = new BitField(0x1);
- private BitField crossesFarRight = new BitField(0x2);
- private BitField reversed = new BitField(0x4);
+ private BitField valueAxisCrossing = BitFieldFactory.getInstance(0x1);
+ private BitField crossesFarRight = BitFieldFactory.getInstance(0x2);
+ private BitField reversed = BitFieldFactory.getInstance(0x4);
public CategorySeriesAxisRecord()
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
/**
* Class ChartFormatRecord
private int field3_width;
private int field4_height;
private short field5_grbit;
- private BitField varyDisplayPattern = new BitField(0x01);
+ private BitField varyDisplayPattern = BitFieldFactory.getInstance(0x01);
public ChartFormatRecord()
{
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
/**
* Title: ColumnInfo Record<P>
private short field_3_col_width;
private short field_4_xf_index;
private short field_5_options;
- static final private BitField hidden = new BitField(0x01);
- static final private BitField outlevel = new BitField(0x0700);
- static final private BitField collapsed = new BitField(0x1000);
+ static final private BitField hidden = BitFieldFactory.getInstance(0x01);
+ static final private BitField outlevel = BitFieldFactory.getInstance(0x0700);
+ static final private BitField collapsed = BitFieldFactory.getInstance(0x1000);
private short field_6_reserved;
public ColumnInfoRecord()
public final static short OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING = 30;
private short field_2_objectId;
private short field_3_option;
- private BitField locked = new BitField(0x1);
- private BitField printable = new BitField(0x10);
- private BitField autofill = new BitField(0x2000);
- private BitField autoline = new BitField(0x4000);
+ private BitField locked = BitFieldFactory.getInstance(0x1);
+ private BitField printable = BitFieldFactory.getInstance(0x10);
+ private BitField autofill = BitFieldFactory.getInstance(0x2000);
+ private BitField autoline = BitFieldFactory.getInstance(0x4000);
private int field_4_reserved1;
private int field_5_reserved2;
private int field_6_reserved3;
{
public final static short sid = 0x1063;
private short field_1_options;
- private BitField horizontalBorder = new BitField(0x1);
- private BitField verticalBorder = new BitField(0x2);
- private BitField border = new BitField(0x4);
- private BitField showSeriesKey = new BitField(0x8);
+ private BitField horizontalBorder = BitFieldFactory.getInstance(0x1);
+ private BitField verticalBorder = BitFieldFactory.getInstance(0x2);
+ private BitField border = BitFieldFactory.getInstance(0x4);
+ private BitField showSeriesKey = BitFieldFactory.getInstance(0x8);
public DatRecord()
private short field_2_seriesIndex;
private short field_3_seriesNumber;
private short field_4_formatFlags;
- private BitField useExcel4Colors = new BitField(0x1);
+ private BitField useExcel4Colors = BitFieldFactory.getInstance(0x1);
public DataFormatRecord()
package org.apache.poi.hssf.record;
import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.LittleEndian;
/**
private short field_2_format_index; // not bit-mapped
// field_3_cell_options bit map
- static final private BitField _locked = new BitField(0x0001);
- static final private BitField _hidden = new BitField(0x0002);
- static final private BitField _xf_type = new BitField(0x0004);
- static final private BitField _123_prefix = new BitField(0x0008);
- static final private BitField _parent_index = new BitField(0xFFF0);
+ static final private BitField _locked = BitFieldFactory.getInstance(0x0001);
+ static final private BitField _hidden = BitFieldFactory.getInstance(0x0002);
+ static final private BitField _xf_type = BitFieldFactory.getInstance(0x0004);
+ static final private BitField _123_prefix = BitFieldFactory.getInstance(0x0008);
+ static final private BitField _parent_index = BitFieldFactory.getInstance(0xFFF0);
private short field_3_cell_options;
// field_4_alignment_options bit map
- static final private BitField _alignment = new BitField(0x0007);
- static final private BitField _wrap_text = new BitField(0x0008);
- static final private BitField _vertical_alignment = new BitField(0x0070);
- static final private BitField _justify_last = new BitField(0x0080);
- static final private BitField _rotation = new BitField(0xFF00);
+ static final private BitField _alignment = BitFieldFactory.getInstance(0x0007);
+ static final private BitField _wrap_text = BitFieldFactory.getInstance(0x0008);
+ static final private BitField _vertical_alignment = BitFieldFactory.getInstance(0x0070);
+ static final private BitField _justify_last = BitFieldFactory.getInstance(0x0080);
+ static final private BitField _rotation = BitFieldFactory.getInstance(0xFF00);
private short field_4_alignment_options;
// field_5_indention_options
static final private BitField _indent =
- new BitField(0x000F);
+ BitFieldFactory.getInstance(0x000F);
static final private BitField _shrink_to_fit =
- new BitField(0x0010);
+ BitFieldFactory.getInstance(0x0010);
static final private BitField _merge_cells =
- new BitField(0x0020);
+ BitFieldFactory.getInstance(0x0020);
static final private BitField _reading_order =
- new BitField(0x00C0);
+ BitFieldFactory.getInstance(0x00C0);
// apparently bits 8 and 9 are unused
static final private BitField _indent_not_parent_format =
- new BitField(0x0400);
+ BitFieldFactory.getInstance(0x0400);
static final private BitField _indent_not_parent_font =
- new BitField(0x0800);
+ BitFieldFactory.getInstance(0x0800);
static final private BitField _indent_not_parent_alignment =
- new BitField(0x1000);
+ BitFieldFactory.getInstance(0x1000);
static final private BitField _indent_not_parent_border =
- new BitField(0x2000);
+ BitFieldFactory.getInstance(0x2000);
static final private BitField _indent_not_parent_pattern =
- new BitField(0x4000);
+ BitFieldFactory.getInstance(0x4000);
static final private BitField _indent_not_parent_cell_options =
- new BitField(0x8000);
+ BitFieldFactory.getInstance(0x8000);
private short field_5_indention_options;
// field_6_border_options bit map
- static final private BitField _border_left = new BitField(0x000F);
- static final private BitField _border_right = new BitField(0x00F0);
- static final private BitField _border_top = new BitField(0x0F00);
- static final private BitField _border_bottom = new BitField(0xF000);
+ static final private BitField _border_left = BitFieldFactory.getInstance(0x000F);
+ static final private BitField _border_right = BitFieldFactory.getInstance(0x00F0);
+ static final private BitField _border_top = BitFieldFactory.getInstance(0x0F00);
+ static final private BitField _border_bottom = BitFieldFactory.getInstance(0xF000);
private short field_6_border_options;
// all three of the following attributes are palette options
// field_7_palette_options bit map
static final private BitField _left_border_palette_idx =
- new BitField(0x007F);
+ BitFieldFactory.getInstance(0x007F);
static final private BitField _right_border_palette_idx =
- new BitField(0x3F80);
+ BitFieldFactory.getInstance(0x3F80);
static final private BitField _diag =
- new BitField(0xC000);
+ BitFieldFactory.getInstance(0xC000);
private short field_7_palette_options;
// field_8_adtl_palette_options bit map
static final private BitField _top_border_palette_idx =
- new BitField(0x0000007F);
+ BitFieldFactory.getInstance(0x0000007F);
static final private BitField _bottom_border_palette_idx =
- new BitField(0x00003F80);
+ BitFieldFactory.getInstance(0x00003F80);
static final private BitField _adtl_diag =
- new BitField(0x001fc000);
+ BitFieldFactory.getInstance(0x001fc000);
static final private BitField _adtl_diag_line_style =
- new BitField(0x01e00000);
+ BitFieldFactory.getInstance(0x01e00000);
// apparently bit 25 is unused
static final private BitField _adtl_fill_pattern =
- new BitField(0xfc000000);
+ BitFieldFactory.getInstance(0xfc000000);
private int field_8_adtl_palette_options; // additional to avoid 2
// field_9_fill_palette_options bit map
- static final private BitField _fill_foreground = new BitField(0x007F);
- static final private BitField _fill_background = new BitField(0x3f80);
+ static final private BitField _fill_foreground = BitFieldFactory.getInstance(0x007F);
+ static final private BitField _fill_background = BitFieldFactory.getInstance(0x3f80);
// apparently bits 15 and 14 are unused
private short field_9_fill_palette_options;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.StringUtil;
import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
/**
* Title: Font Record - descrbes a font in the workbook (index = 0-3,5-infinity - skip 4)<P>
// 0 0x01 - Reserved bit must be 0
static final private BitField italic =
- new BitField(0x02); // is this font in italics
+ BitFieldFactory.getInstance(0x02); // is this font in italics
// 2 0x04 - reserved bit must be 0
static final private BitField strikeout =
- new BitField(0x08); // is this font has a line through the center
- static final private BitField macoutline = new BitField(
+ BitFieldFactory.getInstance(0x08); // is this font has a line through the center
+ static final private BitField macoutline = BitFieldFactory.getInstance(
0x10); // some weird macintosh thing....but who understands those mac people anyhow
- static final private BitField macshadow = new BitField(
+ static final private BitField macshadow = BitFieldFactory.getInstance(
0x20); // some weird macintosh thing....but who understands those mac people anyhow
// 7-6 - reserved bits must be 0
public final static short BORDER_TYPE_REGULAR = 0;
public final static short BORDER_TYPE_SHADOW = 1;
private short field_2_options;
- private BitField autoSize = new BitField(0x1);
- private BitField autoPosition = new BitField(0x2);
+ private BitField autoSize = BitFieldFactory.getInstance(0x1);
+ private BitField autoPosition = BitFieldFactory.getInstance(0x2);
public FrameRecord()
public final static byte SPACING_MEDIUM = 1;
public final static byte SPACING_OPEN = 2;
private short field_7_options;
- private BitField autoPosition = new BitField(0x1);
- private BitField autoSeries = new BitField(0x2);
- private BitField autoXPositioning = new BitField(0x4);
- private BitField autoYPositioning = new BitField(0x8);
- private BitField vertical = new BitField(0x10);
- private BitField dataTable = new BitField(0x20);
+ private BitField autoPosition = BitFieldFactory.getInstance(0x1);
+ private BitField autoSeries = BitFieldFactory.getInstance(0x2);
+ private BitField autoXPositioning = BitFieldFactory.getInstance(0x4);
+ private BitField autoYPositioning = BitFieldFactory.getInstance(0x8);
+ private BitField vertical = BitFieldFactory.getInstance(0x10);
+ private BitField dataTable = BitFieldFactory.getInstance(0x20);
public LegendRecord()
public final static short WEIGHT_MEDIUM = 1;
public final static short WEIGHT_WIDE = 2;
private short field_4_format;
- private BitField auto = new BitField(0x1);
- private BitField drawTicks = new BitField(0x4);
- private BitField unknown = new BitField(0x4);
+ private BitField auto = BitFieldFactory.getInstance(0x1);
+ private BitField drawTicks = BitFieldFactory.getInstance(0x4);
+ private BitField unknown = BitFieldFactory.getInstance(0x4);
private short field_5_colourPaletteIndex;
public final static byte REFERENCE_TYPE_NOT_USED = 3;
public final static byte REFERENCE_TYPE_ERROR_REPORTED = 4;
private short field_3_options;
- private BitField customNumberFormat = new BitField(0x1);
+ private BitField customNumberFormat = BitFieldFactory.getInstance(0x1);
private short field_4_indexNumberFmtRecord;
private LinkedDataFormulaField field_5_formulaOfLink;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
/**
* Title: Print Setup Record<P>
private short field_5_fit_height;
private short field_6_options;
static final private BitField lefttoright =
- new BitField(0x01); // print over then down
+ BitFieldFactory.getInstance(0x01); // print over then down
static final private BitField landscape =
- new BitField(0x02); // landscape mode
- static final private BitField validsettings = new BitField(
+ BitFieldFactory.getInstance(0x02); // landscape mode
+ static final private BitField validsettings = BitFieldFactory.getInstance(
0x04); // if papersize, scale, resolution, copies, landscape
// weren't obtained from the print consider them
// mere bunk
static final private BitField nocolor =
- new BitField(0x08); // print mono/b&w, colorless
+ BitFieldFactory.getInstance(0x08); // print mono/b&w, colorless
static final private BitField draft =
- new BitField(0x10); // print draft quality
+ BitFieldFactory.getInstance(0x10); // print draft quality
static final private BitField notes =
- new BitField(0x20); // print the notes
+ BitFieldFactory.getInstance(0x20); // print the notes
static final private BitField noOrientation =
- new BitField(0x40); // the orientation is not set
+ BitFieldFactory.getInstance(0x40); // the orientation is not set
static final private BitField usepage =
- new BitField(0x80); // use a user set page no, instead of auto
+ BitFieldFactory.getInstance(0x80); // use a user set page no, instead of auto
private short field_7_hresolution;
private short field_8_vresolution;
private double field_9_headermargin;
package org.apache.poi.hssf.record;
import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.LittleEndian;
/**
// for generated sheets.
private short field_6_reserved;
private short field_7_option_flags;
- private BitField outlineLevel = new BitField(0x07);
+ private BitField outlineLevel = BitFieldFactory.getInstance(0x07);
// bit 3 reserved
- private BitField colapsed = new BitField(0x10);
- private BitField zeroHeight = new BitField(0x20);
- private BitField badFontHeight = new BitField(0x40);
- private BitField formatted = new BitField(0x80);
+ private BitField colapsed = BitFieldFactory.getInstance(0x10);
+ private BitField zeroHeight = BitFieldFactory.getInstance(0x20);
+ private BitField badFontHeight = BitFieldFactory.getInstance(0x40);
+ private BitField formatted = BitFieldFactory.getInstance(0x80);
private short field_8_xf_index; // only if isFormatted
public RowRecord()
{
public final static short sid = 0x100c;
private short field_1_formatFlags;
- private BitField showActual = new BitField(0x1);
- private BitField showPercent = new BitField(0x2);
- private BitField labelAsPercentage = new BitField(0x4);
- private BitField smoothedLine = new BitField(0x8);
- private BitField showLabel = new BitField(0x10);
- private BitField showBubbleSizes = new BitField(0x20);
+ private BitField showActual = BitFieldFactory.getInstance(0x1);
+ private BitField showPercent = BitFieldFactory.getInstance(0x2);
+ private BitField labelAsPercentage = BitFieldFactory.getInstance(0x4);
+ private BitField smoothedLine = BitFieldFactory.getInstance(0x8);
+ private BitField showLabel = BitFieldFactory.getInstance(0x10);
+ private BitField showBubbleSizes = BitFieldFactory.getInstance(0x20);
public SeriesLabelsRecord()
{
public final static short sid = 0x1044;
private short field_1_flags;
- private BitField chartTypeManuallyFormatted = new BitField(0x1);
- private BitField plotVisibleOnly = new BitField(0x2);
- private BitField doNotSizeWithWindow = new BitField(0x4);
- private BitField defaultPlotDimensions = new BitField(0x8);
- private BitField autoPlotArea = new BitField(0x10);
+ private BitField chartTypeManuallyFormatted = BitFieldFactory.getInstance(0x1);
+ private BitField plotVisibleOnly = BitFieldFactory.getInstance(0x2);
+ private BitField doNotSizeWithWindow = BitFieldFactory.getInstance(0x4);
+ private BitField defaultPlotDimensions = BitFieldFactory.getInstance(0x8);
+ private BitField autoPlotArea = BitFieldFactory.getInstance(0x10);
private byte field_2_empty;
public final static byte EMPTY_NOT_PLOTTED = 0;
public final static byte EMPTY_ZERO = 1;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.StringUtil;
import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
/**
* Title: Style Record<P>
protected void fillFields(RecordInputStream in)
{
- fHighByte = new BitField(0x01); //have to init here, since we are being called
+ fHighByte = BitFieldFactory.getInstance(0x01); //have to init here, since we are being called
//from super, and class level init hasnt been done.
field_1_xf_index = in.readShort();
if (getType() == STYLE_BUILT_IN)
{
public final static short sid = 0x1B6;
private short field_1_options;
- private BitField reserved1 = new BitField(0x1);
- private BitField HorizontalTextAlignment = new BitField(0x000E);
+ private BitField reserved1 = BitFieldFactory.getInstance(0x1);
+ private BitField HorizontalTextAlignment = BitFieldFactory.getInstance(0x000E);
public final static short HORIZONTAL_TEXT_ALIGNMENT_LEFT_ALIGNED = 1;
public final static short HORIZONTAL_TEXT_ALIGNMENT_CENTERED = 2;
public final static short HORIZONTAL_TEXT_ALIGNMENT_RIGHT_ALIGNED = 3;
public final static short HORIZONTAL_TEXT_ALIGNMENT_JUSTIFIED = 4;
- private BitField VerticalTextAlignment = new BitField(0x0070);
+ private BitField VerticalTextAlignment = BitFieldFactory.getInstance(0x0070);
public final static short VERTICAL_TEXT_ALIGNMENT_TOP = 1;
public final static short VERTICAL_TEXT_ALIGNMENT_CENTER = 2;
public final static short VERTICAL_TEXT_ALIGNMENT_BOTTOM = 3;
public final static short VERTICAL_TEXT_ALIGNMENT_JUSTIFY = 4;
- private BitField reserved2 = new BitField(0x0180);
- private BitField textLocked = new BitField(0x200);
- private BitField reserved3 = new BitField(0xFC00);
+ private BitField reserved2 = BitFieldFactory.getInstance(0x0180);
+ private BitField textLocked = BitFieldFactory.getInstance(0x200);
+ private BitField reserved3 = BitFieldFactory.getInstance(0xFC00);
private short field_2_textOrientation;
public final static short TEXT_ORIENTATION_NONE = 0;
public final static short TEXT_ORIENTATION_TOP_TO_BOTTOM = 1;
protected void fillFields(RecordInputStream in)
{
super.fillFields(in);
+ if (getTextLength() > 0) {
if (in.isContinueNext() && in.remaining() == 0) {
//1st Continue
in.nextRecord();
processRawString(in);
+ } else
+ throw new RecordFormatException("Expected Continue record to hold string data for TextObjectRecord");
+ }
+ if (getFormattingRunLength() > 0) {
if (in.isContinueNext() && in.remaining() == 0) {
in.nextRecord();
processFontRuns(in);
} else throw new RecordFormatException("Expected Continue Record to hold font runs for TextObjectRecord");
- } else
- throw new RecordFormatException("Expected Continue record to hold string data for TextObjectRecord");
+ }
}
private int field_7_width;
private int field_8_height;
private short field_9_options1;
- private BitField autoColor = new BitField(0x1);
- private BitField showKey = new BitField(0x2);
- private BitField showValue = new BitField(0x4);
- private BitField vertical = new BitField(0x8);
- private BitField autoGeneratedText = new BitField(0x10);
- private BitField generated = new BitField(0x20);
- private BitField autoLabelDeleted = new BitField(0x40);
- private BitField autoBackground = new BitField(0x80);
- private BitField rotation = new BitField(0x0700);
+ private BitField autoColor = BitFieldFactory.getInstance(0x1);
+ private BitField showKey = BitFieldFactory.getInstance(0x2);
+ private BitField showValue = BitFieldFactory.getInstance(0x4);
+ private BitField vertical = BitFieldFactory.getInstance(0x8);
+ private BitField autoGeneratedText = BitFieldFactory.getInstance(0x10);
+ private BitField generated = BitFieldFactory.getInstance(0x20);
+ private BitField autoLabelDeleted = BitFieldFactory.getInstance(0x40);
+ private BitField autoBackground = BitFieldFactory.getInstance(0x80);
+ private BitField rotation = BitFieldFactory.getInstance(0x0700);
public final static short ROTATION_NONE = 0;
public final static short ROTATION_TOP_TO_BOTTOM = 1;
public final static short ROTATION_ROTATED_90_DEGREES = 2;
public final static short ROTATION_ROTATED_90_DEGREES_CLOCKWISE = 3;
- private BitField showCategoryLabelAsPercentage = new BitField(0x800);
- private BitField showValueAsPercentage = new BitField(0x1000);
- private BitField showBubbleSizes = new BitField(0x2000);
- private BitField showLabel = new BitField(0x4000);
+ private BitField showCategoryLabelAsPercentage = BitFieldFactory.getInstance(0x800);
+ private BitField showValueAsPercentage = BitFieldFactory.getInstance(0x1000);
+ private BitField showBubbleSizes = BitFieldFactory.getInstance(0x2000);
+ private BitField showLabel = BitFieldFactory.getInstance(0x4000);
private short field_10_indexOfColorValue;
private short field_11_options2;
- private BitField dataLabelPlacement = new BitField(0x000F);
+ private BitField dataLabelPlacement = BitFieldFactory.getInstance(0x000F);
public final static short DATA_LABEL_PLACEMENT_CHART_DEPENDENT = 0;
public final static short DATA_LABEL_PLACEMENT_OUTSIDE = 1;
public final static short DATA_LABEL_PLACEMENT_INSIDE = 2;
private int field_8_zero3;
private int field_9_zero4;
private short field_10_options;
- private BitField autoTextColor = new BitField(0x1);
- private BitField autoTextBackground = new BitField(0x2);
- private BitField rotation = new BitField(0x1c);
- private BitField autorotate = new BitField(0x20);
+ private BitField autoTextColor = BitFieldFactory.getInstance(0x1);
+ private BitField autoTextBackground = BitFieldFactory.getInstance(0x2);
+ private BitField rotation = BitFieldFactory.getInstance(0x1c);
+ private BitField autorotate = BitFieldFactory.getInstance(0x20);
private short field_11_tickColor;
private short field_12_zero5;
private double field_4_minorIncrement;
private double field_5_categoryAxisCross;
private short field_6_options;
- private BitField automaticMinimum = new BitField(0x1);
- private BitField automaticMaximum = new BitField(0x2);
- private BitField automaticMajor = new BitField(0x4);
- private BitField automaticMinor = new BitField(0x8);
- private BitField automaticCategoryCrossing = new BitField(0x10);
- private BitField logarithmicScale = new BitField(0x20);
- private BitField valuesInReverse = new BitField(0x40);
- private BitField crossCategoryAxisAtMaximum = new BitField(0x80);
- private BitField reserved = new BitField(0x100);
+ private BitField automaticMinimum = BitFieldFactory.getInstance(0x1);
+ private BitField automaticMaximum = BitFieldFactory.getInstance(0x2);
+ private BitField automaticMajor = BitFieldFactory.getInstance(0x4);
+ private BitField automaticMinor = BitFieldFactory.getInstance(0x8);
+ private BitField automaticCategoryCrossing = BitFieldFactory.getInstance(0x10);
+ private BitField logarithmicScale = BitFieldFactory.getInstance(0x20);
+ private BitField valuesInReverse = BitFieldFactory.getInstance(0x40);
+ private BitField crossCategoryAxisAtMaximum = BitFieldFactory.getInstance(0x80);
+ private BitField reserved = BitFieldFactory.getInstance(0x100);
public ValueRangeRecord()
package org.apache.poi.hssf.record;
import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.LittleEndian;
/**
// I decided to be consistant in this way.
static final private BitField autobreaks =
- new BitField(0x01); // are automatic page breaks visible
+ BitFieldFactory.getInstance(0x01); // are automatic page breaks visible
// bits 1 to 3 unused
static final private BitField dialog =
- new BitField(0x10); // is sheet dialog sheet
+ BitFieldFactory.getInstance(0x10); // is sheet dialog sheet
static final private BitField applystyles =
- new BitField(0x20); // whether to apply automatic styles to outlines
- static final private BitField rowsumsbelow = new BitField(
+ BitFieldFactory.getInstance(0x20); // whether to apply automatic styles to outlines
+ static final private BitField rowsumsbelow = BitFieldFactory.getInstance(
0x40); // whether summary rows will appear below detail in outlines
- static final private BitField rowsumsright = new BitField(
+ static final private BitField rowsumsright = BitFieldFactory.getInstance(
0x80); // whether summary rows will appear right of the detail in outlines
static final private BitField fittopage =
- new BitField(0x01); // whether to fit stuff to the page
+ BitFieldFactory.getInstance(0x01); // whether to fit stuff to the page
// bit 2 reserved
- static final private BitField displayguts = new BitField(
+ static final private BitField displayguts = BitFieldFactory.getInstance(
0x06); // whether to display outline symbols (in the gutters)
// bits 4-5 reserved
static final private BitField alternateexpression = // whether to use alternate expression eval
- new BitField(0x40);
+ BitFieldFactory.getInstance(0x40);
static final private BitField alternateformula = // whether to use alternate formula entry
- new BitField(0x80);
+ BitFieldFactory.getInstance(0x80);
public WSBoolRecord()
{
package org.apache.poi.hssf.record;
import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.LittleEndian;
/**
private short field_4_height;
private short field_5_options;
static final private BitField hidden =
- new BitField(0x01); // is this window is hidden
+ BitFieldFactory.getInstance(0x01); // is this window is hidden
static final private BitField iconic =
- new BitField(0x02); // is this window is an icon
- static final private BitField reserved = new BitField(0x04); // reserved
+ BitFieldFactory.getInstance(0x02); // is this window is an icon
+ static final private BitField reserved = BitFieldFactory.getInstance(0x04); // reserved
static final private BitField hscroll =
- new BitField(0x08); // display horizontal scrollbar
+ BitFieldFactory.getInstance(0x08); // display horizontal scrollbar
static final private BitField vscroll =
- new BitField(0x10); // display vertical scrollbar
+ BitFieldFactory.getInstance(0x10); // display vertical scrollbar
static final private BitField tabs =
- new BitField(0x20); // display tabs at the bottom
+ BitFieldFactory.getInstance(0x20); // display tabs at the bottom
// all the rest are "reserved"
private short field_6_selected_tab;
package org.apache.poi.hssf.record;
import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.LittleEndian;
/**
private short field_1_options;
// bitfields
- private BitField displayFormulas = new BitField(0x01);
- private BitField displayGridlines = new BitField(0x02);
- private BitField displayRowColHeadings = new BitField(0x04);
- private BitField freezePanes = new BitField(0x08);
- private BitField displayZeros = new BitField(0x10);
+ private BitField displayFormulas = BitFieldFactory.getInstance(0x01);
+ private BitField displayGridlines = BitFieldFactory.getInstance(0x02);
+ private BitField displayRowColHeadings = BitFieldFactory.getInstance(0x04);
+ private BitField freezePanes = BitFieldFactory.getInstance(0x08);
+ private BitField displayZeros = BitFieldFactory.getInstance(0x10);
private BitField defaultHeader =
- new BitField(0x20); // if false use color in field 4
+ BitFieldFactory.getInstance(0x20); // if false use color in field 4
// if true use default foreground
// for headers
private BitField arabic =
- new BitField(0x40); // for our desert dwelling friends
- private BitField displayGuts = new BitField(0x80);
- private BitField freezePanesNoSplit = new BitField(0x100);
- private BitField selected = new BitField(0x200);
- private BitField paged = new BitField(0x400);
- private BitField savedInPageBreakPreview = new BitField(0x800);
+ BitFieldFactory.getInstance(0x40); // for our desert dwelling friends
+ private BitField displayGuts = BitFieldFactory.getInstance(0x80);
+ private BitField freezePanesNoSplit = BitFieldFactory.getInstance(0x100);
+ private BitField selected = BitFieldFactory.getInstance(0x200);
+ private BitField paged = BitFieldFactory.getInstance(0x400);
+ private BitField savedInPageBreakPreview = BitFieldFactory.getInstance(0x800);
// 4-7 reserved
// end bitfields
import org.apache.poi.hssf.model.Workbook;
import org.apache.poi.hssf.record.RecordInputStream;
import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
+
/**
* Title: Area 3D Ptg - 3D referecnce (Sheet + Area)<P>
private short field_4_first_column;
private short field_5_last_column;
- private BitField rowRelative = new BitField( 0x8000 );
- private BitField colRelative = new BitField( 0x4000 );
+ private BitField rowRelative = BitFieldFactory.getInstance( 0x8000 );
+ private BitField colRelative = BitFieldFactory.getInstance( 0x4000 );
/** Creates new AreaPtg */
public Area3DPtg()
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.hssf.util.AreaReference;
import org.apache.poi.hssf.util.CellReference;
private short field_3_first_column;
private short field_4_last_column;
- private BitField rowRelative = new BitField(0x8000);
- private BitField colRelative = new BitField(0x4000);
- private BitField column = new BitField(0x3FFF);
+ private BitField rowRelative = BitFieldFactory.getInstance(0x8000);
+ private BitField colRelative = BitFieldFactory.getInstance(0x4000);
+ private BitField column = BitFieldFactory.getInstance(0x3FFF);
private AreaPtg() {
//Required for clone methods
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
import java.util.List;
private final static int SIZE = 4;
private byte field_1_options;
private short field_2_data;
- private BitField semiVolatile = new BitField(0x01);
- private BitField optiIf = new BitField(0x02);
- private BitField optiChoose = new BitField(0x04);
- private BitField optGoto = new BitField(0x08);
- private BitField sum = new BitField(0x10);
- private BitField baxcel = new BitField(0x20);
- private BitField space = new BitField(0x40);
+ private BitField semiVolatile = BitFieldFactory.getInstance(0x01);
+ private BitField optiIf = BitFieldFactory.getInstance(0x02);
+ private BitField optiChoose = BitFieldFactory.getInstance(0x04);
+ private BitField optGoto = BitFieldFactory.getInstance(0x08);
+ private BitField sum = BitFieldFactory.getInstance(0x10);
+ private BitField baxcel = BitFieldFactory.getInstance(0x20);
+ private BitField space = BitFieldFactory.getInstance(0x40);
public AttrPtg() {
}
import org.apache.poi.hssf.util.SheetReferences;
import org.apache.poi.hssf.model.Workbook;
import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.hssf.model.Workbook;
import org.apache.poi.hssf.record.RecordInputStream;
private short field_1_index_extern_sheet;
private short field_2_row;
private short field_3_column;
- private BitField rowRelative = new BitField(0x8000);
- private BitField colRelative = new BitField(0x4000);
+ private BitField rowRelative = BitFieldFactory.getInstance(0x8000);
+ private BitField colRelative = BitFieldFactory.getInstance(0x4000);
/** Creates new AreaPtg */
public Ref3DPtg() {}
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.hssf.util.CellReference;
import org.apache.poi.hssf.model.Workbook;
//public final static byte sid = 0x44;
private short field_1_row;
private short field_2_col;
- private BitField rowRelative = new BitField(0x8000);
- private BitField colRelative = new BitField(0x4000);
+ private BitField rowRelative = BitFieldFactory.getInstance(0x8000);
+ private BitField colRelative = BitFieldFactory.getInstance(0x4000);
private ReferencePtg() {
//Required for clone methods
import org.apache.poi.hssf.model.Workbook;
import org.apache.poi.util.BitField;
+import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.StringUtil;
import org.apache.poi.hssf.record.RecordInputStream;
// Book says something totally different, so dont look there!
int field_1_length;
byte field_2_options;
- BitField fHighByte = new BitField(0x01);
+ BitField fHighByte = BitFieldFactory.getInstance(0x01);
private String field_3_string;
private StringPtg() {
*/
public final static int CELL_TYPE_ERROR = 5;
+ public final static short ENCODING_UNCHANGED = -1;
public final static short ENCODING_COMPRESSED_UNICODE = 0;
public final static short ENCODING_UTF_16 = 1;
private short cellNum;
private HSSFRichTextString stringValue;
private boolean booleanValue;
private byte errorValue;
- private short encoding = ENCODING_COMPRESSED_UNICODE;
+ private short encoding = ENCODING_UNCHANGED;
private Workbook book;
private Sheet sheet;
//private short row;
{
int sst = 0;
+ UnicodeString str = getRichStringCellValue().getUnicodeString();
if (encoding == ENCODING_COMPRESSED_UNICODE)
{
- UnicodeString str = getRichStringCellValue().getUnicodeString();
str.setCompressedUnicode();
- sst = book.addSSTString(str);
- }
- if (encoding == ENCODING_UTF_16)
+ } else if (encoding == ENCODING_UTF_16)
{
- UnicodeString str = getRichStringCellValue().getUnicodeString();
str.setUncompressedUnicode();
- sst = book.addSSTString(str);
}
+ sst = book.addSSTString(str);
lrec.setSSTIndex(sst);
+ getRichStringCellValue().setUnicodeString(book.getSSTString(sst));
}
}
record = lrec;
}
int index = 0;
+ UnicodeString str = value.getUnicodeString();
if (encoding == ENCODING_COMPRESSED_UNICODE)
{
- UnicodeString str = value.getUnicodeString();
str.setCompressedUnicode();
- index = book.addSSTString(str);
- }
- if (encoding == ENCODING_UTF_16)
+ } else if (encoding == ENCODING_UTF_16)
{
- UnicodeString str = value.getUnicodeString();
str.setUncompressedUnicode();
- index = book.addSSTString(str);
}
+ index = book.addSSTString(str);
(( LabelSSTRecord ) record).setSSTIndex(index);
stringValue = value;
stringValue.setWorkbookReferences(book, (( LabelSSTRecord ) record));
+ stringValue.setUnicodeString(book.getSSTString(index));
}
}
}
/**
- * used for internationalization, currently 0 for compressed unicode or 1 for 16-bit
+ * used for internationalization, currently -1 for unchanged, 0 for compressed unicode or 1 for 16-bit
*
+ * @see #ENCODING_UNCHANGED
* @see #ENCODING_COMPRESSED_UNICODE
* @see #ENCODING_UTF_16
*
- * @return 1 or 0 for compressed or uncompressed (used only with String type)
+ * @return -1, 1 or 0 for unchanged, compressed or uncompressed (used only with String type)
*/
-
public short getEncoding()
{
return encoding;
/**
* set the encoding to either 8 or 16 bit. (US/UK use 8-bit, rest of the western world use 16bit)
*
+ * @see #ENCODING_UNCHANGED
* @see #ENCODING_COMPRESSED_UNICODE
* @see #ENCODING_UTF_16
*
private void addToSSTIfRequired() {
if (book != null) {
- record.setSSTIndex(book.addSSTString(string));
+ int index = book.addSSTString(string);
+ record.setSSTIndex(index);
+ //The act of adding the string to the SST record may have meant that
+ //a extsing string was returned for the index, so update our local version
+ string = book.getSSTString(index);
}
}
return string.getString();
}
+ /** Used internally by the HSSFCell to get the internal string value*/
UnicodeString getUnicodeString() {
return cloneStringIfRequired();
}
+ /** Used internally by the HSSFCell to set the internal string value*/
+ void setUnicodeString(UnicodeString str) {
+ this.string = str;
+ }
+
+
/**
* @return the number of characters in the font.
*/
return string.compareTo(r.string);
}
+ public boolean equals(Object o) {
+ if (o instanceof HSSFRichTextString) {
+ return string.equals(((HSSFRichTextString)o).string);
+ }
+ return false;
+
+ }
+
/**
* @return the plain text representation of this string.
*/