From: Josh Micich Date: Wed, 19 Nov 2008 20:17:42 +0000 (+0000) Subject: moving other chart records into dedicated package X-Git-Tag: REL_3_5_BETA4~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fd323517bcbdf9a637b20515f63cf54e519364ec;p=poi.git moving other chart records into dedicated package git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@719053 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java b/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java deleted file mode 100644 index ef20677a28..0000000000 --- a/src/java/org/apache/poi/hssf/record/AreaFormatRecord.java +++ /dev/null @@ -1,260 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The area format record is used to define the colours and patterns for an area.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class AreaFormatRecord extends StandardRecord { - public final static short sid = 0x100A; - - private static final BitField automatic = BitFieldFactory.getInstance(0x1); - private static final BitField invert = BitFieldFactory.getInstance(0x2); - - private int field_1_foregroundColor; - private int field_2_backgroundColor; - private short field_3_pattern; - private short field_4_formatFlags; - private short field_5_forecolorIndex; - private short field_6_backcolorIndex; - - - public AreaFormatRecord() - { - - } - - public AreaFormatRecord(RecordInputStream in) - { - field_1_foregroundColor = in.readInt(); - field_2_backgroundColor = in.readInt(); - field_3_pattern = in.readShort(); - field_4_formatFlags = in.readShort(); - field_5_forecolorIndex = in.readShort(); - field_6_backcolorIndex = in.readShort(); - - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[AREAFORMAT]\n"); - buffer.append(" .foregroundColor = ") - .append("0x").append(HexDump.toHex( getForegroundColor ())) - .append(" (").append( getForegroundColor() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .backgroundColor = ") - .append("0x").append(HexDump.toHex( getBackgroundColor ())) - .append(" (").append( getBackgroundColor() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .pattern = ") - .append("0x").append(HexDump.toHex( getPattern ())) - .append(" (").append( getPattern() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .formatFlags = ") - .append("0x").append(HexDump.toHex( getFormatFlags ())) - .append(" (").append( getFormatFlags() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .automatic = ").append(isAutomatic()).append('\n'); - buffer.append(" .invert = ").append(isInvert()).append('\n'); - buffer.append(" .forecolorIndex = ") - .append("0x").append(HexDump.toHex( getForecolorIndex ())) - .append(" (").append( getForecolorIndex() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .backcolorIndex = ") - .append("0x").append(HexDump.toHex( getBackcolorIndex ())) - .append(" (").append( getBackcolorIndex() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/AREAFORMAT]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeInt(field_1_foregroundColor); - out.writeInt(field_2_backgroundColor); - out.writeShort(field_3_pattern); - out.writeShort(field_4_formatFlags); - out.writeShort(field_5_forecolorIndex); - out.writeShort(field_6_backcolorIndex); - } - - protected int getDataSize() { - return 4 + 4 + 2 + 2 + 2 + 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - AreaFormatRecord rec = new AreaFormatRecord(); - - rec.field_1_foregroundColor = field_1_foregroundColor; - rec.field_2_backgroundColor = field_2_backgroundColor; - rec.field_3_pattern = field_3_pattern; - rec.field_4_formatFlags = field_4_formatFlags; - rec.field_5_forecolorIndex = field_5_forecolorIndex; - rec.field_6_backcolorIndex = field_6_backcolorIndex; - return rec; - } - - - - - /** - * Get the foreground color field for the AreaFormat record. - */ - public int getForegroundColor() - { - return field_1_foregroundColor; - } - - /** - * Set the foreground color field for the AreaFormat record. - */ - public void setForegroundColor(int field_1_foregroundColor) - { - this.field_1_foregroundColor = field_1_foregroundColor; - } - - /** - * Get the background color field for the AreaFormat record. - */ - public int getBackgroundColor() - { - return field_2_backgroundColor; - } - - /** - * Set the background color field for the AreaFormat record. - */ - public void setBackgroundColor(int field_2_backgroundColor) - { - this.field_2_backgroundColor = field_2_backgroundColor; - } - - /** - * Get the pattern field for the AreaFormat record. - */ - public short getPattern() - { - return field_3_pattern; - } - - /** - * Set the pattern field for the AreaFormat record. - */ - public void setPattern(short field_3_pattern) - { - this.field_3_pattern = field_3_pattern; - } - - /** - * Get the format flags field for the AreaFormat record. - */ - public short getFormatFlags() - { - return field_4_formatFlags; - } - - /** - * Set the format flags field for the AreaFormat record. - */ - public void setFormatFlags(short field_4_formatFlags) - { - this.field_4_formatFlags = field_4_formatFlags; - } - - /** - * Get the forecolor index field for the AreaFormat record. - */ - public short getForecolorIndex() - { - return field_5_forecolorIndex; - } - - /** - * Set the forecolor index field for the AreaFormat record. - */ - public void setForecolorIndex(short field_5_forecolorIndex) - { - this.field_5_forecolorIndex = field_5_forecolorIndex; - } - - /** - * Get the backcolor index field for the AreaFormat record. - */ - public short getBackcolorIndex() - { - return field_6_backcolorIndex; - } - - /** - * Set the backcolor index field for the AreaFormat record. - */ - public void setBackcolorIndex(short field_6_backcolorIndex) - { - this.field_6_backcolorIndex = field_6_backcolorIndex; - } - - /** - * Sets the automatic field value. - * automatic formatting - */ - public void setAutomatic(boolean value) - { - field_4_formatFlags = automatic.setShortBoolean(field_4_formatFlags, value); - } - - /** - * automatic formatting - * @return the automatic field value. - */ - public boolean isAutomatic() - { - return automatic.isSet(field_4_formatFlags); - } - - /** - * Sets the invert field value. - * swap foreground and background colours when data is negative - */ - public void setInvert(boolean value) - { - field_4_formatFlags = invert.setShortBoolean(field_4_formatFlags, value); - } - - /** - * swap foreground and background colours when data is negative - * @return the invert field value. - */ - public boolean isInvert() - { - return invert.isSet(field_4_formatFlags); - } -} diff --git a/src/java/org/apache/poi/hssf/record/AreaRecord.java b/src/java/org/apache/poi/hssf/record/AreaRecord.java deleted file mode 100644 index 82c3ec249d..0000000000 --- a/src/java/org/apache/poi/hssf/record/AreaRecord.java +++ /dev/null @@ -1,158 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The area record is used to define a area chart.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class AreaRecord extends StandardRecord { - public final static short sid = 0x101A; - private short field_1_formatFlags; - private static final BitField stacked = BitFieldFactory.getInstance(0x1); - private static final BitField displayAsPercentage = BitFieldFactory.getInstance(0x2); - private static final BitField shadow = BitFieldFactory.getInstance(0x4); - - - public AreaRecord() - { - - } - - public AreaRecord(RecordInputStream in) - { - - field_1_formatFlags = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[AREA]\n"); - buffer.append(" .formatFlags = ") - .append("0x").append(HexDump.toHex( getFormatFlags ())) - .append(" (").append( getFormatFlags() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .stacked = ").append(isStacked()).append('\n'); - buffer.append(" .displayAsPercentage = ").append(isDisplayAsPercentage()).append('\n'); - buffer.append(" .shadow = ").append(isShadow()).append('\n'); - - buffer.append("[/AREA]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_formatFlags); - } - - protected int getDataSize() { - return 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - AreaRecord rec = new AreaRecord(); - - rec.field_1_formatFlags = field_1_formatFlags; - return rec; - } - - - - - /** - * Get the format flags field for the Area record. - */ - public short getFormatFlags() - { - return field_1_formatFlags; - } - - /** - * Set the format flags field for the Area record. - */ - public void setFormatFlags(short field_1_formatFlags) - { - this.field_1_formatFlags = field_1_formatFlags; - } - - /** - * Sets the stacked field value. - * series is stacked - */ - public void setStacked(boolean value) - { - field_1_formatFlags = stacked.setShortBoolean(field_1_formatFlags, value); - } - - /** - * series is stacked - * @return the stacked field value. - */ - public boolean isStacked() - { - return stacked.isSet(field_1_formatFlags); - } - - /** - * Sets the display as percentage field value. - * results displayed as percentages - */ - public void setDisplayAsPercentage(boolean value) - { - field_1_formatFlags = displayAsPercentage.setShortBoolean(field_1_formatFlags, value); - } - - /** - * results displayed as percentages - * @return the display as percentage field value. - */ - public boolean isDisplayAsPercentage() - { - return displayAsPercentage.isSet(field_1_formatFlags); - } - - /** - * Sets the shadow field value. - * display a shadow for the chart - */ - public void setShadow(boolean value) - { - field_1_formatFlags = shadow.setShortBoolean(field_1_formatFlags, value); - } - - /** - * display a shadow for the chart - * @return the shadow field value. - */ - public boolean isShadow() - { - return shadow.isSet(field_1_formatFlags); - } -} diff --git a/src/java/org/apache/poi/hssf/record/AxisLineFormatRecord.java b/src/java/org/apache/poi/hssf/record/AxisLineFormatRecord.java deleted file mode 100644 index 400bb1c580..0000000000 --- a/src/java/org/apache/poi/hssf/record/AxisLineFormatRecord.java +++ /dev/null @@ -1,112 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The axis line format record defines the axis type details.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class AxisLineFormatRecord extends StandardRecord { - public final static short sid = 0x1021; - private short field_1_axisType; - public final static short AXIS_TYPE_AXIS_LINE = 0; - public final static short AXIS_TYPE_MAJOR_GRID_LINE = 1; - public final static short AXIS_TYPE_MINOR_GRID_LINE = 2; - public final static short AXIS_TYPE_WALLS_OR_FLOOR = 3; - - - public AxisLineFormatRecord() - { - - } - - public AxisLineFormatRecord(RecordInputStream in) - { - field_1_axisType = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[AXISLINEFORMAT]\n"); - buffer.append(" .axisType = ") - .append("0x").append(HexDump.toHex( getAxisType ())) - .append(" (").append( getAxisType() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/AXISLINEFORMAT]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_axisType); - } - - protected int getDataSize() { - return 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - AxisLineFormatRecord rec = new AxisLineFormatRecord(); - - rec.field_1_axisType = field_1_axisType; - return rec; - } - - - - - /** - * Get the axis type field for the AxisLineFormat record. - * - * @return One of - * AXIS_TYPE_AXIS_LINE - * AXIS_TYPE_MAJOR_GRID_LINE - * AXIS_TYPE_MINOR_GRID_LINE - * AXIS_TYPE_WALLS_OR_FLOOR - */ - public short getAxisType() - { - return field_1_axisType; - } - - /** - * Set the axis type field for the AxisLineFormat record. - * - * @param field_1_axisType - * One of - * AXIS_TYPE_AXIS_LINE - * AXIS_TYPE_MAJOR_GRID_LINE - * AXIS_TYPE_MINOR_GRID_LINE - * AXIS_TYPE_WALLS_OR_FLOOR - */ - public void setAxisType(short field_1_axisType) - { - this.field_1_axisType = field_1_axisType; - } -} diff --git a/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java b/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java deleted file mode 100644 index 6e7ef699ec..0000000000 --- a/src/java/org/apache/poi/hssf/record/AxisOptionsRecord.java +++ /dev/null @@ -1,451 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The axis options record provides unit information and other various tidbits about the axis.

- * - * @author Andrew C. Oliver(acoliver at apache.org) - */ -public final class AxisOptionsRecord extends StandardRecord { - public final static short sid = 0x1062; - - private static final BitField defaultMinimum = BitFieldFactory.getInstance(0x01); - private static final BitField defaultMaximum = BitFieldFactory.getInstance(0x02); - private static final BitField defaultMajor = BitFieldFactory.getInstance(0x04); - private static final BitField defaultMinorUnit = BitFieldFactory.getInstance(0x08); - private static final BitField isDate = BitFieldFactory.getInstance(0x10); - private static final BitField defaultBase = BitFieldFactory.getInstance(0x20); - private static final BitField defaultCross = BitFieldFactory.getInstance(0x40); - private static final BitField defaultDateSettings = BitFieldFactory.getInstance(0x80); - - private short field_1_minimumCategory; - private short field_2_maximumCategory; - private short field_3_majorUnitValue; - private short field_4_majorUnit; - private short field_5_minorUnitValue; - private short field_6_minorUnit; - private short field_7_baseUnit; - private short field_8_crossingPoint; - private short field_9_options; - - - public AxisOptionsRecord() - { - - } - - public AxisOptionsRecord(RecordInputStream in) - { - field_1_minimumCategory = in.readShort(); - field_2_maximumCategory = in.readShort(); - field_3_majorUnitValue = in.readShort(); - field_4_majorUnit = in.readShort(); - field_5_minorUnitValue = in.readShort(); - field_6_minorUnit = in.readShort(); - field_7_baseUnit = in.readShort(); - field_8_crossingPoint = in.readShort(); - field_9_options = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[AXCEXT]\n"); - buffer.append(" .minimumCategory = ") - .append("0x").append(HexDump.toHex( getMinimumCategory ())) - .append(" (").append( getMinimumCategory() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .maximumCategory = ") - .append("0x").append(HexDump.toHex( getMaximumCategory ())) - .append(" (").append( getMaximumCategory() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .majorUnitValue = ") - .append("0x").append(HexDump.toHex( getMajorUnitValue ())) - .append(" (").append( getMajorUnitValue() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .majorUnit = ") - .append("0x").append(HexDump.toHex( getMajorUnit ())) - .append(" (").append( getMajorUnit() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .minorUnitValue = ") - .append("0x").append(HexDump.toHex( getMinorUnitValue ())) - .append(" (").append( getMinorUnitValue() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .minorUnit = ") - .append("0x").append(HexDump.toHex( getMinorUnit ())) - .append(" (").append( getMinorUnit() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .baseUnit = ") - .append("0x").append(HexDump.toHex( getBaseUnit ())) - .append(" (").append( getBaseUnit() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .crossingPoint = ") - .append("0x").append(HexDump.toHex( getCrossingPoint ())) - .append(" (").append( getCrossingPoint() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .options = ") - .append("0x").append(HexDump.toHex( getOptions ())) - .append(" (").append( getOptions() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .defaultMinimum = ").append(isDefaultMinimum()).append('\n'); - buffer.append(" .defaultMaximum = ").append(isDefaultMaximum()).append('\n'); - buffer.append(" .defaultMajor = ").append(isDefaultMajor()).append('\n'); - buffer.append(" .defaultMinorUnit = ").append(isDefaultMinorUnit()).append('\n'); - buffer.append(" .isDate = ").append(isIsDate()).append('\n'); - buffer.append(" .defaultBase = ").append(isDefaultBase()).append('\n'); - buffer.append(" .defaultCross = ").append(isDefaultCross()).append('\n'); - buffer.append(" .defaultDateSettings = ").append(isDefaultDateSettings()).append('\n'); - - buffer.append("[/AXCEXT]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_minimumCategory); - out.writeShort(field_2_maximumCategory); - out.writeShort(field_3_majorUnitValue); - out.writeShort(field_4_majorUnit); - out.writeShort(field_5_minorUnitValue); - out.writeShort(field_6_minorUnit); - out.writeShort(field_7_baseUnit); - out.writeShort(field_8_crossingPoint); - out.writeShort(field_9_options); - } - - protected int getDataSize() { - return 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - AxisOptionsRecord rec = new AxisOptionsRecord(); - - rec.field_1_minimumCategory = field_1_minimumCategory; - rec.field_2_maximumCategory = field_2_maximumCategory; - rec.field_3_majorUnitValue = field_3_majorUnitValue; - rec.field_4_majorUnit = field_4_majorUnit; - rec.field_5_minorUnitValue = field_5_minorUnitValue; - rec.field_6_minorUnit = field_6_minorUnit; - rec.field_7_baseUnit = field_7_baseUnit; - rec.field_8_crossingPoint = field_8_crossingPoint; - rec.field_9_options = field_9_options; - return rec; - } - - - - - /** - * Get the minimum category field for the AxisOptions record. - */ - public short getMinimumCategory() - { - return field_1_minimumCategory; - } - - /** - * Set the minimum category field for the AxisOptions record. - */ - public void setMinimumCategory(short field_1_minimumCategory) - { - this.field_1_minimumCategory = field_1_minimumCategory; - } - - /** - * Get the maximum category field for the AxisOptions record. - */ - public short getMaximumCategory() - { - return field_2_maximumCategory; - } - - /** - * Set the maximum category field for the AxisOptions record. - */ - public void setMaximumCategory(short field_2_maximumCategory) - { - this.field_2_maximumCategory = field_2_maximumCategory; - } - - /** - * Get the major unit value field for the AxisOptions record. - */ - public short getMajorUnitValue() - { - return field_3_majorUnitValue; - } - - /** - * Set the major unit value field for the AxisOptions record. - */ - public void setMajorUnitValue(short field_3_majorUnitValue) - { - this.field_3_majorUnitValue = field_3_majorUnitValue; - } - - /** - * Get the major unit field for the AxisOptions record. - */ - public short getMajorUnit() - { - return field_4_majorUnit; - } - - /** - * Set the major unit field for the AxisOptions record. - */ - public void setMajorUnit(short field_4_majorUnit) - { - this.field_4_majorUnit = field_4_majorUnit; - } - - /** - * Get the minor unit value field for the AxisOptions record. - */ - public short getMinorUnitValue() - { - return field_5_minorUnitValue; - } - - /** - * Set the minor unit value field for the AxisOptions record. - */ - public void setMinorUnitValue(short field_5_minorUnitValue) - { - this.field_5_minorUnitValue = field_5_minorUnitValue; - } - - /** - * Get the minor unit field for the AxisOptions record. - */ - public short getMinorUnit() - { - return field_6_minorUnit; - } - - /** - * Set the minor unit field for the AxisOptions record. - */ - public void setMinorUnit(short field_6_minorUnit) - { - this.field_6_minorUnit = field_6_minorUnit; - } - - /** - * Get the base unit field for the AxisOptions record. - */ - public short getBaseUnit() - { - return field_7_baseUnit; - } - - /** - * Set the base unit field for the AxisOptions record. - */ - public void setBaseUnit(short field_7_baseUnit) - { - this.field_7_baseUnit = field_7_baseUnit; - } - - /** - * Get the crossing point field for the AxisOptions record. - */ - public short getCrossingPoint() - { - return field_8_crossingPoint; - } - - /** - * Set the crossing point field for the AxisOptions record. - */ - public void setCrossingPoint(short field_8_crossingPoint) - { - this.field_8_crossingPoint = field_8_crossingPoint; - } - - /** - * Get the options field for the AxisOptions record. - */ - public short getOptions() - { - return field_9_options; - } - - /** - * Set the options field for the AxisOptions record. - */ - public void setOptions(short field_9_options) - { - this.field_9_options = field_9_options; - } - - /** - * Sets the default minimum field value. - * use the default minimum category - */ - public void setDefaultMinimum(boolean value) - { - field_9_options = defaultMinimum.setShortBoolean(field_9_options, value); - } - - /** - * use the default minimum category - * @return the default minimum field value. - */ - public boolean isDefaultMinimum() - { - return defaultMinimum.isSet(field_9_options); - } - - /** - * Sets the default maximum field value. - * use the default maximum category - */ - public void setDefaultMaximum(boolean value) - { - field_9_options = defaultMaximum.setShortBoolean(field_9_options, value); - } - - /** - * use the default maximum category - * @return the default maximum field value. - */ - public boolean isDefaultMaximum() - { - return defaultMaximum.isSet(field_9_options); - } - - /** - * Sets the default major field value. - * use the default major unit - */ - public void setDefaultMajor(boolean value) - { - field_9_options = defaultMajor.setShortBoolean(field_9_options, value); - } - - /** - * use the default major unit - * @return the default major field value. - */ - public boolean isDefaultMajor() - { - return defaultMajor.isSet(field_9_options); - } - - /** - * Sets the default minor unit field value. - * use the default minor unit - */ - public void setDefaultMinorUnit(boolean value) - { - field_9_options = defaultMinorUnit.setShortBoolean(field_9_options, value); - } - - /** - * use the default minor unit - * @return the default minor unit field value. - */ - public boolean isDefaultMinorUnit() - { - return defaultMinorUnit.isSet(field_9_options); - } - - /** - * Sets the isDate field value. - * this is a date axis - */ - public void setIsDate(boolean value) - { - field_9_options = isDate.setShortBoolean(field_9_options, value); - } - - /** - * this is a date axis - * @return the isDate field value. - */ - public boolean isIsDate() - { - return isDate.isSet(field_9_options); - } - - /** - * Sets the default base field value. - * use the default base unit - */ - public void setDefaultBase(boolean value) - { - field_9_options = defaultBase.setShortBoolean(field_9_options, value); - } - - /** - * use the default base unit - * @return the default base field value. - */ - public boolean isDefaultBase() - { - return defaultBase.isSet(field_9_options); - } - - /** - * Sets the default cross field value. - * use the default crossing point - */ - public void setDefaultCross(boolean value) - { - field_9_options = defaultCross.setShortBoolean(field_9_options, value); - } - - /** - * use the default crossing point - * @return the default cross field value. - */ - public boolean isDefaultCross() - { - return defaultCross.isSet(field_9_options); - } - - /** - * Sets the default date settings field value. - * use default date setttings for this axis - */ - public void setDefaultDateSettings(boolean value) - { - field_9_options = defaultDateSettings.setShortBoolean(field_9_options, value); - } - - /** - * use default date setttings for this axis - * @return the default date settings field value. - */ - public boolean isDefaultDateSettings() - { - return defaultDateSettings.isSet(field_9_options); - } -} diff --git a/src/java/org/apache/poi/hssf/record/AxisParentRecord.java b/src/java/org/apache/poi/hssf/record/AxisParentRecord.java deleted file mode 100644 index e40e9ae00a..0000000000 --- a/src/java/org/apache/poi/hssf/record/AxisParentRecord.java +++ /dev/null @@ -1,202 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The axis size and location

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class AxisParentRecord extends StandardRecord { - public final static short sid = 0x1041; - private short field_1_axisType; - public final static short AXIS_TYPE_MAIN = 0; - public final static short AXIS_TYPE_SECONDARY = 1; - private int field_2_x; - private int field_3_y; - private int field_4_width; - private int field_5_height; - - - public AxisParentRecord() - { - - } - - public AxisParentRecord(RecordInputStream in) - { - field_1_axisType = in.readShort(); - field_2_x = in.readInt(); - field_3_y = in.readInt(); - field_4_width = in.readInt(); - field_5_height = in.readInt(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[AXISPARENT]\n"); - buffer.append(" .axisType = ") - .append("0x").append(HexDump.toHex( getAxisType ())) - .append(" (").append( getAxisType() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .x = ") - .append("0x").append(HexDump.toHex( getX ())) - .append(" (").append( getX() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .y = ") - .append("0x").append(HexDump.toHex( getY ())) - .append(" (").append( getY() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .width = ") - .append("0x").append(HexDump.toHex( getWidth ())) - .append(" (").append( getWidth() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .height = ") - .append("0x").append(HexDump.toHex( getHeight ())) - .append(" (").append( getHeight() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/AXISPARENT]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_axisType); - out.writeInt(field_2_x); - out.writeInt(field_3_y); - out.writeInt(field_4_width); - out.writeInt(field_5_height); - } - - protected int getDataSize() { - return 2 + 4 + 4 + 4 + 4; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - AxisParentRecord rec = new AxisParentRecord(); - - rec.field_1_axisType = field_1_axisType; - rec.field_2_x = field_2_x; - rec.field_3_y = field_3_y; - rec.field_4_width = field_4_width; - rec.field_5_height = field_5_height; - return rec; - } - - - - - /** - * Get the axis type field for the AxisParent record. - * - * @return One of - * AXIS_TYPE_MAIN - * AXIS_TYPE_SECONDARY - */ - public short getAxisType() - { - return field_1_axisType; - } - - /** - * Set the axis type field for the AxisParent record. - * - * @param field_1_axisType - * One of - * AXIS_TYPE_MAIN - * AXIS_TYPE_SECONDARY - */ - public void setAxisType(short field_1_axisType) - { - this.field_1_axisType = field_1_axisType; - } - - /** - * Get the x field for the AxisParent record. - */ - public int getX() - { - return field_2_x; - } - - /** - * Set the x field for the AxisParent record. - */ - public void setX(int field_2_x) - { - this.field_2_x = field_2_x; - } - - /** - * Get the y field for the AxisParent record. - */ - public int getY() - { - return field_3_y; - } - - /** - * Set the y field for the AxisParent record. - */ - public void setY(int field_3_y) - { - this.field_3_y = field_3_y; - } - - /** - * Get the width field for the AxisParent record. - */ - public int getWidth() - { - return field_4_width; - } - - /** - * Set the width field for the AxisParent record. - */ - public void setWidth(int field_4_width) - { - this.field_4_width = field_4_width; - } - - /** - * Get the height field for the AxisParent record. - */ - public int getHeight() - { - return field_5_height; - } - - /** - * Set the height field for the AxisParent record. - */ - public void setHeight(int field_5_height) - { - this.field_5_height = field_5_height; - } -} diff --git a/src/java/org/apache/poi/hssf/record/AxisRecord.java b/src/java/org/apache/poi/hssf/record/AxisRecord.java deleted file mode 100644 index f12b30b88e..0000000000 --- a/src/java/org/apache/poi/hssf/record/AxisRecord.java +++ /dev/null @@ -1,205 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The axis record defines the type of an axis.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class AxisRecord extends StandardRecord { - public final static short sid = 0x101d; - private short field_1_axisType; - public final static short AXIS_TYPE_CATEGORY_OR_X_AXIS = 0; - public final static short AXIS_TYPE_VALUE_AXIS = 1; - public final static short AXIS_TYPE_SERIES_AXIS = 2; - private int field_2_reserved1; - private int field_3_reserved2; - private int field_4_reserved3; - private int field_5_reserved4; - - - public AxisRecord() - { - - } - - public AxisRecord(RecordInputStream in) - { - field_1_axisType = in.readShort(); - field_2_reserved1 = in.readInt(); - field_3_reserved2 = in.readInt(); - field_4_reserved3 = in.readInt(); - field_5_reserved4 = in.readInt(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[AXIS]\n"); - buffer.append(" .axisType = ") - .append("0x").append(HexDump.toHex( getAxisType ())) - .append(" (").append( getAxisType() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .reserved1 = ") - .append("0x").append(HexDump.toHex( getReserved1 ())) - .append(" (").append( getReserved1() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .reserved2 = ") - .append("0x").append(HexDump.toHex( getReserved2 ())) - .append(" (").append( getReserved2() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .reserved3 = ") - .append("0x").append(HexDump.toHex( getReserved3 ())) - .append(" (").append( getReserved3() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .reserved4 = ") - .append("0x").append(HexDump.toHex( getReserved4 ())) - .append(" (").append( getReserved4() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/AXIS]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_axisType); - out.writeInt(field_2_reserved1); - out.writeInt(field_3_reserved2); - out.writeInt(field_4_reserved3); - out.writeInt(field_5_reserved4); - } - - protected int getDataSize() { - return 2 + 4 + 4 + 4 + 4; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - AxisRecord rec = new AxisRecord(); - - rec.field_1_axisType = field_1_axisType; - rec.field_2_reserved1 = field_2_reserved1; - rec.field_3_reserved2 = field_3_reserved2; - rec.field_4_reserved3 = field_4_reserved3; - rec.field_5_reserved4 = field_5_reserved4; - return rec; - } - - - - - /** - * Get the axis type field for the Axis record. - * - * @return One of - * AXIS_TYPE_CATEGORY_OR_X_AXIS - * AXIS_TYPE_VALUE_AXIS - * AXIS_TYPE_SERIES_AXIS - */ - public short getAxisType() - { - return field_1_axisType; - } - - /** - * Set the axis type field for the Axis record. - * - * @param field_1_axisType - * One of - * AXIS_TYPE_CATEGORY_OR_X_AXIS - * AXIS_TYPE_VALUE_AXIS - * AXIS_TYPE_SERIES_AXIS - */ - public void setAxisType(short field_1_axisType) - { - this.field_1_axisType = field_1_axisType; - } - - /** - * Get the reserved1 field for the Axis record. - */ - public int getReserved1() - { - return field_2_reserved1; - } - - /** - * Set the reserved1 field for the Axis record. - */ - public void setReserved1(int field_2_reserved1) - { - this.field_2_reserved1 = field_2_reserved1; - } - - /** - * Get the reserved2 field for the Axis record. - */ - public int getReserved2() - { - return field_3_reserved2; - } - - /** - * Set the reserved2 field for the Axis record. - */ - public void setReserved2(int field_3_reserved2) - { - this.field_3_reserved2 = field_3_reserved2; - } - - /** - * Get the reserved3 field for the Axis record. - */ - public int getReserved3() - { - return field_4_reserved3; - } - - /** - * Set the reserved3 field for the Axis record. - */ - public void setReserved3(int field_4_reserved3) - { - this.field_4_reserved3 = field_4_reserved3; - } - - /** - * Get the reserved4 field for the Axis record. - */ - public int getReserved4() - { - return field_5_reserved4; - } - - /** - * Set the reserved4 field for the Axis record. - */ - public void setReserved4(int field_5_reserved4) - { - this.field_5_reserved4 = field_5_reserved4; - } -} diff --git a/src/java/org/apache/poi/hssf/record/AxisUsedRecord.java b/src/java/org/apache/poi/hssf/record/AxisUsedRecord.java deleted file mode 100644 index 4e860f1b2c..0000000000 --- a/src/java/org/apache/poi/hssf/record/AxisUsedRecord.java +++ /dev/null @@ -1,95 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The number of axes used on a chart.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class AxisUsedRecord extends StandardRecord { - public final static short sid = 0x1046; - private short field_1_numAxis; - - - public AxisUsedRecord() - { - - } - - public AxisUsedRecord(RecordInputStream in) - { - field_1_numAxis = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[AXISUSED]\n"); - buffer.append(" .numAxis = ") - .append("0x").append(HexDump.toHex( getNumAxis ())) - .append(" (").append( getNumAxis() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/AXISUSED]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_numAxis); - } - - protected int getDataSize() { - return 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - AxisUsedRecord rec = new AxisUsedRecord(); - - rec.field_1_numAxis = field_1_numAxis; - return rec; - } - - - - - /** - * Get the num axis field for the AxisUsed record. - */ - public short getNumAxis() - { - return field_1_numAxis; - } - - /** - * Set the num axis field for the AxisUsed record. - */ - public void setNumAxis(short field_1_numAxis) - { - this.field_1_numAxis = field_1_numAxis; - } -} diff --git a/src/java/org/apache/poi/hssf/record/BarRecord.java b/src/java/org/apache/poi/hssf/record/BarRecord.java deleted file mode 100644 index 4f4aa2f694..0000000000 --- a/src/java/org/apache/poi/hssf/record/BarRecord.java +++ /dev/null @@ -1,227 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The bar record is used to define a bar chart.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class BarRecord extends StandardRecord { - public final static short sid = 0x1017; - - private static final BitField horizontal = BitFieldFactory.getInstance(0x1); - private static final BitField stacked = BitFieldFactory.getInstance(0x2); - private static final BitField displayAsPercentage = BitFieldFactory.getInstance(0x4); - private static final BitField shadow = BitFieldFactory.getInstance(0x8); - - private short field_1_barSpace; - private short field_2_categorySpace; - private short field_3_formatFlags; - - - public BarRecord() - { - - } - - public BarRecord(RecordInputStream in) - { - field_1_barSpace = in.readShort(); - field_2_categorySpace = in.readShort(); - field_3_formatFlags = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[BAR]\n"); - buffer.append(" .barSpace = ") - .append("0x").append(HexDump.toHex( getBarSpace ())) - .append(" (").append( getBarSpace() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .categorySpace = ") - .append("0x").append(HexDump.toHex( getCategorySpace ())) - .append(" (").append( getCategorySpace() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .formatFlags = ") - .append("0x").append(HexDump.toHex( getFormatFlags ())) - .append(" (").append( getFormatFlags() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .horizontal = ").append(isHorizontal()).append('\n'); - buffer.append(" .stacked = ").append(isStacked()).append('\n'); - buffer.append(" .displayAsPercentage = ").append(isDisplayAsPercentage()).append('\n'); - buffer.append(" .shadow = ").append(isShadow()).append('\n'); - - buffer.append("[/BAR]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_barSpace); - out.writeShort(field_2_categorySpace); - out.writeShort(field_3_formatFlags); - } - - protected int getDataSize() { - return 2 + 2 + 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - BarRecord rec = new BarRecord(); - - rec.field_1_barSpace = field_1_barSpace; - rec.field_2_categorySpace = field_2_categorySpace; - rec.field_3_formatFlags = field_3_formatFlags; - return rec; - } - - - - - /** - * Get the bar space field for the Bar record. - */ - public short getBarSpace() - { - return field_1_barSpace; - } - - /** - * Set the bar space field for the Bar record. - */ - public void setBarSpace(short field_1_barSpace) - { - this.field_1_barSpace = field_1_barSpace; - } - - /** - * Get the category space field for the Bar record. - */ - public short getCategorySpace() - { - return field_2_categorySpace; - } - - /** - * Set the category space field for the Bar record. - */ - public void setCategorySpace(short field_2_categorySpace) - { - this.field_2_categorySpace = field_2_categorySpace; - } - - /** - * Get the format flags field for the Bar record. - */ - public short getFormatFlags() - { - return field_3_formatFlags; - } - - /** - * Set the format flags field for the Bar record. - */ - public void setFormatFlags(short field_3_formatFlags) - { - this.field_3_formatFlags = field_3_formatFlags; - } - - /** - * Sets the horizontal field value. - * true to display horizontal bar charts, false for vertical - */ - public void setHorizontal(boolean value) - { - field_3_formatFlags = horizontal.setShortBoolean(field_3_formatFlags, value); - } - - /** - * true to display horizontal bar charts, false for vertical - * @return the horizontal field value. - */ - public boolean isHorizontal() - { - return horizontal.isSet(field_3_formatFlags); - } - - /** - * Sets the stacked field value. - * stack displayed values - */ - public void setStacked(boolean value) - { - field_3_formatFlags = stacked.setShortBoolean(field_3_formatFlags, value); - } - - /** - * stack displayed values - * @return the stacked field value. - */ - public boolean isStacked() - { - return stacked.isSet(field_3_formatFlags); - } - - /** - * Sets the display as percentage field value. - * display chart values as a percentage - */ - public void setDisplayAsPercentage(boolean value) - { - field_3_formatFlags = displayAsPercentage.setShortBoolean(field_3_formatFlags, value); - } - - /** - * display chart values as a percentage - * @return the display as percentage field value. - */ - public boolean isDisplayAsPercentage() - { - return displayAsPercentage.isSet(field_3_formatFlags); - } - - /** - * Sets the shadow field value. - * display a shadow for the chart - */ - public void setShadow(boolean value) - { - field_3_formatFlags = shadow.setShortBoolean(field_3_formatFlags, value); - } - - /** - * display a shadow for the chart - * @return the shadow field value. - */ - public boolean isShadow() - { - return shadow.isSet(field_3_formatFlags); - } -} diff --git a/src/java/org/apache/poi/hssf/record/BeginRecord.java b/src/java/org/apache/poi/hssf/record/BeginRecord.java deleted file mode 100644 index 37d1663ff7..0000000000 --- a/src/java/org/apache/poi/hssf/record/BeginRecord.java +++ /dev/null @@ -1,64 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.LittleEndianOutput; - -/** - * The begin record defines the start of a block of records for a (grpahing - * data object. This record is matched with a corresponding EndRecord. - * - * @see EndRecord - * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class BeginRecord extends StandardRecord { - public static final short sid = 0x1033; - - public BeginRecord() - { - } - - /** - * @param in unused (since this record has no data) - */ - public BeginRecord(RecordInputStream in) - { - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[BEGIN]\n"); - buffer.append("[/BEGIN]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - } - - protected int getDataSize() { - return 0; - } - - public short getSid() - { - return sid; - } -} diff --git a/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java b/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java deleted file mode 100644 index c52e3de3bf..0000000000 --- a/src/java/org/apache/poi/hssf/record/CategorySeriesAxisRecord.java +++ /dev/null @@ -1,231 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * This record refers to a category or series axis and is used to specify label/tickmark frequency.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class CategorySeriesAxisRecord extends StandardRecord { - public final static short sid = 0x1020; - - private static final BitField valueAxisCrossing = BitFieldFactory.getInstance(0x1); - private static final BitField crossesFarRight = BitFieldFactory.getInstance(0x2); - private static final BitField reversed = BitFieldFactory.getInstance(0x4); - - private short field_1_crossingPoint; - private short field_2_labelFrequency; - private short field_3_tickMarkFrequency; - private short field_4_options; - - - public CategorySeriesAxisRecord() - { - - } - - public CategorySeriesAxisRecord(RecordInputStream in) - { - field_1_crossingPoint = in.readShort(); - field_2_labelFrequency = in.readShort(); - field_3_tickMarkFrequency = in.readShort(); - field_4_options = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[CATSERRANGE]\n"); - buffer.append(" .crossingPoint = ") - .append("0x").append(HexDump.toHex( getCrossingPoint ())) - .append(" (").append( getCrossingPoint() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .labelFrequency = ") - .append("0x").append(HexDump.toHex( getLabelFrequency ())) - .append(" (").append( getLabelFrequency() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .tickMarkFrequency = ") - .append("0x").append(HexDump.toHex( getTickMarkFrequency ())) - .append(" (").append( getTickMarkFrequency() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .options = ") - .append("0x").append(HexDump.toHex( getOptions ())) - .append(" (").append( getOptions() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .valueAxisCrossing = ").append(isValueAxisCrossing()).append('\n'); - buffer.append(" .crossesFarRight = ").append(isCrossesFarRight()).append('\n'); - buffer.append(" .reversed = ").append(isReversed()).append('\n'); - - buffer.append("[/CATSERRANGE]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_crossingPoint); - out.writeShort(field_2_labelFrequency); - out.writeShort(field_3_tickMarkFrequency); - out.writeShort(field_4_options); - } - - protected int getDataSize() { - return 2 + 2 + 2 + 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - CategorySeriesAxisRecord rec = new CategorySeriesAxisRecord(); - - rec.field_1_crossingPoint = field_1_crossingPoint; - rec.field_2_labelFrequency = field_2_labelFrequency; - rec.field_3_tickMarkFrequency = field_3_tickMarkFrequency; - rec.field_4_options = field_4_options; - return rec; - } - - - - - /** - * Get the crossing point field for the CategorySeriesAxis record. - */ - public short getCrossingPoint() - { - return field_1_crossingPoint; - } - - /** - * Set the crossing point field for the CategorySeriesAxis record. - */ - public void setCrossingPoint(short field_1_crossingPoint) - { - this.field_1_crossingPoint = field_1_crossingPoint; - } - - /** - * Get the label frequency field for the CategorySeriesAxis record. - */ - public short getLabelFrequency() - { - return field_2_labelFrequency; - } - - /** - * Set the label frequency field for the CategorySeriesAxis record. - */ - public void setLabelFrequency(short field_2_labelFrequency) - { - this.field_2_labelFrequency = field_2_labelFrequency; - } - - /** - * Get the tick mark frequency field for the CategorySeriesAxis record. - */ - public short getTickMarkFrequency() - { - return field_3_tickMarkFrequency; - } - - /** - * Set the tick mark frequency field for the CategorySeriesAxis record. - */ - public void setTickMarkFrequency(short field_3_tickMarkFrequency) - { - this.field_3_tickMarkFrequency = field_3_tickMarkFrequency; - } - - /** - * Get the options field for the CategorySeriesAxis record. - */ - public short getOptions() - { - return field_4_options; - } - - /** - * Set the options field for the CategorySeriesAxis record. - */ - public void setOptions(short field_4_options) - { - this.field_4_options = field_4_options; - } - - /** - * Sets the value axis crossing field value. - * set true to indicate axis crosses between categories and false to cross axis midway - */ - public void setValueAxisCrossing(boolean value) - { - field_4_options = valueAxisCrossing.setShortBoolean(field_4_options, value); - } - - /** - * set true to indicate axis crosses between categories and false to cross axis midway - * @return the value axis crossing field value. - */ - public boolean isValueAxisCrossing() - { - return valueAxisCrossing.isSet(field_4_options); - } - - /** - * Sets the crosses far right field value. - * axis crosses at the far right - */ - public void setCrossesFarRight(boolean value) - { - field_4_options = crossesFarRight.setShortBoolean(field_4_options, value); - } - - /** - * axis crosses at the far right - * @return the crosses far right field value. - */ - public boolean isCrossesFarRight() - { - return crossesFarRight.isSet(field_4_options); - } - - /** - * Sets the reversed field value. - * categories are displayed in reverse order - */ - public void setReversed(boolean value) - { - field_4_options = reversed.setShortBoolean(field_4_options, value); - } - - /** - * categories are displayed in reverse order - * @return the reversed field value. - */ - public boolean isReversed() - { - return reversed.isSet(field_4_options); - } -} diff --git a/src/java/org/apache/poi/hssf/record/ChartFormatRecord.java b/src/java/org/apache/poi/hssf/record/ChartFormatRecord.java deleted file mode 100644 index 69a8a8281e..0000000000 --- a/src/java/org/apache/poi/hssf/record/ChartFormatRecord.java +++ /dev/null @@ -1,142 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.LittleEndianOutput; - -/** - * Class ChartFormatRecord - * - * - * @author Glen Stampoultzis (glens at apache.org) - * @version %I%, %G% - */ -public final class ChartFormatRecord extends StandardRecord { - public static final short sid = 0x1014; - - private static final BitField varyDisplayPattern = BitFieldFactory.getInstance(0x01); - - // ignored? - private int field1_x_position; // lower left - private int field2_y_position; // lower left - private int field3_width; - private int field4_height; - private short field5_grbit; - - public ChartFormatRecord() - { - } - - public ChartFormatRecord(RecordInputStream in) - { - field1_x_position = in.readInt(); - field2_y_position = in.readInt(); - field3_width = in.readInt(); - field4_height = in.readInt(); - field5_grbit = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[CHARTFORMAT]\n"); - buffer.append(" .xPosition = ").append(getXPosition()) - .append("\n"); - buffer.append(" .yPosition = ").append(getYPosition()) - .append("\n"); - buffer.append(" .width = ").append(getWidth()) - .append("\n"); - buffer.append(" .height = ").append(getHeight()) - .append("\n"); - buffer.append(" .grBit = ") - .append(Integer.toHexString(field5_grbit)).append("\n"); - buffer.append("[/CHARTFORMAT]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeInt(getXPosition()); - out.writeInt(getYPosition()); - out.writeInt(getWidth()); - out.writeInt(getHeight()); - out.writeShort(field5_grbit); - } - - protected int getDataSize() { - return 18; - } - - public short getSid() - { - return sid; - } - - public int getXPosition() - { - return field1_x_position; - } - - public void setXPosition(int xPosition) - { - this.field1_x_position = xPosition; - } - - public int getYPosition() - { - return field2_y_position; - } - - public void setYPosition(int yPosition) - { - this.field2_y_position = yPosition; - } - - public int getWidth() - { - return field3_width; - } - - public void setWidth(int width) - { - this.field3_width = width; - } - - public int getHeight() - { - return field4_height; - } - - public void setHeight(int height) - { - this.field4_height = height; - } - - public boolean getVaryDisplayPattern() - { - return varyDisplayPattern.isSet(field5_grbit); - } - - public void setVaryDisplayPattern(boolean value) - { - field5_grbit = varyDisplayPattern.setShortBoolean(field5_grbit, - value); - } -} diff --git a/src/java/org/apache/poi/hssf/record/ChartRecord.java b/src/java/org/apache/poi/hssf/record/ChartRecord.java deleted file mode 100644 index 55ccab6407..0000000000 --- a/src/java/org/apache/poi/hssf/record/ChartRecord.java +++ /dev/null @@ -1,166 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The chart record is used to define the location and size of a chart. - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class ChartRecord extends StandardRecord { - public final static short sid = 0x1002; - private int field_1_x; - private int field_2_y; - private int field_3_width; - private int field_4_height; - - - public ChartRecord() - { - - } - - public ChartRecord(RecordInputStream in) - { - field_1_x = in.readInt(); - field_2_y = in.readInt(); - field_3_width = in.readInt(); - field_4_height = in.readInt(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[CHART]\n"); - buffer.append(" .x = ") - .append("0x").append(HexDump.toHex( getX ())) - .append(" (").append( getX() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .y = ") - .append("0x").append(HexDump.toHex( getY ())) - .append(" (").append( getY() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .width = ") - .append("0x").append(HexDump.toHex( getWidth ())) - .append(" (").append( getWidth() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .height = ") - .append("0x").append(HexDump.toHex( getHeight ())) - .append(" (").append( getHeight() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/CHART]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeInt(field_1_x); - out.writeInt(field_2_y); - out.writeInt(field_3_width); - out.writeInt(field_4_height); - } - - protected int getDataSize() { - return 4 + 4 + 4 + 4; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - ChartRecord rec = new ChartRecord(); - - rec.field_1_x = field_1_x; - rec.field_2_y = field_2_y; - rec.field_3_width = field_3_width; - rec.field_4_height = field_4_height; - return rec; - } - - - - - /** - * Get the x field for the Chart record. - */ - public int getX() - { - return field_1_x; - } - - /** - * Set the x field for the Chart record. - */ - public void setX(int field_1_x) - { - this.field_1_x = field_1_x; - } - - /** - * Get the y field for the Chart record. - */ - public int getY() - { - return field_2_y; - } - - /** - * Set the y field for the Chart record. - */ - public void setY(int field_2_y) - { - this.field_2_y = field_2_y; - } - - /** - * Get the width field for the Chart record. - */ - public int getWidth() - { - return field_3_width; - } - - /** - * Set the width field for the Chart record. - */ - public void setWidth(int field_3_width) - { - this.field_3_width = field_3_width; - } - - /** - * Get the height field for the Chart record. - */ - public int getHeight() - { - return field_4_height; - } - - /** - * Set the height field for the Chart record. - */ - public void setHeight(int field_4_height) - { - this.field_4_height = field_4_height; - } -} diff --git a/src/java/org/apache/poi/hssf/record/ChartTitleFormatRecord.java b/src/java/org/apache/poi/hssf/record/ChartTitleFormatRecord.java deleted file mode 100644 index d24c58a7d7..0000000000 --- a/src/java/org/apache/poi/hssf/record/ChartTitleFormatRecord.java +++ /dev/null @@ -1,121 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -/* - * HSSF Chart Title Format Record Type - */ -package org.apache.poi.hssf.record; - -import org.apache.poi.util.LittleEndianOutput; - -/** - * CHARTTITLEFORMAT (0x1050)

- * Describes the formatting runs associated with a chart title. - */ -public class ChartTitleFormatRecord extends StandardRecord { - public static final short sid = 0x1050; - - private CTFormat[] _formats; - - private static final class CTFormat { - public static final int ENCODED_SIZE=4; - private int _offset; - private int _fontIndex; - - protected CTFormat(short offset,short fontIdx){ - _offset = offset; - _fontIndex = fontIdx; - } - - public CTFormat(RecordInputStream in) { - _offset = in.readShort(); - _fontIndex = in.readShort(); - } - - public int getOffset(){ - return _offset; - } - public void setOffset(int newOff){ - _offset = newOff; - } - public int getFontIndex() { - return _fontIndex; - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(_offset); - out.writeShort(_fontIndex); - } - } - - - public ChartTitleFormatRecord(RecordInputStream in) { - int nRecs = in.readUShort(); - _formats = new CTFormat[nRecs]; - - for(int i=0;i - * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class DatRecord extends StandardRecord { - public final static short sid = 0x1063; - - private static final BitField horizontalBorder = BitFieldFactory.getInstance(0x1); - private static final BitField verticalBorder = BitFieldFactory.getInstance(0x2); - private static final BitField border = BitFieldFactory.getInstance(0x4); - private static final BitField showSeriesKey = BitFieldFactory.getInstance(0x8); - - private short field_1_options; - - - public DatRecord() - { - - } - - public DatRecord(RecordInputStream in) - { - field_1_options = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[DAT]\n"); - buffer.append(" .options = ") - .append("0x").append(HexDump.toHex( getOptions ())) - .append(" (").append( getOptions() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .horizontalBorder = ").append(isHorizontalBorder()).append('\n'); - buffer.append(" .verticalBorder = ").append(isVerticalBorder()).append('\n'); - buffer.append(" .border = ").append(isBorder()).append('\n'); - buffer.append(" .showSeriesKey = ").append(isShowSeriesKey()).append('\n'); - - buffer.append("[/DAT]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_options); - } - - protected int getDataSize() { - return 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - DatRecord rec = new DatRecord(); - - rec.field_1_options = field_1_options; - return rec; - } - - - - - /** - * Get the options field for the Dat record. - */ - public short getOptions() - { - return field_1_options; - } - - /** - * Set the options field for the Dat record. - */ - public void setOptions(short field_1_options) - { - this.field_1_options = field_1_options; - } - - /** - * Sets the horizontal border field value. - * has a horizontal border - */ - public void setHorizontalBorder(boolean value) - { - field_1_options = horizontalBorder.setShortBoolean(field_1_options, value); - } - - /** - * has a horizontal border - * @return the horizontal border field value. - */ - public boolean isHorizontalBorder() - { - return horizontalBorder.isSet(field_1_options); - } - - /** - * Sets the vertical border field value. - * has vertical border - */ - public void setVerticalBorder(boolean value) - { - field_1_options = verticalBorder.setShortBoolean(field_1_options, value); - } - - /** - * has vertical border - * @return the vertical border field value. - */ - public boolean isVerticalBorder() - { - return verticalBorder.isSet(field_1_options); - } - - /** - * Sets the border field value. - * data table has a border - */ - public void setBorder(boolean value) - { - field_1_options = border.setShortBoolean(field_1_options, value); - } - - /** - * data table has a border - * @return the border field value. - */ - public boolean isBorder() - { - return border.isSet(field_1_options); - } - - /** - * Sets the show series key field value. - * shows the series key - */ - public void setShowSeriesKey(boolean value) - { - field_1_options = showSeriesKey.setShortBoolean(field_1_options, value); - } - - /** - * shows the series key - * @return the show series key field value. - */ - public boolean isShowSeriesKey() - { - return showSeriesKey.isSet(field_1_options); - } -} diff --git a/src/java/org/apache/poi/hssf/record/DataFormatRecord.java b/src/java/org/apache/poi/hssf/record/DataFormatRecord.java deleted file mode 100644 index efb2a19d77..0000000000 --- a/src/java/org/apache/poi/hssf/record/DataFormatRecord.java +++ /dev/null @@ -1,191 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The data format record is used to index into a series.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class DataFormatRecord extends StandardRecord { - public final static short sid = 0x1006; - - private static final BitField useExcel4Colors = BitFieldFactory.getInstance(0x1); - - private short field_1_pointNumber; - private short field_2_seriesIndex; - private short field_3_seriesNumber; - private short field_4_formatFlags; - - - public DataFormatRecord() - { - - } - - public DataFormatRecord(RecordInputStream in) - { - field_1_pointNumber = in.readShort(); - field_2_seriesIndex = in.readShort(); - field_3_seriesNumber = in.readShort(); - field_4_formatFlags = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[DATAFORMAT]\n"); - buffer.append(" .pointNumber = ") - .append("0x").append(HexDump.toHex( getPointNumber ())) - .append(" (").append( getPointNumber() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .seriesIndex = ") - .append("0x").append(HexDump.toHex( getSeriesIndex ())) - .append(" (").append( getSeriesIndex() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .seriesNumber = ") - .append("0x").append(HexDump.toHex( getSeriesNumber ())) - .append(" (").append( getSeriesNumber() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .formatFlags = ") - .append("0x").append(HexDump.toHex( getFormatFlags ())) - .append(" (").append( getFormatFlags() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .useExcel4Colors = ").append(isUseExcel4Colors()).append('\n'); - - buffer.append("[/DATAFORMAT]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_pointNumber); - out.writeShort(field_2_seriesIndex); - out.writeShort(field_3_seriesNumber); - out.writeShort(field_4_formatFlags); - } - - protected int getDataSize() { - return 2 + 2 + 2 + 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - DataFormatRecord rec = new DataFormatRecord(); - - rec.field_1_pointNumber = field_1_pointNumber; - rec.field_2_seriesIndex = field_2_seriesIndex; - rec.field_3_seriesNumber = field_3_seriesNumber; - rec.field_4_formatFlags = field_4_formatFlags; - return rec; - } - - - - - /** - * Get the point number field for the DataFormat record. - */ - public short getPointNumber() - { - return field_1_pointNumber; - } - - /** - * Set the point number field for the DataFormat record. - */ - public void setPointNumber(short field_1_pointNumber) - { - this.field_1_pointNumber = field_1_pointNumber; - } - - /** - * Get the series index field for the DataFormat record. - */ - public short getSeriesIndex() - { - return field_2_seriesIndex; - } - - /** - * Set the series index field for the DataFormat record. - */ - public void setSeriesIndex(short field_2_seriesIndex) - { - this.field_2_seriesIndex = field_2_seriesIndex; - } - - /** - * Get the series number field for the DataFormat record. - */ - public short getSeriesNumber() - { - return field_3_seriesNumber; - } - - /** - * Set the series number field for the DataFormat record. - */ - public void setSeriesNumber(short field_3_seriesNumber) - { - this.field_3_seriesNumber = field_3_seriesNumber; - } - - /** - * Get the format flags field for the DataFormat record. - */ - public short getFormatFlags() - { - return field_4_formatFlags; - } - - /** - * Set the format flags field for the DataFormat record. - */ - public void setFormatFlags(short field_4_formatFlags) - { - this.field_4_formatFlags = field_4_formatFlags; - } - - /** - * Sets the use excel 4 colors field value. - * set true to use excel 4 colors. - */ - public void setUseExcel4Colors(boolean value) - { - field_4_formatFlags = useExcel4Colors.setShortBoolean(field_4_formatFlags, value); - } - - /** - * set true to use excel 4 colors. - * @return the use excel 4 colors field value. - */ - public boolean isUseExcel4Colors() - { - return useExcel4Colors.isSet(field_4_formatFlags); - } -} diff --git a/src/java/org/apache/poi/hssf/record/DefaultDataLabelTextPropertiesRecord.java b/src/java/org/apache/poi/hssf/record/DefaultDataLabelTextPropertiesRecord.java deleted file mode 100644 index 35ac05e239..0000000000 --- a/src/java/org/apache/poi/hssf/record/DefaultDataLabelTextPropertiesRecord.java +++ /dev/null @@ -1,109 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The default data label text properties record identifies the text characteristics of the preceding text record.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class DefaultDataLabelTextPropertiesRecord extends StandardRecord { - public final static short sid = 0x1024; - private short field_1_categoryDataType; - public final static short CATEGORY_DATA_TYPE_SHOW_LABELS_CHARACTERISTIC = 0; - public final static short CATEGORY_DATA_TYPE_VALUE_AND_PERCENTAGE_CHARACTERISTIC = 1; - public final static short CATEGORY_DATA_TYPE_ALL_TEXT_CHARACTERISTIC = 2; - - - public DefaultDataLabelTextPropertiesRecord() - { - - } - - public DefaultDataLabelTextPropertiesRecord(RecordInputStream in) - { - field_1_categoryDataType = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[DEFAULTTEXT]\n"); - buffer.append(" .categoryDataType = ") - .append("0x").append(HexDump.toHex( getCategoryDataType ())) - .append(" (").append( getCategoryDataType() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/DEFAULTTEXT]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_categoryDataType); - } - - protected int getDataSize() { - return 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - DefaultDataLabelTextPropertiesRecord rec = new DefaultDataLabelTextPropertiesRecord(); - - rec.field_1_categoryDataType = field_1_categoryDataType; - return rec; - } - - - - - /** - * Get the category data type field for the DefaultDataLabelTextProperties record. - * - * @return One of - * CATEGORY_DATA_TYPE_SHOW_LABELS_CHARACTERISTIC - * CATEGORY_DATA_TYPE_VALUE_AND_PERCENTAGE_CHARACTERISTIC - * CATEGORY_DATA_TYPE_ALL_TEXT_CHARACTERISTIC - */ - public short getCategoryDataType() - { - return field_1_categoryDataType; - } - - /** - * Set the category data type field for the DefaultDataLabelTextProperties record. - * - * @param field_1_categoryDataType - * One of - * CATEGORY_DATA_TYPE_SHOW_LABELS_CHARACTERISTIC - * CATEGORY_DATA_TYPE_VALUE_AND_PERCENTAGE_CHARACTERISTIC - * CATEGORY_DATA_TYPE_ALL_TEXT_CHARACTERISTIC - */ - public void setCategoryDataType(short field_1_categoryDataType) - { - this.field_1_categoryDataType = field_1_categoryDataType; - } -} diff --git a/src/java/org/apache/poi/hssf/record/EndRecord.java b/src/java/org/apache/poi/hssf/record/EndRecord.java deleted file mode 100644 index 1731a49374..0000000000 --- a/src/java/org/apache/poi/hssf/record/EndRecord.java +++ /dev/null @@ -1,65 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.LittleEndianOutput; - -/** - * The end record defines the end of a block of records for a (Graphing) - * data object. This record is matched with a corresponding BeginRecord. - * - * @see BeginRecord - * - * @author Glen Stampoultzis (glens at apache.org) - */ - -public final class EndRecord extends StandardRecord { - public static final short sid = 0x1034; - - public EndRecord() - { - } - - /** - * @param in unused (since this record has no data) - */ - public EndRecord(RecordInputStream in) - { - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[END]\n"); - buffer.append("[/END]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - } - - protected int getDataSize() { - return 0; - } - - public short getSid() - { - return sid; - } -} diff --git a/src/java/org/apache/poi/hssf/record/FontBasisRecord.java b/src/java/org/apache/poi/hssf/record/FontBasisRecord.java deleted file mode 100644 index 5825ec824c..0000000000 --- a/src/java/org/apache/poi/hssf/record/FontBasisRecord.java +++ /dev/null @@ -1,191 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The font basis record stores various font metrics.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class FontBasisRecord extends StandardRecord { - public final static short sid = 0x1060; - private short field_1_xBasis; - private short field_2_yBasis; - private short field_3_heightBasis; - private short field_4_scale; - private short field_5_indexToFontTable; - - - public FontBasisRecord() - { - - } - - public FontBasisRecord(RecordInputStream in) - { - field_1_xBasis = in.readShort(); - field_2_yBasis = in.readShort(); - field_3_heightBasis = in.readShort(); - field_4_scale = in.readShort(); - field_5_indexToFontTable = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[FBI]\n"); - buffer.append(" .xBasis = ") - .append("0x").append(HexDump.toHex( getXBasis ())) - .append(" (").append( getXBasis() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .yBasis = ") - .append("0x").append(HexDump.toHex( getYBasis ())) - .append(" (").append( getYBasis() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .heightBasis = ") - .append("0x").append(HexDump.toHex( getHeightBasis ())) - .append(" (").append( getHeightBasis() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .scale = ") - .append("0x").append(HexDump.toHex( getScale ())) - .append(" (").append( getScale() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .indexToFontTable = ") - .append("0x").append(HexDump.toHex( getIndexToFontTable ())) - .append(" (").append( getIndexToFontTable() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/FBI]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_xBasis); - out.writeShort(field_2_yBasis); - out.writeShort(field_3_heightBasis); - out.writeShort(field_4_scale); - out.writeShort(field_5_indexToFontTable); - } - - protected int getDataSize() { - return 2 + 2 + 2 + 2 + 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - FontBasisRecord rec = new FontBasisRecord(); - - rec.field_1_xBasis = field_1_xBasis; - rec.field_2_yBasis = field_2_yBasis; - rec.field_3_heightBasis = field_3_heightBasis; - rec.field_4_scale = field_4_scale; - rec.field_5_indexToFontTable = field_5_indexToFontTable; - return rec; - } - - - - - /** - * Get the x Basis field for the FontBasis record. - */ - public short getXBasis() - { - return field_1_xBasis; - } - - /** - * Set the x Basis field for the FontBasis record. - */ - public void setXBasis(short field_1_xBasis) - { - this.field_1_xBasis = field_1_xBasis; - } - - /** - * Get the y Basis field for the FontBasis record. - */ - public short getYBasis() - { - return field_2_yBasis; - } - - /** - * Set the y Basis field for the FontBasis record. - */ - public void setYBasis(short field_2_yBasis) - { - this.field_2_yBasis = field_2_yBasis; - } - - /** - * Get the height basis field for the FontBasis record. - */ - public short getHeightBasis() - { - return field_3_heightBasis; - } - - /** - * Set the height basis field for the FontBasis record. - */ - public void setHeightBasis(short field_3_heightBasis) - { - this.field_3_heightBasis = field_3_heightBasis; - } - - /** - * Get the scale field for the FontBasis record. - */ - public short getScale() - { - return field_4_scale; - } - - /** - * Set the scale field for the FontBasis record. - */ - public void setScale(short field_4_scale) - { - this.field_4_scale = field_4_scale; - } - - /** - * Get the index to font table field for the FontBasis record. - */ - public short getIndexToFontTable() - { - return field_5_indexToFontTable; - } - - /** - * Set the index to font table field for the FontBasis record. - */ - public void setIndexToFontTable(short field_5_indexToFontTable) - { - this.field_5_indexToFontTable = field_5_indexToFontTable; - } -} diff --git a/src/java/org/apache/poi/hssf/record/FontIndexRecord.java b/src/java/org/apache/poi/hssf/record/FontIndexRecord.java deleted file mode 100644 index 1b312b1dfb..0000000000 --- a/src/java/org/apache/poi/hssf/record/FontIndexRecord.java +++ /dev/null @@ -1,95 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The font index record indexes into the font table for the text record.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class FontIndexRecord extends StandardRecord { - public final static short sid = 0x1026; - private short field_1_fontIndex; - - - public FontIndexRecord() - { - - } - - public FontIndexRecord(RecordInputStream in) - { - field_1_fontIndex = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[FONTX]\n"); - buffer.append(" .fontIndex = ") - .append("0x").append(HexDump.toHex( getFontIndex ())) - .append(" (").append( getFontIndex() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/FONTX]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_fontIndex); - } - - protected int getDataSize() { - return 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - FontIndexRecord rec = new FontIndexRecord(); - - rec.field_1_fontIndex = field_1_fontIndex; - return rec; - } - - - - - /** - * Get the font index field for the FontIndex record. - */ - public short getFontIndex() - { - return field_1_fontIndex; - } - - /** - * Set the font index field for the FontIndex record. - */ - public void setFontIndex(short field_1_fontIndex) - { - this.field_1_fontIndex = field_1_fontIndex; - } -} diff --git a/src/java/org/apache/poi/hssf/record/FrameRecord.java b/src/java/org/apache/poi/hssf/record/FrameRecord.java deleted file mode 100644 index 6e9dcf0402..0000000000 --- a/src/java/org/apache/poi/hssf/record/FrameRecord.java +++ /dev/null @@ -1,174 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The frame record indicates whether there is a border around the displayed text of a chart.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class FrameRecord extends StandardRecord { - public final static short sid = 0x1032; - - private static final BitField autoSize = BitFieldFactory.getInstance(0x1); - private static final BitField autoPosition = BitFieldFactory.getInstance(0x2); - - private short field_1_borderType; - public final static short BORDER_TYPE_REGULAR = 0; - public final static short BORDER_TYPE_SHADOW = 1; - private short field_2_options; - - - public FrameRecord() - { - - } - - public FrameRecord(RecordInputStream in) - { - field_1_borderType = in.readShort(); - field_2_options = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[FRAME]\n"); - buffer.append(" .borderType = ") - .append("0x").append(HexDump.toHex( getBorderType ())) - .append(" (").append( getBorderType() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .options = ") - .append("0x").append(HexDump.toHex( getOptions ())) - .append(" (").append( getOptions() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .autoSize = ").append(isAutoSize()).append('\n'); - buffer.append(" .autoPosition = ").append(isAutoPosition()).append('\n'); - - buffer.append("[/FRAME]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_borderType); - out.writeShort(field_2_options); - } - - protected int getDataSize() { - return 2 + 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - FrameRecord rec = new FrameRecord(); - - rec.field_1_borderType = field_1_borderType; - rec.field_2_options = field_2_options; - return rec; - } - - - - - /** - * Get the border type field for the Frame record. - * - * @return One of - * BORDER_TYPE_REGULAR - * BORDER_TYPE_SHADOW - */ - public short getBorderType() - { - return field_1_borderType; - } - - /** - * Set the border type field for the Frame record. - * - * @param field_1_borderType - * One of - * BORDER_TYPE_REGULAR - * BORDER_TYPE_SHADOW - */ - public void setBorderType(short field_1_borderType) - { - this.field_1_borderType = field_1_borderType; - } - - /** - * Get the options field for the Frame record. - */ - public short getOptions() - { - return field_2_options; - } - - /** - * Set the options field for the Frame record. - */ - public void setOptions(short field_2_options) - { - this.field_2_options = field_2_options; - } - - /** - * Sets the auto size field value. - * excel calculates the size automatically if true - */ - public void setAutoSize(boolean value) - { - field_2_options = autoSize.setShortBoolean(field_2_options, value); - } - - /** - * excel calculates the size automatically if true - * @return the auto size field value. - */ - public boolean isAutoSize() - { - return autoSize.isSet(field_2_options); - } - - /** - * Sets the auto position field value. - * excel calculates the position automatically - */ - public void setAutoPosition(boolean value) - { - field_2_options = autoPosition.setShortBoolean(field_2_options, value); - } - - /** - * excel calculates the position automatically - * @return the auto position field value. - */ - public boolean isAutoPosition() - { - return autoPosition.isSet(field_2_options); - } -} \ No newline at end of file diff --git a/src/java/org/apache/poi/hssf/record/LegendRecord.java b/src/java/org/apache/poi/hssf/record/LegendRecord.java deleted file mode 100644 index a98c16b56b..0000000000 --- a/src/java/org/apache/poi/hssf/record/LegendRecord.java +++ /dev/null @@ -1,400 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * Defines a legend for a chart.

- * - * @author Andrew C. Oliver (acoliver at apache.org) - */ -public final class LegendRecord extends StandardRecord { - public final static short sid = 0x1015; - - private static final BitField autoPosition = BitFieldFactory.getInstance(0x01); - private static final BitField autoSeries = BitFieldFactory.getInstance(0x02); - private static final BitField autoXPositioning = BitFieldFactory.getInstance(0x04); - private static final BitField autoYPositioning = BitFieldFactory.getInstance(0x08); - private static final BitField vertical = BitFieldFactory.getInstance(0x10); - private static final BitField dataTable = BitFieldFactory.getInstance(0x20); - - private int field_1_xAxisUpperLeft; - private int field_2_yAxisUpperLeft; - private int field_3_xSize; - private int field_4_ySize; - private byte field_5_type; - public final static byte TYPE_BOTTOM = 0; - public final static byte TYPE_CORNER = 1; - public final static byte TYPE_TOP = 2; - public final static byte TYPE_RIGHT = 3; - public final static byte TYPE_LEFT = 4; - public final static byte TYPE_UNDOCKED = 7; - private byte field_6_spacing; - public final static byte SPACING_CLOSE = 0; - public final static byte SPACING_MEDIUM = 1; - public final static byte SPACING_OPEN = 2; - private short field_7_options; - - - public LegendRecord() - { - - } - - public LegendRecord(RecordInputStream in) - { - field_1_xAxisUpperLeft = in.readInt(); - field_2_yAxisUpperLeft = in.readInt(); - field_3_xSize = in.readInt(); - field_4_ySize = in.readInt(); - field_5_type = in.readByte(); - field_6_spacing = in.readByte(); - field_7_options = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[LEGEND]\n"); - buffer.append(" .xAxisUpperLeft = ") - .append("0x").append(HexDump.toHex( getXAxisUpperLeft ())) - .append(" (").append( getXAxisUpperLeft() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .yAxisUpperLeft = ") - .append("0x").append(HexDump.toHex( getYAxisUpperLeft ())) - .append(" (").append( getYAxisUpperLeft() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .xSize = ") - .append("0x").append(HexDump.toHex( getXSize ())) - .append(" (").append( getXSize() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .ySize = ") - .append("0x").append(HexDump.toHex( getYSize ())) - .append(" (").append( getYSize() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .type = ") - .append("0x").append(HexDump.toHex( getType ())) - .append(" (").append( getType() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .spacing = ") - .append("0x").append(HexDump.toHex( getSpacing ())) - .append(" (").append( getSpacing() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .options = ") - .append("0x").append(HexDump.toHex( getOptions ())) - .append(" (").append( getOptions() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .autoPosition = ").append(isAutoPosition()).append('\n'); - buffer.append(" .autoSeries = ").append(isAutoSeries()).append('\n'); - buffer.append(" .autoXPositioning = ").append(isAutoXPositioning()).append('\n'); - buffer.append(" .autoYPositioning = ").append(isAutoYPositioning()).append('\n'); - buffer.append(" .vertical = ").append(isVertical()).append('\n'); - buffer.append(" .dataTable = ").append(isDataTable()).append('\n'); - - buffer.append("[/LEGEND]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeInt(field_1_xAxisUpperLeft); - out.writeInt(field_2_yAxisUpperLeft); - out.writeInt(field_3_xSize); - out.writeInt(field_4_ySize); - out.writeByte(field_5_type); - out.writeByte(field_6_spacing); - out.writeShort(field_7_options); - } - - protected int getDataSize() { - return 4 + 4 + 4 + 4 + 1 + 1 + 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - LegendRecord rec = new LegendRecord(); - - rec.field_1_xAxisUpperLeft = field_1_xAxisUpperLeft; - rec.field_2_yAxisUpperLeft = field_2_yAxisUpperLeft; - rec.field_3_xSize = field_3_xSize; - rec.field_4_ySize = field_4_ySize; - rec.field_5_type = field_5_type; - rec.field_6_spacing = field_6_spacing; - rec.field_7_options = field_7_options; - return rec; - } - - - - - /** - * Get the x axis upper left field for the Legend record. - */ - public int getXAxisUpperLeft() - { - return field_1_xAxisUpperLeft; - } - - /** - * Set the x axis upper left field for the Legend record. - */ - public void setXAxisUpperLeft(int field_1_xAxisUpperLeft) - { - this.field_1_xAxisUpperLeft = field_1_xAxisUpperLeft; - } - - /** - * Get the y axis upper left field for the Legend record. - */ - public int getYAxisUpperLeft() - { - return field_2_yAxisUpperLeft; - } - - /** - * Set the y axis upper left field for the Legend record. - */ - public void setYAxisUpperLeft(int field_2_yAxisUpperLeft) - { - this.field_2_yAxisUpperLeft = field_2_yAxisUpperLeft; - } - - /** - * Get the x size field for the Legend record. - */ - public int getXSize() - { - return field_3_xSize; - } - - /** - * Set the x size field for the Legend record. - */ - public void setXSize(int field_3_xSize) - { - this.field_3_xSize = field_3_xSize; - } - - /** - * Get the y size field for the Legend record. - */ - public int getYSize() - { - return field_4_ySize; - } - - /** - * Set the y size field for the Legend record. - */ - public void setYSize(int field_4_ySize) - { - this.field_4_ySize = field_4_ySize; - } - - /** - * Get the type field for the Legend record. - * - * @return One of - * TYPE_BOTTOM - * TYPE_CORNER - * TYPE_TOP - * TYPE_RIGHT - * TYPE_LEFT - * TYPE_UNDOCKED - */ - public byte getType() - { - return field_5_type; - } - - /** - * Set the type field for the Legend record. - * - * @param field_5_type - * One of - * TYPE_BOTTOM - * TYPE_CORNER - * TYPE_TOP - * TYPE_RIGHT - * TYPE_LEFT - * TYPE_UNDOCKED - */ - public void setType(byte field_5_type) - { - this.field_5_type = field_5_type; - } - - /** - * Get the spacing field for the Legend record. - * - * @return One of - * SPACING_CLOSE - * SPACING_MEDIUM - * SPACING_OPEN - */ - public byte getSpacing() - { - return field_6_spacing; - } - - /** - * Set the spacing field for the Legend record. - * - * @param field_6_spacing - * One of - * SPACING_CLOSE - * SPACING_MEDIUM - * SPACING_OPEN - */ - public void setSpacing(byte field_6_spacing) - { - this.field_6_spacing = field_6_spacing; - } - - /** - * Get the options field for the Legend record. - */ - public short getOptions() - { - return field_7_options; - } - - /** - * Set the options field for the Legend record. - */ - public void setOptions(short field_7_options) - { - this.field_7_options = field_7_options; - } - - /** - * Sets the auto position field value. - * automatic positioning (1=docked) - */ - public void setAutoPosition(boolean value) - { - field_7_options = autoPosition.setShortBoolean(field_7_options, value); - } - - /** - * automatic positioning (1=docked) - * @return the auto position field value. - */ - public boolean isAutoPosition() - { - return autoPosition.isSet(field_7_options); - } - - /** - * Sets the auto series field value. - * excel 5 only (true) - */ - public void setAutoSeries(boolean value) - { - field_7_options = autoSeries.setShortBoolean(field_7_options, value); - } - - /** - * excel 5 only (true) - * @return the auto series field value. - */ - public boolean isAutoSeries() - { - return autoSeries.isSet(field_7_options); - } - - /** - * Sets the auto x positioning field value. - * position of legend on the x axis is automatic - */ - public void setAutoXPositioning(boolean value) - { - field_7_options = autoXPositioning.setShortBoolean(field_7_options, value); - } - - /** - * position of legend on the x axis is automatic - * @return the auto x positioning field value. - */ - public boolean isAutoXPositioning() - { - return autoXPositioning.isSet(field_7_options); - } - - /** - * Sets the auto y positioning field value. - * position of legend on the y axis is automatic - */ - public void setAutoYPositioning(boolean value) - { - field_7_options = autoYPositioning.setShortBoolean(field_7_options, value); - } - - /** - * position of legend on the y axis is automatic - * @return the auto y positioning field value. - */ - public boolean isAutoYPositioning() - { - return autoYPositioning.isSet(field_7_options); - } - - /** - * Sets the vertical field value. - * vertical or horizontal legend (1 or 0 respectively). Always 0 if not automatic. - */ - public void setVertical(boolean value) - { - field_7_options = vertical.setShortBoolean(field_7_options, value); - } - - /** - * vertical or horizontal legend (1 or 0 respectively). Always 0 if not automatic. - * @return the vertical field value. - */ - public boolean isVertical() - { - return vertical.isSet(field_7_options); - } - - /** - * Sets the data table field value. - * 1 if chart contains data table - */ - public void setDataTable(boolean value) - { - field_7_options = dataTable.setShortBoolean(field_7_options, value); - } - - /** - * 1 if chart contains data table - * @return the data table field value. - */ - public boolean isDataTable() - { - return dataTable.isSet(field_7_options); - } -} diff --git a/src/java/org/apache/poi/hssf/record/LineFormatRecord.java b/src/java/org/apache/poi/hssf/record/LineFormatRecord.java deleted file mode 100644 index 7e84e0ca53..0000000000 --- a/src/java/org/apache/poi/hssf/record/LineFormatRecord.java +++ /dev/null @@ -1,305 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * Describes a line format record. The line format record controls how a line on a chart appears.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class LineFormatRecord extends StandardRecord { - public final static short sid = 0x1007; - - private static final BitField auto = BitFieldFactory.getInstance(0x1); - private static final BitField drawTicks = BitFieldFactory.getInstance(0x4); - private static final BitField unknown = BitFieldFactory.getInstance(0x4); - - private int field_1_lineColor; - private short field_2_linePattern; - public final static short LINE_PATTERN_SOLID = 0; - public final static short LINE_PATTERN_DASH = 1; - public final static short LINE_PATTERN_DOT = 2; - public final static short LINE_PATTERN_DASH_DOT = 3; - public final static short LINE_PATTERN_DASH_DOT_DOT = 4; - public final static short LINE_PATTERN_NONE = 5; - public final static short LINE_PATTERN_DARK_GRAY_PATTERN = 6; - public final static short LINE_PATTERN_MEDIUM_GRAY_PATTERN = 7; - public final static short LINE_PATTERN_LIGHT_GRAY_PATTERN = 8; - private short field_3_weight; - public final static short WEIGHT_HAIRLINE = -1; - public final static short WEIGHT_NARROW = 0; - public final static short WEIGHT_MEDIUM = 1; - public final static short WEIGHT_WIDE = 2; - private short field_4_format; - private short field_5_colourPaletteIndex; - - - public LineFormatRecord() - { - - } - - public LineFormatRecord(RecordInputStream in) - { - field_1_lineColor = in.readInt(); - field_2_linePattern = in.readShort(); - field_3_weight = in.readShort(); - field_4_format = in.readShort(); - field_5_colourPaletteIndex = in.readShort(); - - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[LINEFORMAT]\n"); - buffer.append(" .lineColor = ") - .append("0x").append(HexDump.toHex( getLineColor ())) - .append(" (").append( getLineColor() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .linePattern = ") - .append("0x").append(HexDump.toHex( getLinePattern ())) - .append(" (").append( getLinePattern() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .weight = ") - .append("0x").append(HexDump.toHex( getWeight ())) - .append(" (").append( getWeight() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .format = ") - .append("0x").append(HexDump.toHex( getFormat ())) - .append(" (").append( getFormat() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .auto = ").append(isAuto()).append('\n'); - buffer.append(" .drawTicks = ").append(isDrawTicks()).append('\n'); - buffer.append(" .unknown = ").append(isUnknown()).append('\n'); - buffer.append(" .colourPaletteIndex = ") - .append("0x").append(HexDump.toHex( getColourPaletteIndex ())) - .append(" (").append( getColourPaletteIndex() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/LINEFORMAT]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeInt(field_1_lineColor); - out.writeShort(field_2_linePattern); - out.writeShort(field_3_weight); - out.writeShort(field_4_format); - out.writeShort(field_5_colourPaletteIndex); - } - - protected int getDataSize() { - return 4 + 2 + 2 + 2 + 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - LineFormatRecord rec = new LineFormatRecord(); - - rec.field_1_lineColor = field_1_lineColor; - rec.field_2_linePattern = field_2_linePattern; - rec.field_3_weight = field_3_weight; - rec.field_4_format = field_4_format; - rec.field_5_colourPaletteIndex = field_5_colourPaletteIndex; - return rec; - } - - - - - /** - * Get the line color field for the LineFormat record. - */ - public int getLineColor() - { - return field_1_lineColor; - } - - /** - * Set the line color field for the LineFormat record. - */ - public void setLineColor(int field_1_lineColor) - { - this.field_1_lineColor = field_1_lineColor; - } - - /** - * Get the line pattern field for the LineFormat record. - * - * @return One of - * LINE_PATTERN_SOLID - * LINE_PATTERN_DASH - * LINE_PATTERN_DOT - * LINE_PATTERN_DASH_DOT - * LINE_PATTERN_DASH_DOT_DOT - * LINE_PATTERN_NONE - * LINE_PATTERN_DARK_GRAY_PATTERN - * LINE_PATTERN_MEDIUM_GRAY_PATTERN - * LINE_PATTERN_LIGHT_GRAY_PATTERN - */ - public short getLinePattern() - { - return field_2_linePattern; - } - - /** - * Set the line pattern field for the LineFormat record. - * - * @param field_2_linePattern - * One of - * LINE_PATTERN_SOLID - * LINE_PATTERN_DASH - * LINE_PATTERN_DOT - * LINE_PATTERN_DASH_DOT - * LINE_PATTERN_DASH_DOT_DOT - * LINE_PATTERN_NONE - * LINE_PATTERN_DARK_GRAY_PATTERN - * LINE_PATTERN_MEDIUM_GRAY_PATTERN - * LINE_PATTERN_LIGHT_GRAY_PATTERN - */ - public void setLinePattern(short field_2_linePattern) - { - this.field_2_linePattern = field_2_linePattern; - } - - /** - * Get the weight field for the LineFormat record. - * - * @return One of - * WEIGHT_HAIRLINE - * WEIGHT_NARROW - * WEIGHT_MEDIUM - * WEIGHT_WIDE - */ - public short getWeight() - { - return field_3_weight; - } - - /** - * Set the weight field for the LineFormat record. - * - * @param field_3_weight - * One of - * WEIGHT_HAIRLINE - * WEIGHT_NARROW - * WEIGHT_MEDIUM - * WEIGHT_WIDE - */ - public void setWeight(short field_3_weight) - { - this.field_3_weight = field_3_weight; - } - - /** - * Get the format field for the LineFormat record. - */ - public short getFormat() - { - return field_4_format; - } - - /** - * Set the format field for the LineFormat record. - */ - public void setFormat(short field_4_format) - { - this.field_4_format = field_4_format; - } - - /** - * Get the colour palette index field for the LineFormat record. - */ - public short getColourPaletteIndex() - { - return field_5_colourPaletteIndex; - } - - /** - * Set the colour palette index field for the LineFormat record. - */ - public void setColourPaletteIndex(short field_5_colourPaletteIndex) - { - this.field_5_colourPaletteIndex = field_5_colourPaletteIndex; - } - - /** - * Sets the auto field value. - * automatic format - */ - public void setAuto(boolean value) - { - field_4_format = auto.setShortBoolean(field_4_format, value); - } - - /** - * automatic format - * @return the auto field value. - */ - public boolean isAuto() - { - return auto.isSet(field_4_format); - } - - /** - * Sets the draw ticks field value. - * draw tick marks - */ - public void setDrawTicks(boolean value) - { - field_4_format = drawTicks.setShortBoolean(field_4_format, value); - } - - /** - * draw tick marks - * @return the draw ticks field value. - */ - public boolean isDrawTicks() - { - return drawTicks.isSet(field_4_format); - } - - /** - * Sets the unknown field value. - * book marks this as reserved = 0 but it seems to do something - */ - public void setUnknown(boolean value) - { - field_4_format = unknown.setShortBoolean(field_4_format, value); - } - - /** - * book marks this as reserved = 0 but it seems to do something - * @return the unknown field value. - */ - public boolean isUnknown() - { - return unknown.isSet(field_4_format); - } -} diff --git a/src/java/org/apache/poi/hssf/record/LinkedDataRecord.java b/src/java/org/apache/poi/hssf/record/LinkedDataRecord.java deleted file mode 100644 index 75b6caab55..0000000000 --- a/src/java/org/apache/poi/hssf/record/LinkedDataRecord.java +++ /dev/null @@ -1,249 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.hssf.record.formula.Ptg; -import org.apache.poi.ss.formula.Formula; -import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * Describes a linked data record. This record refers to the series data or text.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class LinkedDataRecord extends StandardRecord { - public final static short sid = 0x1051; - - private static final BitField customNumberFormat= BitFieldFactory.getInstance(0x1); - - private byte field_1_linkType; - public final static byte LINK_TYPE_TITLE_OR_TEXT = 0; - public final static byte LINK_TYPE_VALUES = 1; - public final static byte LINK_TYPE_CATEGORIES = 2; - private byte field_2_referenceType; - public final static byte REFERENCE_TYPE_DEFAULT_CATEGORIES = 0; - public final static byte REFERENCE_TYPE_DIRECT = 1; - public final static byte REFERENCE_TYPE_WORKSHEET = 2; - public final static byte REFERENCE_TYPE_NOT_USED = 3; - public final static byte REFERENCE_TYPE_ERROR_REPORTED = 4; - private short field_3_options; - private short field_4_indexNumberFmtRecord; - private Formula field_5_formulaOfLink; - - - public LinkedDataRecord() - { - - } - - public LinkedDataRecord(RecordInputStream in) - { - field_1_linkType = in.readByte(); - field_2_referenceType = in.readByte(); - field_3_options = in.readShort(); - field_4_indexNumberFmtRecord = in.readShort(); - int encodedTokenLen = in.readUShort(); - field_5_formulaOfLink = Formula.read(encodedTokenLen, in); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[AI]\n"); - buffer.append(" .linkType = ") - .append("0x").append(HexDump.toHex( getLinkType ())) - .append(" (").append( getLinkType() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .referenceType = ") - .append("0x").append(HexDump.toHex( getReferenceType ())) - .append(" (").append( getReferenceType() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .options = ") - .append("0x").append(HexDump.toHex( getOptions ())) - .append(" (").append( getOptions() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .customNumberFormat = ").append(isCustomNumberFormat()).append('\n'); - buffer.append(" .indexNumberFmtRecord = ") - .append("0x").append(HexDump.toHex( getIndexNumberFmtRecord ())) - .append(" (").append( getIndexNumberFmtRecord() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .formulaOfLink = ") - .append(" (").append( getFormulaOfLink() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/AI]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeByte(field_1_linkType); - out.writeByte(field_2_referenceType); - out.writeShort(field_3_options); - out.writeShort(field_4_indexNumberFmtRecord); - field_5_formulaOfLink.serialize(out); - } - - protected int getDataSize() { - return 1 + 1 + 2 + 2 + field_5_formulaOfLink.getEncodedSize(); - } - - public short getSid() { - return sid; - } - - public Object clone() { - LinkedDataRecord rec = new LinkedDataRecord(); - - rec.field_1_linkType = field_1_linkType; - rec.field_2_referenceType = field_2_referenceType; - rec.field_3_options = field_3_options; - rec.field_4_indexNumberFmtRecord = field_4_indexNumberFmtRecord; - rec.field_5_formulaOfLink = field_5_formulaOfLink.copy(); - return rec; - } - - - - - /** - * Get the link type field for the LinkedData record. - * - * @return One of - * LINK_TYPE_TITLE_OR_TEXT - * LINK_TYPE_VALUES - * LINK_TYPE_CATEGORIES - */ - public byte getLinkType() - { - return field_1_linkType; - } - - /** - * Set the link type field for the LinkedData record. - * - * @param field_1_linkType - * One of - * LINK_TYPE_TITLE_OR_TEXT - * LINK_TYPE_VALUES - * LINK_TYPE_CATEGORIES - */ - public void setLinkType(byte field_1_linkType) - { - this.field_1_linkType = field_1_linkType; - } - - /** - * Get the reference type field for the LinkedData record. - * - * @return One of - * REFERENCE_TYPE_DEFAULT_CATEGORIES - * REFERENCE_TYPE_DIRECT - * REFERENCE_TYPE_WORKSHEET - * REFERENCE_TYPE_NOT_USED - * REFERENCE_TYPE_ERROR_REPORTED - */ - public byte getReferenceType() - { - return field_2_referenceType; - } - - /** - * Set the reference type field for the LinkedData record. - * - * @param field_2_referenceType - * One of - * REFERENCE_TYPE_DEFAULT_CATEGORIES - * REFERENCE_TYPE_DIRECT - * REFERENCE_TYPE_WORKSHEET - * REFERENCE_TYPE_NOT_USED - * REFERENCE_TYPE_ERROR_REPORTED - */ - public void setReferenceType(byte field_2_referenceType) - { - this.field_2_referenceType = field_2_referenceType; - } - - /** - * Get the options field for the LinkedData record. - */ - public short getOptions() - { - return field_3_options; - } - - /** - * Set the options field for the LinkedData record. - */ - public void setOptions(short field_3_options) - { - this.field_3_options = field_3_options; - } - - /** - * Get the index number fmt record field for the LinkedData record. - */ - public short getIndexNumberFmtRecord() - { - return field_4_indexNumberFmtRecord; - } - - /** - * Set the index number fmt record field for the LinkedData record. - */ - public void setIndexNumberFmtRecord(short field_4_indexNumberFmtRecord) - { - this.field_4_indexNumberFmtRecord = field_4_indexNumberFmtRecord; - } - - /** - * Get the formula of link field for the LinkedData record. - */ - public Ptg[] getFormulaOfLink() { - return field_5_formulaOfLink.getTokens(); - } - - /** - * Set the formula of link field for the LinkedData record. - */ - public void setFormulaOfLink(Ptg[] ptgs) - { - this.field_5_formulaOfLink = Formula.create(ptgs); - } - - /** - * Sets the custom number format field value. - * true if this object has a custom number format - */ - public void setCustomNumberFormat(boolean value) - { - field_3_options = customNumberFormat.setShortBoolean(field_3_options, value); - } - - /** - * true if this object has a custom number format - * @return the custom number format field value. - */ - public boolean isCustomNumberFormat() - { - return customNumberFormat.isSet(field_3_options); - } -} diff --git a/src/java/org/apache/poi/hssf/record/NumberFormatIndexRecord.java b/src/java/org/apache/poi/hssf/record/NumberFormatIndexRecord.java deleted file mode 100644 index af8b191d32..0000000000 --- a/src/java/org/apache/poi/hssf/record/NumberFormatIndexRecord.java +++ /dev/null @@ -1,95 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The number format index record indexes format table. This applies to an axis.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class NumberFormatIndexRecord extends StandardRecord { - public final static short sid = 0x104E; - private short field_1_formatIndex; - - - public NumberFormatIndexRecord() - { - - } - - public NumberFormatIndexRecord(RecordInputStream in) - { - field_1_formatIndex = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[IFMT]\n"); - buffer.append(" .formatIndex = ") - .append("0x").append(HexDump.toHex( getFormatIndex ())) - .append(" (").append( getFormatIndex() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/IFMT]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_formatIndex); - } - - protected int getDataSize() { - return 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - NumberFormatIndexRecord rec = new NumberFormatIndexRecord(); - - rec.field_1_formatIndex = field_1_formatIndex; - return rec; - } - - - - - /** - * Get the format index field for the NumberFormatIndex record. - */ - public short getFormatIndex() - { - return field_1_formatIndex; - } - - /** - * Set the format index field for the NumberFormatIndex record. - */ - public void setFormatIndex(short field_1_formatIndex) - { - this.field_1_formatIndex = field_1_formatIndex; - } -} diff --git a/src/java/org/apache/poi/hssf/record/ObjectLinkRecord.java b/src/java/org/apache/poi/hssf/record/ObjectLinkRecord.java deleted file mode 100644 index 0e81c75ecf..0000000000 --- a/src/java/org/apache/poi/hssf/record/ObjectLinkRecord.java +++ /dev/null @@ -1,164 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * Links text to an object on the chart or identifies it as the title.

- * - * @author Andrew C. Oliver (acoliver at apache.org) - */ -public final class ObjectLinkRecord extends StandardRecord { - public final static short sid = 0x1027; - private short field_1_anchorId; - public final static short ANCHOR_ID_CHART_TITLE = 1; - public final static short ANCHOR_ID_Y_AXIS = 2; - public final static short ANCHOR_ID_X_AXIS = 3; - public final static short ANCHOR_ID_SERIES_OR_POINT = 4; - public final static short ANCHOR_ID_Z_AXIS = 7; - private short field_2_link1; - private short field_3_link2; - - - public ObjectLinkRecord() - { - - } - - public ObjectLinkRecord(RecordInputStream in) - { - field_1_anchorId = in.readShort(); - field_2_link1 = in.readShort(); - field_3_link2 = in.readShort(); - - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[OBJECTLINK]\n"); - buffer.append(" .anchorId = ") - .append("0x").append(HexDump.toHex( getAnchorId ())) - .append(" (").append( getAnchorId() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .link1 = ") - .append("0x").append(HexDump.toHex( getLink1 ())) - .append(" (").append( getLink1() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .link2 = ") - .append("0x").append(HexDump.toHex( getLink2 ())) - .append(" (").append( getLink2() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/OBJECTLINK]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_anchorId); - out.writeShort(field_2_link1); - out.writeShort(field_3_link2); - } - - protected int getDataSize() { - return 2 + 2 + 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - ObjectLinkRecord rec = new ObjectLinkRecord(); - - rec.field_1_anchorId = field_1_anchorId; - rec.field_2_link1 = field_2_link1; - rec.field_3_link2 = field_3_link2; - return rec; - } - - - - - /** - * Get the anchor id field for the ObjectLink record. - * - * @return One of - * ANCHOR_ID_CHART_TITLE - * ANCHOR_ID_Y_AXIS - * ANCHOR_ID_X_AXIS - * ANCHOR_ID_SERIES_OR_POINT - * ANCHOR_ID_Z_AXIS - */ - public short getAnchorId() - { - return field_1_anchorId; - } - - /** - * Set the anchor id field for the ObjectLink record. - * - * @param field_1_anchorId - * One of - * ANCHOR_ID_CHART_TITLE - * ANCHOR_ID_Y_AXIS - * ANCHOR_ID_X_AXIS - * ANCHOR_ID_SERIES_OR_POINT - * ANCHOR_ID_Z_AXIS - */ - public void setAnchorId(short field_1_anchorId) - { - this.field_1_anchorId = field_1_anchorId; - } - - /** - * Get the link 1 field for the ObjectLink record. - */ - public short getLink1() - { - return field_2_link1; - } - - /** - * Set the link 1 field for the ObjectLink record. - */ - public void setLink1(short field_2_link1) - { - this.field_2_link1 = field_2_link1; - } - - /** - * Get the link 2 field for the ObjectLink record. - */ - public short getLink2() - { - return field_3_link2; - } - - /** - * Set the link 2 field for the ObjectLink record. - */ - public void setLink2(short field_3_link2) - { - this.field_3_link2 = field_3_link2; - } -} diff --git a/src/java/org/apache/poi/hssf/record/PlotAreaRecord.java b/src/java/org/apache/poi/hssf/record/PlotAreaRecord.java deleted file mode 100644 index aa382bc4bb..0000000000 --- a/src/java/org/apache/poi/hssf/record/PlotAreaRecord.java +++ /dev/null @@ -1,71 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.LittleEndianOutput; - -/** - * preceeds and identifies a frame as belonging to the plot area.

- * - * @author Andrew C. Oliver (acoliver at apache.org) - */ -public final class PlotAreaRecord extends StandardRecord { - public final static short sid = 0x1035; - - - public PlotAreaRecord() - { - - } - - /** - * @param in unused (since this record has no data) - */ - public PlotAreaRecord(RecordInputStream in) - { - - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[PLOTAREA]\n"); - - buffer.append("[/PLOTAREA]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - } - - protected int getDataSize() { - return 0; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - PlotAreaRecord rec = new PlotAreaRecord(); - - return rec; - } -} diff --git a/src/java/org/apache/poi/hssf/record/PlotGrowthRecord.java b/src/java/org/apache/poi/hssf/record/PlotGrowthRecord.java deleted file mode 100644 index 3f460dc353..0000000000 --- a/src/java/org/apache/poi/hssf/record/PlotGrowthRecord.java +++ /dev/null @@ -1,120 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The plot growth record specifies the scaling factors used when a font is scaled.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class PlotGrowthRecord extends StandardRecord { - public final static short sid = 0x1064; - private int field_1_horizontalScale; - private int field_2_verticalScale; - - - public PlotGrowthRecord() - { - - } - - public PlotGrowthRecord(RecordInputStream in) - { - field_1_horizontalScale = in.readInt(); - field_2_verticalScale = in.readInt(); - - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[PLOTGROWTH]\n"); - buffer.append(" .horizontalScale = ") - .append("0x").append(HexDump.toHex( getHorizontalScale ())) - .append(" (").append( getHorizontalScale() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .verticalScale = ") - .append("0x").append(HexDump.toHex( getVerticalScale ())) - .append(" (").append( getVerticalScale() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/PLOTGROWTH]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeInt(field_1_horizontalScale); - out.writeInt(field_2_verticalScale); - } - - protected int getDataSize() { - return 4 + 4; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - PlotGrowthRecord rec = new PlotGrowthRecord(); - - rec.field_1_horizontalScale = field_1_horizontalScale; - rec.field_2_verticalScale = field_2_verticalScale; - return rec; - } - - - - - /** - * Get the horizontalScale field for the PlotGrowth record. - */ - public int getHorizontalScale() - { - return field_1_horizontalScale; - } - - /** - * Set the horizontalScale field for the PlotGrowth record. - */ - public void setHorizontalScale(int field_1_horizontalScale) - { - this.field_1_horizontalScale = field_1_horizontalScale; - } - - /** - * Get the verticalScale field for the PlotGrowth record. - */ - public int getVerticalScale() - { - return field_2_verticalScale; - } - - /** - * Set the verticalScale field for the PlotGrowth record. - */ - public void setVerticalScale(int field_2_verticalScale) - { - this.field_2_verticalScale = field_2_verticalScale; - } -} diff --git a/src/java/org/apache/poi/hssf/record/SeriesChartGroupIndexRecord.java b/src/java/org/apache/poi/hssf/record/SeriesChartGroupIndexRecord.java deleted file mode 100644 index afe0dc3e63..0000000000 --- a/src/java/org/apache/poi/hssf/record/SeriesChartGroupIndexRecord.java +++ /dev/null @@ -1,95 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The series chart group index record stores the index to the CHARTFORMAT record (0 based).

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class SeriesChartGroupIndexRecord extends StandardRecord { - public final static short sid = 0x1045; - private short field_1_chartGroupIndex; - - - public SeriesChartGroupIndexRecord() - { - - } - - public SeriesChartGroupIndexRecord(RecordInputStream in) - { - field_1_chartGroupIndex = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[SERTOCRT]\n"); - buffer.append(" .chartGroupIndex = ") - .append("0x").append(HexDump.toHex( getChartGroupIndex ())) - .append(" (").append( getChartGroupIndex() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/SERTOCRT]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_chartGroupIndex); - } - - protected int getDataSize() { - return 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - SeriesChartGroupIndexRecord rec = new SeriesChartGroupIndexRecord(); - - rec.field_1_chartGroupIndex = field_1_chartGroupIndex; - return rec; - } - - - - - /** - * Get the chart group index field for the SeriesChartGroupIndex record. - */ - public short getChartGroupIndex() - { - return field_1_chartGroupIndex; - } - - /** - * Set the chart group index field for the SeriesChartGroupIndex record. - */ - public void setChartGroupIndex(short field_1_chartGroupIndex) - { - this.field_1_chartGroupIndex = field_1_chartGroupIndex; - } -} diff --git a/src/java/org/apache/poi/hssf/record/SeriesIndexRecord.java b/src/java/org/apache/poi/hssf/record/SeriesIndexRecord.java deleted file mode 100644 index c6870b1b69..0000000000 --- a/src/java/org/apache/poi/hssf/record/SeriesIndexRecord.java +++ /dev/null @@ -1,95 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * links a series to its position in the series list.

- * - * @author Andrew C. Oliver (acoliver at apache.org) - */ -public final class SeriesIndexRecord extends StandardRecord { - public final static short sid = 0x1065; - private short field_1_index; - - - public SeriesIndexRecord() - { - - } - - public SeriesIndexRecord(RecordInputStream in) - { - field_1_index = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[SINDEX]\n"); - buffer.append(" .index = ") - .append("0x").append(HexDump.toHex( getIndex ())) - .append(" (").append( getIndex() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/SINDEX]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_index); - } - - protected int getDataSize() { - return 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - SeriesIndexRecord rec = new SeriesIndexRecord(); - - rec.field_1_index = field_1_index; - return rec; - } - - - - - /** - * Get the index field for the SeriesIndex record. - */ - public short getIndex() - { - return field_1_index; - } - - /** - * Set the index field for the SeriesIndex record. - */ - public void setIndex(short field_1_index) - { - this.field_1_index = field_1_index; - } -} diff --git a/src/java/org/apache/poi/hssf/record/SeriesLabelsRecord.java b/src/java/org/apache/poi/hssf/record/SeriesLabelsRecord.java deleted file mode 100644 index 8386768862..0000000000 --- a/src/java/org/apache/poi/hssf/record/SeriesLabelsRecord.java +++ /dev/null @@ -1,218 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The series label record defines the type of label associated with the data format record.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class SeriesLabelsRecord extends StandardRecord { - public final static short sid = 0x100c; - - private static final BitField showActual = BitFieldFactory.getInstance(0x01); - private static final BitField showPercent = BitFieldFactory.getInstance(0x02); - private static final BitField labelAsPercentage = BitFieldFactory.getInstance(0x04); - private static final BitField smoothedLine = BitFieldFactory.getInstance(0x08); - private static final BitField showLabel = BitFieldFactory.getInstance(0x10); - private static final BitField showBubbleSizes = BitFieldFactory.getInstance(0x20); - - private short field_1_formatFlags; - - public SeriesLabelsRecord() - { - - } - - public SeriesLabelsRecord(RecordInputStream in) - { - field_1_formatFlags = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[ATTACHEDLABEL]\n"); - buffer.append(" .formatFlags = ") - .append("0x").append(HexDump.toHex( getFormatFlags ())) - .append(" (").append( getFormatFlags() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .showActual = ").append(isShowActual()).append('\n'); - buffer.append(" .showPercent = ").append(isShowPercent()).append('\n'); - buffer.append(" .labelAsPercentage = ").append(isLabelAsPercentage()).append('\n'); - buffer.append(" .smoothedLine = ").append(isSmoothedLine()).append('\n'); - buffer.append(" .showLabel = ").append(isShowLabel()).append('\n'); - buffer.append(" .showBubbleSizes = ").append(isShowBubbleSizes()).append('\n'); - - buffer.append("[/ATTACHEDLABEL]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_formatFlags); - } - - protected int getDataSize() { - return 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - SeriesLabelsRecord rec = new SeriesLabelsRecord(); - - rec.field_1_formatFlags = field_1_formatFlags; - return rec; - } - - - - - /** - * Get the format flags field for the SeriesLabels record. - */ - public short getFormatFlags() - { - return field_1_formatFlags; - } - - /** - * Set the format flags field for the SeriesLabels record. - */ - public void setFormatFlags(short field_1_formatFlags) - { - this.field_1_formatFlags = field_1_formatFlags; - } - - /** - * Sets the show actual field value. - * show actual value of the data point - */ - public void setShowActual(boolean value) - { - field_1_formatFlags = showActual.setShortBoolean(field_1_formatFlags, value); - } - - /** - * show actual value of the data point - * @return the show actual field value. - */ - public boolean isShowActual() - { - return showActual.isSet(field_1_formatFlags); - } - - /** - * Sets the show percent field value. - * show value as percentage of total (pie charts only) - */ - public void setShowPercent(boolean value) - { - field_1_formatFlags = showPercent.setShortBoolean(field_1_formatFlags, value); - } - - /** - * show value as percentage of total (pie charts only) - * @return the show percent field value. - */ - public boolean isShowPercent() - { - return showPercent.isSet(field_1_formatFlags); - } - - /** - * Sets the label as percentage field value. - * show category label/value as percentage (pie charts only) - */ - public void setLabelAsPercentage(boolean value) - { - field_1_formatFlags = labelAsPercentage.setShortBoolean(field_1_formatFlags, value); - } - - /** - * show category label/value as percentage (pie charts only) - * @return the label as percentage field value. - */ - public boolean isLabelAsPercentage() - { - return labelAsPercentage.isSet(field_1_formatFlags); - } - - /** - * Sets the smoothed line field value. - * show smooth line - */ - public void setSmoothedLine(boolean value) - { - field_1_formatFlags = smoothedLine.setShortBoolean(field_1_formatFlags, value); - } - - /** - * show smooth line - * @return the smoothed line field value. - */ - public boolean isSmoothedLine() - { - return smoothedLine.isSet(field_1_formatFlags); - } - - /** - * Sets the show label field value. - * display category label - */ - public void setShowLabel(boolean value) - { - field_1_formatFlags = showLabel.setShortBoolean(field_1_formatFlags, value); - } - - /** - * display category label - * @return the show label field value. - */ - public boolean isShowLabel() - { - return showLabel.isSet(field_1_formatFlags); - } - - /** - * Sets the show bubble sizes field value. - * ?? - */ - public void setShowBubbleSizes(boolean value) - { - field_1_formatFlags = showBubbleSizes.setShortBoolean(field_1_formatFlags, value); - } - - /** - * ?? - * @return the show bubble sizes field value. - */ - public boolean isShowBubbleSizes() - { - return showBubbleSizes.isSet(field_1_formatFlags); - } -} diff --git a/src/java/org/apache/poi/hssf/record/SeriesListRecord.java b/src/java/org/apache/poi/hssf/record/SeriesListRecord.java deleted file mode 100644 index c8edda2aa5..0000000000 --- a/src/java/org/apache/poi/hssf/record/SeriesListRecord.java +++ /dev/null @@ -1,99 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.LittleEndianOutput; - -/** - * SERIESLIST (0x1016) - * - * The series list record defines the series displayed as an overlay to the main chart record.
- * This record doesn't seem to be referenced in either the OOO or MS doc, but this page mentions it - * http://ooxmlisdefectivebydesign.blogspot.com/2008/03/bad-surprise-in-microsoft-office-binary.html - * - * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class SeriesListRecord extends StandardRecord { - public final static short sid = 0x1016; - private short[] field_1_seriesNumbers; - - public SeriesListRecord(short[] seriesNumbers) { - field_1_seriesNumbers = seriesNumbers; - } - - public SeriesListRecord(RecordInputStream in) { - int nItems = in.readUShort(); - short[] ss = new short[nItems]; - for (int i = 0; i < nItems; i++) { - ss[i] = in.readShort(); - - } - field_1_seriesNumbers = ss; - } - - public String toString() { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[SERIESLIST]\n"); - buffer.append(" .seriesNumbers= ").append(" (").append( getSeriesNumbers() ).append(" )"); - buffer.append("\n"); - - buffer.append("[/SERIESLIST]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - - int nItems = field_1_seriesNumbers.length; - out.writeShort(nItems); - for (int i = 0; i < nItems; i++) { - out.writeShort(field_1_seriesNumbers[i]); - } - } - - protected int getDataSize() { - return field_1_seriesNumbers.length * 2 + 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - return new SeriesListRecord(field_1_seriesNumbers.clone()); - } - - /** - * Get the series numbers field for the SeriesList record. - */ - public short[] getSeriesNumbers() { - return field_1_seriesNumbers; - } - - /** - * Set the series numbers field for the SeriesList record. - */ - public void setSeriesNumbers(short[] field_1_seriesNumbers) { - this.field_1_seriesNumbers = field_1_seriesNumbers; - } -} - - - diff --git a/src/java/org/apache/poi/hssf/record/SeriesRecord.java b/src/java/org/apache/poi/hssf/record/SeriesRecord.java deleted file mode 100644 index 33ca3f9a50..0000000000 --- a/src/java/org/apache/poi/hssf/record/SeriesRecord.java +++ /dev/null @@ -1,267 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The series record describes the overall data for a series.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class SeriesRecord extends StandardRecord { - public final static short sid = 0x1003; - private short field_1_categoryDataType; - public final static short CATEGORY_DATA_TYPE_DATES = 0; - public final static short CATEGORY_DATA_TYPE_NUMERIC = 1; - public final static short CATEGORY_DATA_TYPE_SEQUENCE = 2; - public final static short CATEGORY_DATA_TYPE_TEXT = 3; - private short field_2_valuesDataType; - public final static short VALUES_DATA_TYPE_DATES = 0; - public final static short VALUES_DATA_TYPE_NUMERIC = 1; - public final static short VALUES_DATA_TYPE_SEQUENCE = 2; - public final static short VALUES_DATA_TYPE_TEXT = 3; - private short field_3_numCategories; - private short field_4_numValues; - private short field_5_bubbleSeriesType; - public final static short BUBBLE_SERIES_TYPE_DATES = 0; - public final static short BUBBLE_SERIES_TYPE_NUMERIC = 1; - public final static short BUBBLE_SERIES_TYPE_SEQUENCE = 2; - public final static short BUBBLE_SERIES_TYPE_TEXT = 3; - private short field_6_numBubbleValues; - - - public SeriesRecord() - { - - } - - public SeriesRecord(RecordInputStream in) - { - field_1_categoryDataType = in.readShort(); - field_2_valuesDataType = in.readShort(); - field_3_numCategories = in.readShort(); - field_4_numValues = in.readShort(); - field_5_bubbleSeriesType = in.readShort(); - field_6_numBubbleValues = in.readShort(); - - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[SERIES]\n"); - buffer.append(" .categoryDataType = ") - .append("0x").append(HexDump.toHex( getCategoryDataType ())) - .append(" (").append( getCategoryDataType() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .valuesDataType = ") - .append("0x").append(HexDump.toHex( getValuesDataType ())) - .append(" (").append( getValuesDataType() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .numCategories = ") - .append("0x").append(HexDump.toHex( getNumCategories ())) - .append(" (").append( getNumCategories() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .numValues = ") - .append("0x").append(HexDump.toHex( getNumValues ())) - .append(" (").append( getNumValues() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .bubbleSeriesType = ") - .append("0x").append(HexDump.toHex( getBubbleSeriesType ())) - .append(" (").append( getBubbleSeriesType() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .numBubbleValues = ") - .append("0x").append(HexDump.toHex( getNumBubbleValues ())) - .append(" (").append( getNumBubbleValues() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/SERIES]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_categoryDataType); - out.writeShort(field_2_valuesDataType); - out.writeShort(field_3_numCategories); - out.writeShort(field_4_numValues); - out.writeShort(field_5_bubbleSeriesType); - out.writeShort(field_6_numBubbleValues); - } - - protected int getDataSize() { - return 2 + 2 + 2 + 2 + 2 + 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - SeriesRecord rec = new SeriesRecord(); - - rec.field_1_categoryDataType = field_1_categoryDataType; - rec.field_2_valuesDataType = field_2_valuesDataType; - rec.field_3_numCategories = field_3_numCategories; - rec.field_4_numValues = field_4_numValues; - rec.field_5_bubbleSeriesType = field_5_bubbleSeriesType; - rec.field_6_numBubbleValues = field_6_numBubbleValues; - return rec; - } - - - - - /** - * Get the category data type field for the Series record. - * - * @return One of - * CATEGORY_DATA_TYPE_DATES - * CATEGORY_DATA_TYPE_NUMERIC - * CATEGORY_DATA_TYPE_SEQUENCE - * CATEGORY_DATA_TYPE_TEXT - */ - public short getCategoryDataType() - { - return field_1_categoryDataType; - } - - /** - * Set the category data type field for the Series record. - * - * @param field_1_categoryDataType - * One of - * CATEGORY_DATA_TYPE_DATES - * CATEGORY_DATA_TYPE_NUMERIC - * CATEGORY_DATA_TYPE_SEQUENCE - * CATEGORY_DATA_TYPE_TEXT - */ - public void setCategoryDataType(short field_1_categoryDataType) - { - this.field_1_categoryDataType = field_1_categoryDataType; - } - - /** - * Get the values data type field for the Series record. - * - * @return One of - * VALUES_DATA_TYPE_DATES - * VALUES_DATA_TYPE_NUMERIC - * VALUES_DATA_TYPE_SEQUENCE - * VALUES_DATA_TYPE_TEXT - */ - public short getValuesDataType() - { - return field_2_valuesDataType; - } - - /** - * Set the values data type field for the Series record. - * - * @param field_2_valuesDataType - * One of - * VALUES_DATA_TYPE_DATES - * VALUES_DATA_TYPE_NUMERIC - * VALUES_DATA_TYPE_SEQUENCE - * VALUES_DATA_TYPE_TEXT - */ - public void setValuesDataType(short field_2_valuesDataType) - { - this.field_2_valuesDataType = field_2_valuesDataType; - } - - /** - * Get the num categories field for the Series record. - */ - public short getNumCategories() - { - return field_3_numCategories; - } - - /** - * Set the num categories field for the Series record. - */ - public void setNumCategories(short field_3_numCategories) - { - this.field_3_numCategories = field_3_numCategories; - } - - /** - * Get the num values field for the Series record. - */ - public short getNumValues() - { - return field_4_numValues; - } - - /** - * Set the num values field for the Series record. - */ - public void setNumValues(short field_4_numValues) - { - this.field_4_numValues = field_4_numValues; - } - - /** - * Get the bubble series type field for the Series record. - * - * @return One of - * BUBBLE_SERIES_TYPE_DATES - * BUBBLE_SERIES_TYPE_NUMERIC - * BUBBLE_SERIES_TYPE_SEQUENCE - * BUBBLE_SERIES_TYPE_TEXT - */ - public short getBubbleSeriesType() - { - return field_5_bubbleSeriesType; - } - - /** - * Set the bubble series type field for the Series record. - * - * @param field_5_bubbleSeriesType - * One of - * BUBBLE_SERIES_TYPE_DATES - * BUBBLE_SERIES_TYPE_NUMERIC - * BUBBLE_SERIES_TYPE_SEQUENCE - * BUBBLE_SERIES_TYPE_TEXT - */ - public void setBubbleSeriesType(short field_5_bubbleSeriesType) - { - this.field_5_bubbleSeriesType = field_5_bubbleSeriesType; - } - - /** - * Get the num bubble values field for the Series record. - */ - public short getNumBubbleValues() - { - return field_6_numBubbleValues; - } - - /** - * Set the num bubble values field for the Series record. - */ - public void setNumBubbleValues(short field_6_numBubbleValues) - { - this.field_6_numBubbleValues = field_6_numBubbleValues; - } -} diff --git a/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java b/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java deleted file mode 100644 index 8dfaccad3f..0000000000 --- a/src/java/org/apache/poi/hssf/record/SeriesTextRecord.java +++ /dev/null @@ -1,132 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianByteArrayOutputStream; -import org.apache.poi.util.LittleEndianOutput; -import org.apache.poi.util.StringUtil; - -/** - * SERIESTEXT (0x100D)

- * Defines a series name

- * - * @author Andrew C. Oliver (acoliver at apache.org) - */ -public final class SeriesTextRecord extends StandardRecord { - public final static short sid = 0x100D; - - /** the actual text cannot be longer than 255 characters */ - private static final int MAX_LEN = 0xFF; - private int field_1_id; - private boolean is16bit; - private String field_4_text; - - public SeriesTextRecord() { - field_4_text = ""; - is16bit = false; - } - - public SeriesTextRecord(RecordInputStream in) { - field_1_id = in.readUShort(); - int field_2_textLength = in.readUByte(); - is16bit = (in.readUByte() & 0x01) != 0; - if (is16bit) { - field_4_text = in.readUnicodeLEString(field_2_textLength); - } else { - field_4_text = in.readCompressedUnicode(field_2_textLength); - } - } - - public String toString() { - StringBuffer sb = new StringBuffer(); - - sb.append("[SERIESTEXT]\n"); - sb.append(" .id =").append(HexDump.shortToHex(getId())).append('\n'); - sb.append(" .textLen=").append(field_4_text.length()).append('\n'); - sb.append(" .is16bit=").append(is16bit).append('\n'); - sb.append(" .text =").append(" (").append(getText()).append(" )").append('\n'); - sb.append("[/SERIESTEXT]\n"); - return sb.toString(); - } - - public void serialize(LittleEndianOutput out) { - - out.writeShort(field_1_id); - out.writeByte(field_4_text.length()); - if (is16bit) { - // Excel (2007) seems to choose 16bit regardless of whether it is needed - out.writeByte(0x01); - StringUtil.putUnicodeLE(field_4_text, out); - } else { - // Excel can read this OK - out.writeByte(0x00); - StringUtil.putCompressedUnicode(field_4_text, out); - } - } - - protected int getDataSize() { - return 2 + 1 + 1 + field_4_text.length() * (is16bit ? 2 : 1); - } - - public short getSid() { - return sid; - } - - public Object clone() { - SeriesTextRecord rec = new SeriesTextRecord(); - - rec.field_1_id = field_1_id; - rec.is16bit = is16bit; - rec.field_4_text = field_4_text; - return rec; - } - - /** - * Get the id field for the SeriesText record. - */ - public int getId() { - return field_1_id; - } - - /** - * Set the id field for the SeriesText record. - */ - public void setId(int id) { - field_1_id = id; - } - - /** - * Get the text field for the SeriesText record. - */ - public String getText() { - return field_4_text; - } - - /** - * Set the text field for the SeriesText record. - */ - public void setText(String text) { - if (text.length() > MAX_LEN) { - throw new IllegalArgumentException("Text is too long (" - + text.length() + ">" + MAX_LEN + ")"); - } - field_4_text = text; - is16bit = StringUtil.hasMultibyte(text); - } -} diff --git a/src/java/org/apache/poi/hssf/record/SeriesToChartGroupRecord.java b/src/java/org/apache/poi/hssf/record/SeriesToChartGroupRecord.java deleted file mode 100644 index 1069dad123..0000000000 --- a/src/java/org/apache/poi/hssf/record/SeriesToChartGroupRecord.java +++ /dev/null @@ -1,97 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * Indicates the chart-group index for a series. The order probably defines the mapping. - * So the 0th record probably means the 0th series. The only field in this of course defines which chart - * group the 0th series (for instance) would map to. Confusing? Well thats because it is. (p 522 BCG)

- * - * @author Andrew C. Oliver (acoliver at apache.org) - */ -public final class SeriesToChartGroupRecord extends StandardRecord { - public final static short sid = 0x1045; - private short field_1_chartGroupIndex; - - - public SeriesToChartGroupRecord() - { - - } - - public SeriesToChartGroupRecord(RecordInputStream in) - { - field_1_chartGroupIndex = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[SeriesToChartGroup]\n"); - buffer.append(" .chartGroupIndex = ") - .append("0x").append(HexDump.toHex( getChartGroupIndex ())) - .append(" (").append( getChartGroupIndex() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/SeriesToChartGroup]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_chartGroupIndex); - } - - protected int getDataSize() { - return 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - SeriesToChartGroupRecord rec = new SeriesToChartGroupRecord(); - - rec.field_1_chartGroupIndex = field_1_chartGroupIndex; - return rec; - } - - - - - /** - * Get the chart group index field for the SeriesToChartGroup record. - */ - public short getChartGroupIndex() - { - return field_1_chartGroupIndex; - } - - /** - * Set the chart group index field for the SeriesToChartGroup record. - */ - public void setChartGroupIndex(short field_1_chartGroupIndex) - { - this.field_1_chartGroupIndex = field_1_chartGroupIndex; - } -} diff --git a/src/java/org/apache/poi/hssf/record/SheetPropertiesRecord.java b/src/java/org/apache/poi/hssf/record/SheetPropertiesRecord.java deleted file mode 100644 index 6d3c7b3ee5..0000000000 --- a/src/java/org/apache/poi/hssf/record/SheetPropertiesRecord.java +++ /dev/null @@ -1,237 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * Describes a chart sheet properties record.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class SheetPropertiesRecord extends StandardRecord { - public final static short sid = 0x1044; - - private static final BitField chartTypeManuallyFormatted = BitFieldFactory.getInstance(0x01); - private static final BitField plotVisibleOnly = BitFieldFactory.getInstance(0x02); - private static final BitField doNotSizeWithWindow = BitFieldFactory.getInstance(0x04); - private static final BitField defaultPlotDimensions = BitFieldFactory.getInstance(0x08); - private static final BitField autoPlotArea = BitFieldFactory.getInstance(0x10); - - private short field_1_flags; - private byte field_2_empty; - public final static byte EMPTY_NOT_PLOTTED = 0; - public final static byte EMPTY_ZERO = 1; - public final static byte EMPTY_INTERPOLATED = 2; - - - public SheetPropertiesRecord() - { - - } - - public SheetPropertiesRecord(RecordInputStream in) - { - field_1_flags = in.readShort(); - field_2_empty = in.readByte(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[SHTPROPS]\n"); - buffer.append(" .flags = ") - .append("0x").append(HexDump.toHex( getFlags ())) - .append(" (").append( getFlags() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .chartTypeManuallyFormatted = ").append(isChartTypeManuallyFormatted()).append('\n'); - buffer.append(" .plotVisibleOnly = ").append(isPlotVisibleOnly()).append('\n'); - buffer.append(" .doNotSizeWithWindow = ").append(isDoNotSizeWithWindow()).append('\n'); - buffer.append(" .defaultPlotDimensions = ").append(isDefaultPlotDimensions()).append('\n'); - buffer.append(" .autoPlotArea = ").append(isAutoPlotArea()).append('\n'); - buffer.append(" .empty = ") - .append("0x").append(HexDump.toHex( getEmpty ())) - .append(" (").append( getEmpty() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/SHTPROPS]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_flags); - out.writeByte(field_2_empty); - } - - protected int getDataSize() { - return 2 + 1; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - SheetPropertiesRecord rec = new SheetPropertiesRecord(); - - rec.field_1_flags = field_1_flags; - rec.field_2_empty = field_2_empty; - return rec; - } - - - - - /** - * Get the flags field for the SheetProperties record. - */ - public short getFlags() - { - return field_1_flags; - } - - /** - * Set the flags field for the SheetProperties record. - */ - public void setFlags(short field_1_flags) - { - this.field_1_flags = field_1_flags; - } - - /** - * Get the empty field for the SheetProperties record. - * - * @return One of - * EMPTY_NOT_PLOTTED - * EMPTY_ZERO - * EMPTY_INTERPOLATED - */ - public byte getEmpty() - { - return field_2_empty; - } - - /** - * Set the empty field for the SheetProperties record. - * - * @param field_2_empty - * One of - * EMPTY_NOT_PLOTTED - * EMPTY_ZERO - * EMPTY_INTERPOLATED - */ - public void setEmpty(byte field_2_empty) - { - this.field_2_empty = field_2_empty; - } - - /** - * Sets the chart type manually formatted field value. - * Has the chart type been manually formatted? - */ - public void setChartTypeManuallyFormatted(boolean value) - { - field_1_flags = chartTypeManuallyFormatted.setShortBoolean(field_1_flags, value); - } - - /** - * Has the chart type been manually formatted? - * @return the chart type manually formatted field value. - */ - public boolean isChartTypeManuallyFormatted() - { - return chartTypeManuallyFormatted.isSet(field_1_flags); - } - - /** - * Sets the plot visible only field value. - * Only show visible cells on the chart. - */ - public void setPlotVisibleOnly(boolean value) - { - field_1_flags = plotVisibleOnly.setShortBoolean(field_1_flags, value); - } - - /** - * Only show visible cells on the chart. - * @return the plot visible only field value. - */ - public boolean isPlotVisibleOnly() - { - return plotVisibleOnly.isSet(field_1_flags); - } - - /** - * Sets the do not size with window field value. - * Do not size the chart when the window changes size - */ - public void setDoNotSizeWithWindow(boolean value) - { - field_1_flags = doNotSizeWithWindow.setShortBoolean(field_1_flags, value); - } - - /** - * Do not size the chart when the window changes size - * @return the do not size with window field value. - */ - public boolean isDoNotSizeWithWindow() - { - return doNotSizeWithWindow.isSet(field_1_flags); - } - - /** - * Sets the default plot dimensions field value. - * Indicates that the default area dimensions should be used. - */ - public void setDefaultPlotDimensions(boolean value) - { - field_1_flags = defaultPlotDimensions.setShortBoolean(field_1_flags, value); - } - - /** - * Indicates that the default area dimensions should be used. - * @return the default plot dimensions field value. - */ - public boolean isDefaultPlotDimensions() - { - return defaultPlotDimensions.isSet(field_1_flags); - } - - /** - * Sets the auto plot area field value. - * ?? - */ - public void setAutoPlotArea(boolean value) - { - field_1_flags = autoPlotArea.setShortBoolean(field_1_flags, value); - } - - /** - * ?? - * @return the auto plot area field value. - */ - public boolean isAutoPlotArea() - { - return autoPlotArea.isSet(field_1_flags); - } -} diff --git a/src/java/org/apache/poi/hssf/record/TextRecord.java b/src/java/org/apache/poi/hssf/record/TextRecord.java deleted file mode 100644 index 9fc27d4fdc..0000000000 --- a/src/java/org/apache/poi/hssf/record/TextRecord.java +++ /dev/null @@ -1,705 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The text record is used to define text stored on a chart.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TextRecord extends StandardRecord { - public final static short sid = 0x1025; - - private static final BitField dataLabelPlacement = BitFieldFactory.getInstance(0x000F); - private static final BitField autoColor = BitFieldFactory.getInstance(0x0001); - private static final BitField showKey = BitFieldFactory.getInstance(0x0002); - private static final BitField showValue = BitFieldFactory.getInstance(0x0004); - private static final BitField vertical = BitFieldFactory.getInstance(0x0008); - private static final BitField autoGeneratedText = BitFieldFactory.getInstance(0x0010); - private static final BitField generated = BitFieldFactory.getInstance(0x0020); - private static final BitField autoLabelDeleted = BitFieldFactory.getInstance(0x0040); - private static final BitField autoBackground = BitFieldFactory.getInstance(0x0080); - private static final BitField rotation = BitFieldFactory.getInstance(0x0700); - - private static final BitField showCategoryLabelAsPercentage = BitFieldFactory.getInstance(0x0800); - private static final BitField showValueAsPercentage = BitFieldFactory.getInstance(0x1000); - private static final BitField showBubbleSizes = BitFieldFactory.getInstance(0x2000); - private static final BitField showLabel = BitFieldFactory.getInstance(0x4000); - - - private byte field_1_horizontalAlignment; - public final static byte HORIZONTAL_ALIGNMENT_LEFT = 1; - public final static byte HORIZONTAL_ALIGNMENT_CENTER = 2; - public final static byte HORIZONTAL_ALIGNMENT_BOTTOM = 3; - public final static byte HORIZONTAL_ALIGNMENT_JUSTIFY = 4; - private byte field_2_verticalAlignment; - public final static byte VERTICAL_ALIGNMENT_TOP = 1; - public final static byte VERTICAL_ALIGNMENT_CENTER = 2; - public final static byte VERTICAL_ALIGNMENT_BOTTOM = 3; - public final static byte VERTICAL_ALIGNMENT_JUSTIFY = 4; - private short field_3_displayMode; - public final static short DISPLAY_MODE_TRANSPARENT = 1; - public final static short DISPLAY_MODE_OPAQUE = 2; - private int field_4_rgbColor; - private int field_5_x; - private int field_6_y; - private int field_7_width; - private int field_8_height; - private short field_9_options1; - 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 short field_10_indexOfColorValue; - private short field_11_options2; - 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; - public final static short DATA_LABEL_PLACEMENT_CENTER = 3; - public final static short DATA_LABEL_PLACEMENT_AXIS = 4; - public final static short DATA_LABEL_PLACEMENT_ABOVE = 5; - public final static short DATA_LABEL_PLACEMENT_BELOW = 6; - public final static short DATA_LABEL_PLACEMENT_LEFT = 7; - public final static short DATA_LABEL_PLACEMENT_RIGHT = 8; - public final static short DATA_LABEL_PLACEMENT_AUTO = 9; - public final static short DATA_LABEL_PLACEMENT_USER_MOVED = 10; - private short field_12_textRotation; - - - public TextRecord() - { - - } - - public TextRecord(RecordInputStream in) - { - field_1_horizontalAlignment = in.readByte(); - field_2_verticalAlignment = in.readByte(); - field_3_displayMode = in.readShort(); - field_4_rgbColor = in.readInt(); - field_5_x = in.readInt(); - field_6_y = in.readInt(); - field_7_width = in.readInt(); - field_8_height = in.readInt(); - field_9_options1 = in.readShort(); - field_10_indexOfColorValue = in.readShort(); - field_11_options2 = in.readShort(); - field_12_textRotation = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[TEXT]\n"); - buffer.append(" .horizontalAlignment = ") - .append("0x").append(HexDump.toHex( getHorizontalAlignment ())) - .append(" (").append( getHorizontalAlignment() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .verticalAlignment = ") - .append("0x").append(HexDump.toHex( getVerticalAlignment ())) - .append(" (").append( getVerticalAlignment() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .displayMode = ") - .append("0x").append(HexDump.toHex( getDisplayMode ())) - .append(" (").append( getDisplayMode() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .rgbColor = ") - .append("0x").append(HexDump.toHex( getRgbColor ())) - .append(" (").append( getRgbColor() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .x = ") - .append("0x").append(HexDump.toHex( getX ())) - .append(" (").append( getX() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .y = ") - .append("0x").append(HexDump.toHex( getY ())) - .append(" (").append( getY() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .width = ") - .append("0x").append(HexDump.toHex( getWidth ())) - .append(" (").append( getWidth() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .height = ") - .append("0x").append(HexDump.toHex( getHeight ())) - .append(" (").append( getHeight() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .options1 = ") - .append("0x").append(HexDump.toHex( getOptions1 ())) - .append(" (").append( getOptions1() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .autoColor = ").append(isAutoColor()).append('\n'); - buffer.append(" .showKey = ").append(isShowKey()).append('\n'); - buffer.append(" .showValue = ").append(isShowValue()).append('\n'); - buffer.append(" .vertical = ").append(isVertical()).append('\n'); - buffer.append(" .autoGeneratedText = ").append(isAutoGeneratedText()).append('\n'); - buffer.append(" .generated = ").append(isGenerated()).append('\n'); - buffer.append(" .autoLabelDeleted = ").append(isAutoLabelDeleted()).append('\n'); - buffer.append(" .autoBackground = ").append(isAutoBackground()).append('\n'); - buffer.append(" .rotation = ").append(getRotation()).append('\n'); - buffer.append(" .showCategoryLabelAsPercentage = ").append(isShowCategoryLabelAsPercentage()).append('\n'); - buffer.append(" .showValueAsPercentage = ").append(isShowValueAsPercentage()).append('\n'); - buffer.append(" .showBubbleSizes = ").append(isShowBubbleSizes()).append('\n'); - buffer.append(" .showLabel = ").append(isShowLabel()).append('\n'); - buffer.append(" .indexOfColorValue = ") - .append("0x").append(HexDump.toHex( getIndexOfColorValue ())) - .append(" (").append( getIndexOfColorValue() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .options2 = ") - .append("0x").append(HexDump.toHex( getOptions2 ())) - .append(" (").append( getOptions2() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .dataLabelPlacement = ").append(getDataLabelPlacement()).append('\n'); - buffer.append(" .textRotation = ") - .append("0x").append(HexDump.toHex( getTextRotation ())) - .append(" (").append( getTextRotation() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/TEXT]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeByte(field_1_horizontalAlignment); - out.writeByte(field_2_verticalAlignment); - out.writeShort(field_3_displayMode); - out.writeInt(field_4_rgbColor); - out.writeInt(field_5_x); - out.writeInt(field_6_y); - out.writeInt(field_7_width); - out.writeInt(field_8_height); - out.writeShort(field_9_options1); - out.writeShort(field_10_indexOfColorValue); - out.writeShort(field_11_options2); - out.writeShort(field_12_textRotation); - } - - protected int getDataSize() { - return 1 + 1 + 2 + 4 + 4 + 4 + 4 + 4 + 2 + 2 + 2 + 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - TextRecord rec = new TextRecord(); - - rec.field_1_horizontalAlignment = field_1_horizontalAlignment; - rec.field_2_verticalAlignment = field_2_verticalAlignment; - rec.field_3_displayMode = field_3_displayMode; - rec.field_4_rgbColor = field_4_rgbColor; - rec.field_5_x = field_5_x; - rec.field_6_y = field_6_y; - rec.field_7_width = field_7_width; - rec.field_8_height = field_8_height; - rec.field_9_options1 = field_9_options1; - rec.field_10_indexOfColorValue = field_10_indexOfColorValue; - rec.field_11_options2 = field_11_options2; - rec.field_12_textRotation = field_12_textRotation; - return rec; - } - - - - - /** - * Get the horizontal alignment field for the Text record. - * - * @return One of - * HORIZONTAL_ALIGNMENT_LEFT - * HORIZONTAL_ALIGNMENT_CENTER - * HORIZONTAL_ALIGNMENT_BOTTOM - * HORIZONTAL_ALIGNMENT_JUSTIFY - */ - public byte getHorizontalAlignment() - { - return field_1_horizontalAlignment; - } - - /** - * Set the horizontal alignment field for the Text record. - * - * @param field_1_horizontalAlignment - * One of - * HORIZONTAL_ALIGNMENT_LEFT - * HORIZONTAL_ALIGNMENT_CENTER - * HORIZONTAL_ALIGNMENT_BOTTOM - * HORIZONTAL_ALIGNMENT_JUSTIFY - */ - public void setHorizontalAlignment(byte field_1_horizontalAlignment) - { - this.field_1_horizontalAlignment = field_1_horizontalAlignment; - } - - /** - * Get the vertical alignment field for the Text record. - * - * @return One of - * VERTICAL_ALIGNMENT_TOP - * VERTICAL_ALIGNMENT_CENTER - * VERTICAL_ALIGNMENT_BOTTOM - * VERTICAL_ALIGNMENT_JUSTIFY - */ - public byte getVerticalAlignment() - { - return field_2_verticalAlignment; - } - - /** - * Set the vertical alignment field for the Text record. - * - * @param field_2_verticalAlignment - * One of - * VERTICAL_ALIGNMENT_TOP - * VERTICAL_ALIGNMENT_CENTER - * VERTICAL_ALIGNMENT_BOTTOM - * VERTICAL_ALIGNMENT_JUSTIFY - */ - public void setVerticalAlignment(byte field_2_verticalAlignment) - { - this.field_2_verticalAlignment = field_2_verticalAlignment; - } - - /** - * Get the display mode field for the Text record. - * - * @return One of - * DISPLAY_MODE_TRANSPARENT - * DISPLAY_MODE_OPAQUE - */ - public short getDisplayMode() - { - return field_3_displayMode; - } - - /** - * Set the display mode field for the Text record. - * - * @param field_3_displayMode - * One of - * DISPLAY_MODE_TRANSPARENT - * DISPLAY_MODE_OPAQUE - */ - public void setDisplayMode(short field_3_displayMode) - { - this.field_3_displayMode = field_3_displayMode; - } - - /** - * Get the rgbColor field for the Text record. - */ - public int getRgbColor() - { - return field_4_rgbColor; - } - - /** - * Set the rgbColor field for the Text record. - */ - public void setRgbColor(int field_4_rgbColor) - { - this.field_4_rgbColor = field_4_rgbColor; - } - - /** - * Get the x field for the Text record. - */ - public int getX() - { - return field_5_x; - } - - /** - * Set the x field for the Text record. - */ - public void setX(int field_5_x) - { - this.field_5_x = field_5_x; - } - - /** - * Get the y field for the Text record. - */ - public int getY() - { - return field_6_y; - } - - /** - * Set the y field for the Text record. - */ - public void setY(int field_6_y) - { - this.field_6_y = field_6_y; - } - - /** - * Get the width field for the Text record. - */ - public int getWidth() - { - return field_7_width; - } - - /** - * Set the width field for the Text record. - */ - public void setWidth(int field_7_width) - { - this.field_7_width = field_7_width; - } - - /** - * Get the height field for the Text record. - */ - public int getHeight() - { - return field_8_height; - } - - /** - * Set the height field for the Text record. - */ - public void setHeight(int field_8_height) - { - this.field_8_height = field_8_height; - } - - /** - * Get the options1 field for the Text record. - */ - public short getOptions1() - { - return field_9_options1; - } - - /** - * Set the options1 field for the Text record. - */ - public void setOptions1(short field_9_options1) - { - this.field_9_options1 = field_9_options1; - } - - /** - * Get the index of color value field for the Text record. - */ - public short getIndexOfColorValue() - { - return field_10_indexOfColorValue; - } - - /** - * Set the index of color value field for the Text record. - */ - public void setIndexOfColorValue(short field_10_indexOfColorValue) - { - this.field_10_indexOfColorValue = field_10_indexOfColorValue; - } - - /** - * Get the options2 field for the Text record. - */ - public short getOptions2() - { - return field_11_options2; - } - - /** - * Set the options2 field for the Text record. - */ - public void setOptions2(short field_11_options2) - { - this.field_11_options2 = field_11_options2; - } - - /** - * Get the text rotation field for the Text record. - */ - public short getTextRotation() - { - return field_12_textRotation; - } - - /** - * Set the text rotation field for the Text record. - */ - public void setTextRotation(short field_12_textRotation) - { - this.field_12_textRotation = field_12_textRotation; - } - - /** - * Sets the auto color field value. - * true = automaticly selected colour, false = user-selected - */ - public void setAutoColor(boolean value) - { - field_9_options1 = autoColor.setShortBoolean(field_9_options1, value); - } - - /** - * true = automaticly selected colour, false = user-selected - * @return the auto color field value. - */ - public boolean isAutoColor() - { - return autoColor.isSet(field_9_options1); - } - - /** - * Sets the show key field value. - * true = draw legend - */ - public void setShowKey(boolean value) - { - field_9_options1 = showKey.setShortBoolean(field_9_options1, value); - } - - /** - * true = draw legend - * @return the show key field value. - */ - public boolean isShowKey() - { - return showKey.isSet(field_9_options1); - } - - /** - * Sets the show value field value. - * false = text is category label - */ - public void setShowValue(boolean value) - { - field_9_options1 = showValue.setShortBoolean(field_9_options1, value); - } - - /** - * false = text is category label - * @return the show value field value. - */ - public boolean isShowValue() - { - return showValue.isSet(field_9_options1); - } - - /** - * Sets the vertical field value. - * true = text is vertical - */ - public void setVertical(boolean value) - { - field_9_options1 = vertical.setShortBoolean(field_9_options1, value); - } - - /** - * true = text is vertical - * @return the vertical field value. - */ - public boolean isVertical() - { - return vertical.isSet(field_9_options1); - } - - /** - * Sets the auto generated text field value. - * - */ - public void setAutoGeneratedText(boolean value) - { - field_9_options1 = autoGeneratedText.setShortBoolean(field_9_options1, value); - } - - /** - * - * @return the auto generated text field value. - */ - public boolean isAutoGeneratedText() - { - return autoGeneratedText.isSet(field_9_options1); - } - - /** - * Sets the generated field value. - * - */ - public void setGenerated(boolean value) - { - field_9_options1 = generated.setShortBoolean(field_9_options1, value); - } - - /** - * - * @return the generated field value. - */ - public boolean isGenerated() - { - return generated.isSet(field_9_options1); - } - - /** - * Sets the auto label deleted field value. - * - */ - public void setAutoLabelDeleted(boolean value) - { - field_9_options1 = autoLabelDeleted.setShortBoolean(field_9_options1, value); - } - - /** - * - * @return the auto label deleted field value. - */ - public boolean isAutoLabelDeleted() - { - return autoLabelDeleted.isSet(field_9_options1); - } - - /** - * Sets the auto background field value. - * - */ - public void setAutoBackground(boolean value) - { - field_9_options1 = autoBackground.setShortBoolean(field_9_options1, value); - } - - /** - * - * @return the auto background field value. - */ - public boolean isAutoBackground() - { - return autoBackground.isSet(field_9_options1); - } - - /** - * Sets the rotation field value. - * - */ - public void setRotation(short value) - { - field_9_options1 = rotation.setShortValue(field_9_options1, value); - } - - /** - * - * @return the rotation field value. - */ - public short getRotation() - { - return rotation.getShortValue(field_9_options1); - } - - /** - * Sets the show category label as percentage field value. - * - */ - public void setShowCategoryLabelAsPercentage(boolean value) - { - field_9_options1 = showCategoryLabelAsPercentage.setShortBoolean(field_9_options1, value); - } - - /** - * - * @return the show category label as percentage field value. - */ - public boolean isShowCategoryLabelAsPercentage() - { - return showCategoryLabelAsPercentage.isSet(field_9_options1); - } - - /** - * Sets the show value as percentage field value. - * - */ - public void setShowValueAsPercentage(boolean value) - { - field_9_options1 = showValueAsPercentage.setShortBoolean(field_9_options1, value); - } - - /** - * - * @return the show value as percentage field value. - */ - public boolean isShowValueAsPercentage() - { - return showValueAsPercentage.isSet(field_9_options1); - } - - /** - * Sets the show bubble sizes field value. - * - */ - public void setShowBubbleSizes(boolean value) - { - field_9_options1 = showBubbleSizes.setShortBoolean(field_9_options1, value); - } - - /** - * - * @return the show bubble sizes field value. - */ - public boolean isShowBubbleSizes() - { - return showBubbleSizes.isSet(field_9_options1); - } - - /** - * Sets the show label field value. - * - */ - public void setShowLabel(boolean value) - { - field_9_options1 = showLabel.setShortBoolean(field_9_options1, value); - } - - /** - * - * @return the show label field value. - */ - public boolean isShowLabel() - { - return showLabel.isSet(field_9_options1); - } - - /** - * Sets the data label placement field value. - * - */ - public void setDataLabelPlacement(short value) - { - field_11_options2 = dataLabelPlacement.setShortValue(field_11_options2, value); - } - - /** - * - * @return the data label placement field value. - */ - public short getDataLabelPlacement() - { - return dataLabelPlacement.getShortValue(field_11_options2); - } -} diff --git a/src/java/org/apache/poi/hssf/record/TickRecord.java b/src/java/org/apache/poi/hssf/record/TickRecord.java deleted file mode 100644 index 2913224992..0000000000 --- a/src/java/org/apache/poi/hssf/record/TickRecord.java +++ /dev/null @@ -1,405 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The Tick record defines how tick marks and label positioning/formatting

- * - * @author Andrew C. Oliver(acoliver at apache.org) - */ -public final class TickRecord extends StandardRecord { - public final static short sid = 0x101E; - - private static final BitField autoTextColor = BitFieldFactory.getInstance(0x1); - private static final BitField autoTextBackground = BitFieldFactory.getInstance(0x2); - private static final BitField rotation = BitFieldFactory.getInstance(0x1c); - private static final BitField autorotate = BitFieldFactory.getInstance(0x20); - - private byte field_1_majorTickType; - private byte field_2_minorTickType; - private byte field_3_labelPosition; - private byte field_4_background; - private int field_5_labelColorRgb; - private int field_6_zero1; - private int field_7_zero2; - private int field_8_zero3; - private int field_9_zero4; - private short field_10_options; - private short field_11_tickColor; - private short field_12_zero5; - - - public TickRecord() - { - - } - - public TickRecord(RecordInputStream in) - { - - field_1_majorTickType = in.readByte(); - field_2_minorTickType = in.readByte(); - field_3_labelPosition = in.readByte(); - field_4_background = in.readByte(); - field_5_labelColorRgb = in.readInt(); - field_6_zero1 = in.readInt(); - field_7_zero2 = in.readInt(); - field_8_zero3 = in.readInt(); - field_9_zero4 = in.readInt(); - - field_10_options = in.readShort(); - field_11_tickColor = in.readShort(); - field_12_zero5 = in.readShort(); - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[TICK]\n"); - buffer.append(" .majorTickType = ") - .append("0x").append(HexDump.toHex( getMajorTickType ())) - .append(" (").append( getMajorTickType() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .minorTickType = ") - .append("0x").append(HexDump.toHex( getMinorTickType ())) - .append(" (").append( getMinorTickType() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .labelPosition = ") - .append("0x").append(HexDump.toHex( getLabelPosition ())) - .append(" (").append( getLabelPosition() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .background = ") - .append("0x").append(HexDump.toHex( getBackground ())) - .append(" (").append( getBackground() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .labelColorRgb = ") - .append("0x").append(HexDump.toHex( getLabelColorRgb ())) - .append(" (").append( getLabelColorRgb() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .zero1 = ") - .append("0x").append(HexDump.toHex( getZero1 ())) - .append(" (").append( getZero1() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .zero2 = ") - .append("0x").append(HexDump.toHex( getZero2 ())) - .append(" (").append( getZero2() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .options = ") - .append("0x").append(HexDump.toHex( getOptions ())) - .append(" (").append( getOptions() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .autoTextColor = ").append(isAutoTextColor()).append('\n'); - buffer.append(" .autoTextBackground = ").append(isAutoTextBackground()).append('\n'); - buffer.append(" .rotation = ").append(getRotation()).append('\n'); - buffer.append(" .autorotate = ").append(isAutorotate()).append('\n'); - buffer.append(" .tickColor = ") - .append("0x").append(HexDump.toHex( getTickColor ())) - .append(" (").append( getTickColor() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .zero3 = ") - .append("0x").append(HexDump.toHex( getZero3 ())) - .append(" (").append( getZero3() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/TICK]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeByte(field_1_majorTickType); - out.writeByte(field_2_minorTickType); - out.writeByte(field_3_labelPosition); - out.writeByte(field_4_background); - out.writeInt(field_5_labelColorRgb); - out.writeInt(field_6_zero1); - out.writeInt(field_7_zero2); - out.writeInt(field_8_zero3); - out.writeInt(field_9_zero4); - out.writeShort(field_10_options); - out.writeShort(field_11_tickColor); - out.writeShort(field_12_zero5); - } - - protected int getDataSize() { - return 1 + 1 + 1 + 1 + 4 + 8 + 8 + 2 + 2 + 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - TickRecord rec = new TickRecord(); - - rec.field_1_majorTickType = field_1_majorTickType; - rec.field_2_minorTickType = field_2_minorTickType; - rec.field_3_labelPosition = field_3_labelPosition; - rec.field_4_background = field_4_background; - rec.field_5_labelColorRgb = field_5_labelColorRgb; - rec.field_6_zero1 = field_6_zero1; - rec.field_7_zero2 = field_7_zero2; - rec.field_8_zero3 = field_8_zero3; - rec.field_9_zero4 = field_9_zero4; - rec.field_10_options = field_10_options; - rec.field_11_tickColor = field_11_tickColor; - rec.field_12_zero5 = field_12_zero5; - return rec; - } - - - - - /** - * Get the major tick type field for the Tick record. - */ - public byte getMajorTickType() - { - return field_1_majorTickType; - } - - /** - * Set the major tick type field for the Tick record. - */ - public void setMajorTickType(byte field_1_majorTickType) - { - this.field_1_majorTickType = field_1_majorTickType; - } - - /** - * Get the minor tick type field for the Tick record. - */ - public byte getMinorTickType() - { - return field_2_minorTickType; - } - - /** - * Set the minor tick type field for the Tick record. - */ - public void setMinorTickType(byte field_2_minorTickType) - { - this.field_2_minorTickType = field_2_minorTickType; - } - - /** - * Get the label position field for the Tick record. - */ - public byte getLabelPosition() - { - return field_3_labelPosition; - } - - /** - * Set the label position field for the Tick record. - */ - public void setLabelPosition(byte field_3_labelPosition) - { - this.field_3_labelPosition = field_3_labelPosition; - } - - /** - * Get the background field for the Tick record. - */ - public byte getBackground() - { - return field_4_background; - } - - /** - * Set the background field for the Tick record. - */ - public void setBackground(byte field_4_background) - { - this.field_4_background = field_4_background; - } - - /** - * Get the label color rgb field for the Tick record. - */ - public int getLabelColorRgb() - { - return field_5_labelColorRgb; - } - - /** - * Set the label color rgb field for the Tick record. - */ - public void setLabelColorRgb(int field_5_labelColorRgb) - { - this.field_5_labelColorRgb = field_5_labelColorRgb; - } - - /** - * Get the zero 1 field for the Tick record. - */ - public int getZero1() - { - return field_6_zero1; - } - - /** - * Set the zero 1 field for the Tick record. - */ - public void setZero1(int field_6_zero1) - { - this.field_6_zero1 = field_6_zero1; - } - - /** - * Get the zero 2 field for the Tick record. - */ - public int getZero2() - { - return field_7_zero2; - } - - /** - * Set the zero 2 field for the Tick record. - */ - public void setZero2(int field_7_zero2) - { - this.field_7_zero2 = field_7_zero2; - } - - /** - * Get the options field for the Tick record. - */ - public short getOptions() - { - return field_10_options; - } - - /** - * Set the options field for the Tick record. - */ - public void setOptions(short field_10_options) - { - this.field_10_options = field_10_options; - } - - /** - * Get the tick color field for the Tick record. - */ - public short getTickColor() - { - return field_11_tickColor; - } - - /** - * Set the tick color field for the Tick record. - */ - public void setTickColor(short field_11_tickColor) - { - this.field_11_tickColor = field_11_tickColor; - } - - /** - * Get the zero 3 field for the Tick record. - */ - public short getZero3() - { - return field_12_zero5; - } - - /** - * Set the zero 3 field for the Tick record. - */ - public void setZero3(short field_12_zero3) - { - this.field_12_zero5 = field_12_zero3; - } - - /** - * Sets the auto text color field value. - * use the quote unquote automatic color for text - */ - public void setAutoTextColor(boolean value) - { - field_10_options = autoTextColor.setShortBoolean(field_10_options, value); - } - - /** - * use the quote unquote automatic color for text - * @return the auto text color field value. - */ - public boolean isAutoTextColor() - { - return autoTextColor.isSet(field_10_options); - } - - /** - * Sets the auto text background field value. - * use the quote unquote automatic color for text background - */ - public void setAutoTextBackground(boolean value) - { - field_10_options = autoTextBackground.setShortBoolean(field_10_options, value); - } - - /** - * use the quote unquote automatic color for text background - * @return the auto text background field value. - */ - public boolean isAutoTextBackground() - { - return autoTextBackground.isSet(field_10_options); - } - - /** - * Sets the rotation field value. - * rotate text (0=none, 1=normal, 2=90 degrees counterclockwise, 3=90 degrees clockwise) - */ - public void setRotation(short value) - { - field_10_options = rotation.setShortValue(field_10_options, value); - } - - /** - * rotate text (0=none, 1=normal, 2=90 degrees counterclockwise, 3=90 degrees clockwise) - * @return the rotation field value. - */ - public short getRotation() - { - return rotation.getShortValue(field_10_options); - } - - /** - * Sets the autorotate field value. - * automatically rotate the text - */ - public void setAutorotate(boolean value) - { - field_10_options = autorotate.setShortBoolean(field_10_options, value); - } - - /** - * automatically rotate the text - * @return the autorotate field value. - */ - public boolean isAutorotate() - { - return autorotate.isSet(field_10_options); - } -} diff --git a/src/java/org/apache/poi/hssf/record/UnitsRecord.java b/src/java/org/apache/poi/hssf/record/UnitsRecord.java deleted file mode 100644 index 4ed1253814..0000000000 --- a/src/java/org/apache/poi/hssf/record/UnitsRecord.java +++ /dev/null @@ -1,96 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The units record describes units.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class UnitsRecord extends StandardRecord { - public final static short sid = 0x1001; - private short field_1_units; - - - public UnitsRecord() - { - - } - - public UnitsRecord(RecordInputStream in) - { - field_1_units = in.readShort(); - - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[UNITS]\n"); - buffer.append(" .units = ") - .append("0x").append(HexDump.toHex( getUnits ())) - .append(" (").append( getUnits() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - - buffer.append("[/UNITS]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeShort(field_1_units); - } - - protected int getDataSize() { - return 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - UnitsRecord rec = new UnitsRecord(); - - rec.field_1_units = field_1_units; - return rec; - } - - - - - /** - * Get the units field for the Units record. - */ - public short getUnits() - { - return field_1_units; - } - - /** - * Set the units field for the Units record. - */ - public void setUnits(short field_1_units) - { - this.field_1_units = field_1_units; - } -} diff --git a/src/java/org/apache/poi/hssf/record/ValueRangeRecord.java b/src/java/org/apache/poi/hssf/record/ValueRangeRecord.java deleted file mode 100644 index f1df0dde58..0000000000 --- a/src/java/org/apache/poi/hssf/record/ValueRangeRecord.java +++ /dev/null @@ -1,395 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.HexDump; -import org.apache.poi.util.LittleEndianOutput; - -/** - * The value range record defines the range of the value axis.

- * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class ValueRangeRecord extends StandardRecord { - public final static short sid = 0x101f; - - private static final BitField automaticMinimum = BitFieldFactory.getInstance(0x0001); - private static final BitField automaticMaximum = BitFieldFactory.getInstance(0x0002); - private static final BitField automaticMajor = BitFieldFactory.getInstance(0x0004); - private static final BitField automaticMinor = BitFieldFactory.getInstance(0x0008); - private static final BitField automaticCategoryCrossing = BitFieldFactory.getInstance(0x0010); - private static final BitField logarithmicScale = BitFieldFactory.getInstance(0x0020); - private static final BitField valuesInReverse = BitFieldFactory.getInstance(0x0040); - private static final BitField crossCategoryAxisAtMaximum = BitFieldFactory.getInstance(0x0080); - private static final BitField reserved = BitFieldFactory.getInstance(0x0100); - - private double field_1_minimumAxisValue; - private double field_2_maximumAxisValue; - private double field_3_majorIncrement; - private double field_4_minorIncrement; - private double field_5_categoryAxisCross; - private short field_6_options; - - - public ValueRangeRecord() - { - - } - - public ValueRangeRecord(RecordInputStream in) - { - field_1_minimumAxisValue = in.readDouble(); - field_2_maximumAxisValue = in.readDouble(); - field_3_majorIncrement = in.readDouble(); - field_4_minorIncrement = in.readDouble(); - field_5_categoryAxisCross = in.readDouble(); - field_6_options = in.readShort(); - - } - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[VALUERANGE]\n"); - buffer.append(" .minimumAxisValue = ") - .append(" (").append( getMinimumAxisValue() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .maximumAxisValue = ") - .append(" (").append( getMaximumAxisValue() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .majorIncrement = ") - .append(" (").append( getMajorIncrement() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .minorIncrement = ") - .append(" (").append( getMinorIncrement() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .categoryAxisCross = ") - .append(" (").append( getCategoryAxisCross() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .options = ") - .append("0x").append(HexDump.toHex( getOptions ())) - .append(" (").append( getOptions() ).append(" )"); - buffer.append(System.getProperty("line.separator")); - buffer.append(" .automaticMinimum = ").append(isAutomaticMinimum()).append('\n'); - buffer.append(" .automaticMaximum = ").append(isAutomaticMaximum()).append('\n'); - buffer.append(" .automaticMajor = ").append(isAutomaticMajor()).append('\n'); - buffer.append(" .automaticMinor = ").append(isAutomaticMinor()).append('\n'); - buffer.append(" .automaticCategoryCrossing = ").append(isAutomaticCategoryCrossing()).append('\n'); - buffer.append(" .logarithmicScale = ").append(isLogarithmicScale()).append('\n'); - buffer.append(" .valuesInReverse = ").append(isValuesInReverse()).append('\n'); - buffer.append(" .crossCategoryAxisAtMaximum = ").append(isCrossCategoryAxisAtMaximum()).append('\n'); - buffer.append(" .reserved = ").append(isReserved()).append('\n'); - - buffer.append("[/VALUERANGE]\n"); - return buffer.toString(); - } - - public void serialize(LittleEndianOutput out) { - out.writeDouble(field_1_minimumAxisValue); - out.writeDouble(field_2_maximumAxisValue); - out.writeDouble(field_3_majorIncrement); - out.writeDouble(field_4_minorIncrement); - out.writeDouble(field_5_categoryAxisCross); - out.writeShort(field_6_options); - } - - protected int getDataSize() { - return 8 + 8 + 8 + 8 + 8 + 2; - } - - public short getSid() - { - return sid; - } - - public Object clone() { - ValueRangeRecord rec = new ValueRangeRecord(); - - rec.field_1_minimumAxisValue = field_1_minimumAxisValue; - rec.field_2_maximumAxisValue = field_2_maximumAxisValue; - rec.field_3_majorIncrement = field_3_majorIncrement; - rec.field_4_minorIncrement = field_4_minorIncrement; - rec.field_5_categoryAxisCross = field_5_categoryAxisCross; - rec.field_6_options = field_6_options; - return rec; - } - - - - - /** - * Get the minimum axis value field for the ValueRange record. - */ - public double getMinimumAxisValue() - { - return field_1_minimumAxisValue; - } - - /** - * Set the minimum axis value field for the ValueRange record. - */ - public void setMinimumAxisValue(double field_1_minimumAxisValue) - { - this.field_1_minimumAxisValue = field_1_minimumAxisValue; - } - - /** - * Get the maximum axis value field for the ValueRange record. - */ - public double getMaximumAxisValue() - { - return field_2_maximumAxisValue; - } - - /** - * Set the maximum axis value field for the ValueRange record. - */ - public void setMaximumAxisValue(double field_2_maximumAxisValue) - { - this.field_2_maximumAxisValue = field_2_maximumAxisValue; - } - - /** - * Get the major increment field for the ValueRange record. - */ - public double getMajorIncrement() - { - return field_3_majorIncrement; - } - - /** - * Set the major increment field for the ValueRange record. - */ - public void setMajorIncrement(double field_3_majorIncrement) - { - this.field_3_majorIncrement = field_3_majorIncrement; - } - - /** - * Get the minor increment field for the ValueRange record. - */ - public double getMinorIncrement() - { - return field_4_minorIncrement; - } - - /** - * Set the minor increment field for the ValueRange record. - */ - public void setMinorIncrement(double field_4_minorIncrement) - { - this.field_4_minorIncrement = field_4_minorIncrement; - } - - /** - * Get the category axis cross field for the ValueRange record. - */ - public double getCategoryAxisCross() - { - return field_5_categoryAxisCross; - } - - /** - * Set the category axis cross field for the ValueRange record. - */ - public void setCategoryAxisCross(double field_5_categoryAxisCross) - { - this.field_5_categoryAxisCross = field_5_categoryAxisCross; - } - - /** - * Get the options field for the ValueRange record. - */ - public short getOptions() - { - return field_6_options; - } - - /** - * Set the options field for the ValueRange record. - */ - public void setOptions(short field_6_options) - { - this.field_6_options = field_6_options; - } - - /** - * Sets the automatic minimum field value. - * automatic minimum value selected - */ - public void setAutomaticMinimum(boolean value) - { - field_6_options = automaticMinimum.setShortBoolean(field_6_options, value); - } - - /** - * automatic minimum value selected - * @return the automatic minimum field value. - */ - public boolean isAutomaticMinimum() - { - return automaticMinimum.isSet(field_6_options); - } - - /** - * Sets the automatic maximum field value. - * automatic maximum value selected - */ - public void setAutomaticMaximum(boolean value) - { - field_6_options = automaticMaximum.setShortBoolean(field_6_options, value); - } - - /** - * automatic maximum value selected - * @return the automatic maximum field value. - */ - public boolean isAutomaticMaximum() - { - return automaticMaximum.isSet(field_6_options); - } - - /** - * Sets the automatic major field value. - * automatic major unit selected - */ - public void setAutomaticMajor(boolean value) - { - field_6_options = automaticMajor.setShortBoolean(field_6_options, value); - } - - /** - * automatic major unit selected - * @return the automatic major field value. - */ - public boolean isAutomaticMajor() - { - return automaticMajor.isSet(field_6_options); - } - - /** - * Sets the automatic minor field value. - * automatic minor unit selected - */ - public void setAutomaticMinor(boolean value) - { - field_6_options = automaticMinor.setShortBoolean(field_6_options, value); - } - - /** - * automatic minor unit selected - * @return the automatic minor field value. - */ - public boolean isAutomaticMinor() - { - return automaticMinor.isSet(field_6_options); - } - - /** - * Sets the automatic category crossing field value. - * category crossing point is automatically selected - */ - public void setAutomaticCategoryCrossing(boolean value) - { - field_6_options = automaticCategoryCrossing.setShortBoolean(field_6_options, value); - } - - /** - * category crossing point is automatically selected - * @return the automatic category crossing field value. - */ - public boolean isAutomaticCategoryCrossing() - { - return automaticCategoryCrossing.isSet(field_6_options); - } - - /** - * Sets the logarithmic scale field value. - * use logarithmic scale - */ - public void setLogarithmicScale(boolean value) - { - field_6_options = logarithmicScale.setShortBoolean(field_6_options, value); - } - - /** - * use logarithmic scale - * @return the logarithmic scale field value. - */ - public boolean isLogarithmicScale() - { - return logarithmicScale.isSet(field_6_options); - } - - /** - * Sets the values in reverse field value. - * values are reverses in graph - */ - public void setValuesInReverse(boolean value) - { - field_6_options = valuesInReverse.setShortBoolean(field_6_options, value); - } - - /** - * values are reverses in graph - * @return the values in reverse field value. - */ - public boolean isValuesInReverse() - { - return valuesInReverse.isSet(field_6_options); - } - - /** - * Sets the cross category axis at maximum field value. - * category axis to cross at maximum value - */ - public void setCrossCategoryAxisAtMaximum(boolean value) - { - field_6_options = crossCategoryAxisAtMaximum.setShortBoolean(field_6_options, value); - } - - /** - * category axis to cross at maximum value - * @return the cross category axis at maximum field value. - */ - public boolean isCrossCategoryAxisAtMaximum() - { - return crossCategoryAxisAtMaximum.isSet(field_6_options); - } - - /** - * Sets the reserved field value. - * reserved, must equal 1 (excel dev. guide says otherwise) - */ - public void setReserved(boolean value) - { - field_6_options = reserved.setShortBoolean(field_6_options, value); - } - - /** - * reserved, must equal 1 (excel dev. guide says otherwise) - * @return the reserved field value. - */ - public boolean isReserved() - { - return reserved.isSet(field_6_options); - } -} diff --git a/src/java/org/apache/poi/hssf/record/chart/AreaFormatRecord.java b/src/java/org/apache/poi/hssf/record/chart/AreaFormatRecord.java new file mode 100644 index 0000000000..661d2dc274 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/AreaFormatRecord.java @@ -0,0 +1,262 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.BitField; +import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The area format record is used to define the colours and patterns for an area.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class AreaFormatRecord extends StandardRecord { + public final static short sid = 0x100A; + + private static final BitField automatic = BitFieldFactory.getInstance(0x1); + private static final BitField invert = BitFieldFactory.getInstance(0x2); + + private int field_1_foregroundColor; + private int field_2_backgroundColor; + private short field_3_pattern; + private short field_4_formatFlags; + private short field_5_forecolorIndex; + private short field_6_backcolorIndex; + + + public AreaFormatRecord() + { + + } + + public AreaFormatRecord(RecordInputStream in) + { + field_1_foregroundColor = in.readInt(); + field_2_backgroundColor = in.readInt(); + field_3_pattern = in.readShort(); + field_4_formatFlags = in.readShort(); + field_5_forecolorIndex = in.readShort(); + field_6_backcolorIndex = in.readShort(); + + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[AREAFORMAT]\n"); + buffer.append(" .foregroundColor = ") + .append("0x").append(HexDump.toHex( getForegroundColor ())) + .append(" (").append( getForegroundColor() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .backgroundColor = ") + .append("0x").append(HexDump.toHex( getBackgroundColor ())) + .append(" (").append( getBackgroundColor() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .pattern = ") + .append("0x").append(HexDump.toHex( getPattern ())) + .append(" (").append( getPattern() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .formatFlags = ") + .append("0x").append(HexDump.toHex( getFormatFlags ())) + .append(" (").append( getFormatFlags() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .automatic = ").append(isAutomatic()).append('\n'); + buffer.append(" .invert = ").append(isInvert()).append('\n'); + buffer.append(" .forecolorIndex = ") + .append("0x").append(HexDump.toHex( getForecolorIndex ())) + .append(" (").append( getForecolorIndex() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .backcolorIndex = ") + .append("0x").append(HexDump.toHex( getBackcolorIndex ())) + .append(" (").append( getBackcolorIndex() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/AREAFORMAT]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeInt(field_1_foregroundColor); + out.writeInt(field_2_backgroundColor); + out.writeShort(field_3_pattern); + out.writeShort(field_4_formatFlags); + out.writeShort(field_5_forecolorIndex); + out.writeShort(field_6_backcolorIndex); + } + + protected int getDataSize() { + return 4 + 4 + 2 + 2 + 2 + 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + AreaFormatRecord rec = new AreaFormatRecord(); + + rec.field_1_foregroundColor = field_1_foregroundColor; + rec.field_2_backgroundColor = field_2_backgroundColor; + rec.field_3_pattern = field_3_pattern; + rec.field_4_formatFlags = field_4_formatFlags; + rec.field_5_forecolorIndex = field_5_forecolorIndex; + rec.field_6_backcolorIndex = field_6_backcolorIndex; + return rec; + } + + + + + /** + * Get the foreground color field for the AreaFormat record. + */ + public int getForegroundColor() + { + return field_1_foregroundColor; + } + + /** + * Set the foreground color field for the AreaFormat record. + */ + public void setForegroundColor(int field_1_foregroundColor) + { + this.field_1_foregroundColor = field_1_foregroundColor; + } + + /** + * Get the background color field for the AreaFormat record. + */ + public int getBackgroundColor() + { + return field_2_backgroundColor; + } + + /** + * Set the background color field for the AreaFormat record. + */ + public void setBackgroundColor(int field_2_backgroundColor) + { + this.field_2_backgroundColor = field_2_backgroundColor; + } + + /** + * Get the pattern field for the AreaFormat record. + */ + public short getPattern() + { + return field_3_pattern; + } + + /** + * Set the pattern field for the AreaFormat record. + */ + public void setPattern(short field_3_pattern) + { + this.field_3_pattern = field_3_pattern; + } + + /** + * Get the format flags field for the AreaFormat record. + */ + public short getFormatFlags() + { + return field_4_formatFlags; + } + + /** + * Set the format flags field for the AreaFormat record. + */ + public void setFormatFlags(short field_4_formatFlags) + { + this.field_4_formatFlags = field_4_formatFlags; + } + + /** + * Get the forecolor index field for the AreaFormat record. + */ + public short getForecolorIndex() + { + return field_5_forecolorIndex; + } + + /** + * Set the forecolor index field for the AreaFormat record. + */ + public void setForecolorIndex(short field_5_forecolorIndex) + { + this.field_5_forecolorIndex = field_5_forecolorIndex; + } + + /** + * Get the backcolor index field for the AreaFormat record. + */ + public short getBackcolorIndex() + { + return field_6_backcolorIndex; + } + + /** + * Set the backcolor index field for the AreaFormat record. + */ + public void setBackcolorIndex(short field_6_backcolorIndex) + { + this.field_6_backcolorIndex = field_6_backcolorIndex; + } + + /** + * Sets the automatic field value. + * automatic formatting + */ + public void setAutomatic(boolean value) + { + field_4_formatFlags = automatic.setShortBoolean(field_4_formatFlags, value); + } + + /** + * automatic formatting + * @return the automatic field value. + */ + public boolean isAutomatic() + { + return automatic.isSet(field_4_formatFlags); + } + + /** + * Sets the invert field value. + * swap foreground and background colours when data is negative + */ + public void setInvert(boolean value) + { + field_4_formatFlags = invert.setShortBoolean(field_4_formatFlags, value); + } + + /** + * swap foreground and background colours when data is negative + * @return the invert field value. + */ + public boolean isInvert() + { + return invert.isSet(field_4_formatFlags); + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/AreaRecord.java b/src/java/org/apache/poi/hssf/record/chart/AreaRecord.java new file mode 100644 index 0000000000..7d763fa8ec --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/AreaRecord.java @@ -0,0 +1,160 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.BitField; +import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The area record is used to define a area chart.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class AreaRecord extends StandardRecord { + public final static short sid = 0x101A; + private short field_1_formatFlags; + private static final BitField stacked = BitFieldFactory.getInstance(0x1); + private static final BitField displayAsPercentage = BitFieldFactory.getInstance(0x2); + private static final BitField shadow = BitFieldFactory.getInstance(0x4); + + + public AreaRecord() + { + + } + + public AreaRecord(RecordInputStream in) + { + + field_1_formatFlags = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[AREA]\n"); + buffer.append(" .formatFlags = ") + .append("0x").append(HexDump.toHex( getFormatFlags ())) + .append(" (").append( getFormatFlags() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .stacked = ").append(isStacked()).append('\n'); + buffer.append(" .displayAsPercentage = ").append(isDisplayAsPercentage()).append('\n'); + buffer.append(" .shadow = ").append(isShadow()).append('\n'); + + buffer.append("[/AREA]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_formatFlags); + } + + protected int getDataSize() { + return 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + AreaRecord rec = new AreaRecord(); + + rec.field_1_formatFlags = field_1_formatFlags; + return rec; + } + + + + + /** + * Get the format flags field for the Area record. + */ + public short getFormatFlags() + { + return field_1_formatFlags; + } + + /** + * Set the format flags field for the Area record. + */ + public void setFormatFlags(short field_1_formatFlags) + { + this.field_1_formatFlags = field_1_formatFlags; + } + + /** + * Sets the stacked field value. + * series is stacked + */ + public void setStacked(boolean value) + { + field_1_formatFlags = stacked.setShortBoolean(field_1_formatFlags, value); + } + + /** + * series is stacked + * @return the stacked field value. + */ + public boolean isStacked() + { + return stacked.isSet(field_1_formatFlags); + } + + /** + * Sets the display as percentage field value. + * results displayed as percentages + */ + public void setDisplayAsPercentage(boolean value) + { + field_1_formatFlags = displayAsPercentage.setShortBoolean(field_1_formatFlags, value); + } + + /** + * results displayed as percentages + * @return the display as percentage field value. + */ + public boolean isDisplayAsPercentage() + { + return displayAsPercentage.isSet(field_1_formatFlags); + } + + /** + * Sets the shadow field value. + * display a shadow for the chart + */ + public void setShadow(boolean value) + { + field_1_formatFlags = shadow.setShortBoolean(field_1_formatFlags, value); + } + + /** + * display a shadow for the chart + * @return the shadow field value. + */ + public boolean isShadow() + { + return shadow.isSet(field_1_formatFlags); + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/AxisLineFormatRecord.java b/src/java/org/apache/poi/hssf/record/chart/AxisLineFormatRecord.java new file mode 100644 index 0000000000..737b474e67 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/AxisLineFormatRecord.java @@ -0,0 +1,114 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The axis line format record defines the axis type details.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class AxisLineFormatRecord extends StandardRecord { + public final static short sid = 0x1021; + private short field_1_axisType; + public final static short AXIS_TYPE_AXIS_LINE = 0; + public final static short AXIS_TYPE_MAJOR_GRID_LINE = 1; + public final static short AXIS_TYPE_MINOR_GRID_LINE = 2; + public final static short AXIS_TYPE_WALLS_OR_FLOOR = 3; + + + public AxisLineFormatRecord() + { + + } + + public AxisLineFormatRecord(RecordInputStream in) + { + field_1_axisType = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[AXISLINEFORMAT]\n"); + buffer.append(" .axisType = ") + .append("0x").append(HexDump.toHex( getAxisType ())) + .append(" (").append( getAxisType() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/AXISLINEFORMAT]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_axisType); + } + + protected int getDataSize() { + return 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + AxisLineFormatRecord rec = new AxisLineFormatRecord(); + + rec.field_1_axisType = field_1_axisType; + return rec; + } + + + + + /** + * Get the axis type field for the AxisLineFormat record. + * + * @return One of + * AXIS_TYPE_AXIS_LINE + * AXIS_TYPE_MAJOR_GRID_LINE + * AXIS_TYPE_MINOR_GRID_LINE + * AXIS_TYPE_WALLS_OR_FLOOR + */ + public short getAxisType() + { + return field_1_axisType; + } + + /** + * Set the axis type field for the AxisLineFormat record. + * + * @param field_1_axisType + * One of + * AXIS_TYPE_AXIS_LINE + * AXIS_TYPE_MAJOR_GRID_LINE + * AXIS_TYPE_MINOR_GRID_LINE + * AXIS_TYPE_WALLS_OR_FLOOR + */ + public void setAxisType(short field_1_axisType) + { + this.field_1_axisType = field_1_axisType; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/AxisOptionsRecord.java b/src/java/org/apache/poi/hssf/record/chart/AxisOptionsRecord.java new file mode 100644 index 0000000000..0b4f9dd4b7 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/AxisOptionsRecord.java @@ -0,0 +1,453 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.BitField; +import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The axis options record provides unit information and other various tidbits about the axis.

+ * + * @author Andrew C. Oliver(acoliver at apache.org) + */ +public final class AxisOptionsRecord extends StandardRecord { + public final static short sid = 0x1062; + + private static final BitField defaultMinimum = BitFieldFactory.getInstance(0x01); + private static final BitField defaultMaximum = BitFieldFactory.getInstance(0x02); + private static final BitField defaultMajor = BitFieldFactory.getInstance(0x04); + private static final BitField defaultMinorUnit = BitFieldFactory.getInstance(0x08); + private static final BitField isDate = BitFieldFactory.getInstance(0x10); + private static final BitField defaultBase = BitFieldFactory.getInstance(0x20); + private static final BitField defaultCross = BitFieldFactory.getInstance(0x40); + private static final BitField defaultDateSettings = BitFieldFactory.getInstance(0x80); + + private short field_1_minimumCategory; + private short field_2_maximumCategory; + private short field_3_majorUnitValue; + private short field_4_majorUnit; + private short field_5_minorUnitValue; + private short field_6_minorUnit; + private short field_7_baseUnit; + private short field_8_crossingPoint; + private short field_9_options; + + + public AxisOptionsRecord() + { + + } + + public AxisOptionsRecord(RecordInputStream in) + { + field_1_minimumCategory = in.readShort(); + field_2_maximumCategory = in.readShort(); + field_3_majorUnitValue = in.readShort(); + field_4_majorUnit = in.readShort(); + field_5_minorUnitValue = in.readShort(); + field_6_minorUnit = in.readShort(); + field_7_baseUnit = in.readShort(); + field_8_crossingPoint = in.readShort(); + field_9_options = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[AXCEXT]\n"); + buffer.append(" .minimumCategory = ") + .append("0x").append(HexDump.toHex( getMinimumCategory ())) + .append(" (").append( getMinimumCategory() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .maximumCategory = ") + .append("0x").append(HexDump.toHex( getMaximumCategory ())) + .append(" (").append( getMaximumCategory() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .majorUnitValue = ") + .append("0x").append(HexDump.toHex( getMajorUnitValue ())) + .append(" (").append( getMajorUnitValue() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .majorUnit = ") + .append("0x").append(HexDump.toHex( getMajorUnit ())) + .append(" (").append( getMajorUnit() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .minorUnitValue = ") + .append("0x").append(HexDump.toHex( getMinorUnitValue ())) + .append(" (").append( getMinorUnitValue() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .minorUnit = ") + .append("0x").append(HexDump.toHex( getMinorUnit ())) + .append(" (").append( getMinorUnit() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .baseUnit = ") + .append("0x").append(HexDump.toHex( getBaseUnit ())) + .append(" (").append( getBaseUnit() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .crossingPoint = ") + .append("0x").append(HexDump.toHex( getCrossingPoint ())) + .append(" (").append( getCrossingPoint() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .options = ") + .append("0x").append(HexDump.toHex( getOptions ())) + .append(" (").append( getOptions() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .defaultMinimum = ").append(isDefaultMinimum()).append('\n'); + buffer.append(" .defaultMaximum = ").append(isDefaultMaximum()).append('\n'); + buffer.append(" .defaultMajor = ").append(isDefaultMajor()).append('\n'); + buffer.append(" .defaultMinorUnit = ").append(isDefaultMinorUnit()).append('\n'); + buffer.append(" .isDate = ").append(isIsDate()).append('\n'); + buffer.append(" .defaultBase = ").append(isDefaultBase()).append('\n'); + buffer.append(" .defaultCross = ").append(isDefaultCross()).append('\n'); + buffer.append(" .defaultDateSettings = ").append(isDefaultDateSettings()).append('\n'); + + buffer.append("[/AXCEXT]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_minimumCategory); + out.writeShort(field_2_maximumCategory); + out.writeShort(field_3_majorUnitValue); + out.writeShort(field_4_majorUnit); + out.writeShort(field_5_minorUnitValue); + out.writeShort(field_6_minorUnit); + out.writeShort(field_7_baseUnit); + out.writeShort(field_8_crossingPoint); + out.writeShort(field_9_options); + } + + protected int getDataSize() { + return 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + AxisOptionsRecord rec = new AxisOptionsRecord(); + + rec.field_1_minimumCategory = field_1_minimumCategory; + rec.field_2_maximumCategory = field_2_maximumCategory; + rec.field_3_majorUnitValue = field_3_majorUnitValue; + rec.field_4_majorUnit = field_4_majorUnit; + rec.field_5_minorUnitValue = field_5_minorUnitValue; + rec.field_6_minorUnit = field_6_minorUnit; + rec.field_7_baseUnit = field_7_baseUnit; + rec.field_8_crossingPoint = field_8_crossingPoint; + rec.field_9_options = field_9_options; + return rec; + } + + + + + /** + * Get the minimum category field for the AxisOptions record. + */ + public short getMinimumCategory() + { + return field_1_minimumCategory; + } + + /** + * Set the minimum category field for the AxisOptions record. + */ + public void setMinimumCategory(short field_1_minimumCategory) + { + this.field_1_minimumCategory = field_1_minimumCategory; + } + + /** + * Get the maximum category field for the AxisOptions record. + */ + public short getMaximumCategory() + { + return field_2_maximumCategory; + } + + /** + * Set the maximum category field for the AxisOptions record. + */ + public void setMaximumCategory(short field_2_maximumCategory) + { + this.field_2_maximumCategory = field_2_maximumCategory; + } + + /** + * Get the major unit value field for the AxisOptions record. + */ + public short getMajorUnitValue() + { + return field_3_majorUnitValue; + } + + /** + * Set the major unit value field for the AxisOptions record. + */ + public void setMajorUnitValue(short field_3_majorUnitValue) + { + this.field_3_majorUnitValue = field_3_majorUnitValue; + } + + /** + * Get the major unit field for the AxisOptions record. + */ + public short getMajorUnit() + { + return field_4_majorUnit; + } + + /** + * Set the major unit field for the AxisOptions record. + */ + public void setMajorUnit(short field_4_majorUnit) + { + this.field_4_majorUnit = field_4_majorUnit; + } + + /** + * Get the minor unit value field for the AxisOptions record. + */ + public short getMinorUnitValue() + { + return field_5_minorUnitValue; + } + + /** + * Set the minor unit value field for the AxisOptions record. + */ + public void setMinorUnitValue(short field_5_minorUnitValue) + { + this.field_5_minorUnitValue = field_5_minorUnitValue; + } + + /** + * Get the minor unit field for the AxisOptions record. + */ + public short getMinorUnit() + { + return field_6_minorUnit; + } + + /** + * Set the minor unit field for the AxisOptions record. + */ + public void setMinorUnit(short field_6_minorUnit) + { + this.field_6_minorUnit = field_6_minorUnit; + } + + /** + * Get the base unit field for the AxisOptions record. + */ + public short getBaseUnit() + { + return field_7_baseUnit; + } + + /** + * Set the base unit field for the AxisOptions record. + */ + public void setBaseUnit(short field_7_baseUnit) + { + this.field_7_baseUnit = field_7_baseUnit; + } + + /** + * Get the crossing point field for the AxisOptions record. + */ + public short getCrossingPoint() + { + return field_8_crossingPoint; + } + + /** + * Set the crossing point field for the AxisOptions record. + */ + public void setCrossingPoint(short field_8_crossingPoint) + { + this.field_8_crossingPoint = field_8_crossingPoint; + } + + /** + * Get the options field for the AxisOptions record. + */ + public short getOptions() + { + return field_9_options; + } + + /** + * Set the options field for the AxisOptions record. + */ + public void setOptions(short field_9_options) + { + this.field_9_options = field_9_options; + } + + /** + * Sets the default minimum field value. + * use the default minimum category + */ + public void setDefaultMinimum(boolean value) + { + field_9_options = defaultMinimum.setShortBoolean(field_9_options, value); + } + + /** + * use the default minimum category + * @return the default minimum field value. + */ + public boolean isDefaultMinimum() + { + return defaultMinimum.isSet(field_9_options); + } + + /** + * Sets the default maximum field value. + * use the default maximum category + */ + public void setDefaultMaximum(boolean value) + { + field_9_options = defaultMaximum.setShortBoolean(field_9_options, value); + } + + /** + * use the default maximum category + * @return the default maximum field value. + */ + public boolean isDefaultMaximum() + { + return defaultMaximum.isSet(field_9_options); + } + + /** + * Sets the default major field value. + * use the default major unit + */ + public void setDefaultMajor(boolean value) + { + field_9_options = defaultMajor.setShortBoolean(field_9_options, value); + } + + /** + * use the default major unit + * @return the default major field value. + */ + public boolean isDefaultMajor() + { + return defaultMajor.isSet(field_9_options); + } + + /** + * Sets the default minor unit field value. + * use the default minor unit + */ + public void setDefaultMinorUnit(boolean value) + { + field_9_options = defaultMinorUnit.setShortBoolean(field_9_options, value); + } + + /** + * use the default minor unit + * @return the default minor unit field value. + */ + public boolean isDefaultMinorUnit() + { + return defaultMinorUnit.isSet(field_9_options); + } + + /** + * Sets the isDate field value. + * this is a date axis + */ + public void setIsDate(boolean value) + { + field_9_options = isDate.setShortBoolean(field_9_options, value); + } + + /** + * this is a date axis + * @return the isDate field value. + */ + public boolean isIsDate() + { + return isDate.isSet(field_9_options); + } + + /** + * Sets the default base field value. + * use the default base unit + */ + public void setDefaultBase(boolean value) + { + field_9_options = defaultBase.setShortBoolean(field_9_options, value); + } + + /** + * use the default base unit + * @return the default base field value. + */ + public boolean isDefaultBase() + { + return defaultBase.isSet(field_9_options); + } + + /** + * Sets the default cross field value. + * use the default crossing point + */ + public void setDefaultCross(boolean value) + { + field_9_options = defaultCross.setShortBoolean(field_9_options, value); + } + + /** + * use the default crossing point + * @return the default cross field value. + */ + public boolean isDefaultCross() + { + return defaultCross.isSet(field_9_options); + } + + /** + * Sets the default date settings field value. + * use default date setttings for this axis + */ + public void setDefaultDateSettings(boolean value) + { + field_9_options = defaultDateSettings.setShortBoolean(field_9_options, value); + } + + /** + * use default date setttings for this axis + * @return the default date settings field value. + */ + public boolean isDefaultDateSettings() + { + return defaultDateSettings.isSet(field_9_options); + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/AxisParentRecord.java b/src/java/org/apache/poi/hssf/record/chart/AxisParentRecord.java new file mode 100644 index 0000000000..e0d6d5b585 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/AxisParentRecord.java @@ -0,0 +1,204 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The axis size and location

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class AxisParentRecord extends StandardRecord { + public final static short sid = 0x1041; + private short field_1_axisType; + public final static short AXIS_TYPE_MAIN = 0; + public final static short AXIS_TYPE_SECONDARY = 1; + private int field_2_x; + private int field_3_y; + private int field_4_width; + private int field_5_height; + + + public AxisParentRecord() + { + + } + + public AxisParentRecord(RecordInputStream in) + { + field_1_axisType = in.readShort(); + field_2_x = in.readInt(); + field_3_y = in.readInt(); + field_4_width = in.readInt(); + field_5_height = in.readInt(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[AXISPARENT]\n"); + buffer.append(" .axisType = ") + .append("0x").append(HexDump.toHex( getAxisType ())) + .append(" (").append( getAxisType() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .x = ") + .append("0x").append(HexDump.toHex( getX ())) + .append(" (").append( getX() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .y = ") + .append("0x").append(HexDump.toHex( getY ())) + .append(" (").append( getY() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .width = ") + .append("0x").append(HexDump.toHex( getWidth ())) + .append(" (").append( getWidth() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .height = ") + .append("0x").append(HexDump.toHex( getHeight ())) + .append(" (").append( getHeight() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/AXISPARENT]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_axisType); + out.writeInt(field_2_x); + out.writeInt(field_3_y); + out.writeInt(field_4_width); + out.writeInt(field_5_height); + } + + protected int getDataSize() { + return 2 + 4 + 4 + 4 + 4; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + AxisParentRecord rec = new AxisParentRecord(); + + rec.field_1_axisType = field_1_axisType; + rec.field_2_x = field_2_x; + rec.field_3_y = field_3_y; + rec.field_4_width = field_4_width; + rec.field_5_height = field_5_height; + return rec; + } + + + + + /** + * Get the axis type field for the AxisParent record. + * + * @return One of + * AXIS_TYPE_MAIN + * AXIS_TYPE_SECONDARY + */ + public short getAxisType() + { + return field_1_axisType; + } + + /** + * Set the axis type field for the AxisParent record. + * + * @param field_1_axisType + * One of + * AXIS_TYPE_MAIN + * AXIS_TYPE_SECONDARY + */ + public void setAxisType(short field_1_axisType) + { + this.field_1_axisType = field_1_axisType; + } + + /** + * Get the x field for the AxisParent record. + */ + public int getX() + { + return field_2_x; + } + + /** + * Set the x field for the AxisParent record. + */ + public void setX(int field_2_x) + { + this.field_2_x = field_2_x; + } + + /** + * Get the y field for the AxisParent record. + */ + public int getY() + { + return field_3_y; + } + + /** + * Set the y field for the AxisParent record. + */ + public void setY(int field_3_y) + { + this.field_3_y = field_3_y; + } + + /** + * Get the width field for the AxisParent record. + */ + public int getWidth() + { + return field_4_width; + } + + /** + * Set the width field for the AxisParent record. + */ + public void setWidth(int field_4_width) + { + this.field_4_width = field_4_width; + } + + /** + * Get the height field for the AxisParent record. + */ + public int getHeight() + { + return field_5_height; + } + + /** + * Set the height field for the AxisParent record. + */ + public void setHeight(int field_5_height) + { + this.field_5_height = field_5_height; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/AxisRecord.java b/src/java/org/apache/poi/hssf/record/chart/AxisRecord.java new file mode 100644 index 0000000000..4eb92dc51d --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/AxisRecord.java @@ -0,0 +1,207 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The axis record defines the type of an axis.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class AxisRecord extends StandardRecord { + public final static short sid = 0x101d; + private short field_1_axisType; + public final static short AXIS_TYPE_CATEGORY_OR_X_AXIS = 0; + public final static short AXIS_TYPE_VALUE_AXIS = 1; + public final static short AXIS_TYPE_SERIES_AXIS = 2; + private int field_2_reserved1; + private int field_3_reserved2; + private int field_4_reserved3; + private int field_5_reserved4; + + + public AxisRecord() + { + + } + + public AxisRecord(RecordInputStream in) + { + field_1_axisType = in.readShort(); + field_2_reserved1 = in.readInt(); + field_3_reserved2 = in.readInt(); + field_4_reserved3 = in.readInt(); + field_5_reserved4 = in.readInt(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[AXIS]\n"); + buffer.append(" .axisType = ") + .append("0x").append(HexDump.toHex( getAxisType ())) + .append(" (").append( getAxisType() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .reserved1 = ") + .append("0x").append(HexDump.toHex( getReserved1 ())) + .append(" (").append( getReserved1() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .reserved2 = ") + .append("0x").append(HexDump.toHex( getReserved2 ())) + .append(" (").append( getReserved2() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .reserved3 = ") + .append("0x").append(HexDump.toHex( getReserved3 ())) + .append(" (").append( getReserved3() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .reserved4 = ") + .append("0x").append(HexDump.toHex( getReserved4 ())) + .append(" (").append( getReserved4() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/AXIS]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_axisType); + out.writeInt(field_2_reserved1); + out.writeInt(field_3_reserved2); + out.writeInt(field_4_reserved3); + out.writeInt(field_5_reserved4); + } + + protected int getDataSize() { + return 2 + 4 + 4 + 4 + 4; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + AxisRecord rec = new AxisRecord(); + + rec.field_1_axisType = field_1_axisType; + rec.field_2_reserved1 = field_2_reserved1; + rec.field_3_reserved2 = field_3_reserved2; + rec.field_4_reserved3 = field_4_reserved3; + rec.field_5_reserved4 = field_5_reserved4; + return rec; + } + + + + + /** + * Get the axis type field for the Axis record. + * + * @return One of + * AXIS_TYPE_CATEGORY_OR_X_AXIS + * AXIS_TYPE_VALUE_AXIS + * AXIS_TYPE_SERIES_AXIS + */ + public short getAxisType() + { + return field_1_axisType; + } + + /** + * Set the axis type field for the Axis record. + * + * @param field_1_axisType + * One of + * AXIS_TYPE_CATEGORY_OR_X_AXIS + * AXIS_TYPE_VALUE_AXIS + * AXIS_TYPE_SERIES_AXIS + */ + public void setAxisType(short field_1_axisType) + { + this.field_1_axisType = field_1_axisType; + } + + /** + * Get the reserved1 field for the Axis record. + */ + public int getReserved1() + { + return field_2_reserved1; + } + + /** + * Set the reserved1 field for the Axis record. + */ + public void setReserved1(int field_2_reserved1) + { + this.field_2_reserved1 = field_2_reserved1; + } + + /** + * Get the reserved2 field for the Axis record. + */ + public int getReserved2() + { + return field_3_reserved2; + } + + /** + * Set the reserved2 field for the Axis record. + */ + public void setReserved2(int field_3_reserved2) + { + this.field_3_reserved2 = field_3_reserved2; + } + + /** + * Get the reserved3 field for the Axis record. + */ + public int getReserved3() + { + return field_4_reserved3; + } + + /** + * Set the reserved3 field for the Axis record. + */ + public void setReserved3(int field_4_reserved3) + { + this.field_4_reserved3 = field_4_reserved3; + } + + /** + * Get the reserved4 field for the Axis record. + */ + public int getReserved4() + { + return field_5_reserved4; + } + + /** + * Set the reserved4 field for the Axis record. + */ + public void setReserved4(int field_5_reserved4) + { + this.field_5_reserved4 = field_5_reserved4; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/AxisUsedRecord.java b/src/java/org/apache/poi/hssf/record/chart/AxisUsedRecord.java new file mode 100644 index 0000000000..b05cf1b9bb --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/AxisUsedRecord.java @@ -0,0 +1,97 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The number of axes used on a chart.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class AxisUsedRecord extends StandardRecord { + public final static short sid = 0x1046; + private short field_1_numAxis; + + + public AxisUsedRecord() + { + + } + + public AxisUsedRecord(RecordInputStream in) + { + field_1_numAxis = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[AXISUSED]\n"); + buffer.append(" .numAxis = ") + .append("0x").append(HexDump.toHex( getNumAxis ())) + .append(" (").append( getNumAxis() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/AXISUSED]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_numAxis); + } + + protected int getDataSize() { + return 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + AxisUsedRecord rec = new AxisUsedRecord(); + + rec.field_1_numAxis = field_1_numAxis; + return rec; + } + + + + + /** + * Get the num axis field for the AxisUsed record. + */ + public short getNumAxis() + { + return field_1_numAxis; + } + + /** + * Set the num axis field for the AxisUsed record. + */ + public void setNumAxis(short field_1_numAxis) + { + this.field_1_numAxis = field_1_numAxis; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/BarRecord.java b/src/java/org/apache/poi/hssf/record/chart/BarRecord.java new file mode 100644 index 0000000000..297a27f127 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/BarRecord.java @@ -0,0 +1,229 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.BitField; +import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The bar record is used to define a bar chart.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class BarRecord extends StandardRecord { + public final static short sid = 0x1017; + + private static final BitField horizontal = BitFieldFactory.getInstance(0x1); + private static final BitField stacked = BitFieldFactory.getInstance(0x2); + private static final BitField displayAsPercentage = BitFieldFactory.getInstance(0x4); + private static final BitField shadow = BitFieldFactory.getInstance(0x8); + + private short field_1_barSpace; + private short field_2_categorySpace; + private short field_3_formatFlags; + + + public BarRecord() + { + + } + + public BarRecord(RecordInputStream in) + { + field_1_barSpace = in.readShort(); + field_2_categorySpace = in.readShort(); + field_3_formatFlags = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[BAR]\n"); + buffer.append(" .barSpace = ") + .append("0x").append(HexDump.toHex( getBarSpace ())) + .append(" (").append( getBarSpace() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .categorySpace = ") + .append("0x").append(HexDump.toHex( getCategorySpace ())) + .append(" (").append( getCategorySpace() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .formatFlags = ") + .append("0x").append(HexDump.toHex( getFormatFlags ())) + .append(" (").append( getFormatFlags() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .horizontal = ").append(isHorizontal()).append('\n'); + buffer.append(" .stacked = ").append(isStacked()).append('\n'); + buffer.append(" .displayAsPercentage = ").append(isDisplayAsPercentage()).append('\n'); + buffer.append(" .shadow = ").append(isShadow()).append('\n'); + + buffer.append("[/BAR]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_barSpace); + out.writeShort(field_2_categorySpace); + out.writeShort(field_3_formatFlags); + } + + protected int getDataSize() { + return 2 + 2 + 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + BarRecord rec = new BarRecord(); + + rec.field_1_barSpace = field_1_barSpace; + rec.field_2_categorySpace = field_2_categorySpace; + rec.field_3_formatFlags = field_3_formatFlags; + return rec; + } + + + + + /** + * Get the bar space field for the Bar record. + */ + public short getBarSpace() + { + return field_1_barSpace; + } + + /** + * Set the bar space field for the Bar record. + */ + public void setBarSpace(short field_1_barSpace) + { + this.field_1_barSpace = field_1_barSpace; + } + + /** + * Get the category space field for the Bar record. + */ + public short getCategorySpace() + { + return field_2_categorySpace; + } + + /** + * Set the category space field for the Bar record. + */ + public void setCategorySpace(short field_2_categorySpace) + { + this.field_2_categorySpace = field_2_categorySpace; + } + + /** + * Get the format flags field for the Bar record. + */ + public short getFormatFlags() + { + return field_3_formatFlags; + } + + /** + * Set the format flags field for the Bar record. + */ + public void setFormatFlags(short field_3_formatFlags) + { + this.field_3_formatFlags = field_3_formatFlags; + } + + /** + * Sets the horizontal field value. + * true to display horizontal bar charts, false for vertical + */ + public void setHorizontal(boolean value) + { + field_3_formatFlags = horizontal.setShortBoolean(field_3_formatFlags, value); + } + + /** + * true to display horizontal bar charts, false for vertical + * @return the horizontal field value. + */ + public boolean isHorizontal() + { + return horizontal.isSet(field_3_formatFlags); + } + + /** + * Sets the stacked field value. + * stack displayed values + */ + public void setStacked(boolean value) + { + field_3_formatFlags = stacked.setShortBoolean(field_3_formatFlags, value); + } + + /** + * stack displayed values + * @return the stacked field value. + */ + public boolean isStacked() + { + return stacked.isSet(field_3_formatFlags); + } + + /** + * Sets the display as percentage field value. + * display chart values as a percentage + */ + public void setDisplayAsPercentage(boolean value) + { + field_3_formatFlags = displayAsPercentage.setShortBoolean(field_3_formatFlags, value); + } + + /** + * display chart values as a percentage + * @return the display as percentage field value. + */ + public boolean isDisplayAsPercentage() + { + return displayAsPercentage.isSet(field_3_formatFlags); + } + + /** + * Sets the shadow field value. + * display a shadow for the chart + */ + public void setShadow(boolean value) + { + field_3_formatFlags = shadow.setShortBoolean(field_3_formatFlags, value); + } + + /** + * display a shadow for the chart + * @return the shadow field value. + */ + public boolean isShadow() + { + return shadow.isSet(field_3_formatFlags); + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/BeginRecord.java b/src/java/org/apache/poi/hssf/record/chart/BeginRecord.java new file mode 100644 index 0000000000..85e80f024c --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/BeginRecord.java @@ -0,0 +1,66 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The begin record defines the start of a block of records for a (grpahing + * data object. This record is matched with a corresponding EndRecord. + * + * @see EndRecord + * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class BeginRecord extends StandardRecord { + public static final short sid = 0x1033; + + public BeginRecord() + { + } + + /** + * @param in unused (since this record has no data) + */ + public BeginRecord(RecordInputStream in) + { + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[BEGIN]\n"); + buffer.append("[/BEGIN]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + } + + protected int getDataSize() { + return 0; + } + + public short getSid() + { + return sid; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/CategorySeriesAxisRecord.java b/src/java/org/apache/poi/hssf/record/chart/CategorySeriesAxisRecord.java new file mode 100644 index 0000000000..0278d5f3dc --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/CategorySeriesAxisRecord.java @@ -0,0 +1,233 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.BitField; +import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * This record refers to a category or series axis and is used to specify label/tickmark frequency.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class CategorySeriesAxisRecord extends StandardRecord { + public final static short sid = 0x1020; + + private static final BitField valueAxisCrossing = BitFieldFactory.getInstance(0x1); + private static final BitField crossesFarRight = BitFieldFactory.getInstance(0x2); + private static final BitField reversed = BitFieldFactory.getInstance(0x4); + + private short field_1_crossingPoint; + private short field_2_labelFrequency; + private short field_3_tickMarkFrequency; + private short field_4_options; + + + public CategorySeriesAxisRecord() + { + + } + + public CategorySeriesAxisRecord(RecordInputStream in) + { + field_1_crossingPoint = in.readShort(); + field_2_labelFrequency = in.readShort(); + field_3_tickMarkFrequency = in.readShort(); + field_4_options = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[CATSERRANGE]\n"); + buffer.append(" .crossingPoint = ") + .append("0x").append(HexDump.toHex( getCrossingPoint ())) + .append(" (").append( getCrossingPoint() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .labelFrequency = ") + .append("0x").append(HexDump.toHex( getLabelFrequency ())) + .append(" (").append( getLabelFrequency() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .tickMarkFrequency = ") + .append("0x").append(HexDump.toHex( getTickMarkFrequency ())) + .append(" (").append( getTickMarkFrequency() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .options = ") + .append("0x").append(HexDump.toHex( getOptions ())) + .append(" (").append( getOptions() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .valueAxisCrossing = ").append(isValueAxisCrossing()).append('\n'); + buffer.append(" .crossesFarRight = ").append(isCrossesFarRight()).append('\n'); + buffer.append(" .reversed = ").append(isReversed()).append('\n'); + + buffer.append("[/CATSERRANGE]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_crossingPoint); + out.writeShort(field_2_labelFrequency); + out.writeShort(field_3_tickMarkFrequency); + out.writeShort(field_4_options); + } + + protected int getDataSize() { + return 2 + 2 + 2 + 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + CategorySeriesAxisRecord rec = new CategorySeriesAxisRecord(); + + rec.field_1_crossingPoint = field_1_crossingPoint; + rec.field_2_labelFrequency = field_2_labelFrequency; + rec.field_3_tickMarkFrequency = field_3_tickMarkFrequency; + rec.field_4_options = field_4_options; + return rec; + } + + + + + /** + * Get the crossing point field for the CategorySeriesAxis record. + */ + public short getCrossingPoint() + { + return field_1_crossingPoint; + } + + /** + * Set the crossing point field for the CategorySeriesAxis record. + */ + public void setCrossingPoint(short field_1_crossingPoint) + { + this.field_1_crossingPoint = field_1_crossingPoint; + } + + /** + * Get the label frequency field for the CategorySeriesAxis record. + */ + public short getLabelFrequency() + { + return field_2_labelFrequency; + } + + /** + * Set the label frequency field for the CategorySeriesAxis record. + */ + public void setLabelFrequency(short field_2_labelFrequency) + { + this.field_2_labelFrequency = field_2_labelFrequency; + } + + /** + * Get the tick mark frequency field for the CategorySeriesAxis record. + */ + public short getTickMarkFrequency() + { + return field_3_tickMarkFrequency; + } + + /** + * Set the tick mark frequency field for the CategorySeriesAxis record. + */ + public void setTickMarkFrequency(short field_3_tickMarkFrequency) + { + this.field_3_tickMarkFrequency = field_3_tickMarkFrequency; + } + + /** + * Get the options field for the CategorySeriesAxis record. + */ + public short getOptions() + { + return field_4_options; + } + + /** + * Set the options field for the CategorySeriesAxis record. + */ + public void setOptions(short field_4_options) + { + this.field_4_options = field_4_options; + } + + /** + * Sets the value axis crossing field value. + * set true to indicate axis crosses between categories and false to cross axis midway + */ + public void setValueAxisCrossing(boolean value) + { + field_4_options = valueAxisCrossing.setShortBoolean(field_4_options, value); + } + + /** + * set true to indicate axis crosses between categories and false to cross axis midway + * @return the value axis crossing field value. + */ + public boolean isValueAxisCrossing() + { + return valueAxisCrossing.isSet(field_4_options); + } + + /** + * Sets the crosses far right field value. + * axis crosses at the far right + */ + public void setCrossesFarRight(boolean value) + { + field_4_options = crossesFarRight.setShortBoolean(field_4_options, value); + } + + /** + * axis crosses at the far right + * @return the crosses far right field value. + */ + public boolean isCrossesFarRight() + { + return crossesFarRight.isSet(field_4_options); + } + + /** + * Sets the reversed field value. + * categories are displayed in reverse order + */ + public void setReversed(boolean value) + { + field_4_options = reversed.setShortBoolean(field_4_options, value); + } + + /** + * categories are displayed in reverse order + * @return the reversed field value. + */ + public boolean isReversed() + { + return reversed.isSet(field_4_options); + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/ChartFormatRecord.java b/src/java/org/apache/poi/hssf/record/chart/ChartFormatRecord.java new file mode 100644 index 0000000000..de17e46125 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/ChartFormatRecord.java @@ -0,0 +1,144 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.BitField; +import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.LittleEndianOutput; + +/** + * Class ChartFormatRecord + * + * + * @author Glen Stampoultzis (glens at apache.org) + * @version %I%, %G% + */ +public final class ChartFormatRecord extends StandardRecord { + public static final short sid = 0x1014; + + private static final BitField varyDisplayPattern = BitFieldFactory.getInstance(0x01); + + // ignored? + private int field1_x_position; // lower left + private int field2_y_position; // lower left + private int field3_width; + private int field4_height; + private short field5_grbit; + + public ChartFormatRecord() + { + } + + public ChartFormatRecord(RecordInputStream in) + { + field1_x_position = in.readInt(); + field2_y_position = in.readInt(); + field3_width = in.readInt(); + field4_height = in.readInt(); + field5_grbit = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[CHARTFORMAT]\n"); + buffer.append(" .xPosition = ").append(getXPosition()) + .append("\n"); + buffer.append(" .yPosition = ").append(getYPosition()) + .append("\n"); + buffer.append(" .width = ").append(getWidth()) + .append("\n"); + buffer.append(" .height = ").append(getHeight()) + .append("\n"); + buffer.append(" .grBit = ") + .append(Integer.toHexString(field5_grbit)).append("\n"); + buffer.append("[/CHARTFORMAT]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeInt(getXPosition()); + out.writeInt(getYPosition()); + out.writeInt(getWidth()); + out.writeInt(getHeight()); + out.writeShort(field5_grbit); + } + + protected int getDataSize() { + return 18; + } + + public short getSid() + { + return sid; + } + + public int getXPosition() + { + return field1_x_position; + } + + public void setXPosition(int xPosition) + { + this.field1_x_position = xPosition; + } + + public int getYPosition() + { + return field2_y_position; + } + + public void setYPosition(int yPosition) + { + this.field2_y_position = yPosition; + } + + public int getWidth() + { + return field3_width; + } + + public void setWidth(int width) + { + this.field3_width = width; + } + + public int getHeight() + { + return field4_height; + } + + public void setHeight(int height) + { + this.field4_height = height; + } + + public boolean getVaryDisplayPattern() + { + return varyDisplayPattern.isSet(field5_grbit); + } + + public void setVaryDisplayPattern(boolean value) + { + field5_grbit = varyDisplayPattern.setShortBoolean(field5_grbit, + value); + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/ChartRecord.java b/src/java/org/apache/poi/hssf/record/chart/ChartRecord.java new file mode 100644 index 0000000000..639a96027f --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/ChartRecord.java @@ -0,0 +1,168 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The chart record is used to define the location and size of a chart. + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class ChartRecord extends StandardRecord { + public final static short sid = 0x1002; + private int field_1_x; + private int field_2_y; + private int field_3_width; + private int field_4_height; + + + public ChartRecord() + { + + } + + public ChartRecord(RecordInputStream in) + { + field_1_x = in.readInt(); + field_2_y = in.readInt(); + field_3_width = in.readInt(); + field_4_height = in.readInt(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[CHART]\n"); + buffer.append(" .x = ") + .append("0x").append(HexDump.toHex( getX ())) + .append(" (").append( getX() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .y = ") + .append("0x").append(HexDump.toHex( getY ())) + .append(" (").append( getY() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .width = ") + .append("0x").append(HexDump.toHex( getWidth ())) + .append(" (").append( getWidth() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .height = ") + .append("0x").append(HexDump.toHex( getHeight ())) + .append(" (").append( getHeight() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/CHART]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeInt(field_1_x); + out.writeInt(field_2_y); + out.writeInt(field_3_width); + out.writeInt(field_4_height); + } + + protected int getDataSize() { + return 4 + 4 + 4 + 4; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + ChartRecord rec = new ChartRecord(); + + rec.field_1_x = field_1_x; + rec.field_2_y = field_2_y; + rec.field_3_width = field_3_width; + rec.field_4_height = field_4_height; + return rec; + } + + + + + /** + * Get the x field for the Chart record. + */ + public int getX() + { + return field_1_x; + } + + /** + * Set the x field for the Chart record. + */ + public void setX(int field_1_x) + { + this.field_1_x = field_1_x; + } + + /** + * Get the y field for the Chart record. + */ + public int getY() + { + return field_2_y; + } + + /** + * Set the y field for the Chart record. + */ + public void setY(int field_2_y) + { + this.field_2_y = field_2_y; + } + + /** + * Get the width field for the Chart record. + */ + public int getWidth() + { + return field_3_width; + } + + /** + * Set the width field for the Chart record. + */ + public void setWidth(int field_3_width) + { + this.field_3_width = field_3_width; + } + + /** + * Get the height field for the Chart record. + */ + public int getHeight() + { + return field_4_height; + } + + /** + * Set the height field for the Chart record. + */ + public void setHeight(int field_4_height) + { + this.field_4_height = field_4_height; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/ChartTitleFormatRecord.java b/src/java/org/apache/poi/hssf/record/chart/ChartTitleFormatRecord.java new file mode 100644 index 0000000000..ac9859048a --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/ChartTitleFormatRecord.java @@ -0,0 +1,123 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +/* + * HSSF Chart Title Format Record Type + */ +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.LittleEndianOutput; + +/** + * CHARTTITLEFORMAT (0x1050)

+ * Describes the formatting runs associated with a chart title. + */ +public class ChartTitleFormatRecord extends StandardRecord { + public static final short sid = 0x1050; + + private CTFormat[] _formats; + + private static final class CTFormat { + public static final int ENCODED_SIZE=4; + private int _offset; + private int _fontIndex; + + protected CTFormat(short offset,short fontIdx){ + _offset = offset; + _fontIndex = fontIdx; + } + + public CTFormat(RecordInputStream in) { + _offset = in.readShort(); + _fontIndex = in.readShort(); + } + + public int getOffset(){ + return _offset; + } + public void setOffset(int newOff){ + _offset = newOff; + } + public int getFontIndex() { + return _fontIndex; + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(_offset); + out.writeShort(_fontIndex); + } + } + + + public ChartTitleFormatRecord(RecordInputStream in) { + int nRecs = in.readUShort(); + _formats = new CTFormat[nRecs]; + + for(int i=0;i + * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class DatRecord extends StandardRecord { + public final static short sid = 0x1063; + + private static final BitField horizontalBorder = BitFieldFactory.getInstance(0x1); + private static final BitField verticalBorder = BitFieldFactory.getInstance(0x2); + private static final BitField border = BitFieldFactory.getInstance(0x4); + private static final BitField showSeriesKey = BitFieldFactory.getInstance(0x8); + + private short field_1_options; + + + public DatRecord() + { + + } + + public DatRecord(RecordInputStream in) + { + field_1_options = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[DAT]\n"); + buffer.append(" .options = ") + .append("0x").append(HexDump.toHex( getOptions ())) + .append(" (").append( getOptions() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .horizontalBorder = ").append(isHorizontalBorder()).append('\n'); + buffer.append(" .verticalBorder = ").append(isVerticalBorder()).append('\n'); + buffer.append(" .border = ").append(isBorder()).append('\n'); + buffer.append(" .showSeriesKey = ").append(isShowSeriesKey()).append('\n'); + + buffer.append("[/DAT]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_options); + } + + protected int getDataSize() { + return 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + DatRecord rec = new DatRecord(); + + rec.field_1_options = field_1_options; + return rec; + } + + + + + /** + * Get the options field for the Dat record. + */ + public short getOptions() + { + return field_1_options; + } + + /** + * Set the options field for the Dat record. + */ + public void setOptions(short field_1_options) + { + this.field_1_options = field_1_options; + } + + /** + * Sets the horizontal border field value. + * has a horizontal border + */ + public void setHorizontalBorder(boolean value) + { + field_1_options = horizontalBorder.setShortBoolean(field_1_options, value); + } + + /** + * has a horizontal border + * @return the horizontal border field value. + */ + public boolean isHorizontalBorder() + { + return horizontalBorder.isSet(field_1_options); + } + + /** + * Sets the vertical border field value. + * has vertical border + */ + public void setVerticalBorder(boolean value) + { + field_1_options = verticalBorder.setShortBoolean(field_1_options, value); + } + + /** + * has vertical border + * @return the vertical border field value. + */ + public boolean isVerticalBorder() + { + return verticalBorder.isSet(field_1_options); + } + + /** + * Sets the border field value. + * data table has a border + */ + public void setBorder(boolean value) + { + field_1_options = border.setShortBoolean(field_1_options, value); + } + + /** + * data table has a border + * @return the border field value. + */ + public boolean isBorder() + { + return border.isSet(field_1_options); + } + + /** + * Sets the show series key field value. + * shows the series key + */ + public void setShowSeriesKey(boolean value) + { + field_1_options = showSeriesKey.setShortBoolean(field_1_options, value); + } + + /** + * shows the series key + * @return the show series key field value. + */ + public boolean isShowSeriesKey() + { + return showSeriesKey.isSet(field_1_options); + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/DataFormatRecord.java b/src/java/org/apache/poi/hssf/record/chart/DataFormatRecord.java new file mode 100644 index 0000000000..bb9d6ad001 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/DataFormatRecord.java @@ -0,0 +1,193 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.BitField; +import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The data format record is used to index into a series.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class DataFormatRecord extends StandardRecord { + public final static short sid = 0x1006; + + private static final BitField useExcel4Colors = BitFieldFactory.getInstance(0x1); + + private short field_1_pointNumber; + private short field_2_seriesIndex; + private short field_3_seriesNumber; + private short field_4_formatFlags; + + + public DataFormatRecord() + { + + } + + public DataFormatRecord(RecordInputStream in) + { + field_1_pointNumber = in.readShort(); + field_2_seriesIndex = in.readShort(); + field_3_seriesNumber = in.readShort(); + field_4_formatFlags = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[DATAFORMAT]\n"); + buffer.append(" .pointNumber = ") + .append("0x").append(HexDump.toHex( getPointNumber ())) + .append(" (").append( getPointNumber() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .seriesIndex = ") + .append("0x").append(HexDump.toHex( getSeriesIndex ())) + .append(" (").append( getSeriesIndex() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .seriesNumber = ") + .append("0x").append(HexDump.toHex( getSeriesNumber ())) + .append(" (").append( getSeriesNumber() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .formatFlags = ") + .append("0x").append(HexDump.toHex( getFormatFlags ())) + .append(" (").append( getFormatFlags() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .useExcel4Colors = ").append(isUseExcel4Colors()).append('\n'); + + buffer.append("[/DATAFORMAT]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_pointNumber); + out.writeShort(field_2_seriesIndex); + out.writeShort(field_3_seriesNumber); + out.writeShort(field_4_formatFlags); + } + + protected int getDataSize() { + return 2 + 2 + 2 + 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + DataFormatRecord rec = new DataFormatRecord(); + + rec.field_1_pointNumber = field_1_pointNumber; + rec.field_2_seriesIndex = field_2_seriesIndex; + rec.field_3_seriesNumber = field_3_seriesNumber; + rec.field_4_formatFlags = field_4_formatFlags; + return rec; + } + + + + + /** + * Get the point number field for the DataFormat record. + */ + public short getPointNumber() + { + return field_1_pointNumber; + } + + /** + * Set the point number field for the DataFormat record. + */ + public void setPointNumber(short field_1_pointNumber) + { + this.field_1_pointNumber = field_1_pointNumber; + } + + /** + * Get the series index field for the DataFormat record. + */ + public short getSeriesIndex() + { + return field_2_seriesIndex; + } + + /** + * Set the series index field for the DataFormat record. + */ + public void setSeriesIndex(short field_2_seriesIndex) + { + this.field_2_seriesIndex = field_2_seriesIndex; + } + + /** + * Get the series number field for the DataFormat record. + */ + public short getSeriesNumber() + { + return field_3_seriesNumber; + } + + /** + * Set the series number field for the DataFormat record. + */ + public void setSeriesNumber(short field_3_seriesNumber) + { + this.field_3_seriesNumber = field_3_seriesNumber; + } + + /** + * Get the format flags field for the DataFormat record. + */ + public short getFormatFlags() + { + return field_4_formatFlags; + } + + /** + * Set the format flags field for the DataFormat record. + */ + public void setFormatFlags(short field_4_formatFlags) + { + this.field_4_formatFlags = field_4_formatFlags; + } + + /** + * Sets the use excel 4 colors field value. + * set true to use excel 4 colors. + */ + public void setUseExcel4Colors(boolean value) + { + field_4_formatFlags = useExcel4Colors.setShortBoolean(field_4_formatFlags, value); + } + + /** + * set true to use excel 4 colors. + * @return the use excel 4 colors field value. + */ + public boolean isUseExcel4Colors() + { + return useExcel4Colors.isSet(field_4_formatFlags); + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/DefaultDataLabelTextPropertiesRecord.java b/src/java/org/apache/poi/hssf/record/chart/DefaultDataLabelTextPropertiesRecord.java new file mode 100644 index 0000000000..4967bd35b0 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/DefaultDataLabelTextPropertiesRecord.java @@ -0,0 +1,111 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The default data label text properties record identifies the text characteristics of the preceding text record.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class DefaultDataLabelTextPropertiesRecord extends StandardRecord { + public final static short sid = 0x1024; + private short field_1_categoryDataType; + public final static short CATEGORY_DATA_TYPE_SHOW_LABELS_CHARACTERISTIC = 0; + public final static short CATEGORY_DATA_TYPE_VALUE_AND_PERCENTAGE_CHARACTERISTIC = 1; + public final static short CATEGORY_DATA_TYPE_ALL_TEXT_CHARACTERISTIC = 2; + + + public DefaultDataLabelTextPropertiesRecord() + { + + } + + public DefaultDataLabelTextPropertiesRecord(RecordInputStream in) + { + field_1_categoryDataType = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[DEFAULTTEXT]\n"); + buffer.append(" .categoryDataType = ") + .append("0x").append(HexDump.toHex( getCategoryDataType ())) + .append(" (").append( getCategoryDataType() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/DEFAULTTEXT]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_categoryDataType); + } + + protected int getDataSize() { + return 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + DefaultDataLabelTextPropertiesRecord rec = new DefaultDataLabelTextPropertiesRecord(); + + rec.field_1_categoryDataType = field_1_categoryDataType; + return rec; + } + + + + + /** + * Get the category data type field for the DefaultDataLabelTextProperties record. + * + * @return One of + * CATEGORY_DATA_TYPE_SHOW_LABELS_CHARACTERISTIC + * CATEGORY_DATA_TYPE_VALUE_AND_PERCENTAGE_CHARACTERISTIC + * CATEGORY_DATA_TYPE_ALL_TEXT_CHARACTERISTIC + */ + public short getCategoryDataType() + { + return field_1_categoryDataType; + } + + /** + * Set the category data type field for the DefaultDataLabelTextProperties record. + * + * @param field_1_categoryDataType + * One of + * CATEGORY_DATA_TYPE_SHOW_LABELS_CHARACTERISTIC + * CATEGORY_DATA_TYPE_VALUE_AND_PERCENTAGE_CHARACTERISTIC + * CATEGORY_DATA_TYPE_ALL_TEXT_CHARACTERISTIC + */ + public void setCategoryDataType(short field_1_categoryDataType) + { + this.field_1_categoryDataType = field_1_categoryDataType; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/EndRecord.java b/src/java/org/apache/poi/hssf/record/chart/EndRecord.java new file mode 100644 index 0000000000..44a5099e29 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/EndRecord.java @@ -0,0 +1,67 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The end record defines the end of a block of records for a (Graphing) + * data object. This record is matched with a corresponding BeginRecord. + * + * @see BeginRecord + * + * @author Glen Stampoultzis (glens at apache.org) + */ + +public final class EndRecord extends StandardRecord { + public static final short sid = 0x1034; + + public EndRecord() + { + } + + /** + * @param in unused (since this record has no data) + */ + public EndRecord(RecordInputStream in) + { + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[END]\n"); + buffer.append("[/END]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + } + + protected int getDataSize() { + return 0; + } + + public short getSid() + { + return sid; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/FontBasisRecord.java b/src/java/org/apache/poi/hssf/record/chart/FontBasisRecord.java new file mode 100644 index 0000000000..826a505376 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/FontBasisRecord.java @@ -0,0 +1,193 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The font basis record stores various font metrics.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class FontBasisRecord extends StandardRecord { + public final static short sid = 0x1060; + private short field_1_xBasis; + private short field_2_yBasis; + private short field_3_heightBasis; + private short field_4_scale; + private short field_5_indexToFontTable; + + + public FontBasisRecord() + { + + } + + public FontBasisRecord(RecordInputStream in) + { + field_1_xBasis = in.readShort(); + field_2_yBasis = in.readShort(); + field_3_heightBasis = in.readShort(); + field_4_scale = in.readShort(); + field_5_indexToFontTable = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[FBI]\n"); + buffer.append(" .xBasis = ") + .append("0x").append(HexDump.toHex( getXBasis ())) + .append(" (").append( getXBasis() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .yBasis = ") + .append("0x").append(HexDump.toHex( getYBasis ())) + .append(" (").append( getYBasis() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .heightBasis = ") + .append("0x").append(HexDump.toHex( getHeightBasis ())) + .append(" (").append( getHeightBasis() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .scale = ") + .append("0x").append(HexDump.toHex( getScale ())) + .append(" (").append( getScale() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .indexToFontTable = ") + .append("0x").append(HexDump.toHex( getIndexToFontTable ())) + .append(" (").append( getIndexToFontTable() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/FBI]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_xBasis); + out.writeShort(field_2_yBasis); + out.writeShort(field_3_heightBasis); + out.writeShort(field_4_scale); + out.writeShort(field_5_indexToFontTable); + } + + protected int getDataSize() { + return 2 + 2 + 2 + 2 + 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + FontBasisRecord rec = new FontBasisRecord(); + + rec.field_1_xBasis = field_1_xBasis; + rec.field_2_yBasis = field_2_yBasis; + rec.field_3_heightBasis = field_3_heightBasis; + rec.field_4_scale = field_4_scale; + rec.field_5_indexToFontTable = field_5_indexToFontTable; + return rec; + } + + + + + /** + * Get the x Basis field for the FontBasis record. + */ + public short getXBasis() + { + return field_1_xBasis; + } + + /** + * Set the x Basis field for the FontBasis record. + */ + public void setXBasis(short field_1_xBasis) + { + this.field_1_xBasis = field_1_xBasis; + } + + /** + * Get the y Basis field for the FontBasis record. + */ + public short getYBasis() + { + return field_2_yBasis; + } + + /** + * Set the y Basis field for the FontBasis record. + */ + public void setYBasis(short field_2_yBasis) + { + this.field_2_yBasis = field_2_yBasis; + } + + /** + * Get the height basis field for the FontBasis record. + */ + public short getHeightBasis() + { + return field_3_heightBasis; + } + + /** + * Set the height basis field for the FontBasis record. + */ + public void setHeightBasis(short field_3_heightBasis) + { + this.field_3_heightBasis = field_3_heightBasis; + } + + /** + * Get the scale field for the FontBasis record. + */ + public short getScale() + { + return field_4_scale; + } + + /** + * Set the scale field for the FontBasis record. + */ + public void setScale(short field_4_scale) + { + this.field_4_scale = field_4_scale; + } + + /** + * Get the index to font table field for the FontBasis record. + */ + public short getIndexToFontTable() + { + return field_5_indexToFontTable; + } + + /** + * Set the index to font table field for the FontBasis record. + */ + public void setIndexToFontTable(short field_5_indexToFontTable) + { + this.field_5_indexToFontTable = field_5_indexToFontTable; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/FontIndexRecord.java b/src/java/org/apache/poi/hssf/record/chart/FontIndexRecord.java new file mode 100644 index 0000000000..b0047b1f37 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/FontIndexRecord.java @@ -0,0 +1,97 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The font index record indexes into the font table for the text record.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class FontIndexRecord extends StandardRecord { + public final static short sid = 0x1026; + private short field_1_fontIndex; + + + public FontIndexRecord() + { + + } + + public FontIndexRecord(RecordInputStream in) + { + field_1_fontIndex = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[FONTX]\n"); + buffer.append(" .fontIndex = ") + .append("0x").append(HexDump.toHex( getFontIndex ())) + .append(" (").append( getFontIndex() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/FONTX]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_fontIndex); + } + + protected int getDataSize() { + return 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + FontIndexRecord rec = new FontIndexRecord(); + + rec.field_1_fontIndex = field_1_fontIndex; + return rec; + } + + + + + /** + * Get the font index field for the FontIndex record. + */ + public short getFontIndex() + { + return field_1_fontIndex; + } + + /** + * Set the font index field for the FontIndex record. + */ + public void setFontIndex(short field_1_fontIndex) + { + this.field_1_fontIndex = field_1_fontIndex; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/FrameRecord.java b/src/java/org/apache/poi/hssf/record/chart/FrameRecord.java new file mode 100644 index 0000000000..525741422e --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/FrameRecord.java @@ -0,0 +1,176 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.BitField; +import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The frame record indicates whether there is a border around the displayed text of a chart.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class FrameRecord extends StandardRecord { + public final static short sid = 0x1032; + + private static final BitField autoSize = BitFieldFactory.getInstance(0x1); + private static final BitField autoPosition = BitFieldFactory.getInstance(0x2); + + private short field_1_borderType; + public final static short BORDER_TYPE_REGULAR = 0; + public final static short BORDER_TYPE_SHADOW = 1; + private short field_2_options; + + + public FrameRecord() + { + + } + + public FrameRecord(RecordInputStream in) + { + field_1_borderType = in.readShort(); + field_2_options = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[FRAME]\n"); + buffer.append(" .borderType = ") + .append("0x").append(HexDump.toHex( getBorderType ())) + .append(" (").append( getBorderType() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .options = ") + .append("0x").append(HexDump.toHex( getOptions ())) + .append(" (").append( getOptions() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .autoSize = ").append(isAutoSize()).append('\n'); + buffer.append(" .autoPosition = ").append(isAutoPosition()).append('\n'); + + buffer.append("[/FRAME]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_borderType); + out.writeShort(field_2_options); + } + + protected int getDataSize() { + return 2 + 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + FrameRecord rec = new FrameRecord(); + + rec.field_1_borderType = field_1_borderType; + rec.field_2_options = field_2_options; + return rec; + } + + + + + /** + * Get the border type field for the Frame record. + * + * @return One of + * BORDER_TYPE_REGULAR + * BORDER_TYPE_SHADOW + */ + public short getBorderType() + { + return field_1_borderType; + } + + /** + * Set the border type field for the Frame record. + * + * @param field_1_borderType + * One of + * BORDER_TYPE_REGULAR + * BORDER_TYPE_SHADOW + */ + public void setBorderType(short field_1_borderType) + { + this.field_1_borderType = field_1_borderType; + } + + /** + * Get the options field for the Frame record. + */ + public short getOptions() + { + return field_2_options; + } + + /** + * Set the options field for the Frame record. + */ + public void setOptions(short field_2_options) + { + this.field_2_options = field_2_options; + } + + /** + * Sets the auto size field value. + * excel calculates the size automatically if true + */ + public void setAutoSize(boolean value) + { + field_2_options = autoSize.setShortBoolean(field_2_options, value); + } + + /** + * excel calculates the size automatically if true + * @return the auto size field value. + */ + public boolean isAutoSize() + { + return autoSize.isSet(field_2_options); + } + + /** + * Sets the auto position field value. + * excel calculates the position automatically + */ + public void setAutoPosition(boolean value) + { + field_2_options = autoPosition.setShortBoolean(field_2_options, value); + } + + /** + * excel calculates the position automatically + * @return the auto position field value. + */ + public boolean isAutoPosition() + { + return autoPosition.isSet(field_2_options); + } +} \ No newline at end of file diff --git a/src/java/org/apache/poi/hssf/record/chart/LegendRecord.java b/src/java/org/apache/poi/hssf/record/chart/LegendRecord.java new file mode 100644 index 0000000000..1fd99be974 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/LegendRecord.java @@ -0,0 +1,402 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.BitField; +import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * Defines a legend for a chart.

+ * + * @author Andrew C. Oliver (acoliver at apache.org) + */ +public final class LegendRecord extends StandardRecord { + public final static short sid = 0x1015; + + private static final BitField autoPosition = BitFieldFactory.getInstance(0x01); + private static final BitField autoSeries = BitFieldFactory.getInstance(0x02); + private static final BitField autoXPositioning = BitFieldFactory.getInstance(0x04); + private static final BitField autoYPositioning = BitFieldFactory.getInstance(0x08); + private static final BitField vertical = BitFieldFactory.getInstance(0x10); + private static final BitField dataTable = BitFieldFactory.getInstance(0x20); + + private int field_1_xAxisUpperLeft; + private int field_2_yAxisUpperLeft; + private int field_3_xSize; + private int field_4_ySize; + private byte field_5_type; + public final static byte TYPE_BOTTOM = 0; + public final static byte TYPE_CORNER = 1; + public final static byte TYPE_TOP = 2; + public final static byte TYPE_RIGHT = 3; + public final static byte TYPE_LEFT = 4; + public final static byte TYPE_UNDOCKED = 7; + private byte field_6_spacing; + public final static byte SPACING_CLOSE = 0; + public final static byte SPACING_MEDIUM = 1; + public final static byte SPACING_OPEN = 2; + private short field_7_options; + + + public LegendRecord() + { + + } + + public LegendRecord(RecordInputStream in) + { + field_1_xAxisUpperLeft = in.readInt(); + field_2_yAxisUpperLeft = in.readInt(); + field_3_xSize = in.readInt(); + field_4_ySize = in.readInt(); + field_5_type = in.readByte(); + field_6_spacing = in.readByte(); + field_7_options = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[LEGEND]\n"); + buffer.append(" .xAxisUpperLeft = ") + .append("0x").append(HexDump.toHex( getXAxisUpperLeft ())) + .append(" (").append( getXAxisUpperLeft() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .yAxisUpperLeft = ") + .append("0x").append(HexDump.toHex( getYAxisUpperLeft ())) + .append(" (").append( getYAxisUpperLeft() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .xSize = ") + .append("0x").append(HexDump.toHex( getXSize ())) + .append(" (").append( getXSize() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .ySize = ") + .append("0x").append(HexDump.toHex( getYSize ())) + .append(" (").append( getYSize() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .type = ") + .append("0x").append(HexDump.toHex( getType ())) + .append(" (").append( getType() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .spacing = ") + .append("0x").append(HexDump.toHex( getSpacing ())) + .append(" (").append( getSpacing() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .options = ") + .append("0x").append(HexDump.toHex( getOptions ())) + .append(" (").append( getOptions() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .autoPosition = ").append(isAutoPosition()).append('\n'); + buffer.append(" .autoSeries = ").append(isAutoSeries()).append('\n'); + buffer.append(" .autoXPositioning = ").append(isAutoXPositioning()).append('\n'); + buffer.append(" .autoYPositioning = ").append(isAutoYPositioning()).append('\n'); + buffer.append(" .vertical = ").append(isVertical()).append('\n'); + buffer.append(" .dataTable = ").append(isDataTable()).append('\n'); + + buffer.append("[/LEGEND]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeInt(field_1_xAxisUpperLeft); + out.writeInt(field_2_yAxisUpperLeft); + out.writeInt(field_3_xSize); + out.writeInt(field_4_ySize); + out.writeByte(field_5_type); + out.writeByte(field_6_spacing); + out.writeShort(field_7_options); + } + + protected int getDataSize() { + return 4 + 4 + 4 + 4 + 1 + 1 + 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + LegendRecord rec = new LegendRecord(); + + rec.field_1_xAxisUpperLeft = field_1_xAxisUpperLeft; + rec.field_2_yAxisUpperLeft = field_2_yAxisUpperLeft; + rec.field_3_xSize = field_3_xSize; + rec.field_4_ySize = field_4_ySize; + rec.field_5_type = field_5_type; + rec.field_6_spacing = field_6_spacing; + rec.field_7_options = field_7_options; + return rec; + } + + + + + /** + * Get the x axis upper left field for the Legend record. + */ + public int getXAxisUpperLeft() + { + return field_1_xAxisUpperLeft; + } + + /** + * Set the x axis upper left field for the Legend record. + */ + public void setXAxisUpperLeft(int field_1_xAxisUpperLeft) + { + this.field_1_xAxisUpperLeft = field_1_xAxisUpperLeft; + } + + /** + * Get the y axis upper left field for the Legend record. + */ + public int getYAxisUpperLeft() + { + return field_2_yAxisUpperLeft; + } + + /** + * Set the y axis upper left field for the Legend record. + */ + public void setYAxisUpperLeft(int field_2_yAxisUpperLeft) + { + this.field_2_yAxisUpperLeft = field_2_yAxisUpperLeft; + } + + /** + * Get the x size field for the Legend record. + */ + public int getXSize() + { + return field_3_xSize; + } + + /** + * Set the x size field for the Legend record. + */ + public void setXSize(int field_3_xSize) + { + this.field_3_xSize = field_3_xSize; + } + + /** + * Get the y size field for the Legend record. + */ + public int getYSize() + { + return field_4_ySize; + } + + /** + * Set the y size field for the Legend record. + */ + public void setYSize(int field_4_ySize) + { + this.field_4_ySize = field_4_ySize; + } + + /** + * Get the type field for the Legend record. + * + * @return One of + * TYPE_BOTTOM + * TYPE_CORNER + * TYPE_TOP + * TYPE_RIGHT + * TYPE_LEFT + * TYPE_UNDOCKED + */ + public byte getType() + { + return field_5_type; + } + + /** + * Set the type field for the Legend record. + * + * @param field_5_type + * One of + * TYPE_BOTTOM + * TYPE_CORNER + * TYPE_TOP + * TYPE_RIGHT + * TYPE_LEFT + * TYPE_UNDOCKED + */ + public void setType(byte field_5_type) + { + this.field_5_type = field_5_type; + } + + /** + * Get the spacing field for the Legend record. + * + * @return One of + * SPACING_CLOSE + * SPACING_MEDIUM + * SPACING_OPEN + */ + public byte getSpacing() + { + return field_6_spacing; + } + + /** + * Set the spacing field for the Legend record. + * + * @param field_6_spacing + * One of + * SPACING_CLOSE + * SPACING_MEDIUM + * SPACING_OPEN + */ + public void setSpacing(byte field_6_spacing) + { + this.field_6_spacing = field_6_spacing; + } + + /** + * Get the options field for the Legend record. + */ + public short getOptions() + { + return field_7_options; + } + + /** + * Set the options field for the Legend record. + */ + public void setOptions(short field_7_options) + { + this.field_7_options = field_7_options; + } + + /** + * Sets the auto position field value. + * automatic positioning (1=docked) + */ + public void setAutoPosition(boolean value) + { + field_7_options = autoPosition.setShortBoolean(field_7_options, value); + } + + /** + * automatic positioning (1=docked) + * @return the auto position field value. + */ + public boolean isAutoPosition() + { + return autoPosition.isSet(field_7_options); + } + + /** + * Sets the auto series field value. + * excel 5 only (true) + */ + public void setAutoSeries(boolean value) + { + field_7_options = autoSeries.setShortBoolean(field_7_options, value); + } + + /** + * excel 5 only (true) + * @return the auto series field value. + */ + public boolean isAutoSeries() + { + return autoSeries.isSet(field_7_options); + } + + /** + * Sets the auto x positioning field value. + * position of legend on the x axis is automatic + */ + public void setAutoXPositioning(boolean value) + { + field_7_options = autoXPositioning.setShortBoolean(field_7_options, value); + } + + /** + * position of legend on the x axis is automatic + * @return the auto x positioning field value. + */ + public boolean isAutoXPositioning() + { + return autoXPositioning.isSet(field_7_options); + } + + /** + * Sets the auto y positioning field value. + * position of legend on the y axis is automatic + */ + public void setAutoYPositioning(boolean value) + { + field_7_options = autoYPositioning.setShortBoolean(field_7_options, value); + } + + /** + * position of legend on the y axis is automatic + * @return the auto y positioning field value. + */ + public boolean isAutoYPositioning() + { + return autoYPositioning.isSet(field_7_options); + } + + /** + * Sets the vertical field value. + * vertical or horizontal legend (1 or 0 respectively). Always 0 if not automatic. + */ + public void setVertical(boolean value) + { + field_7_options = vertical.setShortBoolean(field_7_options, value); + } + + /** + * vertical or horizontal legend (1 or 0 respectively). Always 0 if not automatic. + * @return the vertical field value. + */ + public boolean isVertical() + { + return vertical.isSet(field_7_options); + } + + /** + * Sets the data table field value. + * 1 if chart contains data table + */ + public void setDataTable(boolean value) + { + field_7_options = dataTable.setShortBoolean(field_7_options, value); + } + + /** + * 1 if chart contains data table + * @return the data table field value. + */ + public boolean isDataTable() + { + return dataTable.isSet(field_7_options); + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/LineFormatRecord.java b/src/java/org/apache/poi/hssf/record/chart/LineFormatRecord.java new file mode 100644 index 0000000000..ed47dabed9 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/LineFormatRecord.java @@ -0,0 +1,307 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.BitField; +import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * Describes a line format record. The line format record controls how a line on a chart appears.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class LineFormatRecord extends StandardRecord { + public final static short sid = 0x1007; + + private static final BitField auto = BitFieldFactory.getInstance(0x1); + private static final BitField drawTicks = BitFieldFactory.getInstance(0x4); + private static final BitField unknown = BitFieldFactory.getInstance(0x4); + + private int field_1_lineColor; + private short field_2_linePattern; + public final static short LINE_PATTERN_SOLID = 0; + public final static short LINE_PATTERN_DASH = 1; + public final static short LINE_PATTERN_DOT = 2; + public final static short LINE_PATTERN_DASH_DOT = 3; + public final static short LINE_PATTERN_DASH_DOT_DOT = 4; + public final static short LINE_PATTERN_NONE = 5; + public final static short LINE_PATTERN_DARK_GRAY_PATTERN = 6; + public final static short LINE_PATTERN_MEDIUM_GRAY_PATTERN = 7; + public final static short LINE_PATTERN_LIGHT_GRAY_PATTERN = 8; + private short field_3_weight; + public final static short WEIGHT_HAIRLINE = -1; + public final static short WEIGHT_NARROW = 0; + public final static short WEIGHT_MEDIUM = 1; + public final static short WEIGHT_WIDE = 2; + private short field_4_format; + private short field_5_colourPaletteIndex; + + + public LineFormatRecord() + { + + } + + public LineFormatRecord(RecordInputStream in) + { + field_1_lineColor = in.readInt(); + field_2_linePattern = in.readShort(); + field_3_weight = in.readShort(); + field_4_format = in.readShort(); + field_5_colourPaletteIndex = in.readShort(); + + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[LINEFORMAT]\n"); + buffer.append(" .lineColor = ") + .append("0x").append(HexDump.toHex( getLineColor ())) + .append(" (").append( getLineColor() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .linePattern = ") + .append("0x").append(HexDump.toHex( getLinePattern ())) + .append(" (").append( getLinePattern() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .weight = ") + .append("0x").append(HexDump.toHex( getWeight ())) + .append(" (").append( getWeight() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .format = ") + .append("0x").append(HexDump.toHex( getFormat ())) + .append(" (").append( getFormat() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .auto = ").append(isAuto()).append('\n'); + buffer.append(" .drawTicks = ").append(isDrawTicks()).append('\n'); + buffer.append(" .unknown = ").append(isUnknown()).append('\n'); + buffer.append(" .colourPaletteIndex = ") + .append("0x").append(HexDump.toHex( getColourPaletteIndex ())) + .append(" (").append( getColourPaletteIndex() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/LINEFORMAT]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeInt(field_1_lineColor); + out.writeShort(field_2_linePattern); + out.writeShort(field_3_weight); + out.writeShort(field_4_format); + out.writeShort(field_5_colourPaletteIndex); + } + + protected int getDataSize() { + return 4 + 2 + 2 + 2 + 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + LineFormatRecord rec = new LineFormatRecord(); + + rec.field_1_lineColor = field_1_lineColor; + rec.field_2_linePattern = field_2_linePattern; + rec.field_3_weight = field_3_weight; + rec.field_4_format = field_4_format; + rec.field_5_colourPaletteIndex = field_5_colourPaletteIndex; + return rec; + } + + + + + /** + * Get the line color field for the LineFormat record. + */ + public int getLineColor() + { + return field_1_lineColor; + } + + /** + * Set the line color field for the LineFormat record. + */ + public void setLineColor(int field_1_lineColor) + { + this.field_1_lineColor = field_1_lineColor; + } + + /** + * Get the line pattern field for the LineFormat record. + * + * @return One of + * LINE_PATTERN_SOLID + * LINE_PATTERN_DASH + * LINE_PATTERN_DOT + * LINE_PATTERN_DASH_DOT + * LINE_PATTERN_DASH_DOT_DOT + * LINE_PATTERN_NONE + * LINE_PATTERN_DARK_GRAY_PATTERN + * LINE_PATTERN_MEDIUM_GRAY_PATTERN + * LINE_PATTERN_LIGHT_GRAY_PATTERN + */ + public short getLinePattern() + { + return field_2_linePattern; + } + + /** + * Set the line pattern field for the LineFormat record. + * + * @param field_2_linePattern + * One of + * LINE_PATTERN_SOLID + * LINE_PATTERN_DASH + * LINE_PATTERN_DOT + * LINE_PATTERN_DASH_DOT + * LINE_PATTERN_DASH_DOT_DOT + * LINE_PATTERN_NONE + * LINE_PATTERN_DARK_GRAY_PATTERN + * LINE_PATTERN_MEDIUM_GRAY_PATTERN + * LINE_PATTERN_LIGHT_GRAY_PATTERN + */ + public void setLinePattern(short field_2_linePattern) + { + this.field_2_linePattern = field_2_linePattern; + } + + /** + * Get the weight field for the LineFormat record. + * + * @return One of + * WEIGHT_HAIRLINE + * WEIGHT_NARROW + * WEIGHT_MEDIUM + * WEIGHT_WIDE + */ + public short getWeight() + { + return field_3_weight; + } + + /** + * Set the weight field for the LineFormat record. + * + * @param field_3_weight + * One of + * WEIGHT_HAIRLINE + * WEIGHT_NARROW + * WEIGHT_MEDIUM + * WEIGHT_WIDE + */ + public void setWeight(short field_3_weight) + { + this.field_3_weight = field_3_weight; + } + + /** + * Get the format field for the LineFormat record. + */ + public short getFormat() + { + return field_4_format; + } + + /** + * Set the format field for the LineFormat record. + */ + public void setFormat(short field_4_format) + { + this.field_4_format = field_4_format; + } + + /** + * Get the colour palette index field for the LineFormat record. + */ + public short getColourPaletteIndex() + { + return field_5_colourPaletteIndex; + } + + /** + * Set the colour palette index field for the LineFormat record. + */ + public void setColourPaletteIndex(short field_5_colourPaletteIndex) + { + this.field_5_colourPaletteIndex = field_5_colourPaletteIndex; + } + + /** + * Sets the auto field value. + * automatic format + */ + public void setAuto(boolean value) + { + field_4_format = auto.setShortBoolean(field_4_format, value); + } + + /** + * automatic format + * @return the auto field value. + */ + public boolean isAuto() + { + return auto.isSet(field_4_format); + } + + /** + * Sets the draw ticks field value. + * draw tick marks + */ + public void setDrawTicks(boolean value) + { + field_4_format = drawTicks.setShortBoolean(field_4_format, value); + } + + /** + * draw tick marks + * @return the draw ticks field value. + */ + public boolean isDrawTicks() + { + return drawTicks.isSet(field_4_format); + } + + /** + * Sets the unknown field value. + * book marks this as reserved = 0 but it seems to do something + */ + public void setUnknown(boolean value) + { + field_4_format = unknown.setShortBoolean(field_4_format, value); + } + + /** + * book marks this as reserved = 0 but it seems to do something + * @return the unknown field value. + */ + public boolean isUnknown() + { + return unknown.isSet(field_4_format); + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/LinkedDataRecord.java b/src/java/org/apache/poi/hssf/record/chart/LinkedDataRecord.java new file mode 100644 index 0000000000..114aff5968 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/LinkedDataRecord.java @@ -0,0 +1,251 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.hssf.record.formula.Ptg; +import org.apache.poi.ss.formula.Formula; +import org.apache.poi.util.BitField; +import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * Describes a linked data record. This record refers to the series data or text.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class LinkedDataRecord extends StandardRecord { + public final static short sid = 0x1051; + + private static final BitField customNumberFormat= BitFieldFactory.getInstance(0x1); + + private byte field_1_linkType; + public final static byte LINK_TYPE_TITLE_OR_TEXT = 0; + public final static byte LINK_TYPE_VALUES = 1; + public final static byte LINK_TYPE_CATEGORIES = 2; + private byte field_2_referenceType; + public final static byte REFERENCE_TYPE_DEFAULT_CATEGORIES = 0; + public final static byte REFERENCE_TYPE_DIRECT = 1; + public final static byte REFERENCE_TYPE_WORKSHEET = 2; + public final static byte REFERENCE_TYPE_NOT_USED = 3; + public final static byte REFERENCE_TYPE_ERROR_REPORTED = 4; + private short field_3_options; + private short field_4_indexNumberFmtRecord; + private Formula field_5_formulaOfLink; + + + public LinkedDataRecord() + { + + } + + public LinkedDataRecord(RecordInputStream in) + { + field_1_linkType = in.readByte(); + field_2_referenceType = in.readByte(); + field_3_options = in.readShort(); + field_4_indexNumberFmtRecord = in.readShort(); + int encodedTokenLen = in.readUShort(); + field_5_formulaOfLink = Formula.read(encodedTokenLen, in); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[AI]\n"); + buffer.append(" .linkType = ") + .append("0x").append(HexDump.toHex( getLinkType ())) + .append(" (").append( getLinkType() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .referenceType = ") + .append("0x").append(HexDump.toHex( getReferenceType ())) + .append(" (").append( getReferenceType() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .options = ") + .append("0x").append(HexDump.toHex( getOptions ())) + .append(" (").append( getOptions() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .customNumberFormat = ").append(isCustomNumberFormat()).append('\n'); + buffer.append(" .indexNumberFmtRecord = ") + .append("0x").append(HexDump.toHex( getIndexNumberFmtRecord ())) + .append(" (").append( getIndexNumberFmtRecord() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .formulaOfLink = ") + .append(" (").append( getFormulaOfLink() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/AI]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeByte(field_1_linkType); + out.writeByte(field_2_referenceType); + out.writeShort(field_3_options); + out.writeShort(field_4_indexNumberFmtRecord); + field_5_formulaOfLink.serialize(out); + } + + protected int getDataSize() { + return 1 + 1 + 2 + 2 + field_5_formulaOfLink.getEncodedSize(); + } + + public short getSid() { + return sid; + } + + public Object clone() { + LinkedDataRecord rec = new LinkedDataRecord(); + + rec.field_1_linkType = field_1_linkType; + rec.field_2_referenceType = field_2_referenceType; + rec.field_3_options = field_3_options; + rec.field_4_indexNumberFmtRecord = field_4_indexNumberFmtRecord; + rec.field_5_formulaOfLink = field_5_formulaOfLink.copy(); + return rec; + } + + + + + /** + * Get the link type field for the LinkedData record. + * + * @return One of + * LINK_TYPE_TITLE_OR_TEXT + * LINK_TYPE_VALUES + * LINK_TYPE_CATEGORIES + */ + public byte getLinkType() + { + return field_1_linkType; + } + + /** + * Set the link type field for the LinkedData record. + * + * @param field_1_linkType + * One of + * LINK_TYPE_TITLE_OR_TEXT + * LINK_TYPE_VALUES + * LINK_TYPE_CATEGORIES + */ + public void setLinkType(byte field_1_linkType) + { + this.field_1_linkType = field_1_linkType; + } + + /** + * Get the reference type field for the LinkedData record. + * + * @return One of + * REFERENCE_TYPE_DEFAULT_CATEGORIES + * REFERENCE_TYPE_DIRECT + * REFERENCE_TYPE_WORKSHEET + * REFERENCE_TYPE_NOT_USED + * REFERENCE_TYPE_ERROR_REPORTED + */ + public byte getReferenceType() + { + return field_2_referenceType; + } + + /** + * Set the reference type field for the LinkedData record. + * + * @param field_2_referenceType + * One of + * REFERENCE_TYPE_DEFAULT_CATEGORIES + * REFERENCE_TYPE_DIRECT + * REFERENCE_TYPE_WORKSHEET + * REFERENCE_TYPE_NOT_USED + * REFERENCE_TYPE_ERROR_REPORTED + */ + public void setReferenceType(byte field_2_referenceType) + { + this.field_2_referenceType = field_2_referenceType; + } + + /** + * Get the options field for the LinkedData record. + */ + public short getOptions() + { + return field_3_options; + } + + /** + * Set the options field for the LinkedData record. + */ + public void setOptions(short field_3_options) + { + this.field_3_options = field_3_options; + } + + /** + * Get the index number fmt record field for the LinkedData record. + */ + public short getIndexNumberFmtRecord() + { + return field_4_indexNumberFmtRecord; + } + + /** + * Set the index number fmt record field for the LinkedData record. + */ + public void setIndexNumberFmtRecord(short field_4_indexNumberFmtRecord) + { + this.field_4_indexNumberFmtRecord = field_4_indexNumberFmtRecord; + } + + /** + * Get the formula of link field for the LinkedData record. + */ + public Ptg[] getFormulaOfLink() { + return field_5_formulaOfLink.getTokens(); + } + + /** + * Set the formula of link field for the LinkedData record. + */ + public void setFormulaOfLink(Ptg[] ptgs) + { + this.field_5_formulaOfLink = Formula.create(ptgs); + } + + /** + * Sets the custom number format field value. + * true if this object has a custom number format + */ + public void setCustomNumberFormat(boolean value) + { + field_3_options = customNumberFormat.setShortBoolean(field_3_options, value); + } + + /** + * true if this object has a custom number format + * @return the custom number format field value. + */ + public boolean isCustomNumberFormat() + { + return customNumberFormat.isSet(field_3_options); + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/NumberFormatIndexRecord.java b/src/java/org/apache/poi/hssf/record/chart/NumberFormatIndexRecord.java new file mode 100644 index 0000000000..fc9f0d7776 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/NumberFormatIndexRecord.java @@ -0,0 +1,97 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The number format index record indexes format table. This applies to an axis.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class NumberFormatIndexRecord extends StandardRecord { + public final static short sid = 0x104E; + private short field_1_formatIndex; + + + public NumberFormatIndexRecord() + { + + } + + public NumberFormatIndexRecord(RecordInputStream in) + { + field_1_formatIndex = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[IFMT]\n"); + buffer.append(" .formatIndex = ") + .append("0x").append(HexDump.toHex( getFormatIndex ())) + .append(" (").append( getFormatIndex() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/IFMT]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_formatIndex); + } + + protected int getDataSize() { + return 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + NumberFormatIndexRecord rec = new NumberFormatIndexRecord(); + + rec.field_1_formatIndex = field_1_formatIndex; + return rec; + } + + + + + /** + * Get the format index field for the NumberFormatIndex record. + */ + public short getFormatIndex() + { + return field_1_formatIndex; + } + + /** + * Set the format index field for the NumberFormatIndex record. + */ + public void setFormatIndex(short field_1_formatIndex) + { + this.field_1_formatIndex = field_1_formatIndex; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/ObjectLinkRecord.java b/src/java/org/apache/poi/hssf/record/chart/ObjectLinkRecord.java new file mode 100644 index 0000000000..a949218867 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/ObjectLinkRecord.java @@ -0,0 +1,166 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * Links text to an object on the chart or identifies it as the title.

+ * + * @author Andrew C. Oliver (acoliver at apache.org) + */ +public final class ObjectLinkRecord extends StandardRecord { + public final static short sid = 0x1027; + private short field_1_anchorId; + public final static short ANCHOR_ID_CHART_TITLE = 1; + public final static short ANCHOR_ID_Y_AXIS = 2; + public final static short ANCHOR_ID_X_AXIS = 3; + public final static short ANCHOR_ID_SERIES_OR_POINT = 4; + public final static short ANCHOR_ID_Z_AXIS = 7; + private short field_2_link1; + private short field_3_link2; + + + public ObjectLinkRecord() + { + + } + + public ObjectLinkRecord(RecordInputStream in) + { + field_1_anchorId = in.readShort(); + field_2_link1 = in.readShort(); + field_3_link2 = in.readShort(); + + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[OBJECTLINK]\n"); + buffer.append(" .anchorId = ") + .append("0x").append(HexDump.toHex( getAnchorId ())) + .append(" (").append( getAnchorId() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .link1 = ") + .append("0x").append(HexDump.toHex( getLink1 ())) + .append(" (").append( getLink1() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .link2 = ") + .append("0x").append(HexDump.toHex( getLink2 ())) + .append(" (").append( getLink2() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/OBJECTLINK]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_anchorId); + out.writeShort(field_2_link1); + out.writeShort(field_3_link2); + } + + protected int getDataSize() { + return 2 + 2 + 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + ObjectLinkRecord rec = new ObjectLinkRecord(); + + rec.field_1_anchorId = field_1_anchorId; + rec.field_2_link1 = field_2_link1; + rec.field_3_link2 = field_3_link2; + return rec; + } + + + + + /** + * Get the anchor id field for the ObjectLink record. + * + * @return One of + * ANCHOR_ID_CHART_TITLE + * ANCHOR_ID_Y_AXIS + * ANCHOR_ID_X_AXIS + * ANCHOR_ID_SERIES_OR_POINT + * ANCHOR_ID_Z_AXIS + */ + public short getAnchorId() + { + return field_1_anchorId; + } + + /** + * Set the anchor id field for the ObjectLink record. + * + * @param field_1_anchorId + * One of + * ANCHOR_ID_CHART_TITLE + * ANCHOR_ID_Y_AXIS + * ANCHOR_ID_X_AXIS + * ANCHOR_ID_SERIES_OR_POINT + * ANCHOR_ID_Z_AXIS + */ + public void setAnchorId(short field_1_anchorId) + { + this.field_1_anchorId = field_1_anchorId; + } + + /** + * Get the link 1 field for the ObjectLink record. + */ + public short getLink1() + { + return field_2_link1; + } + + /** + * Set the link 1 field for the ObjectLink record. + */ + public void setLink1(short field_2_link1) + { + this.field_2_link1 = field_2_link1; + } + + /** + * Get the link 2 field for the ObjectLink record. + */ + public short getLink2() + { + return field_3_link2; + } + + /** + * Set the link 2 field for the ObjectLink record. + */ + public void setLink2(short field_3_link2) + { + this.field_3_link2 = field_3_link2; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/PlotAreaRecord.java b/src/java/org/apache/poi/hssf/record/chart/PlotAreaRecord.java new file mode 100644 index 0000000000..47f01fd9bc --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/PlotAreaRecord.java @@ -0,0 +1,73 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.LittleEndianOutput; + +/** + * preceeds and identifies a frame as belonging to the plot area.

+ * + * @author Andrew C. Oliver (acoliver at apache.org) + */ +public final class PlotAreaRecord extends StandardRecord { + public final static short sid = 0x1035; + + + public PlotAreaRecord() + { + + } + + /** + * @param in unused (since this record has no data) + */ + public PlotAreaRecord(RecordInputStream in) + { + + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[PLOTAREA]\n"); + + buffer.append("[/PLOTAREA]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + } + + protected int getDataSize() { + return 0; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + PlotAreaRecord rec = new PlotAreaRecord(); + + return rec; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/PlotGrowthRecord.java b/src/java/org/apache/poi/hssf/record/chart/PlotGrowthRecord.java new file mode 100644 index 0000000000..1ab0ea73d4 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/PlotGrowthRecord.java @@ -0,0 +1,122 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The plot growth record specifies the scaling factors used when a font is scaled.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class PlotGrowthRecord extends StandardRecord { + public final static short sid = 0x1064; + private int field_1_horizontalScale; + private int field_2_verticalScale; + + + public PlotGrowthRecord() + { + + } + + public PlotGrowthRecord(RecordInputStream in) + { + field_1_horizontalScale = in.readInt(); + field_2_verticalScale = in.readInt(); + + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[PLOTGROWTH]\n"); + buffer.append(" .horizontalScale = ") + .append("0x").append(HexDump.toHex( getHorizontalScale ())) + .append(" (").append( getHorizontalScale() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .verticalScale = ") + .append("0x").append(HexDump.toHex( getVerticalScale ())) + .append(" (").append( getVerticalScale() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/PLOTGROWTH]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeInt(field_1_horizontalScale); + out.writeInt(field_2_verticalScale); + } + + protected int getDataSize() { + return 4 + 4; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + PlotGrowthRecord rec = new PlotGrowthRecord(); + + rec.field_1_horizontalScale = field_1_horizontalScale; + rec.field_2_verticalScale = field_2_verticalScale; + return rec; + } + + + + + /** + * Get the horizontalScale field for the PlotGrowth record. + */ + public int getHorizontalScale() + { + return field_1_horizontalScale; + } + + /** + * Set the horizontalScale field for the PlotGrowth record. + */ + public void setHorizontalScale(int field_1_horizontalScale) + { + this.field_1_horizontalScale = field_1_horizontalScale; + } + + /** + * Get the verticalScale field for the PlotGrowth record. + */ + public int getVerticalScale() + { + return field_2_verticalScale; + } + + /** + * Set the verticalScale field for the PlotGrowth record. + */ + public void setVerticalScale(int field_2_verticalScale) + { + this.field_2_verticalScale = field_2_verticalScale; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/SeriesChartGroupIndexRecord.java b/src/java/org/apache/poi/hssf/record/chart/SeriesChartGroupIndexRecord.java new file mode 100644 index 0000000000..89aaaa5cda --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/SeriesChartGroupIndexRecord.java @@ -0,0 +1,97 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The series chart group index record stores the index to the CHARTFORMAT record (0 based).

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class SeriesChartGroupIndexRecord extends StandardRecord { + public final static short sid = 0x1045; + private short field_1_chartGroupIndex; + + + public SeriesChartGroupIndexRecord() + { + + } + + public SeriesChartGroupIndexRecord(RecordInputStream in) + { + field_1_chartGroupIndex = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[SERTOCRT]\n"); + buffer.append(" .chartGroupIndex = ") + .append("0x").append(HexDump.toHex( getChartGroupIndex ())) + .append(" (").append( getChartGroupIndex() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/SERTOCRT]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_chartGroupIndex); + } + + protected int getDataSize() { + return 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + SeriesChartGroupIndexRecord rec = new SeriesChartGroupIndexRecord(); + + rec.field_1_chartGroupIndex = field_1_chartGroupIndex; + return rec; + } + + + + + /** + * Get the chart group index field for the SeriesChartGroupIndex record. + */ + public short getChartGroupIndex() + { + return field_1_chartGroupIndex; + } + + /** + * Set the chart group index field for the SeriesChartGroupIndex record. + */ + public void setChartGroupIndex(short field_1_chartGroupIndex) + { + this.field_1_chartGroupIndex = field_1_chartGroupIndex; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/SeriesIndexRecord.java b/src/java/org/apache/poi/hssf/record/chart/SeriesIndexRecord.java new file mode 100644 index 0000000000..3204cdda2b --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/SeriesIndexRecord.java @@ -0,0 +1,97 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * links a series to its position in the series list.

+ * + * @author Andrew C. Oliver (acoliver at apache.org) + */ +public final class SeriesIndexRecord extends StandardRecord { + public final static short sid = 0x1065; + private short field_1_index; + + + public SeriesIndexRecord() + { + + } + + public SeriesIndexRecord(RecordInputStream in) + { + field_1_index = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[SINDEX]\n"); + buffer.append(" .index = ") + .append("0x").append(HexDump.toHex( getIndex ())) + .append(" (").append( getIndex() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/SINDEX]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_index); + } + + protected int getDataSize() { + return 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + SeriesIndexRecord rec = new SeriesIndexRecord(); + + rec.field_1_index = field_1_index; + return rec; + } + + + + + /** + * Get the index field for the SeriesIndex record. + */ + public short getIndex() + { + return field_1_index; + } + + /** + * Set the index field for the SeriesIndex record. + */ + public void setIndex(short field_1_index) + { + this.field_1_index = field_1_index; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/SeriesLabelsRecord.java b/src/java/org/apache/poi/hssf/record/chart/SeriesLabelsRecord.java new file mode 100644 index 0000000000..9fff21af92 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/SeriesLabelsRecord.java @@ -0,0 +1,220 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.BitField; +import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The series label record defines the type of label associated with the data format record.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class SeriesLabelsRecord extends StandardRecord { + public final static short sid = 0x100c; + + private static final BitField showActual = BitFieldFactory.getInstance(0x01); + private static final BitField showPercent = BitFieldFactory.getInstance(0x02); + private static final BitField labelAsPercentage = BitFieldFactory.getInstance(0x04); + private static final BitField smoothedLine = BitFieldFactory.getInstance(0x08); + private static final BitField showLabel = BitFieldFactory.getInstance(0x10); + private static final BitField showBubbleSizes = BitFieldFactory.getInstance(0x20); + + private short field_1_formatFlags; + + public SeriesLabelsRecord() + { + + } + + public SeriesLabelsRecord(RecordInputStream in) + { + field_1_formatFlags = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[ATTACHEDLABEL]\n"); + buffer.append(" .formatFlags = ") + .append("0x").append(HexDump.toHex( getFormatFlags ())) + .append(" (").append( getFormatFlags() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .showActual = ").append(isShowActual()).append('\n'); + buffer.append(" .showPercent = ").append(isShowPercent()).append('\n'); + buffer.append(" .labelAsPercentage = ").append(isLabelAsPercentage()).append('\n'); + buffer.append(" .smoothedLine = ").append(isSmoothedLine()).append('\n'); + buffer.append(" .showLabel = ").append(isShowLabel()).append('\n'); + buffer.append(" .showBubbleSizes = ").append(isShowBubbleSizes()).append('\n'); + + buffer.append("[/ATTACHEDLABEL]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_formatFlags); + } + + protected int getDataSize() { + return 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + SeriesLabelsRecord rec = new SeriesLabelsRecord(); + + rec.field_1_formatFlags = field_1_formatFlags; + return rec; + } + + + + + /** + * Get the format flags field for the SeriesLabels record. + */ + public short getFormatFlags() + { + return field_1_formatFlags; + } + + /** + * Set the format flags field for the SeriesLabels record. + */ + public void setFormatFlags(short field_1_formatFlags) + { + this.field_1_formatFlags = field_1_formatFlags; + } + + /** + * Sets the show actual field value. + * show actual value of the data point + */ + public void setShowActual(boolean value) + { + field_1_formatFlags = showActual.setShortBoolean(field_1_formatFlags, value); + } + + /** + * show actual value of the data point + * @return the show actual field value. + */ + public boolean isShowActual() + { + return showActual.isSet(field_1_formatFlags); + } + + /** + * Sets the show percent field value. + * show value as percentage of total (pie charts only) + */ + public void setShowPercent(boolean value) + { + field_1_formatFlags = showPercent.setShortBoolean(field_1_formatFlags, value); + } + + /** + * show value as percentage of total (pie charts only) + * @return the show percent field value. + */ + public boolean isShowPercent() + { + return showPercent.isSet(field_1_formatFlags); + } + + /** + * Sets the label as percentage field value. + * show category label/value as percentage (pie charts only) + */ + public void setLabelAsPercentage(boolean value) + { + field_1_formatFlags = labelAsPercentage.setShortBoolean(field_1_formatFlags, value); + } + + /** + * show category label/value as percentage (pie charts only) + * @return the label as percentage field value. + */ + public boolean isLabelAsPercentage() + { + return labelAsPercentage.isSet(field_1_formatFlags); + } + + /** + * Sets the smoothed line field value. + * show smooth line + */ + public void setSmoothedLine(boolean value) + { + field_1_formatFlags = smoothedLine.setShortBoolean(field_1_formatFlags, value); + } + + /** + * show smooth line + * @return the smoothed line field value. + */ + public boolean isSmoothedLine() + { + return smoothedLine.isSet(field_1_formatFlags); + } + + /** + * Sets the show label field value. + * display category label + */ + public void setShowLabel(boolean value) + { + field_1_formatFlags = showLabel.setShortBoolean(field_1_formatFlags, value); + } + + /** + * display category label + * @return the show label field value. + */ + public boolean isShowLabel() + { + return showLabel.isSet(field_1_formatFlags); + } + + /** + * Sets the show bubble sizes field value. + * ?? + */ + public void setShowBubbleSizes(boolean value) + { + field_1_formatFlags = showBubbleSizes.setShortBoolean(field_1_formatFlags, value); + } + + /** + * ?? + * @return the show bubble sizes field value. + */ + public boolean isShowBubbleSizes() + { + return showBubbleSizes.isSet(field_1_formatFlags); + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/SeriesListRecord.java b/src/java/org/apache/poi/hssf/record/chart/SeriesListRecord.java new file mode 100644 index 0000000000..779ae05afe --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/SeriesListRecord.java @@ -0,0 +1,101 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.LittleEndianOutput; + +/** + * SERIESLIST (0x1016) + * + * The series list record defines the series displayed as an overlay to the main chart record.
+ * This record doesn't seem to be referenced in either the OOO or MS doc, but this page mentions it + * http://ooxmlisdefectivebydesign.blogspot.com/2008/03/bad-surprise-in-microsoft-office-binary.html + * + * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class SeriesListRecord extends StandardRecord { + public final static short sid = 0x1016; + private short[] field_1_seriesNumbers; + + public SeriesListRecord(short[] seriesNumbers) { + field_1_seriesNumbers = seriesNumbers; + } + + public SeriesListRecord(RecordInputStream in) { + int nItems = in.readUShort(); + short[] ss = new short[nItems]; + for (int i = 0; i < nItems; i++) { + ss[i] = in.readShort(); + + } + field_1_seriesNumbers = ss; + } + + public String toString() { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[SERIESLIST]\n"); + buffer.append(" .seriesNumbers= ").append(" (").append( getSeriesNumbers() ).append(" )"); + buffer.append("\n"); + + buffer.append("[/SERIESLIST]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + + int nItems = field_1_seriesNumbers.length; + out.writeShort(nItems); + for (int i = 0; i < nItems; i++) { + out.writeShort(field_1_seriesNumbers[i]); + } + } + + protected int getDataSize() { + return field_1_seriesNumbers.length * 2 + 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + return new SeriesListRecord(field_1_seriesNumbers.clone()); + } + + /** + * Get the series numbers field for the SeriesList record. + */ + public short[] getSeriesNumbers() { + return field_1_seriesNumbers; + } + + /** + * Set the series numbers field for the SeriesList record. + */ + public void setSeriesNumbers(short[] field_1_seriesNumbers) { + this.field_1_seriesNumbers = field_1_seriesNumbers; + } +} + + + diff --git a/src/java/org/apache/poi/hssf/record/chart/SeriesRecord.java b/src/java/org/apache/poi/hssf/record/chart/SeriesRecord.java new file mode 100644 index 0000000000..91be5aa9af --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/SeriesRecord.java @@ -0,0 +1,269 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The series record describes the overall data for a series.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class SeriesRecord extends StandardRecord { + public final static short sid = 0x1003; + private short field_1_categoryDataType; + public final static short CATEGORY_DATA_TYPE_DATES = 0; + public final static short CATEGORY_DATA_TYPE_NUMERIC = 1; + public final static short CATEGORY_DATA_TYPE_SEQUENCE = 2; + public final static short CATEGORY_DATA_TYPE_TEXT = 3; + private short field_2_valuesDataType; + public final static short VALUES_DATA_TYPE_DATES = 0; + public final static short VALUES_DATA_TYPE_NUMERIC = 1; + public final static short VALUES_DATA_TYPE_SEQUENCE = 2; + public final static short VALUES_DATA_TYPE_TEXT = 3; + private short field_3_numCategories; + private short field_4_numValues; + private short field_5_bubbleSeriesType; + public final static short BUBBLE_SERIES_TYPE_DATES = 0; + public final static short BUBBLE_SERIES_TYPE_NUMERIC = 1; + public final static short BUBBLE_SERIES_TYPE_SEQUENCE = 2; + public final static short BUBBLE_SERIES_TYPE_TEXT = 3; + private short field_6_numBubbleValues; + + + public SeriesRecord() + { + + } + + public SeriesRecord(RecordInputStream in) + { + field_1_categoryDataType = in.readShort(); + field_2_valuesDataType = in.readShort(); + field_3_numCategories = in.readShort(); + field_4_numValues = in.readShort(); + field_5_bubbleSeriesType = in.readShort(); + field_6_numBubbleValues = in.readShort(); + + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[SERIES]\n"); + buffer.append(" .categoryDataType = ") + .append("0x").append(HexDump.toHex( getCategoryDataType ())) + .append(" (").append( getCategoryDataType() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .valuesDataType = ") + .append("0x").append(HexDump.toHex( getValuesDataType ())) + .append(" (").append( getValuesDataType() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .numCategories = ") + .append("0x").append(HexDump.toHex( getNumCategories ())) + .append(" (").append( getNumCategories() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .numValues = ") + .append("0x").append(HexDump.toHex( getNumValues ())) + .append(" (").append( getNumValues() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .bubbleSeriesType = ") + .append("0x").append(HexDump.toHex( getBubbleSeriesType ())) + .append(" (").append( getBubbleSeriesType() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .numBubbleValues = ") + .append("0x").append(HexDump.toHex( getNumBubbleValues ())) + .append(" (").append( getNumBubbleValues() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/SERIES]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_categoryDataType); + out.writeShort(field_2_valuesDataType); + out.writeShort(field_3_numCategories); + out.writeShort(field_4_numValues); + out.writeShort(field_5_bubbleSeriesType); + out.writeShort(field_6_numBubbleValues); + } + + protected int getDataSize() { + return 2 + 2 + 2 + 2 + 2 + 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + SeriesRecord rec = new SeriesRecord(); + + rec.field_1_categoryDataType = field_1_categoryDataType; + rec.field_2_valuesDataType = field_2_valuesDataType; + rec.field_3_numCategories = field_3_numCategories; + rec.field_4_numValues = field_4_numValues; + rec.field_5_bubbleSeriesType = field_5_bubbleSeriesType; + rec.field_6_numBubbleValues = field_6_numBubbleValues; + return rec; + } + + + + + /** + * Get the category data type field for the Series record. + * + * @return One of + * CATEGORY_DATA_TYPE_DATES + * CATEGORY_DATA_TYPE_NUMERIC + * CATEGORY_DATA_TYPE_SEQUENCE + * CATEGORY_DATA_TYPE_TEXT + */ + public short getCategoryDataType() + { + return field_1_categoryDataType; + } + + /** + * Set the category data type field for the Series record. + * + * @param field_1_categoryDataType + * One of + * CATEGORY_DATA_TYPE_DATES + * CATEGORY_DATA_TYPE_NUMERIC + * CATEGORY_DATA_TYPE_SEQUENCE + * CATEGORY_DATA_TYPE_TEXT + */ + public void setCategoryDataType(short field_1_categoryDataType) + { + this.field_1_categoryDataType = field_1_categoryDataType; + } + + /** + * Get the values data type field for the Series record. + * + * @return One of + * VALUES_DATA_TYPE_DATES + * VALUES_DATA_TYPE_NUMERIC + * VALUES_DATA_TYPE_SEQUENCE + * VALUES_DATA_TYPE_TEXT + */ + public short getValuesDataType() + { + return field_2_valuesDataType; + } + + /** + * Set the values data type field for the Series record. + * + * @param field_2_valuesDataType + * One of + * VALUES_DATA_TYPE_DATES + * VALUES_DATA_TYPE_NUMERIC + * VALUES_DATA_TYPE_SEQUENCE + * VALUES_DATA_TYPE_TEXT + */ + public void setValuesDataType(short field_2_valuesDataType) + { + this.field_2_valuesDataType = field_2_valuesDataType; + } + + /** + * Get the num categories field for the Series record. + */ + public short getNumCategories() + { + return field_3_numCategories; + } + + /** + * Set the num categories field for the Series record. + */ + public void setNumCategories(short field_3_numCategories) + { + this.field_3_numCategories = field_3_numCategories; + } + + /** + * Get the num values field for the Series record. + */ + public short getNumValues() + { + return field_4_numValues; + } + + /** + * Set the num values field for the Series record. + */ + public void setNumValues(short field_4_numValues) + { + this.field_4_numValues = field_4_numValues; + } + + /** + * Get the bubble series type field for the Series record. + * + * @return One of + * BUBBLE_SERIES_TYPE_DATES + * BUBBLE_SERIES_TYPE_NUMERIC + * BUBBLE_SERIES_TYPE_SEQUENCE + * BUBBLE_SERIES_TYPE_TEXT + */ + public short getBubbleSeriesType() + { + return field_5_bubbleSeriesType; + } + + /** + * Set the bubble series type field for the Series record. + * + * @param field_5_bubbleSeriesType + * One of + * BUBBLE_SERIES_TYPE_DATES + * BUBBLE_SERIES_TYPE_NUMERIC + * BUBBLE_SERIES_TYPE_SEQUENCE + * BUBBLE_SERIES_TYPE_TEXT + */ + public void setBubbleSeriesType(short field_5_bubbleSeriesType) + { + this.field_5_bubbleSeriesType = field_5_bubbleSeriesType; + } + + /** + * Get the num bubble values field for the Series record. + */ + public short getNumBubbleValues() + { + return field_6_numBubbleValues; + } + + /** + * Set the num bubble values field for the Series record. + */ + public void setNumBubbleValues(short field_6_numBubbleValues) + { + this.field_6_numBubbleValues = field_6_numBubbleValues; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/SeriesTextRecord.java b/src/java/org/apache/poi/hssf/record/chart/SeriesTextRecord.java new file mode 100644 index 0000000000..01a78b51a5 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/SeriesTextRecord.java @@ -0,0 +1,133 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; +import org.apache.poi.util.StringUtil; + +/** + * SERIESTEXT (0x100D)

+ * Defines a series name

+ * + * @author Andrew C. Oliver (acoliver at apache.org) + */ +public final class SeriesTextRecord extends StandardRecord { + public final static short sid = 0x100D; + + /** the actual text cannot be longer than 255 characters */ + private static final int MAX_LEN = 0xFF; + private int field_1_id; + private boolean is16bit; + private String field_4_text; + + public SeriesTextRecord() { + field_4_text = ""; + is16bit = false; + } + + public SeriesTextRecord(RecordInputStream in) { + field_1_id = in.readUShort(); + int field_2_textLength = in.readUByte(); + is16bit = (in.readUByte() & 0x01) != 0; + if (is16bit) { + field_4_text = in.readUnicodeLEString(field_2_textLength); + } else { + field_4_text = in.readCompressedUnicode(field_2_textLength); + } + } + + public String toString() { + StringBuffer sb = new StringBuffer(); + + sb.append("[SERIESTEXT]\n"); + sb.append(" .id =").append(HexDump.shortToHex(getId())).append('\n'); + sb.append(" .textLen=").append(field_4_text.length()).append('\n'); + sb.append(" .is16bit=").append(is16bit).append('\n'); + sb.append(" .text =").append(" (").append(getText()).append(" )").append('\n'); + sb.append("[/SERIESTEXT]\n"); + return sb.toString(); + } + + public void serialize(LittleEndianOutput out) { + + out.writeShort(field_1_id); + out.writeByte(field_4_text.length()); + if (is16bit) { + // Excel (2007) seems to choose 16bit regardless of whether it is needed + out.writeByte(0x01); + StringUtil.putUnicodeLE(field_4_text, out); + } else { + // Excel can read this OK + out.writeByte(0x00); + StringUtil.putCompressedUnicode(field_4_text, out); + } + } + + protected int getDataSize() { + return 2 + 1 + 1 + field_4_text.length() * (is16bit ? 2 : 1); + } + + public short getSid() { + return sid; + } + + public Object clone() { + SeriesTextRecord rec = new SeriesTextRecord(); + + rec.field_1_id = field_1_id; + rec.is16bit = is16bit; + rec.field_4_text = field_4_text; + return rec; + } + + /** + * Get the id field for the SeriesText record. + */ + public int getId() { + return field_1_id; + } + + /** + * Set the id field for the SeriesText record. + */ + public void setId(int id) { + field_1_id = id; + } + + /** + * Get the text field for the SeriesText record. + */ + public String getText() { + return field_4_text; + } + + /** + * Set the text field for the SeriesText record. + */ + public void setText(String text) { + if (text.length() > MAX_LEN) { + throw new IllegalArgumentException("Text is too long (" + + text.length() + ">" + MAX_LEN + ")"); + } + field_4_text = text; + is16bit = StringUtil.hasMultibyte(text); + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/SeriesToChartGroupRecord.java b/src/java/org/apache/poi/hssf/record/chart/SeriesToChartGroupRecord.java new file mode 100644 index 0000000000..164f82c7f2 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/SeriesToChartGroupRecord.java @@ -0,0 +1,99 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * Indicates the chart-group index for a series. The order probably defines the mapping. + * So the 0th record probably means the 0th series. The only field in this of course defines which chart + * group the 0th series (for instance) would map to. Confusing? Well thats because it is. (p 522 BCG)

+ * + * @author Andrew C. Oliver (acoliver at apache.org) + */ +public final class SeriesToChartGroupRecord extends StandardRecord { + public final static short sid = 0x1045; + private short field_1_chartGroupIndex; + + + public SeriesToChartGroupRecord() + { + + } + + public SeriesToChartGroupRecord(RecordInputStream in) + { + field_1_chartGroupIndex = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[SeriesToChartGroup]\n"); + buffer.append(" .chartGroupIndex = ") + .append("0x").append(HexDump.toHex( getChartGroupIndex ())) + .append(" (").append( getChartGroupIndex() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/SeriesToChartGroup]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_chartGroupIndex); + } + + protected int getDataSize() { + return 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + SeriesToChartGroupRecord rec = new SeriesToChartGroupRecord(); + + rec.field_1_chartGroupIndex = field_1_chartGroupIndex; + return rec; + } + + + + + /** + * Get the chart group index field for the SeriesToChartGroup record. + */ + public short getChartGroupIndex() + { + return field_1_chartGroupIndex; + } + + /** + * Set the chart group index field for the SeriesToChartGroup record. + */ + public void setChartGroupIndex(short field_1_chartGroupIndex) + { + this.field_1_chartGroupIndex = field_1_chartGroupIndex; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/SheetPropertiesRecord.java b/src/java/org/apache/poi/hssf/record/chart/SheetPropertiesRecord.java new file mode 100644 index 0000000000..7ca006354a --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/SheetPropertiesRecord.java @@ -0,0 +1,239 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.BitField; +import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * Describes a chart sheet properties record.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class SheetPropertiesRecord extends StandardRecord { + public final static short sid = 0x1044; + + private static final BitField chartTypeManuallyFormatted = BitFieldFactory.getInstance(0x01); + private static final BitField plotVisibleOnly = BitFieldFactory.getInstance(0x02); + private static final BitField doNotSizeWithWindow = BitFieldFactory.getInstance(0x04); + private static final BitField defaultPlotDimensions = BitFieldFactory.getInstance(0x08); + private static final BitField autoPlotArea = BitFieldFactory.getInstance(0x10); + + private short field_1_flags; + private byte field_2_empty; + public final static byte EMPTY_NOT_PLOTTED = 0; + public final static byte EMPTY_ZERO = 1; + public final static byte EMPTY_INTERPOLATED = 2; + + + public SheetPropertiesRecord() + { + + } + + public SheetPropertiesRecord(RecordInputStream in) + { + field_1_flags = in.readShort(); + field_2_empty = in.readByte(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[SHTPROPS]\n"); + buffer.append(" .flags = ") + .append("0x").append(HexDump.toHex( getFlags ())) + .append(" (").append( getFlags() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .chartTypeManuallyFormatted = ").append(isChartTypeManuallyFormatted()).append('\n'); + buffer.append(" .plotVisibleOnly = ").append(isPlotVisibleOnly()).append('\n'); + buffer.append(" .doNotSizeWithWindow = ").append(isDoNotSizeWithWindow()).append('\n'); + buffer.append(" .defaultPlotDimensions = ").append(isDefaultPlotDimensions()).append('\n'); + buffer.append(" .autoPlotArea = ").append(isAutoPlotArea()).append('\n'); + buffer.append(" .empty = ") + .append("0x").append(HexDump.toHex( getEmpty ())) + .append(" (").append( getEmpty() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/SHTPROPS]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_flags); + out.writeByte(field_2_empty); + } + + protected int getDataSize() { + return 2 + 1; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + SheetPropertiesRecord rec = new SheetPropertiesRecord(); + + rec.field_1_flags = field_1_flags; + rec.field_2_empty = field_2_empty; + return rec; + } + + + + + /** + * Get the flags field for the SheetProperties record. + */ + public short getFlags() + { + return field_1_flags; + } + + /** + * Set the flags field for the SheetProperties record. + */ + public void setFlags(short field_1_flags) + { + this.field_1_flags = field_1_flags; + } + + /** + * Get the empty field for the SheetProperties record. + * + * @return One of + * EMPTY_NOT_PLOTTED + * EMPTY_ZERO + * EMPTY_INTERPOLATED + */ + public byte getEmpty() + { + return field_2_empty; + } + + /** + * Set the empty field for the SheetProperties record. + * + * @param field_2_empty + * One of + * EMPTY_NOT_PLOTTED + * EMPTY_ZERO + * EMPTY_INTERPOLATED + */ + public void setEmpty(byte field_2_empty) + { + this.field_2_empty = field_2_empty; + } + + /** + * Sets the chart type manually formatted field value. + * Has the chart type been manually formatted? + */ + public void setChartTypeManuallyFormatted(boolean value) + { + field_1_flags = chartTypeManuallyFormatted.setShortBoolean(field_1_flags, value); + } + + /** + * Has the chart type been manually formatted? + * @return the chart type manually formatted field value. + */ + public boolean isChartTypeManuallyFormatted() + { + return chartTypeManuallyFormatted.isSet(field_1_flags); + } + + /** + * Sets the plot visible only field value. + * Only show visible cells on the chart. + */ + public void setPlotVisibleOnly(boolean value) + { + field_1_flags = plotVisibleOnly.setShortBoolean(field_1_flags, value); + } + + /** + * Only show visible cells on the chart. + * @return the plot visible only field value. + */ + public boolean isPlotVisibleOnly() + { + return plotVisibleOnly.isSet(field_1_flags); + } + + /** + * Sets the do not size with window field value. + * Do not size the chart when the window changes size + */ + public void setDoNotSizeWithWindow(boolean value) + { + field_1_flags = doNotSizeWithWindow.setShortBoolean(field_1_flags, value); + } + + /** + * Do not size the chart when the window changes size + * @return the do not size with window field value. + */ + public boolean isDoNotSizeWithWindow() + { + return doNotSizeWithWindow.isSet(field_1_flags); + } + + /** + * Sets the default plot dimensions field value. + * Indicates that the default area dimensions should be used. + */ + public void setDefaultPlotDimensions(boolean value) + { + field_1_flags = defaultPlotDimensions.setShortBoolean(field_1_flags, value); + } + + /** + * Indicates that the default area dimensions should be used. + * @return the default plot dimensions field value. + */ + public boolean isDefaultPlotDimensions() + { + return defaultPlotDimensions.isSet(field_1_flags); + } + + /** + * Sets the auto plot area field value. + * ?? + */ + public void setAutoPlotArea(boolean value) + { + field_1_flags = autoPlotArea.setShortBoolean(field_1_flags, value); + } + + /** + * ?? + * @return the auto plot area field value. + */ + public boolean isAutoPlotArea() + { + return autoPlotArea.isSet(field_1_flags); + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/TextRecord.java b/src/java/org/apache/poi/hssf/record/chart/TextRecord.java new file mode 100644 index 0000000000..1772d30065 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/TextRecord.java @@ -0,0 +1,707 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.BitField; +import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The text record is used to define text stored on a chart.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TextRecord extends StandardRecord { + public final static short sid = 0x1025; + + private static final BitField dataLabelPlacement = BitFieldFactory.getInstance(0x000F); + private static final BitField autoColor = BitFieldFactory.getInstance(0x0001); + private static final BitField showKey = BitFieldFactory.getInstance(0x0002); + private static final BitField showValue = BitFieldFactory.getInstance(0x0004); + private static final BitField vertical = BitFieldFactory.getInstance(0x0008); + private static final BitField autoGeneratedText = BitFieldFactory.getInstance(0x0010); + private static final BitField generated = BitFieldFactory.getInstance(0x0020); + private static final BitField autoLabelDeleted = BitFieldFactory.getInstance(0x0040); + private static final BitField autoBackground = BitFieldFactory.getInstance(0x0080); + private static final BitField rotation = BitFieldFactory.getInstance(0x0700); + + private static final BitField showCategoryLabelAsPercentage = BitFieldFactory.getInstance(0x0800); + private static final BitField showValueAsPercentage = BitFieldFactory.getInstance(0x1000); + private static final BitField showBubbleSizes = BitFieldFactory.getInstance(0x2000); + private static final BitField showLabel = BitFieldFactory.getInstance(0x4000); + + + private byte field_1_horizontalAlignment; + public final static byte HORIZONTAL_ALIGNMENT_LEFT = 1; + public final static byte HORIZONTAL_ALIGNMENT_CENTER = 2; + public final static byte HORIZONTAL_ALIGNMENT_BOTTOM = 3; + public final static byte HORIZONTAL_ALIGNMENT_JUSTIFY = 4; + private byte field_2_verticalAlignment; + public final static byte VERTICAL_ALIGNMENT_TOP = 1; + public final static byte VERTICAL_ALIGNMENT_CENTER = 2; + public final static byte VERTICAL_ALIGNMENT_BOTTOM = 3; + public final static byte VERTICAL_ALIGNMENT_JUSTIFY = 4; + private short field_3_displayMode; + public final static short DISPLAY_MODE_TRANSPARENT = 1; + public final static short DISPLAY_MODE_OPAQUE = 2; + private int field_4_rgbColor; + private int field_5_x; + private int field_6_y; + private int field_7_width; + private int field_8_height; + private short field_9_options1; + 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 short field_10_indexOfColorValue; + private short field_11_options2; + 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; + public final static short DATA_LABEL_PLACEMENT_CENTER = 3; + public final static short DATA_LABEL_PLACEMENT_AXIS = 4; + public final static short DATA_LABEL_PLACEMENT_ABOVE = 5; + public final static short DATA_LABEL_PLACEMENT_BELOW = 6; + public final static short DATA_LABEL_PLACEMENT_LEFT = 7; + public final static short DATA_LABEL_PLACEMENT_RIGHT = 8; + public final static short DATA_LABEL_PLACEMENT_AUTO = 9; + public final static short DATA_LABEL_PLACEMENT_USER_MOVED = 10; + private short field_12_textRotation; + + + public TextRecord() + { + + } + + public TextRecord(RecordInputStream in) + { + field_1_horizontalAlignment = in.readByte(); + field_2_verticalAlignment = in.readByte(); + field_3_displayMode = in.readShort(); + field_4_rgbColor = in.readInt(); + field_5_x = in.readInt(); + field_6_y = in.readInt(); + field_7_width = in.readInt(); + field_8_height = in.readInt(); + field_9_options1 = in.readShort(); + field_10_indexOfColorValue = in.readShort(); + field_11_options2 = in.readShort(); + field_12_textRotation = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[TEXT]\n"); + buffer.append(" .horizontalAlignment = ") + .append("0x").append(HexDump.toHex( getHorizontalAlignment ())) + .append(" (").append( getHorizontalAlignment() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .verticalAlignment = ") + .append("0x").append(HexDump.toHex( getVerticalAlignment ())) + .append(" (").append( getVerticalAlignment() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .displayMode = ") + .append("0x").append(HexDump.toHex( getDisplayMode ())) + .append(" (").append( getDisplayMode() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .rgbColor = ") + .append("0x").append(HexDump.toHex( getRgbColor ())) + .append(" (").append( getRgbColor() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .x = ") + .append("0x").append(HexDump.toHex( getX ())) + .append(" (").append( getX() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .y = ") + .append("0x").append(HexDump.toHex( getY ())) + .append(" (").append( getY() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .width = ") + .append("0x").append(HexDump.toHex( getWidth ())) + .append(" (").append( getWidth() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .height = ") + .append("0x").append(HexDump.toHex( getHeight ())) + .append(" (").append( getHeight() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .options1 = ") + .append("0x").append(HexDump.toHex( getOptions1 ())) + .append(" (").append( getOptions1() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .autoColor = ").append(isAutoColor()).append('\n'); + buffer.append(" .showKey = ").append(isShowKey()).append('\n'); + buffer.append(" .showValue = ").append(isShowValue()).append('\n'); + buffer.append(" .vertical = ").append(isVertical()).append('\n'); + buffer.append(" .autoGeneratedText = ").append(isAutoGeneratedText()).append('\n'); + buffer.append(" .generated = ").append(isGenerated()).append('\n'); + buffer.append(" .autoLabelDeleted = ").append(isAutoLabelDeleted()).append('\n'); + buffer.append(" .autoBackground = ").append(isAutoBackground()).append('\n'); + buffer.append(" .rotation = ").append(getRotation()).append('\n'); + buffer.append(" .showCategoryLabelAsPercentage = ").append(isShowCategoryLabelAsPercentage()).append('\n'); + buffer.append(" .showValueAsPercentage = ").append(isShowValueAsPercentage()).append('\n'); + buffer.append(" .showBubbleSizes = ").append(isShowBubbleSizes()).append('\n'); + buffer.append(" .showLabel = ").append(isShowLabel()).append('\n'); + buffer.append(" .indexOfColorValue = ") + .append("0x").append(HexDump.toHex( getIndexOfColorValue ())) + .append(" (").append( getIndexOfColorValue() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .options2 = ") + .append("0x").append(HexDump.toHex( getOptions2 ())) + .append(" (").append( getOptions2() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .dataLabelPlacement = ").append(getDataLabelPlacement()).append('\n'); + buffer.append(" .textRotation = ") + .append("0x").append(HexDump.toHex( getTextRotation ())) + .append(" (").append( getTextRotation() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/TEXT]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeByte(field_1_horizontalAlignment); + out.writeByte(field_2_verticalAlignment); + out.writeShort(field_3_displayMode); + out.writeInt(field_4_rgbColor); + out.writeInt(field_5_x); + out.writeInt(field_6_y); + out.writeInt(field_7_width); + out.writeInt(field_8_height); + out.writeShort(field_9_options1); + out.writeShort(field_10_indexOfColorValue); + out.writeShort(field_11_options2); + out.writeShort(field_12_textRotation); + } + + protected int getDataSize() { + return 1 + 1 + 2 + 4 + 4 + 4 + 4 + 4 + 2 + 2 + 2 + 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + TextRecord rec = new TextRecord(); + + rec.field_1_horizontalAlignment = field_1_horizontalAlignment; + rec.field_2_verticalAlignment = field_2_verticalAlignment; + rec.field_3_displayMode = field_3_displayMode; + rec.field_4_rgbColor = field_4_rgbColor; + rec.field_5_x = field_5_x; + rec.field_6_y = field_6_y; + rec.field_7_width = field_7_width; + rec.field_8_height = field_8_height; + rec.field_9_options1 = field_9_options1; + rec.field_10_indexOfColorValue = field_10_indexOfColorValue; + rec.field_11_options2 = field_11_options2; + rec.field_12_textRotation = field_12_textRotation; + return rec; + } + + + + + /** + * Get the horizontal alignment field for the Text record. + * + * @return One of + * HORIZONTAL_ALIGNMENT_LEFT + * HORIZONTAL_ALIGNMENT_CENTER + * HORIZONTAL_ALIGNMENT_BOTTOM + * HORIZONTAL_ALIGNMENT_JUSTIFY + */ + public byte getHorizontalAlignment() + { + return field_1_horizontalAlignment; + } + + /** + * Set the horizontal alignment field for the Text record. + * + * @param field_1_horizontalAlignment + * One of + * HORIZONTAL_ALIGNMENT_LEFT + * HORIZONTAL_ALIGNMENT_CENTER + * HORIZONTAL_ALIGNMENT_BOTTOM + * HORIZONTAL_ALIGNMENT_JUSTIFY + */ + public void setHorizontalAlignment(byte field_1_horizontalAlignment) + { + this.field_1_horizontalAlignment = field_1_horizontalAlignment; + } + + /** + * Get the vertical alignment field for the Text record. + * + * @return One of + * VERTICAL_ALIGNMENT_TOP + * VERTICAL_ALIGNMENT_CENTER + * VERTICAL_ALIGNMENT_BOTTOM + * VERTICAL_ALIGNMENT_JUSTIFY + */ + public byte getVerticalAlignment() + { + return field_2_verticalAlignment; + } + + /** + * Set the vertical alignment field for the Text record. + * + * @param field_2_verticalAlignment + * One of + * VERTICAL_ALIGNMENT_TOP + * VERTICAL_ALIGNMENT_CENTER + * VERTICAL_ALIGNMENT_BOTTOM + * VERTICAL_ALIGNMENT_JUSTIFY + */ + public void setVerticalAlignment(byte field_2_verticalAlignment) + { + this.field_2_verticalAlignment = field_2_verticalAlignment; + } + + /** + * Get the display mode field for the Text record. + * + * @return One of + * DISPLAY_MODE_TRANSPARENT + * DISPLAY_MODE_OPAQUE + */ + public short getDisplayMode() + { + return field_3_displayMode; + } + + /** + * Set the display mode field for the Text record. + * + * @param field_3_displayMode + * One of + * DISPLAY_MODE_TRANSPARENT + * DISPLAY_MODE_OPAQUE + */ + public void setDisplayMode(short field_3_displayMode) + { + this.field_3_displayMode = field_3_displayMode; + } + + /** + * Get the rgbColor field for the Text record. + */ + public int getRgbColor() + { + return field_4_rgbColor; + } + + /** + * Set the rgbColor field for the Text record. + */ + public void setRgbColor(int field_4_rgbColor) + { + this.field_4_rgbColor = field_4_rgbColor; + } + + /** + * Get the x field for the Text record. + */ + public int getX() + { + return field_5_x; + } + + /** + * Set the x field for the Text record. + */ + public void setX(int field_5_x) + { + this.field_5_x = field_5_x; + } + + /** + * Get the y field for the Text record. + */ + public int getY() + { + return field_6_y; + } + + /** + * Set the y field for the Text record. + */ + public void setY(int field_6_y) + { + this.field_6_y = field_6_y; + } + + /** + * Get the width field for the Text record. + */ + public int getWidth() + { + return field_7_width; + } + + /** + * Set the width field for the Text record. + */ + public void setWidth(int field_7_width) + { + this.field_7_width = field_7_width; + } + + /** + * Get the height field for the Text record. + */ + public int getHeight() + { + return field_8_height; + } + + /** + * Set the height field for the Text record. + */ + public void setHeight(int field_8_height) + { + this.field_8_height = field_8_height; + } + + /** + * Get the options1 field for the Text record. + */ + public short getOptions1() + { + return field_9_options1; + } + + /** + * Set the options1 field for the Text record. + */ + public void setOptions1(short field_9_options1) + { + this.field_9_options1 = field_9_options1; + } + + /** + * Get the index of color value field for the Text record. + */ + public short getIndexOfColorValue() + { + return field_10_indexOfColorValue; + } + + /** + * Set the index of color value field for the Text record. + */ + public void setIndexOfColorValue(short field_10_indexOfColorValue) + { + this.field_10_indexOfColorValue = field_10_indexOfColorValue; + } + + /** + * Get the options2 field for the Text record. + */ + public short getOptions2() + { + return field_11_options2; + } + + /** + * Set the options2 field for the Text record. + */ + public void setOptions2(short field_11_options2) + { + this.field_11_options2 = field_11_options2; + } + + /** + * Get the text rotation field for the Text record. + */ + public short getTextRotation() + { + return field_12_textRotation; + } + + /** + * Set the text rotation field for the Text record. + */ + public void setTextRotation(short field_12_textRotation) + { + this.field_12_textRotation = field_12_textRotation; + } + + /** + * Sets the auto color field value. + * true = automaticly selected colour, false = user-selected + */ + public void setAutoColor(boolean value) + { + field_9_options1 = autoColor.setShortBoolean(field_9_options1, value); + } + + /** + * true = automaticly selected colour, false = user-selected + * @return the auto color field value. + */ + public boolean isAutoColor() + { + return autoColor.isSet(field_9_options1); + } + + /** + * Sets the show key field value. + * true = draw legend + */ + public void setShowKey(boolean value) + { + field_9_options1 = showKey.setShortBoolean(field_9_options1, value); + } + + /** + * true = draw legend + * @return the show key field value. + */ + public boolean isShowKey() + { + return showKey.isSet(field_9_options1); + } + + /** + * Sets the show value field value. + * false = text is category label + */ + public void setShowValue(boolean value) + { + field_9_options1 = showValue.setShortBoolean(field_9_options1, value); + } + + /** + * false = text is category label + * @return the show value field value. + */ + public boolean isShowValue() + { + return showValue.isSet(field_9_options1); + } + + /** + * Sets the vertical field value. + * true = text is vertical + */ + public void setVertical(boolean value) + { + field_9_options1 = vertical.setShortBoolean(field_9_options1, value); + } + + /** + * true = text is vertical + * @return the vertical field value. + */ + public boolean isVertical() + { + return vertical.isSet(field_9_options1); + } + + /** + * Sets the auto generated text field value. + * + */ + public void setAutoGeneratedText(boolean value) + { + field_9_options1 = autoGeneratedText.setShortBoolean(field_9_options1, value); + } + + /** + * + * @return the auto generated text field value. + */ + public boolean isAutoGeneratedText() + { + return autoGeneratedText.isSet(field_9_options1); + } + + /** + * Sets the generated field value. + * + */ + public void setGenerated(boolean value) + { + field_9_options1 = generated.setShortBoolean(field_9_options1, value); + } + + /** + * + * @return the generated field value. + */ + public boolean isGenerated() + { + return generated.isSet(field_9_options1); + } + + /** + * Sets the auto label deleted field value. + * + */ + public void setAutoLabelDeleted(boolean value) + { + field_9_options1 = autoLabelDeleted.setShortBoolean(field_9_options1, value); + } + + /** + * + * @return the auto label deleted field value. + */ + public boolean isAutoLabelDeleted() + { + return autoLabelDeleted.isSet(field_9_options1); + } + + /** + * Sets the auto background field value. + * + */ + public void setAutoBackground(boolean value) + { + field_9_options1 = autoBackground.setShortBoolean(field_9_options1, value); + } + + /** + * + * @return the auto background field value. + */ + public boolean isAutoBackground() + { + return autoBackground.isSet(field_9_options1); + } + + /** + * Sets the rotation field value. + * + */ + public void setRotation(short value) + { + field_9_options1 = rotation.setShortValue(field_9_options1, value); + } + + /** + * + * @return the rotation field value. + */ + public short getRotation() + { + return rotation.getShortValue(field_9_options1); + } + + /** + * Sets the show category label as percentage field value. + * + */ + public void setShowCategoryLabelAsPercentage(boolean value) + { + field_9_options1 = showCategoryLabelAsPercentage.setShortBoolean(field_9_options1, value); + } + + /** + * + * @return the show category label as percentage field value. + */ + public boolean isShowCategoryLabelAsPercentage() + { + return showCategoryLabelAsPercentage.isSet(field_9_options1); + } + + /** + * Sets the show value as percentage field value. + * + */ + public void setShowValueAsPercentage(boolean value) + { + field_9_options1 = showValueAsPercentage.setShortBoolean(field_9_options1, value); + } + + /** + * + * @return the show value as percentage field value. + */ + public boolean isShowValueAsPercentage() + { + return showValueAsPercentage.isSet(field_9_options1); + } + + /** + * Sets the show bubble sizes field value. + * + */ + public void setShowBubbleSizes(boolean value) + { + field_9_options1 = showBubbleSizes.setShortBoolean(field_9_options1, value); + } + + /** + * + * @return the show bubble sizes field value. + */ + public boolean isShowBubbleSizes() + { + return showBubbleSizes.isSet(field_9_options1); + } + + /** + * Sets the show label field value. + * + */ + public void setShowLabel(boolean value) + { + field_9_options1 = showLabel.setShortBoolean(field_9_options1, value); + } + + /** + * + * @return the show label field value. + */ + public boolean isShowLabel() + { + return showLabel.isSet(field_9_options1); + } + + /** + * Sets the data label placement field value. + * + */ + public void setDataLabelPlacement(short value) + { + field_11_options2 = dataLabelPlacement.setShortValue(field_11_options2, value); + } + + /** + * + * @return the data label placement field value. + */ + public short getDataLabelPlacement() + { + return dataLabelPlacement.getShortValue(field_11_options2); + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/TickRecord.java b/src/java/org/apache/poi/hssf/record/chart/TickRecord.java new file mode 100644 index 0000000000..993f5705cd --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/TickRecord.java @@ -0,0 +1,407 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.BitField; +import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The Tick record defines how tick marks and label positioning/formatting

+ * + * @author Andrew C. Oliver(acoliver at apache.org) + */ +public final class TickRecord extends StandardRecord { + public final static short sid = 0x101E; + + private static final BitField autoTextColor = BitFieldFactory.getInstance(0x1); + private static final BitField autoTextBackground = BitFieldFactory.getInstance(0x2); + private static final BitField rotation = BitFieldFactory.getInstance(0x1c); + private static final BitField autorotate = BitFieldFactory.getInstance(0x20); + + private byte field_1_majorTickType; + private byte field_2_minorTickType; + private byte field_3_labelPosition; + private byte field_4_background; + private int field_5_labelColorRgb; + private int field_6_zero1; + private int field_7_zero2; + private int field_8_zero3; + private int field_9_zero4; + private short field_10_options; + private short field_11_tickColor; + private short field_12_zero5; + + + public TickRecord() + { + + } + + public TickRecord(RecordInputStream in) + { + + field_1_majorTickType = in.readByte(); + field_2_minorTickType = in.readByte(); + field_3_labelPosition = in.readByte(); + field_4_background = in.readByte(); + field_5_labelColorRgb = in.readInt(); + field_6_zero1 = in.readInt(); + field_7_zero2 = in.readInt(); + field_8_zero3 = in.readInt(); + field_9_zero4 = in.readInt(); + + field_10_options = in.readShort(); + field_11_tickColor = in.readShort(); + field_12_zero5 = in.readShort(); + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[TICK]\n"); + buffer.append(" .majorTickType = ") + .append("0x").append(HexDump.toHex( getMajorTickType ())) + .append(" (").append( getMajorTickType() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .minorTickType = ") + .append("0x").append(HexDump.toHex( getMinorTickType ())) + .append(" (").append( getMinorTickType() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .labelPosition = ") + .append("0x").append(HexDump.toHex( getLabelPosition ())) + .append(" (").append( getLabelPosition() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .background = ") + .append("0x").append(HexDump.toHex( getBackground ())) + .append(" (").append( getBackground() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .labelColorRgb = ") + .append("0x").append(HexDump.toHex( getLabelColorRgb ())) + .append(" (").append( getLabelColorRgb() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .zero1 = ") + .append("0x").append(HexDump.toHex( getZero1 ())) + .append(" (").append( getZero1() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .zero2 = ") + .append("0x").append(HexDump.toHex( getZero2 ())) + .append(" (").append( getZero2() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .options = ") + .append("0x").append(HexDump.toHex( getOptions ())) + .append(" (").append( getOptions() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .autoTextColor = ").append(isAutoTextColor()).append('\n'); + buffer.append(" .autoTextBackground = ").append(isAutoTextBackground()).append('\n'); + buffer.append(" .rotation = ").append(getRotation()).append('\n'); + buffer.append(" .autorotate = ").append(isAutorotate()).append('\n'); + buffer.append(" .tickColor = ") + .append("0x").append(HexDump.toHex( getTickColor ())) + .append(" (").append( getTickColor() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .zero3 = ") + .append("0x").append(HexDump.toHex( getZero3 ())) + .append(" (").append( getZero3() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/TICK]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeByte(field_1_majorTickType); + out.writeByte(field_2_minorTickType); + out.writeByte(field_3_labelPosition); + out.writeByte(field_4_background); + out.writeInt(field_5_labelColorRgb); + out.writeInt(field_6_zero1); + out.writeInt(field_7_zero2); + out.writeInt(field_8_zero3); + out.writeInt(field_9_zero4); + out.writeShort(field_10_options); + out.writeShort(field_11_tickColor); + out.writeShort(field_12_zero5); + } + + protected int getDataSize() { + return 1 + 1 + 1 + 1 + 4 + 8 + 8 + 2 + 2 + 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + TickRecord rec = new TickRecord(); + + rec.field_1_majorTickType = field_1_majorTickType; + rec.field_2_minorTickType = field_2_minorTickType; + rec.field_3_labelPosition = field_3_labelPosition; + rec.field_4_background = field_4_background; + rec.field_5_labelColorRgb = field_5_labelColorRgb; + rec.field_6_zero1 = field_6_zero1; + rec.field_7_zero2 = field_7_zero2; + rec.field_8_zero3 = field_8_zero3; + rec.field_9_zero4 = field_9_zero4; + rec.field_10_options = field_10_options; + rec.field_11_tickColor = field_11_tickColor; + rec.field_12_zero5 = field_12_zero5; + return rec; + } + + + + + /** + * Get the major tick type field for the Tick record. + */ + public byte getMajorTickType() + { + return field_1_majorTickType; + } + + /** + * Set the major tick type field for the Tick record. + */ + public void setMajorTickType(byte field_1_majorTickType) + { + this.field_1_majorTickType = field_1_majorTickType; + } + + /** + * Get the minor tick type field for the Tick record. + */ + public byte getMinorTickType() + { + return field_2_minorTickType; + } + + /** + * Set the minor tick type field for the Tick record. + */ + public void setMinorTickType(byte field_2_minorTickType) + { + this.field_2_minorTickType = field_2_minorTickType; + } + + /** + * Get the label position field for the Tick record. + */ + public byte getLabelPosition() + { + return field_3_labelPosition; + } + + /** + * Set the label position field for the Tick record. + */ + public void setLabelPosition(byte field_3_labelPosition) + { + this.field_3_labelPosition = field_3_labelPosition; + } + + /** + * Get the background field for the Tick record. + */ + public byte getBackground() + { + return field_4_background; + } + + /** + * Set the background field for the Tick record. + */ + public void setBackground(byte field_4_background) + { + this.field_4_background = field_4_background; + } + + /** + * Get the label color rgb field for the Tick record. + */ + public int getLabelColorRgb() + { + return field_5_labelColorRgb; + } + + /** + * Set the label color rgb field for the Tick record. + */ + public void setLabelColorRgb(int field_5_labelColorRgb) + { + this.field_5_labelColorRgb = field_5_labelColorRgb; + } + + /** + * Get the zero 1 field for the Tick record. + */ + public int getZero1() + { + return field_6_zero1; + } + + /** + * Set the zero 1 field for the Tick record. + */ + public void setZero1(int field_6_zero1) + { + this.field_6_zero1 = field_6_zero1; + } + + /** + * Get the zero 2 field for the Tick record. + */ + public int getZero2() + { + return field_7_zero2; + } + + /** + * Set the zero 2 field for the Tick record. + */ + public void setZero2(int field_7_zero2) + { + this.field_7_zero2 = field_7_zero2; + } + + /** + * Get the options field for the Tick record. + */ + public short getOptions() + { + return field_10_options; + } + + /** + * Set the options field for the Tick record. + */ + public void setOptions(short field_10_options) + { + this.field_10_options = field_10_options; + } + + /** + * Get the tick color field for the Tick record. + */ + public short getTickColor() + { + return field_11_tickColor; + } + + /** + * Set the tick color field for the Tick record. + */ + public void setTickColor(short field_11_tickColor) + { + this.field_11_tickColor = field_11_tickColor; + } + + /** + * Get the zero 3 field for the Tick record. + */ + public short getZero3() + { + return field_12_zero5; + } + + /** + * Set the zero 3 field for the Tick record. + */ + public void setZero3(short field_12_zero3) + { + this.field_12_zero5 = field_12_zero3; + } + + /** + * Sets the auto text color field value. + * use the quote unquote automatic color for text + */ + public void setAutoTextColor(boolean value) + { + field_10_options = autoTextColor.setShortBoolean(field_10_options, value); + } + + /** + * use the quote unquote automatic color for text + * @return the auto text color field value. + */ + public boolean isAutoTextColor() + { + return autoTextColor.isSet(field_10_options); + } + + /** + * Sets the auto text background field value. + * use the quote unquote automatic color for text background + */ + public void setAutoTextBackground(boolean value) + { + field_10_options = autoTextBackground.setShortBoolean(field_10_options, value); + } + + /** + * use the quote unquote automatic color for text background + * @return the auto text background field value. + */ + public boolean isAutoTextBackground() + { + return autoTextBackground.isSet(field_10_options); + } + + /** + * Sets the rotation field value. + * rotate text (0=none, 1=normal, 2=90 degrees counterclockwise, 3=90 degrees clockwise) + */ + public void setRotation(short value) + { + field_10_options = rotation.setShortValue(field_10_options, value); + } + + /** + * rotate text (0=none, 1=normal, 2=90 degrees counterclockwise, 3=90 degrees clockwise) + * @return the rotation field value. + */ + public short getRotation() + { + return rotation.getShortValue(field_10_options); + } + + /** + * Sets the autorotate field value. + * automatically rotate the text + */ + public void setAutorotate(boolean value) + { + field_10_options = autorotate.setShortBoolean(field_10_options, value); + } + + /** + * automatically rotate the text + * @return the autorotate field value. + */ + public boolean isAutorotate() + { + return autorotate.isSet(field_10_options); + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/UnitsRecord.java b/src/java/org/apache/poi/hssf/record/chart/UnitsRecord.java new file mode 100644 index 0000000000..1ad6662298 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/UnitsRecord.java @@ -0,0 +1,98 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The units record describes units.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class UnitsRecord extends StandardRecord { + public final static short sid = 0x1001; + private short field_1_units; + + + public UnitsRecord() + { + + } + + public UnitsRecord(RecordInputStream in) + { + field_1_units = in.readShort(); + + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[UNITS]\n"); + buffer.append(" .units = ") + .append("0x").append(HexDump.toHex( getUnits ())) + .append(" (").append( getUnits() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + + buffer.append("[/UNITS]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeShort(field_1_units); + } + + protected int getDataSize() { + return 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + UnitsRecord rec = new UnitsRecord(); + + rec.field_1_units = field_1_units; + return rec; + } + + + + + /** + * Get the units field for the Units record. + */ + public short getUnits() + { + return field_1_units; + } + + /** + * Set the units field for the Units record. + */ + public void setUnits(short field_1_units) + { + this.field_1_units = field_1_units; + } +} diff --git a/src/java/org/apache/poi/hssf/record/chart/ValueRangeRecord.java b/src/java/org/apache/poi/hssf/record/chart/ValueRangeRecord.java new file mode 100644 index 0000000000..df3aa7c007 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/chart/ValueRangeRecord.java @@ -0,0 +1,397 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.StandardRecord; +import org.apache.poi.util.BitField; +import org.apache.poi.util.BitFieldFactory; +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndianOutput; + +/** + * The value range record defines the range of the value axis.

+ * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class ValueRangeRecord extends StandardRecord { + public final static short sid = 0x101f; + + private static final BitField automaticMinimum = BitFieldFactory.getInstance(0x0001); + private static final BitField automaticMaximum = BitFieldFactory.getInstance(0x0002); + private static final BitField automaticMajor = BitFieldFactory.getInstance(0x0004); + private static final BitField automaticMinor = BitFieldFactory.getInstance(0x0008); + private static final BitField automaticCategoryCrossing = BitFieldFactory.getInstance(0x0010); + private static final BitField logarithmicScale = BitFieldFactory.getInstance(0x0020); + private static final BitField valuesInReverse = BitFieldFactory.getInstance(0x0040); + private static final BitField crossCategoryAxisAtMaximum = BitFieldFactory.getInstance(0x0080); + private static final BitField reserved = BitFieldFactory.getInstance(0x0100); + + private double field_1_minimumAxisValue; + private double field_2_maximumAxisValue; + private double field_3_majorIncrement; + private double field_4_minorIncrement; + private double field_5_categoryAxisCross; + private short field_6_options; + + + public ValueRangeRecord() + { + + } + + public ValueRangeRecord(RecordInputStream in) + { + field_1_minimumAxisValue = in.readDouble(); + field_2_maximumAxisValue = in.readDouble(); + field_3_majorIncrement = in.readDouble(); + field_4_minorIncrement = in.readDouble(); + field_5_categoryAxisCross = in.readDouble(); + field_6_options = in.readShort(); + + } + + public String toString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append("[VALUERANGE]\n"); + buffer.append(" .minimumAxisValue = ") + .append(" (").append( getMinimumAxisValue() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .maximumAxisValue = ") + .append(" (").append( getMaximumAxisValue() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .majorIncrement = ") + .append(" (").append( getMajorIncrement() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .minorIncrement = ") + .append(" (").append( getMinorIncrement() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .categoryAxisCross = ") + .append(" (").append( getCategoryAxisCross() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .options = ") + .append("0x").append(HexDump.toHex( getOptions ())) + .append(" (").append( getOptions() ).append(" )"); + buffer.append(System.getProperty("line.separator")); + buffer.append(" .automaticMinimum = ").append(isAutomaticMinimum()).append('\n'); + buffer.append(" .automaticMaximum = ").append(isAutomaticMaximum()).append('\n'); + buffer.append(" .automaticMajor = ").append(isAutomaticMajor()).append('\n'); + buffer.append(" .automaticMinor = ").append(isAutomaticMinor()).append('\n'); + buffer.append(" .automaticCategoryCrossing = ").append(isAutomaticCategoryCrossing()).append('\n'); + buffer.append(" .logarithmicScale = ").append(isLogarithmicScale()).append('\n'); + buffer.append(" .valuesInReverse = ").append(isValuesInReverse()).append('\n'); + buffer.append(" .crossCategoryAxisAtMaximum = ").append(isCrossCategoryAxisAtMaximum()).append('\n'); + buffer.append(" .reserved = ").append(isReserved()).append('\n'); + + buffer.append("[/VALUERANGE]\n"); + return buffer.toString(); + } + + public void serialize(LittleEndianOutput out) { + out.writeDouble(field_1_minimumAxisValue); + out.writeDouble(field_2_maximumAxisValue); + out.writeDouble(field_3_majorIncrement); + out.writeDouble(field_4_minorIncrement); + out.writeDouble(field_5_categoryAxisCross); + out.writeShort(field_6_options); + } + + protected int getDataSize() { + return 8 + 8 + 8 + 8 + 8 + 2; + } + + public short getSid() + { + return sid; + } + + public Object clone() { + ValueRangeRecord rec = new ValueRangeRecord(); + + rec.field_1_minimumAxisValue = field_1_minimumAxisValue; + rec.field_2_maximumAxisValue = field_2_maximumAxisValue; + rec.field_3_majorIncrement = field_3_majorIncrement; + rec.field_4_minorIncrement = field_4_minorIncrement; + rec.field_5_categoryAxisCross = field_5_categoryAxisCross; + rec.field_6_options = field_6_options; + return rec; + } + + + + + /** + * Get the minimum axis value field for the ValueRange record. + */ + public double getMinimumAxisValue() + { + return field_1_minimumAxisValue; + } + + /** + * Set the minimum axis value field for the ValueRange record. + */ + public void setMinimumAxisValue(double field_1_minimumAxisValue) + { + this.field_1_minimumAxisValue = field_1_minimumAxisValue; + } + + /** + * Get the maximum axis value field for the ValueRange record. + */ + public double getMaximumAxisValue() + { + return field_2_maximumAxisValue; + } + + /** + * Set the maximum axis value field for the ValueRange record. + */ + public void setMaximumAxisValue(double field_2_maximumAxisValue) + { + this.field_2_maximumAxisValue = field_2_maximumAxisValue; + } + + /** + * Get the major increment field for the ValueRange record. + */ + public double getMajorIncrement() + { + return field_3_majorIncrement; + } + + /** + * Set the major increment field for the ValueRange record. + */ + public void setMajorIncrement(double field_3_majorIncrement) + { + this.field_3_majorIncrement = field_3_majorIncrement; + } + + /** + * Get the minor increment field for the ValueRange record. + */ + public double getMinorIncrement() + { + return field_4_minorIncrement; + } + + /** + * Set the minor increment field for the ValueRange record. + */ + public void setMinorIncrement(double field_4_minorIncrement) + { + this.field_4_minorIncrement = field_4_minorIncrement; + } + + /** + * Get the category axis cross field for the ValueRange record. + */ + public double getCategoryAxisCross() + { + return field_5_categoryAxisCross; + } + + /** + * Set the category axis cross field for the ValueRange record. + */ + public void setCategoryAxisCross(double field_5_categoryAxisCross) + { + this.field_5_categoryAxisCross = field_5_categoryAxisCross; + } + + /** + * Get the options field for the ValueRange record. + */ + public short getOptions() + { + return field_6_options; + } + + /** + * Set the options field for the ValueRange record. + */ + public void setOptions(short field_6_options) + { + this.field_6_options = field_6_options; + } + + /** + * Sets the automatic minimum field value. + * automatic minimum value selected + */ + public void setAutomaticMinimum(boolean value) + { + field_6_options = automaticMinimum.setShortBoolean(field_6_options, value); + } + + /** + * automatic minimum value selected + * @return the automatic minimum field value. + */ + public boolean isAutomaticMinimum() + { + return automaticMinimum.isSet(field_6_options); + } + + /** + * Sets the automatic maximum field value. + * automatic maximum value selected + */ + public void setAutomaticMaximum(boolean value) + { + field_6_options = automaticMaximum.setShortBoolean(field_6_options, value); + } + + /** + * automatic maximum value selected + * @return the automatic maximum field value. + */ + public boolean isAutomaticMaximum() + { + return automaticMaximum.isSet(field_6_options); + } + + /** + * Sets the automatic major field value. + * automatic major unit selected + */ + public void setAutomaticMajor(boolean value) + { + field_6_options = automaticMajor.setShortBoolean(field_6_options, value); + } + + /** + * automatic major unit selected + * @return the automatic major field value. + */ + public boolean isAutomaticMajor() + { + return automaticMajor.isSet(field_6_options); + } + + /** + * Sets the automatic minor field value. + * automatic minor unit selected + */ + public void setAutomaticMinor(boolean value) + { + field_6_options = automaticMinor.setShortBoolean(field_6_options, value); + } + + /** + * automatic minor unit selected + * @return the automatic minor field value. + */ + public boolean isAutomaticMinor() + { + return automaticMinor.isSet(field_6_options); + } + + /** + * Sets the automatic category crossing field value. + * category crossing point is automatically selected + */ + public void setAutomaticCategoryCrossing(boolean value) + { + field_6_options = automaticCategoryCrossing.setShortBoolean(field_6_options, value); + } + + /** + * category crossing point is automatically selected + * @return the automatic category crossing field value. + */ + public boolean isAutomaticCategoryCrossing() + { + return automaticCategoryCrossing.isSet(field_6_options); + } + + /** + * Sets the logarithmic scale field value. + * use logarithmic scale + */ + public void setLogarithmicScale(boolean value) + { + field_6_options = logarithmicScale.setShortBoolean(field_6_options, value); + } + + /** + * use logarithmic scale + * @return the logarithmic scale field value. + */ + public boolean isLogarithmicScale() + { + return logarithmicScale.isSet(field_6_options); + } + + /** + * Sets the values in reverse field value. + * values are reverses in graph + */ + public void setValuesInReverse(boolean value) + { + field_6_options = valuesInReverse.setShortBoolean(field_6_options, value); + } + + /** + * values are reverses in graph + * @return the values in reverse field value. + */ + public boolean isValuesInReverse() + { + return valuesInReverse.isSet(field_6_options); + } + + /** + * Sets the cross category axis at maximum field value. + * category axis to cross at maximum value + */ + public void setCrossCategoryAxisAtMaximum(boolean value) + { + field_6_options = crossCategoryAxisAtMaximum.setShortBoolean(field_6_options, value); + } + + /** + * category axis to cross at maximum value + * @return the cross category axis at maximum field value. + */ + public boolean isCrossCategoryAxisAtMaximum() + { + return crossCategoryAxisAtMaximum.isSet(field_6_options); + } + + /** + * Sets the reserved field value. + * reserved, must equal 1 (excel dev. guide says otherwise) + */ + public void setReserved(boolean value) + { + field_6_options = reserved.setShortBoolean(field_6_options, value); + } + + /** + * reserved, must equal 1 (excel dev. guide says otherwise) + * @return the reserved field value. + */ + public boolean isReserved() + { + return reserved.isSet(field_6_options); + } +} diff --git a/src/scratchpad/src/org/apache/poi/hssf/usermodel/HSSFChart.java b/src/scratchpad/src/org/apache/poi/hssf/usermodel/HSSFChart.java index 10a75b375e..8aa849fa2f 100644 --- a/src/scratchpad/src/org/apache/poi/hssf/usermodel/HSSFChart.java +++ b/src/scratchpad/src/org/apache/poi/hssf/usermodel/HSSFChart.java @@ -21,51 +21,20 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import org.apache.poi.hssf.record.AreaFormatRecord; -import org.apache.poi.hssf.record.AxisLineFormatRecord; -import org.apache.poi.hssf.record.AxisOptionsRecord; -import org.apache.poi.hssf.record.AxisParentRecord; -import org.apache.poi.hssf.record.AxisRecord; -import org.apache.poi.hssf.record.AxisUsedRecord; +import org.apache.poi.hssf.record.chart.*; import org.apache.poi.hssf.record.BOFRecord; -import org.apache.poi.hssf.record.BarRecord; -import org.apache.poi.hssf.record.BeginRecord; -import org.apache.poi.hssf.record.CategorySeriesAxisRecord; -import org.apache.poi.hssf.record.ChartFormatRecord; -import org.apache.poi.hssf.record.ChartRecord; -import org.apache.poi.hssf.record.ChartTitleFormatRecord; -import org.apache.poi.hssf.record.DataFormatRecord; -import org.apache.poi.hssf.record.DefaultDataLabelTextPropertiesRecord; import org.apache.poi.hssf.record.DimensionsRecord; import org.apache.poi.hssf.record.EOFRecord; -import org.apache.poi.hssf.record.EndRecord; -import org.apache.poi.hssf.record.FontBasisRecord; -import org.apache.poi.hssf.record.FontIndexRecord; import org.apache.poi.hssf.record.FooterRecord; -import org.apache.poi.hssf.record.FrameRecord; import org.apache.poi.hssf.record.HCenterRecord; import org.apache.poi.hssf.record.HeaderRecord; -import org.apache.poi.hssf.record.LegendRecord; -import org.apache.poi.hssf.record.LineFormatRecord; -import org.apache.poi.hssf.record.LinkedDataRecord; -import org.apache.poi.hssf.record.PlotAreaRecord; -import org.apache.poi.hssf.record.PlotGrowthRecord; import org.apache.poi.hssf.record.PrintSetupRecord; import org.apache.poi.hssf.record.ProtectRecord; import org.apache.poi.hssf.record.Record; import org.apache.poi.hssf.record.RecordBase; import org.apache.poi.hssf.record.SCLRecord; -import org.apache.poi.hssf.record.SeriesIndexRecord; -import org.apache.poi.hssf.record.SeriesRecord; -import org.apache.poi.hssf.record.SeriesTextRecord; -import org.apache.poi.hssf.record.SeriesToChartGroupRecord; -import org.apache.poi.hssf.record.SheetPropertiesRecord; -import org.apache.poi.hssf.record.TextRecord; -import org.apache.poi.hssf.record.TickRecord; -import org.apache.poi.hssf.record.UnitsRecord; import org.apache.poi.hssf.record.UnknownRecord; import org.apache.poi.hssf.record.VCenterRecord; -import org.apache.poi.hssf.record.ValueRangeRecord; import org.apache.poi.hssf.record.formula.Area3DPtg; import org.apache.poi.hssf.record.formula.Ptg; diff --git a/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestHSSFChart.java b/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestHSSFChart.java index d244d3372e..8baac01d37 100644 --- a/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestHSSFChart.java +++ b/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestHSSFChart.java @@ -20,11 +20,14 @@ package org.apache.poi.hssf.usermodel; import junit.framework.TestCase; import org.apache.poi.hssf.HSSFTestDataSamples; -import org.apache.poi.hssf.record.SeriesRecord; +import org.apache.poi.hssf.record.chart.SeriesRecord; +/** + * Tests for {@link HSSFChart} + */ public final class TestHSSFChart extends TestCase { - public void testSingleChart() throws Exception { + public void testSingleChart() { HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("WithChart.xls"); HSSFSheet s1 = wb.getSheetAt(0); @@ -53,7 +56,7 @@ public final class TestHSSFChart extends TestCase { assertEquals(15040512, charts[0].getChartHeight()); } - public void testTwoCharts() throws Exception { + public void testTwoCharts() { HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("WithTwoCharts.xls"); HSSFSheet s1 = wb.getSheetAt(0); @@ -85,7 +88,7 @@ public final class TestHSSFChart extends TestCase { assertEquals(null, charts[0].getChartTitle()); } - public void testThreeCharts() throws Exception { + public void testThreeCharts() { HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("WithThreeCharts.xls"); HSSFSheet s1 = wb.getSheetAt(0); diff --git a/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java b/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java index edf62a9ad1..db6c7ff3f2 100755 --- a/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java +++ b/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java @@ -22,11 +22,12 @@ import junit.framework.TestSuite; import org.apache.poi.hssf.record.aggregates.AllRecordAggregateTests; import org.apache.poi.hssf.record.cf.TestCellRange; +import org.apache.poi.hssf.record.chart.AllChartRecordTests; import org.apache.poi.hssf.record.constant.TestConstantValueParser; import org.apache.poi.hssf.record.formula.AllFormulaTests; /** - * Collects all tests for package org.apache.poi.hssf.record. + * Collects all tests for package org.apache.poi.hssf.record and sub-packages. * * @author Josh Micich */ @@ -35,28 +36,15 @@ public final class AllRecordTests { public static Test suite() { TestSuite result = new TestSuite(AllRecordTests.class.getName()); + result.addTest(AllChartRecordTests.suite()); result.addTest(AllFormulaTests.suite()); result.addTest(AllRecordAggregateTests.suite()); - result.addTestSuite(TestAreaFormatRecord.class); - result.addTestSuite(TestAreaRecord.class); - result.addTestSuite(TestAxisLineFormatRecord.class); - result.addTestSuite(TestAxisOptionsRecord.class); - result.addTestSuite(TestAxisParentRecord.class); - result.addTestSuite(TestAxisRecord.class); - result.addTestSuite(TestAxisUsedRecord.class); result.addTestSuite(TestBOFRecord.class); - result.addTestSuite(TestBarRecord.class); result.addTestSuite(TestBoundSheetRecord.class); - result.addTestSuite(TestCategorySeriesAxisRecord.class); result.addTestSuite(TestCFHeaderRecord.class); result.addTestSuite(TestCFRuleRecord.class); - result.addTestSuite(TestChartRecord.class); - result.addTestSuite(TestChartTitleFormatRecord.class); result.addTestSuite(TestCommonObjectDataSubRecord.class); - result.addTestSuite(TestDatRecord.class); - result.addTestSuite(TestDataFormatRecord.class); - result.addTestSuite(TestDefaultDataLabelTextPropertiesRecord.class); result.addTestSuite(TestDrawingGroupRecord.class); result.addTestSuite(TestEmbeddedObjectRefSubRecord.class); result.addTestSuite(TestEndSubRecord.class); @@ -64,40 +52,22 @@ public final class AllRecordTests { result.addTestSuite(TestExtendedFormatRecord.class); result.addTestSuite(TestExternalNameRecord.class); result.addTestSuite(TestFontRecord.class); - result.addTestSuite(TestFontBasisRecord.class); - result.addTestSuite(TestFontIndexRecord.class); result.addTestSuite(TestFormulaRecord.class); - result.addTestSuite(TestFrameRecord.class); result.addTestSuite(TestHyperlinkRecord.class); result.addTestSuite(TestLabelRecord.class); - result.addTestSuite(TestLegendRecord.class); - result.addTestSuite(TestLineFormatRecord.class); - result.addTestSuite(TestLinkedDataRecord.class); result.addTestSuite(TestMergeCellsRecord.class); result.addTestSuite(TestNameRecord.class); result.addTestSuite(TestNoteRecord.class); result.addTestSuite(TestNoteStructureSubRecord.class); - result.addTestSuite(TestNumberFormatIndexRecord.class); result.addTestSuite(TestObjRecord.class); - result.addTestSuite(TestObjectLinkRecord.class); result.addTestSuite(TestPaletteRecord.class); result.addTestSuite(TestPaneRecord.class); - result.addTestSuite(TestPlotAreaRecord.class); - result.addTestSuite(TestPlotGrowthRecord.class); result.addTestSuite(TestRecordInputStream.class); result.addTestSuite(TestRecordFactory.class); result.addTestSuite(TestSCLRecord.class); result.addTestSuite(TestSSTDeserializer.class); result.addTestSuite(TestSSTRecord.class); result.addTestSuite(TestSSTRecordSizeCalculator.class); - result.addTestSuite(TestSeriesChartGroupIndexRecord.class); - result.addTestSuite(TestSeriesIndexRecord.class); - result.addTestSuite(TestSeriesLabelsRecord.class); - result.addTestSuite(TestSeriesListRecord.class); - result.addTestSuite(TestSeriesRecord.class); - result.addTestSuite(TestSeriesTextRecord.class); - result.addTestSuite(TestSeriesToChartGroupRecord.class); - result.addTestSuite(TestSheetPropertiesRecord.class); result.addTestSuite(TestSharedFormulaRecord.class); result.addTestSuite(TestStringRecord.class); result.addTestSuite(TestStyleRecord.class); @@ -106,12 +76,8 @@ public final class AllRecordTests { result.addTestSuite(TestTableRecord.class); result.addTestSuite(TestTextObjectBaseRecord.class); result.addTestSuite(TestTextObjectRecord.class); - result.addTestSuite(TestTextRecord.class); - result.addTestSuite(TestTickRecord.class); result.addTestSuite(TestUnicodeNameRecord.class); result.addTestSuite(TestUnicodeString.class); - result.addTestSuite(TestUnitsRecord.class); - result.addTestSuite(TestValueRangeRecord.class); result.addTestSuite(TestCellRange.class); result.addTestSuite(TestConstantValueParser.class); return result; diff --git a/src/testcases/org/apache/poi/hssf/record/TestAreaFormatRecord.java b/src/testcases/org/apache/poi/hssf/record/TestAreaFormatRecord.java deleted file mode 100644 index fb852ba88c..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestAreaFormatRecord.java +++ /dev/null @@ -1,75 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the AreaFormatRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestAreaFormatRecord extends TestCase { - byte[] data = new byte[] { - (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x00, // forecolor - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // backcolor - (byte)0x01,(byte)0x00, // pattern - (byte)0x01,(byte)0x00, // format - (byte)0x4E,(byte)0x00, // forecolor index - (byte)0x4D,(byte)0x00 // backcolor index - - }; - - public void testLoad() { - - AreaFormatRecord record = new AreaFormatRecord(TestcaseRecordInputStream.create(0x100a, data)); - assertEquals( 0xFFFFFF, record.getForegroundColor()); - assertEquals( 0x000000, record.getBackgroundColor()); - assertEquals( 1, record.getPattern()); - assertEquals( 1, record.getFormatFlags()); - assertEquals( true, record.isAutomatic() ); - assertEquals( false, record.isInvert() ); - assertEquals( 0x4e, record.getForecolorIndex()); - assertEquals( 0x4d, record.getBackcolorIndex()); - - - assertEquals( 20, record.getRecordSize() ); - } - - public void testStore() - { - AreaFormatRecord record = new AreaFormatRecord(); - record.setForegroundColor( 0xFFFFFF ); - record.setBackgroundColor( 0x000000 ); - record.setPattern( (short)1 ); - record.setAutomatic( true ); - record.setInvert( false ); - record.setForecolorIndex( (short)0x4e ); - record.setBackcolorIndex( (short)0x4d ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestAreaRecord.java b/src/testcases/org/apache/poi/hssf/record/TestAreaRecord.java deleted file mode 100644 index f514feccba..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestAreaRecord.java +++ /dev/null @@ -1,61 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the AreaRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestAreaRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x02,(byte)0x00 // format flags - }; - - public void testLoad() { - - AreaRecord record = new AreaRecord(TestcaseRecordInputStream.create(0x101A, data)); - assertEquals( 2, record.getFormatFlags()); - assertEquals( false, record.isStacked() ); - assertEquals( true, record.isDisplayAsPercentage() ); - assertEquals( false, record.isShadow() ); - - - assertEquals( 6, record.getRecordSize() ); - } - - public void testStore() - { - AreaRecord record = new AreaRecord(); - record.setStacked( false ); - record.setDisplayAsPercentage( true ); - record.setShadow( false ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestAxisLineFormatRecord.java b/src/testcases/org/apache/poi/hssf/record/TestAxisLineFormatRecord.java deleted file mode 100644 index 4e9e29a6f7..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestAxisLineFormatRecord.java +++ /dev/null @@ -1,54 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the AxisLineFormatRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestAxisLineFormatRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x01,(byte)0x00 - }; - - public void testLoad() { - AxisLineFormatRecord record = new AxisLineFormatRecord(TestcaseRecordInputStream.create(0x1021, data)); - assertEquals( AxisLineFormatRecord.AXIS_TYPE_MAJOR_GRID_LINE, record.getAxisType()); - - assertEquals( 6, record.getRecordSize() ); - } - - public void testStore() - { - AxisLineFormatRecord record = new AxisLineFormatRecord(); - record.setAxisType( AxisLineFormatRecord.AXIS_TYPE_MAJOR_GRID_LINE ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestAxisOptionsRecord.java b/src/testcases/org/apache/poi/hssf/record/TestAxisOptionsRecord.java deleted file mode 100644 index de51b48b0d..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestAxisOptionsRecord.java +++ /dev/null @@ -1,99 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the AxisOptionsRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Andrew C. Oliver(acoliver at apache.org) - */ -public final class TestAxisOptionsRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01, - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00, - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0xEF,(byte)0x00 - }; - - public void testLoad() { - AxisOptionsRecord record = new AxisOptionsRecord(TestcaseRecordInputStream.create(0x1062, data)); - assertEquals( 0, record.getMinimumCategory()); - assertEquals( 0, record.getMaximumCategory()); - assertEquals( 1, record.getMajorUnitValue()); - assertEquals( 0, record.getMajorUnit()); - assertEquals( 1, record.getMinorUnitValue()); - assertEquals( 0, record.getMinorUnit()); - assertEquals( 0, record.getBaseUnit()); - assertEquals( 0, record.getCrossingPoint()); - assertEquals( 239, record.getOptions()); - assertEquals( true, record.isDefaultMinimum() ); - assertEquals( true, record.isDefaultMaximum() ); - assertEquals( true, record.isDefaultMajor() ); - assertEquals( true, record.isDefaultMinorUnit() ); - assertEquals( false, record.isIsDate() ); - assertEquals( true, record.isDefaultBase() ); - assertEquals( true, record.isDefaultCross() ); - assertEquals( true, record.isDefaultDateSettings() ); - - assertEquals( 22, record.getRecordSize() ); - } - - public void testStore() - { - AxisOptionsRecord record = new AxisOptionsRecord(); - record.setMinimumCategory( (short)0 ); - record.setMaximumCategory( (short)0 ); - record.setMajorUnitValue( (short)1 ); - record.setMajorUnit( (short)0 ); - record.setMinorUnitValue( (short)1 ); - record.setMinorUnit( (short)0 ); - record.setBaseUnit( (short)0 ); - record.setCrossingPoint( (short)0 ); - record.setOptions( (short)239 ); - record.setDefaultMinimum( true ); - record.setDefaultMaximum( true ); - record.setDefaultMajor( true ); - record.setDefaultMinorUnit( true ); - record.setIsDate( false ); - record.setDefaultBase( true ); - record.setDefaultCross( true ); - record.setDefaultDateSettings( true ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } - - /** - * The main program for the TestAxisOptionsRecord class - * - *@param args The command line arguments - */ - public static void main(String[] args) { - System.out.println("Testing org.apache.poi.hssf.record.AxisOptionsRecord"); - junit.textui.TestRunner.run(TestAxisOptionsRecord.class); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestAxisParentRecord.java b/src/testcases/org/apache/poi/hssf/record/TestAxisParentRecord.java deleted file mode 100644 index 406b68fd60..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestAxisParentRecord.java +++ /dev/null @@ -1,65 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the AxisParentRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestAxisParentRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x00,(byte)0x00, // axis type - (byte)0x1D,(byte)0x02,(byte)0x00,(byte)0x00, // x - (byte)0xDD,(byte)0x00,(byte)0x00,(byte)0x00, // y - (byte)0x31,(byte)0x0B,(byte)0x00,(byte)0x00, // width - (byte)0x56,(byte)0x0B,(byte)0x00,(byte)0x00 // height - }; - - public void testLoad() { - AxisParentRecord record = new AxisParentRecord(TestcaseRecordInputStream.create(0x1041, data)); - assertEquals( AxisParentRecord.AXIS_TYPE_MAIN, record.getAxisType()); - assertEquals( 0x021d, record.getX()); - assertEquals( 0xdd, record.getY()); - assertEquals( 0x0b31, record.getWidth()); - assertEquals( 0x0b56, record.getHeight()); - - assertEquals( 22, record.getRecordSize() ); - } - - public void testStore() - { - AxisParentRecord record = new AxisParentRecord(); - record.setAxisType( AxisParentRecord.AXIS_TYPE_MAIN ); - record.setX( 0x021d ); - record.setY( 0xdd ); - record.setWidth( 0x0b31 ); - record.setHeight( 0x0b56 ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestAxisRecord.java b/src/testcases/org/apache/poi/hssf/record/TestAxisRecord.java deleted file mode 100644 index 21e41773ce..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestAxisRecord.java +++ /dev/null @@ -1,67 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the AxisRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestAxisRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x00,(byte)0x00, // type - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00 - }; - - public void testLoad() { - - AxisRecord record = new AxisRecord(TestcaseRecordInputStream.create(0x101d, data)); - assertEquals( AxisRecord.AXIS_TYPE_CATEGORY_OR_X_AXIS, record.getAxisType()); - assertEquals( 0, record.getReserved1()); - assertEquals( 0, record.getReserved2()); - assertEquals( 0, record.getReserved3()); - assertEquals( 0, record.getReserved4()); - - assertEquals( 4 + 18, record.getRecordSize() ); - } - - public void testStore() - { - AxisRecord record = new AxisRecord(); - record.setAxisType( AxisRecord.AXIS_TYPE_CATEGORY_OR_X_AXIS ); - record.setReserved1( 0 ); - record.setReserved2( 0 ); - record.setReserved3( 0 ); - record.setReserved4( 0 ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestAxisUsedRecord.java b/src/testcases/org/apache/poi/hssf/record/TestAxisUsedRecord.java deleted file mode 100644 index 5f02d2874c..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestAxisUsedRecord.java +++ /dev/null @@ -1,54 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the AxisUsedRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestAxisUsedRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x01,(byte)0x00, - }; - - public void testLoad() { - AxisUsedRecord record = new AxisUsedRecord(TestcaseRecordInputStream.create(0x1046, data)); - assertEquals( 1, record.getNumAxis()); - - assertEquals( 6, record.getRecordSize() ); - } - - public void testStore() - { - AxisUsedRecord record = new AxisUsedRecord(); - record.setNumAxis( (short)1 ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestBarRecord.java b/src/testcases/org/apache/poi/hssf/record/TestBarRecord.java deleted file mode 100644 index 80c729c212..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestBarRecord.java +++ /dev/null @@ -1,68 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the BarRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestBarRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x00,(byte)0x00, // bar space - (byte)0x96,(byte)0x00, // category space - (byte)0x00,(byte)0x00 // format flags - }; - - public void testLoad() { - - BarRecord record = new BarRecord(TestcaseRecordInputStream.create(0x1017, data)); - assertEquals( 0, record.getBarSpace()); - assertEquals( 0x96, record.getCategorySpace()); - assertEquals( 0, record.getFormatFlags()); - assertEquals( false, record.isHorizontal() ); - assertEquals( false, record.isStacked() ); - assertEquals( false, record.isDisplayAsPercentage() ); - assertEquals( false, record.isShadow() ); - - assertEquals( 10, record.getRecordSize() ); - } - - public void testStore() - { - BarRecord record = new BarRecord(); - record.setBarSpace( (short)0 ); - record.setCategorySpace( (short)0x96 ); - record.setHorizontal( false ); - record.setStacked( false ); - record.setDisplayAsPercentage( false ); - record.setShadow( false ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestCategorySeriesAxisRecord.java b/src/testcases/org/apache/poi/hssf/record/TestCategorySeriesAxisRecord.java deleted file mode 100644 index 080918aa05..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestCategorySeriesAxisRecord.java +++ /dev/null @@ -1,69 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the CategorySeriesAxisRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestCategorySeriesAxisRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x01,(byte)0x00, // crossing point - (byte)0x01,(byte)0x00, // label frequency - (byte)0x01,(byte)0x00, // tick mark frequency - (byte)0x01,(byte)0x00 // options - }; - - public void testLoad() { - - CategorySeriesAxisRecord record = new CategorySeriesAxisRecord(TestcaseRecordInputStream.create(0x1020, data)); - assertEquals( 1, record.getCrossingPoint()); - assertEquals( 1, record.getLabelFrequency()); - assertEquals( 1, record.getTickMarkFrequency()); - assertEquals( 1, record.getOptions()); - assertEquals( true, record.isValueAxisCrossing() ); - assertEquals( false, record.isCrossesFarRight() ); - assertEquals( false, record.isReversed() ); - - assertEquals( 4 + 8, record.getRecordSize() ); - } - - public void testStore() - { - CategorySeriesAxisRecord record = new CategorySeriesAxisRecord(); - record.setCrossingPoint( (short)1 ); - record.setLabelFrequency( (short)1 ); - record.setTickMarkFrequency( (short)1 ); - record.setValueAxisCrossing( true ); - record.setCrossesFarRight( false ); - record.setReversed( false ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestChartRecord.java b/src/testcases/org/apache/poi/hssf/record/TestChartRecord.java deleted file mode 100644 index 994b15b32c..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestChartRecord.java +++ /dev/null @@ -1,64 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the ChartRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestChartRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, - (byte)0xE8,(byte)0xFF,(byte)0xD0,(byte)0x01, - (byte)0xC8,(byte)0xCC,(byte)0xE5,(byte)0x00 - }; - - public void testLoad() { - - ChartRecord record = new ChartRecord(TestcaseRecordInputStream.create(0x1002, data)); - assertEquals( 0, record.getX()); - assertEquals( 0, record.getY()); - assertEquals( 30474216, record.getWidth()); - assertEquals( 15060168, record.getHeight()); - - assertEquals( 20, record.getRecordSize() ); - } - - public void testStore() - { - ChartRecord record = new ChartRecord(); - record.setX( 0 ); - record.setY( 0 ); - record.setWidth( 30474216 ); - record.setHeight( 15060168 ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestChartTitleFormatRecord.java b/src/testcases/org/apache/poi/hssf/record/TestChartTitleFormatRecord.java deleted file mode 100644 index 5e285021b1..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestChartTitleFormatRecord.java +++ /dev/null @@ -1,78 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - -import junit.framework.TestCase; - -import org.apache.poi.hssf.HSSFTestDataSamples; -import org.apache.poi.hssf.eventusermodel.HSSFEventFactory; -import org.apache.poi.hssf.eventusermodel.HSSFListener; -import org.apache.poi.hssf.eventusermodel.HSSFRequest; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.poifs.filesystem.POIFSFileSystem; -/** - * - */ -public final class TestChartTitleFormatRecord extends TestCase { - - public void testRecord() throws Exception { - POIFSFileSystem fs = new POIFSFileSystem( - HSSFTestDataSamples.openSampleFileStream("WithFormattedGraphTitle.xls")); - - // Check we can open the file via usermodel - HSSFWorkbook hssf = new HSSFWorkbook(fs); - - // Now process it through eventusermodel, and - // look out for the title records - ChartTitleFormatRecordGrabber grabber = new ChartTitleFormatRecordGrabber(); - InputStream din = fs.createDocumentInputStream("Workbook"); - HSSFRequest req = new HSSFRequest(); - req.addListenerForAllRecords(grabber); - HSSFEventFactory factory = new HSSFEventFactory(); - factory.processEvents(req, din); - din.close(); - - // Should've found one - assertEquals(1, grabber.chartTitleFormatRecords.size()); - // And it should be of something interesting - ChartTitleFormatRecord r = - (ChartTitleFormatRecord)grabber.chartTitleFormatRecords.get(0); - assertEquals(3, r.getFormatCount()); - } - - private static final class ChartTitleFormatRecordGrabber implements HSSFListener { - private final List chartTitleFormatRecords; - - public ChartTitleFormatRecordGrabber() { - chartTitleFormatRecords = new ArrayList(); - } - - public void processRecord(Record record) { - if(record instanceof ChartTitleFormatRecord) { - chartTitleFormatRecords.add( - record - ); - } - } - - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestDatRecord.java b/src/testcases/org/apache/poi/hssf/record/TestDatRecord.java deleted file mode 100644 index 408d80e568..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestDatRecord.java +++ /dev/null @@ -1,62 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the DatRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestDatRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x0D,(byte)0x00 // options - }; - - public void testLoad() { - - DatRecord record = new DatRecord(TestcaseRecordInputStream.create(0x1063, data)); - assertEquals( 0xD, record.getOptions()); - assertEquals( true, record.isHorizontalBorder() ); - assertEquals( false, record.isVerticalBorder() ); - assertEquals( true, record.isBorder() ); - assertEquals( true, record.isShowSeriesKey() ); - - assertEquals( 6, record.getRecordSize() ); - } - - public void testStore() - { - DatRecord record = new DatRecord(); - record.setHorizontalBorder( true ); - record.setVerticalBorder( false ); - record.setBorder( true ); - record.setShowSeriesKey( true ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestDataFormatRecord.java b/src/testcases/org/apache/poi/hssf/record/TestDataFormatRecord.java deleted file mode 100644 index 953f13ec08..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestDataFormatRecord.java +++ /dev/null @@ -1,66 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the DataFormatRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestDataFormatRecord extends TestCase { - byte[] data = new byte[] { - (byte)0xFF,(byte)0xFF, // point number - (byte)0x00,(byte)0x00, // series index - (byte)0x00,(byte)0x00, // series number - (byte)0x00,(byte)0x00 // format flags - }; - - public void testLoad() { - - DataFormatRecord record = new DataFormatRecord(TestcaseRecordInputStream.create(0x1006, data)); - assertEquals( (short)0xFFFF, record.getPointNumber()); - assertEquals( 0, record.getSeriesIndex()); - assertEquals( 0, record.getSeriesNumber()); - assertEquals( 0, record.getFormatFlags()); - assertEquals( false, record.isUseExcel4Colors() ); - - assertEquals( 12, record.getRecordSize() ); - } - - public void testStore() - { - DataFormatRecord record = new DataFormatRecord(); - record.setPointNumber( (short)0xFFFF ); - record.setSeriesIndex( (short)0 ); - record.setSeriesNumber( (short)0 ); - record.setFormatFlags( (short)0 ); - record.setUseExcel4Colors( false ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestDefaultDataLabelTextPropertiesRecord.java b/src/testcases/org/apache/poi/hssf/record/TestDefaultDataLabelTextPropertiesRecord.java deleted file mode 100644 index 8557359e8a..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestDefaultDataLabelTextPropertiesRecord.java +++ /dev/null @@ -1,55 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the DefaultDataLabelTextPropertiesRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestDefaultDataLabelTextPropertiesRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x02,(byte)0x00 - }; - - public void testLoad() { - - DefaultDataLabelTextPropertiesRecord record = new DefaultDataLabelTextPropertiesRecord(TestcaseRecordInputStream.create(0x1024, data)); - assertEquals( 2, record.getCategoryDataType()); - - assertEquals( 6, record.getRecordSize() ); - } - - public void testStore() - { - DefaultDataLabelTextPropertiesRecord record = new DefaultDataLabelTextPropertiesRecord(); - record.setCategoryDataType( (short)2 ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestFontBasisRecord.java b/src/testcases/org/apache/poi/hssf/record/TestFontBasisRecord.java deleted file mode 100644 index 65c19f0916..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestFontBasisRecord.java +++ /dev/null @@ -1,66 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the FontBasisRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestFontBasisRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x28,(byte)0x1A, // x basis - (byte)0x9C,(byte)0x0F, // y basis - (byte)0xC8,(byte)0x00, // height basis - (byte)0x00,(byte)0x00, // scale - (byte)0x05,(byte)0x00 // index to font table - }; - - public void testLoad() { - - FontBasisRecord record = new FontBasisRecord(TestcaseRecordInputStream.create(0x1060, data)); - assertEquals( 0x1a28, record.getXBasis()); - assertEquals( 0x0f9c, record.getYBasis()); - assertEquals( 0xc8, record.getHeightBasis()); - assertEquals( 0x00, record.getScale()); - assertEquals( 0x05, record.getIndexToFontTable()); - - assertEquals( 14, record.getRecordSize() ); - } - - public void testStore() - { - FontBasisRecord record = new FontBasisRecord(); - record.setXBasis( (short)0x1a28 ); - record.setYBasis( (short)0x0f9c ); - record.setHeightBasis( (short)0xc8 ); - record.setScale( (short)0x00 ); - record.setIndexToFontTable( (short)0x05 ); - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestFontIndexRecord.java b/src/testcases/org/apache/poi/hssf/record/TestFontIndexRecord.java deleted file mode 100644 index c962e0daee..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestFontIndexRecord.java +++ /dev/null @@ -1,55 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the FontIndexRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestFontIndexRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x05,(byte)0x00 - }; - - public void testLoad() { - - FontIndexRecord record = new FontIndexRecord(TestcaseRecordInputStream.create(0x1026, data)); - assertEquals( 5, record.getFontIndex()); - - assertEquals( 6, record.getRecordSize() ); - } - - public void testStore() - { - FontIndexRecord record = new FontIndexRecord(); - record.setFontIndex( (short)5 ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestFrameRecord.java b/src/testcases/org/apache/poi/hssf/record/TestFrameRecord.java deleted file mode 100644 index 23f1593efb..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestFrameRecord.java +++ /dev/null @@ -1,62 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the FrameRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestFrameRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x00,(byte)0x00, // border type - (byte)0x02,(byte)0x00 // options - }; - - public void testLoad() { - - FrameRecord record = new FrameRecord(TestcaseRecordInputStream.create(0x1032, data)); - assertEquals( FrameRecord.BORDER_TYPE_REGULAR, record.getBorderType()); - assertEquals( 2, record.getOptions()); - assertEquals( false, record.isAutoSize() ); - assertEquals( true, record.isAutoPosition() ); - - assertEquals( 8, record.getRecordSize() ); - } - - public void testStore() - { - FrameRecord record = new FrameRecord(); - record.setBorderType( FrameRecord.BORDER_TYPE_REGULAR ); - record.setOptions( (short)2 ); - record.setAutoSize( false ); - record.setAutoPosition( true ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestLegendRecord.java b/src/testcases/org/apache/poi/hssf/record/TestLegendRecord.java deleted file mode 100644 index 6bae58f2a4..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestLegendRecord.java +++ /dev/null @@ -1,89 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the LegendRecord class works - * correctly. Test data taken directly from a real Excel file. - * - * - * @author Andrew C. Oliver (acoliver at apache.org) - */ -public final class TestLegendRecord extends TestCase { - byte[] data = new byte[] { (byte) 0x76, (byte) 0x0E, (byte) 0x00, (byte) 0x00, (byte) 0x86, - (byte) 0x07, (byte) 0x00, (byte) 0x00, (byte) 0x19, (byte) 0x01, (byte) 0x00, - (byte) 0x00, (byte) 0x8B, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x03, - (byte) 0x01, (byte) 0x1F, (byte) 0x00 }; - - public void testLoad() { - LegendRecord record = new LegendRecord(TestcaseRecordInputStream.create(0x1015, data)); - - assertEquals(0xe76, record.getXAxisUpperLeft()); - - assertEquals(0x786, record.getYAxisUpperLeft()); - - assertEquals(0x119, record.getXSize()); - - assertEquals(0x8b, record.getYSize()); - - assertEquals((byte) 0x3, record.getType()); - - assertEquals((byte) 0x1, record.getSpacing()); - - assertEquals((short) 0x1f, record.getOptions()); - assertEquals(true, record.isAutoPosition()); - assertEquals(true, record.isAutoSeries()); - assertEquals(true, record.isAutoXPositioning()); - assertEquals(true, record.isAutoYPositioning()); - assertEquals(true, record.isVertical()); - assertEquals(false, record.isDataTable()); - - assertEquals(24, record.getRecordSize()); - } - - public void testStore() { - LegendRecord record = new LegendRecord(); - - record.setXAxisUpperLeft(0xe76); - - record.setYAxisUpperLeft(0x786); - - record.setXSize(0x119); - - record.setYSize(0x8b); - - record.setType((byte) 0x3); - - record.setSpacing((byte) 0x1); - - record.setOptions((short) 0x1f); - record.setAutoPosition(true); - record.setAutoSeries(true); - record.setAutoXPositioning(true); - record.setAutoYPositioning(true); - record.setVertical(true); - record.setDataTable(false); - - byte[] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i + 4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestLineFormatRecord.java b/src/testcases/org/apache/poi/hssf/record/TestLineFormatRecord.java deleted file mode 100644 index f3b4c3d326..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestLineFormatRecord.java +++ /dev/null @@ -1,69 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the LineFormatRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestLineFormatRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // colour - (byte)0x00,(byte)0x00, // pattern - (byte)0x00,(byte)0x00, // weight - (byte)0x01,(byte)0x00, // format - (byte)0x4D,(byte)0x00 // index - }; - - public void testLoad() { - LineFormatRecord record = new LineFormatRecord(TestcaseRecordInputStream.create(0x1007, data)); - assertEquals( 0, record.getLineColor()); - assertEquals( 0, record.getLinePattern()); - assertEquals( 0, record.getWeight()); - assertEquals( 1, record.getFormat()); - assertEquals( true, record.isAuto() ); - assertEquals( false, record.isDrawTicks() ); - assertEquals( 0x4d, record.getColourPaletteIndex()); - - assertEquals( 16, record.getRecordSize() ); - } - - public void testStore() - { - LineFormatRecord record = new LineFormatRecord(); - record.setLineColor( 0 ); - record.setLinePattern( (short)0 ); - record.setWeight( (short)0 ); - record.setAuto( true ); - record.setDrawTicks( false ); - record.setColourPaletteIndex( (short)0x4d ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestLinkedDataRecord.java b/src/testcases/org/apache/poi/hssf/record/TestLinkedDataRecord.java deleted file mode 100644 index 6f6e8cc131..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestLinkedDataRecord.java +++ /dev/null @@ -1,192 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -import org.apache.poi.hssf.record.formula.Area3DPtg; -import org.apache.poi.hssf.record.formula.Ptg; - -/** - * Tests the serialization and deserialization of the LinkedDataRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestLinkedDataRecord extends TestCase { - -/* - The records below are records that would appear in a simple bar chart - - The first record links to the series title (linkType = 0). It's - reference type is 1 which means that it links directly to data entered - into the forumula bar. There seems to be no reference to any data - however. The formulaOfLink field contains two 0 bytes. This probably - means that there is no particular heading set. - - -============================================ -Offset 0xf9c (3996) -rectype = 0x1051, recsize = 0x8 --BEGIN DUMP--------------------------------- -00000000 00 01 00 00 00 00 00 00 ........ --END DUMP----------------------------------- -recordid = 0x1051, size =8 -[AI] -.linkType = 0x00 (0 ) -.referenceType = 0x01 (1 ) -.options = 0x0000 (0 ) - .customNumberFormat = false -.indexNumberFmtRecord = 0x0000 (0 ) -.formulaOfLink = (org.apache.poi.hssf.record.LinkedDataFormulaField@95fd19 ) -[/AI] - - - The second record links to the series data (linkType=1). The - referenceType = 2 which means it's linked to the worksheet. - It links using a formula. The formula value is - 0B 00 3B 00 00 00 00 1E 00 01 00 01 00. - - 0B 00 11 bytes length - 3B (tArea3d) Rectangular area - 00 00 index to REF entry in extern sheet - 00 00 index to first row - 1E 00 index to last row - 01 00 index to first column and relative flags - 01 00 index to last column and relative flags - -============================================ -Offset 0xfa8 (4008) -rectype = 0x1051, recsize = 0x13 --BEGIN DUMP--------------------------------- -00000000 01 02 00 00 00 00 0B 00 3B 00 00 00 00 1E 00 01 ........;....... -00000010 00 01 00 ... --END DUMP----------------------------------- -recordid = 0x1051, size =19 -[AI] -.linkType = 0x01 (1 ) -.referenceType = 0x02 (2 ) -.options = 0x0000 (0 ) - .customNumberFormat = false -.indexNumberFmtRecord = 0x0000 (0 ) -.formulaOfLink = (org.apache.poi.hssf.record.LinkedDataFormulaField@11b9fb1 ) -[/AI] - - The third record links to the series categories (linkType=2). The - reference type of 2 means that it's linked to the worksheet. - It links using a formula. The formula value is - 0B 00 3B 00 00 00 00 1E 00 01 00 01 00 - - 0B 00 11 bytes in length - 3B (tArea3d) Rectangular area - 00 00 index to REF entry in extern sheet - 00 00 index to first row - 00 1F index to last row - 00 00 index to first column and relative flags - 00 00 index to last column and relative flags - - -============================================ -Offset 0xfbf (4031) -rectype = 0x1051, recsize = 0x13 --BEGIN DUMP--------------------------------- -00000000 02 02 00 00 69 01 0B 00 3B 00 00 00 00 1F 00 00 ....i...;....... -00000010 00 00 00 ... --END DUMP----------------------------------- -recordid = 0x1051, size =19 -[AI] -.linkType = 0x02 (2 ) -.referenceType = 0x02 (2 ) -.options = 0x0000 (0 ) - .customNumberFormat = false -.indexNumberFmtRecord = 0x0169 (361 ) -.formulaOfLink = (org.apache.poi.hssf.record.LinkedDataFormulaField@913fe2 ) -[/AI] - -This third link type does not seem to be documented and does not appear to -contain any useful information anyway. - -============================================ -Offset 0xfd6 (4054) -rectype = 0x1051, recsize = 0x8 --BEGIN DUMP--------------------------------- -00000000 03 01 00 00 00 00 00 00 ........ --END DUMP----------------------------------- -recordid = 0x1051, size =8 -[AI] -.linkType = 0x03 (3 ) -.referenceType = 0x01 (1 ) -.options = 0x0000 (0 ) - .customNumberFormat = false -.indexNumberFmtRecord = 0x0000 (0 ) -.formulaOfLink = (org.apache.poi.hssf.record.LinkedDataFormulaField@1f934ad ) -[/AI] - -*/ - - byte[] data = new byte[]{ - (byte)0x01, // link type - (byte)0x02, // reference type - (byte)0x00,(byte)0x00, // options - (byte)0x00,(byte)0x00, // index number format record - (byte)0x0B,(byte)0x00, // 11 bytes length - (byte)0x3B, // formula of link - (byte)0x00,(byte)0x00, // index to ref entry in extern sheet - (byte)0x00,(byte)0x00, // index to first row - (byte)0x00,(byte)0x1F, // index to last row - (byte)0x00,(byte)0x00, // index to first column and relative flags - (byte)0x00,(byte)0x00, // index to last column and relative flags - }; - - public void testLoad() { - - LinkedDataRecord record = new LinkedDataRecord(TestcaseRecordInputStream.create(0x1051, data)); - assertEquals( LinkedDataRecord.LINK_TYPE_VALUES, record.getLinkType()); - assertEquals( LinkedDataRecord.REFERENCE_TYPE_WORKSHEET, record.getReferenceType()); - assertEquals( 0, record.getOptions()); - assertEquals( false, record.isCustomNumberFormat() ); - assertEquals( 0, record.getIndexNumberFmtRecord()); - - Area3DPtg ptgExpected = new Area3DPtg(0, 7936, 0, 0, - false, false, false, false, 0); - - Ptg ptgActual = record.getFormulaOfLink()[0]; - assertEquals(ptgExpected.toString(), ptgActual.toString()); - - assertEquals( data.length + 4, record.getRecordSize() ); - } - - public void testStore() { - LinkedDataRecord record = new LinkedDataRecord(); - record.setLinkType( LinkedDataRecord.LINK_TYPE_VALUES ); - record.setReferenceType( LinkedDataRecord.REFERENCE_TYPE_WORKSHEET ); - record.setOptions( (short)0 ); - record.setCustomNumberFormat( false ); - record.setIndexNumberFmtRecord( (short)0 ); - Area3DPtg ptg = new Area3DPtg(0, 7936, 0, 0, - false, false, false, false, 0); - record.setFormulaOfLink(new Ptg[] { ptg, } ); - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestNumberFormatIndexRecord.java b/src/testcases/org/apache/poi/hssf/record/TestNumberFormatIndexRecord.java deleted file mode 100644 index 570d71ec62..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestNumberFormatIndexRecord.java +++ /dev/null @@ -1,55 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the NumberFormatIndexRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestNumberFormatIndexRecord extends TestCase { - byte[] data = new byte[] { - 0x05,0x00 - }; - - public void testLoad() { - - NumberFormatIndexRecord record = new NumberFormatIndexRecord(TestcaseRecordInputStream.create(0x104e, data)); - assertEquals( 5, record.getFormatIndex()); - - assertEquals( 6, record.getRecordSize() ); - } - - public void testStore() - { - NumberFormatIndexRecord record = new NumberFormatIndexRecord(); - record.setFormatIndex( (short)5 ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestObjectLinkRecord.java b/src/testcases/org/apache/poi/hssf/record/TestObjectLinkRecord.java deleted file mode 100644 index 9d8168d4b5..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestObjectLinkRecord.java +++ /dev/null @@ -1,59 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the ObjectLinkRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Andrew C. Oliver (acoliver at apache.org) - */ -public final class TestObjectLinkRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x03,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00 - }; - - public void testLoad() { - ObjectLinkRecord record = new ObjectLinkRecord(TestcaseRecordInputStream.create(0x1027, data)); - - assertEquals( (short)3, record.getAnchorId()); - assertEquals( (short)0x00, record.getLink1()); - assertEquals( (short)0x00, record.getLink2()); - - assertEquals( 10, record.getRecordSize() ); - } - - public void testStore() { - ObjectLinkRecord record = new ObjectLinkRecord(); - - record.setAnchorId( (short)3 ); - record.setLink1( (short)0x00 ); - record.setLink2( (short)0x00 ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestPlotAreaRecord.java b/src/testcases/org/apache/poi/hssf/record/TestPlotAreaRecord.java deleted file mode 100644 index 631d6895d9..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestPlotAreaRecord.java +++ /dev/null @@ -1,50 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the PlotAreaRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Andrew C. Oliver (acoliver at apache.org) - */ -public final class TestPlotAreaRecord extends TestCase { - byte[] data = new byte[] { - - }; - - public void testLoad() { - PlotAreaRecord record = new PlotAreaRecord(TestcaseRecordInputStream.create(0x1035, data)); - - assertEquals( 4, record.getRecordSize() ); - } - - public void testStore() { - PlotAreaRecord record = new PlotAreaRecord(); - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestPlotGrowthRecord.java b/src/testcases/org/apache/poi/hssf/record/TestPlotGrowthRecord.java deleted file mode 100644 index c5896d2b38..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestPlotGrowthRecord.java +++ /dev/null @@ -1,57 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the PlotGrowthRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestPlotGrowthRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00, // horizontal - (byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00 // vertical - }; - - public void testLoad() { - - PlotGrowthRecord record = new PlotGrowthRecord(TestcaseRecordInputStream.create(0x1064, data)); - assertEquals( 65536, record.getHorizontalScale()); - assertEquals( 65536, record.getVerticalScale()); - - assertEquals( 12, record.getRecordSize() ); - } - - public void testStore() - { - PlotGrowthRecord record = new PlotGrowthRecord(); - record.setHorizontalScale( 65536 ); - record.setVerticalScale( 65536 ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestSeriesChartGroupIndexRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSeriesChartGroupIndexRecord.java deleted file mode 100644 index cd09e061e6..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestSeriesChartGroupIndexRecord.java +++ /dev/null @@ -1,53 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the SeriesChartGroupIndexRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestSeriesChartGroupIndexRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x00,(byte)0x00 - }; - - public void testLoad() { - SeriesChartGroupIndexRecord record = new SeriesChartGroupIndexRecord(TestcaseRecordInputStream.create(0x1045, data)); - assertEquals( 0, record.getChartGroupIndex()); - - assertEquals( 6, record.getRecordSize() ); - } - - public void testStore() - { - SeriesChartGroupIndexRecord record = new SeriesChartGroupIndexRecord(); - record.setChartGroupIndex( (short)0 ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestSeriesIndexRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSeriesIndexRecord.java deleted file mode 100644 index 9ba9b0ad9e..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestSeriesIndexRecord.java +++ /dev/null @@ -1,57 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the SeriesIndexRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Andrew C. Oliver (acoliver at apache.org) - */ -public final class TestSeriesIndexRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x03,(byte)0x00 - }; - - public void testLoad() { - SeriesIndexRecord record = new SeriesIndexRecord(TestcaseRecordInputStream.create(0x1065, data)); - - assertEquals( (short)3, record.getIndex()); - assertEquals( 6, record.getRecordSize() ); - } - - public void testStore() - { - SeriesIndexRecord record = new SeriesIndexRecord(); - - - - record.setIndex( (short)3 ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestSeriesLabelsRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSeriesLabelsRecord.java deleted file mode 100644 index c1602dd2a3..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestSeriesLabelsRecord.java +++ /dev/null @@ -1,66 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the SeriesLabelsRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestSeriesLabelsRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x03,(byte)0x00 - }; - - public void testLoad() { - SeriesLabelsRecord record = new SeriesLabelsRecord(TestcaseRecordInputStream.create(0x100c, data)); - assertEquals( 3, record.getFormatFlags()); - assertEquals( true, record.isShowActual() ); - assertEquals( true, record.isShowPercent() ); - assertEquals( false, record.isLabelAsPercentage() ); - assertEquals( false, record.isSmoothedLine() ); - assertEquals( false, record.isShowLabel() ); - assertEquals( false, record.isShowBubbleSizes() ); - - - assertEquals( 2+4, record.getRecordSize() ); - } - - public void testStore() - { - SeriesLabelsRecord record = new SeriesLabelsRecord(); - record.setShowActual( true ); - record.setShowPercent( true ); - record.setLabelAsPercentage( false ); - record.setSmoothedLine( false ); - record.setShowLabel( false ); - record.setShowBubbleSizes( false ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestSeriesListRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSeriesListRecord.java deleted file mode 100644 index 1669dc4dfc..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestSeriesListRecord.java +++ /dev/null @@ -1,54 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the SeriesListRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestSeriesListRecord extends TestCase { - private static final byte[] data = { - (byte)0x02,(byte)0x00,(byte)0x01,(byte)0x20,(byte)0xff,(byte)0xf0 - }; - - public void testLoad() { - - SeriesListRecord record = new SeriesListRecord(TestcaseRecordInputStream.create(0x1016, data)); - assertEquals( (short)0x2001, record.getSeriesNumbers()[0]); - assertEquals( (short)0xf0ff, record.getSeriesNumbers()[1]); - assertEquals( 2, record.getSeriesNumbers().length); - - assertEquals( 4 + 6, record.getRecordSize() ); - } - - public void testStore() { - SeriesListRecord record = new SeriesListRecord(new short[] { (short)0x2001, (short)0xf0ff } ); - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestSeriesRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSeriesRecord.java deleted file mode 100644 index 2e7cfa6fee..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestSeriesRecord.java +++ /dev/null @@ -1,69 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the SeriesRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestSeriesRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x01,(byte)0x00, // category data type - (byte)0x01,(byte)0x00, // values data type - (byte)0x1B,(byte)0x00, // num categories - (byte)0x1B,(byte)0x00, // num values - (byte)0x01,(byte)0x00, // bubble series type - (byte)0x00,(byte)0x00 // num bubble values - }; - - public void testLoad() { - - SeriesRecord record = new SeriesRecord(TestcaseRecordInputStream.create(0x1003, data)); - assertEquals( SeriesRecord.CATEGORY_DATA_TYPE_NUMERIC, record.getCategoryDataType()); - assertEquals( SeriesRecord.VALUES_DATA_TYPE_NUMERIC, record.getValuesDataType()); - assertEquals( 27, record.getNumCategories()); - assertEquals( 27, record.getNumValues()); - assertEquals( SeriesRecord.BUBBLE_SERIES_TYPE_NUMERIC, record.getBubbleSeriesType()); - assertEquals( 0, record.getNumBubbleValues()); - - - assertEquals( 16, record.getRecordSize() ); - } - - public void testStore() - { - SeriesRecord record = new SeriesRecord(); - record.setCategoryDataType( SeriesRecord.CATEGORY_DATA_TYPE_NUMERIC ); - record.setValuesDataType( SeriesRecord.VALUES_DATA_TYPE_NUMERIC ); - record.setNumCategories( (short)27 ); - record.setNumValues( (short)27 ); - record.setBubbleSeriesType( SeriesRecord.BUBBLE_SERIES_TYPE_NUMERIC ); - record.setNumBubbleValues( (short)0 ); - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestSeriesTextRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSeriesTextRecord.java deleted file mode 100644 index 8b05dc4336..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestSeriesTextRecord.java +++ /dev/null @@ -1,105 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - -import junit.framework.AssertionFailedError; -import junit.framework.TestCase; - -import org.apache.poi.util.HexRead; - -/** - * Tests the serialization and deserialization of the SeriesTextRecord class - * works correctly. Test data taken directly from a real Excel file. - * - * - * @author Andrew C. Oliver (acoliver at apache.org) - */ -public final class TestSeriesTextRecord extends TestCase { - private static final byte[] SIMPLE_DATA = HexRead - .readFromString("00 00 0C 00 56 61 6C 75 65 20 4E 75 6D 62 65 72"); - - public void testLoad() { - SeriesTextRecord record = new SeriesTextRecord(TestcaseRecordInputStream.create(0x100d, SIMPLE_DATA)); - - assertEquals((short) 0, record.getId()); - assertEquals("Value Number", record.getText()); - - assertEquals(SIMPLE_DATA.length + 4, record.getRecordSize()); - } - - public void testStore() { - SeriesTextRecord record = new SeriesTextRecord(); - - record.setId(0); - record.setText("Value Number"); - - byte[] recordBytes = record.serialize(); - TestcaseRecordInputStream.confirmRecordEncoding(SeriesTextRecord.sid, SIMPLE_DATA, - recordBytes); - } - - public void testReserializeLongTitle() { - // Hex dump from bug 45784 attachment 22560 streamOffset=0x0CD1 - byte[] data = HexRead.readFromString( - "00 00, " - + "82 " - + "01 " - + "50 00 6C 00 61 00 73 00 6D 00 61 00 20 00 4C 00 " - + "65 00 76 00 65 00 6C 00 73 00 20 00 6F 00 66 00 " - + "20 00 4C 00 2D 00 30 00 30 00 30 00 31 00 31 00 " - + "31 00 32 00 32 00 32 00 2D 00 33 00 33 00 33 00 " - + "58 00 34 00 34 00 34 00 20 00 69 00 6E 00 20 00 " - + "53 00 44 00 20 00 72 00 61 00 74 00 0A 00 50 00 " - + "4F 00 20 00 33 00 2E 00 30 00 20 00 6D 00 67 00 " - + "2F 00 6B 00 67 00 20 00 28 00 35 00 2E 00 30 00 " - + "20 00 6D 00 4C 00 2F 00 6B 00 67 00 29 00 20 00 " - + "69 00 6E 00 20 00 4D 00 65 00 74 00 68 00 6F 00 " - + "63 00 65 00 6C 00 0A 00 49 00 56 00 20 00 30 00 " - + "2E 00 35 00 20 00 6D 00 67 00 2F 00 6B 00 67 00 " - + "20 00 28 00 31 00 2E 00 30 00 20 00 6D 00 4C 00 " - + "2F 00 6B 00 67 00 29 00 20 00 69 00 6E 00 20 00 " - + "36 00 30 00 25 00 20 00 50 00 45 00 47 00 20 00 " - + "32 00 30 00 30 00 0A 00 46 00 20 00 3D 00 61 00 " - + "62 00 63 00"); - - RecordInputStream in = TestcaseRecordInputStream.create(SeriesTextRecord.sid, data); - SeriesTextRecord str; - try { - str = new SeriesTextRecord(in); - } catch (RecordFormatException e) { - if (e.getCause() instanceof IllegalArgumentException) { - // 'would be' error msg changed at svn r703620 - // "Illegal length - asked for -126 but only 130 left!" - // "Bad requested string length (-126)" - throw new AssertionFailedError("Identified bug 45784a"); - } - throw e; - } - - if (str.getRecordSize() < 0) { - throw new AssertionFailedError("Identified bug 45784b"); - } - byte[] ser; - try { - ser = str.serialize(); - } catch (Exception e) { - throw new RuntimeException(e); - } - TestcaseRecordInputStream.confirmRecordEncoding(SeriesTextRecord.sid, data, ser); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestSeriesToChartGroupRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSeriesToChartGroupRecord.java deleted file mode 100644 index 8112c54b70..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestSeriesToChartGroupRecord.java +++ /dev/null @@ -1,54 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the SeriesToChartGroupRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Andrew C. Oliver (acoliver at apache.org) - */ -public final class TestSeriesToChartGroupRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x0, (byte)0x0 - }; - - public void testLoad() { - SeriesToChartGroupRecord record = new SeriesToChartGroupRecord(TestcaseRecordInputStream.create(0x1045, data)); - assertEquals( 0x0, record.getChartGroupIndex()); - - assertEquals( 0x6, record.getRecordSize() ); - } - - public void testStore() - { - SeriesToChartGroupRecord record = new SeriesToChartGroupRecord(); - record.setChartGroupIndex( (short)0x0 ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestSheetPropertiesRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSheetPropertiesRecord.java deleted file mode 100644 index aa870a3374..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestSheetPropertiesRecord.java +++ /dev/null @@ -1,68 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the SheetPropertiesRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestSheetPropertiesRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x0A,(byte)0x00, - (byte)0x00 - //,(byte)0x00 // not sure where that last byte comes from - }; - - public void testLoad() { - SheetPropertiesRecord record = new SheetPropertiesRecord(TestcaseRecordInputStream.create(0x1044, data)); - assertEquals( 10, record.getFlags()); - assertEquals( false, record.isChartTypeManuallyFormatted() ); - assertEquals( true, record.isPlotVisibleOnly() ); - assertEquals( false, record.isDoNotSizeWithWindow() ); - assertEquals( true, record.isDefaultPlotDimensions() ); - assertEquals( false, record.isAutoPlotArea() ); - assertEquals( 0, record.getEmpty()); - - - assertEquals( 7, record.getRecordSize() ); - } - - public void testStore() - { - SheetPropertiesRecord record = new SheetPropertiesRecord(); - record.setChartTypeManuallyFormatted( false ); - record.setPlotVisibleOnly( true ); - record.setDoNotSizeWithWindow( false ); - record.setDefaultPlotDimensions( true ); - record.setAutoPlotArea( false ); - record.setEmpty( (byte)0 ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestTextRecord.java b/src/testcases/org/apache/poi/hssf/record/TestTextRecord.java deleted file mode 100644 index 8d416050f7..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestTextRecord.java +++ /dev/null @@ -1,115 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the TextRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestTextRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x02, // horiz align - (byte)0x02, // vert align - (byte)0x01,(byte)0x00, // display mode - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // rgb color - (byte)0xD6,(byte)0xFF,(byte)0xFF,(byte)0xFF, // x - (byte)0xC4,(byte)0xFF,(byte)0xFF,(byte)0xFF, // y - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // width - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // height - (byte)0xB1,(byte)0x00, // options 1 - (byte)0x4D,(byte)0x00, // index of color value - (byte)0x50,(byte)0x2B, // options 2 -- strange upper bits supposed to be 0'd - (byte)0x00,(byte)0x00 // text rotation - }; - - public void testLoad() { - - TextRecord record = new TextRecord(TestcaseRecordInputStream.create(0x1025, data)); - assertEquals( TextRecord.HORIZONTAL_ALIGNMENT_CENTER, record.getHorizontalAlignment()); - assertEquals( TextRecord.VERTICAL_ALIGNMENT_CENTER, record.getVerticalAlignment()); - assertEquals( TextRecord.DISPLAY_MODE_TRANSPARENT, record.getDisplayMode()); - assertEquals( 0, record.getRgbColor()); - assertEquals( -42, record.getX()); - assertEquals( -60, record.getY()); - assertEquals( 0, record.getWidth()); - assertEquals( 0, record.getHeight()); - assertEquals( 177, record.getOptions1()); - assertEquals( true, record.isAutoColor() ); - assertEquals( false, record.isShowKey() ); - assertEquals( false, record.isShowValue() ); - assertEquals( false, record.isVertical() ); - assertEquals( true, record.isAutoGeneratedText() ); - assertEquals( true, record.isGenerated() ); - assertEquals( false, record.isAutoLabelDeleted() ); - assertEquals( true, record.isAutoBackground() ); - assertEquals( TextRecord.ROTATION_NONE, record.getRotation() ); - assertEquals( false, record.isShowCategoryLabelAsPercentage() ); - assertEquals( false, record.isShowValueAsPercentage() ); - assertEquals( false, record.isShowBubbleSizes() ); - assertEquals( false, record.isShowLabel() ); - assertEquals( 77, record.getIndexOfColorValue()); - assertEquals( 11088, record.getOptions2()); - assertEquals( 0, record.getDataLabelPlacement() ); - assertEquals( 0, record.getTextRotation()); - - - assertEquals( 36, record.getRecordSize() ); - } - - public void testStore() - { - TextRecord record = new TextRecord(); - record.setHorizontalAlignment( TextRecord.HORIZONTAL_ALIGNMENT_CENTER ); - record.setVerticalAlignment( TextRecord.VERTICAL_ALIGNMENT_CENTER ); - record.setDisplayMode( TextRecord.DISPLAY_MODE_TRANSPARENT ); - record.setRgbColor( 0 ); - record.setX( -42 ); - record.setY( -60 ); - record.setWidth( 0 ); - record.setHeight( 0 ); - record.setAutoColor( true ); - record.setShowKey( false ); - record.setShowValue( false ); - record.setVertical( false ); - record.setAutoGeneratedText( true ); - record.setGenerated( true ); - record.setAutoLabelDeleted( false ); - record.setAutoBackground( true ); - record.setRotation( TextRecord.ROTATION_NONE ); - record.setShowCategoryLabelAsPercentage( false ); - record.setShowValueAsPercentage( false ); - record.setShowBubbleSizes( false ); - record.setShowLabel( false ); - record.setIndexOfColorValue( (short)77 ); - record.setOptions2( (short)0x2b50 ); -// record.setDataLabelPlacement( (short)0x2b50 ); - record.setTextRotation( (short)0 ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestTickRecord.java b/src/testcases/org/apache/poi/hssf/record/TestTickRecord.java deleted file mode 100644 index b0b8ced7b0..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestTickRecord.java +++ /dev/null @@ -1,99 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the TickRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Andrew C. Oliver(acoliver at apache.org) - */ -public final class TestTickRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x02, (byte)0x00, (byte)0x03, (byte)0x01, - (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, - (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, - (byte)0x00, (byte)0x00, (byte)0x00, - (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, - (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x23, (byte)0x00, - (byte)0x4D, (byte)0x00, (byte)0x00, (byte)0x00 - }; - - public void testLoad() { - TickRecord record = new TickRecord(TestcaseRecordInputStream.create(0x101e, data)); - assertEquals( (byte)2, record.getMajorTickType()); - assertEquals( (byte)0, record.getMinorTickType()); - assertEquals( (byte)3, record.getLabelPosition()); - assertEquals( (short)1, record.getBackground()); - assertEquals( 0, record.getLabelColorRgb()); - assertEquals( (short)0, record.getZero1()); - assertEquals( (short)0, record.getZero2()); - assertEquals( (short)35, record.getOptions()); - assertEquals( true, record.isAutoTextColor() ); - assertEquals( true, record.isAutoTextBackground() ); - assertEquals( (short)0x0, record.getRotation() ); - assertEquals( true, record.isAutorotate() ); - assertEquals( (short)77, record.getTickColor()); - assertEquals( (short)0x0, record.getZero3()); - - - assertEquals( 34, record.getRecordSize() ); - } - - public void testStore() - { - TickRecord record = new TickRecord(); - record.setMajorTickType( (byte)2 ); - record.setMinorTickType( (byte)0 ); - record.setLabelPosition( (byte)3 ); - record.setBackground( (byte)1 ); - record.setLabelColorRgb( 0 ); - record.setZero1( (short)0 ); - record.setZero2( (short)0 ); - record.setOptions( (short)35 ); - record.setAutoTextColor( true ); - record.setAutoTextBackground( true ); - record.setRotation( (short)0 ); - record.setAutorotate( true ); - record.setTickColor( (short)77 ); - record.setZero3( (short)0 ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } - - - /** - * The main program for the TestTickRecord class - * - *@param args The command line arguments - */ - public static void main(String[] args) { - System.out.println("Testing org.apache.poi.hssf.record.TickRecord"); - junit.textui.TestRunner.run(TestTickRecord.class); - } - -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestUnitsRecord.java b/src/testcases/org/apache/poi/hssf/record/TestUnitsRecord.java deleted file mode 100644 index 7b79553df4..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestUnitsRecord.java +++ /dev/null @@ -1,55 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the UnitsRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestUnitsRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x00, (byte)0x00 - }; - - public void testLoad() { - - UnitsRecord record = new UnitsRecord(TestcaseRecordInputStream.create(0x1001, data)); - assertEquals( 0, record.getUnits()); - - assertEquals( 6, record.getRecordSize() ); - } - - public void testStore() - { - UnitsRecord record = new UnitsRecord(); - record.setUnits( (short)0 ); - - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/TestValueRangeRecord.java b/src/testcases/org/apache/poi/hssf/record/TestValueRangeRecord.java deleted file mode 100644 index 62d7d34c21..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/TestValueRangeRecord.java +++ /dev/null @@ -1,86 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.record; - - -import junit.framework.TestCase; - -/** - * Tests the serialization and deserialization of the ValueRangeRecord - * class works correctly. Test data taken directly from a real - * Excel file. - * - * - * @author Glen Stampoultzis (glens at apache.org) - */ -public final class TestValueRangeRecord extends TestCase { - byte[] data = new byte[] { - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // min axis value - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // max axis value - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // major increment - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // minor increment - (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // cross over - (byte)0x1F,(byte)0x01 // options - }; - - public void testLoad() { - - ValueRangeRecord record = new ValueRangeRecord(TestcaseRecordInputStream.create(0x101f, data)); - assertEquals( 0.0, record.getMinimumAxisValue(), 0.001); - assertEquals( 0.0, record.getMaximumAxisValue(), 0.001); - assertEquals( 0.0, record.getMajorIncrement(), 0.001); - assertEquals( 0.0, record.getMinorIncrement(), 0.001); - assertEquals( 0.0, record.getCategoryAxisCross(), 0.001); - assertEquals( 0x011f, record.getOptions()); - assertEquals( true, record.isAutomaticMinimum() ); - assertEquals( true, record.isAutomaticMaximum() ); - assertEquals( true, record.isAutomaticMajor() ); - assertEquals( true, record.isAutomaticMinor() ); - assertEquals( true, record.isAutomaticCategoryCrossing() ); - assertEquals( false, record.isLogarithmicScale() ); - assertEquals( false, record.isValuesInReverse() ); - assertEquals( false, record.isCrossCategoryAxisAtMaximum() ); - assertEquals( true, record.isReserved() ); - - assertEquals( 42+4, record.getRecordSize() ); - } - - public void testStore() - { - ValueRangeRecord record = new ValueRangeRecord(); - record.setMinimumAxisValue( 0 ); - record.setMaximumAxisValue( 0 ); - record.setMajorIncrement( 0 ); - record.setMinorIncrement( 0 ); - record.setCategoryAxisCross( 0 ); - record.setAutomaticMinimum( true ); - record.setAutomaticMaximum( true ); - record.setAutomaticMajor( true ); - record.setAutomaticMinor( true ); - record.setAutomaticCategoryCrossing( true ); - record.setLogarithmicScale( false ); - record.setValuesInReverse( false ); - record.setCrossCategoryAxisAtMaximum( false ); - record.setReserved( true ); - - byte [] recordBytes = record.serialize(); - assertEquals(recordBytes.length - 4, data.length); - for (int i = 0; i < data.length; i++) - assertEquals("At offset " + i, data[i], recordBytes[i+4]); - } -} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/AllChartRecordTests.java b/src/testcases/org/apache/poi/hssf/record/chart/AllChartRecordTests.java new file mode 100644 index 0000000000..1714e91c02 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/AllChartRecordTests.java @@ -0,0 +1,71 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * Collects all tests for package org.apache.poi.hssf.record.class. + * + * @author Josh Micich + */ +public final class AllChartRecordTests { + + public static Test suite() { + TestSuite result = new TestSuite(AllChartRecordTests.class.getName()); + + result.addTestSuite(TestAreaFormatRecord.class); + result.addTestSuite(TestAreaRecord.class); + result.addTestSuite(TestAxisLineFormatRecord.class); + result.addTestSuite(TestAxisOptionsRecord.class); + result.addTestSuite(TestAxisParentRecord.class); + result.addTestSuite(TestAxisRecord.class); + result.addTestSuite(TestAxisUsedRecord.class); + result.addTestSuite(TestBarRecord.class); + result.addTestSuite(TestCategorySeriesAxisRecord.class); + result.addTestSuite(TestChartRecord.class); + result.addTestSuite(TestChartTitleFormatRecord.class); + result.addTestSuite(TestDatRecord.class); + result.addTestSuite(TestDataFormatRecord.class); + result.addTestSuite(TestDefaultDataLabelTextPropertiesRecord.class); + result.addTestSuite(TestFontBasisRecord.class); + result.addTestSuite(TestFontIndexRecord.class); + result.addTestSuite(TestFrameRecord.class); + result.addTestSuite(TestLegendRecord.class); + result.addTestSuite(TestLineFormatRecord.class); + result.addTestSuite(TestLinkedDataRecord.class); + result.addTestSuite(TestNumberFormatIndexRecord.class); + result.addTestSuite(TestObjectLinkRecord.class); + result.addTestSuite(TestPlotAreaRecord.class); + result.addTestSuite(TestPlotGrowthRecord.class); + result.addTestSuite(TestSeriesChartGroupIndexRecord.class); + result.addTestSuite(TestSeriesIndexRecord.class); + result.addTestSuite(TestSeriesLabelsRecord.class); + result.addTestSuite(TestSeriesListRecord.class); + result.addTestSuite(TestSeriesRecord.class); + result.addTestSuite(TestSeriesTextRecord.class); + result.addTestSuite(TestSeriesToChartGroupRecord.class); + result.addTestSuite(TestSheetPropertiesRecord.class); + result.addTestSuite(TestTextRecord.class); + result.addTestSuite(TestTickRecord.class); + result.addTestSuite(TestUnitsRecord.class); + result.addTestSuite(TestValueRangeRecord.class); + return result; + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestAreaFormatRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestAreaFormatRecord.java new file mode 100644 index 0000000000..c47a8b4f7e --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestAreaFormatRecord.java @@ -0,0 +1,77 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the AreaFormatRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestAreaFormatRecord extends TestCase { + byte[] data = new byte[] { + (byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x00, // forecolor + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // backcolor + (byte)0x01,(byte)0x00, // pattern + (byte)0x01,(byte)0x00, // format + (byte)0x4E,(byte)0x00, // forecolor index + (byte)0x4D,(byte)0x00 // backcolor index + + }; + + public void testLoad() { + + AreaFormatRecord record = new AreaFormatRecord(TestcaseRecordInputStream.create(0x100a, data)); + assertEquals( 0xFFFFFF, record.getForegroundColor()); + assertEquals( 0x000000, record.getBackgroundColor()); + assertEquals( 1, record.getPattern()); + assertEquals( 1, record.getFormatFlags()); + assertEquals( true, record.isAutomatic() ); + assertEquals( false, record.isInvert() ); + assertEquals( 0x4e, record.getForecolorIndex()); + assertEquals( 0x4d, record.getBackcolorIndex()); + + + assertEquals( 20, record.getRecordSize() ); + } + + public void testStore() + { + AreaFormatRecord record = new AreaFormatRecord(); + record.setForegroundColor( 0xFFFFFF ); + record.setBackgroundColor( 0x000000 ); + record.setPattern( (short)1 ); + record.setAutomatic( true ); + record.setInvert( false ); + record.setForecolorIndex( (short)0x4e ); + record.setBackcolorIndex( (short)0x4d ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestAreaRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestAreaRecord.java new file mode 100644 index 0000000000..2570d2e1c3 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestAreaRecord.java @@ -0,0 +1,63 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the AreaRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestAreaRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x02,(byte)0x00 // format flags + }; + + public void testLoad() { + + AreaRecord record = new AreaRecord(TestcaseRecordInputStream.create(0x101A, data)); + assertEquals( 2, record.getFormatFlags()); + assertEquals( false, record.isStacked() ); + assertEquals( true, record.isDisplayAsPercentage() ); + assertEquals( false, record.isShadow() ); + + + assertEquals( 6, record.getRecordSize() ); + } + + public void testStore() + { + AreaRecord record = new AreaRecord(); + record.setStacked( false ); + record.setDisplayAsPercentage( true ); + record.setShadow( false ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestAxisLineFormatRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestAxisLineFormatRecord.java new file mode 100644 index 0000000000..ae80fe2b30 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestAxisLineFormatRecord.java @@ -0,0 +1,56 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the AxisLineFormatRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestAxisLineFormatRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x01,(byte)0x00 + }; + + public void testLoad() { + AxisLineFormatRecord record = new AxisLineFormatRecord(TestcaseRecordInputStream.create(0x1021, data)); + assertEquals( AxisLineFormatRecord.AXIS_TYPE_MAJOR_GRID_LINE, record.getAxisType()); + + assertEquals( 6, record.getRecordSize() ); + } + + public void testStore() + { + AxisLineFormatRecord record = new AxisLineFormatRecord(); + record.setAxisType( AxisLineFormatRecord.AXIS_TYPE_MAJOR_GRID_LINE ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestAxisOptionsRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestAxisOptionsRecord.java new file mode 100644 index 0000000000..00af6db238 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestAxisOptionsRecord.java @@ -0,0 +1,101 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the AxisOptionsRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Andrew C. Oliver(acoliver at apache.org) + */ +public final class TestAxisOptionsRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01, + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00, + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, + (byte)0x00,(byte)0xEF,(byte)0x00 + }; + + public void testLoad() { + AxisOptionsRecord record = new AxisOptionsRecord(TestcaseRecordInputStream.create(0x1062, data)); + assertEquals( 0, record.getMinimumCategory()); + assertEquals( 0, record.getMaximumCategory()); + assertEquals( 1, record.getMajorUnitValue()); + assertEquals( 0, record.getMajorUnit()); + assertEquals( 1, record.getMinorUnitValue()); + assertEquals( 0, record.getMinorUnit()); + assertEquals( 0, record.getBaseUnit()); + assertEquals( 0, record.getCrossingPoint()); + assertEquals( 239, record.getOptions()); + assertEquals( true, record.isDefaultMinimum() ); + assertEquals( true, record.isDefaultMaximum() ); + assertEquals( true, record.isDefaultMajor() ); + assertEquals( true, record.isDefaultMinorUnit() ); + assertEquals( false, record.isIsDate() ); + assertEquals( true, record.isDefaultBase() ); + assertEquals( true, record.isDefaultCross() ); + assertEquals( true, record.isDefaultDateSettings() ); + + assertEquals( 22, record.getRecordSize() ); + } + + public void testStore() + { + AxisOptionsRecord record = new AxisOptionsRecord(); + record.setMinimumCategory( (short)0 ); + record.setMaximumCategory( (short)0 ); + record.setMajorUnitValue( (short)1 ); + record.setMajorUnit( (short)0 ); + record.setMinorUnitValue( (short)1 ); + record.setMinorUnit( (short)0 ); + record.setBaseUnit( (short)0 ); + record.setCrossingPoint( (short)0 ); + record.setOptions( (short)239 ); + record.setDefaultMinimum( true ); + record.setDefaultMaximum( true ); + record.setDefaultMajor( true ); + record.setDefaultMinorUnit( true ); + record.setIsDate( false ); + record.setDefaultBase( true ); + record.setDefaultCross( true ); + record.setDefaultDateSettings( true ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } + + /** + * The main program for the TestAxisOptionsRecord class + * + *@param args The command line arguments + */ + public static void main(String[] args) { + System.out.println("Testing org.apache.poi.hssf.record.AxisOptionsRecord"); + junit.textui.TestRunner.run(TestAxisOptionsRecord.class); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestAxisParentRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestAxisParentRecord.java new file mode 100644 index 0000000000..323f7f3c05 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestAxisParentRecord.java @@ -0,0 +1,67 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the AxisParentRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestAxisParentRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x00,(byte)0x00, // axis type + (byte)0x1D,(byte)0x02,(byte)0x00,(byte)0x00, // x + (byte)0xDD,(byte)0x00,(byte)0x00,(byte)0x00, // y + (byte)0x31,(byte)0x0B,(byte)0x00,(byte)0x00, // width + (byte)0x56,(byte)0x0B,(byte)0x00,(byte)0x00 // height + }; + + public void testLoad() { + AxisParentRecord record = new AxisParentRecord(TestcaseRecordInputStream.create(0x1041, data)); + assertEquals( AxisParentRecord.AXIS_TYPE_MAIN, record.getAxisType()); + assertEquals( 0x021d, record.getX()); + assertEquals( 0xdd, record.getY()); + assertEquals( 0x0b31, record.getWidth()); + assertEquals( 0x0b56, record.getHeight()); + + assertEquals( 22, record.getRecordSize() ); + } + + public void testStore() + { + AxisParentRecord record = new AxisParentRecord(); + record.setAxisType( AxisParentRecord.AXIS_TYPE_MAIN ); + record.setX( 0x021d ); + record.setY( 0xdd ); + record.setWidth( 0x0b31 ); + record.setHeight( 0x0b56 ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestAxisRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestAxisRecord.java new file mode 100644 index 0000000000..e8ebf322f5 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestAxisRecord.java @@ -0,0 +1,69 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the AxisRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestAxisRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x00,(byte)0x00, // type + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00 + }; + + public void testLoad() { + + AxisRecord record = new AxisRecord(TestcaseRecordInputStream.create(0x101d, data)); + assertEquals( AxisRecord.AXIS_TYPE_CATEGORY_OR_X_AXIS, record.getAxisType()); + assertEquals( 0, record.getReserved1()); + assertEquals( 0, record.getReserved2()); + assertEquals( 0, record.getReserved3()); + assertEquals( 0, record.getReserved4()); + + assertEquals( 4 + 18, record.getRecordSize() ); + } + + public void testStore() + { + AxisRecord record = new AxisRecord(); + record.setAxisType( AxisRecord.AXIS_TYPE_CATEGORY_OR_X_AXIS ); + record.setReserved1( 0 ); + record.setReserved2( 0 ); + record.setReserved3( 0 ); + record.setReserved4( 0 ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestAxisUsedRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestAxisUsedRecord.java new file mode 100644 index 0000000000..f421b4ffc6 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestAxisUsedRecord.java @@ -0,0 +1,56 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the AxisUsedRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestAxisUsedRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x01,(byte)0x00, + }; + + public void testLoad() { + AxisUsedRecord record = new AxisUsedRecord(TestcaseRecordInputStream.create(0x1046, data)); + assertEquals( 1, record.getNumAxis()); + + assertEquals( 6, record.getRecordSize() ); + } + + public void testStore() + { + AxisUsedRecord record = new AxisUsedRecord(); + record.setNumAxis( (short)1 ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestBarRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestBarRecord.java new file mode 100644 index 0000000000..4781fe9418 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestBarRecord.java @@ -0,0 +1,70 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the BarRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestBarRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x00,(byte)0x00, // bar space + (byte)0x96,(byte)0x00, // category space + (byte)0x00,(byte)0x00 // format flags + }; + + public void testLoad() { + + BarRecord record = new BarRecord(TestcaseRecordInputStream.create(0x1017, data)); + assertEquals( 0, record.getBarSpace()); + assertEquals( 0x96, record.getCategorySpace()); + assertEquals( 0, record.getFormatFlags()); + assertEquals( false, record.isHorizontal() ); + assertEquals( false, record.isStacked() ); + assertEquals( false, record.isDisplayAsPercentage() ); + assertEquals( false, record.isShadow() ); + + assertEquals( 10, record.getRecordSize() ); + } + + public void testStore() + { + BarRecord record = new BarRecord(); + record.setBarSpace( (short)0 ); + record.setCategorySpace( (short)0x96 ); + record.setHorizontal( false ); + record.setStacked( false ); + record.setDisplayAsPercentage( false ); + record.setShadow( false ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestCategorySeriesAxisRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestCategorySeriesAxisRecord.java new file mode 100644 index 0000000000..948241dbb7 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestCategorySeriesAxisRecord.java @@ -0,0 +1,71 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the CategorySeriesAxisRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestCategorySeriesAxisRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x01,(byte)0x00, // crossing point + (byte)0x01,(byte)0x00, // label frequency + (byte)0x01,(byte)0x00, // tick mark frequency + (byte)0x01,(byte)0x00 // options + }; + + public void testLoad() { + + CategorySeriesAxisRecord record = new CategorySeriesAxisRecord(TestcaseRecordInputStream.create(0x1020, data)); + assertEquals( 1, record.getCrossingPoint()); + assertEquals( 1, record.getLabelFrequency()); + assertEquals( 1, record.getTickMarkFrequency()); + assertEquals( 1, record.getOptions()); + assertEquals( true, record.isValueAxisCrossing() ); + assertEquals( false, record.isCrossesFarRight() ); + assertEquals( false, record.isReversed() ); + + assertEquals( 4 + 8, record.getRecordSize() ); + } + + public void testStore() + { + CategorySeriesAxisRecord record = new CategorySeriesAxisRecord(); + record.setCrossingPoint( (short)1 ); + record.setLabelFrequency( (short)1 ); + record.setTickMarkFrequency( (short)1 ); + record.setValueAxisCrossing( true ); + record.setCrossesFarRight( false ); + record.setReversed( false ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestChartRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestChartRecord.java new file mode 100644 index 0000000000..c423d1b9a2 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestChartRecord.java @@ -0,0 +1,66 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the ChartRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestChartRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, + (byte)0xE8,(byte)0xFF,(byte)0xD0,(byte)0x01, + (byte)0xC8,(byte)0xCC,(byte)0xE5,(byte)0x00 + }; + + public void testLoad() { + + ChartRecord record = new ChartRecord(TestcaseRecordInputStream.create(0x1002, data)); + assertEquals( 0, record.getX()); + assertEquals( 0, record.getY()); + assertEquals( 30474216, record.getWidth()); + assertEquals( 15060168, record.getHeight()); + + assertEquals( 20, record.getRecordSize() ); + } + + public void testStore() + { + ChartRecord record = new ChartRecord(); + record.setX( 0 ); + record.setY( 0 ); + record.setWidth( 30474216 ); + record.setHeight( 15060168 ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestChartTitleFormatRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestChartTitleFormatRecord.java new file mode 100644 index 0000000000..c31a3968c3 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestChartTitleFormatRecord.java @@ -0,0 +1,79 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +import junit.framework.TestCase; + +import org.apache.poi.hssf.HSSFTestDataSamples; +import org.apache.poi.hssf.eventusermodel.HSSFEventFactory; +import org.apache.poi.hssf.eventusermodel.HSSFListener; +import org.apache.poi.hssf.eventusermodel.HSSFRequest; +import org.apache.poi.hssf.record.Record; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.poifs.filesystem.POIFSFileSystem; +/** + * + */ +public final class TestChartTitleFormatRecord extends TestCase { + + public void testRecord() throws Exception { + POIFSFileSystem fs = new POIFSFileSystem( + HSSFTestDataSamples.openSampleFileStream("WithFormattedGraphTitle.xls")); + + // Check we can open the file via usermodel + HSSFWorkbook hssf = new HSSFWorkbook(fs); + + // Now process it through eventusermodel, and + // look out for the title records + ChartTitleFormatRecordGrabber grabber = new ChartTitleFormatRecordGrabber(); + InputStream din = fs.createDocumentInputStream("Workbook"); + HSSFRequest req = new HSSFRequest(); + req.addListenerForAllRecords(grabber); + HSSFEventFactory factory = new HSSFEventFactory(); + factory.processEvents(req, din); + din.close(); + + // Should've found one + assertEquals(1, grabber.chartTitleFormatRecords.size()); + // And it should be of something interesting + ChartTitleFormatRecord r = + (ChartTitleFormatRecord)grabber.chartTitleFormatRecords.get(0); + assertEquals(3, r.getFormatCount()); + } + + private static final class ChartTitleFormatRecordGrabber implements HSSFListener { + private final List chartTitleFormatRecords; + + public ChartTitleFormatRecordGrabber() { + chartTitleFormatRecords = new ArrayList(); + } + + public void processRecord(Record record) { + if(record instanceof ChartTitleFormatRecord) { + chartTitleFormatRecords.add( + record + ); + } + } + + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestDatRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestDatRecord.java new file mode 100644 index 0000000000..93b25ed95b --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestDatRecord.java @@ -0,0 +1,64 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the DatRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestDatRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x0D,(byte)0x00 // options + }; + + public void testLoad() { + + DatRecord record = new DatRecord(TestcaseRecordInputStream.create(0x1063, data)); + assertEquals( 0xD, record.getOptions()); + assertEquals( true, record.isHorizontalBorder() ); + assertEquals( false, record.isVerticalBorder() ); + assertEquals( true, record.isBorder() ); + assertEquals( true, record.isShowSeriesKey() ); + + assertEquals( 6, record.getRecordSize() ); + } + + public void testStore() + { + DatRecord record = new DatRecord(); + record.setHorizontalBorder( true ); + record.setVerticalBorder( false ); + record.setBorder( true ); + record.setShowSeriesKey( true ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestDataFormatRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestDataFormatRecord.java new file mode 100644 index 0000000000..c9958f5074 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestDataFormatRecord.java @@ -0,0 +1,68 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the DataFormatRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestDataFormatRecord extends TestCase { + byte[] data = new byte[] { + (byte)0xFF,(byte)0xFF, // point number + (byte)0x00,(byte)0x00, // series index + (byte)0x00,(byte)0x00, // series number + (byte)0x00,(byte)0x00 // format flags + }; + + public void testLoad() { + + DataFormatRecord record = new DataFormatRecord(TestcaseRecordInputStream.create(0x1006, data)); + assertEquals( (short)0xFFFF, record.getPointNumber()); + assertEquals( 0, record.getSeriesIndex()); + assertEquals( 0, record.getSeriesNumber()); + assertEquals( 0, record.getFormatFlags()); + assertEquals( false, record.isUseExcel4Colors() ); + + assertEquals( 12, record.getRecordSize() ); + } + + public void testStore() + { + DataFormatRecord record = new DataFormatRecord(); + record.setPointNumber( (short)0xFFFF ); + record.setSeriesIndex( (short)0 ); + record.setSeriesNumber( (short)0 ); + record.setFormatFlags( (short)0 ); + record.setUseExcel4Colors( false ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestDefaultDataLabelTextPropertiesRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestDefaultDataLabelTextPropertiesRecord.java new file mode 100644 index 0000000000..32bddd81a1 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestDefaultDataLabelTextPropertiesRecord.java @@ -0,0 +1,57 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the DefaultDataLabelTextPropertiesRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestDefaultDataLabelTextPropertiesRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x02,(byte)0x00 + }; + + public void testLoad() { + + DefaultDataLabelTextPropertiesRecord record = new DefaultDataLabelTextPropertiesRecord(TestcaseRecordInputStream.create(0x1024, data)); + assertEquals( 2, record.getCategoryDataType()); + + assertEquals( 6, record.getRecordSize() ); + } + + public void testStore() + { + DefaultDataLabelTextPropertiesRecord record = new DefaultDataLabelTextPropertiesRecord(); + record.setCategoryDataType( (short)2 ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestFontBasisRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestFontBasisRecord.java new file mode 100644 index 0000000000..c783a34e6f --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestFontBasisRecord.java @@ -0,0 +1,68 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the FontBasisRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestFontBasisRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x28,(byte)0x1A, // x basis + (byte)0x9C,(byte)0x0F, // y basis + (byte)0xC8,(byte)0x00, // height basis + (byte)0x00,(byte)0x00, // scale + (byte)0x05,(byte)0x00 // index to font table + }; + + public void testLoad() { + + FontBasisRecord record = new FontBasisRecord(TestcaseRecordInputStream.create(0x1060, data)); + assertEquals( 0x1a28, record.getXBasis()); + assertEquals( 0x0f9c, record.getYBasis()); + assertEquals( 0xc8, record.getHeightBasis()); + assertEquals( 0x00, record.getScale()); + assertEquals( 0x05, record.getIndexToFontTable()); + + assertEquals( 14, record.getRecordSize() ); + } + + public void testStore() + { + FontBasisRecord record = new FontBasisRecord(); + record.setXBasis( (short)0x1a28 ); + record.setYBasis( (short)0x0f9c ); + record.setHeightBasis( (short)0xc8 ); + record.setScale( (short)0x00 ); + record.setIndexToFontTable( (short)0x05 ); + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestFontIndexRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestFontIndexRecord.java new file mode 100644 index 0000000000..fb09d30dc6 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestFontIndexRecord.java @@ -0,0 +1,57 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the FontIndexRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestFontIndexRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x05,(byte)0x00 + }; + + public void testLoad() { + + FontIndexRecord record = new FontIndexRecord(TestcaseRecordInputStream.create(0x1026, data)); + assertEquals( 5, record.getFontIndex()); + + assertEquals( 6, record.getRecordSize() ); + } + + public void testStore() + { + FontIndexRecord record = new FontIndexRecord(); + record.setFontIndex( (short)5 ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestFrameRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestFrameRecord.java new file mode 100644 index 0000000000..da2a8a3189 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestFrameRecord.java @@ -0,0 +1,64 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the FrameRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestFrameRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x00,(byte)0x00, // border type + (byte)0x02,(byte)0x00 // options + }; + + public void testLoad() { + + FrameRecord record = new FrameRecord(TestcaseRecordInputStream.create(0x1032, data)); + assertEquals( FrameRecord.BORDER_TYPE_REGULAR, record.getBorderType()); + assertEquals( 2, record.getOptions()); + assertEquals( false, record.isAutoSize() ); + assertEquals( true, record.isAutoPosition() ); + + assertEquals( 8, record.getRecordSize() ); + } + + public void testStore() + { + FrameRecord record = new FrameRecord(); + record.setBorderType( FrameRecord.BORDER_TYPE_REGULAR ); + record.setOptions( (short)2 ); + record.setAutoSize( false ); + record.setAutoPosition( true ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestLegendRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestLegendRecord.java new file mode 100644 index 0000000000..a23d6741b6 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestLegendRecord.java @@ -0,0 +1,91 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the LegendRecord class works + * correctly. Test data taken directly from a real Excel file. + * + * + * @author Andrew C. Oliver (acoliver at apache.org) + */ +public final class TestLegendRecord extends TestCase { + byte[] data = new byte[] { (byte) 0x76, (byte) 0x0E, (byte) 0x00, (byte) 0x00, (byte) 0x86, + (byte) 0x07, (byte) 0x00, (byte) 0x00, (byte) 0x19, (byte) 0x01, (byte) 0x00, + (byte) 0x00, (byte) 0x8B, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x03, + (byte) 0x01, (byte) 0x1F, (byte) 0x00 }; + + public void testLoad() { + LegendRecord record = new LegendRecord(TestcaseRecordInputStream.create(0x1015, data)); + + assertEquals(0xe76, record.getXAxisUpperLeft()); + + assertEquals(0x786, record.getYAxisUpperLeft()); + + assertEquals(0x119, record.getXSize()); + + assertEquals(0x8b, record.getYSize()); + + assertEquals((byte) 0x3, record.getType()); + + assertEquals((byte) 0x1, record.getSpacing()); + + assertEquals((short) 0x1f, record.getOptions()); + assertEquals(true, record.isAutoPosition()); + assertEquals(true, record.isAutoSeries()); + assertEquals(true, record.isAutoXPositioning()); + assertEquals(true, record.isAutoYPositioning()); + assertEquals(true, record.isVertical()); + assertEquals(false, record.isDataTable()); + + assertEquals(24, record.getRecordSize()); + } + + public void testStore() { + LegendRecord record = new LegendRecord(); + + record.setXAxisUpperLeft(0xe76); + + record.setYAxisUpperLeft(0x786); + + record.setXSize(0x119); + + record.setYSize(0x8b); + + record.setType((byte) 0x3); + + record.setSpacing((byte) 0x1); + + record.setOptions((short) 0x1f); + record.setAutoPosition(true); + record.setAutoSeries(true); + record.setAutoXPositioning(true); + record.setAutoYPositioning(true); + record.setVertical(true); + record.setDataTable(false); + + byte[] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i + 4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestLineFormatRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestLineFormatRecord.java new file mode 100644 index 0000000000..5b58b22561 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestLineFormatRecord.java @@ -0,0 +1,71 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the LineFormatRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestLineFormatRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // colour + (byte)0x00,(byte)0x00, // pattern + (byte)0x00,(byte)0x00, // weight + (byte)0x01,(byte)0x00, // format + (byte)0x4D,(byte)0x00 // index + }; + + public void testLoad() { + LineFormatRecord record = new LineFormatRecord(TestcaseRecordInputStream.create(0x1007, data)); + assertEquals( 0, record.getLineColor()); + assertEquals( 0, record.getLinePattern()); + assertEquals( 0, record.getWeight()); + assertEquals( 1, record.getFormat()); + assertEquals( true, record.isAuto() ); + assertEquals( false, record.isDrawTicks() ); + assertEquals( 0x4d, record.getColourPaletteIndex()); + + assertEquals( 16, record.getRecordSize() ); + } + + public void testStore() + { + LineFormatRecord record = new LineFormatRecord(); + record.setLineColor( 0 ); + record.setLinePattern( (short)0 ); + record.setWeight( (short)0 ); + record.setAuto( true ); + record.setDrawTicks( false ); + record.setColourPaletteIndex( (short)0x4d ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestLinkedDataRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestLinkedDataRecord.java new file mode 100644 index 0000000000..d9f09eab7c --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestLinkedDataRecord.java @@ -0,0 +1,193 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import junit.framework.TestCase; + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; +import org.apache.poi.hssf.record.formula.Area3DPtg; +import org.apache.poi.hssf.record.formula.Ptg; + +/** + * Tests the serialization and deserialization of the LinkedDataRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestLinkedDataRecord extends TestCase { + +/* + The records below are records that would appear in a simple bar chart + + The first record links to the series title (linkType = 0). It's + reference type is 1 which means that it links directly to data entered + into the forumula bar. There seems to be no reference to any data + however. The formulaOfLink field contains two 0 bytes. This probably + means that there is no particular heading set. + + +============================================ +Offset 0xf9c (3996) +rectype = 0x1051, recsize = 0x8 +-BEGIN DUMP--------------------------------- +00000000 00 01 00 00 00 00 00 00 ........ +-END DUMP----------------------------------- +recordid = 0x1051, size =8 +[AI] +.linkType = 0x00 (0 ) +.referenceType = 0x01 (1 ) +.options = 0x0000 (0 ) + .customNumberFormat = false +.indexNumberFmtRecord = 0x0000 (0 ) +.formulaOfLink = (org.apache.poi.hssf.record.LinkedDataFormulaField@95fd19 ) +[/AI] + + + The second record links to the series data (linkType=1). The + referenceType = 2 which means it's linked to the worksheet. + It links using a formula. The formula value is + 0B 00 3B 00 00 00 00 1E 00 01 00 01 00. + + 0B 00 11 bytes length + 3B (tArea3d) Rectangular area + 00 00 index to REF entry in extern sheet + 00 00 index to first row + 1E 00 index to last row + 01 00 index to first column and relative flags + 01 00 index to last column and relative flags + +============================================ +Offset 0xfa8 (4008) +rectype = 0x1051, recsize = 0x13 +-BEGIN DUMP--------------------------------- +00000000 01 02 00 00 00 00 0B 00 3B 00 00 00 00 1E 00 01 ........;....... +00000010 00 01 00 ... +-END DUMP----------------------------------- +recordid = 0x1051, size =19 +[AI] +.linkType = 0x01 (1 ) +.referenceType = 0x02 (2 ) +.options = 0x0000 (0 ) + .customNumberFormat = false +.indexNumberFmtRecord = 0x0000 (0 ) +.formulaOfLink = (org.apache.poi.hssf.record.LinkedDataFormulaField@11b9fb1 ) +[/AI] + + The third record links to the series categories (linkType=2). The + reference type of 2 means that it's linked to the worksheet. + It links using a formula. The formula value is + 0B 00 3B 00 00 00 00 1E 00 01 00 01 00 + + 0B 00 11 bytes in length + 3B (tArea3d) Rectangular area + 00 00 index to REF entry in extern sheet + 00 00 index to first row + 00 1F index to last row + 00 00 index to first column and relative flags + 00 00 index to last column and relative flags + + +============================================ +Offset 0xfbf (4031) +rectype = 0x1051, recsize = 0x13 +-BEGIN DUMP--------------------------------- +00000000 02 02 00 00 69 01 0B 00 3B 00 00 00 00 1F 00 00 ....i...;....... +00000010 00 00 00 ... +-END DUMP----------------------------------- +recordid = 0x1051, size =19 +[AI] +.linkType = 0x02 (2 ) +.referenceType = 0x02 (2 ) +.options = 0x0000 (0 ) + .customNumberFormat = false +.indexNumberFmtRecord = 0x0169 (361 ) +.formulaOfLink = (org.apache.poi.hssf.record.LinkedDataFormulaField@913fe2 ) +[/AI] + +This third link type does not seem to be documented and does not appear to +contain any useful information anyway. + +============================================ +Offset 0xfd6 (4054) +rectype = 0x1051, recsize = 0x8 +-BEGIN DUMP--------------------------------- +00000000 03 01 00 00 00 00 00 00 ........ +-END DUMP----------------------------------- +recordid = 0x1051, size =8 +[AI] +.linkType = 0x03 (3 ) +.referenceType = 0x01 (1 ) +.options = 0x0000 (0 ) + .customNumberFormat = false +.indexNumberFmtRecord = 0x0000 (0 ) +.formulaOfLink = (org.apache.poi.hssf.record.LinkedDataFormulaField@1f934ad ) +[/AI] + +*/ + + byte[] data = new byte[]{ + (byte)0x01, // link type + (byte)0x02, // reference type + (byte)0x00,(byte)0x00, // options + (byte)0x00,(byte)0x00, // index number format record + (byte)0x0B,(byte)0x00, // 11 bytes length + (byte)0x3B, // formula of link + (byte)0x00,(byte)0x00, // index to ref entry in extern sheet + (byte)0x00,(byte)0x00, // index to first row + (byte)0x00,(byte)0x1F, // index to last row + (byte)0x00,(byte)0x00, // index to first column and relative flags + (byte)0x00,(byte)0x00, // index to last column and relative flags + }; + + public void testLoad() { + + LinkedDataRecord record = new LinkedDataRecord(TestcaseRecordInputStream.create(0x1051, data)); + assertEquals( LinkedDataRecord.LINK_TYPE_VALUES, record.getLinkType()); + assertEquals( LinkedDataRecord.REFERENCE_TYPE_WORKSHEET, record.getReferenceType()); + assertEquals( 0, record.getOptions()); + assertEquals( false, record.isCustomNumberFormat() ); + assertEquals( 0, record.getIndexNumberFmtRecord()); + + Area3DPtg ptgExpected = new Area3DPtg(0, 7936, 0, 0, + false, false, false, false, 0); + + Ptg ptgActual = record.getFormulaOfLink()[0]; + assertEquals(ptgExpected.toString(), ptgActual.toString()); + + assertEquals( data.length + 4, record.getRecordSize() ); + } + + public void testStore() { + LinkedDataRecord record = new LinkedDataRecord(); + record.setLinkType( LinkedDataRecord.LINK_TYPE_VALUES ); + record.setReferenceType( LinkedDataRecord.REFERENCE_TYPE_WORKSHEET ); + record.setOptions( (short)0 ); + record.setCustomNumberFormat( false ); + record.setIndexNumberFmtRecord( (short)0 ); + Area3DPtg ptg = new Area3DPtg(0, 7936, 0, 0, + false, false, false, false, 0); + record.setFormulaOfLink(new Ptg[] { ptg, } ); + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestNumberFormatIndexRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestNumberFormatIndexRecord.java new file mode 100644 index 0000000000..d06f646c58 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestNumberFormatIndexRecord.java @@ -0,0 +1,57 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the NumberFormatIndexRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestNumberFormatIndexRecord extends TestCase { + byte[] data = new byte[] { + 0x05,0x00 + }; + + public void testLoad() { + + NumberFormatIndexRecord record = new NumberFormatIndexRecord(TestcaseRecordInputStream.create(0x104e, data)); + assertEquals( 5, record.getFormatIndex()); + + assertEquals( 6, record.getRecordSize() ); + } + + public void testStore() + { + NumberFormatIndexRecord record = new NumberFormatIndexRecord(); + record.setFormatIndex( (short)5 ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestObjectLinkRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestObjectLinkRecord.java new file mode 100644 index 0000000000..f12babe136 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestObjectLinkRecord.java @@ -0,0 +1,61 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the ObjectLinkRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Andrew C. Oliver (acoliver at apache.org) + */ +public final class TestObjectLinkRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x03,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00 + }; + + public void testLoad() { + ObjectLinkRecord record = new ObjectLinkRecord(TestcaseRecordInputStream.create(0x1027, data)); + + assertEquals( (short)3, record.getAnchorId()); + assertEquals( (short)0x00, record.getLink1()); + assertEquals( (short)0x00, record.getLink2()); + + assertEquals( 10, record.getRecordSize() ); + } + + public void testStore() { + ObjectLinkRecord record = new ObjectLinkRecord(); + + record.setAnchorId( (short)3 ); + record.setLink1( (short)0x00 ); + record.setLink2( (short)0x00 ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestPlotAreaRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestPlotAreaRecord.java new file mode 100644 index 0000000000..bfd678b305 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestPlotAreaRecord.java @@ -0,0 +1,52 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the PlotAreaRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Andrew C. Oliver (acoliver at apache.org) + */ +public final class TestPlotAreaRecord extends TestCase { + byte[] data = new byte[] { + + }; + + public void testLoad() { + PlotAreaRecord record = new PlotAreaRecord(TestcaseRecordInputStream.create(0x1035, data)); + + assertEquals( 4, record.getRecordSize() ); + } + + public void testStore() { + PlotAreaRecord record = new PlotAreaRecord(); + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestPlotGrowthRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestPlotGrowthRecord.java new file mode 100644 index 0000000000..cb7de70b0e --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestPlotGrowthRecord.java @@ -0,0 +1,59 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the PlotGrowthRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestPlotGrowthRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00, // horizontal + (byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00 // vertical + }; + + public void testLoad() { + + PlotGrowthRecord record = new PlotGrowthRecord(TestcaseRecordInputStream.create(0x1064, data)); + assertEquals( 65536, record.getHorizontalScale()); + assertEquals( 65536, record.getVerticalScale()); + + assertEquals( 12, record.getRecordSize() ); + } + + public void testStore() + { + PlotGrowthRecord record = new PlotGrowthRecord(); + record.setHorizontalScale( 65536 ); + record.setVerticalScale( 65536 ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesChartGroupIndexRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesChartGroupIndexRecord.java new file mode 100644 index 0000000000..d216cc2f2c --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesChartGroupIndexRecord.java @@ -0,0 +1,55 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the SeriesChartGroupIndexRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestSeriesChartGroupIndexRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x00,(byte)0x00 + }; + + public void testLoad() { + SeriesChartGroupIndexRecord record = new SeriesChartGroupIndexRecord(TestcaseRecordInputStream.create(0x1045, data)); + assertEquals( 0, record.getChartGroupIndex()); + + assertEquals( 6, record.getRecordSize() ); + } + + public void testStore() + { + SeriesChartGroupIndexRecord record = new SeriesChartGroupIndexRecord(); + record.setChartGroupIndex( (short)0 ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesIndexRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesIndexRecord.java new file mode 100644 index 0000000000..86f24a38bc --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesIndexRecord.java @@ -0,0 +1,59 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the SeriesIndexRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Andrew C. Oliver (acoliver at apache.org) + */ +public final class TestSeriesIndexRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x03,(byte)0x00 + }; + + public void testLoad() { + SeriesIndexRecord record = new SeriesIndexRecord(TestcaseRecordInputStream.create(0x1065, data)); + + assertEquals( (short)3, record.getIndex()); + assertEquals( 6, record.getRecordSize() ); + } + + public void testStore() + { + SeriesIndexRecord record = new SeriesIndexRecord(); + + + + record.setIndex( (short)3 ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesLabelsRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesLabelsRecord.java new file mode 100644 index 0000000000..9f0f1f1ead --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesLabelsRecord.java @@ -0,0 +1,68 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the SeriesLabelsRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestSeriesLabelsRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x03,(byte)0x00 + }; + + public void testLoad() { + SeriesLabelsRecord record = new SeriesLabelsRecord(TestcaseRecordInputStream.create(0x100c, data)); + assertEquals( 3, record.getFormatFlags()); + assertEquals( true, record.isShowActual() ); + assertEquals( true, record.isShowPercent() ); + assertEquals( false, record.isLabelAsPercentage() ); + assertEquals( false, record.isSmoothedLine() ); + assertEquals( false, record.isShowLabel() ); + assertEquals( false, record.isShowBubbleSizes() ); + + + assertEquals( 2+4, record.getRecordSize() ); + } + + public void testStore() + { + SeriesLabelsRecord record = new SeriesLabelsRecord(); + record.setShowActual( true ); + record.setShowPercent( true ); + record.setLabelAsPercentage( false ); + record.setSmoothedLine( false ); + record.setShowLabel( false ); + record.setShowBubbleSizes( false ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesListRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesListRecord.java new file mode 100644 index 0000000000..c049de4f30 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesListRecord.java @@ -0,0 +1,56 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the SeriesListRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestSeriesListRecord extends TestCase { + private static final byte[] data = { + (byte)0x02,(byte)0x00,(byte)0x01,(byte)0x20,(byte)0xff,(byte)0xf0 + }; + + public void testLoad() { + + SeriesListRecord record = new SeriesListRecord(TestcaseRecordInputStream.create(0x1016, data)); + assertEquals( (short)0x2001, record.getSeriesNumbers()[0]); + assertEquals( (short)0xf0ff, record.getSeriesNumbers()[1]); + assertEquals( 2, record.getSeriesNumbers().length); + + assertEquals( 4 + 6, record.getRecordSize() ); + } + + public void testStore() { + SeriesListRecord record = new SeriesListRecord(new short[] { (short)0x2001, (short)0xf0ff } ); + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesRecord.java new file mode 100644 index 0000000000..dacaae10d1 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesRecord.java @@ -0,0 +1,71 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the SeriesRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestSeriesRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x01,(byte)0x00, // category data type + (byte)0x01,(byte)0x00, // values data type + (byte)0x1B,(byte)0x00, // num categories + (byte)0x1B,(byte)0x00, // num values + (byte)0x01,(byte)0x00, // bubble series type + (byte)0x00,(byte)0x00 // num bubble values + }; + + public void testLoad() { + + SeriesRecord record = new SeriesRecord(TestcaseRecordInputStream.create(0x1003, data)); + assertEquals( SeriesRecord.CATEGORY_DATA_TYPE_NUMERIC, record.getCategoryDataType()); + assertEquals( SeriesRecord.VALUES_DATA_TYPE_NUMERIC, record.getValuesDataType()); + assertEquals( 27, record.getNumCategories()); + assertEquals( 27, record.getNumValues()); + assertEquals( SeriesRecord.BUBBLE_SERIES_TYPE_NUMERIC, record.getBubbleSeriesType()); + assertEquals( 0, record.getNumBubbleValues()); + + + assertEquals( 16, record.getRecordSize() ); + } + + public void testStore() + { + SeriesRecord record = new SeriesRecord(); + record.setCategoryDataType( SeriesRecord.CATEGORY_DATA_TYPE_NUMERIC ); + record.setValuesDataType( SeriesRecord.VALUES_DATA_TYPE_NUMERIC ); + record.setNumCategories( (short)27 ); + record.setNumValues( (short)27 ); + record.setBubbleSeriesType( SeriesRecord.BUBBLE_SERIES_TYPE_NUMERIC ); + record.setNumBubbleValues( (short)0 ); + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesTextRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesTextRecord.java new file mode 100644 index 0000000000..2d11999be8 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesTextRecord.java @@ -0,0 +1,108 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + +import junit.framework.AssertionFailedError; +import junit.framework.TestCase; + +import org.apache.poi.hssf.record.RecordFormatException; +import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.hssf.record.TestcaseRecordInputStream; +import org.apache.poi.util.HexRead; + +/** + * Tests the serialization and deserialization of the SeriesTextRecord class + * works correctly. Test data taken directly from a real Excel file. + * + * + * @author Andrew C. Oliver (acoliver at apache.org) + */ +public final class TestSeriesTextRecord extends TestCase { + private static final byte[] SIMPLE_DATA = HexRead + .readFromString("00 00 0C 00 56 61 6C 75 65 20 4E 75 6D 62 65 72"); + + public void testLoad() { + SeriesTextRecord record = new SeriesTextRecord(TestcaseRecordInputStream.create(0x100d, SIMPLE_DATA)); + + assertEquals((short) 0, record.getId()); + assertEquals("Value Number", record.getText()); + + assertEquals(SIMPLE_DATA.length + 4, record.getRecordSize()); + } + + public void testStore() { + SeriesTextRecord record = new SeriesTextRecord(); + + record.setId(0); + record.setText("Value Number"); + + byte[] recordBytes = record.serialize(); + TestcaseRecordInputStream.confirmRecordEncoding(SeriesTextRecord.sid, SIMPLE_DATA, + recordBytes); + } + + public void testReserializeLongTitle() { + // Hex dump from bug 45784 attachment 22560 streamOffset=0x0CD1 + byte[] data = HexRead.readFromString( + "00 00, " + + "82 " + + "01 " + + "50 00 6C 00 61 00 73 00 6D 00 61 00 20 00 4C 00 " + + "65 00 76 00 65 00 6C 00 73 00 20 00 6F 00 66 00 " + + "20 00 4C 00 2D 00 30 00 30 00 30 00 31 00 31 00 " + + "31 00 32 00 32 00 32 00 2D 00 33 00 33 00 33 00 " + + "58 00 34 00 34 00 34 00 20 00 69 00 6E 00 20 00 " + + "53 00 44 00 20 00 72 00 61 00 74 00 0A 00 50 00 " + + "4F 00 20 00 33 00 2E 00 30 00 20 00 6D 00 67 00 " + + "2F 00 6B 00 67 00 20 00 28 00 35 00 2E 00 30 00 " + + "20 00 6D 00 4C 00 2F 00 6B 00 67 00 29 00 20 00 " + + "69 00 6E 00 20 00 4D 00 65 00 74 00 68 00 6F 00 " + + "63 00 65 00 6C 00 0A 00 49 00 56 00 20 00 30 00 " + + "2E 00 35 00 20 00 6D 00 67 00 2F 00 6B 00 67 00 " + + "20 00 28 00 31 00 2E 00 30 00 20 00 6D 00 4C 00 " + + "2F 00 6B 00 67 00 29 00 20 00 69 00 6E 00 20 00 " + + "36 00 30 00 25 00 20 00 50 00 45 00 47 00 20 00 " + + "32 00 30 00 30 00 0A 00 46 00 20 00 3D 00 61 00 " + + "62 00 63 00"); + + RecordInputStream in = TestcaseRecordInputStream.create(SeriesTextRecord.sid, data); + SeriesTextRecord str; + try { + str = new SeriesTextRecord(in); + } catch (RecordFormatException e) { + if (e.getCause() instanceof IllegalArgumentException) { + // 'would be' error msg changed at svn r703620 + // "Illegal length - asked for -126 but only 130 left!" + // "Bad requested string length (-126)" + throw new AssertionFailedError("Identified bug 45784a"); + } + throw e; + } + + if (str.getRecordSize() < 0) { + throw new AssertionFailedError("Identified bug 45784b"); + } + byte[] ser; + try { + ser = str.serialize(); + } catch (Exception e) { + throw new RuntimeException(e); + } + TestcaseRecordInputStream.confirmRecordEncoding(SeriesTextRecord.sid, data, ser); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesToChartGroupRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesToChartGroupRecord.java new file mode 100644 index 0000000000..22ad685c2b --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesToChartGroupRecord.java @@ -0,0 +1,56 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the SeriesToChartGroupRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Andrew C. Oliver (acoliver at apache.org) + */ +public final class TestSeriesToChartGroupRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x0, (byte)0x0 + }; + + public void testLoad() { + SeriesToChartGroupRecord record = new SeriesToChartGroupRecord(TestcaseRecordInputStream.create(0x1045, data)); + assertEquals( 0x0, record.getChartGroupIndex()); + + assertEquals( 0x6, record.getRecordSize() ); + } + + public void testStore() + { + SeriesToChartGroupRecord record = new SeriesToChartGroupRecord(); + record.setChartGroupIndex( (short)0x0 ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestSheetPropertiesRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestSheetPropertiesRecord.java new file mode 100644 index 0000000000..51794029ef --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestSheetPropertiesRecord.java @@ -0,0 +1,70 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the SheetPropertiesRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestSheetPropertiesRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x0A,(byte)0x00, + (byte)0x00 + //,(byte)0x00 // not sure where that last byte comes from + }; + + public void testLoad() { + SheetPropertiesRecord record = new SheetPropertiesRecord(TestcaseRecordInputStream.create(0x1044, data)); + assertEquals( 10, record.getFlags()); + assertEquals( false, record.isChartTypeManuallyFormatted() ); + assertEquals( true, record.isPlotVisibleOnly() ); + assertEquals( false, record.isDoNotSizeWithWindow() ); + assertEquals( true, record.isDefaultPlotDimensions() ); + assertEquals( false, record.isAutoPlotArea() ); + assertEquals( 0, record.getEmpty()); + + + assertEquals( 7, record.getRecordSize() ); + } + + public void testStore() + { + SheetPropertiesRecord record = new SheetPropertiesRecord(); + record.setChartTypeManuallyFormatted( false ); + record.setPlotVisibleOnly( true ); + record.setDoNotSizeWithWindow( false ); + record.setDefaultPlotDimensions( true ); + record.setAutoPlotArea( false ); + record.setEmpty( (byte)0 ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestTextRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestTextRecord.java new file mode 100644 index 0000000000..4214b0a370 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestTextRecord.java @@ -0,0 +1,117 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the TextRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestTextRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x02, // horiz align + (byte)0x02, // vert align + (byte)0x01,(byte)0x00, // display mode + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // rgb color + (byte)0xD6,(byte)0xFF,(byte)0xFF,(byte)0xFF, // x + (byte)0xC4,(byte)0xFF,(byte)0xFF,(byte)0xFF, // y + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // width + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // height + (byte)0xB1,(byte)0x00, // options 1 + (byte)0x4D,(byte)0x00, // index of color value + (byte)0x50,(byte)0x2B, // options 2 -- strange upper bits supposed to be 0'd + (byte)0x00,(byte)0x00 // text rotation + }; + + public void testLoad() { + + TextRecord record = new TextRecord(TestcaseRecordInputStream.create(0x1025, data)); + assertEquals( TextRecord.HORIZONTAL_ALIGNMENT_CENTER, record.getHorizontalAlignment()); + assertEquals( TextRecord.VERTICAL_ALIGNMENT_CENTER, record.getVerticalAlignment()); + assertEquals( TextRecord.DISPLAY_MODE_TRANSPARENT, record.getDisplayMode()); + assertEquals( 0, record.getRgbColor()); + assertEquals( -42, record.getX()); + assertEquals( -60, record.getY()); + assertEquals( 0, record.getWidth()); + assertEquals( 0, record.getHeight()); + assertEquals( 177, record.getOptions1()); + assertEquals( true, record.isAutoColor() ); + assertEquals( false, record.isShowKey() ); + assertEquals( false, record.isShowValue() ); + assertEquals( false, record.isVertical() ); + assertEquals( true, record.isAutoGeneratedText() ); + assertEquals( true, record.isGenerated() ); + assertEquals( false, record.isAutoLabelDeleted() ); + assertEquals( true, record.isAutoBackground() ); + assertEquals( TextRecord.ROTATION_NONE, record.getRotation() ); + assertEquals( false, record.isShowCategoryLabelAsPercentage() ); + assertEquals( false, record.isShowValueAsPercentage() ); + assertEquals( false, record.isShowBubbleSizes() ); + assertEquals( false, record.isShowLabel() ); + assertEquals( 77, record.getIndexOfColorValue()); + assertEquals( 11088, record.getOptions2()); + assertEquals( 0, record.getDataLabelPlacement() ); + assertEquals( 0, record.getTextRotation()); + + + assertEquals( 36, record.getRecordSize() ); + } + + public void testStore() + { + TextRecord record = new TextRecord(); + record.setHorizontalAlignment( TextRecord.HORIZONTAL_ALIGNMENT_CENTER ); + record.setVerticalAlignment( TextRecord.VERTICAL_ALIGNMENT_CENTER ); + record.setDisplayMode( TextRecord.DISPLAY_MODE_TRANSPARENT ); + record.setRgbColor( 0 ); + record.setX( -42 ); + record.setY( -60 ); + record.setWidth( 0 ); + record.setHeight( 0 ); + record.setAutoColor( true ); + record.setShowKey( false ); + record.setShowValue( false ); + record.setVertical( false ); + record.setAutoGeneratedText( true ); + record.setGenerated( true ); + record.setAutoLabelDeleted( false ); + record.setAutoBackground( true ); + record.setRotation( TextRecord.ROTATION_NONE ); + record.setShowCategoryLabelAsPercentage( false ); + record.setShowValueAsPercentage( false ); + record.setShowBubbleSizes( false ); + record.setShowLabel( false ); + record.setIndexOfColorValue( (short)77 ); + record.setOptions2( (short)0x2b50 ); +// record.setDataLabelPlacement( (short)0x2b50 ); + record.setTextRotation( (short)0 ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestTickRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestTickRecord.java new file mode 100644 index 0000000000..0301e7e811 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestTickRecord.java @@ -0,0 +1,101 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the TickRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Andrew C. Oliver(acoliver at apache.org) + */ +public final class TestTickRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x02, (byte)0x00, (byte)0x03, (byte)0x01, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x23, (byte)0x00, + (byte)0x4D, (byte)0x00, (byte)0x00, (byte)0x00 + }; + + public void testLoad() { + TickRecord record = new TickRecord(TestcaseRecordInputStream.create(0x101e, data)); + assertEquals( (byte)2, record.getMajorTickType()); + assertEquals( (byte)0, record.getMinorTickType()); + assertEquals( (byte)3, record.getLabelPosition()); + assertEquals( (short)1, record.getBackground()); + assertEquals( 0, record.getLabelColorRgb()); + assertEquals( (short)0, record.getZero1()); + assertEquals( (short)0, record.getZero2()); + assertEquals( (short)35, record.getOptions()); + assertEquals( true, record.isAutoTextColor() ); + assertEquals( true, record.isAutoTextBackground() ); + assertEquals( (short)0x0, record.getRotation() ); + assertEquals( true, record.isAutorotate() ); + assertEquals( (short)77, record.getTickColor()); + assertEquals( (short)0x0, record.getZero3()); + + + assertEquals( 34, record.getRecordSize() ); + } + + public void testStore() + { + TickRecord record = new TickRecord(); + record.setMajorTickType( (byte)2 ); + record.setMinorTickType( (byte)0 ); + record.setLabelPosition( (byte)3 ); + record.setBackground( (byte)1 ); + record.setLabelColorRgb( 0 ); + record.setZero1( (short)0 ); + record.setZero2( (short)0 ); + record.setOptions( (short)35 ); + record.setAutoTextColor( true ); + record.setAutoTextBackground( true ); + record.setRotation( (short)0 ); + record.setAutorotate( true ); + record.setTickColor( (short)77 ); + record.setZero3( (short)0 ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } + + + /** + * The main program for the TestTickRecord class + * + *@param args The command line arguments + */ + public static void main(String[] args) { + System.out.println("Testing org.apache.poi.hssf.record.TickRecord"); + junit.textui.TestRunner.run(TestTickRecord.class); + } + +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestUnitsRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestUnitsRecord.java new file mode 100644 index 0000000000..4c142bdb05 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestUnitsRecord.java @@ -0,0 +1,57 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the UnitsRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestUnitsRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x00, (byte)0x00 + }; + + public void testLoad() { + + UnitsRecord record = new UnitsRecord(TestcaseRecordInputStream.create(0x1001, data)); + assertEquals( 0, record.getUnits()); + + assertEquals( 6, record.getRecordSize() ); + } + + public void testStore() + { + UnitsRecord record = new UnitsRecord(); + record.setUnits( (short)0 ); + + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +} diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestValueRangeRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestValueRangeRecord.java new file mode 100644 index 0000000000..d2a08df4a5 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/record/chart/TestValueRangeRecord.java @@ -0,0 +1,88 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.hssf.record.chart; + + +import org.apache.poi.hssf.record.TestcaseRecordInputStream; + +import junit.framework.TestCase; + +/** + * Tests the serialization and deserialization of the ValueRangeRecord + * class works correctly. Test data taken directly from a real + * Excel file. + * + * + * @author Glen Stampoultzis (glens at apache.org) + */ +public final class TestValueRangeRecord extends TestCase { + byte[] data = new byte[] { + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // min axis value + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // max axis value + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // major increment + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // minor increment + (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00, // cross over + (byte)0x1F,(byte)0x01 // options + }; + + public void testLoad() { + + ValueRangeRecord record = new ValueRangeRecord(TestcaseRecordInputStream.create(0x101f, data)); + assertEquals( 0.0, record.getMinimumAxisValue(), 0.001); + assertEquals( 0.0, record.getMaximumAxisValue(), 0.001); + assertEquals( 0.0, record.getMajorIncrement(), 0.001); + assertEquals( 0.0, record.getMinorIncrement(), 0.001); + assertEquals( 0.0, record.getCategoryAxisCross(), 0.001); + assertEquals( 0x011f, record.getOptions()); + assertEquals( true, record.isAutomaticMinimum() ); + assertEquals( true, record.isAutomaticMaximum() ); + assertEquals( true, record.isAutomaticMajor() ); + assertEquals( true, record.isAutomaticMinor() ); + assertEquals( true, record.isAutomaticCategoryCrossing() ); + assertEquals( false, record.isLogarithmicScale() ); + assertEquals( false, record.isValuesInReverse() ); + assertEquals( false, record.isCrossCategoryAxisAtMaximum() ); + assertEquals( true, record.isReserved() ); + + assertEquals( 42+4, record.getRecordSize() ); + } + + public void testStore() + { + ValueRangeRecord record = new ValueRangeRecord(); + record.setMinimumAxisValue( 0 ); + record.setMaximumAxisValue( 0 ); + record.setMajorIncrement( 0 ); + record.setMinorIncrement( 0 ); + record.setCategoryAxisCross( 0 ); + record.setAutomaticMinimum( true ); + record.setAutomaticMaximum( true ); + record.setAutomaticMajor( true ); + record.setAutomaticMinor( true ); + record.setAutomaticCategoryCrossing( true ); + record.setLogarithmicScale( false ); + record.setValuesInReverse( false ); + record.setCrossCategoryAxisAtMaximum( false ); + record.setReserved( true ); + + byte [] recordBytes = record.serialize(); + assertEquals(recordBytes.length - 4, data.length); + for (int i = 0; i < data.length; i++) + assertEquals("At offset " + i, data[i], recordBytes[i+4]); + } +}