Patch from Nick. Bug 34744 Fix for ddf.DefaultRecordFactory never creating EscherTextboxRecord

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353671 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Glen Stampoultzis 2005-05-05 13:06:06 +00:00
parent 0aaf734131
commit 2e3142e65c

View File

@ -27,6 +27,8 @@ import java.util.Map;
* Generates escher records when provided the byte array containing those records. * Generates escher records when provided the byte array containing those records.
* *
* @author Glen Stampoultzis * @author Glen Stampoultzis
* @author Nick Burch (nick at torchbox . com)
*
* @see EscherRecordFactory * @see EscherRecordFactory
*/ */
public class DefaultEscherRecordFactory public class DefaultEscherRecordFactory
@ -57,8 +59,13 @@ public class DefaultEscherRecordFactory
public EscherRecord createRecord( byte[] data, int offset ) public EscherRecord createRecord( byte[] data, int offset )
{ {
EscherRecord.EscherRecordHeader header = EscherRecord.EscherRecordHeader.readHeader( data, offset ); EscherRecord.EscherRecordHeader header = EscherRecord.EscherRecordHeader.readHeader( data, offset );
if ( ( header.getOptions() & (short) 0x000F ) == (short) 0x000F )
{ // Options of 0x000F means container record
// However, EscherTextboxRecord are containers of records for the
// host application, not of other Escher records, so treat them
// differently
if ( ( header.getOptions() & (short) 0x000F ) == (short) 0x000F
&& header.getRecordId() != EscherTextboxRecord.RECORD_ID ) {
EscherContainerRecord r = new EscherContainerRecord(); EscherContainerRecord r = new EscherContainerRecord();
r.setRecordId( header.getRecordId() ); r.setRecordId( header.getRecordId() );
r.setOptions( header.getOptions() ); r.setOptions( header.getOptions() );