<No Comment Entered>
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353551 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e16b4b948d
commit
e90590e97d
@ -89,6 +89,11 @@ public class HWPFDocument
|
|||||||
/** Hold list tables */
|
/** Hold list tables */
|
||||||
protected ListTables _lt;
|
protected ListTables _lt;
|
||||||
|
|
||||||
|
protected HWPFDocument()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This constructor loads a Word document from an InputStream.
|
* This constructor loads a Word document from an InputStream.
|
||||||
*
|
*
|
||||||
@ -181,11 +186,21 @@ public class HWPFDocument
|
|||||||
return _ss;
|
return _ss;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FileInformationBlock getFileInformationBlock()
|
||||||
|
{
|
||||||
|
return _fib;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DocumentProperties getDocProperties()
|
||||||
|
{
|
||||||
|
return _dop;
|
||||||
|
}
|
||||||
|
|
||||||
public Range getRange()
|
public Range getRange()
|
||||||
{
|
{
|
||||||
// hack to get the ending cp of the document, Have to revisit this.
|
// hack to get the ending cp of the document, Have to revisit this.
|
||||||
java.util.List paragraphs = _pbt.getParagraphs();
|
java.util.List text = _tpt.getTextPieces();
|
||||||
PAPX p = (PAPX)paragraphs.get(paragraphs.size() - 1);
|
PropertyNode p = (PropertyNode)text.get(text.size() - 1);
|
||||||
|
|
||||||
return new Range(0, p.getEnd(), this);
|
return new Range(0, p.getEnd(), this);
|
||||||
}
|
}
|
||||||
@ -226,7 +241,7 @@ public class HWPFDocument
|
|||||||
HWPFFileSystem docSys = new HWPFFileSystem();
|
HWPFFileSystem docSys = new HWPFFileSystem();
|
||||||
HWPFOutputStream mainStream = docSys.getStream("WordDocument");
|
HWPFOutputStream mainStream = docSys.getStream("WordDocument");
|
||||||
HWPFOutputStream tableStream = docSys.getStream("1Table");
|
HWPFOutputStream tableStream = docSys.getStream("1Table");
|
||||||
HWPFOutputStream dataStream = docSys.getStream("Data");
|
//HWPFOutputStream dataStream = docSys.getStream("Data");
|
||||||
int tableOffset = 0;
|
int tableOffset = 0;
|
||||||
|
|
||||||
// FileInformationBlock fib = (FileInformationBlock)_fib.clone();
|
// FileInformationBlock fib = (FileInformationBlock)_fib.clone();
|
||||||
@ -332,6 +347,10 @@ public class HWPFDocument
|
|||||||
}
|
}
|
||||||
|
|
||||||
byte[] dataBuf = _dataStream;
|
byte[] dataBuf = _dataStream;
|
||||||
|
if (dataBuf == null)
|
||||||
|
{
|
||||||
|
dataBuf = new byte[4096];
|
||||||
|
}
|
||||||
if (dataBuf.length < 4096)
|
if (dataBuf.length < 4096)
|
||||||
{
|
{
|
||||||
byte[] tempBuf = new byte[4096];
|
byte[] tempBuf = new byte[4096];
|
||||||
|
@ -34,7 +34,7 @@ import org.apache.poi.hwpf.sprm.SprmBuffer;
|
|||||||
public class CHPBinTable
|
public class CHPBinTable
|
||||||
{
|
{
|
||||||
/** List of character properties.*/
|
/** List of character properties.*/
|
||||||
ArrayList _textRuns = new ArrayList();
|
protected ArrayList _textRuns = new ArrayList();
|
||||||
|
|
||||||
|
|
||||||
public CHPBinTable()
|
public CHPBinTable()
|
||||||
|
@ -114,7 +114,7 @@ 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 + 1;
|
int totalSize = FC_SIZE + 2;
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (; index < size; index++)
|
for (; index < size; index++)
|
||||||
@ -165,7 +165,6 @@ public class CHPFormattedDiskPage extends FormattedDiskPage
|
|||||||
buf[grpprlOffset] = (byte)grpprl.length;
|
buf[grpprlOffset] = (byte)grpprl.length;
|
||||||
System.arraycopy(grpprl, 0, buf, grpprlOffset + 1, grpprl.length);
|
System.arraycopy(grpprl, 0, buf, grpprlOffset + 1, grpprl.length);
|
||||||
|
|
||||||
|
|
||||||
offsetOffset += 1;
|
offsetOffset += 1;
|
||||||
fcOffset += FC_SIZE;
|
fcOffset += FC_SIZE;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ public class ComplexFileTable
|
|||||||
private static final byte GRPPRL_TYPE = 1;
|
private static final byte GRPPRL_TYPE = 1;
|
||||||
private static final byte TEXT_PIECE_TABLE_TYPE = 2;
|
private static final byte TEXT_PIECE_TABLE_TYPE = 2;
|
||||||
|
|
||||||
TextPieceTable _tpt;
|
protected TextPieceTable _tpt;
|
||||||
|
|
||||||
public ComplexFileTable()
|
public ComplexFileTable()
|
||||||
{
|
{
|
||||||
|
@ -80,10 +80,19 @@ public class ListFormatOverrideLevel
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ListFormatOverrideLevel lfolvl = (ListFormatOverrideLevel)obj;
|
ListFormatOverrideLevel lfolvl = (ListFormatOverrideLevel)obj;
|
||||||
return lfolvl._iStartAt == _iStartAt && lfolvl._info == _info &&
|
boolean lvlEquality = false;
|
||||||
lfolvl._lvl.equals(_lvl) && Arrays.equals(lfolvl._reserved, _reserved);
|
if (_lvl != null)
|
||||||
|
{
|
||||||
|
lvlEquality = _lvl.equals(lfolvl._lvl);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lvlEquality = lfolvl._lvl == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return lvlEquality && lfolvl._iStartAt == _iStartAt && lfolvl._info == _info &&
|
||||||
|
Arrays.equals(lfolvl._reserved, _reserved);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] toByteArray()
|
public byte[] toByteArray()
|
||||||
|
@ -35,7 +35,7 @@ import org.apache.poi.util.LittleEndian;
|
|||||||
*/
|
*/
|
||||||
public class PAPBinTable
|
public class PAPBinTable
|
||||||
{
|
{
|
||||||
ArrayList _paragraphs = new ArrayList();
|
protected ArrayList _paragraphs = new ArrayList();
|
||||||
byte[] _dataStream;
|
byte[] _dataStream;
|
||||||
|
|
||||||
public PAPBinTable()
|
public PAPBinTable()
|
||||||
|
@ -28,7 +28,7 @@ import org.apache.poi.hwpf.sprm.SprmBuffer;
|
|||||||
*
|
*
|
||||||
* @author Ryan Ackley
|
* @author Ryan Ackley
|
||||||
*/
|
*/
|
||||||
public abstract class PropertyNode implements Comparable
|
public abstract class PropertyNode implements Comparable, Cloneable
|
||||||
{
|
{
|
||||||
protected Object _buf;
|
protected Object _buf;
|
||||||
private int _cpStart;
|
private int _cpStart;
|
||||||
@ -56,7 +56,7 @@ public abstract class PropertyNode implements Comparable
|
|||||||
return _cpStart;
|
return _cpStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setStart(int start)
|
public void setStart(int start)
|
||||||
{
|
{
|
||||||
_cpStart = start;
|
_cpStart = start;
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ public abstract class PropertyNode implements Comparable
|
|||||||
return _cpEnd;
|
return _cpEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setEnd(int end)
|
public void setEnd(int end)
|
||||||
{
|
{
|
||||||
_cpEnd = end;
|
_cpEnd = end;
|
||||||
}
|
}
|
||||||
@ -118,6 +118,13 @@ public abstract class PropertyNode implements Comparable
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object clone()
|
||||||
|
throws CloneNotSupportedException
|
||||||
|
{
|
||||||
|
return super.clone();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for sorting in collections.
|
* Used for sorting in collections.
|
||||||
*/
|
*/
|
||||||
|
@ -31,8 +31,8 @@ public class SectionTable
|
|||||||
{
|
{
|
||||||
private static final int SED_SIZE = 12;
|
private static final int SED_SIZE = 12;
|
||||||
|
|
||||||
private ArrayList _sections = new ArrayList();
|
protected ArrayList _sections = new ArrayList();
|
||||||
private List _text;
|
protected List _text;
|
||||||
|
|
||||||
public SectionTable()
|
public SectionTable()
|
||||||
{
|
{
|
||||||
|
@ -159,7 +159,8 @@ public class StyleSheet implements HDFType
|
|||||||
{
|
{
|
||||||
byte[] std = _styleDescriptions[x].toByteArray();
|
byte[] std = _styleDescriptions[x].toByteArray();
|
||||||
|
|
||||||
LittleEndian.putShort(sizeHolder, (short)(std.length));
|
// adjust the size so it is always on a word boundary
|
||||||
|
LittleEndian.putShort(sizeHolder, (short)((std.length) + (std.length % 2)));
|
||||||
out.write(sizeHolder);
|
out.write(sizeHolder);
|
||||||
out.write(std);
|
out.write(std);
|
||||||
|
|
||||||
|
@ -64,6 +64,11 @@ public class TextPiece extends PropertyNode implements Comparable
|
|||||||
return (StringBuffer)_buf;
|
return (StringBuffer)_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setStringBuffer(StringBuffer buf)
|
||||||
|
{
|
||||||
|
_buf = buf;
|
||||||
|
}
|
||||||
|
|
||||||
public byte[] getRawBytes()
|
public byte[] getRawBytes()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -33,7 +33,7 @@ import org.apache.poi.hwpf.model.io.*;
|
|||||||
*/
|
*/
|
||||||
public class TextPieceTable
|
public class TextPieceTable
|
||||||
{
|
{
|
||||||
ArrayList _textPieces = new ArrayList();
|
protected ArrayList _textPieces = new ArrayList();
|
||||||
//int _multiple;
|
//int _multiple;
|
||||||
int _cpMin;
|
int _cpMin;
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ public class HWPFFileSystem
|
|||||||
{
|
{
|
||||||
_streams.put("WordDocument", new HWPFOutputStream());
|
_streams.put("WordDocument", new HWPFOutputStream());
|
||||||
_streams.put("1Table", new HWPFOutputStream());
|
_streams.put("1Table", new HWPFOutputStream());
|
||||||
|
_streams.put("Data", new HWPFOutputStream());
|
||||||
}
|
}
|
||||||
|
|
||||||
public HWPFOutputStream getStream(String name)
|
public HWPFOutputStream getStream(String name)
|
||||||
|
@ -719,7 +719,7 @@ public class Range
|
|||||||
/**
|
/**
|
||||||
* loads all of the list indexes.
|
* loads all of the list indexes.
|
||||||
*/
|
*/
|
||||||
private void initAll()
|
protected void initAll()
|
||||||
{
|
{
|
||||||
initText();
|
initText();
|
||||||
initCharacterRuns();
|
initCharacterRuns();
|
||||||
|
@ -68,7 +68,6 @@ public class TestCHPBinTable
|
|||||||
{
|
{
|
||||||
PropertyNode oldNode = (PropertyNode)oldTextRuns.get(x);
|
PropertyNode oldNode = (PropertyNode)oldTextRuns.get(x);
|
||||||
PropertyNode newNode = (PropertyNode)newTextRuns.get(x);
|
PropertyNode newNode = (PropertyNode)newTextRuns.get(x);
|
||||||
|
|
||||||
assertTrue(oldNode.equals(newNode));
|
assertTrue(oldNode.equals(newNode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user