2004-04-09 09:05:39 -04:00
|
|
|
/* ====================================================================
|
2006-12-22 14:18:16 -05:00
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
2004-04-09 09:05:39 -04:00
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
==================================================================== */
|
2008-10-30 21:02:55 -04:00
|
|
|
|
2004-04-09 07:45:38 -04:00
|
|
|
package org.apache.poi.hssf.record;
|
|
|
|
|
2008-11-18 19:06:06 -05:00
|
|
|
import org.apache.poi.util.LittleEndianOutput;
|
|
|
|
/**
|
2016-06-12 17:28:13 -04:00
|
|
|
* DrawingRecord (0x00EC)
|
2008-11-18 19:06:06 -05:00
|
|
|
*/
|
2015-09-28 19:16:58 -04:00
|
|
|
public final class DrawingRecord extends StandardRecord implements Cloneable {
|
2008-10-30 21:02:55 -04:00
|
|
|
public static final short sid = 0x00EC;
|
|
|
|
|
2012-06-04 04:08:47 -04:00
|
|
|
private static final byte[] EMPTY_BYTE_ARRAY = {};
|
2004-04-09 07:45:38 -04:00
|
|
|
|
|
|
|
private byte[] recordData;
|
2007-11-23 07:52:51 -05:00
|
|
|
private byte[] contd;
|
2004-04-09 07:45:38 -04:00
|
|
|
|
2008-10-30 21:02:55 -04:00
|
|
|
public DrawingRecord() {
|
2012-06-04 04:08:47 -04:00
|
|
|
recordData = EMPTY_BYTE_ARRAY;
|
2004-04-09 07:45:38 -04:00
|
|
|
}
|
|
|
|
|
2008-11-18 19:06:06 -05:00
|
|
|
public DrawingRecord(RecordInputStream in) {
|
2012-06-04 04:08:47 -04:00
|
|
|
recordData = in.readRemainder();
|
2004-04-09 07:45:38 -04:00
|
|
|
}
|
|
|
|
|
2016-06-17 21:06:53 -04:00
|
|
|
/**
|
|
|
|
* @deprecated POI 3.9
|
|
|
|
*/
|
2012-08-06 17:06:12 -04:00
|
|
|
@Deprecated
|
2008-11-18 19:06:06 -05:00
|
|
|
public void processContinueRecord(byte[] record) {
|
2007-11-23 07:52:51 -05:00
|
|
|
//don't merge continue record with the drawing record, it must be serialized separately
|
|
|
|
contd = record;
|
2005-05-01 07:26:18 -04:00
|
|
|
}
|
|
|
|
|
2008-11-18 19:06:06 -05:00
|
|
|
public void serialize(LittleEndianOutput out) {
|
|
|
|
out.write(recordData);
|
2004-04-09 07:45:38 -04:00
|
|
|
}
|
2012-06-04 04:08:47 -04:00
|
|
|
|
2008-10-30 21:02:55 -04:00
|
|
|
protected int getDataSize() {
|
2008-11-18 19:06:06 -05:00
|
|
|
return recordData.length;
|
2004-04-09 07:45:38 -04:00
|
|
|
}
|
|
|
|
|
2008-11-18 19:06:06 -05:00
|
|
|
public short getSid() {
|
2004-04-09 07:45:38 -04:00
|
|
|
return sid;
|
|
|
|
}
|
|
|
|
|
2012-05-31 05:47:17 -04:00
|
|
|
public byte[] getRecordData(){
|
|
|
|
return recordData;
|
|
|
|
}
|
|
|
|
|
2008-11-18 19:06:06 -05:00
|
|
|
public void setData(byte[] thedata) {
|
2012-06-04 04:08:47 -04:00
|
|
|
if (thedata == null) {
|
|
|
|
throw new IllegalArgumentException("data must not be null");
|
|
|
|
}
|
2008-11-18 19:06:06 -05:00
|
|
|
recordData = thedata;
|
2004-04-09 07:45:38 -04:00
|
|
|
}
|
|
|
|
|
2012-08-06 17:06:12 -04:00
|
|
|
/**
|
|
|
|
* Cloning of drawing records must be executed through HSSFPatriarch, because all id's must be changed
|
|
|
|
* @return cloned drawing records
|
|
|
|
*/
|
2015-09-28 19:16:58 -04:00
|
|
|
@Override
|
|
|
|
public DrawingRecord clone() {
|
2012-06-04 04:08:47 -04:00
|
|
|
DrawingRecord rec = new DrawingRecord();
|
|
|
|
rec.recordData = recordData.clone();
|
|
|
|
if (contd != null) {
|
|
|
|
// TODO - this code probably never executes
|
|
|
|
rec.contd = contd.clone();
|
|
|
|
}
|
|
|
|
|
|
|
|
return rec;
|
2008-01-09 05:05:03 -05:00
|
|
|
}
|
2012-06-14 11:36:34 -04:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
return "DrawingRecord["+recordData.length+"]";
|
|
|
|
}
|
2012-06-04 04:08:47 -04:00
|
|
|
}
|