View | Details | Raw Unified | Return to bug 11721
Collapse All | Expand All

(-)jakarta-poi/src/java/org/apache/poi/hssf/model/Sheet.java (+41 lines)
Lines 80-85 Link Here
80
 * @author  Andrew C. Oliver (acoliver at apache dot org)
80
 * @author  Andrew C. Oliver (acoliver at apache dot org)
81
 * @author  Glen Stampoultzis (glens at apache.org)
81
 * @author  Glen Stampoultzis (glens at apache.org)
82
 * @author  Shawn Laubach (laubach at acm.org) Just Gridlines, Headers, Footers, and PrintSetup
82
 * @author  Shawn Laubach (laubach at acm.org) Just Gridlines, Headers, Footers, and PrintSetup
83
 * @author Jason Height (jheight at chariot dot net dot au) Clone support
83
 *
84
 *
84
 * @see org.apache.poi.hssf.model.Workbook
85
 * @see org.apache.poi.hssf.model.Workbook
85
 * @see org.apache.poi.hssf.usermodel.HSSFSheet
86
 * @see org.apache.poi.hssf.usermodel.HSSFSheet
Lines 270-275 Link Here
270
        log.log(log.DEBUG, "sheet createSheet (existing file) exited");
271
        log.log(log.DEBUG, "sheet createSheet (existing file) exited");
271
        return retval;
272
        return retval;
272
    }
273
    }
274
275
    /**
276
     * Clones the low level records of this sheet and returns the new sheet instance.
277
     */
278
    public Sheet cloneSheet()
279
    {
280
      ArrayList clonedRecords = new ArrayList(this.records.size());
281
      for (int i=0; i<this.records.size();i++) {
282
        Record rec = (Record)((Record)this.records.get(i)).clone();
283
        //Need to pull out the Row record and the Value records from their
284
        //Aggregates.
285
        //This is probably the best way to do it since we probably dont want the createSheet
286
        //To cater for these artificial Record types
287
        if (rec instanceof RowRecordsAggregate) {
288
          RowRecordsAggregate rrAgg = (RowRecordsAggregate)rec;
289
          for (Iterator rowIter = rrAgg.getIterator();rowIter.hasNext();) {
290
            Record rowRec = (Record)rowIter.next();
291
            clonedRecords.add(rowRec);
292
          }
293
        } else if (rec instanceof ValueRecordsAggregate) {
294
          ValueRecordsAggregate vrAgg = (ValueRecordsAggregate)rec;
295
          for (Iterator cellIter = vrAgg.getIterator();cellIter.hasNext();) {
296
            Record valRec = (Record)cellIter.next();
297
            clonedRecords.add(valRec);
298
          }
299
        } else if (rec instanceof FormulaRecordAggregate) {
300
          FormulaRecordAggregate fmAgg = (FormulaRecordAggregate)rec;
301
          Record fmAggRec = fmAgg.getFormulaRecord();
302
          if (fmAggRec != null)
303
            clonedRecords.add(fmAggRec);
304
          fmAggRec =   fmAgg.getStringRecord();
305
          if (fmAggRec != null)
306
            clonedRecords.add(fmAggRec);
307
        } else {
308
          clonedRecords.add(rec);
309
        }
310
      }
311
      return createSheet(clonedRecords, 0, 0);
312
    }
313
273
314
274
    /**
315
    /**
275
     * read support  (offset = 0) Same as createSheet(Record[] recs, int, int)
316
     * read support  (offset = 0) Same as createSheet(Record[] recs, int, int)
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/BOFRecord.java (+12 lines)
Lines 64-69 Link Here
64
 *              Used in sheets and workbooks.<P>
64
 *              Used in sheets and workbooks.<P>
65
 * REFERENCE:  PG 289 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
65
 * REFERENCE:  PG 289 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
66
 * @author Andrew C. Oliver
66
 * @author Andrew C. Oliver
67
 * @author Jason Height (jheight at chariot dot net dot au)
67
 * @version 2.0-pre
68
 * @version 2.0-pre
68
 */
69
 */
69
70
Lines 357-361 Link Here
357
    public short getSid()
358
    public short getSid()
358
    {
359
    {
359
        return this.sid;
360
        return this.sid;
361
    }
362
363
    public Object clone() {
364
      BOFRecord rec = new BOFRecord();
365
      rec.field_1_version = field_1_version;
366
      rec.field_2_type = field_2_type;
367
      rec.field_3_build = field_3_build;
368
      rec.field_4_year = field_4_year;
369
      rec.field_5_history = field_5_history;
370
      rec.field_6_rversion = field_6_rversion;
371
      return rec;
360
    }
372
    }
361
}
373
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/BlankRecord.java (+9 lines)
Lines 67-72 Link Here
67
 * Description:  Represents a column in a row with no value but with styling.<P>
67
 * Description:  Represents a column in a row with no value but with styling.<P>
68
 * REFERENCE:  PG 287 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
68
 * REFERENCE:  PG 287 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
69
 * @author Andrew C. Oliver (acoliver at apache dot org)
69
 * @author Andrew C. Oliver (acoliver at apache dot org)
70
 * @author Jason Height (jheight at chariot dot net dot au)
70
 * @version 2.0-pre
71
 * @version 2.0-pre
71
 */
72
 */
72
73
Lines 348-352 Link Here
348
            return true;
349
            return true;
349
        }
350
        }
350
        return false;
351
        return false;
352
    }
353
354
    public Object clone() {
355
      BlankRecord rec = new BlankRecord();
356
      rec.field_1_row = field_1_row;
357
      rec.field_2_col = field_2_col;
358
      rec.field_3_xf = field_3_xf;
359
      return rec;
351
    }
360
    }
352
}
361
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/BoolErrRecord.java (+11 lines)
Lines 66-71 Link Here
66
 * Creates new BoolErrRecord. <P>
66
 * Creates new BoolErrRecord. <P>
67
 * REFERENCE:  PG ??? Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
67
 * REFERENCE:  PG ??? Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
68
 * @author Michael P. Harhen
68
 * @author Michael P. Harhen
69
 * @author Jason Height (jheight at chariot dot net dot au)
69
 * @version 2.0-pre
70
 * @version 2.0-pre
70
 */
71
 */
71
72
Lines 412-416 Link Here
412
            return true;
413
            return true;
413
        }
414
        }
414
        return false;
415
        return false;
416
    }
417
418
    public Object clone() {
419
      BoolErrRecord rec = new BoolErrRecord();
420
      rec.field_1_row = field_1_row;
421
      rec.field_2_column = field_2_column;
422
      rec.field_3_xf_index = field_3_xf_index;
423
      rec.field_4_bBoolErr = field_4_bBoolErr;
424
      rec.field_5_fError = field_5_fError;
425
      return rec;
415
    }
426
    }
416
}
427
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/CalcCountRecord.java (+7 lines)
Lines 66-71 Link Here
66
 *               loop in the event the formulas are not independant. <P>
66
 *               loop in the event the formulas are not independant. <P>
67
 * REFERENCE:  PG 292 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
67
 * REFERENCE:  PG 292 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
68
 * @author Andrew C. Oliver (acoliver at apache dot org)
68
 * @author Andrew C. Oliver (acoliver at apache dot org)
69
 * @author Jason Height (jheight at chariot dot net dot au)
69
 * @version 2.0-pre
70
 * @version 2.0-pre
70
 * @see org.apache.poi.hssf.record.CalcModeRecord
71
 * @see org.apache.poi.hssf.record.CalcModeRecord
71
 */
72
 */
Lines 168-172 Link Here
168
    public short getSid()
169
    public short getSid()
169
    {
170
    {
170
        return this.sid;
171
        return this.sid;
172
    }
173
174
    public Object clone() {
175
      CalcCountRecord rec = new CalcCountRecord();
176
      rec.field_1_iterations = field_1_iterations;
177
      return rec;
171
    }
178
    }
172
}
179
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/CalcModeRecord.java (+7 lines)
Lines 64-69 Link Here
64
 *               except for tables.<P>
64
 *               except for tables.<P>
65
 * REFERENCE:  PG 292 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
65
 * REFERENCE:  PG 292 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
66
 * @author Andrew C. Oliver (acoliver at apache dot org)
66
 * @author Andrew C. Oliver (acoliver at apache dot org)
67
 * @author Jason Height (jheight at chariot dot net dot au)
67
 * @version 2.0-pre
68
 * @version 2.0-pre
68
 * @see org.apache.poi.hssf.record.CalcCountRecord
69
 * @see org.apache.poi.hssf.record.CalcCountRecord
69
 */
70
 */
Lines 193-197 Link Here
193
    public short getSid()
194
    public short getSid()
194
    {
195
    {
195
        return this.sid;
196
        return this.sid;
197
    }
198
199
    public Object clone() {
200
      CalcModeRecord rec = new CalcModeRecord();
201
      rec.field_1_calcmode = field_1_calcmode;
202
      return rec;
196
    }
203
    }
197
}
204
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/CellValueRecordInterface.java (+3 lines)
Lines 66-71 Link Here
66
 * them.
66
 * them.
67
 *
67
 *
68
 * @author Andrew C. Oliver (acoliver at apache dot org)
68
 * @author Andrew C. Oliver (acoliver at apache dot org)
69
 * @author Jason Height (jheight at chariot dot net dot au)
69
 *
70
 *
70
 * @see org.apache.poi.hssf.model.Sheet
71
 * @see org.apache.poi.hssf.model.Sheet
71
 * @see org.apache.poi.hssf.record.Record
72
 * @see org.apache.poi.hssf.record.Record
Lines 138-141 Link Here
138
     */
139
     */
139
140
140
    public boolean isEqual(CellValueRecordInterface i);
141
    public boolean isEqual(CellValueRecordInterface i);
142
143
    public Object clone();
141
}
144
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/DefaultColWidthRecord.java (+7 lines)
Lines 63-68 Link Here
63
 *               width set.<P>
63
 *               width set.<P>
64
 * REFERENCE:  PG 302 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
64
 * REFERENCE:  PG 302 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
66
 * @author Jason Height (jheight at chariot dot net dot au)
66
 * @version 2.0-pre
67
 * @version 2.0-pre
67
 */
68
 */
68
69
Lines 164-168 Link Here
164
    public short getSid()
165
    public short getSid()
165
    {
166
    {
166
        return this.sid;
167
        return this.sid;
168
    }
169
170
    public Object clone() {
171
      DefaultColWidthRecord rec = new DefaultColWidthRecord();
172
      rec.field_1_col_width = field_1_col_width;
173
      return rec;
167
    }
174
    }
168
}
175
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/DefaultRowHeightRecord.java (+8 lines)
Lines 63-68 Link Here
63
 *               heights.
63
 *               heights.
64
 * REFERENCE:  PG 301 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
64
 * REFERENCE:  PG 301 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
66
 * @author Jason Height (jheight at chariot dot net dot au)
66
 * @version 2.0-pre
67
 * @version 2.0-pre
67
 */
68
 */
68
69
Lines 189-193 Link Here
189
    public short getSid()
190
    public short getSid()
190
    {
191
    {
191
        return this.sid;
192
        return this.sid;
193
    }
194
195
    public Object clone() {
196
      DefaultRowHeightRecord rec = new DefaultRowHeightRecord();
197
      rec.field_1_option_flags = field_1_option_flags;
198
      rec.field_2_row_height = field_2_row_height;
199
      return rec;
192
    }
200
    }
193
}
201
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/DeltaRecord.java (+7 lines)
Lines 62-67 Link Here
62
 * Description:  controls the accuracy of the calculations<P>
62
 * Description:  controls the accuracy of the calculations<P>
63
 * REFERENCE:  PG 303 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
63
 * REFERENCE:  PG 303 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
64
 * @author Andrew C. Oliver (acoliver at apache dot org)
64
 * @author Andrew C. Oliver (acoliver at apache dot org)
65
 * @author Jason Height (jheight at chariot dot net dot au)
65
 * @version 2.0-pre
66
 * @version 2.0-pre
66
 */
67
 */
67
68
Lines 166-170 Link Here
166
    public short getSid()
167
    public short getSid()
167
    {
168
    {
168
        return this.sid;
169
        return this.sid;
170
    }
171
172
    public Object clone() {
173
      DeltaRecord rec = new DeltaRecord();
174
      rec.field_1_max_change = field_1_max_change;
175
      return rec;
169
    }
176
    }
170
}
177
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/DimensionsRecord.java (+11 lines)
Lines 63-68 Link Here
63
 *               of a sheet.<P>
63
 *               of a sheet.<P>
64
 * REFERENCE:  PG 303 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
64
 * REFERENCE:  PG 303 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
66
 * @author Jason Height (jheight at chariot dot net dot au)
66
 * @version 2.0-pre
67
 * @version 2.0-pre
67
 */
68
 */
68
69
Lines 243-247 Link Here
243
    public short getSid()
244
    public short getSid()
244
    {
245
    {
245
        return this.sid;
246
        return this.sid;
247
    }
248
249
    public Object clone() {
250
      DimensionsRecord rec = new DimensionsRecord();
251
      rec.field_1_first_row = field_1_first_row;
252
      rec.field_2_last_row = field_2_last_row;
253
      rec.field_3_first_col = field_3_first_col;
254
      rec.field_4_last_col = field_4_last_col;
255
      rec.field_5_zero = field_5_zero;
256
      return rec;
246
    }
257
    }
247
}
258
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/EOFRecord.java (+6 lines)
Lines 64-69 Link Here
64
 *               HSSF File<P>
64
 *               HSSF File<P>
65
 * REFERENCE:  PG 307 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
65
 * REFERENCE:  PG 307 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
66
 * @author Andrew C. Oliver (acoliver at apache dot org)
66
 * @author Andrew C. Oliver (acoliver at apache dot org)
67
 * @author Jason Height (jheight at chariot dot net dot au)
67
 * @version 2.0-pre
68
 * @version 2.0-pre
68
 */
69
 */
69
70
Lines 140-144 Link Here
140
    public short getSid()
141
    public short getSid()
141
    {
142
    {
142
        return this.sid;
143
        return this.sid;
144
    }
145
146
    public Object clone() {
147
      EOFRecord rec = new EOFRecord();
148
      return rec;
143
    }
149
    }
144
}
150
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/FooterRecord.java (+8 lines)
Lines 64-69 Link Here
64
 * REFERENCE:  PG 317 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
64
 * REFERENCE:  PG 317 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
66
 * @author Shawn Laubach (laubach@acm.org) Modified 3/14/02
66
 * @author Shawn Laubach (laubach@acm.org) Modified 3/14/02
67
 * @author Jason Height (jheight at chariot dot net dot au)
67
 * @version 2.0-pre
68
 * @version 2.0-pre
68
 */
69
 */
69
70
Lines 217-221 Link Here
217
    public short getSid()
218
    public short getSid()
218
    {
219
    {
219
        return this.sid;
220
        return this.sid;
221
    }
222
223
    public Object clone() {
224
      FooterRecord rec = new FooterRecord();
225
      rec.field_1_footer_len = field_1_footer_len;
226
      rec.field_2_footer = field_2_footer;
227
      return rec;
220
    }
228
    }
221
}
229
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/FormulaRecord.java (+22 lines)
Lines 70-75 Link Here
70
 * Formula Record.
70
 * Formula Record.
71
 * REFERENCE:  PG 317/444 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
71
 * REFERENCE:  PG 317/444 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
72
 * @author Andrew C. Oliver (acoliver at apache dot org)
72
 * @author Andrew C. Oliver (acoliver at apache dot org)
73
 * @author Jason Height (jheight at chariot dot net dot au)
73
 * @version 2.0-pre
74
 * @version 2.0-pre
74
 */
75
 */
75
76
Lines 568-571 Link Here
568
        return buffer.toString();
569
        return buffer.toString();
569
    }
570
    }
570
    
571
    
572
    public Object clone() {
573
      FormulaRecord rec = new FormulaRecord();
574
      rec.field_1_row = field_1_row;
575
      rec.field_2_column = field_2_column;
576
      rec.field_3_xf = field_3_xf;
577
      rec.field_4_value = field_4_value;
578
      rec.field_5_options = field_5_options;
579
      rec.field_6_zero = field_6_zero;
580
      rec.field_7_expression_len = field_7_expression_len;
581
      rec.field_8_parsed_expr = new Stack();
582
      int size = 0;
583
      if (field_8_parsed_expr != null)
584
        size = field_8_parsed_expr.size();
585
      for (int i=0; i< size; i++) {
586
        Ptg ptg = (Ptg)((Ptg)field_8_parsed_expr.get(i)).clone();
587
        rec.field_8_parsed_expr.set(i, ptg);
588
      }
589
      rec.all_data = all_data;
590
      return rec;
591
    }
592
571
}
593
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/GridsetRecord.java (+7 lines)
Lines 65-70 Link Here
65
 *
65
 *
66
 * @author Andrew C. Oliver (acoliver at apache dot org)
66
 * @author Andrew C. Oliver (acoliver at apache dot org)
67
 * @author  Glen Stampoultzis (glens at apache.org)
67
 * @author  Glen Stampoultzis (glens at apache.org)
68
 * @author Jason Height (jheight at chariot dot net dot au)
