latest changes...still not working though!

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353443 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Said Ryan Ackley 2003-11-10 11:58:39 +00:00
parent e3bff5f91b
commit 1081456401
31 changed files with 1428 additions and 2697 deletions

View File

@ -76,6 +76,10 @@ public class HDFFieldIterator extends FieldIterator
result = "LittleEndian.getSimpleShortArray(data, 0x" + Integer.toHexString(offset) + " + offset," + size + ")"; result = "LittleEndian.getSimpleShortArray(data, 0x" + Integer.toHexString(offset) + " + offset," + size + ")";
else if (type.equals("byte[]")) else if (type.equals("byte[]"))
result = "LittleEndian.getByteArray(data, 0x" + Integer.toHexString(offset) + " + offset," + size + ")"; result = "LittleEndian.getByteArray(data, 0x" + Integer.toHexString(offset) + " + offset," + size + ")";
else if (type.equals("BorderCode"))
result = "new BorderCode(data, 0x" + Integer.toHexString(offset) + " + offset)";
else if (type.equals("DateAndTime"))
result = "new DateAndTime(data, 0x" + Integer.toHexString(offset) + " + offset)";
else if (size.equals("2")) else if (size.equals("2"))
result = "LittleEndian.getShort(data, 0x" + Integer.toHexString(offset) + " + offset)"; result = "LittleEndian.getShort(data, 0x" + Integer.toHexString(offset) + " + offset)";
else if (size.equals("4")) else if (size.equals("4"))
@ -97,23 +101,27 @@ public class HDFFieldIterator extends FieldIterator
public String serialiseEncoder( int fieldNumber, String fieldName, String size, String type) public String serialiseEncoder( int fieldNumber, String fieldName, String size, String type)
{ {
String javaType = RecordUtil.getType(size, type, 0); //String javaType = RecordUtil.getType(size, type, 0);
String javaFieldName = RecordUtil.getFieldName(fieldNumber,fieldName,0); String javaFieldName = RecordUtil.getFieldName(fieldNumber,fieldName,0);
String result = ""; String result = "";
if (javaType.equals("short[]")) if (type.equals("short[]"))
result = "LittleEndian.putShortArray(data, 0x" + Integer.toHexString(offset) + " + offset, " + javaFieldName + ");"; result = "LittleEndian.putShortArray(data, 0x" + Integer.toHexString(offset) + " + offset, " + javaFieldName + ");";
else if (javaType.equals("byte[]")) else if (type.equals("byte[]"))
result = "LittleEndian.putByteArray(data, 0x" + Integer.toHexString(offset) + " + offset, " + javaFieldName + ");"; result = "System.arraycopy(" + javaFieldName + ", 0, data, 0x" + Integer.toHexString(offset) + " + offset, " + javaFieldName + ".length);";
else if (type.equals("BorderCode"))
result = javaFieldName + ".serialize(data, 0x" + Integer.toHexString(offset) + " + offset);";
else if (type.equals("DateAndTime"))
result = javaFieldName + ".serialize(data, 0x" + Integer.toHexString(offset) + " + offset);";
else if (size.equals("2")) else if (size.equals("2"))
result = "LittleEndian.putShort(data, 0x" + Integer.toHexString(offset) + " + offset, (short)" + javaFieldName + ");"; result = "LittleEndian.putShort(data, 0x" + Integer.toHexString(offset) + " + offset, (short)" + javaFieldName + ");";
else if (size.equals("4")) else if (size.equals("4"))
result = "LittleEndian.putInt(data, 0x" + Integer.toHexString(offset) + " + offset, " + javaFieldName + ");"; result = "LittleEndian.putInt(data, 0x" + Integer.toHexString(offset) + " + offset, " + javaFieldName + ");";
else if (size.equals("1")) else if (size.equals("1"))
result = "data[ 0x" + Integer.toHexString(offset) + " + offset] = " + javaFieldName + ";"; result = "data[ 0x" + Integer.toHexString(offset) + " + offset] = " + javaFieldName + ";";
else if (javaType.equals("double")) else if (type.equals("double"))
result = "LittleEndian.putDouble(data, 0x" + Integer.toHexString(offset) + " + offset, " + javaFieldName + ");"; result = "LittleEndian.putDouble(data, 0x" + Integer.toHexString(offset) + " + offset, " + javaFieldName + ");";
try try

View File

@ -161,6 +161,12 @@ public class HWPFDocument
} }
public StyleSheet getStyleSheet()
{
return _ss;
}
/** /**
* Writes out the word file that is represented by an instance of this class. * Writes out the word file that is represented by an instance of this class.
* *
@ -271,6 +277,28 @@ public class HWPFDocument
pfs.writeFilesystem(out); pfs.writeFilesystem(out);
} }
CHPBinTable getCharacterTable()
{
return _cbt;
}
PAPBinTable getParagraphTable()
{
return _pbt;
}
SectionTable getSectionTable()
{
return _st;
}
TextPieceTable getTextTable()
{
return _cft.getTextPieceTable();
}
/** /**
* Takes two arguments, 1) name of the Word file to read in 2) location to * Takes two arguments, 1) name of the Word file to read in 2) location to
* write it out at. * write it out at.

View File

@ -56,6 +56,7 @@
package org.apache.poi.hwpf.model.hdftypes; package org.apache.poi.hwpf.model.hdftypes;
import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.IOException; import java.io.IOException;
@ -64,11 +65,25 @@ import org.apache.poi.poifs.common.POIFSConstants;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
import org.apache.poi.hwpf.model.io.*; import org.apache.poi.hwpf.model.io.*;
/**
* This class holds all of the character formatting properties.
*
* @author Ryan Ackley
*/
public class CHPBinTable public class CHPBinTable
{ {
/** List of character properties.*/
ArrayList _textRuns = new ArrayList(); ArrayList _textRuns = new ArrayList();
/**
* Constructor used to read a binTable in from a Word document.
*
* @param documentStream
* @param tableStream
* @param offset
* @param size
* @param fcMin
*/
public CHPBinTable(byte[] documentStream, byte[] tableStream, int offset, public CHPBinTable(byte[] documentStream, byte[] tableStream, int offset,
int size, int fcMin) int size, int fcMin)
{ {
@ -94,7 +109,7 @@ public class CHPBinTable
} }
} }
public ArrayList getTextRuns() public List getTextRuns()
{ {
return _textRuns; return _textRuns;
} }

View File

@ -150,25 +150,26 @@ public class CHPFormattedDiskPage extends FormattedDiskPage
int fcOffset = 0; int fcOffset = 0;
// total size is currently the size of one FC // total size is currently the size of one FC
int totalSize = FC_SIZE; int totalSize = FC_SIZE + 1;
int index = 0; int index = 0;
for (; index < size; index++) for (; index < size; index++)
{ {
int grpprlLength = ((CHPX)_chpxList.get(index)).getGrpprl().length; int grpprlLength = ((CHPX)_chpxList.get(index)).getGrpprl().length;
// check to see if we have enough room for an FC, a byte, and the grpprl. // check to see if we have enough room for an FC, the grpprl offset,
totalSize += (FC_SIZE + 1 + grpprlLength); // the grpprl size byte and the grpprl.
totalSize += (FC_SIZE + 2 + grpprlLength);
// if size is uneven we will have to add one so the first grpprl falls // if size is uneven we will have to add one so the first grpprl falls
// on a word boundary // on a word boundary
if (totalSize > 511 + (index % 2)) if (totalSize > 511 + (index % 2))
{ {
totalSize -= (FC_SIZE + 1 + grpprlLength); totalSize -= (FC_SIZE + 2 + grpprlLength);
break; break;
} }
// grpprls must fall on word boundaries // grpprls must fall on word boundaries
if (grpprlLength % 2 > 0) if ((1 + grpprlLength) % 2 > 0)
{ {
totalSize += 1; totalSize += 1;
} }

View File

@ -64,6 +64,7 @@ package org.apache.poi.hwpf.model.hdftypes;
public class CHPX extends PropertyNode public class CHPX extends PropertyNode
{ {
public CHPX(int fcStart, int fcEnd, byte[] grpprl) public CHPX(int fcStart, int fcEnd, byte[] grpprl)
{ {
super(fcStart, fcEnd, grpprl); super(fcStart, fcEnd, grpprl);

View File

@ -72,6 +72,6 @@ public class DocumentProperties extends DOPAbstractType
public DocumentProperties(byte[] tableStream, int offset) public DocumentProperties(byte[] tableStream, int offset)
{ {
super.fillFields(tableStream, (short)0, offset); super.fillFields(tableStream, offset);
} }
} }

View File

@ -75,7 +75,7 @@ public class FileInformationBlock extends FIBAbstractType
/** Creates a new instance of FileInformationBlock */ /** Creates a new instance of FileInformationBlock */
public FileInformationBlock(byte[] mainDocument) public FileInformationBlock(byte[] mainDocument)
{ {
fillFields(mainDocument, (short)0, (short)0); fillFields(mainDocument, 0);
} }
public void clearOffsetsSizes() public void clearOffsetsSizes()

View File

@ -0,0 +1,133 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache POI" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache POI", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.poi.hwpf.model.hdftypes;
import org.apache.poi.util.BitField;
import org.apache.poi.util.LittleEndian;
public class ListData
{
private int _lsid;
private int _tplc;
private short[] _rglst;
private byte _info;
private static BitField _fSimpleList = new BitField(0x1);
private static BitField _fRestartHdn = new BitField(0x2);
private byte _reserved;
ListLevel[] _levels;
public ListData(byte[] buf, int offset)
{
_lsid = LittleEndian.getInt(buf, offset);
offset += LittleEndian.INT_SIZE;
_tplc = LittleEndian.getInt(buf, offset);
offset += LittleEndian.INT_SIZE;
_rglst = new short[9];
for (int x = 0; x < 9; x++)
{
_rglst[x] = LittleEndian.getShort(buf, offset);
offset += LittleEndian.SHORT_SIZE;
}
_info = buf[offset++];
_reserved = buf[offset];
if (_fSimpleList.getValue(_info) > 0)
{
_levels = new ListLevel[1];
}
else
{
_levels = new ListLevel[9];
}
}
public int getLsid()
{
return _lsid;
}
public int numLevels()
{
return _levels.length;
}
public void setLevel(int index, ListLevel level)
{
_levels[index] = level;
}
public ListLevel[] getLevels()
{
return _levels;
}
public byte[] toByteArray()
{
byte[] buf = new byte[28];
int offset = 0;
LittleEndian.putInt(buf, _lsid);
offset += LittleEndian.INT_SIZE;
LittleEndian.putInt(buf, offset, _tplc);
offset += LittleEndian.INT_SIZE;
for (int x = 0; x < 9; x++)
{
LittleEndian.putShort(buf, offset, _rglst[x]);
offset += LittleEndian.SHORT_SIZE;
}
buf[offset++] = _info;
buf[offset] = _reserved;
return buf;
}
}

View File

@ -90,5 +90,4 @@ public class PAPX extends PropertyNode
} }
return false; return false;
} }
} }

View File

