PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352836 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew C. Oliver 2002-09-05 00:26:28 +00:00
parent 5e907911d8
commit 744ffde73d
101 changed files with 1000 additions and 2 deletions

View File

@ -80,6 +80,7 @@ import org.apache.poi.hssf.record
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Glen Stampoultzis (glens at apache.org)
* @author Shawn Laubach (laubach at acm.org) Just Gridlines, Headers, Footers, and PrintSetup
* @author Jason Height (jheight at chariot dot net dot au) Clone support
*
* @see org.apache.poi.hssf.model.Workbook
* @see org.apache.poi.hssf.usermodel.HSSFSheet
@ -271,6 +272,46 @@ public class Sheet
return retval;
}
/**
* Clones the low level records of this sheet and returns the new sheet instance.
*/
public Sheet cloneSheet()
{
ArrayList clonedRecords = new ArrayList(this.records.size());
for (int i=0; i<this.records.size();i++) {
Record rec = (Record)((Record)this.records.get(i)).clone();
//Need to pull out the Row record and the Value records from their
//Aggregates.
//This is probably the best way to do it since we probably dont want the createSheet
//To cater for these artificial Record types
if (rec instanceof RowRecordsAggregate) {
RowRecordsAggregate rrAgg = (RowRecordsAggregate)rec;
for (Iterator rowIter = rrAgg.getIterator();rowIter.hasNext();) {
Record rowRec = (Record)rowIter.next();
clonedRecords.add(rowRec);
}
} else if (rec instanceof ValueRecordsAggregate) {
ValueRecordsAggregate vrAgg = (ValueRecordsAggregate)rec;
for (Iterator cellIter = vrAgg.getIterator();cellIter.hasNext();) {
Record valRec = (Record)cellIter.next();
clonedRecords.add(valRec);
}
} else if (rec instanceof FormulaRecordAggregate) {
FormulaRecordAggregate fmAgg = (FormulaRecordAggregate)rec;
Record fmAggRec = fmAgg.getFormulaRecord();
if (fmAggRec != null)
clonedRecords.add(fmAggRec);
fmAggRec = fmAgg.getStringRecord();
if (fmAggRec != null)
clonedRecords.add(fmAggRec);
} else {
clonedRecords.add(rec);
}
}
return createSheet(clonedRecords, 0, 0);
}
/**
* read support (offset = 0) Same as createSheet(Record[] recs, int, int)
* only the record offset is assumed to be 0.

View File

@ -209,6 +209,19 @@ public class AreaFormatRecord
return this.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.

View File

@ -171,6 +171,14 @@ public class AreaRecord
return this.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.

View File

@ -169,6 +169,14 @@ public class AxisLineFormatRecord
return this.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.

View File

@ -245,6 +245,22 @@ public class AxisOptionsRecord
return this.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.

View File

@ -199,6 +199,18 @@ public class AxisParentRecord
return this.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.

View File

@ -200,6 +200,18 @@ public class AxisRecord
return this.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.

View File

@ -165,6 +165,14 @@ public class AxisUsedRecord
return this.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.

View File

@ -64,6 +64,7 @@ import org.apache.poi.util.LittleEndian;
* Used in sheets and workbooks.<P>
* REFERENCE: PG 289 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -358,4 +359,15 @@ public class BOFRecord
{
return this.sid;
}
public Object clone() {
BOFRecord rec = new BOFRecord();
rec.field_1_version = field_1_version;
rec.field_2_type = field_2_type;
rec.field_3_build = field_3_build;
rec.field_4_year = field_4_year;
rec.field_5_history = field_5_history;
rec.field_6_rversion = field_6_rversion;
return rec;
}
}

View File

@ -190,6 +190,16 @@ public class BarRecord
return this.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.

View File

@ -67,6 +67,7 @@ import org.apache.poi.util.LittleEndian;
* Description: Represents a column in a row with no value but with styling.<P>
* REFERENCE: PG 287 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -349,4 +350,12 @@ public class BlankRecord
}
return false;
}
public Object clone() {
BlankRecord rec = new BlankRecord();
rec.field_1_row = field_1_row;
rec.field_2_col = field_2_col;
rec.field_3_xf = field_3_xf;
return rec;
}
}

View File

@ -66,6 +66,7 @@ import org.apache.poi.util.LittleEndian;
* Creates new BoolErrRecord. <P>
* REFERENCE: PG ??? Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Michael P. Harhen
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -413,4 +414,14 @@ public class BoolErrRecord
}
return false;
}
public Object clone() {
BoolErrRecord rec = new BoolErrRecord();
rec.field_1_row = field_1_row;
rec.field_2_column = field_2_column;
rec.field_3_xf_index = field_3_xf_index;
rec.field_4_bBoolErr = field_4_bBoolErr;
rec.field_5_fError = field_5_fError;
return rec;
}
}

View File

@ -66,6 +66,7 @@ import org.apache.poi.util.LittleEndian;
* loop in the event the formulas are not independant. <P>
* REFERENCE: PG 292 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
* @see org.apache.poi.hssf.record.CalcModeRecord
*/
@ -169,4 +170,10 @@ public class CalcCountRecord
{
return this.sid;
}
public Object clone() {
CalcCountRecord rec = new CalcCountRecord();
rec.field_1_iterations = field_1_iterations;
return rec;
}
}