68
 *
69
 *
69
 * @version 2.0-pre
70
 * @version 2.0-pre
70
 */
71
 */
Lines 175-179 Link Here
175
    public short getSid()
176
    public short getSid()
176
    {
177
    {
177
        return this.sid;
178
        return this.sid;
179
    }
180
181
    public Object clone() {
182
      GridsetRecord rec = new GridsetRecord();
183
      rec.field_1_gridset_flag = field_1_gridset_flag;
184
      return rec;
178
    }
185
    }
179
}
186
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/GutsRecord.java (+10 lines)
Lines 62-67 Link Here
62
 * Description:  Row/column gutter sizes <P>
62
 * Description:  Row/column gutter sizes <P>
63
 * REFERENCE:  PG 320 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
63
 * REFERENCE:  PG 320 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
64
 * @author Andrew C. Oliver (acoliver at apache dot org)
64
 * @author Andrew C. Oliver (acoliver at apache dot org)
65
 * @author Jason Height (jheight at chariot dot net dot au)
65
 * @version 2.0-pre
66
 * @version 2.0-pre
66
 */
67
 */
67
68
Lines 245-249 Link Here
245
    public short getSid()
246
    public short getSid()
246
    {
247
    {
247
        return this.sid;
248
        return this.sid;
249
    }
250
251
    public Object clone() {
252
      GutsRecord rec = new GutsRecord();
253
      rec.field_1_left_row_gutter = field_1_left_row_gutter;
254
      rec.field_2_top_col_gutter = field_2_top_col_gutter;
255
      rec.field_3_row_level_max = field_3_row_level_max;
256
      rec.field_4_col_level_max = field_4_col_level_max;
257
      return rec;
248
    }
258
    }
249
}
259
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/HCenterRecord.java (+7 lines)
Lines 62-67 Link Here
62
 * Description:  whether to center between horizontal margins<P>
62
 * Description:  whether to center between horizontal margins<P>
63
 * REFERENCE:  PG 320 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
63
 * REFERENCE:  PG 320 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
64
 * @author Andrew C. Oliver (acoliver at apache dot org)
64
 * @author Andrew C. Oliver (acoliver at apache dot org)
65
 * @author Jason Height (jheight at chariot dot net dot au)
65
 * @version 2.0-pre
66
 * @version 2.0-pre
66
 */
67
 */
67
68
Lines 169-173 Link Here
169
    public short getSid()
170
    public short getSid()
170
    {
171
    {
171
        return this.sid;
172
        return this.sid;
173
    }
174
175
    public Object clone() {
176
      HCenterRecord rec = new HCenterRecord();
177
      rec.field_1_hcenter = field_1_hcenter;
178
      return rec;
172
    }
179
    }
173
}
180
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/HeaderRecord.java (+8 lines)
Lines 64-69 Link Here
64
 * REFERENCE:  PG 321 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
64
 * REFERENCE:  PG 321 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
66
 * @author Shawn Laubach (laubach@acm.org) Modified 3/14/02
66
 * @author Shawn Laubach (laubach@acm.org) Modified 3/14/02
67
 * @author Jason Height (jheight at chariot dot net dot au)
67
 * @version 2.0-pre
68
 * @version 2.0-pre
68
 */
69
 */
69
70
Lines 219-223 Link Here
219
    public short getSid()
220
    public short getSid()
220
    {
221
    {
221
        return this.sid;
222
        return this.sid;
223
    }
224
225
    public Object clone() {
226
      HeaderRecord rec = new HeaderRecord();
227
      rec.field_1_header_len = field_1_header_len;
228
      rec.field_2_header = field_2_header;
229
      return rec;
222
    }
230
    }
223
}
231
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/IndexRecord.java (+12 lines)
Lines 65-70 Link Here
65
 * NOT USED IN THIS RELEASE
65
 * NOT USED IN THIS RELEASE
66
 * REFERENCE:  PG 323 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
66
 * REFERENCE:  PG 323 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
67
 * @author Andrew C. Oliver (acoliver at apache dot org)
67
 * @author Andrew C. Oliver (acoliver at apache dot org)
68
 * @author Jason Height (jheight at chariot dot net dot au)
68
 * @version 2.0-pre
69
 * @version 2.0-pre
69
 */
70
 */
70
71
Lines 224-228 Link Here
224
    public short getSid()
225
    public short getSid()
225
    {
226
    {
226
        return this.sid;
227
        return this.sid;
228
    }
229
230
    public Object clone() {
231
      IndexRecord rec = new IndexRecord();
232
      rec.field_1_zero = field_1_zero;
233
      rec.field_2_first_row = field_2_first_row;
234
      rec.field_3_last_row_add1 = field_3_last_row_add1;
235
      rec.field_4_zero = field_4_zero;
236
      rec.field_5_dbcells = new IntList();
237
      rec.field_5_dbcells.addAll(field_5_dbcells);
238
      return rec;
227
    }
239
    }
228
}
240
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/IterationRecord.java (+7 lines)
Lines 65-70 Link Here
65
 *                a formula!)<P>
65
 *                a formula!)<P>
66
 * REFERENCE:  PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
66
 * REFERENCE:  PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
67
 * @author Andrew C. Oliver (acoliver at apache dot org)
67
 * @author Andrew C. Oliver (acoliver at apache dot org)
68
 * @author Jason Height (jheight at chariot dot net dot au)
68
 * @version 2.0-pre
69
 * @version 2.0-pre
69
 */
70
 */
70
71
Lines 173-177 Link Here
173
    public short getSid()
174
    public short getSid()
174
    {
175
    {
175
        return this.sid;
176
        return this.sid;
177
    }
178
179
    public Object clone() {
180
      IterationRecord rec = new IterationRecord();
181
      rec.field_1_iteration = field_1_iteration;
182
      return rec;
176
    }
183
    }
177
}
184
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/LabelRecord.java (+12 lines)
Lines 68-73 Link Here
68
 * use this (except to read), use LabelSST instead <P>
68
 * use this (except to read), use LabelSST instead <P>
69
 * REFERENCE:  PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
69
 * REFERENCE:  PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
70
 * @author Andrew C. Oliver (acoliver at apache dot org)
70
 * @author Andrew C. Oliver (acoliver at apache dot org)
71
 * @author Jason Height (jheight at chariot dot net dot au)
71
 * @version 2.0-pre
72
 * @version 2.0-pre
72
 * @see org.apache.poi.hssf.record.LabelSSTRecord
73
 * @see org.apache.poi.hssf.record.LabelSSTRecord
73
 */
74
 */
Lines 313-317 Link Here
313
314
314
    public void setXFIndex(short xf)
315
    public void setXFIndex(short xf)
315
    {
316
    {
317
    }
318
319
    public Object clone() {
320
      LabelRecord rec = new LabelRecord();
321
      rec.field_1_row = field_1_row;
322
      rec.field_2_column = field_2_column;
323
      rec.field_3_xf_index = field_3_xf_index;
324
      rec.field_4_string_len = field_4_string_len;
325
      rec.field_5_unicode_flag = field_5_unicode_flag;
326
      rec.field_6_value = field_6_value;
327
      return rec;
316
    }
328
    }
317
}
329
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/LabelSSTRecord.java (+10 lines)
Lines 63-68 Link Here
63
 *               value.  <P>
63
 *               value.  <P>
64
 * REFERENCE:  PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
64
 * REFERENCE:  PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
66
 * @author Jason Height (jheight at chariot dot net dot au)
66
 * @version 2.0-pre
67
 * @version 2.0-pre
67
 */
68
 */
68
69
Lines 330-334 Link Here
330
            return true;
331
            return true;
331
        }
332
        }
332
        return false;
333
        return false;
334
    }
335
336
    public Object clone() {
337
      LabelSSTRecord rec = new LabelSSTRecord();
338
      rec.field_1_row = field_1_row;
339
      rec.field_2_column = field_2_column;
340
      rec.field_3_xf_index = field_3_xf_index;
341
      rec.field_4_sst_index = field_4_sst_index;
342
      return rec;
333
    }
343
    }
334
}
344
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/NumberRecord.java (+10 lines)
Lines 67-72 Link Here
67
 * Contains a numeric cell value. <P>
67
 * Contains a numeric cell value. <P>
68
 * REFERENCE:  PG 334 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
68
 * REFERENCE:  PG 334 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
69
 * @author Andrew C. Oliver (acoliver at apache dot org)
69
 * @author Andrew C. Oliver (acoliver at apache dot org)
70
 * @author Jason Height (jheight at chariot dot net dot au)
70
 * @version 2.0-pre
71
 * @version 2.0-pre
71
 */
72
 */
72
73
Lines 354-358 Link Here
354
            return true;
