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

(-)src/java/org/apache/poi/hssf/dev/BiffViewer.java (+18 lines)
Lines 32-37 Link Here
32
32
33
import org.apache.poi.hssf.record.*;
33
import org.apache.poi.hssf.record.*;
34
import org.apache.poi.hssf.record.chart.*;
34
import org.apache.poi.hssf.record.chart.*;
35
import org.apache.poi.hssf.record.pivottable.*;
35
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
36
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
36
import org.apache.poi.util.HexDump;
37
import org.apache.poi.util.HexDump;
37
import org.apache.poi.util.LittleEndian;
38
import org.apache.poi.util.LittleEndian;
Lines 210-215 Link Here
210
			case StyleRecord.sid:          return new StyleRecord(in);
211
			case StyleRecord.sid:          return new StyleRecord(in);
211
			case SupBookRecord.sid:        return new SupBookRecord(in);
212
			case SupBookRecord.sid:        return new SupBookRecord(in);
212
			case TabIdRecord.sid:          return new TabIdRecord(in);
213
			case TabIdRecord.sid:          return new TabIdRecord(in);
214
			case TableStylesRecord.sid:	   return new TableStylesRecord(in);	
213
			case TableRecord.sid:          return new TableRecord(in);
215
			case TableRecord.sid:          return new TableRecord(in);
214
			case TextObjectRecord.sid:     return new TextObjectRecord(in);
216
			case TextObjectRecord.sid:     return new TextObjectRecord(in);
215
			case TextRecord.sid:           return new TextRecord(in);
217
			case TextRecord.sid:           return new TextRecord(in);
Lines 227-232 Link Here
227
			case WriteAccessRecord.sid:    return new WriteAccessRecord(in);
229
			case WriteAccessRecord.sid:    return new WriteAccessRecord(in);
228
			case WriteProtectRecord.sid:   return new WriteProtectRecord(in);        
230
			case WriteProtectRecord.sid:   return new WriteProtectRecord(in);        
229
		
231
		
232
			// chart
233
			case CatLabRecord.sid: 		   return new CatLabRecord(in);
234
			case ChartEndBlockRecord.sid:  return new ChartEndBlockRecord(in);
235
			case ChartEndObjectRecord.sid: return new ChartEndObjectRecord(in);
236
			case ChartFRTInfoRecord.sid:   return new ChartFRTInfoRecord(in);
237
			case ChartStartBlockRecord.sid: return new ChartStartBlockRecord(in);
238
			case ChartStartObjectRecord.sid: return new ChartStartObjectRecord(in);
239
			
240
			// pivot table
241
			case StreamIDRecord.sid: 		return new StreamIDRecord(in);
242
			case ViewSourceRecord.sid: 		return new ViewSourceRecord(in);
243
			case PageItemRecord.sid:		return new PageItemRecord(in);
244
			case ViewDefinitionRecord.sid:	return new ViewDefinitionRecord(in);
245
			case ViewFieldsRecord.sid: 		return new ViewFieldsRecord(in);
246
			case DataItemRecord.sid: 		return new DataItemRecord(in);
247
			case ExtendedPivotTableViewFieldsRecord.sid: return new ExtendedPivotTableViewFieldsRecord(in);
230
		}
248
		}
231
		return new UnknownRecord(in);
249
		return new UnknownRecord(in);
232
	}
250
	}