View File

@ -64,6 +64,7 @@ import org.apache.poi.util.LittleEndian;
* except for tables.<P>
* REFERENCE: PG 292 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
* @see org.apache.poi.hssf.record.CalcCountRecord
*/
@ -194,4 +195,10 @@ public class CalcModeRecord
{
return this.sid;
}
public Object clone() {
CalcModeRecord rec = new CalcModeRecord();
rec.field_1_calcmode = field_1_calcmode;
return rec;
}
}

View File

@ -195,6 +195,17 @@ public class CategorySeriesAxisRecord
return this.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.

View File

@ -66,6 +66,7 @@ package org.apache.poi.hssf.record;
* them.
*
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
*
* @see org.apache.poi.hssf.model.Sheet
* @see org.apache.poi.hssf.record.Record
@ -138,4 +139,6 @@ public interface CellValueRecordInterface
*/
public boolean isEqual(CellValueRecordInterface i);
public Object clone();
}

View File

@ -189,6 +189,17 @@ public class ChartRecord
return this.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.

View File

@ -173,6 +173,14 @@ public class DatRecord
return this.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.

View File

@ -191,6 +191,17 @@ public class DataFormatRecord
return this.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.

View File

@ -63,6 +63,7 @@ import org.apache.poi.util.LittleEndian;
* width set.<P>
* REFERENCE: PG 302 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -165,4 +166,10 @@ public class DefaultColWidthRecord
{
return this.sid;
}
public Object clone() {
DefaultColWidthRecord rec = new DefaultColWidthRecord();
rec.field_1_col_width = field_1_col_width;
return rec;
}
}

View File

@ -168,6 +168,14 @@ public class DefaultDataLabelTextPropertiesRecord
return this.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.

View File

@ -63,6 +63,7 @@ import org.apache.poi.util.LittleEndian;
* heights.
* REFERENCE: PG 301 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -190,4 +191,11 @@ public class DefaultRowHeightRecord
{
return this.sid;
}
public Object clone() {
DefaultRowHeightRecord rec = new DefaultRowHeightRecord();
rec.field_1_option_flags = field_1_option_flags;
rec.field_2_row_height = field_2_row_height;
return rec;
}
}

View File

@ -62,6 +62,7 @@ import org.apache.poi.util.LittleEndian;
* Description: controls the accuracy of the calculations<P>
* REFERENCE: PG 303 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -167,4 +168,10 @@ public class DeltaRecord
{
return this.sid;
}
public Object clone() {
DeltaRecord rec = new DeltaRecord();
rec.field_1_max_change = field_1_max_change;
return rec;
}
}

View File

@ -63,6 +63,7 @@ import org.apache.poi.util.LittleEndian;
* of a sheet.<P>
* REFERENCE: PG 303 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -244,4 +245,14 @@ public class DimensionsRecord
{
return this.sid;
}
public Object clone() {
DimensionsRecord rec = new DimensionsRecord();
rec.field_1_first_row = field_1_first_row;
rec.field_2_last_row = field_2_last_row;
rec.field_3_first_col = field_3_first_col;
rec.field_4_last_col = field_4_last_col;
rec.field_5_zero = field_5_zero;
return rec;
}
}

View File

@ -64,6 +64,7 @@ import org.apache.poi.util.LittleEndian;
* HSSF File<P>
* REFERENCE: PG 307 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -141,4 +142,9 @@ public class EOFRecord
{
return this.sid;
}
public Object clone() {
EOFRecord rec = new EOFRecord();
return rec;
}
}

View File

@ -197,6 +197,18 @@ public class FontBasisRecord
return this.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.

View File

@ -165,6 +165,14 @@ public class FontIndexRecord
return this.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.

View File

@ -64,6 +64,7 @@ import org.apache.poi.util.StringUtil;
* REFERENCE: PG 317 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Shawn Laubach (laubach@acm.org) Modified 3/14/02
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -218,4 +219,11 @@ public class FooterRecord
{
return this.sid;
}
public Object clone() {
FooterRecord rec = new FooterRecord();
rec.field_1_footer_len = field_1_footer_len;
rec.field_2_footer = field_2_footer;
return rec;
}
}

View File

@ -70,6 +70,7 @@ import org.apache.poi.hssf.record.formula.*;
* Formula Record.
* REFERENCE: PG 317/444 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -568,4 +569,25 @@ public class FormulaRecord
return buffer.toString();
}
public Object clone() {
FormulaRecord rec = new FormulaRecord();
rec.field_1_row = field_1_row;
rec.field_2_column = field_2_column;
rec.field_3_xf = field_3_xf;
rec.field_4_value = field_4_value;
rec.field_5_options = field_5_options;
rec.field_6_zero = field_6_zero;
rec.field_7_expression_len = field_7_expression_len;
rec.field_8_parsed_expr = new Stack();
int size = 0;
if (field_8_parsed_expr != null)
size = field_8_parsed_expr.size();
for (int i=0; i< size; i++) {
Ptg ptg = (Ptg)((Ptg)field_8_parsed_expr.get(i)).clone();
rec.field_8_parsed_expr.set(i, ptg);
}
rec.all_data = all_data;
return rec;
}
}