355
            return true;
355
        }
356
        }
356
        return false;
357
        return false;
358
    }
359
360
    public Object clone() {
361
      NumberRecord rec = new NumberRecord();
362
      rec.field_1_row = field_1_row;
363
      rec.field_2_col = field_2_col;
364
      rec.field_3_xf = field_3_xf;
365
      rec.field_4_value = field_4_value;
366
      return rec;
357
    }
367
    }
358
}
368
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/PrintGridlinesRecord.java (+7 lines)
Lines 62-67 Link Here
62
 * Description:  whether to print the gridlines when you enjoy you spreadsheet on paper.<P>
62
 * Description:  whether to print the gridlines when you enjoy you spreadsheet on paper.<P>
63
 * REFERENCE:  PG 373 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
63
 * REFERENCE:  PG 373 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
64
 * @author Andrew C. Oliver (acoliver at apache dot org)
64
 * @author Andrew C. Oliver (acoliver at apache dot org)
65
 * @author Jason Height (jheight at chariot dot net dot au)
65
 * @version 2.0-pre
66
 * @version 2.0-pre
66
 */
67
 */
67
68
Lines 172-176 Link Here
172
    public short getSid()
173
    public short getSid()
173
    {
174
    {
174
        return this.sid;
175
        return this.sid;
176
    }
177
178
    public Object clone() {
179
      PrintGridlinesRecord rec = new PrintGridlinesRecord();
180
      rec.field_1_print_gridlines = field_1_print_gridlines;
181
      return rec;
175
    }
182
    }
176
}
183
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/PrintHeadersRecord.java (+7 lines)
Lines 63-68 Link Here
63
 *               enjoy your spreadsheet in the physical form.<P>
63
 *               enjoy your spreadsheet in the physical form.<P>
64
 * REFERENCE:  PG 373 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
64
 * REFERENCE:  PG 373 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
66
 * @author Jason Height (jheight at chariot dot net dot au)
66
 * @version 2.0-pre
67
 * @version 2.0-pre
67
 */
68
 */
68
69
Lines 170-174 Link Here
170
    public short getSid()
171
    public short getSid()
171
    {
172
    {
172
        return this.sid;
173
        return this.sid;
174
    }
175
176
    public Object clone() {
177
      PrintHeadersRecord rec = new PrintHeadersRecord();
178
      rec.field_1_print_headers = field_1_print_headers;
179
      return rec;
173
    }
180
    }
174
}
181
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/PrintSetupRecord.java (+17 lines)
Lines 63-68 Link Here
63
 * Description:  Stores print setup options -- bogus for HSSF (and marked as such)<P>
63
 * Description:  Stores print setup options -- bogus for HSSF (and marked as such)<P>
64
 * REFERENCE:  PG 385 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
64
 * REFERENCE:  PG 385 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
66
 * @author Jason Height (jheight at chariot dot net dot au)
66
 * @version 2.0-pre
67
 * @version 2.0-pre
67
 */
68
 */
68
69
Lines 422-426 Link Here
422
    public short getSid()
423
    public short getSid()
423
    {
424
    {
424
        return this.sid;
425
        return this.sid;
426
    }
427
428
    public Object clone() {
429
      PrintSetupRecord rec = new PrintSetupRecord();
430
      rec.field_1_paper_size = field_1_paper_size;
431
      rec.field_2_scale = field_2_scale;
432
      rec.field_3_page_start = field_3_page_start;
433
      rec.field_4_fit_width = field_4_fit_width;
434
      rec.field_5_fit_height = field_5_fit_height;
435
      rec.field_6_options = field_6_options;
436
      rec.field_7_hresolution = field_7_hresolution;
437
      rec.field_8_vresolution = field_8_vresolution;
438
      rec.field_9_headermargin = field_9_headermargin;
439
      rec.field_10_footermargin = field_10_footermargin;
440
      rec.field_11_copies = field_11_copies;
441
      return rec;
425
    }
442
    }
426
}
443
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/RKRecord.java (+10 lines)
Lines 71-76 Link Here
71
 *
71
 *
72
 * REFERENCE:  PG 376 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
72
 * REFERENCE:  PG 376 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
73
 * @author Andrew C. Oliver (acoliver at apache dot org)
73
 * @author Andrew C. Oliver (acoliver at apache dot org)
74
 * @author Jason Height (jheight at chariot dot net dot au)
74
 * @version 2.0-pre
75
 * @version 2.0-pre
75
 * @see org.apache.poi.hssf.record.NumberRecord
76
 * @see org.apache.poi.hssf.record.NumberRecord
76
 */
77
 */
Lines 338-342 Link Here
338
339
339
    public void setXFIndex(short xf)
340
    public void setXFIndex(short xf)
340
    {
341
    {
342
    }
343
344
    public Object clone() {
345
      RKRecord rec = new RKRecord();
346
      rec.field_1_row = field_1_row;
347
      rec.field_2_col = field_2_col;
348
      rec.field_3_xf_index = field_3_xf_index;
349
      rec.field_4_rk_number = field_4_rk_number;
350
      return rec;
341
    }
351
    }
342
}
352
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/Record.java (+5 lines)
Lines 63-68 Link Here
63
 * Company:
63
 * Company:
64
 * @author Andrew C. Oliver
64
 * @author Andrew C. Oliver
65
 * @author Marc Johnson (mjohnson at apache dot org)
65
 * @author Marc Johnson (mjohnson at apache dot org)
66
 * @author Jason Height (jheight at chariot dot net dot au)
66
 * @version 2.0-pre
67
 * @version 2.0-pre
67
 */
68
 */
68
69
Lines 241-244 Link Here
241
     */
242
     */
242
243
243
    public abstract short getSid();
244
    public abstract short getSid();
245
246
    public Object clone() {
247
      throw new RuntimeException("The class "+getClass().getName()+" needs to define a clone method");
248
    }
244
}
249
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/RefModeRecord.java (+7 lines)
Lines 62-67 Link Here
62
 * Description:  Describes which reference mode to use<P>
62
 * Description:  Describes which reference mode to use<P>
63
 * REFERENCE:  PG 376 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
63
 * REFERENCE:  PG 376 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
64
 * @author Andrew C. Oliver (acoliver at apache dot org)
64
 * @author Andrew C. Oliver (acoliver at apache dot org)
65
 * @author Jason Height (jheight at chariot dot net dot au)
65
 * @version 2.0-pre
66
 * @version 2.0-pre
66
 */
67
 */
67
68
Lines 169-173 Link Here
169
    public short getSid()
170
    public short getSid()
170
    {
171
    {
171
        return this.sid;
172
        return this.sid;
173
    }
174
175
    public Object clone() {
176
      RefModeRecord rec = new RefModeRecord();
177
      rec.field_1_mode = field_1_mode;
178
      return rec;
172
    }
179
    }
173
}
180
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/RowRecord.java (+14 lines)
Lines 63-68 Link Here
63
 * Description:  stores the row information for the sheet. <P>
63
 * Description:  stores the row information for the sheet. <P>
64
 * REFERENCE:  PG 379 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
64
 * REFERENCE:  PG 379 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
66
 * @author Jason Height (jheight at chariot dot net dot au)
66
 * @version 2.0-pre
67
 * @version 2.0-pre
67
 */
68
 */
68
69
Lines 511-515 Link Here
511
            return true;
512
            return true;
512
        }
513
        }
513
        return false;
514
        return false;
515
    }
516
517
    public Object clone() {
518
      RowRecord rec = new RowRecord();
519
      rec.field_1_row_number = field_1_row_number;
520
      rec.field_2_first_col = field_2_first_col;
521
      rec.field_3_last_col = field_3_last_col;
522
      rec.field_4_height = field_4_height;
523
      rec.field_5_optimize = field_5_optimize;
524
      rec.field_6_reserved = field_6_reserved;
525
      rec.field_7_option_flags = field_7_option_flags;
526
      rec.field_8_xf_index = field_8_xf_index;
527
      return rec;
514
    }
528
    }
515
}
529
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/SaveRecalcRecord.java (+7 lines)
Lines 62-67 Link Here
62
 * Description:  defines whether to recalculate before saving (set to true)<P>
62
 * Description:  defines whether to recalculate before saving (set to true)<P>
63
 * REFERENCE:  PG 381 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
63
 * REFERENCE:  PG 381 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
64
 * @author Andrew C. Oliver (acoliver at apache dot org)
64
 * @author Andrew C. Oliver (acoliver at apache dot org)
65
 * @author Jason Height (jheight at chariot dot net dot au)
65
 * @version 2.0-pre
66
 * @version 2.0-pre
66
 */
67
 */
67
68
Lines 163-167 Link Here
163
    public short getSid()