@ -53,7 +53,10 @@
*/ */
package org.apache.poi.hwpf.model.hdftypes; package org.apache.poi.hwpf.model.hdftypes;
import java.lang.ref.SoftReference;
import java.io.ByteArrayOutputStream;
import org.apache.poi.hwpf.sprm.SprmBuffer;
/** /**
* Represents a lightweight node in the Trees used to store content * Represents a lightweight node in the Trees used to store content
@ -63,9 +66,10 @@ package org.apache.poi.hwpf.model.hdftypes;
*/ */
public class PropertyNode implements Comparable public class PropertyNode implements Comparable
{ {
private byte[] _buf; private SprmBuffer _buf;
private int _cpStart; private int _cpStart;
private int _cpEnd; private int _cpEnd;
private SoftReference _propCache;
/** /**
* @param fcStart The start of the text for this property. * @param fcStart The start of the text for this property.
@ -76,7 +80,8 @@ public class PropertyNode implements Comparable
{ {
_cpStart = fcStart; _cpStart = fcStart;
_cpEnd = fcEnd; _cpEnd = fcEnd;
_buf = buf; _buf = new SprmBuffer(buf);
} }
/** /**
* @return The offset of this property's text. * @return The offset of this property's text.
@ -97,21 +102,22 @@ public class PropertyNode implements Comparable
*/ */
public byte[] getBuf() public byte[] getBuf()
{ {
return _buf; return _buf.toByteArray();
} }
public boolean equals(Object o) public boolean equals(Object o)
{ {
byte[] buf = _buf.toByteArray();
if (((PropertyNode)o).getStart() == _cpStart && if (((PropertyNode)o).getStart() == _cpStart &&
((PropertyNode)o).getEnd() == _cpEnd) ((PropertyNode)o).getEnd() == _cpEnd)
{ {
byte[] testBuf = ((PropertyNode)o).getBuf(); byte[] testBuf = ((PropertyNode)o).getBuf();
if (testBuf.length == _buf.length) if (testBuf.length == buf.length)
{ {
for (int x = 0; x < _buf.length; x++) for (int x = 0; x < buf.length; x++)
{ {
if (testBuf[x] != _buf[x]) if (testBuf[x] != buf[x])
{ {
return false; return false;
} }
@ -140,4 +146,17 @@ public class PropertyNode implements Comparable
return 1; return 1;
} }
} }
public void fillCache(Object ref)
{
_propCache = new SoftReference(ref);
}
public Object getCacheContents()
{
return _propCache == null ? null : _propCache.get();
}
} }

View File

@ -59,6 +59,8 @@ package org.apache.poi.hwpf.model.hdftypes;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.Arrays; import java.util.Arrays;
import org.apache.poi.hwpf.usermodel.CharacterProperties;
import org.apache.poi.hwpf.usermodel.ParagraphProperties;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.BitField; import org.apache.poi.util.BitField;
/** /**
@ -70,8 +72,8 @@ import org.apache.poi.util.BitField;
public class StyleDescription implements HDFType public class StyleDescription implements HDFType
{ {
private static int PARAGRAPH_STYLE = 1; private final static int PARAGRAPH_STYLE = 1;
private static int CHARACTER_STYLE = 2; private final static int CHARACTER_STYLE = 2;
private int _istd; private int _istd;
private int _baseLength; private int _baseLength;
@ -92,11 +94,10 @@ public class StyleDescription implements HDFType
private static BitField _fAutoRedef = new BitField(0x1); private static BitField _fAutoRedef = new BitField(0x1);
private static BitField _fHidden = new BitField(0x2); private static BitField _fHidden = new BitField(0x2);
byte[] _papx; UPX[] _upxs;
byte[] _chpx;
String _name; String _name;
// ParagraphProperties _pap; ParagraphProperties _pap;
// CharacterProperties _chp; CharacterProperties _chp;
public StyleDescription() public StyleDescription()
{ {
@ -149,33 +150,17 @@ public class StyleDescription implements HDFType
// that more may be added in the future // that more may be added in the future
int varOffset = grupxStart; int varOffset = grupxStart;
int numUPX = _numUPX.getValue(_infoShort3); int numUPX = _numUPX.getValue(_infoShort3);
_upxs = new UPX[numUPX];
for(int x = 0; x < numUPX; x++) for(int x = 0; x < numUPX; x++)
{ {
int upxSize = LittleEndian.getShort(std, varOffset); int upxSize = LittleEndian.getShort(std, varOffset);
varOffset += LittleEndian.SHORT_SIZE; varOffset += LittleEndian.SHORT_SIZE;
if(_styleTypeCode.getValue(_infoShort2) == PARAGRAPH_STYLE)
{ byte[] upx = new byte[upxSize];
if(x == 0) System.arraycopy(std, varOffset, upx, 0, upxSize);
{ _upxs[x] = new UPX(upx);
_istd = LittleEndian.getShort(std, varOffset); varOffset += upxSize;
//varOffset += LittleEndian.SHORT_SIZE;
int grrprlSize = upxSize;
_papx = new byte[grrprlSize];
System.arraycopy(std, varOffset, _papx, 0, grrprlSize);
varOffset += grrprlSize;
}
else if(x == 1)
{
_chpx = new byte[upxSize];
System.arraycopy(std, varOffset, _chpx, 0, upxSize);
varOffset += upxSize;
}
}
else if(_styleTypeCode.getValue(_infoShort2) == CHARACTER_STYLE && x == 0)
{
_chpx = new byte[upxSize];
System.arraycopy(std, varOffset, _chpx, 0, upxSize);
}
// the upx will always start on a word boundary. // the upx will always start on a word boundary.
if(upxSize % 2 == 1) if(upxSize % 2 == 1)
@ -189,32 +174,52 @@ public class StyleDescription implements HDFType
} }
public int getBaseStyle() public int getBaseStyle()
{ {
return _baseStyle.getValue(_infoShort2); return _baseStyle.getValue(_infoShort2);
} }
public byte[] getCHPX() public byte[] getCHPX()
{ {
return _chpx; switch (_styleTypeCode.getValue(_infoShort2))
{
case PARAGRAPH_STYLE:
if (_upxs.length > 1)
{
return _upxs[1].getUPX();
}
return null;
case CHARACTER_STYLE:
return _upxs[0].getUPX();
default:
return null;
}
} }
public byte[] getPAPX() public byte[] getPAPX()
{ {
return _papx; switch (_styleTypeCode.getValue(_infoShort2))
{
case PARAGRAPH_STYLE:
return _upxs[0].getUPX();
default:
return null;
}
} }
// public ParagraphProperties getPAP() public ParagraphProperties getPAP()
// { {
// return _pap; return _pap;
// } }
// public CharacterProperties getCHP() public CharacterProperties getCHP()
// { {
// return _chp; return _chp;
// } }
// public void setPAP(ParagraphProperties pap) void setPAP(ParagraphProperties pap)
// { {
// _pap = pap; _pap = pap;
// } }
// public void setCHP(CharacterProperties chp) void setCHP(CharacterProperties chp)
// { {
// _chp = chp; _chp = chp;
// } }
public byte[] toByteArray() public byte[] toByteArray()
{ {
// size equals _baseLength bytes for known variables plus 2 bytes for name // size equals _baseLength bytes for known variables plus 2 bytes for name
@ -222,20 +227,16 @@ public class StyleDescription implements HDFType
// length // length
int size = _baseLength + 2 + ((_name.length() + 1) * 2); int size = _baseLength + 2 + ((_name.length() + 1) * 2);
//only worry about papx and chpx for upxs // determine the size needed for the upxs. They always fall on word
if(_styleTypeCode.getValue(_infoShort2) == PARAGRAPH_STYLE) // boundaries.
size += _upxs[0].size() + 2;
for (int x = 1; x < _upxs.length; x++)
{ {
size += _papx.length + 2 + (_papx.length % 2); size += _upxs[x-1].size() % 2;
if (_chpx != null) size += _upxs[x].size() + 2;
{
size += _chpx.length + 2;
}
}
else if (_styleTypeCode.getValue(_infoShort2) == CHARACTER_STYLE)
{
size += _chpx.length + 2;
} }
byte[] buf = new byte[size]; byte[] buf = new byte[size];
int offset = 0; int offset = 0;
@ -248,10 +249,10 @@ public class StyleDescription implements HDFType
LittleEndian.putShort(buf, offset, _bchUpe); LittleEndian.putShort(buf, offset, _bchUpe);
offset += LittleEndian.SHORT_SIZE; offset += LittleEndian.SHORT_SIZE;
LittleEndian.putShort(buf, offset, _infoShort4); LittleEndian.putShort(buf, offset, _infoShort4);
offset += LittleEndian.SHORT_SIZE; offset = _baseLength;
char[] letters = _name.toCharArray(); char[] letters = _name.toCharArray();
LittleEndian.putShort(buf, offset, (short)letters.length); LittleEndian.putShort(buf, _baseLength, (short)letters.length);
offset += LittleEndian.SHORT_SIZE; offset += LittleEndian.SHORT_SIZE;
for (int x = 0; x < letters.length; x++) for (int x = 0; x < letters.length; x++)
{ {
@ -261,28 +262,13 @@ public class StyleDescription implements HDFType
// get past the null delimiter for the name. // get past the null delimiter for the name.
offset += LittleEndian.SHORT_SIZE; offset += LittleEndian.SHORT_SIZE;
//only worry about papx and chpx for upxs for (int x = 0; x < _upxs.length; x++)
if(_styleTypeCode.getValue(_infoShort2) == PARAGRAPH_STYLE)
{ {
LittleEndian.putShort(buf, offset, (short)(_papx.length)); short upxSize = (short)_upxs[x].size();
LittleEndian.putShort(buf, offset, upxSize);
offset += LittleEndian.SHORT_SIZE; offset += LittleEndian.SHORT_SIZE;
System.arraycopy(_papx, 0, buf, offset, _papx.length); System.arraycopy(_upxs[x].getUPX(), 0, buf, offset, upxSize);
offset += _papx.length + (_papx.length % 2); offset += upxSize + (upxSize % 2);
if (_chpx != null)
{
LittleEndian.putShort(buf, offset, (short) _chpx.length);
offset += LittleEndian.SHORT_SIZE;
System.arraycopy(_chpx, 0, buf, offset, _chpx.length);
offset += _chpx.length;
}
}
else if (_styleTypeCode.getValue(_infoShort2) == CHARACTER_STYLE)
{
LittleEndian.putShort(buf, offset, (short)_chpx.length);
offset += LittleEndian.SHORT_SIZE;
System.arraycopy(_chpx, 0, buf, offset, _chpx.length);
offset += _chpx.length;
} }
return buf; return buf;
@ -297,16 +283,10 @@ public class StyleDescription implements HDFType
_name.equals(sd._name)) _name.equals(sd._name))
{ {
if (!Arrays.equals(_chpx, sd._chpx)) if (!Arrays.equals(_upxs, sd._upxs))
{ {
return false; return false;
} }
if (!Arrays.equals(_papx, sd._papx))
{
return false;
}
return true; return true;
} }
return false; return false;

View File

@ -60,6 +60,7 @@ package org.apache.poi.hwpf.model.hdftypes;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import org.apache.poi.hwpf.model.io.*; import org.apache.poi.hwpf.model.io.*;
@ -67,6 +68,7 @@ import org.apache.poi.hwpf.model.io.*;
public class TextPieceTable public class TextPieceTable
{ {
ArrayList _textPieces = new ArrayList(); ArrayList _textPieces = new ArrayList();
int _multiple;
public TextPieceTable(byte[] documentStream, byte[] tableStream, int offset, public TextPieceTable(byte[] documentStream, byte[] tableStream, int offset,
int size, int fcMin) int size, int fcMin)
@ -75,7 +77,7 @@ public class TextPieceTable
// get our plex of PieceDescriptors // get our plex of PieceDescriptors
PlexOfCps pieceTable = new PlexOfCps(tableStream, offset, size, PieceDescriptor.getSizeInBytes()); PlexOfCps pieceTable = new PlexOfCps(tableStream, offset, size, PieceDescriptor.getSizeInBytes());
int multiple = 2; _multiple = 2;
int length = pieceTable.length(); int length = pieceTable.length();
PieceDescriptor[] pieces = new PieceDescriptor[length]; PieceDescriptor[] pieces = new PieceDescriptor[length];
@ -88,7 +90,7 @@ public class TextPieceTable
if (!pieces[x].isUnicode()) if (!pieces[x].isUnicode())
{ {
multiple = 1; _multiple = 1;
} }
} }
@ -97,33 +99,33 @@ public class TextPieceTable
{ {
int start = pieces[x].getFilePosition(); int start = pieces[x].getFilePosition();
PropertyNode node = pieceTable.getProperty(x); PropertyNode node = pieceTable.getProperty(x);
int nodeStart = node.getStart() - fcMin; int nodeStart = node.getStart();
int nodeEnd = node.getEnd() - fcMin; // multiple will be 2 if there is only one piece and its unicode. Some
// type of optimization.
int nodeEnd = ((node.getEnd() - nodeStart) * _multiple) + nodeStart;
int textSize = nodeEnd - nodeStart; int textSize = nodeEnd - nodeStart;
boolean unicode = pieces[x].isUnicode(); boolean unicode = pieces[x].isUnicode();
String toStr = null; String toStr = null;
if (unicode)
{ byte[] buf = new byte[textSize + (unicode ? textSize % 2 : 0)];
byte[] buf = new byte[textSize * multiple]; System.arraycopy(documentStream, start, buf, 0, textSize);
System.arraycopy(documentStream, start, buf, 0, textSize * multiple); _textPieces.add(new TextPiece(nodeStart, nodeEnd, buf, pieces[x]));
_textPieces.add(new TextPiece(nodeStart, nodeEnd, buf, pieces[x]));
}
else
{
byte[] buf = new byte[textSize];
System.arraycopy(documentStream, start, buf, 0, textSize);
_textPieces.add(new TextPiece(nodeStart, nodeEnd, buf, pieces[x]));
}
} }
} }
public List getTextPieces()
{
return _textPieces;
}
public byte[] writeTo(HWPFOutputStream docStream) public byte[] writeTo(HWPFOutputStream docStream)
throws IOException throws IOException
{ {
PlexOfCps textPlex = new PlexOfCps(PieceDescriptor.getSizeInBytes()); PlexOfCps textPlex = new PlexOfCps(PieceDescriptor.getSizeInBytes());
int fcMin = docStream.getOffset(); //int fcMin = docStream.getOffset();
int size = _textPieces.size(); int size = _textPieces.size();
for (int x = 0; x < size; x++) for (int x = 0; x < size; x++)
@ -137,8 +139,10 @@ public class TextPieceTable
// write the text to the docstream and save the piece descriptor to the // write the text to the docstream and save the piece descriptor to the
// plex which will be written later to the tableStream. // plex which will be written later to the tableStream.
docStream.write(next.getBuf()); docStream.write(next.getBuf());
textPlex.addProperty(new PropertyNode(next.getStart() + fcMin,
next.getEnd() + fcMin, int nodeStart = next.getStart();
textPlex.addProperty(new PropertyNode(nodeStart,
(next.getEnd() - nodeStart)/_multiple + nodeStart,
pd.toByteArray())); pd.toByteArray()));
} }

View File

@ -63,6 +63,7 @@ import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.StringUtil; import org.apache.poi.util.StringUtil;
import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
import org.apache.poi.hdf.model.hdftypes.HDFType; import org.apache.poi.hdf.model.hdftypes.HDFType;
import org.apache.poi.hwpf.usermodel.*;
/** /**
* Character Properties. * Character Properties.
@ -75,8 +76,8 @@ public abstract class CHPAbstractType
implements HDFType implements HDFType
{ {
private short field_1_chse; protected short field_1_chse;
private int field_2_format_flags; protected int field_2_format_flags;
private static BitField fBold = new BitField(0x0001); private static BitField fBold = new BitField(0x0001);
private static BitField fItalic = new BitField(0x0002); private static BitField fItalic = new BitField(0x0002);
private static BitField fRMarkDel = new BitField(0x0004); private static BitField fRMarkDel = new BitField(0x0004);
@ -93,41 +94,41 @@ public abstract class CHPAbstractType
private static BitField fLowerCase = new BitField(0x2000); private static BitField fLowerCase = new BitField(0x2000);
private static BitField fData = new BitField(0x4000); private static BitField fData = new BitField(0x4000);
private static BitField fOle2 = new BitField(0x8000); private static BitField fOle2 = new BitField(0x8000);
private int field_3_format_flags1; protected int field_3_format_flags1;
private static BitField fEmboss = new BitField(0x0001); private static BitField fEmboss = new BitField(0x0001);
private static BitField fImprint = new BitField(0x0002); private static BitField fImprint = new BitField(0x0002);
private static BitField fDStrike = new BitField(0x0004); private static BitField fDStrike = new BitField(0x0004);
private static BitField fUsePgsuSettings = new BitField(0x0008); private static BitField fUsePgsuSettings = new BitField(0x0008);
private int field_4_ftcAscii; protected int field_4_ftcAscii;
private int field_5_ftcFE; protected int field_5_ftcFE;
private int field_6_ftcOther; protected int field_6_ftcOther;
private int field_7_hps; protected int field_7_hps;
private int field_8_dxaSpace; protected int field_8_dxaSpace;
private byte field_9_iss; protected byte field_9_iss;
private byte field_10_kul; protected byte field_10_kul;
private byte field_11_ico; protected byte field_11_ico;
private int field_12_hpsPos; protected int field_12_hpsPos;
private int field_13_lidDefault; protected int field_13_lidDefault;
private int field_14_lidFE; protected int field_14_lidFE;
private byte field_15_idctHint; protected byte field_15_idctHint;
private int field_16_wCharScale; protected int field_16_wCharScale;
private int field_17_fcPic; protected int field_17_fcPic;
private int field_18_fcObj; protected int field_18_fcObj;
private int field_19_lTagObj; protected int field_19_lTagObj;
private int field_20_ibstRMark; protected int field_20_ibstRMark;
private int field_21_ibstRMarkDel; protected int field_21_ibstRMarkDel;
private short[] field_22_dttmRMark; protected DateAndTime field_22_dttmRMark;
private short[] field_23_dttmRMarkDel; protected DateAndTime field_23_dttmRMarkDel;
private int field_24_istd; protected int field_24_istd;
private int field_25_baseIstd; protected int field_25_baseIstd;
private int field_26_ftcSym; protected int field_26_ftcSym;
private int field_27_xchSym; protected int field_27_xchSym;
private int field_28_idslRMReason; protected int field_28_idslRMReason;
private int field_29_idslReasonDel; protected int field_29_idslReasonDel;
private byte field_30_ysr; protected byte field_30_ysr;
private byte field_31_chYsr; protected byte field_31_chYsr;
private int field_32_hpsKern; protected int field_32_hpsKern;
private short field_33_Highlight; protected short field_33_Highlight;
private static BitField icoHighlight = new BitField(0x001f); private static BitField icoHighlight = new BitField(0x001f);
private static BitField fHighlight = new BitField(0x0020); private static BitField fHighlight = new BitField(0x0020);
private static BitField kcd = new BitField(0x01c0); private static BitField kcd = new BitField(0x01c0);
@ -135,16 +136,16 @@ public abstract class CHPAbstractType
private static BitField fChsDiff = new BitField(0x0400); private static BitField fChsDiff = new BitField(0x0400);
private static BitField fMacChs = new BitField(0x0800); private static BitField fMacChs = new BitField(0x0800);
private static BitField fFtcAsciSym = new BitField(0x1000); private static BitField fFtcAsciSym = new BitField(0x1000);
private short field_34_fPropMark; protected short field_34_fPropMark;
private int field_35_ibstPropRMark; protected int field_35_ibstPropRMark;
private int field_36_dttmPropRMark; protected DateAndTime field_36_dttmPropRMark;
private byte field_37_sfxtText; protected byte field_37_sfxtText;
private byte field_38_fDispFldRMark; protected byte field_38_fDispFldRMark;
private int field_39_ibstDispFldRMark; protected int field_39_ibstDispFldRMark;
private int field_40_dttmDispFldRMark; protected DateAndTime field_40_dttmDispFldRMark;
private byte[] field_41_xstDispFldRMark; protected byte[] field_41_xstDispFldRMark;
private int field_42_shd; protected ShadingDescriptor field_42_shd;
private short[] field_43_brc; protected BorderCode field_43_brc;
public CHPAbstractType() public CHPAbstractType()
@ -501,7 +502,7 @@ public abstract class CHPAbstractType
/** /**
* Get the dttmRMark field for the CHP record. * Get the dttmRMark field for the CHP record.
*/ */
public short[] getDttmRMark() public DateAndTime getDttmRMark()
{ {
return field_22_dttmRMark; return field_22_dttmRMark;
} }
@ -509,7 +510,7 @@ public abstract class CHPAbstractType
/** /**
* Set the dttmRMark field for the CHP record. * Set the dttmRMark field for the CHP record.
*/ */
public void setDttmRMark(short[] field_22_dttmRMark) public void setDttmRMark(DateAndTime field_22_dttmRMark)
{ {
this.field_22_dttmRMark = field_22_dttmRMark; this.field_22_dttmRMark = field_22_dttmRMark;
} }
@ -517,7 +518,7 @@ public abstract class CHPAbstractType
/** /**
* Get the dttmRMarkDel field for the CHP record. * Get the dttmRMarkDel field for the CHP record.
*/ */
public short[] getDttmRMarkDel() public DateAndTime getDttmRMarkDel()
{ {
return field_23_dttmRMarkDel; return field_23_dttmRMarkDel;
} }
@ -525,7 +526,7 @@ public abstract class CHPAbstractType
/** /**
* Set the dttmRMarkDel field for the CHP record. * Set the dttmRMarkDel field for the CHP record.
*/ */
public void setDttmRMarkDel(short[] field_23_dttmRMarkDel) public void setDttmRMarkDel(DateAndTime field_23_dttmRMarkDel)
{ {
this.field_23_dttmRMarkDel = field_23_dttmRMarkDel; this.field_23_dttmRMarkDel = field_23_dttmRMarkDel;
} }
@ -725,7 +726,7 @@ public abstract class CHPAbstractType
/** /**
* Get the dttmPropRMark field for the CHP record. * Get the dttmPropRMark field for the CHP record.
*/ */
public int getDttmPropRMark() public DateAndTime getDttmPropRMark()
{ {
return field_36_dttmPropRMark; return field_36_dttmPropRMark;
} }
@ -733,7 +734,7 @@ public abstract class CHPAbstractType
/** /**
* Set the dttmPropRMark field for the CHP record. * Set the dttmPropRMark field for the CHP record.
*/ */
public void setDttmPropRMark(int field_36_dttmPropRMark) public void setDttmPropRMark(DateAndTime field_36_dttmPropRMark)
{ {
this.field_36_dttmPropRMark = field_36_dttmPropRMark; this.field_36_dttmPropRMark = field_36_dttmPropRMark;
} }
@ -789,7 +790,7 @@ public abstract class CHPAbstractType
/** /**
* Get the dttmDispFldRMark field for the CHP record. * Get the dttmDispFldRMark field for the CHP record.
*/ */
public int getDttmDispFldRMark() public DateAndTime getDttmDispFldRMark()
{ {
return field_40_dttmDispFldRMark; return field_40_dttmDispFldRMark;
} }
@ -797,7 +798,7 @@ public abstract class CHPAbstractType
/** /**
* Set the dttmDispFldRMark field for the CHP record. * Set the dttmDispFldRMark field for the CHP record.
*/ */
public void setDttmDispFldRMark(int field_40_dttmDispFldRMark) public void setDttmDispFldRMark(DateAndTime field_40_dttmDispFldRMark)
{ {
this.field_40_dttmDispFldRMark = field_40_dttmDispFldRMark; this.field_40_dttmDispFldRMark = field_40_dttmDispFldRMark;
} }
@ -821,7 +822,7 @@ public abstract class CHPAbstractType
/** /**
* Get the shd field for the CHP record. * Get the shd field for the CHP record.
*/ */
public int getShd() public ShadingDescriptor getShd()
{ {
return field_42_shd; return field_42_shd;
} }
@ -829,7 +830,7 @@ public abstract class CHPAbstractType
/** /**
* Set the shd field for the CHP record. * Set the shd field for the CHP record.
*/ */
public void setShd(int field_42_shd) public void setShd(ShadingDescriptor field_42_shd)
{ {
this.field_42_shd = field_42_shd; this.field_42_shd = field_42_shd;
} }
@ -837,7 +838,7 @@ public abstract class CHPAbstractType
/** /**
* Get the brc field for the CHP record. * Get the brc field for the CHP record.
*/ */
public short[] getBrc() public BorderCode getBrc()
{ {
return field_43_brc; return field_43_brc;
} }
@ -845,7 +846,7 @@ public abstract class CHPAbstractType
/** /**
* Set the brc field for the CHP record. * Set the brc field for the CHP record.
*/ */
public void setBrc(short[] field_43_brc) public void setBrc(BorderCode field_43_brc)
{ {
this.field_43_brc = field_43_brc; this.field_43_brc = field_43_brc;
} }

View File

@ -63,6 +63,7 @@ import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.StringUtil; import org.apache.poi.util.StringUtil;
import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
import org.apache.poi.hdf.model.hdftypes.HDFType; import org.apache.poi.hdf.model.hdftypes.HDFType;
import org.apache.poi.hwpf.usermodel.*;
/** /**
* Document Properties. * Document Properties.
@ -75,19 +76,19 @@ public abstract class DOPAbstractType
implements HDFType implements HDFType
{ {
private byte field_1_formatFlags; protected byte field_1_formatFlags;
private static BitField fFacingPages = new BitField(0x01); private static BitField fFacingPages = new BitField(0x01);
private static BitField fWidowControl = new BitField(0x02); private static BitField fWidowControl = new BitField(0x02);
private static BitField fPMHMainDoc = new BitField(0x04); private static BitField fPMHMainDoc = new BitField(0x04);
private static BitField grfSupression = new BitField(0x18); private static BitField grfSupression = new BitField(0x18);
private static BitField fpc = new BitField(0x60); private static BitField fpc = new BitField(0x60);
private static BitField unused1 = new BitField(0x80); private static BitField unused1 = new BitField(0x80);
private byte field_2_unused2; protected byte field_2_unused2;
private short field_3_footnoteInfo; protected short field_3_footnoteInfo;
private static BitField rncFtn = new BitField(0x0003); private static BitField rncFtn = new BitField(0x0003);
private static BitField nFtn = new BitField(0xfffc); private static BitField nFtn = new BitField(0xfffc);
private byte field_4_fOutlineDirtySave; protected byte field_4_fOutlineDirtySave;
private byte field_5_docinfo; protected byte field_5_docinfo;
private static BitField fOnlyMacPics = new BitField(0x01); private static BitField fOnlyMacPics = new BitField(0x01);
private static BitField fOnlyWinPics = new BitField(0x02); private static BitField fOnlyWinPics = new BitField(0x02);
private static BitField fLabelDoc = new BitField(0x04); private static BitField fLabelDoc = new BitField(0x04);
@ -96,7 +97,7 @@ public abstract class DOPAbstractType
private static BitField fFormNoFields = new BitField(0x20); private static BitField fFormNoFields = new BitField(0x20);
private static BitField fLinkStyles = new BitField(0x40); private static BitField fLinkStyles = new BitField(0x40);
private static BitField fRevMarking = new BitField(0x80); private static BitField fRevMarking = new BitField(0x80);
private byte field_6_docinfo1; protected byte field_6_docinfo1;
private static BitField fBackup = new BitField(0x01); private static BitField fBackup = new BitField(0x01);
private static BitField fExactCWords = new BitField(0x02); private static BitField fExactCWords = new BitField(0x02);
private static BitField fPagHidden = new BitField(0x04); private static BitField fPagHidden = new BitField(0x04);
@ -105,7 +106,7 @@ public abstract class DOPAbstractType
private static BitField fMirrorMargins = new BitField(0x20); private static BitField fMirrorMargins = new BitField(0x20);
private static BitField unused3 = new BitField(0x40); private static BitField unused3 = new BitField(0x40);
private static BitField fDfltTrueType = new BitField(0x80); private static BitField fDfltTrueType = new BitField(0x80);
private byte field_7_docinfo2; protected byte field_7_docinfo2;
private static BitField fPagSupressTopSpacing = new BitField(0x01); private static BitField fPagSupressTopSpacing = new BitField(0x01);
private static BitField fProtEnabled = new BitField(0x02); private static BitField fProtEnabled = new BitField(0x02);
private static BitField fDispFormFldSel = new BitField(0x04); private static BitField fDispFormFldSel = new BitField(0x04);
@ -114,7 +115,7 @@ public abstract class DOPAbstractType
private static BitField unused4 = new BitField(0x20); private static BitField unused4 = new BitField(0x20);
private static BitField fLockRev = new BitField(0x40); private static BitField fLockRev = new BitField(0x40);
private static BitField fEmbedFonts = new BitField(0x80); private static BitField fEmbedFonts = new BitField(0x80);
private short field_8_docinfo3; protected short field_8_docinfo3;
private static BitField oldfNoTabForInd = new BitField(0x0001); private static BitField oldfNoTabForInd = new BitField(0x0001);
private static BitField oldfNoSpaceRaiseLower = new BitField(0x0002); private static BitField oldfNoSpaceRaiseLower = new BitField(0x0002);
private static BitField oldfSuppressSpbfAfterPageBreak = new BitField(0x0004); private static BitField oldfSuppressSpbfAfterPageBreak = new BitField(0x0004);
@ -128,24 +129,24 @@ public abstract class DOPAbstractType
private static BitField oldfShowBreaksInFrames = new BitField(0x0400); private static BitField oldfShowBreaksInFrames = new BitField(0x0400);
private static BitField oldfSwapBordersFacingPgs = new BitField(0x0800); private static BitField oldfSwapBordersFacingPgs = new BitField(0x0800);
private static BitField unused5 = new BitField(0xf000); private static BitField unused5 = new BitField(0xf000);
private int field_9_dxaTab; protected int field_9_dxaTab;
private int field_10_wSpare; protected int field_10_wSpare;
private int field_11_dxaHotz; protected int field_11_dxaHotz;
private int field_12_cConsexHypLim; protected int field_12_cConsexHypLim;
private int field_13_wSpare2; protected int field_13_wSpare2;
private int field_14_dttmCreated; protected int field_14_dttmCreated;
private int field_15_dttmRevised; protected int field_15_dttmRevised;
private int field_16_dttmLastPrint; protected int field_16_dttmLastPrint;
private int field_17_nRevision; protected int field_17_nRevision;
private int field_18_tmEdited; protected int field_18_tmEdited;
private int field_19_cWords; protected int field_19_cWords;
private int field_20_cCh; protected int field_20_cCh;
private int field_21_cPg; protected int field_21_cPg;
private int field_22_cParas; protected int field_22_cParas;
private short field_23_Edn; protected short field_23_Edn;
private static BitField rncEdn = new BitField(0x0003); private static BitField rncEdn = new BitField(0x0003);
private static BitField nEdn = new BitField(0xfffc); private static BitField nEdn = new BitField(0xfffc);
private short field_24_Edn1; protected short field_24_Edn1;
private static BitField epc = new BitField(0x0003); private static BitField epc = new BitField(0x0003);
private static BitField nfcFtnRef1 = new BitField(0x003c); private static BitField nfcFtnRef1 = new BitField(0x003c);
private static BitField nfcEdnRef1 = new BitField(0x03c0); private static BitField nfcEdnRef1 = new BitField(0x03c0);
@ -153,20 +154,20 @@ public abstract class DOPAbstractType
private static BitField fSaveFormData = new BitField(0x0800); private static BitField fSaveFormData = new BitField(0x0800);
private static BitField fShadeFormData = new BitField(0x1000); private static BitField fShadeFormData = new BitField(0x1000);
private static BitField fWCFtnEdn = new BitField(0x8000); private static BitField fWCFtnEdn = new BitField(0x8000);
private int field_25_cLines; protected int field_25_cLines;
private int field_26_cWordsFtnEnd; protected int field_26_cWordsFtnEnd;
private int field_27_cChFtnEdn; protected int field_27_cChFtnEdn;
private short field_28_cPgFtnEdn; protected short field_28_cPgFtnEdn;
private int field_29_cParasFtnEdn; protected int field_29_cParasFtnEdn;
private int field_30_cLinesFtnEdn; protected int field_30_cLinesFtnEdn;
private int field_31_lKeyProtDoc; protected int field_31_lKeyProtDoc;
private short field_32_view; protected short field_32_view;
private static BitField wvkSaved = new BitField(0x0007); private static BitField wvkSaved = new BitField(0x0007);
private static BitField wScaleSaved = new BitField(0x0ff8); private static BitField wScaleSaved = new BitField(0x0ff8);
private static BitField zkSaved = new BitField(0x3000); private static BitField zkSaved = new BitField(0x3000);
private static BitField fRotateFontW6 = new BitField(0x4000); private static BitField fRotateFontW6 = new BitField(0x4000);
private static BitField iGutterPos = new BitField(0x8000); private static BitField iGutterPos = new BitField(0x8000);
private int field_33_docinfo4; protected int field_33_docinfo4;
private static BitField fNoTabForInd = new BitField(0x00000001); private static BitField fNoTabForInd = new BitField(0x00000001);
private static BitField fNoSpaceRaiseLower = new BitField(0x00000002); private static BitField fNoSpaceRaiseLower = new BitField(0x00000002);
private static BitField fSupressSpdfAfterPageBreak = new BitField(0x00000004); private static BitField fSupressSpdfAfterPageBreak = new BitField(0x00000004);
@ -184,10 +185,10 @@ public abstract class DOPAbstractType
private static BitField fPrintBodyBeforeHdr = new BitField(0x00040000); private static BitField fPrintBodyBeforeHdr = new BitField(0x00040000);
private static BitField fNoLeading = new BitField(0x00080000); private static BitField fNoLeading = new BitField(0x00080000);
private static BitField fMWSmallCaps = new BitField(0x00200000); private static BitField fMWSmallCaps = new BitField(0x00200000);
private short field_34_adt; protected short field_34_adt;
private byte[] field_35_doptypography; protected byte[] field_35_doptypography;
private byte[] field_36_dogrid; protected byte[] field_36_dogrid;
private short field_37_docinfo5; protected short field_37_docinfo5;
private static BitField lvl = new BitField(0x001e); private static BitField lvl = new BitField(0x001e);
private static BitField fGramAllDone = new BitField(0x0020); private static BitField fGramAllDone = new BitField(0x0020);
private static BitField fGramAllClean = new BitField(0x0040); private static BitField fGramAllClean = new BitField(0x0040);
@ -199,27 +200,27 @@ public abstract class DOPAbstractType
private static BitField fIncludeFooter = new BitField(0x2000); private static BitField fIncludeFooter = new BitField(0x2000);
private static BitField fForcePageSizePag = new BitField(0x4000); private static BitField fForcePageSizePag = new BitField(0x4000);
private static BitField fMinFontSizePag = new BitField(0x8000); private static BitField fMinFontSizePag = new BitField(0x8000);
private short field_38_docinfo6; protected short field_38_docinfo6;
private static BitField fHaveVersions = new BitField(0x0001); private static BitField fHaveVersions = new BitField(0x0001);
private static BitField fAutoVersions = new BitField(0x0002); private static BitField fAutoVersions = new BitField(0x0002);
private byte[] field_39_asumyi; protected byte[] field_39_asumyi;
private int field_40_cChWS; protected int field_40_cChWS;
private int field_41_cChWSFtnEdn; protected int field_41_cChWSFtnEdn;
private int field_42_grfDocEvents; protected int field_42_grfDocEvents;
private int field_43_virusinfo; protected int field_43_virusinfo;
private static BitField fVirusPrompted = new BitField(0x0001); private static BitField fVirusPrompted = new BitField(0x0001);
private static BitField fVirusLoadSafe = new BitField(0x0002); private static BitField fVirusLoadSafe = new BitField(0x0002);
private static BitField KeyVirusSession30 = new BitField(0xfffffffc); private static BitField KeyVirusSession30 = new BitField(0xfffffffc);
private byte[] field_44_Spare; protected byte[] field_44_Spare;
private int field_45_reserved1; protected int field_45_reserved1;
private int field_46_reserved2; protected int field_46_reserved2;
private int field_47_cDBC; protected int field_47_cDBC;
private int field_48_cDBCFtnEdn; protected int field_48_cDBCFtnEdn;
private int field_49_reserved; protected int field_49_reserved;
private short field_50_nfcFtnRef; protected short field_50_nfcFtnRef;
private short field_51_nfcEdnRef; protected short field_51_nfcEdnRef;
private short field_52_hpsZoonFontPag; protected short field_52_hpsZoonFontPag;
private short field_53_dywDispPag; protected short field_53_dywDispPag;
public DOPAbstractType() public DOPAbstractType()
@ -227,7 +228,7 @@ public abstract class DOPAbstractType
} }
protected void fillFields(byte [] data, short size, int offset) protected void fillFields(byte [] data, int offset)
{ {
field_1_formatFlags = data[ 0x0 + offset ]; field_1_formatFlags = data[ 0x0 + offset ];
field_2_unused2 = data[ 0x1 + offset ]; field_2_unused2 = data[ 0x1 + offset ];
@ -321,16 +322,16 @@ public abstract class DOPAbstractType
LittleEndian.putShort(data, 0x52 + offset, (short)field_32_view);; LittleEndian.putShort(data, 0x52 + offset, (short)field_32_view);;
LittleEndian.putInt(data, 0x54 + offset, field_33_docinfo4);; LittleEndian.putInt(data, 0x54 + offset, field_33_docinfo4);;
LittleEndian.putShort(data, 0x58 + offset, (short)field_34_adt);; LittleEndian.putShort(data, 0x58 + offset, (short)field_34_adt);;
; System.arraycopy(field_35_doptypography, 0, data, 0x5a + offset, field_35_doptypography.length);;
; System.arraycopy(field_36_dogrid, 0, data, 0x190 + offset, field_36_dogrid.length);;
LittleEndian.putShort(data, 0x19a + offset, (short)field_37_docinfo5);; LittleEndian.putShort(data, 0x19a + offset, (short)field_37_docinfo5);;
LittleEndian.putShort(data, 0x19c + offset, (short)field_38_docinfo6);; LittleEndian.putShort(data, 0x19c + offset, (short)field_38_docinfo6);;
; System.arraycopy(field_39_asumyi, 0, data, 0x19e + offset, field_39_asumyi.length);;
LittleEndian.putInt(data, 0x1aa + offset, field_40_cChWS);; LittleEndian.putInt(data, 0x1aa + offset, field_40_cChWS);;
LittleEndian.putInt(data, 0x1ae + offset, field_41_cChWSFtnEdn);; LittleEndian.putInt(data, 0x1ae + offset, field_41_cChWSFtnEdn);;
LittleEndian.putInt(data, 0x1b2 + offset, field_42_grfDocEvents);; LittleEndian.putInt(data, 0x1b2 + offset, field_42_grfDocEvents);;
LittleEndian.putInt(data, 0x1b6 + offset, field_43_virusinfo);; LittleEndian.putInt(data, 0x1b6 + offset, field_43_virusinfo);;
; System.arraycopy(field_44_Spare, 0, data, 0x1ba + offset, field_44_Spare.length);;
LittleEndian.putInt(data, 0x1d8 + offset, field_45_reserved1);; LittleEndian.putInt(data, 0x1d8 + offset, field_45_reserved1);;
LittleEndian.putInt(data, 0x1dc + offset, field_46_reserved2);; LittleEndian.putInt(data, 0x1dc + offset, field_46_reserved2);;
LittleEndian.putInt(data, 0x1e0 + offset, field_47_cDBC);; LittleEndian.putInt(data, 0x1e0 + offset, field_47_cDBC);;
@ -350,8 +351,6 @@ public abstract class DOPAbstractType
buffer.append("[DOP]\n"); buffer.append("[DOP]\n");
buffer.append(" .formatFlags = "); buffer.append(" .formatFlags = ");
buffer.append("0x");
buffer.append(HexDump.toHex((byte)getFormatFlags()));
buffer.append(" (").append(getFormatFlags()).append(" )\n"); buffer.append(" (").append(getFormatFlags()).append(" )\n");
buffer.append(" .fFacingPages = ").append(isFFacingPages()).append('\n'); buffer.append(" .fFacingPages = ").append(isFFacingPages()).append('\n');
buffer.append(" .fWidowControl = ").append(isFWidowControl()).append('\n'); buffer.append(" .fWidowControl = ").append(isFWidowControl()).append('\n');
@ -361,25 +360,17 @@ public abstract class DOPAbstractType
buffer.append(" .unused1 = ").append(isUnused1()).append('\n'); buffer.append(" .unused1 = ").append(isUnused1()).append('\n');
buffer.append(" .unused2 = "); buffer.append(" .unused2 = ");
buffer.append("0x");
buffer.append(HexDump.toHex((byte)getUnused2()));
buffer.append(" (").append(getUnused2()).append(" )\n"); buffer.append(" (").append(getUnused2()).append(" )\n");
buffer.append(" .footnoteInfo = "); buffer.append(" .footnoteInfo = ");
buffer.append("0x");
buffer.append(HexDump.toHex((short)getFootnoteInfo()));
buffer.append(" (").append(getFootnoteInfo()).append(" )\n"); buffer.append(" (").append(getFootnoteInfo()).append(" )\n");
buffer.append(" .rncFtn = ").append(getRncFtn()).append('\n'); buffer.append(" .rncFtn = ").append(getRncFtn()).append('\n');
buffer.append(" .nFtn = ").append(getNFtn()).append('\n'); buffer.append(" .nFtn = ").append(getNFtn()).append('\n');
buffer.append(" .fOutlineDirtySave = "); buffer.append(" .fOutlineDirtySave = ");
buffer.append("0x");
buffer.append(HexDump.toHex((byte)getFOutlineDirtySave()));
buffer.append(" (").append(getFOutlineDirtySave()).append(" )\n"); buffer.append(" (").append(getFOutlineDirtySave()).append(" )\n");
buffer.append(" .docinfo = "); buffer.append(" .docinfo = ");
buffer.append("0x");
buffer.append(HexDump.toHex((byte)getDocinfo()));
buffer.append(" (").append(getDocinfo()).append(" )\n"); buffer.append(" (").append(getDocinfo()).append(" )\n");
buffer.append(" .fOnlyMacPics = ").append(isFOnlyMacPics()).append('\n'); buffer.append(" .fOnlyMacPics = ").append(isFOnlyMacPics()).append('\n');
buffer.append(" .fOnlyWinPics = ").append(isFOnlyWinPics()).append('\n'); buffer.append(" .fOnlyWinPics = ").append(isFOnlyWinPics()).append('\n');
@ -391,8 +382,6 @@ public abstract class DOPAbstractType
buffer.append(" .fRevMarking = ").append(isFRevMarking()).append('\n'); buffer.append(" .fRevMarking = ").append(isFRevMarking()).append('\n');
buffer.append(" .docinfo1 = "); buffer.append(" .docinfo1 = ");
buffer.append("0x");
buffer.append(HexDump.toHex((byte)getDocinfo1()));
buffer.append(" (").append(getDocinfo1()).append(" )\n"); buffer.append(" (").append(getDocinfo1()).append(" )\n");
buffer.append(" .fBackup = ").append(isFBackup()).append('\n'); buffer.append(" .fBackup = ").append(isFBackup()).append('\n');
buffer.append(" .fExactCWords = ").append(isFExactCWords()).append('\n'); buffer.append(" .fExactCWords = ").append(isFExactCWords()).append('\n');
@ -404,8 +393,6 @@ public abstract class DOPAbstractType
buffer.append(" .fDfltTrueType = ").append(isFDfltTrueType()).append('\n'); buffer.append(" .fDfltTrueType = ").append(isFDfltTrueType()).append('\n');
buffer.append(" .docinfo2 = "); buffer.append(" .docinfo2 = ");
buffer.append("0x");
buffer.append(HexDump.toHex((byte)getDocinfo2()));
buffer.append(" (").append(getDocinfo2()).append(" )\n"); buffer.append(" (").append(getDocinfo2()).append(" )\n");
buffer.append(" .fPagSupressTopSpacing = ").append(isFPagSupressTopSpacing()).append('\n'); buffer.append(" .fPagSupressTopSpacing = ").append(isFPagSupressTopSpacing()).append('\n');
buffer.append(" .fProtEnabled = ").append(isFProtEnabled()).append('\n'); buffer.append(" .fProtEnabled = ").append(isFProtEnabled()).append('\n');
@ -417,8 +404,6 @@ public abstract class DOPAbstractType
buffer.append(" .fEmbedFonts = ").append(isFEmbedFonts()).append('\n'); buffer.append(" .fEmbedFonts = ").append(isFEmbedFonts()).append('\n');
buffer.append(" .docinfo3 = "); buffer.append(" .docinfo3 = ");
buffer.append("0x");
buffer.append(HexDump.toHex((short)getDocinfo3()));
buffer.append(" (").append(getDocinfo3()).append(" )\n"); buffer.append(" (").append(getDocinfo3()).append(" )\n");
buffer.append(" .oldfNoTabForInd = ").append(isOldfNoTabForInd()).append('\n'); buffer.append(" .oldfNoTabForInd = ").append(isOldfNoTabForInd()).append('\n');
buffer.append(" .oldfNoSpaceRaiseLower = ").append(isOldfNoSpaceRaiseLower()).append('\n'); buffer.append(" .oldfNoSpaceRaiseLower = ").append(isOldfNoSpaceRaiseLower()).append('\n');
@ -435,85 +420,53 @@ public abstract class DOPAbstractType
buffer.append(" .unused5 = ").append(getUnused5()).append('\n'); buffer.append(" .unused5 = ").append(getUnused5()).append('\n');
buffer.append(" .dxaTab = "); buffer.append(" .dxaTab = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getDxaTab()));
buffer.append(" (").append(getDxaTab()).append(" )\n"); buffer.append(" (").append(getDxaTab()).append(" )\n");
buffer.append(" .wSpare = "); buffer.append(" .wSpare = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getWSpare()));
buffer.append(" (").append(getWSpare()).append(" )\n"); buffer.append(" (").append(getWSpare()).append(" )\n");
buffer.append(" .dxaHotz = "); buffer.append(" .dxaHotz = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getDxaHotz()));
buffer.append(" (").append(getDxaHotz()).append(" )\n"); buffer.append(" (").append(getDxaHotz()).append(" )\n");
buffer.append(" .cConsexHypLim = "); buffer.append(" .cConsexHypLim = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getCConsexHypLim()));
buffer.append(" (").append(getCConsexHypLim()).append(" )\n"); buffer.append(" (").append(getCConsexHypLim()).append(" )\n");
buffer.append(" .wSpare2 = "); buffer.append(" .wSpare2 = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getWSpare2()));
buffer.append(" (").append(getWSpare2()).append(" )\n"); buffer.append(" (").append(getWSpare2()).append(" )\n");
buffer.append(" .dttmCreated = "); buffer.append(" .dttmCreated = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getDttmCreated()));
buffer.append(" (").append(getDttmCreated()).append(" )\n"); buffer.append(" (").append(getDttmCreated()).append(" )\n");
buffer.append(" .dttmRevised = "); buffer.append(" .dttmRevised = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getDttmRevised()));
buffer.append(" (").append(getDttmRevised()).append(" )\n"); buffer.append(" (").append(getDttmRevised()).append(" )\n");
buffer.append(" .dttmLastPrint = "); buffer.append(" .dttmLastPrint = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getDttmLastPrint()));
buffer.append(" (").append(getDttmLastPrint()).append(" )\n"); buffer.append(" (").append(getDttmLastPrint()).append(" )\n");
buffer.append(" .nRevision = "); buffer.append(" .nRevision = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getNRevision()));
buffer.append(" (").append(getNRevision()).append(" )\n"); buffer.append(" (").append(getNRevision()).append(" )\n");
buffer.append(" .tmEdited = "); buffer.append(" .tmEdited = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getTmEdited()));
buffer.append(" (").append(getTmEdited()).append(" )\n"); buffer.append(" (").append(getTmEdited()).append(" )\n");
buffer.append(" .cWords = "); buffer.append(" .cWords = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getCWords()));
buffer.append(" (").append(getCWords()).append(" )\n"); buffer.append(" (").append(getCWords()).append(" )\n");
buffer.append(" .cCh = "); buffer.append(" .cCh = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getCCh()));
buffer.append(" (").append(getCCh()).append(" )\n"); buffer.append(" (").append(getCCh()).append(" )\n");
buffer.append(" .cPg = "); buffer.append(" .cPg = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getCPg()));
buffer.append(" (").append(getCPg()).append(" )\n"); buffer.append(" (").append(getCPg()).append(" )\n");
buffer.append(" .cParas = "); buffer.append(" .cParas = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getCParas()));
buffer.append(" (").append(getCParas()).append(" )\n"); buffer.append(" (").append(getCParas()).append(" )\n");
buffer.append(" .Edn = "); buffer.append(" .Edn = ");
buffer.append("0x");
buffer.append(HexDump.toHex((short)getEdn()));
buffer.append(" (").append(getEdn()).append(" )\n"); buffer.append(" (").append(getEdn()).append(" )\n");
buffer.append(" .rncEdn = ").append(getRncEdn()).append('\n'); buffer.append(" .rncEdn = ").append(getRncEdn()).append('\n');
buffer.append(" .nEdn = ").append(getNEdn()).append('\n'); buffer.append(" .nEdn = ").append(getNEdn()).append('\n');
buffer.append(" .Edn1 = "); buffer.append(" .Edn1 = ");
buffer.append("0x");
buffer.append(HexDump.toHex((short)getEdn1()));
buffer.append(" (").append(getEdn1()).append(" )\n"); buffer.append(" (").append(getEdn1()).append(" )\n");
buffer.append(" .epc = ").append(getEpc()).append('\n'); buffer.append(" .epc = ").append(getEpc()).append('\n');
buffer.append(" .nfcFtnRef1 = ").append(getNfcFtnRef1()).append('\n'); buffer.append(" .nfcFtnRef1 = ").append(getNfcFtnRef1()).append('\n');
@ -524,43 +477,27 @@ public abstract class DOPAbstractType
buffer.append(" .fWCFtnEdn = ").append(isFWCFtnEdn()).append('\n'); buffer.append(" .fWCFtnEdn = ").append(isFWCFtnEdn()).append('\n');
buffer.append(" .cLines = "); buffer.append(" .cLines = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getCLines()));
buffer.append(" (").append(getCLines()).append(" )\n"); buffer.append(" (").append(getCLines()).append(" )\n");
buffer.append(" .cWordsFtnEnd = "); buffer.append(" .cWordsFtnEnd = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getCWordsFtnEnd()));
buffer.append(" (").append(getCWordsFtnEnd()).append(" )\n"); buffer.append(" (").append(getCWordsFtnEnd()).append(" )\n");
buffer.append(" .cChFtnEdn = "); buffer.append(" .cChFtnEdn = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getCChFtnEdn()));
buffer.append(" (").append(getCChFtnEdn()).append(" )\n"); buffer.append(" (").append(getCChFtnEdn()).append(" )\n");
buffer.append(" .cPgFtnEdn = "); buffer.append(" .cPgFtnEdn = ");
buffer.append("0x");
buffer.append(HexDump.toHex((short)getCPgFtnEdn()));
buffer.append(" (").append(getCPgFtnEdn()).append(" )\n"); buffer.append(" (").append(getCPgFtnEdn()).append(" )\n");
buffer.append(" .cParasFtnEdn = "); buffer.append(" .cParasFtnEdn = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getCParasFtnEdn()));
buffer.append(" (").append(getCParasFtnEdn()).append(" )\n"); buffer.append(" (").append(getCParasFtnEdn()).append(" )\n");
buffer.append(" .cLinesFtnEdn = "); buffer.append(" .cLinesFtnEdn = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getCLinesFtnEdn()));
buffer.append(" (").append(getCLinesFtnEdn()).append(" )\n"); buffer.append(" (").append(getCLinesFtnEdn()).append(" )\n");
buffer.append(" .lKeyProtDoc = "); buffer.append(" .lKeyProtDoc = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getLKeyProtDoc()));
buffer.append(" (").append(getLKeyProtDoc()).append(" )\n"); buffer.append(" (").append(getLKeyProtDoc()).append(" )\n");
buffer.append(" .view = "); buffer.append(" .view = ");
buffer.append("0x");
buffer.append(HexDump.toHex((short)getView()));
buffer.append(" (").append(getView()).append(" )\n"); buffer.append(" (").append(getView()).append(" )\n");
buffer.append(" .wvkSaved = ").append(getWvkSaved()).append('\n'); buffer.append(" .wvkSaved = ").append(getWvkSaved()).append('\n');
buffer.append(" .wScaleSaved = ").append(getWScaleSaved()).append('\n'); buffer.append(" .wScaleSaved = ").append(getWScaleSaved()).append('\n');
@ -569,8 +506,6 @@ public abstract class DOPAbstractType
buffer.append(" .iGutterPos = ").append(isIGutterPos()).append('\n'); buffer.append(" .iGutterPos = ").append(isIGutterPos()).append('\n');
buffer.append(" .docinfo4 = "); buffer.append(" .docinfo4 = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getDocinfo4()));
buffer.append(" (").append(getDocinfo4()).append(" )\n"); buffer.append(" (").append(getDocinfo4()).append(" )\n");
buffer.append(" .fNoTabForInd = ").append(isFNoTabForInd()).append('\n'); buffer.append(" .fNoTabForInd = ").append(isFNoTabForInd()).append('\n');
buffer.append(" .fNoSpaceRaiseLower = ").append(isFNoSpaceRaiseLower()).append('\n'); buffer.append(" .fNoSpaceRaiseLower = ").append(isFNoSpaceRaiseLower()).append('\n');
@ -591,23 +526,15 @@ public abstract class DOPAbstractType
buffer.append(" .fMWSmallCaps = ").append(isFMWSmallCaps()).append('\n'); buffer.append(" .fMWSmallCaps = ").append(isFMWSmallCaps()).append('\n');
buffer.append(" .adt = "); buffer.append(" .adt = ");
buffer.append("0x");
buffer.append(HexDump.toHex((short)getAdt()));
buffer.append(" (").append(getAdt()).append(" )\n"); buffer.append(" (").append(getAdt()).append(" )\n");
buffer.append(" .doptypography = "); buffer.append(" .doptypography = ");
buffer.append("0x");
buffer.append(HexDump.toHex((byte[])getDoptypography()));
buffer.append(" (").append(getDoptypography()).append(" )\n"); buffer.append(" (").append(getDoptypography()).append(" )\n");
buffer.append(" .dogrid = "); buffer.append(" .dogrid = ");
buffer.append("0x");
buffer.append(HexDump.toHex((byte[])getDogrid()));
buffer.append(" (").append(getDogrid()).append(" )\n"); buffer.append(" (").append(getDogrid()).append(" )\n");
buffer.append(" .docinfo5 = "); buffer.append(" .docinfo5 = ");
buffer.append("0x");
buffer.append(HexDump.toHex((short)getDocinfo5()));
buffer.append(" (").append(getDocinfo5()).append(" )\n"); buffer.append(" (").append(getDocinfo5()).append(" )\n");
buffer.append(" .lvl = ").append(getLvl()).append('\n'); buffer.append(" .lvl = ").append(getLvl()).append('\n');
buffer.append(" .fGramAllDone = ").append(isFGramAllDone()).append('\n'); buffer.append(" .fGramAllDone = ").append(isFGramAllDone()).append('\n');
@ -622,88 +549,56 @@ public abstract class DOPAbstractType
buffer.append(" .fMinFontSizePag = ").append(isFMinFontSizePag()).append('\n'); buffer.append(" .fMinFontSizePag = ").append(isFMinFontSizePag()).append('\n');
buffer.append(" .docinfo6 = "); buffer.append(" .docinfo6 = ");
buffer.append("0x");
buffer.append(HexDump.toHex((short)getDocinfo6()));
buffer.append(" (").append(getDocinfo6()).append(" )\n"); buffer.append(" (").append(getDocinfo6()).append(" )\n");
buffer.append(" .fHaveVersions = ").append(isFHaveVersions()).append('\n'); buffer.append(" .fHaveVersions = ").append(isFHaveVersions()).append('\n');
buffer.append(" .fAutoVersions = ").append(isFAutoVersions()).append('\n'); buffer.append(" .fAutoVersions = ").append(isFAutoVersions()).append('\n');
buffer.append(" .asumyi = "); buffer.append(" .asumyi = ");
buffer.append("0x");
buffer.append(HexDump.toHex((byte[])getAsumyi()));
buffer.append(" (").append(getAsumyi()).append(" )\n"); buffer.append(" (").append(getAsumyi()).append(" )\n");
buffer.append(" .cChWS = "); buffer.append(" .cChWS = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getCChWS()));
buffer.append(" (").append(getCChWS()).append(" )\n"); buffer.append(" (").append(getCChWS()).append(" )\n");
buffer.append(" .cChWSFtnEdn = "); buffer.append(" .cChWSFtnEdn = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getCChWSFtnEdn()));
buffer.append(" (").append(getCChWSFtnEdn()).append(" )\n"); buffer.append(" (").append(getCChWSFtnEdn()).append(" )\n");
buffer.append(" .grfDocEvents = "); buffer.append(" .grfDocEvents = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getGrfDocEvents()));
buffer.append(" (").append(getGrfDocEvents()).append(" )\n"); buffer.append(" (").append(getGrfDocEvents()).append(" )\n");
buffer.append(" .virusinfo = "); buffer.append(" .virusinfo = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getVirusinfo()));
buffer.append(" (").append(getVirusinfo()).append(" )\n"); buffer.append(" (").append(getVirusinfo()).append(" )\n");
buffer.append(" .fVirusPrompted = ").append(isFVirusPrompted()).append('\n'); buffer.append(" .fVirusPrompted = ").append(isFVirusPrompted()).append('\n');
buffer.append(" .fVirusLoadSafe = ").append(isFVirusLoadSafe()).append('\n'); buffer.append(" .fVirusLoadSafe = ").append(isFVirusLoadSafe()).append('\n');
buffer.append(" .KeyVirusSession30 = ").append(getKeyVirusSession30()).append('\n'); buffer.append(" .KeyVirusSession30 = ").append(getKeyVirusSession30()).append('\n');
buffer.append(" .Spare = "); buffer.append(" .Spare = ");
buffer.append("0x");
buffer.append(HexDump.toHex((byte[])getSpare()));
buffer.append(" (").append(getSpare()).append(" )\n"); buffer.append(" (").append(getSpare()).append(" )\n");
buffer.append(" .reserved1 = "); buffer.append(" .reserved1 = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getReserved1()));
buffer.append(" (").append(getReserved1()).append(" )\n"); buffer.append(" (").append(getReserved1()).append(" )\n");
buffer.append(" .reserved2 = "); buffer.append(" .reserved2 = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getReserved2()));
buffer.append(" (").append(getReserved2()).append(" )\n"); buffer.append(" (").append(getReserved2()).append(" )\n");
buffer.append(" .cDBC = "); buffer.append(" .cDBC = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getCDBC()));
buffer.append(" (").append(getCDBC()).append(" )\n"); buffer.append(" (").append(getCDBC()).append(" )\n");
buffer.append(" .cDBCFtnEdn = "); buffer.append(" .cDBCFtnEdn = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getCDBCFtnEdn()));
buffer.append(" (").append(getCDBCFtnEdn()).append(" )\n"); buffer.append(" (").append(getCDBCFtnEdn()).append(" )\n");
buffer.append(" .reserved = "); buffer.append(" .reserved = ");
buffer.append("0x");
buffer.append(HexDump.toHex((int)getReserved()));
buffer.append(" (").append(getReserved()).append(" )\n"); buffer.append(" (").append(getReserved()).append(" )\n");
buffer.append(" .nfcFtnRef = "); buffer.append(" .nfcFtnRef = ");
buffer.append("0x");
buffer.append(HexDump.toHex((short)getNfcFtnRef()));
buffer.append(" (").append(getNfcFtnRef()).append(" )\n"); buffer.append(" (").append(getNfcFtnRef()).append(" )\n");
buffer.append(" .nfcEdnRef = "); buffer.append(" .nfcEdnRef = ");
buffer.append("0x");
buffer.append(HexDump.toHex((short)getNfcEdnRef()));
buffer.append(" (").append(getNfcEdnRef()).append(" )\n"); buffer.append(" (").append(getNfcEdnRef()).append(" )\n");
buffer.append(" .hpsZoonFontPag = "); buffer.append(" .hpsZoonFontPag = ");
buffer.append("0x");
buffer.append(HexDump.toHex((short)getHpsZoonFontPag()));
buffer.append(" (").append(getHpsZoonFontPag()).append(" )\n"); buffer.append(" (").append(getHpsZoonFontPag()).append(" )\n");
buffer.append(" .dywDispPag = "); buffer.append(" .dywDispPag = ");
buffer.append("0x");
buffer.append(HexDump.toHex((short)getDywDispPag()));
buffer.append(" (").append(getDywDispPag()).append(" )\n"); buffer.append(" (").append(getDywDispPag()).append(" )\n");
buffer.append("[/DOP]\n"); buffer.append("[/DOP]\n");

View File

@ -63,6 +63,7 @@ import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.StringUtil; import org.apache.poi.util.StringUtil;
import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
import org.apache.poi.hdf.model.hdftypes.HDFType; import org.apache.poi.hdf.model.hdftypes.HDFType;
import org.apache.poi.hwpf.usermodel.*;
/** /**
* Paragraph Properties. * Paragraph Properties.
@ -75,76 +76,76 @@ public abstract class PAPAbstractType
implements HDFType implements HDFType
{ {
private int field_1_istd; protected int field_1_istd;
private byte field_2_jc; protected byte field_2_jc;
private byte field_3_fKeep; protected byte field_3_fKeep;
private byte field_4_fKeepFollow; protected byte field_4_fKeepFollow;
private byte field_5_fPageBreakBefore; protected byte field_5_fPageBreakBefore;
private byte field_6_fBrLnAbove; protected byte field_6_fBrLnAbove;
private byte field_7_fBrLnBelow; protected byte field_7_fBrLnBelow;
private byte field_8_pcVert; protected byte field_8_pcVert;
private byte field_9_pcHorz; protected byte field_9_pcHorz;
private byte field_10_brcp; protected byte field_10_brcp;
private byte field_11_brcl; protected byte field_11_brcl;
private byte field_12_ilvl; protected byte field_12_ilvl;
private byte field_13_fNoLnn; protected byte field_13_fNoLnn;
private int field_14_ilfo; protected int field_14_ilfo;
private byte field_15_fSideBySide; protected byte field_15_fSideBySide;
private byte field_16_fNoAutoHyph; protected byte field_16_fNoAutoHyph;
private byte field_17_fWidowControl; protected byte field_17_fWidowControl;
private int field_18_dxaRight; protected int field_18_dxaRight;
private int field_19_dxaLeft; protected int field_19_dxaLeft;
private int field_20_dxaLeft1; protected int field_20_dxaLeft1;
private short[] field_21_lspd; protected LineSpacingDescriptor field_21_lspd;
private int field_22_dyaBefore; protected int field_22_dyaBefore;
private int field_23_dyaAfter; protected int field_23_dyaAfter;
private byte[] field_24_phe; protected byte[] field_24_phe;
private byte field_25_fCrLf; protected byte field_25_fCrLf;
private byte field_26_fUsePgsuSettings; protected byte field_26_fUsePgsuSettings;
private byte field_27_fAdjustRight; protected byte field_27_fAdjustRight;
private byte field_28_fKinsoku; protected byte field_28_fKinsoku;
private byte field_29_fWordWrap; protected byte field_29_fWordWrap;
private byte field_30_fOverflowPunct; protected byte field_30_fOverflowPunct;
private byte field_31_fTopLinePunct; protected byte field_31_fTopLinePunct;
private byte field_32_fAutoSpaceDE; protected byte field_32_fAutoSpaceDE;
private byte field_33_fAutoSpaceDN; protected byte field_33_fAutoSpaceDN;
private int field_34_wAlignFont; protected int field_34_wAlignFont;
private short field_35_fontAlign; protected short field_35_fontAlign;
private static BitField fVertical = new BitField(0x0001); private static BitField fVertical = new BitField(0x0001);
private static BitField fBackward = new BitField(0x0002); private static BitField fBackward = new BitField(0x0002);
private static BitField fRotateFont = new BitField(0x0004); private static BitField fRotateFont = new BitField(0x0004);
private byte field_36_fBackward; protected byte field_36_fBackward;
private byte field_37_fRotateFont; protected byte field_37_fRotateFont;
private byte field_38_fInTable; protected byte field_38_fInTable;
private byte field_39_fTtp; protected byte field_39_fTtp;
private byte field_40_wr; protected byte field_40_wr;
private byte field_41_fLocked; protected byte field_41_fLocked;
private byte[] field_42_ptap; protected byte[] field_42_ptap;
private int field_43_dxaAbs; protected int field_43_dxaAbs;
private int field_44_dyaAbs; protected int field_44_dyaAbs;
private int field_45_dxaWidth; protected int field_45_dxaWidth;
private short[] field_46_brcTop; protected BorderCode field_46_brcTop;
private short[] field_47_brcLeft; protected BorderCode field_47_brcLeft;
private short[] field_48_brcBottom; protected BorderCode field_48_brcBottom;
private short[] field_49_brcRight; protected BorderCode field_49_brcRight;
private short[] field_50_brcBetween; protected BorderCode field_50_brcBetween;
private short[] field_51_brcBar; protected BorderCode field_51_brcBar;
private int field_52_dxaFromText; protected int field_52_dxaFromText;
private int field_53_dyaFromText; protected int field_53_dyaFromText;
private int field_54_dyaHeight; protected int field_54_dyaHeight;
private byte field_55_fMinHeight; protected byte field_55_fMinHeight;
private short field_56_shd; protected short field_56_shd;
private short field_57_dcs; protected short field_57_dcs;
private byte field_58_lvl; protected byte field_58_lvl;
private byte field_59_fNumRMIns; protected byte field_59_fNumRMIns;
private byte[] field_60_anld; protected byte[] field_60_anld;
private int field_61_fPropRMark; protected int field_61_fPropRMark;
private int field_62_ibstPropRMark; protected int field_62_ibstPropRMark;
private byte[] field_63_dttmPropRMark; protected DateAndTime field_63_dttmPropRMark;
private byte[] field_64_numrm; protected byte[] field_64_numrm;
private int field_65_itbdMac; protected int field_65_itbdMac;
private byte[] field_66_rgdxaTab; protected int[] field_66_rgdxaTab;
private byte[] field_67_rgtbd; protected byte[] field_67_rgtbd;
public PAPAbstractType() public PAPAbstractType()
@ -485,7 +486,7 @@ public abstract class PAPAbstractType
/** /**
* Get the lspd field for the PAP record. * Get the lspd field for the PAP record.
*/ */
public short[] getLspd() public LineSpacingDescriptor getLspd()
{ {
return field_21_lspd; return field_21_lspd;
} }
@ -493,7 +494,7 @@ public abstract class PAPAbstractType
/** /**
* Set the lspd field for the PAP record. * Set the lspd field for the PAP record.
*/ */
public void setLspd(short[] field_21_lspd) public void setLspd(LineSpacingDescriptor field_21_lspd)
{ {
this.field_21_lspd = field_21_lspd; this.field_21_lspd = field_21_lspd;
} }
@ -885,7 +886,7 @@ public abstract class PAPAbstractType
/** /**
* Get the brcTop field for the PAP record. * Get the brcTop field for the PAP record.
*/ */
public short[] getBrcTop() public BorderCode getBrcTop()
{ {
return field_46_brcTop; return field_46_brcTop;
} }
@ -893,7 +894,7 @@ public abstract class PAPAbstractType
/** /**
* Set the brcTop field for the PAP record. * Set the brcTop field for the PAP record.
*/ */
public void setBrcTop(short[] field_46_brcTop) public void setBrcTop(BorderCode field_46_brcTop)
{ {
this.field_46_brcTop = field_46_brcTop; this.field_46_brcTop = field_46_brcTop;
} }
@ -901,7 +902,7 @@ public abstract class PAPAbstractType
/** /**
* Get the brcLeft field for the PAP record. * Get the brcLeft field for the PAP record.
*/ */
public short[] getBrcLeft() public BorderCode getBrcLeft()
{ {
return field_47_brcLeft; return field_47_brcLeft;
} }
@ -909,7 +910,7 @@ public abstract class PAPAbstractType
/** /**
* Set the brcLeft field for the PAP record. * Set the brcLeft field for the PAP record.
*/ */
public void setBrcLeft(short[] field_47_brcLeft) public void setBrcLeft(BorderCode field_47_brcLeft)
{ {
this.field_47_brcLeft = field_47_brcLeft; this.field_47_brcLeft = field_47_brcLeft;
} }
@ -917,7 +918,7 @@ public abstract class PAPAbstractType
/** /**
* Get the brcBottom field for the PAP record. * Get the brcBottom field for the PAP record.
*/ */
public short[] getBrcBottom() public BorderCode getBrcBottom()
{ {
return field_48_brcBottom; return field_48_brcBottom;
} }
@ -925,7 +926,7 @@ public abstract class PAPAbstractType
/** /**
* Set the brcBottom field for the PAP record. * Set the brcBottom field for the PAP record.
*/ */
public void setBrcBottom(short[] field_48_brcBottom) public void setBrcBottom(BorderCode field_48_brcBottom)
{ {
this.field_48_brcBottom = field_48_brcBottom; this.field_48_brcBottom = field_48_brcBottom;
} }
@ -933,7 +934,7 @@ public abstract class PAPAbstractType
/** /**
* Get the brcRight field for the PAP record. * Get the brcRight field for the PAP record.
*/ */
public short[] getBrcRight() public BorderCode getBrcRight()
{ {
return field_49_brcRight; return field_49_brcRight;
} }
@ -941,7 +942,7 @@ public abstract class PAPAbstractType
/** /**
* Set the brcRight field for the PAP record. * Set the brcRight field for the PAP record.
*/ */
public void setBrcRight(short[] field_49_brcRight) public void setBrcRight(BorderCode field_49_brcRight)
{ {
this.field_49_brcRight = field_49_brcRight; this.field_49_brcRight = field_49_brcRight;
} }
@ -949,7 +950,7 @@ public abstract class PAPAbstractType
/** /**
* Get the brcBetween field for the PAP record. * Get the brcBetween field for the PAP record.
*/ */
public short[] getBrcBetween() public BorderCode getBrcBetween()
{ {
return field_50_brcBetween; return field_50_brcBetween;
} }
@ -957,7 +958,7 @@ public abstract class PAPAbstractType
/** /**
* Set the brcBetween field for the PAP record. * Set the brcBetween field for the PAP record.
*/ */
public void setBrcBetween(short[] field_50_brcBetween) public void setBrcBetween(BorderCode field_50_brcBetween)
{ {
this.field_50_brcBetween = field_50_brcBetween; this.field_50_brcBetween = field_50_brcBetween;
} }
@ -965,7 +966,7 @@ public abstract class PAPAbstractType
/** /**
* Get the brcBar field for the PAP record. * Get the brcBar field for the PAP record.
*/ */
public short[] getBrcBar() public BorderCode getBrcBar()
{ {
return field_51_brcBar; return field_51_brcBar;
} }
@ -973,7 +974,7 @@ public abstract class PAPAbstractType
/** /**
* Set the brcBar field for the PAP record. * Set the brcBar field for the PAP record.
*/ */
public void setBrcBar(short[] field_51_brcBar) public void setBrcBar(BorderCode field_51_brcBar)
{ {
this.field_51_brcBar = field_51_brcBar; this.field_51_brcBar = field_51_brcBar;
} }
@ -1157,7 +1158,7 @@ public abstract class PAPAbstractType
/** /**
* Get the dttmPropRMark field for the PAP record. * Get the dttmPropRMark field for the PAP record.
*/ */
public byte[] getDttmPropRMark() public DateAndTime getDttmPropRMark()
{ {
return field_63_dttmPropRMark; return field_63_dttmPropRMark;
} }
@ -1165,7 +1166,7 @@ public abstract class PAPAbstractType
/** /**
* Set the dttmPropRMark field for the PAP record. * Set the dttmPropRMark field for the PAP record.
*/ */
public void setDttmPropRMark(byte[] field_63_dttmPropRMark) public void setDttmPropRMark(DateAndTime field_63_dttmPropRMark)
{ {
this.field_63_dttmPropRMark = field_63_dttmPropRMark; this.field_63_dttmPropRMark = field_63_dttmPropRMark;
} }
@ -1205,7 +1206,7 @@ public abstract class PAPAbstractType
/** /**
* Get the rgdxaTab field for the PAP record. * Get the rgdxaTab field for the PAP record.
*/ */
public byte[] getRgdxaTab() public int[] getRgdxaTab()
{ {
return field_66_rgdxaTab; return field_66_rgdxaTab;
} }
@ -1213,7 +1214,7 @@ public abstract class PAPAbstractType
/** /**
* Set the rgdxaTab field for the PAP record. * Set the rgdxaTab field for the PAP record.
*/ */
public void setRgdxaTab(byte[] field_66_rgdxaTab) public void setRgdxaTab(int[] field_66_rgdxaTab)
{ {
this.field_66_rgdxaTab = field_66_rgdxaTab; this.field_66_rgdxaTab = field_66_rgdxaTab;
} }

View File

@ -63,6 +63,7 @@ import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.StringUtil; import org.apache.poi.util.StringUtil;
import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
import org.apache.poi.hdf.model.hdftypes.HDFType; import org.apache.poi.hdf.model.hdftypes.HDFType;
import org.apache.poi.hwpf.usermodel.*;
/** /**
* Section Properties. * Section Properties.
@ -75,65 +76,65 @@ public abstract class SEPAbstractType
implements HDFType implements HDFType
{ {
private byte field_1_bkc; protected byte field_1_bkc;
private boolean field_2_fTitlePage; protected boolean field_2_fTitlePage;
private boolean field_3_fAutoPgn; protected boolean field_3_fAutoPgn;
private byte field_4_nfcPgn; protected byte field_4_nfcPgn;
private boolean field_5_fUnlocked; protected boolean field_5_fUnlocked;
private byte field_6_cnsPgn; protected byte field_6_cnsPgn;
private boolean field_7_fPgnRestart; protected boolean field_7_fPgnRestart;
private boolean field_8_fEndNote; protected boolean field_8_fEndNote;
private byte field_9_lnc; protected byte field_9_lnc;
private byte field_10_grpfIhdt; protected byte field_10_grpfIhdt;
private int field_11_nLnnMod; protected int field_11_nLnnMod;
private int field_12_dxaLnn; protected int field_12_dxaLnn;
private int field_13_dxaPgn; protected int field_13_dxaPgn;
private int field_14_dyaPgn; protected int field_14_dyaPgn;
private boolean field_15_fLBetween; protected boolean field_15_fLBetween;
private byte field_16_vjc; protected byte field_16_vjc;
private int field_17_dmBinFirst; protected int field_17_dmBinFirst;
private int field_18_dmBinOther; protected int field_18_dmBinOther;
private int field_19_dmPaperReq; protected int field_19_dmPaperReq;
private short[] field_20_brcTop; protected BorderCode field_20_brcTop;
private short[] field_21_brcLeft; protected BorderCode field_21_brcLeft;
private short[] field_22_brcBottom; protected BorderCode field_22_brcBottom;
private short[] field_23_brcRight; protected BorderCode field_23_brcRight;
private boolean field_24_fPropMark; protected boolean field_24_fPropMark;
private int field_25_ibstPropRMark; protected int field_25_ibstPropRMark;
private int field_26_dttmPropRMark; protected DateAndTime field_26_dttmPropRMark;
private int field_27_dxtCharSpace; protected int field_27_dxtCharSpace;
private int field_28_dyaLinePitch; protected int field_28_dyaLinePitch;
private int field_29_clm; protected int field_29_clm;
private int field_30_unused2; protected int field_30_unused2;
private byte field_31_dmOrientPage; protected byte field_31_dmOrientPage;
private byte field_32_iHeadingPgn; protected byte field_32_iHeadingPgn;
private int field_33_pgnStart; protected int field_33_pgnStart;
private int field_34_lnnMin; protected int field_34_lnnMin;
private int field_35_wTextFlow; protected int field_35_wTextFlow;
private short field_36_unused3; protected short field_36_unused3;
private int field_37_pgbProp; protected int field_37_pgbProp;
private short field_38_unused4; protected short field_38_unused4;
private int field_39_xaPage; protected int field_39_xaPage;
private int field_40_yaPage; protected int field_40_yaPage;
private int field_41_xaPageNUp; protected int field_41_xaPageNUp;
private int field_42_yaPageNUp; protected int field_42_yaPageNUp;
private int field_43_dxaLeft; protected int field_43_dxaLeft;
private int field_44_dxaRight; protected int field_44_dxaRight;
private int field_45_dyaTop; protected int field_45_dyaTop;
private int field_46_dyaBottom; protected int field_46_dyaBottom;
private int field_47_dzaGutter; protected int field_47_dzaGutter;
private int field_48_dyaHdrTop; protected int field_48_dyaHdrTop;
private int field_49_dyaHdrBottom; protected int field_49_dyaHdrBottom;
private int field_50_ccolM1; protected int field_50_ccolM1;
private boolean field_51_fEvenlySpaced; protected boolean field_51_fEvenlySpaced;
private byte field_52_unused5; protected byte field_52_unused5;
private int field_53_dxaColumns; protected int field_53_dxaColumns;
private int[] field_54_rgdxaColumn; protected int[] field_54_rgdxaColumn;
private int field_55_dxaColumnWidth; protected int field_55_dxaColumnWidth;
private byte field_56_dmOrientFirst; protected byte field_56_dmOrientFirst;
private byte field_57_fLayout; protected byte field_57_fLayout;
private short field_58_unused6; protected short field_58_unused6;
private byte[] field_59_olstAnm; protected byte[] field_59_olstAnm;
public SEPAbstractType() public SEPAbstractType()
@ -458,7 +459,7 @@ public abstract class SEPAbstractType
/** /**
* Get the brcTop field for the SEP record. * Get the brcTop field for the SEP record.
*/ */
public short[] getBrcTop() public BorderCode getBrcTop()
{ {
return field_20_brcTop; return field_20_brcTop;
} }
@ -466,7 +467,7 @@ public abstract class SEPAbstractType
/** /**
* Set the brcTop field for the SEP record. * Set the brcTop field for the SEP record.
*/ */
public void setBrcTop(short[] field_20_brcTop) public void setBrcTop(BorderCode field_20_brcTop)
{ {
this.field_20_brcTop = field_20_brcTop; this.field_20_brcTop = field_20_brcTop;
} }
@ -474,7 +475,7 @@ public abstract class SEPAbstractType
/** /**
* Get the brcLeft field for the SEP record. * Get the brcLeft field for the SEP record.
*/ */
public short[] getBrcLeft() public BorderCode getBrcLeft()
{ {
return field_21_brcLeft; return field_21_brcLeft;
} }
@ -482,7 +483,7 @@ public abstract class SEPAbstractType
/** /**
* Set the brcLeft field for the SEP record. * Set the brcLeft field for the SEP record.
*/ */
public void setBrcLeft(short[] field_21_brcLeft) public void setBrcLeft(BorderCode field_21_brcLeft)
{ {
this.field_21_brcLeft = field_21_brcLeft; this.field_21_brcLeft = field_21_brcLeft;
} }
@ -490,7 +491,7 @@ public abstract class SEPAbstractType
/** /**
* Get the brcBottom field for the SEP record. * Get the brcBottom field for the SEP record.
*/ */
public short[] getBrcBottom() public BorderCode getBrcBottom()
{ {
return field_22_brcBottom; return field_22_brcBottom;
} }
@ -498,7 +499,7 @@ public abstract class SEPAbstractType
/** /**
* Set the brcBottom field for the SEP record. * Set the brcBottom field for the SEP record.
*/ */
public void setBrcBottom(short[] field_22_brcBottom) public void setBrcBottom(BorderCode field_22_brcBottom)
{ {
this.field_22_brcBottom = field_22_brcBottom; this.field_22_brcBottom = field_22_brcBottom;
} }
@ -506,7 +507,7 @@ public abstract class SEPAbstractType
/** /**
* Get the brcRight field for the SEP record. * Get the brcRight field for the SEP record.
*/ */
public short[] getBrcRight() public BorderCode getBrcRight()
{ {
return field_23_brcRight; return field_23_brcRight;
} }
@ -514,7 +515,7 @@ public abstract class SEPAbstractType
/** /**
* Set the brcRight field for the SEP record. * Set the brcRight field for the SEP record.
*/ */
public void setBrcRight(short[] field_23_brcRight) public void setBrcRight(BorderCode field_23_brcRight)
{ {
this.field_23_brcRight = field_23_brcRight; this.field_23_brcRight = field_23_brcRight;
} }
@ -554,7 +555,7 @@ public abstract class SEPAbstractType
/** /**
* Get the dttmPropRMark field for the SEP record. * Get the dttmPropRMark field for the SEP record.
*/ */
public int getDttmPropRMark() public DateAndTime getDttmPropRMark()
{ {
return field_26_dttmPropRMark; return field_26_dttmPropRMark;
} }
@ -562,7 +563,7 @@ public abstract class SEPAbstractType
/** /**
* Set the dttmPropRMark field for the SEP record. * Set the dttmPropRMark field for the SEP record.
*/ */
public void setDttmPropRMark(int field_26_dttmPropRMark) public void setDttmPropRMark(DateAndTime field_26_dttmPropRMark)
{ {
this.field_26_dttmPropRMark = field_26_dttmPropRMark; this.field_26_dttmPropRMark = field_26_dttmPropRMark;
} }

View File

@ -63,6 +63,7 @@ import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.StringUtil; import org.apache.poi.util.StringUtil;
import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
import org.apache.poi.hdf.model.hdftypes.HDFType; import org.apache.poi.hdf.model.hdftypes.HDFType;
import org.apache.poi.hwpf.usermodel.*;
/** /**
* Table Properties. * Table Properties.
@ -75,22 +76,22 @@ public abstract class TAPAbstractType
implements HDFType implements HDFType
{ {
private int field_1_jc; protected int field_1_jc;
private int field_2_dxaGapHalf; protected int field_2_dxaGapHalf;
private int field_3_dyaRowHeight; protected int field_3_dyaRowHeight;
private boolean field_4_fCantSplit; protected boolean field_4_fCantSplit;
private boolean field_5_fTableHeader; protected boolean field_5_fTableHeader;
private int field_6_tlp; protected int field_6_tlp;
private short field_7_itcMac; protected short field_7_itcMac;
private short[] field_8_rgdxaCenter; protected short[] field_8_rgdxaCenter;
private TCAbstractType[] field_9_rgtc; protected TableCellDescriptor[] field_9_rgtc;
private byte[] field_10_rgshd; protected ShadingDescriptor[] field_10_rgshd;
private short[] field_11_brcBottom; protected BorderCode field_11_brcBottom;
private short[] field_12_brcTop; protected BorderCode field_12_brcTop;
private short[] field_13_brcLeft; protected BorderCode field_13_brcLeft;
private short[] field_14_brcRight; protected BorderCode field_14_brcRight;
private short[] field_15_brcVertical; protected BorderCode field_15_brcVertical;
private short[] field_16_brcHorizontal; protected BorderCode field_16_brcHorizontal;
public TAPAbstractType() public TAPAbstractType()
@ -239,7 +240,7 @@ public abstract class TAPAbstractType
/** /**
* Get the rgtc field for the TAP record. * Get the rgtc field for the TAP record.
*/ */
public TCAbstractType[] getRgtc() public TableCellDescriptor[] getRgtc()
{ {
return field_9_rgtc; return field_9_rgtc;
} }
@ -247,7 +248,7 @@ public abstract class TAPAbstractType
/** /**
* Set the rgtc field for the TAP record. * Set the rgtc field for the TAP record.
*/ */
public void setRgtc(TCAbstractType[] field_9_rgtc) public void setRgtc(TableCellDescriptor[] field_9_rgtc)
{ {
this.field_9_rgtc = field_9_rgtc; this.field_9_rgtc = field_9_rgtc;
} }
@ -255,7 +256,7 @@ public abstract class TAPAbstractType
/** /**
* Get the rgshd field for the TAP record. * Get the rgshd field for the TAP record.
*/ */
public byte[] getRgshd() public ShadingDescriptor[] getRgshd()
{ {
return field_10_rgshd; return field_10_rgshd;
} }
@ -263,7 +264,7 @@ public abstract class TAPAbstractType
/** /**
* Set the rgshd field for the TAP record. * Set the rgshd field for the TAP record.
*/ */
public void setRgshd(byte[] field_10_rgshd) public void setRgshd(ShadingDescriptor[] field_10_rgshd)
{ {
this.field_10_rgshd = field_10_rgshd; this.field_10_rgshd = field_10_rgshd;
} }
@ -271,7 +272,7 @@ public abstract class TAPAbstractType
/** /**
* Get the brcBottom field for the TAP record. * Get the brcBottom field for the TAP record.
*/ */
public short[] getBrcBottom() public BorderCode getBrcBottom()
{ {
return field_11_brcBottom; return field_11_brcBottom;
} }
@ -279,7 +280,7 @@ public abstract class TAPAbstractType
/** /**
* Set the brcBottom field for the TAP record. * Set the brcBottom field for the TAP record.
*/ */
public void setBrcBottom(short[] field_11_brcBottom) public void setBrcBottom(BorderCode field_11_brcBottom)
{ {
this.field_11_brcBottom = field_11_brcBottom; this.field_11_brcBottom = field_11_brcBottom;
} }
@ -287,7 +288,7 @@ public abstract class TAPAbstractType
/** /**
* Get the brcTop field for the TAP record. * Get the brcTop field for the TAP record.
*/ */
public short[] getBrcTop() public BorderCode getBrcTop()
{ {
return field_12_brcTop; return field_12_brcTop;
} }
@ -295,7 +296,7 @@ public abstract class TAPAbstractType
/** /**
* Set the brcTop field for the TAP record. * Set the brcTop field for the TAP record.
*/ */
public void setBrcTop(short[] field_12_brcTop) public void setBrcTop(BorderCode field_12_brcTop)
{ {
this.field_12_brcTop = field_12_brcTop; this.field_12_brcTop = field_12_brcTop;
} }
@ -303,7 +304,7 @@ public abstract class TAPAbstractType
/** /**
* Get the brcLeft field for the TAP record. * Get the brcLeft field for the TAP record.
*/ */
public short[] getBrcLeft() public BorderCode getBrcLeft()
{ {
return field_13_brcLeft; return field_13_brcLeft;
} }
@ -311,7 +312,7 @@ public abstract class TAPAbstractType
/** /**
* Set the brcLeft field for the TAP record. * Set the brcLeft field for the TAP record.
*/ */
public void setBrcLeft(short[] field_13_brcLeft) public void setBrcLeft(BorderCode field_13_brcLeft)
{ {
this.field_13_brcLeft = field_13_brcLeft; this.field_13_brcLeft = field_13_brcLeft;
} }
@ -319,7 +320,7 @@ public abstract class TAPAbstractType
/** /**
* Get the brcRight field for the TAP record. * Get the brcRight field for the TAP record.
*/ */
public short[] getBrcRight() public BorderCode getBrcRight()
{ {
return field_14_brcRight; return field_14_brcRight;
} }
@ -327,7 +328,7 @@ public abstract class TAPAbstractType
/** /**
* Set the brcRight field for the TAP record. * Set the brcRight field for the TAP record.
*/ */
public void setBrcRight(short[] field_14_brcRight) public void setBrcRight(BorderCode field_14_brcRight)
{ {
this.field_14_brcRight = field_14_brcRight; this.field_14_brcRight = field_14_brcRight;
} }
@ -335,7 +336,7 @@ public abstract class TAPAbstractType
/** /**
* Get the brcVertical field for the TAP record. * Get the brcVertical field for the TAP record.
*/ */
public short[] getBrcVertical() public BorderCode getBrcVertical()
{ {
return field_15_brcVertical; return field_15_brcVertical;
} }
@ -343,7 +344,7 @@ public abstract class TAPAbstractType
/** /**
* Set the brcVertical field for the TAP record. * Set the brcVertical field for the TAP record.
*/ */
public void setBrcVertical(short[] field_15_brcVertical) public void setBrcVertical(BorderCode field_15_brcVertical)
{ {
this.field_15_brcVertical = field_15_brcVertical; this.field_15_brcVertical = field_15_brcVertical;
} }
@ -351,7 +352,7 @@ public abstract class TAPAbstractType
/** /**
* Get the brcHorizontal field for the TAP record. * Get the brcHorizontal field for the TAP record.
*/ */
public short[] getBrcHorizontal() public BorderCode getBrcHorizontal()
{ {
return field_16_brcHorizontal; return field_16_brcHorizontal;
} }
@ -359,7 +360,7 @@ public abstract class TAPAbstractType
/** /**
* Set the brcHorizontal field for the TAP record. * Set the brcHorizontal field for the TAP record.
*/ */
public void setBrcHorizontal(short[] field_16_brcHorizontal) public void setBrcHorizontal(BorderCode field_16_brcHorizontal)
{ {
this.field_16_brcHorizontal = field_16_brcHorizontal; this.field_16_brcHorizontal = field_16_brcHorizontal;
} }

View File

@ -63,6 +63,7 @@ import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.StringUtil; import org.apache.poi.util.StringUtil;
import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
import org.apache.poi.hdf.model.hdftypes.HDFType; import org.apache.poi.hdf.model.hdftypes.HDFType;
import org.apache.poi.hwpf.usermodel.*;
/** /**
* Table Cell Descriptor. * Table Cell Descriptor.
@ -75,7 +76,7 @@ public abstract class TCAbstractType
implements HDFType implements HDFType
{ {
private short field_1_rgf; protected short field_1_rgf;
private static BitField fFirstMerged = new BitField(0x0001); private static BitField fFirstMerged = new BitField(0x0001);
private static BitField fMerged = new BitField(0x0002); private static BitField fMerged = new BitField(0x0002);
private static BitField fVertical = new BitField(0x0004); private static BitField fVertical = new BitField(0x0004);
@ -84,11 +85,11 @@ public abstract class TCAbstractType
private static BitField fVertMerge = new BitField(0x0020); private static BitField fVertMerge = new BitField(0x0020);
private static BitField fVertRestart = new BitField(0x0040); private static BitField fVertRestart = new BitField(0x0040);
private static BitField vertAlign = new BitField(0x0180); private static BitField vertAlign = new BitField(0x0180);
private short field_2_unused; protected short field_2_unused;
private short[] field_3_brcTop; protected BorderCode field_3_brcTop;
private short[] field_4_brcLeft; protected BorderCode field_4_brcLeft;
private short[] field_5_brcBottom; protected BorderCode field_5_brcBottom;
private short[] field_6_brcRight; protected BorderCode field_6_brcRight;
public TCAbstractType() public TCAbstractType()
@ -96,6 +97,64 @@ public abstract class TCAbstractType
} }
protected void fillFields(byte [] data, int offset)
{
field_1_rgf = LittleEndian.getShort(data, 0x0 + offset);
field_2_unused = LittleEndian.getShort(data, 0x2 + offset);
field_3_brcTop = new BorderCode(data, 0x4 + offset);
field_4_brcLeft = new BorderCode(data, 0x8 + offset);
field_5_brcBottom = new BorderCode(data, 0xc + offset);
field_6_brcRight = new BorderCode(data, 0x10 + offset);
}
public void serialize(byte[] data, int offset)
{
LittleEndian.putShort(data, 0x0 + offset, (short)field_1_rgf);;
LittleEndian.putShort(data, 0x2 + offset, (short)field_2_unused);;
field_3_brcTop.serialize(data, 0x4 + offset);;
field_4_brcLeft.serialize(data, 0x8 + offset);;
field_5_brcBottom.serialize(data, 0xc + offset);;
field_6_brcRight.serialize(data, 0x10 + offset);;
}
public String toString()
{
StringBuffer buffer = new StringBuffer();
buffer.append("[TC]\n");
buffer.append(" .rgf = ");
buffer.append(" (").append(getRgf()).append(" )\n");
buffer.append(" .fFirstMerged = ").append(isFFirstMerged()).append('\n');
buffer.append(" .fMerged = ").append(isFMerged()).append('\n');
buffer.append(" .fVertical = ").append(isFVertical()).append('\n');
buffer.append(" .fBackward = ").append(isFBackward()).append('\n');
buffer.append(" .fRotateFont = ").append(isFRotateFont()).append('\n');
buffer.append(" .fVertMerge = ").append(isFVertMerge()).append('\n');
buffer.append(" .fVertRestart = ").append(isFVertRestart()).append('\n');
buffer.append(" .vertAlign = ").append(getVertAlign()).append('\n');
buffer.append(" .unused = ");
buffer.append(" (").append(getUnused()).append(" )\n");
buffer.append(" .brcTop = ");
buffer.append(" (").append(getBrcTop()).append(" )\n");
buffer.append(" .brcLeft = ");
buffer.append(" (").append(getBrcLeft()).append(" )\n");
buffer.append(" .brcBottom = ");
buffer.append(" (").append(getBrcBottom()).append(" )\n");
buffer.append(" .brcRight = ");
buffer.append(" (").append(getBrcRight()).append(" )\n");
buffer.append("[/TC]\n");
return buffer.toString();
}
/** /**
* Size of record (exluding 4 byte header) * Size of record (exluding 4 byte header)
*/ */
@ -141,7 +200,7 @@ public abstract class TCAbstractType
/** /**
* Get the brcTop field for the TC record. * Get the brcTop field for the TC record.
*/ */
public short[] getBrcTop() public BorderCode getBrcTop()
{ {
return field_3_brcTop; return field_3_brcTop;
} }
@ -149,7 +208,7 @@ public abstract class TCAbstractType
/** /**
* Set the brcTop field for the TC record. * Set the brcTop field for the TC record.
*/ */
public void setBrcTop(short[] field_3_brcTop) public void setBrcTop(BorderCode field_3_brcTop)
{ {
this.field_3_brcTop = field_3_brcTop; this.field_3_brcTop = field_3_brcTop;
} }
@ -157,7 +216,7 @@ public abstract class TCAbstractType
/** /**
* Get the brcLeft field for the TC record. * Get the brcLeft field for the TC record.
*/ */
public short[] getBrcLeft() public BorderCode getBrcLeft()
{ {
return field_4_brcLeft; return field_4_brcLeft;
} }
@ -165,7 +224,7 @@ public abstract class TCAbstractType
/** /**
* Set the brcLeft field for the TC record. * Set the brcLeft field for the TC record.
*/ */
public void setBrcLeft(short[] field_4_brcLeft) public void setBrcLeft(BorderCode field_4_brcLeft)
{ {
this.field_4_brcLeft = field_4_brcLeft; this.field_4_brcLeft = field_4_brcLeft;
} }
@ -173,7 +232,7 @@ public abstract class TCAbstractType
/** /**
* Get the brcBottom field for the TC record. * Get the brcBottom field for the TC record.
*/ */
public short[] getBrcBottom() public BorderCode getBrcBottom()
{ {
return field_5_brcBottom; return field_5_brcBottom;
} }
@ -181,7 +240,7 @@ public abstract class TCAbstractType
/** /**
* Set the brcBottom field for the TC record. * Set the brcBottom field for the TC record.
*/ */
public void setBrcBottom(short[] field_5_brcBottom) public void setBrcBottom(BorderCode field_5_brcBottom)
{ {
this.field_5_brcBottom = field_5_brcBottom; this.field_5_brcBottom = field_5_brcBottom;
} }
@ -189,7 +248,7 @@ public abstract class TCAbstractType
/** /**
* Get the brcRight field for the TC record. * Get the brcRight field for the TC record.
*/ */
public short[] getBrcRight() public BorderCode getBrcRight()
{ {
return field_6_brcRight; return field_6_brcRight;
} }
@ -197,7 +256,7 @@ public abstract class TCAbstractType
/** /**
* Set the brcRight field for the TC record. * Set the brcRight field for the TC record.
*/ */
public void setBrcRight(short[] field_6_brcRight) public void setBrcRight(BorderCode field_6_brcRight)
{ {
this.field_6_brcRight = field_6_brcRight; this.field_6_brcRight = field_6_brcRight;
} }

View File

@ -319,18 +319,7 @@ public class CharacterSprmCompresser
size += SprmUtils.addSprm((short)0x2859, newCHP.getSfxtText(), null, sprmList); size += SprmUtils.addSprm((short)0x2859, newCHP.getSfxtText(), null, sprmList);
} }
// spit out the final grpprl return SprmUtils.getGrpprl(sprmList, size);
byte[] grpprl = new byte[size];
int listSize = sprmList.size() - 1;
int index = 0;
for (; listSize >= 0; listSize--)
{
byte[] sprm = (byte[])sprmList.remove(0);
System.arraycopy(sprm, 0, grpprl, index, sprm.length);
index += sprm.length;
}
return grpprl;
} }