View File

@ -179,6 +179,15 @@ public class FrameRecord
return this.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.

View File

@ -65,6 +65,7 @@ import org.apache.poi.util.LittleEndian;
*
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Glen Stampoultzis (glens at apache.org)
* @author Jason Height (jheight at chariot dot net dot au)
*
* @version 2.0-pre
*/
@ -176,4 +177,10 @@ public class GridsetRecord
{
return this.sid;
}
public Object clone() {
GridsetRecord rec = new GridsetRecord();
rec.field_1_gridset_flag = field_1_gridset_flag;
return rec;
}
}

View File

@ -62,6 +62,7 @@ import org.apache.poi.util.LittleEndian;
* Description: Row/column gutter sizes <P>
* REFERENCE: PG 320 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -246,4 +247,13 @@ public class GutsRecord
{
return this.sid;
}
public Object clone() {
GutsRecord rec = new GutsRecord();
rec.field_1_left_row_gutter = field_1_left_row_gutter;
rec.field_2_top_col_gutter = field_2_top_col_gutter;
rec.field_3_row_level_max = field_3_row_level_max;
rec.field_4_col_level_max = field_4_col_level_max;
return rec;
}
}

View File

@ -62,6 +62,7 @@ import org.apache.poi.util.LittleEndian;
* Description: whether to center between horizontal margins<P>
* REFERENCE: PG 320 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -170,4 +171,10 @@ public class HCenterRecord
{
return this.sid;
}
public Object clone() {
HCenterRecord rec = new HCenterRecord();
rec.field_1_hcenter = field_1_hcenter;
return rec;
}
}

View File

@ -64,6 +64,7 @@ import org.apache.poi.util.StringUtil;
* REFERENCE: PG 321 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Shawn Laubach (laubach@acm.org) Modified 3/14/02
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -220,4 +221,11 @@ public class HeaderRecord
{
return this.sid;
}
public Object clone() {
HeaderRecord rec = new HeaderRecord();
rec.field_1_header_len = field_1_header_len;
rec.field_2_header = field_2_header;
return rec;
}
}

View File

@ -65,6 +65,7 @@ import org.apache.poi.util.LittleEndian;
* NOT USED IN THIS RELEASE
* REFERENCE: PG 323 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -225,4 +226,15 @@ public class IndexRecord
{
return this.sid;
}
public Object clone() {
IndexRecord rec = new IndexRecord();
rec.field_1_zero = field_1_zero;
rec.field_2_first_row = field_2_first_row;
rec.field_3_last_row_add1 = field_3_last_row_add1;
rec.field_4_zero = field_4_zero;
rec.field_5_dbcells = new IntList();
rec.field_5_dbcells.addAll(field_5_dbcells);
return rec;
}
}

View File

@ -65,6 +65,7 @@ import org.apache.poi.util.LittleEndian;
* a formula!)<P>
* REFERENCE: PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -174,4 +175,10 @@ public class IterationRecord
{
return this.sid;
}
public Object clone() {
IterationRecord rec = new IterationRecord();
rec.field_1_iteration = field_1_iteration;
return rec;
}
}

View File

@ -68,6 +68,7 @@ import org.apache.poi.util.StringUtil;
* use this (except to read), use LabelSST instead <P>
* REFERENCE: PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
* @see org.apache.poi.hssf.record.LabelSSTRecord
*/
@ -314,4 +315,15 @@ public class LabelRecord
public void setXFIndex(short xf)
{
}
public Object clone() {
LabelRecord rec = new LabelRecord();
rec.field_1_row = field_1_row;
rec.field_2_column = field_2_column;
rec.field_3_xf_index = field_3_xf_index;
rec.field_4_string_len = field_4_string_len;
rec.field_5_unicode_flag = field_5_unicode_flag;
rec.field_6_value = field_6_value;
return rec;
}
}

View File

@ -63,6 +63,7 @@ import org.apache.poi.util.LittleEndian;
* value. <P>
* REFERENCE: PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -331,4 +332,13 @@ public class LabelSSTRecord
}
return false;
}
public Object clone() {
LabelSSTRecord rec = new LabelSSTRecord();
rec.field_1_row = field_1_row;
rec.field_2_column = field_2_column;
rec.field_3_xf_index = field_3_xf_index;
rec.field_4_sst_index = field_4_sst_index;
return rec;
}
}

View File

@ -234,6 +234,20 @@ public class LegendRecord
return this.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.

View File

@ -216,6 +216,18 @@ public class LineFormatRecord
return this.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.

View File

@ -207,6 +207,18 @@ public class LinkedDataRecord
return this.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;
return rec;
}
/**
* Get the link type field for the LinkedData record.

View File

@ -165,6 +165,14 @@ public class NumberFormatIndexRecord
return this.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.

View File

@ -67,6 +67,7 @@ import org.apache.poi.hssf.record.Record;
* Contains a numeric cell value. <P>
* REFERENCE: PG 334 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -355,4 +356,13 @@ public class NumberRecord
}
return false;
}
public Object clone() {
NumberRecord rec = new NumberRecord();
rec.field_1_row = field_1_row;
rec.field_2_col = field_2_col;
rec.field_3_xf = field_3_xf;
rec.field_4_value = field_4_value;
return rec;
}
}

View File

@ -186,6 +186,16 @@ public class ObjectLinkRecord
return this.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.

View File

@ -157,6 +157,13 @@ public class PlotAreaRecord
return this.sid;
}
public Object clone() {
PlotAreaRecord rec = new PlotAreaRecord();
return rec;
}
} // END OF CLASS

View File

@ -173,6 +173,15 @@ public class PlotGrowthRecord
return this.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.

View File

@ -62,6 +62,7 @@ import org.apache.poi.util.LittleEndian;
* Description: whether to print the gridlines when you enjoy you spreadsheet on paper.<P>
* REFERENCE: PG 373 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -173,4 +174,10 @@ public class PrintGridlinesRecord
{
return this.sid;
}
public Object clone() {
PrintGridlinesRecord rec = new PrintGridlinesRecord();
rec.field_1_print_gridlines = field_1_print_gridlines;
return rec;
}
}

View File

@ -63,6 +63,7 @@ import org.apache.poi.util.LittleEndian;
* enjoy your spreadsheet in the physical form.<P>
* REFERENCE: PG 373 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -171,4 +172,10 @@ public class PrintHeadersRecord
{
return this.sid;
}
public Object clone() {
PrintHeadersRecord rec = new PrintHeadersRecord();
rec.field_1_print_headers = field_1_print_headers;
return rec;
}
}

View File

@ -63,6 +63,7 @@ import org.apache.poi.util.BitField;
* Description: Stores print setup options -- bogus for HSSF (and marked as such)<P>
* REFERENCE: PG 385 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -423,4 +424,20 @@ public class PrintSetupRecord
{
return this.sid;
}
public Object clone() {
PrintSetupRecord rec = new PrintSetupRecord();
rec.field_1_paper_size = field_1_paper_size;
rec.field_2_scale = field_2_scale;
rec.field_3_page_start = field_3_page_start;
rec.field_4_fit_width = field_4_fit_width;
rec.field_5_fit_height = field_5_fit_height;
rec.field_6_options = field_6_options;
rec.field_7_hresolution = field_7_hresolution;
rec.field_8_vresolution = field_8_vresolution;
rec.field_9_headermargin = field_9_headermargin;
rec.field_10_footermargin = field_10_footermargin;
rec.field_11_copies = field_11_copies;
return rec;
}
}

View File

@ -71,6 +71,7 @@ import org.apache.poi.hssf.util.RKUtil;
*
* REFERENCE: PG 376 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
* @see org.apache.poi.hssf.record.NumberRecord
*/
@ -339,4 +340,13 @@ public class RKRecord
public void setXFIndex(short xf)
{
}
public Object clone() {
RKRecord rec = new RKRecord();
rec.field_1_row = field_1_row;
rec.field_2_col = field_2_col;
rec.field_3_xf_index = field_3_xf_index;
rec.field_4_rk_number = field_4_rk_number;
return rec;
}
}

View File

@ -63,6 +63,7 @@ package org.apache.poi.hssf.record;
* Company:
* @author Andrew C. Oliver
* @author Marc Johnson (mjohnson at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -241,4 +242,8 @@ public abstract class Record
*/
public abstract short getSid();
public Object clone() {
throw new RuntimeException("The class "+getClass().getName()+" needs to define a clone method");
}
}

View File

@ -62,6 +62,7 @@ import org.apache.poi.util.LittleEndian;
* Description: Describes which reference mode to use<P>
* REFERENCE: PG 376 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -170,4 +171,10 @@ public class RefModeRecord
{
return this.sid;
}
public Object clone() {
RefModeRecord rec = new RefModeRecord();
rec.field_1_mode = field_1_mode;
return rec;
}
}

View File

@ -63,6 +63,7 @@ import org.apache.poi.util.LittleEndian;
* Description: stores the row information for the sheet. <P>
* REFERENCE: PG 379 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -512,4 +513,17 @@ public class RowRecord
}
return false;
}
public Object clone() {
RowRecord rec = new RowRecord();
rec.field_1_row_number = field_1_row_number;
rec.field_2_first_col = field_2_first_col;
rec.field_3_last_col = field_3_last_col;
rec.field_4_height = field_4_height;
rec.field_5_optimize = field_5_optimize;
rec.field_6_reserved = field_6_reserved;
rec.field_7_option_flags = field_7_option_flags;
rec.field_8_xf_index = field_8_xf_index;
return rec;
}
}

View File