164
    public short getSid()
164
    {
165
    {
165
        return this.sid;
166
        return this.sid;
167
    }
168
169
    public Object clone() {
170
      SaveRecalcRecord rec = new SaveRecalcRecord();
171
      rec.field_1_recalc = field_1_recalc;
172
      return rec;
166
    }
173
    }
167
}
174
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/SelectionRecord.java (+12 lines)
Lines 67-72 Link Here
67
 * TODO :  Implement reference subrecords
67
 * TODO :  Implement reference subrecords
68
 * REFERENCE:  PG 291 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
68
 * REFERENCE:  PG 291 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
69
 * @author Andrew C. Oliver (acoliver at apache dot org)
69
 * @author Andrew C. Oliver (acoliver at apache dot org)
70
 * @author Jason Height (jheight at chariot dot net dot au)
70
 * @version 2.0-pre
71
 * @version 2.0-pre
71
 */
72
 */
72
73
Lines 278-282 Link Here
278
    public short getSid()
279
    public short getSid()
279
    {
280
    {
280
        return this.sid;
281
        return this.sid;
282
    }
283
284
    public Object clone() {
285
      SelectionRecord rec = new SelectionRecord();
286
      rec.field_1_pane = field_1_pane;
287
      rec.field_2_row_active_cell = field_2_row_active_cell;
288
      rec.field_3_col_active_cell = field_3_col_active_cell;
289
      rec.field_4_ref_active_cell = field_4_ref_active_cell;
290
      rec.field_5_num_refs = field_5_num_refs;
291
      rec.field_6_refs = field_6_refs;
292
      return rec;
281
    }
293
    }
282
}
294
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/UnknownRecord.java (+11 lines)
Lines 64-69 Link Here
64
 *               don't know all the records to.  (HSSF leaves these alone!) <P>
64
 *               don't know all the records to.  (HSSF leaves these alone!) <P>
65
 * Company:      SuperLink Software, Inc.<P>
65
 * Company:      SuperLink Software, Inc.<P>
66
 * @author Andrew C. Oliver (acoliver at apache dot org)
66
 * @author Andrew C. Oliver (acoliver at apache dot org)
67
 * @author Jason Height (jheight at chariot dot net dot au)
67
 * @version 2.0-pre
68
 * @version 2.0-pre
68
 */
69
 */
69
70
Lines 173-177 Link Here
173
    {
174
    {
174
        throw new RecordFormatException(
175
        throw new RecordFormatException(
175
            "Unknown record cannot be constructed via offset -- we need a copy of the data");
176
            "Unknown record cannot be constructed via offset -- we need a copy of the data");
177
    }
178
179
    /** Unlike the other Record.clone methods this is a shallow clone*/
180
    public Object clone() {
181
      UnknownRecord rec = new UnknownRecord();
182
      rec.offset = offset;
183
      rec.sid = sid;
184
      rec.size = size;
185
      rec.thedata = thedata;
186
      return rec;
176
    }
187
    }
177
}
188
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/VCenterRecord.java (+7 lines)
Lines 62-67 Link Here
62
 * Description:  tells whether to center the sheet between vertical margins<P>
62
 * Description:  tells whether to center the sheet between vertical margins<P>
63
 * REFERENCE:  PG 420 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
63
 * REFERENCE:  PG 420 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
64
 * @author Andrew C. Oliver (acoliver at apache dot org)
64
 * @author Andrew C. Oliver (acoliver at apache dot org)
65
 * @author Jason Height (jheight at chariot dot net dot au)
65
 * @version 2.0-pre
66
 * @version 2.0-pre
66
 */
67
 */
67
68
Lines 169-173 Link Here
169
    public short getSid()
170
    public short getSid()
170
    {
171
    {
171
        return this.sid;
172
        return this.sid;
173
    }
174
175
    public Object clone() {
176
      VCenterRecord rec = new VCenterRecord();
177
      rec.field_1_vcenter = field_1_vcenter;
178
      return rec;
172
    }
179
    }
173
}
180
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/WSBoolRecord.java (+8 lines)
Lines 65-70 Link Here
65
 * REFERENCE:  PG 425 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
65
 * REFERENCE:  PG 425 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
66
 * @author Andrew C. Oliver (acoliver at apache dot org)
66
 * @author Andrew C. Oliver (acoliver at apache dot org)
67
 * @author Glen Stampoultzis (gstamp@iprimus.com.au)
67
 * @author Glen Stampoultzis (gstamp@iprimus.com.au)
68
 * @author Jason Height (jheight at chariot dot net dot au)
68
 * @version 2.0-pre
69
 * @version 2.0-pre
69
 */
70
 */
70
71
Lines 414-418 Link Here
414
    public short getSid()
415
    public short getSid()
415
    {
416
    {
416
        return this.sid;
417
        return this.sid;
418
    }
419
420
    public Object clone() {
421
      WSBoolRecord rec = new WSBoolRecord();
422
      rec.field_1_wsbool = field_1_wsbool;
423
      rec.field_2_wsbool = field_2_wsbool;
424
      return rec;
417
    }
425
    }
418
}
426
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/WindowTwoRecord.java (+13 lines)
Lines 63-68 Link Here
63
 * Description:  sheet window settings<P>
63
 * Description:  sheet window settings<P>
64
 * REFERENCE:  PG 422 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
64
 * REFERENCE:  PG 422 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
65
 * @author Andrew C. Oliver (acoliver at apache dot org)
66
 * @author Jason Height (jheight at chariot dot net dot au)
66
 * @version 2.0-pre
67
 * @version 2.0-pre
67
 */
68
 */
68
69
Lines 614-618 Link Here
614
    public short getSid()
615
    public short getSid()
615
    {
616
    {
616
        return this.sid;
617
        return this.sid;
618
    }
619
620
    public Object clone() {
621
      WindowTwoRecord rec = new WindowTwoRecord();
622
      rec.field_1_options = field_1_options;
623
      rec.field_2_top_row = field_2_top_row;
624
      rec.field_3_left_col = field_3_left_col;
625
      rec.field_4_header_color = field_4_header_color;
626
      rec.field_5_page_break_zoom = field_5_page_break_zoom;
627
      rec.field_6_normal_zoom = field_6_normal_zoom;
628
      rec.field_7_reserved = field_7_reserved;
629
      return rec;
617
    }
630
    }
618
}
631
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java (+12 lines)
Lines 67-72 Link Here
67
/**
67
/**
68
 *
68
 *
69
 * @author  andy
69
 * @author  andy
70
 * @author Jason Height (jheight at chariot dot net dot au)
70
 */
71
 */
71
72
72
public class RowRecordsAggregate
73
public class RowRecordsAggregate
Lines 219-223 Link Here
219
        return records.values().iterator();
220
        return records.values().iterator();
220
    }
221
    }
221
    
222
    
223
    /** Performs a deep clone of the record*/
224
    public Object clone() {
225
      RowRecordsAggregate rec = new RowRecordsAggregate();
226
      for (Iterator rowIter = getIterator(); rowIter.hasNext();) {
227
        //return the cloned Row Record & insert
228
        RowRecord row = (RowRecord)((RowRecord)rowIter.next()).clone();
229
        rec.insertRow(row);
230
      }
231
      return rec;
232
    }
233
222
}
234
}
223
235
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java (+11 lines)
Lines 67-72 Link Here
67
 *
67
 *
68
 * @author  andy
68
 * @author  andy
69
 * @author  Glen Stampoultzis (glens at apache.org)
69
 * @author  Glen Stampoultzis (glens at apache.org)
70
 * @author Jason Height (jheight at chariot dot net dot au)
70
 */
71
 */
71
72
72
public class ValueRecordsAggregate
73
public class ValueRecordsAggregate
Lines 234-239 Link Here
234
    public Iterator getIterator()
235
    public Iterator getIterator()
235
    {
236
    {
236
        return records.values().iterator();
237
        return records.values().iterator();
238
    }
239
240
    /** Performs a deep clone of the record*/
241
    public Object clone() {
242
      ValueRecordsAggregate rec = new ValueRecordsAggregate();
243
      for (Iterator valIter = getIterator(); valIter.hasNext();) {
244
        CellValueRecordInterface val = (CellValueRecordInterface)((CellValueRecordInterface)valIter.next()).clone();
245
        rec.insertCell(val);
246
      }
247
      return rec;
237
    }
248
    }
238
}
249
}
239
250
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/AddPtg.java (+5 lines)
Lines 68-73 Link Here
68
 * Addition operator PTG the "+" binomial operator.  If you need more 
68
 * Addition operator PTG the "+" binomial operator.  If you need more 
69
 * explanation than that then well...We really can't help you here.