(-)src/java/org/apache/poi/hssf/record/RecordFactory.java (+12 lines)
Lines 31-36 Link Here
31
import java.util.Set;
31
import java.util.Set;
32
32
33
import org.apache.poi.hssf.record.chart.*;
33
import org.apache.poi.hssf.record.chart.*;
34
import org.apache.poi.hssf.record.pivottable.*;
34
35
35
/**
36
/**
36
 * Title:  Record Factory<P>
37
 * Title:  Record Factory<P>
Lines 173-178 Link Here
173
		BeginRecord.class,
174
		BeginRecord.class,
174
		EndRecord.class,
175
		EndRecord.class,
175
		SeriesToChartGroupRecord.class,
176
		SeriesToChartGroupRecord.class,
177
		
178
		TableStylesRecord.class,
179
		
180
		StreamIDRecord.class,
181
		ViewSourceRecord.class,
182
		PageItemRecord.class,
183
		
184
		ViewDefinitionRecord.class, 
185
		ViewFieldsRecord.class,
186
		DataItemRecord.class,
187
		ExtendedPivotTableViewFieldsRecord.class,
176
	};
188
	};
177
	
189
	
178
	/**
190
	/**
(-)src/java/org/apache/poi/hssf/record/UnknownRecord.java (-12 / +8 lines)
Lines 122-142 Link Here
122
		// this method any time a new Record subclass is created.
122
		// this method any time a new Record subclass is created.
123
		switch (sid) {
123
		switch (sid) {
124
			case PLS_004D: return "PLS";
124
			case PLS_004D: return "PLS";
125
			case 0x0050: return "DCON";
125
			case 0x0050: return "DCON"; // Data Consolidation Information
126
			case 0x007F: return "IMDATA";
126
			case 0x007F: return "IMDATA";
127
			case SHEETPR_0081: return "SHEETPR";
127
			case SHEETPR_0081: return "SHEETPR";
128
			case 0x0090: return "SORT";
128
			case 0x0090: return "SORT"; // Sorting Options
129
			case 0x0094: return "LHRECORD";
129
			case 0x0094: return "LHRECORD"; // .WK? File Conversion Information
130
			case STANDARDWIDTH_0099: return "STANDARDWIDTH";
130
			case STANDARDWIDTH_0099: return "STANDARDWIDTH"; //Standard Column Width
131
			case 0x009D: return "AUTOFILTERINFO";
131
			case 0x009D: return "AUTOFILTERINFO"; // Drop-Down Arrow Count
132
			case SCL_00A0:     return "SCL";
132
			case SCL_00A0: return "SCL"; // Window Zoom Magnification
133
			case 0x00AE: return "SCENMAN";
133
			case 0x00AE: return "SCENMAN"; // Scenario Output Data
134
			case SXVIEW_00B0: return "SXVIEW"; // (pivot table) View Definition
134
135
			case 0x00B1: return "SXVD";        // (pivot table) View Fields
136
			case 0x00B2: return "SXVI";        // (pivot table) View Item
135
			case 0x00B2: return "SXVI";        // (pivot table) View Item
137
			case 0x00B4: return "SXIVD";       // (pivot table) Row/Column Field IDs
136
			case 0x00B4: return "SXIVD";       // (pivot table) Row/Column Field IDs
138
			case 0x00B5: return "SXLI";        // (pivot table) Line Item Array
137
			case 0x00B5: return "SXLI";        // (pivot table) Line Item Array
139
			case 0x00C5: return "SXDI";        // (pivot table) Data Item
140
			
138
			
141
			case 0x00D3: return "OBPROJ";
139
			case 0x00D3: return "OBPROJ";
142
			case 0x00DC: return "PARAMQRY";
140
			case 0x00DC: return "PARAMQRY";
Lines 144-150 Link Here
144
			case BITMAP_00E9: return "BITMAP";
142
			case BITMAP_00E9: return "BITMAP";
145
			case PHONETICPR_00EF: return "PHONETICPR";
143
			case PHONETICPR_00EF: return "PHONETICPR";
146
			case 0x00F1: return "SXEX";        // PivotTable View Extended Information
144
			case 0x00F1: return "SXEX";        // PivotTable View Extended Information
147
			case 0x0100: return "SXVDEX";      // Extended PivotTable View Fields
148
145
149
			case LABELRANGES_015F: return "LABELRANGES";
146
			case LABELRANGES_015F: return "LABELRANGES";
150
			case 0x01BA: return "CODENAME";
147
			case 0x01BA: return "CODENAME";
Lines 178-184 Link Here
178
			case 0x088B: return "PLV";
175
			case 0x088B: return "PLV";
179
			case 0x088C: return "COMPAT12";
176
			case 0x088C: return "COMPAT12";
180
			case 0x088D: return "DXF";
177
			case 0x088D: return "DXF";
181
			case 0x088E: return "TABLESTYLES";
182
			case 0x0892: return "STYLEEXT";
178
			case 0x0892: return "STYLEEXT";
183
			case 0x0896: return "THEME";
179
			case 0x0896: return "THEME";
184
			case 0x0897: return "GUIDTYPELIB";
180
			case 0x0897: return "GUIDTYPELIB";
(-)src/java/org/apache/poi/util/StringUtil.java (-1 / +33 lines)
Lines 141-146 Link Here
141
		return readUnicodeLE(in, nChars);
141
		return readUnicodeLE(in, nChars);
142
	}
142
	}
143
	/**
143
	/**
144
	 * InputStream <tt>in</tt> is expected to contain:
145
	 * <ol>
146
	 * <li>byte is16BitFlag</li>
147
	 * <li>byte[]/char[] characterData</li>
148
	 * </ol>
149
	 * For this encoding, the is16BitFlag is always present even if nChars==0.
150
	 */
151
	public static String readUnicodeStringWithSize(LittleEndianInput in, int requestedSize) {
152
		byte flag = in.readByte();
153
		if ((flag & 0x01) == 0) {
154
			return readCompressedUnicode(in, requestedSize);
155
		}
156
		return readUnicodeLE(in, requestedSize);		
157
	}	
158
	/**
144
	 * OutputStream <tt>out</tt> will get:
159
	 * OutputStream <tt>out</tt> will get:
145
	 * <ol>
160
	 * <ol>
146
	 * <li>ushort nChars</li>
161
	 * <li>ushort nChars</li>
Lines 161-168 Link Here
161
			putCompressedUnicode(value, out);
176
			putCompressedUnicode(value, out);
162
		}
177
		}
163
	}
178
	}
164
165
	/**
179
	/**
180
	 * OutputStream <tt>out</tt> will get:
181
	 * <ol>
182
	 * <li>byte is16BitFlag</li>
183
	 * <li>byte[]/char[] characterData</li>
184
	 * </ol>
185
	 * For this encoding, the is16BitFlag is always present even if nChars==0.
186
	 */
187
	public static void writeUnicodeStringOnly(LittleEndianOutput out, String value) {		
188
		boolean is16Bit = hasMultibyte(value);
189
		out.writeByte(is16Bit ? 0x01 : 0x00);
190
		if (is16Bit) {
191
			putUnicodeLE(value, out);
192
		} else {
193
			putCompressedUnicode(value, out);
194
		}
195
	}
196
	
197
	/**
166
	 * @return the number of bytes that would be written by {@link #writeUnicodeString(LittleEndianOutput, String)}
198
	 * @return the number of bytes that would be written by {@link #writeUnicodeString(LittleEndianOutput, String)}
167
	 */
199
	 */
168
	public static int getEncodedSize(String value) {
200
	public static int getEncodedSize(String value) {

Return to bug 46301