@ -173,6 +173,15 @@ public class SCLRecord
return this.sid;
}
public Object clone() {
SCLRecord rec = new SCLRecord();
rec.field_1_numerator = field_1_numerator;
rec.field_2_denominator = field_2_denominator;
return rec;
}
/**
* Get the numerator field for the SCL record.

View File

@ -62,6 +62,7 @@ import org.apache.poi.util.LittleEndian;
* Description: defines whether to recalculate before saving (set to true)<P>
* REFERENCE: PG 381 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -164,4 +165,10 @@ public class SaveRecalcRecord
{
return this.sid;
}
public Object clone() {
SaveRecalcRecord rec = new SaveRecalcRecord();
rec.field_1_recalc = field_1_recalc;
return rec;
}
}

View File

@ -67,6 +67,7 @@ import org.apache.poi.util.LittleEndian;
* TODO : Implement reference subrecords
* REFERENCE: PG 291 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -279,4 +280,15 @@ public class SelectionRecord
{
return this.sid;
}
public Object clone() {
SelectionRecord rec = new SelectionRecord();
rec.field_1_pane = field_1_pane;
rec.field_2_row_active_cell = field_2_row_active_cell;
rec.field_3_col_active_cell = field_3_col_active_cell;
rec.field_4_ref_active_cell = field_4_ref_active_cell;
rec.field_5_num_refs = field_5_num_refs;
rec.field_6_refs = field_6_refs;
return rec;
}
}

View File

@ -165,6 +165,14 @@ public class SeriesChartGroupIndexRecord
return this.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.

View File

@ -165,6 +165,14 @@ public class SeriesIndexRecord
return this.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.

View File

@ -177,6 +177,14 @@ public class SeriesLabelsRecord
return this.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.

View File

@ -163,6 +163,14 @@ public class SeriesListRecord
return this.sid;
}
public Object clone() {
SeriesListRecord rec = new SeriesListRecord();
rec.field_1_seriesNumbers = field_1_seriesNumbers;
return rec;
}
/**
* Get the series numbers field for the SeriesList record.

View File

@ -217,6 +217,19 @@ public class SeriesRecord
return this.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.

View File

@ -187,6 +187,17 @@ public class SeriesTextRecord
return this.sid;
}
public Object clone() {
SeriesTextRecord rec = new SeriesTextRecord();
rec.field_1_id = field_1_id;
rec.field_2_textLength = field_2_textLength;
rec.field_3_undocumented = field_3_undocumented;
rec.field_4_text = field_4_text;
return rec;
}
/**
* Get the id field for the SeriesText record.

View File

@ -165,6 +165,14 @@ public class SeriesToChartGroupRecord
return this.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.

View File

@ -186,6 +186,15 @@ public class SheetPropertiesRecord
return this.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.

View File

@ -306,6 +306,25 @@ public class TextRecord
return this.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.

View File

@ -245,6 +245,23 @@ public class TickRecord
return this.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_options = field_8_options;
rec.field_9_tickColor = field_9_tickColor;
rec.field_10_zero3 = field_10_zero3;
return rec;
}
/**
* Get the major tick type field for the Tick record.

View File

@ -165,6 +165,14 @@ public class UnitsRecord
return this.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.

View File

@ -64,6 +64,7 @@ import org.apache.poi.util.LittleEndian;
* don't know all the records to. (HSSF leaves these alone!) <P>
* Company: SuperLink Software, Inc.<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -174,4 +175,14 @@ public class UnknownRecord
throw new RecordFormatException(
"Unknown record cannot be constructed via offset -- we need a copy of the data");
}
/** Unlike the other Record.clone methods this is a shallow clone*/
public Object clone() {
UnknownRecord rec = new UnknownRecord();
rec.offset = offset;
rec.sid = sid;
rec.size = size;
rec.thedata = thedata;
return rec;
}
}

View File

@ -62,6 +62,7 @@ import org.apache.poi.util.LittleEndian;
* Description: tells whether to center the sheet between vertical margins<P>
* REFERENCE: PG 420 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -170,4 +171,10 @@ public class VCenterRecord
{
return this.sid;
}
public Object clone() {
VCenterRecord rec = new VCenterRecord();
rec.field_1_vcenter = field_1_vcenter;
return rec;
}
}

View File

@ -65,6 +65,7 @@ import org.apache.poi.util.LittleEndian;
* REFERENCE: PG 425 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Glen Stampoultzis (gstamp@iprimus.com.au)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -415,4 +416,11 @@ public class WSBoolRecord
{
return this.sid;
}
public Object clone() {
WSBoolRecord rec = new WSBoolRecord();
rec.field_1_wsbool = field_1_wsbool;
rec.field_2_wsbool = field_2_wsbool;
return rec;
}
}

View File

@ -63,6 +63,7 @@ import org.apache.poi.util.LittleEndian;
* Description: sheet window settings<P>
* REFERENCE: PG 422 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 2.0-pre
*/
@ -615,4 +616,16 @@ public class WindowTwoRecord
{
return this.sid;
}
public Object clone() {
WindowTwoRecord rec = new WindowTwoRecord();
rec.field_1_options = field_1_options;
rec.field_2_top_row = field_2_top_row;
rec.field_3_left_col = field_3_left_col;
rec.field_4_header_color = field_4_header_color;
rec.field_5_page_break_zoom = field_5_page_break_zoom;
rec.field_6_normal_zoom = field_6_normal_zoom;
rec.field_7_reserved = field_7_reserved;
return rec;
}
}

View File

@ -67,6 +67,7 @@ import java.util.List;
/**
*
* @author andy
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class RowRecordsAggregate
@ -219,5 +220,16 @@ public class RowRecordsAggregate
return records.values().iterator();
}
/** Performs a deep clone of the record*/
public Object clone() {
RowRecordsAggregate rec = new RowRecordsAggregate();
for (Iterator rowIter = getIterator(); rowIter.hasNext();) {
//return the cloned Row Record & insert
RowRecord row = (RowRecord)((RowRecord)rowIter.next()).clone();
rec.insertRow(row);
}
return rec;
}
}

View File

@ -67,6 +67,7 @@ import java.util.TreeMap;
*
* @author andy
* @author Glen Stampoultzis (glens at apache.org)
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class ValueRecordsAggregate
@ -235,6 +236,16 @@ public class ValueRecordsAggregate
{
return records.values().iterator();
}
/** Performs a deep clone of the record*/
public Object clone() {
ValueRecordsAggregate rec = new ValueRecordsAggregate();
for (Iterator valIter = getIterator(); valIter.hasNext();) {
CellValueRecordInterface val = (CellValueRecordInterface)((CellValueRecordInterface)valIter.next()).clone();
rec.insertCell(val);
}
return rec;
}
}
/*

View File

@ -68,6 +68,7 @@ import org.apache.poi.hssf.util.SheetReferences;
* Addition operator PTG the "+" binomial operator. If you need more
* explanation than that then well...We really can't help you here.
* @author Andrew C. Oliver (acoliver@apache.org)
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class AddPtg
@ -129,4 +130,8 @@ public class AddPtg
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
public Object clone() {
return new AddPtg();
}
}

View File

@ -70,6 +70,7 @@ import org.apache.poi.util.BitField;
* REFERENCE: <P>
* @author Libin Roman (Vista Portal LDT. Developer)
* @author avik
* @author Jason Height (jheight at chariot dot net dot au)
* @version 1.0-pre
*/
@ -304,4 +305,14 @@ public class Area3DPtg extends Ptg
return Ptg.CLASS_REF;
}
public Object clone() {
Area3DPtg ptg = new Area3DPtg();
ptg.field_1_index_extern_sheet = field_1_index_extern_sheet;
ptg.field_2_first_row = field_2_first_row;
ptg.field_3_last_row = field_3_last_row;
ptg.field_4_first_column = field_4_first_column;
ptg.field_5_last_column = field_5_last_column;
return ptg;
}
}

View File

@ -70,6 +70,7 @@ import org.apache.poi.hssf.util.SheetReferences;
/**
* Specifies a rectangular area of cells A1:A4 for instance.
* @author andy
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class AreaPtg
@ -86,7 +87,9 @@ public class AreaPtg
private BitField colRelative = new BitField(0x4000);
private BitField column = new BitField(0x3FFF);
private AreaPtg() {
//Required for clone methods
}
public AreaPtg(String arearef) {
AreaReference ar = new AreaReference(arearef);
@ -312,4 +315,13 @@ public class AreaPtg
return Ptg.CLASS_REF;
}
public Object clone() {
AreaPtg ptg = new AreaPtg();
ptg.field_1_first_row = field_1_first_row;
ptg.field_2_last_row = field_2_last_row;
ptg.field_3_first_column = field_3_first_column;
ptg.field_4_last_column = field_4_last_column;
return ptg;
}
}

View File

@ -72,6 +72,7 @@ import java.util.List;
* This seems to be a Misc Stuff and Junk record. One function it serves is
* in SUM functions (i.e. SUM(A1:A3) causes an area PTG then an ATTR with the SUM option set)
* @author andy
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class AttrPtg
@ -246,4 +247,11 @@ public class AttrPtg
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
public Object clone() {
AttrPtg ptg = new AttrPtg();
ptg.field_1_options = field_1_options;
ptg.field_2_data = field_2_data;
return ptg;
}
}

View File

@ -67,6 +67,7 @@ import org.apache.poi.hssf.util.SheetReferences;
/**
*
* @author andy
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class ConcatPtg
@ -122,4 +123,8 @@ public class ConcatPtg
return buffer.toString();
}
public Object clone() {
return new ConcatPtg();
}
}

View File

@ -67,6 +67,7 @@ import org.apache.poi.hssf.util.SheetReferences;
/**
* This PTG implements the standard binomial divide "/"
* @author Andrew C. Oliver acoliver at apache dot org
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class DividePtg
@ -120,4 +121,9 @@ public class DividePtg
buffer.append(operands[ 1 ]);
return buffer.toString();
}
public Object clone() {
DividePtg ptg = new DividePtg();
return ptg;
}
}

View File

@ -122,4 +122,9 @@ public class EqualPtg
return buffer.toString();
}
public Object clone() {
return new EqualPtg();
}
}

View File

@ -65,6 +65,7 @@ import org.apache.poi.hssf.util.SheetReferences;
/**
*
* @author andy
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class ExpPtg
@ -101,4 +102,8 @@ public class ExpPtg
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
public Object clone() {
throw new RuntimeException("NO IDEA SHARED FORMULA EXP PTG");
}
}

View File

@ -1,10 +1,19 @@
package org.apache.poi.hssf.record.formula;
import org.apache.poi.util.LittleEndian;
/**
*
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class FuncPtg extends AbstractFunctionPtg{
public final static byte sid = 0x21;
private int numParams=0;
private FuncPtg() {
//Required for clone methods
}
/**Creates new function pointer from a byte array
* usually called while reading an excel file.
*/
@ -28,4 +37,11 @@ public class FuncPtg extends AbstractFunctionPtg{
public int getNumberOfOperands() {
return numParams;
}
public Object clone() {
FuncPtg ptg = new FuncPtg();
ptg.field_1_num_args = field_1_num_args;
ptg.field_2_fnc_index = field_2_fnc_index;
return ptg;
}
}