69
 * explanation than that then well...We really can't help you here.
70
 * @author  Andrew C. Oliver (acoliver@apache.org)
70
 * @author  Andrew C. Oliver (acoliver@apache.org)
71
 * @author Jason Height (jheight at chariot dot net dot au)
71
 */
72
 */
72
73
73
public class AddPtg
74
public class AddPtg
Lines 129-132 Link Here
129
    
130
    
130
    public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
131
    public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
131
           
132
           
133
    public Object clone() {
134
      return new AddPtg();
135
    }
136
132
}
137
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java (+11 lines)
Lines 70-75 Link Here
70
 * REFERENCE:  <P>
70
 * REFERENCE:  <P>
71
 * @author Libin Roman (Vista Portal LDT. Developer)
71
 * @author Libin Roman (Vista Portal LDT. Developer)
72
 * @author avik
72
 * @author avik
73
 * @author Jason Height (jheight at chariot dot net dot au)
73
 * @version 1.0-pre
74
 * @version 1.0-pre
74
 */
75
 */
75
76
Lines 302-307 Link Here
302
303
303
   public byte getDefaultOperandClass() {
304
   public byte getDefaultOperandClass() {
304
       return Ptg.CLASS_REF;
305
       return Ptg.CLASS_REF;
306
   }
307
308
   public Object clone() {
309
     Area3DPtg ptg = new Area3DPtg();
310
     ptg.field_1_index_extern_sheet = field_1_index_extern_sheet;
311
     ptg.field_2_first_row = field_2_first_row;
312
     ptg.field_3_last_row = field_3_last_row;
313
     ptg.field_4_first_column = field_4_first_column;
314
     ptg.field_5_last_column = field_5_last_column;
315
     return ptg;
305
   }
316
   }
306
317
307
}
318
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/AreaPtg.java (-1 / +13 lines)
Lines 70-75 Link Here
70
/**
70
/**
71
 * Specifies a rectangular area of cells A1:A4 for instance.
71
 * Specifies a rectangular area of cells A1:A4 for instance.
72
 * @author  andy
72
 * @author  andy
73
 * @author Jason Height (jheight at chariot dot net dot au)
73
 */
74
 */
74
75
75
public class AreaPtg
76
public class AreaPtg
Lines 86-92 Link Here
86
    private BitField         colRelative = new BitField(0x4000);
87
    private BitField         colRelative = new BitField(0x4000);
87
    private BitField         column      = new BitField(0x3FFF);
88
    private BitField         column      = new BitField(0x3FFF);
88
89
89
    
90
    private AreaPtg() {
91
      //Required for clone methods
92
    }
90
   
93
   
91
    public AreaPtg(String arearef) {
94
    public AreaPtg(String arearef) {
92
        AreaReference ar = new AreaReference(arearef);
95
        AreaReference ar = new AreaReference(arearef);
Lines 312-315 Link Here
312
        return Ptg.CLASS_REF;
315
        return Ptg.CLASS_REF;
313
    }
316
    }
314
    
317
    
318
    public Object clone() {
319
      AreaPtg ptg = new AreaPtg();
320
      ptg.field_1_first_row = field_1_first_row;
321
      ptg.field_2_last_row = field_2_last_row;
322
      ptg.field_3_first_column = field_3_first_column;
323
      ptg.field_4_last_column = field_4_last_column;
324
      return ptg;
325
    }
326
315
}
327
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/AttrPtg.java (+8 lines)
Lines 72-77 Link Here
72
 * This seems to be a Misc Stuff and Junk record.  One function it serves is
72
 * This seems to be a Misc Stuff and Junk record.  One function it serves is
73
 * in SUM functions (i.e. SUM(A1:A3) causes an area PTG then an ATTR with the SUM option set)
73
 * in SUM functions (i.e. SUM(A1:A3) causes an area PTG then an ATTR with the SUM option set)
74
 * @author  andy
74
 * @author  andy
75
 * @author Jason Height (jheight at chariot dot net dot au)
75
 */
76
 */
76
77
77
public class AttrPtg
78
public class AttrPtg
Lines 241-244 Link Here
241
    
242
    
242
 
243
 
243
    public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
244
    public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
245
246
    public Object clone() {
247
      AttrPtg ptg = new AttrPtg();
248
      ptg.field_1_options = field_1_options;
249
      ptg.field_2_data = field_2_data;
250
      return ptg;
251
    }
244
}
252
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/ConcatPtg.java (+5 lines)
Lines 67-72 Link Here
67
/**
67
/**
68
 *
68
 *
69
 * @author  andy
69
 * @author  andy
70
 * @author Jason Height (jheight at chariot dot net dot au)
70
 */
71
 */
71
72
72
public class ConcatPtg
73
public class ConcatPtg
Lines 122-125 Link Here
122
        return buffer.toString();
123
        return buffer.toString();
123
    }
124
    }
124
           
125
           
126
    public Object clone() {
127
      return new ConcatPtg();
128
    }
129
125
}
130
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/DividePtg.java (+6 lines)
Lines 67-72 Link Here
67
/**
67
/**
68
 * This PTG implements the standard binomial divide "/"
68
 * This PTG implements the standard binomial divide "/"
69
 * @author  Andrew C. Oliver acoliver at apache dot org
69
 * @author  Andrew C. Oliver acoliver at apache dot org
70
 * @author Jason Height (jheight at chariot dot net dot au)
70
 */
71
 */
71
72
72
public class DividePtg
73
public class DividePtg
Lines 120-123 Link Here
120
        buffer.append(operands[ 1 ]);
121
        buffer.append(operands[ 1 ]);
121
        return buffer.toString();
122
        return buffer.toString();
122
    }      
123
    }      
124
125
    public Object clone() {
126
      DividePtg ptg = new DividePtg();
127
      return ptg;
128
    }
123
}
129
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/ExpPtg.java (+5 lines)
Lines 65-70 Link Here
65
/**
65
/**
66
 *
66
 *
67
 * @author  andy
67
 * @author  andy
68
 * @author Jason Height (jheight at chariot dot net dot au)
68
 */
69
 */
69
70
70
public class ExpPtg
71
public class ExpPtg
Lines 101-104 Link Here
101
    
102
    
102
    public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
103
    public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
103
    
104
    
105
    public Object clone() {
106
      throw new RuntimeException("NO IDEA SHARED FORMULA EXP PTG");
107
    }
108
104
}
109
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/FuncPtg.java (+16 lines)
Lines 1-10 Link Here
1
package org.apache.poi.hssf.record.formula;
1
package org.apache.poi.hssf.record.formula;
2
import org.apache.poi.util.LittleEndian;
2
import org.apache.poi.util.LittleEndian;
3
3
4
/**
5
 *
6
 * @author Jason Height (jheight at chariot dot net dot au)
7
 */
4
public class FuncPtg extends AbstractFunctionPtg{
8
public class FuncPtg extends AbstractFunctionPtg{
5
    
9
    
6
    public final static byte sid  = 0x21;
10
    public final static byte sid  = 0x21;
7
    private int numParams=0;
11
    private int numParams=0;
12
13
    private FuncPtg() {
14
      //Required for clone methods
15
    }
16
8
    /**Creates new function pointer from a byte array 
17
    /**Creates new function pointer from a byte array 
9
     * usually called while reading an excel file. 
18
     * usually called while reading an excel file. 
10
     */
19
     */
Lines 27-31 Link Here
27
    
36
    
28
     public int getNumberOfOperands() {
37
     public int getNumberOfOperands() {
29
        return numParams;
38
        return numParams;
39
    }
40
41
    public Object clone() {
42
      FuncPtg ptg = new FuncPtg();
43
      ptg.field_1_num_args = field_1_num_args;
44
      ptg.field_2_fnc_index = field_2_fnc_index;
45
      return ptg;
30
    }
46
    }
31
}
47
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/FuncVarPtg.java (+16 lines)
Lines 1-9 Link Here
1
package org.apache.poi.hssf.record.formula;
1
package org.apache.poi.hssf.record.formula;
2
import org.apache.poi.util.LittleEndian;
2
import org.apache.poi.util.LittleEndian;
3
4
/**
5
 *
6
 * @author Jason Height (jheight at chariot dot net dot au)
7
 */
3
public class FuncVarPtg extends AbstractFunctionPtg{
8
public class FuncVarPtg extends AbstractFunctionPtg{
4
    
9
    
5
    public final static byte sid  = 0x22;
10
    public final static byte sid  = 0x22;
6
    
11
    
12
    private FuncVarPtg() {
13
      //Required for clone methods
14
    }
15
7
 /**Creates new function pointer from a byte array 
16
 /**Creates new function pointer from a byte array 
8
     * usually called while reading an excel file. 
17
     * usually called while reading an excel file. 
9
     */
18
     */
Lines 38-42 Link Here
38
        return field_1_num_args;
47
        return field_1_num_args;
39
    }
48
    }
40
    
49
    
50
    public Object clone() {
51
      FuncVarPtg ptg = new FuncVarPtg();
52
      ptg.field_1_num_args = field_1_num_args;
53
      ptg.field_2_fnc_index = field_2_fnc_index;
54
      return ptg;
55
    }
56
41
    
57
    
42
}
58
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/IntPtg.java (+11 lines)
Lines 67-72 Link Here
67
 * Integer (short intger)