View File

@ -329,18 +329,7 @@ public class ParagraphSprmCompressor
size += SprmUtils.addSprm((short)0xC645, 0, newPAP.getNumrm(), sprmList); size += SprmUtils.addSprm((short)0xC645, 0, newPAP.getNumrm(), sprmList);
} }
// spit out the final grpprl return SprmUtils.getGrpprl(sprmList, size);
byte[] grpprl = new byte[size];
int listSize = sprmList.size() - 1;
int index = 0;
for (; listSize >= 0; listSize--)
{
byte[] sprm = (byte[])sprmList.remove(0);
System.arraycopy(sprm, 0, grpprl, index, sprm.length);
index += sprm.length;
}
return grpprl;
} }
} }

View File

@ -123,6 +123,23 @@ public class SprmUtils
return sprm.length; return sprm.length;
} }
public static byte[] getGrpprl(List sprmList, int size)
{
// spit out the final grpprl
byte[] grpprl = new byte[size];
int listSize = sprmList.size() - 1;
int index = 0;
for (; listSize >= 0; listSize--)
{
byte[] sprm = (byte[])sprmList.remove(0);
System.arraycopy(sprm, 0, grpprl, index, sprm.length);
index += sprm.length;
}
return grpprl;
}
public static int convertBrcToInt(short[] brc) public static int convertBrcToInt(short[] brc)
{ {
byte[] buf = new byte[4]; byte[] buf = new byte[4];

View File

@ -55,12 +55,281 @@
package org.apache.poi.hwpf.usermodel; package org.apache.poi.hwpf.usermodel;
import org.apache.poi.hwpf.model.hdftypes.definitions.CHPAbstractType; import org.apache.poi.hwpf.model.hdftypes.definitions.CHPAbstractType;
import org.apache.poi.hwpf.model.hdftypes.StyleDescription;
import org.apache.poi.hwpf.sprm.SprmBuffer;
public class CharacterProperties extends CHPAbstractType public class CharacterProperties
extends CHPAbstractType implements Cloneable
{ {
public final static short SPRM_FRMARKDEL = (short)0x0800;
public final static short SPRM_FRMARK = 0x0801;
public final static short SPRM_FFLDVANISH = 0x0802;
public final static short SPRM_PICLOCATION = 0x6A03;
public final static short SPRM_IBSTRMARK = 0x4804;
public final static short SPRM_DTTMRMARK = 0x6805;
public final static short SPRM_FDATA = 0x0806;
public final static short SPRM_SYMBOL = 0x6A09;
public final static short SPRM_FOLE2 = 0x080A;
public final static short SPRM_HIGHLIGHT = 0x2A0C;
public final static short SPRM_OBJLOCATION = 0x680E;
public final static short SPRM_ISTD = 0x4A30;
public final static short SPRM_FBOLD = 0x0835;
public final static short SPRM_FITALIC = 0x0836;
public final static short SPRM_FSTRIKE = 0x0837;
public final static short SPRM_FOUTLINE = 0x0838;
public final static short SPRM_FSHADOW = 0x0839;
public final static short SPRM_FSMALLCAPS = 0x083A;
public final static short SPRM_FCAPS = 0x083B;
public final static short SPRM_FVANISH = 0x083C;
public final static short SPRM_KUL = 0x2A3E;
public final static short SPRM_DXASPACE = (short)0x8840;
public final static short SPRM_LID = 0x4A41;
public final static short SPRM_ICO = 0x2A42;
public final static short SPRM_HPS = 0x4A43;
public final static short SPRM_HPSPOS = 0x4845;
public final static short SPRM_ISS = 0x2A48;
public final static short SPRM_HPSKERN = 0x484B;
public final static short SPRM_YSRI = 0x484E;
public final static short SPRM_RGFTCASCII = 0x4A4F;
public final static short SPRM_RGFTCFAREAST = 0x4A50;
public final static short SPRM_RGFTCNOTFAREAST = 0x4A51;
public final static short SPRM_CHARSCALE = 0x4852;
public final static short SPRM_FDSTRIKE = 0x2A53;
public final static short SPRM_FIMPRINT = 0x0854;
public final static short SPRM_FSPEC = 0x0855;
public final static short SPRM_FOBJ = 0x0856;
public final static short SPRM_PROPRMARK = (short)0xCA57;
public final static short SPRM_FEMBOSS = 0x0858;
public final static short SPRM_SFXTEXT = 0x2859;
public final static short SPRM_DISPFLDRMARK = (short)0xCA62;
public final static short SPRM_IBSTRMARKDEL = 0x4863;
public final static short SPRM_DTTMRMARKDEL = 0x6864;
public final static short SPRM_BRC = 0x6865;
public final static short SPRM_SHD = 0x4866;
public final static short SPRM_IDSIRMARKDEL = 0x4867;
public final static short SPRM_CPG = 0x486B;
public final static short SPRM_NONFELID = 0x486D;
public final static short SPRM_FELID = 0x486E;
public final static short SPRM_IDCTHINT = 0x286F;
StyleDescription _baseStyle;
SprmBuffer _chpx;
public CharacterProperties() public CharacterProperties()
{ {
field_17_fcPic = -1;
field_22_dttmRMark = new DateAndTime();
field_23_dttmRMarkDel = new DateAndTime();
field_36_dttmPropRMark = new DateAndTime();
field_40_dttmDispFldRMark = new DateAndTime();
field_41_xstDispFldRMark = new byte[36];
field_42_shd = new ShadingDescriptor();
field_43_brc = new BorderCode();
field_7_hps = 20;
field_24_istd = 10;
field_16_wCharScale = 100;
field_13_lidDefault = 0x0400;
field_14_lidFE = 0x0400;
} }
public boolean isMarkedDeleted()
{
return isFRMarkDel();
}
public void markDeleted(boolean mark)
{
if (mark != isFRMarkDel() && mark != _baseStyle.getCHP().isFRMarkDel())
{
byte newVal = (byte)(mark ? 1 : 0);
_chpx.addSprm(SPRM_FRMARKDEL, newVal);
super.setFRMarkDel(mark);
}
}
public boolean isBold()
{
return isFBold();
}
public void setBold(boolean bold)
{
if (bold != isFBold() && bold != _baseStyle.getCHP().isFBold())
{
byte newVal = (byte)(bold ? 1 : 0);
_chpx.addSprm(SPRM_FBOLD, newVal);
super.setFBold(bold);
}
}
public boolean isItalic()
{
return isFItalic();
}
public void setItalic(boolean italic)
{
if (italic != isFItalic() && italic != _baseStyle.getCHP().isFItalic())
{
byte newVal = (byte)(italic ? 1 : 0);
_chpx.addSprm(SPRM_FITALIC, newVal);
super.setFItalic(italic);
}
}
public boolean isOutlined()
{
return isFOutline();
}
public void setOutline(boolean outlined)
{
if (outlined != isFOutline() && outlined != _baseStyle.getCHP().isFOutline())
{
byte newVal = (byte)(outlined ? 1 : 0);
_chpx.addSprm(SPRM_FOUTLINE, newVal);
super.setFOutline(outlined);
}
}
public boolean isFldVanished()
{
return isFFldVanish();
}
public void setFldVanish(boolean fldVanish)
{
if (fldVanish != isFFldVanish() && fldVanish != _baseStyle.getCHP().isFFldVanish())
{
byte newVal = (byte)(fldVanish ? 1 : 0);
_chpx.addSprm(SPRM_FFLDVANISH, newVal);
super.setFFldVanish(fldVanish);
}
}
public boolean isSmallCaps()
{
return isFSmallCaps();
}
public void setSmallCaps(boolean smallCaps)
{
if (smallCaps != isFSmallCaps() && smallCaps != _baseStyle.getCHP().isFSmallCaps())
{
byte newVal = (byte)(smallCaps ? 1 : 0);
_chpx.addSprm(SPRM_FSMALLCAPS, newVal);
super.setFSmallCaps(smallCaps);
}
}
public boolean isCapitalized()
{
return isFCaps();
}
public void setCapitalized(boolean caps)
{
if (caps != isFCaps() && caps != _baseStyle.getCHP().isFCaps())
{
byte newVal = (byte)(caps ? 1 : 0);
_chpx.addSprm(SPRM_FCAPS, newVal);
super.setFCaps(caps);
}
}
public boolean isVanished()
{
return isFVanish();
}
public void setVanished(boolean vanish)
{
if (vanish != isFVanish() && vanish != _baseStyle.getCHP().isFVanish())
{
byte newVal = (byte)(vanish ? 1 : 0);
_chpx.addSprm(SPRM_FVANISH, newVal);
super.setFVanish(vanish);
}
}
public boolean isMarkedInserted()
{
return isFRMark();
}
public void markInserted(boolean mark)
{
if (mark != isFRMark() && mark != _baseStyle.getCHP().isFRMark())
{
byte newVal = (byte)(mark ? 1 : 0);
_chpx.addSprm(SPRM_FRMARK, newVal);
super.setFRMark(mark);
}
}
public boolean isStrikeThrough()
{
return isFStrike();
}
public void strikeThrough(boolean strike)
{
if (strike != isFStrike() && strike != _baseStyle.getCHP().isFStrike())
{
byte newVal = (byte)(strike ? 1 : 0);
_chpx.addSprm(SPRM_FSTRIKE, newVal);
super.setFStrike(strike);
}
}
public boolean isShadowed()
{
return isFShadow();
}
public void setShadow(boolean shadow)
{
if (shadow != isFShadow() && shadow != _baseStyle.getCHP().isFShadow())
{
byte newVal = (byte)(shadow ? 1 : 0);
_chpx.addSprm(SPRM_FSHADOW, newVal);
super.setFShadow(shadow);
}
}
public boolean isEmbossed()
{
return isFEmboss();
}
public void setEmbossed(boolean emboss)
{
if (emboss != isFEmboss() && emboss != _baseStyle.getCHP().isFEmboss())
{
byte newVal = (byte)(emboss ? 1 : 0);
_chpx.addSprm(SPRM_FEMBOSS, newVal);
super.setFEmboss(emboss);
}
}
public Object clone()
throws CloneNotSupportedException
{
CharacterProperties cp = (CharacterProperties)super.clone();
cp.field_22_dttmRMark = (DateAndTime)field_22_dttmRMark.clone();
cp.field_23_dttmRMarkDel = (DateAndTime)field_23_dttmRMarkDel.clone();
cp.field_36_dttmPropRMark = (DateAndTime)field_36_dttmPropRMark.clone();
cp.field_40_dttmDispFldRMark = (DateAndTime)field_40_dttmDispFldRMark.clone();
cp.field_41_xstDispFldRMark = (byte[])field_41_xstDispFldRMark.clone();
cp.field_42_shd = (ShadingDescriptor)field_42_shd.clone();
return cp;
}
} }

View File

@ -55,13 +55,107 @@
package org.apache.poi.hwpf.usermodel; package org.apache.poi.hwpf.usermodel;
import org.apache.poi.hwpf.model.hdftypes.definitions.PAPAbstractType; import org.apache.poi.hwpf.model.hdftypes.definitions.PAPAbstractType;
import org.apache.poi.hwpf.model.hdftypes.StyleDescription;
import org.apache.poi.hwpf.sprm.SprmBuffer;
public class ParagraphProperties
public class ParagraphProperties extends PAPAbstractType extends PAPAbstractType
implements Cloneable
{ {
public final static short SPRM_JC = 0x2403;
public final static short SPRM_FSIDEBYSIDE = 0x2404;
public final static short SPRM_FKEEP = 0x2405;
public final static short SPRM_FKEEPFOLLOW = 0x2406;
public final static short SPRM_FPAGEBREAKBEFORE = 0x2407;
public final static short SPRM_BRCL = 0x2408;
public final static short SPRM_BRCP = 0x2409;
public final static short SPRM_ILVL = 0x260A;
public final static short SPRM_ILFO = 0x460B;
public final static short SPRM_FNOLINENUMB = 0x240C;
public final static short SPRM_CHGTABSPAPX = (short)0xC60D;
public final static short SPRM_DXARIGHT = (short)0x840E;
public final static short SPRM_DXALEFT = (short)0x840F;
public final static short SPRM_DXALEFT1 = (short)0x8411;
public final static short SPRM_DYALINE = 0x6412;
public final static short SPRM_DYABEFORE = (short)0xA413;
public final static short SPRM_DYAAFTER = (short)0xA414;
public final static short SPRM_CHGTABS = (short)0xC615;
public final static short SPRM_FINTABLE = 0x2416;
public final static short SPRM_FTTP = 0x2417;
public final static short SPRM_DXAABS = (short)0x8418;
public final static short SPRM_DYAABS = (short)0x8419;
public final static short SPRM_DXAWIDTH = (short)0x841A;
public final static short SPRM_PC = 0x261B;
public final static short SPRM_WR = 0x2423;
public final static short SPRM_BRCTOP = 0x6424;
public final static short SPRM_BRCLEFT = 0x6425;
public final static short SPRM_BRCBOTTOM = 0x6426;
public final static short SPRM_BRCRIGHT = 0x6427;
public final static short SPRM_BRCBAR = 0x6629;
public final static short SPRM_FNOAUTOHYPH = 0x242A;
public final static short SPRM_WHEIGHTABS = 0x442B;
public final static short SPRM_DCS = 0x442C;
public final static short SPRM_SHD = 0x442D;
public final static short SPRM_DYAFROMTEXT = (short)0x842E;
public final static short SPRM_DXAFROMTEXT = (short)0x842F;
public final static short SPRM_FLOCKED = 0x2430;
public final static short SPRM_FWIDOWCONTROL = 0x2431;
public final static short SPRM_RULER = (short)0xC632;
public final static short SPRM_FKINSOKU = 0x2433;
public final static short SPRM_FWORDWRAP = 0x2434;
public final static short SPRM_FOVERFLOWPUNCT = 0x2435;
public final static short SPRM_FTOPLINEPUNCT = 0x2436;
public final static short SPRM_AUTOSPACEDE = 0x2437;
public final static short SPRM_AUTOSPACEDN = 0x2438;
public final static short SPRM_WALIGNFONT = 0x4439;
public final static short SPRM_FRAMETEXTFLOW = 0x443A;
public final static short SPRM_ANLD = (short)0xC63E;
public final static short SPRM_PROPRMARK = (short)0xC63F;
public final static short SPRM_OUTLVL = 0x2640;
public final static short SPRM_FBIDI = 0x2441;
public final static short SPRM_FNUMRMLNS = 0x2443;
public final static short SPRM_CRLF = 0x2444;
public final static short SPRM_NUMRM = (short)0xC645;
public final static short SPRM_USEPGSUSETTINGS = 0x2447;
public final static short SPRM_FADJUSTRIGHT = 0x2448;
private StyleDescription _baseStyle;
private SprmBuffer _papx;
public ParagraphProperties() public ParagraphProperties()
{ {
field_21_lspd = new LineSpacingDescriptor();
field_24_phe = new byte[12];
field_46_brcTop = new BorderCode();
field_47_brcLeft = new BorderCode();
field_48_brcBottom = new BorderCode();
field_49_brcRight = new BorderCode();
field_50_brcBetween = new BorderCode();
field_51_brcBar = new BorderCode();
field_60_anld = new byte[84];
this.field_17_fWidowControl = 1;
this.field_21_lspd.setMultiLinespace((short)1);
this.field_21_lspd.setDyaLine((short)240);
this.field_12_ilvl = (byte)9;
}
public Object clone()
throws CloneNotSupportedException
{
ParagraphProperties pp = (ParagraphProperties)super.clone();
pp.field_21_lspd = (LineSpacingDescriptor)field_21_lspd.clone();
pp.field_24_phe = (byte[])field_24_phe.clone();
pp.field_46_brcTop = (BorderCode)field_46_brcTop.clone();
pp.field_47_brcLeft = (BorderCode)field_47_brcLeft.clone();
pp.field_48_brcBottom = (BorderCode)field_48_brcBottom.clone();
pp.field_49_brcRight = (BorderCode)field_49_brcRight.clone();
pp.field_50_brcBetween = (BorderCode)field_50_brcBetween.clone();
pp.field_51_brcBar = (BorderCode)field_51_brcBar.clone();
pp.field_60_anld = (byte[])field_60_anld.clone();
return pp;
} }
} }

View File

@ -47,8 +47,8 @@
<field type="int" size="4" name="lTagObj"/> <field type="int" size="4" name="lTagObj"/>
<field type="int" size="2" name="ibstRMark"/> <field type="int" size="2" name="ibstRMark"/>
<field type="int" size="2" name="ibstRMarkDel"/> <field type="int" size="2" name="ibstRMarkDel"/>
<field type="short[]" size="4" name="dttmRMark"/> <field type="DateAndTime" size="4" name="dttmRMark"/>
<field type="short[]" size="4" name="dttmRMarkDel"/> <field type="DateAndTime" size="4" name="dttmRMarkDel"/>
<field type="int" size="2" name="istd"/> <field type="int" size="2" name="istd"/>
<field type="int" size="2" name="baseIstd"/> <field type="int" size="2" name="baseIstd"/>
<field type="int" size="2" name="ftcSym"/> <field type="int" size="2" name="ftcSym"/>
@ -69,13 +69,13 @@
</field> </field>
<field type="short" size="2" name="fPropMark"/> <field type="short" size="2" name="fPropMark"/>
<field type="int" size="2" name="ibstPropRMark"/> <field type="int" size="2" name="ibstPropRMark"/>
<field type="int" size="4" name="dttmPropRMark"/> <field type="DateAndTime" size="4" name="dttmPropRMark"/>
<field type="byte" size="1" name="sfxtText"/> <field type="byte" size="1" name="sfxtText"/>
<field type="byte" size="1" name="fDispFldRMark"/> <field type="byte" size="1" name="fDispFldRMark"/>
<field type="int" size="2" name="ibstDispFldRMark"/> <field type="int" size="2" name="ibstDispFldRMark"/>
<field type="int" size="4" name="dttmDispFldRMark"/> <field type="DateAndTime" size="4" name="dttmDispFldRMark"/>
<field type="byte[]" size="32" name="xstDispFldRMark"/> <field type="byte[]" size="32" name="xstDispFldRMark"/>
<field type="int" size="2" name="shd"/> <field type="ShadingDescriptor" size="2" name="shd"/>
<field type="short[]" size="4" name="brc"/> <field type="BorderCode" size="4" name="brc"/>
</fields> </fields>
</record> </record>

View File

@ -24,7 +24,7 @@
<field type="int" size="4" name="dxaRight"/> <field type="int" size="4" name="dxaRight"/>
<field type="int" size="4" name="dxaLeft"/> <field type="int" size="4" name="dxaLeft"/>
<field type="int" size="4" name="dxaLeft1"/> <field type="int" size="4" name="dxaLeft1"/>
<field type="short[]" size="4" name="lspd"/> <field type="LineSpacingDescriptor" size="4" name="lspd"/>
<field type="int" size="4" name="dyaBefore"/> <field type="int" size="4" name="dyaBefore"/>
<field type="int" size="4" name="dyaAfter"/> <field type="int" size="4" name="dyaAfter"/>
<field type="byte[]" size="12" name="phe"/> <field type="byte[]" size="12" name="phe"/>
@ -53,12 +53,12 @@
<field type="int" size="4" name="dxaAbs"/> <field type="int" size="4" name="dxaAbs"/>
<field type="int" size="4" name="dyaAbs"/> <field type="int" size="4" name="dyaAbs"/>
<field type="int" size="4" name="dxaWidth"/> <field type="int" size="4" name="dxaWidth"/>
<field type="short[]" size="4" name="brcTop"/> <field type="BorderCode" size="4" name="brcTop"/>
<field type="short[]" size="4" name="brcLeft"/> <field type="BorderCode" size="4" name="brcLeft"/>
<field type="short[]" size="4" name="brcBottom"/> <field type="BorderCode" size="4" name="brcBottom"/>
<field type="short[]" size="4" name="brcRight"/> <field type="BorderCode" size="4" name="brcRight"/>
<field type="short[]" size="4" name="brcBetween"/> <field type="BorderCode" size="4" name="brcBetween"/>
<field type="short[]" size="4" name="brcBar"/> <field type="BorderCode" size="4" name="brcBar"/>
<field type="int" size="4" name="dxaFromText"/> <field type="int" size="4" name="dxaFromText"/>
<field type="int" size="4" name="dyaFromText"/> <field type="int" size="4" name="dyaFromText"/>
<field type="int" size="2" name="dyaHeight"/> <field type="int" size="2" name="dyaHeight"/>
@ -70,10 +70,10 @@
<field type="byte[]" size="84" name="anld"/> <field type="byte[]" size="84" name="anld"/>
<field type="int" size="1" name="fPropRMark"/> <field type="int" size="1" name="fPropRMark"/>
<field type="int" size="2" name="ibstPropRMark"/> <field type="int" size="2" name="ibstPropRMark"/>
<field type="byte[]" size="4" name="dttmPropRMark"/> <field type="DateAndTime" size="4" name="dttmPropRMark"/>
<field type="byte[]" size="128" name="numrm"/> <field type="byte[]" size="128" name="numrm"/>
<field type="int" size="2" name="itbdMac"/> <field type="int" size="2" name="itbdMac"/>
<field type="byte[]" size="128" name="rgdxaTab"/> <field type="int[]" size="128" name="rgdxaTab"/>
<field type="byte[]" size="128" name="rgtbd"/> <field type="byte[]" size="128" name="rgtbd"/>
</fields> </fields>
</record> </record>

View File

@ -23,13 +23,13 @@
<field type="int" size="2" name="dmBinFirst"/> <field type="int" size="2" name="dmBinFirst"/>
<field type="int" size="2" name="dmBinOther"/> <field type="int" size="2" name="dmBinOther"/>
<field type="int" size="2" name="dmPaperReq"/> <field type="int" size="2" name="dmPaperReq"/>
<field type="short[]" size="4" name="brcTop"/> <field type="BorderCode" size="4" name="brcTop"/>
<field type="short[]" size="4" name="brcLeft"/> <field type="BorderCode" size="4" name="brcLeft"/>
<field type="short[]" size="4" name="brcBottom"/> <field type="BorderCode" size="4" name="brcBottom"/>
<field type="short[]" size="4" name="brcRight"/> <field type="BorderCode" size="4" name="brcRight"/>
<field type="boolean" size="0" name="fPropMark"/> <field type="boolean" size="0" name="fPropMark"/>
<field type="int" size="2" name="ibstPropRMark"/> <field type="int" size="2" name="ibstPropRMark"/>
<field type="int" size="4" name="dttmPropRMark"/> <field type="DateAndTime" size="4" name="dttmPropRMark"/>
<field type="int" size="4" name="dxtCharSpace"/> <field type="int" size="4" name="dxtCharSpace"/>
<field type="int" size="4" name="dyaLinePitch"/> <field type="int" size="4" name="dyaLinePitch"/>
<field type="int" size="2" name="clm"/> <field type="int" size="2" name="clm"/>

View File

@ -12,13 +12,13 @@
<field type="int" size="4" name="tlp"/> <field type="int" size="4" name="tlp"/>
<field type="short" size="2" name="itcMac"/> <field type="short" size="2" name="itcMac"/>
<field type="short[]" size="130" name="rgdxaCenter"/> <field type="short[]" size="130" name="rgdxaCenter"/>
<field type="TCAbstractType[]" size="0" name="rgtc"/> <field type="TableCellDescriptor[]" size="0" name="rgtc"/>
<field type="byte[]" size="0" name="rgshd"/> <field type="ShadingDescriptor[]" size="0" name="rgshd"/>
<field type="short[]" size="4" name="brcBottom"/> <field type="BorderCode" size="4" name="brcBottom"/>
<field type="short[]" size="4" name="brcTop"/> <field type="BorderCode" size="4" name="brcTop"/>
<field type="short[]" size="4" name="brcLeft"/> <field type="BorderCode" size="4" name="brcLeft"/>
<field type="short[]" size="4" name="brcRight"/> <field type="BorderCode" size="4" name="brcRight"/>
<field type="short[]" size="4" name="brcVertical"/> <field type="BorderCode" size="4" name="brcVertical"/>
<field type="short[]" size="4" name="brcHorizontal"/> <field type="BorderCode" size="4" name="brcHorizontal"/>
</fields> </fields>
</record> </record>

View File

@ -1,4 +1,4 @@
<record id="0x101B" name="TC" package="org.apache.poi.hwpf.model.hdftypes.definitions"> <record fromfile="true" id="0x101B" name="TC" package="org.apache.poi.hwpf.model.hdftypes.definitions">
<suffix>AbstractType</suffix> <suffix>AbstractType</suffix>
<extends>HDFType</extends> <extends>HDFType</extends>
<description>Table Cell Descriptor.</description> <description>Table Cell Descriptor.</description>
@ -15,9 +15,9 @@
<bit number="7" mask="0x0180" name="vertAlign"/> <bit number="7" mask="0x0180" name="vertAlign"/>
</field> </field>
<field type="short" size="2" name="unused"/> <field type="short" size="2" name="unused"/>
<field type="short[]" size="4" name="brcTop"/> <field type="BorderCode" size="4" name="brcTop"/>
<field type="short[]" size="4" name="brcLeft"/> <field type="BorderCode" size="4" name="brcLeft"/>
<field type="short[]" size="4" name="brcBottom"/> <field type="BorderCode" size="4" name="brcBottom"/>
<field type="short[]" size="4" name="brcRight"/> <field type="BorderCode" size="4" name="brcRight"/>
</fields> </fields>
</record> </record>

View File

@ -69,6 +69,7 @@ import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.StringUtil; import org.apache.poi.util.StringUtil;
import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
import org.apache.poi.hdf.model.hdftypes.HDFType; import org.apache.poi.hdf.model.hdftypes.HDFType;
import org.apache.poi.hwpf.usermodel.*;
/** /**
* <xsl:value-of select="/record/description"/> * <xsl:value-of select="/record/description"/>
@ -80,7 +81,7 @@ public abstract class <xsl:value-of select="@name"/>AbstractType
implements HDFType implements HDFType
{ {
<xsl:for-each select="//fields/field"> private <xsl:value-of select="@type"/><xsl:text> field_</xsl:text><xsl:value-of select="position()"/>_<xsl:value-of select="@name"/>; <xsl:for-each select="//fields/field"> protected <xsl:value-of select="@type"/><xsl:text> field_</xsl:text><xsl:value-of select="position()"/>_<xsl:value-of select="@name"/>;
<xsl:apply-templates select="./bit|./const"/> <xsl:apply-templates select="./bit|./const"/>
</xsl:for-each> </xsl:for-each>
@ -92,7 +93,7 @@ public abstract class <xsl:value-of select="@name"/>AbstractType
</xsl:if></xsl:for-each> </xsl:if></xsl:for-each>
} }
<xsl:if test='//@fromfile="true"'> <xsl:if test='//@fromfile="true"'>
protected void fillFields(byte [] data, short size, int offset) protected void fillFields(byte [] data, int offset)
{ {
<xsl:variable name="fieldIterator" select="field:new()"/> <xsl:variable name="fieldIterator" select="field:new()"/>
<xsl:for-each select="//fields/field"> <xsl:for-each select="//fields/field">
@ -200,9 +201,7 @@ public abstract class <xsl:value-of select="@name"/>AbstractType
</xsl:template> </xsl:template>
<xsl:template match="field" mode="tostring"> <xsl:template match="field" mode="tostring">
buffer.append(" .<xsl:value-of select="recutil:getFieldName(@name,20)"/> = ");<xsl:choose><xsl:when test="@type != 'string' and @type != 'float' and @size != 'varword'"> buffer.append(" .<xsl:value-of select="recutil:getFieldName(@name,20)"/> = ");
buffer.append("0x");
buffer.append(HexDump.toHex((<xsl:value-of select="@type"/>)get<xsl:value-of select="recutil:getFieldName1stCap(@name,0)"/>()));</xsl:when></xsl:choose>
buffer.append(" (").append(get<xsl:value-of select="recutil:getFieldName1stCap(@name,0)"/>()).append(" )\n"); buffer.append(" (").append(get<xsl:value-of select="recutil:getFieldName1stCap(@name,0)"/>()).append(" )\n");
<xsl:apply-templates select="bit" mode="bittostring"/> <xsl:apply-templates select="bit" mode="bittostring"/>
</xsl:template> </xsl:template>