View File

@ -1,9 +1,18 @@
package org.apache.poi.hssf.record.formula;
import org.apache.poi.util.LittleEndian;
/**
*
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class FuncVarPtg extends AbstractFunctionPtg{
public final static byte sid = 0x22;
private FuncVarPtg() {
//Required for clone methods
}
/**Creates new function pointer from a byte array
* usually called while reading an excel file.
*/
@ -38,5 +47,12 @@ public class FuncVarPtg extends AbstractFunctionPtg{
return field_1_num_args;
}
public Object clone() {
FuncVarPtg ptg = new FuncVarPtg();
ptg.field_1_num_args = field_1_num_args;
ptg.field_2_fnc_index = field_2_fnc_index;
return ptg;
}
}

View File

@ -67,6 +67,7 @@ import org.apache.poi.hssf.util.SheetReferences;
* Integer (short intger)
* Stores a (java) short value in a formula
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class IntPtg
@ -79,6 +80,10 @@ public class IntPtg
private String val;
private int strlen = 0;
private IntPtg() {
//Required for clone methods
}
public IntPtg(byte [] data, int offset)
{
setValue(LittleEndian.getShort(data, offset + 1));
@ -116,4 +121,10 @@ public class IntPtg
return "" + getValue();
}
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
public Object clone() {
IntPtg ptg = new IntPtg();
ptg.field_1_value = field_1_value;
return ptg;
}
}

View File

@ -66,6 +66,7 @@ import org.apache.poi.hssf.util.SheetReferences;
/**
*
* @author andy
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class MemErrPtg
@ -122,4 +123,11 @@ public class MemErrPtg
return "ERR#";
}
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
public Object clone() {
MemErrPtg ptg = new MemErrPtg();
ptg.field_1_reserved = field_1_reserved;
ptg.field_2_subex_len = field_2_subex_len;
return ptg;
}
}

View File

@ -60,6 +60,7 @@ import org.apache.poi.hssf.util.SheetReferences;
* Missing Function Arguments
*
* Avik Sengupta <avik at apache.org>
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class MissingArgPtg
extends Ptg
@ -97,6 +98,10 @@ public class MissingArgPtg
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
public Object clone() {
return new MissingArgPtg();
}
}

View File

@ -66,6 +66,7 @@ import org.apache.poi.hssf.util.SheetReferences;
/**
* Implements the standard mathmatical multiplication - *
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class MultiplyPtg
@ -136,4 +137,8 @@ public class MultiplyPtg
buffer.append(operands[ 1 ]);
return buffer.toString();
}
public Object clone() {
return new MultiplyPtg();
}
}

View File

@ -66,6 +66,7 @@ import org.apache.poi.hssf.util.SheetReferences;
/**
*
* @author andy
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class NamePtg
@ -77,6 +78,11 @@ public class NamePtg
private short field_2_label_index;
private short field_3_zero; // reserved must be 0
private NamePtg() {
//Required for clone methods
}
/** Creates new NamePtg */
public NamePtg(String name)
@ -109,4 +115,12 @@ public class NamePtg
}
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
public Object clone() {
NamePtg ptg = new NamePtg();
ptg.field_1_ixti = field_1_ixti;
ptg.field_2_label_index = field_2_label_index;
ptg.field_3_zero = field_3_zero;
return ptg;
}
}

View File

@ -61,6 +61,7 @@ import org.apache.poi.hssf.util.SheetReferences;
* Stores a floating point value in a formula
* value stored in a 8 byte field using IEEE notation
* @author Avik Sengupta
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class NumberPtg
@ -70,6 +71,9 @@ public class NumberPtg
public final static byte sid = 0x1f;
private double field_1_value;
private NumberPtg() {
//Required for clone methods
}
/** Create a NumberPtg from a byte array read from disk */
public NumberPtg(byte [] data, int offset)
@ -114,5 +118,11 @@ public class NumberPtg
return "" + getValue();
}
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
public Object clone() {
NumberPtg ptg = new NumberPtg();
ptg.field_1_value = field_1_value;
return ptg;
}
}

View File

@ -66,6 +66,7 @@ import org.apache.poi.hssf.util.SheetReferences;
*
* Avik Sengupta <lists@aviksengupta.com>
* Andrew C. Oliver (acoliver at apache dot org)
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class ParenthesisPtg
extends OperationPtg
@ -118,5 +119,9 @@ public class ParenthesisPtg
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
public Object clone() {
return new ParenthesisPtg();
}
}

View File

@ -67,6 +67,7 @@ import org.apache.poi.hssf.util.SheetReferences;
/**
*
* @author andy
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class PowerPtg
@ -122,4 +123,8 @@ public class PowerPtg
return buffer.toString();
}
public Object clone() {
return new PowerPtg();
}
}

View File

@ -69,6 +69,7 @@ import org.apache.poi.hssf.util.SheetReferences;
*
* @author andy
* @author avik
* @author Jason Height (jheight at chariot dot net dot au)
*/
public abstract class Ptg
@ -334,6 +335,8 @@ public abstract class Ptg
public abstract byte getDefaultOperandClass();
public abstract Object clone();
}