67
 * Integer (short intger)
68
 * Stores a (java) short value in a formula
68
 * Stores a (java) short value in a formula
69
 * @author  Andrew C. Oliver (acoliver at apache dot org)
69
 * @author  Andrew C. Oliver (acoliver at apache dot org)
70
 * @author Jason Height (jheight at chariot dot net dot au)
70
 */
71
 */
71
72
72
public class IntPtg
73
public class IntPtg
Lines 79-84 Link Here
79
    private String val;
80
    private String val;
80
    private int strlen = 0;
81
    private int strlen = 0;
81
  
82
  
83
    private IntPtg() {
84
      //Required for clone methods
85
    }
86
82
    public IntPtg(byte [] data, int offset)
87
    public IntPtg(byte [] data, int offset)
83
    {
88
    {
84
        setValue(LittleEndian.getShort(data, offset + 1));
89
        setValue(LittleEndian.getShort(data, offset + 1));
Lines 116-119 Link Here
116
        return "" + getValue();
121
        return "" + getValue();
117
    }
122
    }
118
 public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}   
123
 public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}   
124
125
   public Object clone() {
126
     IntPtg ptg = new IntPtg();
127
     ptg.field_1_value = field_1_value;
128
     return ptg;
129
   }
119
}
130
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/MemErrPtg.java (+8 lines)
Lines 66-71 Link Here
66
/**
66
/**
67
 *
67
 *
68
 * @author  andy
68
 * @author  andy
69
 * @author Jason Height (jheight at chariot dot net dot au)
69
 */
70
 */
70
71
71
public class MemErrPtg
72
public class MemErrPtg
Lines 122-125 Link Here
122
        return "ERR#";
123
        return "ERR#";
123
    }
124
    }
124
    public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
125
    public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
126
127
    public Object clone() {
128
      MemErrPtg ptg = new MemErrPtg();
129
      ptg.field_1_reserved = field_1_reserved;
130
      ptg.field_2_subex_len = field_2_subex_len;
131
      return ptg;
132
    }
125
}
133
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/MissingArgPtg.java (+5 lines)
Lines 60-65 Link Here
60
 * Missing Function Arguments
60
 * Missing Function Arguments
61
 *
61
 *
62
 * Avik Sengupta <avik at apache.org>
62
 * Avik Sengupta <avik at apache.org>
63
 * @author Jason Height (jheight at chariot dot net dot au)
63
 */
64
 */
64
public class MissingArgPtg
65
public class MissingArgPtg
65
    extends  Ptg
66
    extends  Ptg
Lines 97-102 Link Here
97
    
98
    
98
    public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
99
    public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
99
        
100
        
101
    public Object clone() {
102
      return new MissingArgPtg();
103
    }
104
100
}
105
}
101
106
102
107
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/MultiplyPtg.java (+5 lines)
Lines 66-71 Link Here
66
/**
66
/**
67
 * Implements the standard mathmatical multiplication - *
67
 * Implements the standard mathmatical multiplication - *
68
 * @author  Andrew C. Oliver (acoliver at apache dot org)
68
 * @author  Andrew C. Oliver (acoliver at apache dot org)
69
 * @author Jason Height (jheight at chariot dot net dot au)
69
 */
70
 */
70
71
71
public class MultiplyPtg
72
public class MultiplyPtg
Lines 136-139 Link Here
136
        buffer.append(operands[ 1 ]);
137
        buffer.append(operands[ 1 ]);
137
        return buffer.toString();
138
        return buffer.toString();
138
    }                  
139
    }                  
140
141
    public Object clone() {
142
      return new MultiplyPtg();
143
    }
139
}
144
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/NamePtg.java (+14 lines)
Lines 66-71 Link Here
66
/**
66
/**
67
 *
67
 *
68
 * @author  andy
68
 * @author  andy
69
 * @author Jason Height (jheight at chariot dot net dot au)
69
 */
70
 */
70
71
71
public class NamePtg
72
public class NamePtg
Lines 77-82 Link Here
77
    private short             field_2_label_index;
78
    private short             field_2_label_index;
78
    private short             field_3_zero;   // reserved must be 0
79
    private short             field_3_zero;   // reserved must be 0
79
80
81
82
    private NamePtg() {
83
      //Required for clone methods
84
    }
85
80
    /** Creates new NamePtg */
86
    /** Creates new NamePtg */
81
87
82
    public NamePtg(String name)
88
    public NamePtg(String name)
Lines 109-112 Link Here
109
    }
115
    }
110
    
116
    
111
    public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
117
    public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
118
119
    public Object clone() {
120
      NamePtg ptg = new NamePtg();
121
      ptg.field_1_ixti = field_1_ixti;
122
      ptg.field_2_label_index = field_2_label_index;
123
      ptg.field_3_zero = field_3_zero;
124
      return ptg;
125
    }
112
}
126
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/NumberPtg.java (+10 lines)
Lines 61-66 Link Here
61
 * Stores a floating point value in a formula
61
 * Stores a floating point value in a formula
62
 * value stored in a 8 byte field using IEEE notation
62
 * value stored in a 8 byte field using IEEE notation
63
 * @author  Avik Sengupta
63
 * @author  Avik Sengupta
64
 * @author Jason Height (jheight at chariot dot net dot au)
64
 */
65
 */
65
66
66
public class NumberPtg
67
public class NumberPtg
Lines 70-75 Link Here
70
    public final static byte sid  = 0x1f;
71
    public final static byte sid  = 0x1f;
71
    private double            field_1_value;
72
    private double            field_1_value;
72
73
74
    private NumberPtg() {
75
      //Required for clone methods
76
    }
73
        
77
        
74
    /** Create a NumberPtg from a byte array read from disk */
78
    /** Create a NumberPtg from a byte array read from disk */
75
    public NumberPtg(byte [] data, int offset)
79
    public NumberPtg(byte [] data, int offset)
Lines 114-118 Link Here
114
        return "" + getValue();
118
        return "" + getValue();
115
    }
119
    }
116
       public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
120
       public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
121
122
    public Object clone() {
123
      NumberPtg ptg = new NumberPtg();
124
      ptg.field_1_value = field_1_value;
125
      return ptg;
126
    }
117
}
127
}
118
128
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/ParenthesisPtg.java (+5 lines)
Lines 66-71 Link Here
66
 *
66
 *
67
 * Avik Sengupta <lists@aviksengupta.com>
67
 * Avik Sengupta <lists@aviksengupta.com>
68
 * Andrew C. Oliver (acoliver at apache dot org)
68
 * Andrew C. Oliver (acoliver at apache dot org)
69
 * @author Jason Height (jheight at chariot dot net dot au)
69
 */
70
 */
70
public class ParenthesisPtg
71
public class ParenthesisPtg
71
    extends OperationPtg
72
    extends OperationPtg
Lines 118-122 Link Here
118
    
119
    
119
    public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
120
    public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
120
        
121
        
122
    public Object clone() {
123
      return new ParenthesisPtg();
124
    }
125
121
}
126
}
122
127
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/PowerPtg.java (+5 lines)
Lines 67-72 Link Here
67
/**
67
/**
68
 *
68
 *
69
 * @author  andy
69
 * @author  andy
70
 * @author Jason Height (jheight at chariot dot net dot au)
70
 */
71
 */
71
72
72
public class PowerPtg
73
public class PowerPtg
Lines 121-125 Link Here
121
        buffer.append(operands[ 1 ]);
122
        buffer.append(operands[ 1 ]);
122
        return buffer.toString();
123
        return buffer.toString();
123
    }       
124
    }       
125
126
    public Object clone() {
127
      return new PowerPtg();
128
    }
124
129
125
}
130
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/Ptg.java (+3 lines)
Lines 69-74 Link Here
69
 *
69
 *
70
 * @author  andy
70
 * @author  andy
71
 * @author avik
71
 * @author avik
72
 * @author Jason Height (jheight at chariot dot net dot au)
72
 */
73
 */
73
74
74
public abstract class Ptg
75
public abstract class Ptg
Lines 330-335 Link Here
330
    
331
    
