mirror of https://github.com/apache/poi.git
add StdfPost2000 to StyleDefinition
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1173714 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cb5d8d9be1
commit
0d2e6a8378
|
@ -20,10 +20,14 @@ package org.apache.poi.hwpf.model;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.apache.poi.hwpf.sprm.SprmIterator;
|
||||||
|
|
||||||
import org.apache.poi.hwpf.usermodel.CharacterProperties;
|
import org.apache.poi.hwpf.usermodel.CharacterProperties;
|
||||||
import org.apache.poi.hwpf.usermodel.ParagraphProperties;
|
import org.apache.poi.hwpf.usermodel.ParagraphProperties;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
import org.apache.poi.util.POILogFactory;
|
||||||
|
import org.apache.poi.util.POILogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comment me
|
* Comment me
|
||||||
|
@ -34,6 +38,8 @@ import org.apache.poi.util.LittleEndian;
|
||||||
public final class StyleDescription implements HDFType
|
public final class StyleDescription implements HDFType
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static final POILogger logger = POILogFactory.getLogger( StyleDescription.class );
|
||||||
|
|
||||||
private final static int PARAGRAPH_STYLE = 1;
|
private final static int PARAGRAPH_STYLE = 1;
|
||||||
private final static int CHARACTER_STYLE = 2;
|
private final static int CHARACTER_STYLE = 2;
|
||||||
private final static int TABLE_STYLE = 3;
|
private final static int TABLE_STYLE = 3;
|
||||||
|
@ -41,6 +47,7 @@ public final class StyleDescription implements HDFType
|
||||||
|
|
||||||
private int _baseLength;
|
private int _baseLength;
|
||||||
private StdfBase _stdfBase;
|
private StdfBase _stdfBase;
|
||||||
|
private StdfPost2000 _stdfPost2000;
|
||||||
|
|
||||||
UPX[] _upxs;
|
UPX[] _upxs;
|
||||||
String _name;
|
String _name;
|
||||||
|
@ -57,9 +64,31 @@ public final class StyleDescription implements HDFType
|
||||||
_baseLength = baseLength;
|
_baseLength = baseLength;
|
||||||
int nameStart = offset + baseLength;
|
int nameStart = offset + baseLength;
|
||||||
|
|
||||||
|
boolean readStdfPost2000 = false;
|
||||||
|
if ( baseLength == 0x0012 )
|
||||||
|
{
|
||||||
|
readStdfPost2000 = true;
|
||||||
|
}
|
||||||
|
else if ( baseLength == 0x000A )
|
||||||
|
{
|
||||||
|
readStdfPost2000 = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.log( POILogger.WARN,
|
||||||
|
"Style definition has non-standard size of ",
|
||||||
|
Integer.valueOf( baseLength ) );
|
||||||
|
}
|
||||||
|
|
||||||
_stdfBase = new StdfBase(std, offset);
|
_stdfBase = new StdfBase(std, offset);
|
||||||
offset += StdfBase.getSize();
|
offset += StdfBase.getSize();
|
||||||
|
|
||||||
|
if ( readStdfPost2000 )
|
||||||
|
{
|
||||||
|
_stdfPost2000 = new StdfPost2000( std, offset );
|
||||||
|
offset += StdfPost2000.getSize();
|
||||||
|
}
|
||||||
|
|
||||||
//first byte(s) of variable length section of std is the length of the
|
//first byte(s) of variable length section of std is the length of the
|
||||||
//style name and aliases string
|
//style name and aliases string
|
||||||
int nameLength = 0;
|
int nameLength = 0;
|
||||||
|
@ -255,7 +284,18 @@ public final class StyleDescription implements HDFType
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return "[STD]: '" + _name + "'"
|
StringBuilder result = new StringBuilder();
|
||||||
+ ( "\n" + _stdfBase ).replaceAll( "\n", "\n " );
|
result.append( "[STD]: '" );
|
||||||
|
result.append( _name );
|
||||||
|
result.append( "'" );
|
||||||
|
result.append( ( "\nStdfBase:\t" + _stdfBase ).replaceAll( "\n",
|
||||||
|
"\n " ) );
|
||||||
|
result.append( ( "\nStdfPost2000:\t" + _stdfPost2000 ).replaceAll(
|
||||||
|
"\n", "\n " ) );
|
||||||
|
for ( UPX upx : _upxs )
|
||||||
|
{
|
||||||
|
result.append( ( "\nUPX:\t" + upx ).replaceAll( "\n", "\n " ) );
|
||||||
|
}
|
||||||
|
return result.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue