01: /* ====================================================================
02: Licensed to the Apache Software Foundation (ASF) under one or more
03: contributor license agreements. See the NOTICE file distributed with
04: this work for additional information regarding copyright ownership.
05: The ASF licenses this file to You under the Apache License, Version 2.0
06: (the "License"); you may not use this file except in compliance with
07: the License. You may obtain a copy of the License at
08:
09: http://www.apache.org/licenses/LICENSE-2.0
10:
11: Unless required by applicable law or agreed to in writing, software
12: distributed under the License is distributed on an "AS IS" BASIS,
13: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: See the License for the specific language governing permissions and
15: limitations under the License.
16: ==================================================================== */
17:
18: package org.apache.poi.hssf.record.formula;
19:
20: import org.apache.poi.util.LittleEndian;
21: import org.apache.poi.util.BitField;
22: import org.apache.poi.util.BitFieldFactory;
23: import org.apache.poi.util.StringUtil;
24:
25: import org.apache.poi.hssf.util.CellReference;
26: import org.apache.poi.hssf.model.Workbook;
27: import org.apache.poi.hssf.record.RecordFormatException;
28: import org.apache.poi.hssf.record.RecordInputStream;
29: import org.apache.poi.hssf.record.SSTRecord;
30: import org.apache.poi.hssf.record.UnicodeString;
31:
32: /**
33: * ArrayPtg - handles arrays
34: *
35: * The ArrayPtg is a little wierd, the size of the Ptg when parsing initially only
36: * includes the Ptg sid and the reserved bytes. The next Ptg in the expression then follows.
37: * It is only after the "size" of all the Ptgs is met, that the ArrayPtg data is actually
38: * held after this. So Ptg.createParsedExpression keeps track of the number of
39: * ArrayPtg elements and need to parse the data upto the FORMULA record size.
40: *
41: * @author Jason Height (jheight at chariot dot net dot au)
42: */
43:
44: public class ArrayPtgV extends ArrayPtg {
45: public final static byte sid = 0x40;
46:
47: protected ArrayPtgV() {
48: //Required for clone methods
49: }
50:
51: public ArrayPtgV(RecordInputStream in) {
52: super (in);
53: }
54:
55: public Object clone() {
56: ArrayPtgV ptg = new ArrayPtgV();
57: ptg.field_1_reserved = field_1_reserved;
58: ptg.field_2_reserved = field_2_reserved;
59: ptg.field_3_reserved = field_3_reserved;
60: ptg.field_4_reserved = field_4_reserved;
61: ptg.field_5_reserved = field_5_reserved;
62: ptg.field_6_reserved = field_6_reserved;
63: ptg.field_7_reserved = field_7_reserved;
64:
65: ptg.token_1_columns = token_1_columns;
66: ptg.token_2_rows = token_2_rows;
67: ptg.token_3_arrayValues = new Object[getColumnCount()][getRowCount()];
68: for (int x = 0; x < getColumnCount(); x++) {
69: for (int y = 0; y < getRowCount(); y++) {
70: ptg.token_3_arrayValues[x][y] = token_3_arrayValues[x][y];
71: }
72: }
73: ptg.setClass(ptgClass);
74: return ptg;
75: }
76: }
|