331
    public abstract byte getDefaultOperandClass();
332
    public abstract byte getDefaultOperandClass();
332
333
334
    public abstract Object clone();
335
333
    
336
    
334
    
337
    
335
}
338
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java (+9 lines)
Lines 69-74 Link Here
69
 * Description:  Defined a cell in extern sheet. <P>
69
 * Description:  Defined a cell in extern sheet. <P>
70
 * REFERENCE:  <P>
70
 * REFERENCE:  <P>
71
 * @author Libin Roman (Vista Portal LDT. Developer)
71
 * @author Libin Roman (Vista Portal LDT. Developer)
72
 * @author Jason Height (jheight at chariot dot net dot au)
72
 * @version 1.0-pre
73
 * @version 1.0-pre
73
 */
74
 */
74
75
Lines 203-207 Link Here
203
    }
204
    }
204
205
205
   public byte getDefaultOperandClass() {return Ptg.CLASS_REF;}
206
   public byte getDefaultOperandClass() {return Ptg.CLASS_REF;}
207
208
   public Object clone() {
209
     Ref3DPtg ptg = new Ref3DPtg();
210
     ptg.field_1_index_extern_sheet = field_1_index_extern_sheet;
211
     ptg.field_2_row = field_2_row;
212
     ptg.field_3_column = field_3_column;
213
     return ptg;
214
   }
206
215
207
}
216
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/ReferencePtg.java (-1 / +10 lines)
Lines 69-74 Link Here
69
/**
69
/**
70
 * ReferencePtg - handles references (such as A1, A2, IA4)
70
 * ReferencePtg - handles references (such as A1, A2, IA4)
71
 * @author  Andrew C. Oliver (acoliver@apache.org)
71
 * @author  Andrew C. Oliver (acoliver@apache.org)
72
 * @author Jason Height (jheight at chariot dot net dot au)
72
 */
73
 */
73
74
74
public class ReferencePtg extends Ptg
75
public class ReferencePtg extends Ptg
Lines 81-87 Link Here
81
    private BitField         rowRelative = new BitField(0x8000);
82
    private BitField         rowRelative = new BitField(0x8000);
82
    private BitField         colRelative = new BitField(0x4000);
83
    private BitField         colRelative = new BitField(0x4000);
83
84
84
    
85
    private ReferencePtg() {
86
      //Required for clone methods
87
    }
85
    
88
    
86
    /**
89
    /**
87
     * Takes in a String represnetation of a cell reference and fills out the 
90
     * Takes in a String represnetation of a cell reference and fills out the 
Lines 186-189 Link Here
186
        return Ptg.CLASS_REF;
189
        return Ptg.CLASS_REF;
187
    }
190
    }
188
    
191
    
192
    public Object clone() {
193
      ReferencePtg ptg = new ReferencePtg();
194
      ptg.field_1_row = field_1_row;
195
      ptg.field_2_col = field_2_col;
196
      return ptg;
197
    }
189
}
198
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/StringPtg.java (+10 lines)
Lines 62-67 Link Here
62
 * Number
62
 * Number
63
 * Stores a String value in a formula value stored in the format <length 2 bytes>char[]
63
 * Stores a String value in a formula value stored in the format <length 2 bytes>char[]
64
 * @author  Werner Froidevaux
64
 * @author  Werner Froidevaux
65
 * @author Jason Height (jheight at chariot dot net dot au)
65
 */
66
 */
66
67
67
public class StringPtg
68
public class StringPtg
Lines 71-76 Link Here
71
    public final static byte sid  = 0x17;
72
    public final static byte sid  = 0x17;
72
    private String            field_1_value;
73
    private String            field_1_value;
73
74
75
    private StringPtg() {
76
      //Required for clone methods
77
    }
74
78
75
    /** Create a StringPtg from a byte array read from disk */
79
    /** Create a StringPtg from a byte array read from disk */
76
    public StringPtg(byte [] data, int offset)
80
    public StringPtg(byte [] data, int offset)
Lines 118-123 Link Here
118
    }
122
    }
119
    public byte getDefaultOperandClass() {
123
    public byte getDefaultOperandClass() {
120
       return Ptg.CLASS_VALUE;
124
       return Ptg.CLASS_VALUE;
125
   }
126
127
   public Object clone() {
128
     StringPtg ptg = new StringPtg();
129
     ptg.field_1_value = field_1_value;
130
     return ptg;
121
   }
131
   }
122
132
123
}
133
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/SubtractPtg.java (+5 lines)
Lines 66-71 Link Here
66
/**
66
/**
67
 *
67
 *
68
 * @author  andy
68
 * @author  andy
69
 * @author Jason Height (jheight at chariot dot net dot au)
69
 */
70
 */
70
71
71
public class SubtractPtg
72
public class SubtractPtg
Lines 117-121 Link Here
117
        buffer.append("-");
118
        buffer.append("-");
118
        buffer.append(operands[ 1 ]);
119
        buffer.append(operands[ 1 ]);
119
        return buffer.toString();
120
        return buffer.toString();
121
    }
122
123
    public Object clone() {
124
      return new SubtractPtg();
120
    }
125
    }
121
}
126
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/record/formula/UnknownPtg.java (+5 lines)
Lines 65-70 Link Here
65
/**
65
/**
66
 *
66
 *
67
 * @author  andy
67
 * @author  andy
68
 * @author Jason Height (jheight at chariot dot net dot au)
68
 */
69
 */
69
70
70
public class UnknownPtg
71
public class UnknownPtg
Lines 99-103 Link Here
99
    }
100
    }
100
    public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
101
    public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;}
101
102
103
    public Object clone() {
104
      return new UnknownPtg();
105
    }
106
102
    
107
    
103
}
108
}
(-)jakarta-poi/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java (+4 lines)
Lines 143-148 Link Here
143
        setPropertiesFromSheet(sheet);
143
        setPropertiesFromSheet(sheet);
144
    }
144
    }
145
145
146
    HSSFSheet cloneSheet(Workbook book) {
147
      return new HSSFSheet(book, sheet.cloneSheet());
148
    }
149
146
150
147
    /**
151
    /**
148
     * used internally to set the properties given a Sheet object
152
     * used internally to set the properties given a Sheet object
(-)jakarta-poi/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java (+22 lines)
Lines 273-278 Link Here
273
    }
273
    }
274
274
275
    /**
275
    /**
276
     * create an HSSFSheet from an existing sheet in the HSSFWorkbook.
277
     *
278
     * @return HSSFSheet representing the cloned sheet.
279
     */
280
281
    public HSSFSheet cloneSheet(int sheetNum) {
282
      HSSFSheet srcSheet = (HSSFSheet)sheets.get(sheetNum);
283
      String srcName = workbook.getSheetName(sheetNum);
284
      if (srcSheet != null) {
285
        HSSFSheet clonedSheet = srcSheet.cloneSheet(workbook);
286
        WindowTwoRecord windowTwo = (WindowTwoRecord) clonedSheet.getSheet().findFirstRecordBySid(WindowTwoRecord.sid);
287
        windowTwo.setSelected(sheets.size() == 1);
288
        windowTwo.setPaged(sheets.size() == 1);
289
290
        sheets.add(clonedSheet);
291
        workbook.setSheetName(sheets.size()-1, srcName+"[1]");
292
        return clonedSheet;
293
      }
294
      return null;
295
    }
296
297
    /**
276
     * create an HSSFSheet for this HSSFWorkbook, adds it to the sheets and returns
298
     * create an HSSFSheet for this HSSFWorkbook, adds it to the sheets and returns
277
     * the high level representation.  Use this to create new sheets.
299
     * the high level representation.  Use this to create new sheets.
278
     *
300
     *
(-)jakarta-poi/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java (+16 lines)
Lines 199-202 Link Here
199
        sheet.removeRow(row);
199
        sheet.removeRow(row);
200
    }
200
    }
201
201
202
    public void testCloneSheet() {
203
        HSSFWorkbook workbook = new HSSFWorkbook();
204
        HSSFSheet sheet = workbook.createSheet("Test Clone");
205
        HSSFRow row = sheet.createRow((short) 0);
206
        HSSFCell cell = row.createCell((short) 0);
207
        cell.setCellValue("clone_test"); 
208
        HSSFSheet cloned = workbook.cloneSheet(0);
209
  
210
        //Check for a good clone
211
        assertEquals(cloned.getRow((short)0).getCell((short)0).getStringCellValue(), "clone_test");
212
        
213
        //Check that the cells are not somehow linked
214
        cell.setCellValue("Difference Check");
215
        assertEquals(cloned.getRow((short)0).getCell((short)0).getStringCellValue(), "clone_test");
216
    }
217
202
}
218
}

Return to bug 11721