View File

@ -69,6 +69,7 @@ import org.apache.poi.hssf.model.Workbook;
* Description: Defined a cell in extern sheet. <P>
* REFERENCE: <P>
* @author Libin Roman (Vista Portal LDT. Developer)
* @author Jason Height (jheight at chariot dot net dot au)
* @version 1.0-pre
*/
@ -204,4 +205,12 @@ public class Ref3DPtg extends Ptg {
public byte getDefaultOperandClass() {return Ptg.CLASS_REF;}
public Object clone() {
Ref3DPtg ptg = new Ref3DPtg();
ptg.field_1_index_extern_sheet = field_1_index_extern_sheet;
ptg.field_2_row = field_2_row;
ptg.field_3_column = field_3_column;
return ptg;
}
}

View File

@ -69,6 +69,7 @@ import org.apache.poi.hssf.util.SheetReferences;
/**
* ReferencePtg - handles references (such as A1, A2, IA4)
* @author Andrew C. Oliver (acoliver@apache.org)
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class ReferencePtg extends Ptg
@ -81,7 +82,9 @@ public class ReferencePtg extends Ptg
private BitField rowRelative = new BitField(0x8000);
private BitField colRelative = new BitField(0x4000);
private ReferencePtg() {
//Required for clone methods
}
/**
* Takes in a String represnetation of a cell reference and fills out the
@ -186,4 +189,10 @@ public class ReferencePtg extends Ptg
return Ptg.CLASS_REF;
}
public Object clone() {
ReferencePtg ptg = new ReferencePtg();
ptg.field_1_row = field_1_row;
ptg.field_2_col = field_2_col;
return ptg;
}
}

View File

@ -62,6 +62,7 @@ import org.apache.poi.hssf.util.SheetReferences;
* Number
* Stores a String value in a formula value stored in the format <length 2 bytes>char[]
* @author Werner Froidevaux
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class StringPtg
@ -71,6 +72,9 @@ public class StringPtg
public final static byte sid = 0x17;
private String field_1_value;
private StringPtg() {
//Required for clone methods
}
/** Create a StringPtg from a byte array read from disk */
public StringPtg(byte [] data, int offset)
@ -120,5 +124,11 @@ public class StringPtg
return Ptg.CLASS_VALUE;
}
public Object clone() {
StringPtg ptg = new StringPtg();
ptg.field_1_value = field_1_value;
return ptg;
}
}

View File

@ -66,6 +66,7 @@ import org.apache.poi.hssf.util.SheetReferences;
/**
*
* @author andy
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class SubtractPtg
@ -118,4 +119,8 @@ public class SubtractPtg
buffer.append(operands[ 1 ]);
return buffer.toString();
}
public Object clone() {
return new SubtractPtg();
}
}

View File

@ -65,6 +65,7 @@ import org.apache.poi.hssf.util.SheetReferences;
/**
*
* @author andy
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class UnknownPtg
@ -99,5 +100,9 @@ public class UnknownPtg
}
public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
public Object clone() {
return new UnknownPtg();
}
}

View File

@ -143,6 +143,10 @@ public class HSSFSheet
setPropertiesFromSheet(sheet);
}
HSSFSheet cloneSheet(Workbook book) {
return new HSSFSheet(book, sheet.cloneSheet());
}
/**
* used internally to set the properties given a Sheet object

View File

@ -291,6 +291,28 @@ public class HSSFWorkbook
return sheet;
}
/**
* create an HSSFSheet from an existing sheet in the HSSFWorkbook.
*
* @return HSSFSheet representing the cloned sheet.
*/
public HSSFSheet cloneSheet(int sheetNum) {
HSSFSheet srcSheet = (HSSFSheet)sheets.get(sheetNum);
String srcName = workbook.getSheetName(sheetNum);
if (srcSheet != null) {
HSSFSheet clonedSheet = srcSheet.cloneSheet(workbook);
WindowTwoRecord windowTwo = (WindowTwoRecord) clonedSheet.getSheet().findFirstRecordBySid(WindowTwoRecord.sid);
windowTwo.setSelected(sheets.size() == 1);
windowTwo.setPaged(sheets.size() == 1);
sheets.add(clonedSheet);
workbook.setSheetName(sheets.size()-1, srcName+"[1]");
return clonedSheet;
}
return null;
}
/**
* create an HSSFSheet for this HSSFWorkbook, adds it to the sheets and returns
* the high level representation. Use this to create new sheets.

View File

@ -177,6 +177,16 @@ public class <xsl:value-of select="@name"/>Record
return this.sid;
}
public Object clone() {
<xsl:value-of select="@name"/>Record rec = new <xsl:value-of select="@name"/>Record();
<xsl:for-each select="//fields/field"><xsl:text> rec.</xsl:text><xsl:value-of select="recutil:getFieldName(position(),@name,0)"/><xsl:text> = </xsl:text><xsl:value-of select="recutil:getFieldName(position(),@name,0)"/><xsl:text>;
</xsl:text></xsl:for-each>
return rec;
}
<xsl:apply-templates select="//field" mode="getset"/>
<xsl:apply-templates select="//field" mode="bits"/>

Some files were not shown because too many files have changed in this diff Show More