git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1144920 13f79535-47bb-0310-9956-ffa450edef68tags/REL_3_8_BETA4
import org.apache.poi.hwpf.model.ListTables; | import org.apache.poi.hwpf.model.ListTables; | ||||
import org.apache.poi.hwpf.model.PAPBinTable; | import org.apache.poi.hwpf.model.PAPBinTable; | ||||
import org.apache.poi.hwpf.model.PicturesTable; | import org.apache.poi.hwpf.model.PicturesTable; | ||||
import org.apache.poi.hwpf.model.PropertyNode; | |||||
import org.apache.poi.hwpf.model.RevisionMarkAuthorTable; | import org.apache.poi.hwpf.model.RevisionMarkAuthorTable; | ||||
import org.apache.poi.hwpf.model.SavedByTable; | import org.apache.poi.hwpf.model.SavedByTable; | ||||
import org.apache.poi.hwpf.model.SectionTable; | import org.apache.poi.hwpf.model.SectionTable; | ||||
public Range getOverallRange() { | public Range getOverallRange() { | ||||
// 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. | ||||
PropertyNode p = _tpt.getTextPieces().get(_tpt.getTextPieces().size() - 1); | |||||
TextPiece p = _tpt.getTextPieces().get(_tpt.getTextPieces().size() - 1); | |||||
return new Range(0, p.getEnd(), this); | return new Range(0, p.getEnd(), this); | ||||
} | } |
int pageNum = docOffset/POIFSConstants.SMALLER_BIG_BLOCK_SIZE; | int pageNum = docOffset/POIFSConstants.SMALLER_BIG_BLOCK_SIZE; | ||||
// get the ending fc | // get the ending fc | ||||
PropertyNode lastRun = (PropertyNode)_textRuns.get(_textRuns.size() - 1); | |||||
CHPX lastRun = _textRuns.get(_textRuns.size() - 1); | |||||
int endingFc = lastRun.getEnd(); | int endingFc = lastRun.getEnd(); | ||||
endingFc += fcMin; | endingFc += fcMin; | ||||
ArrayList<CHPX> overflow = _textRuns; | ArrayList<CHPX> overflow = _textRuns; | ||||
do | do | ||||
{ | { | ||||
PropertyNode startingProp = (PropertyNode)overflow.get(0); | |||||
CHPX startingProp = overflow.get(0); | |||||
int start = startingProp.getStart() + fcMin; | int start = startingProp.getStart() + fcMin; | ||||
CHPFormattedDiskPage cfkp = new CHPFormattedDiskPage(); | CHPFormattedDiskPage cfkp = new CHPFormattedDiskPage(); | ||||
int end = endingFc; | int end = endingFc; | ||||
if (overflow != null) | if (overflow != null) | ||||
{ | { | ||||
end = ((PropertyNode)overflow.get(0)).getStart() + fcMin; | |||||
end = overflow.get(0).getStart() + fcMin; | |||||
} | } | ||||
byte[] intHolder = new byte[4]; | byte[] intHolder = new byte[4]; |
CHPX chpx = null; | CHPX chpx = null; | ||||
for (int x = 0; x < index; x++) | for (int x = 0; x < index; x++) | ||||
{ | { | ||||
chpx = (CHPX)_chpxList.get(x); | |||||
chpx = _chpxList.get(x); | |||||
byte[] grpprl = chpx.getGrpprl(); | byte[] grpprl = chpx.getGrpprl(); | ||||
LittleEndian.putInt( buf, fcOffset, | LittleEndian.putInt( buf, fcOffset, |
public final class CachedPropertyNode | public final class CachedPropertyNode | ||||
extends PropertyNode<CachedPropertyNode> | extends PropertyNode<CachedPropertyNode> | ||||
{ | { | ||||
protected SoftReference _propCache; | |||||
protected SoftReference<Object> _propCache; | |||||
public CachedPropertyNode(int start, int end, SprmBuffer buf) | public CachedPropertyNode(int start, int end, SprmBuffer buf) | ||||
{ | { | ||||
protected void fillCache(Object ref) | protected void fillCache(Object ref) | ||||
{ | { | ||||
_propCache = new SoftReference(ref); | |||||
_propCache = new SoftReference<Object>(ref); | |||||
} | } | ||||
protected Object getCacheContents() | protected Object getCacheContents() |
package org.apache.poi.hwpf.model; | package org.apache.poi.hwpf.model; | ||||
import java.util.HashSet; | |||||
import java.util.HashMap; | |||||
import java.util.Arrays; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.Arrays; | |||||
import java.util.HashMap; | |||||
import java.util.HashSet; | |||||
import java.util.Map; | |||||
import org.apache.poi.hwpf.model.io.HWPFOutputStream; | import org.apache.poi.hwpf.model.io.HWPFOutputStream; | ||||
import org.apache.poi.util.LittleEndian; | import org.apache.poi.util.LittleEndian; | ||||
import org.apache.poi.util.POILogFactory; | import org.apache.poi.util.POILogFactory; | ||||
import org.apache.poi.util.POILogger; | import org.apache.poi.util.POILogger; | ||||
private static final int FIELD_SIZE = LittleEndian.INT_SIZE * 2; | private static final int FIELD_SIZE = LittleEndian.INT_SIZE * 2; | ||||
private HashMap _unknownMap = new HashMap(); | |||||
private Map<Integer, UnhandledDataStructure> _unknownMap = new HashMap<Integer, UnhandledDataStructure>(); | |||||
private int[] _fields; | private int[] _fields; | ||||
public FIBFieldHandler(byte[] mainStream, int offset, byte[] tableStream, | public FIBFieldHandler(byte[] mainStream, int offset, byte[] tableStream, | ||||
HashSet offsetList, boolean areKnown) | |||||
HashSet<Integer> offsetList, boolean areKnown) | |||||
{ | { | ||||
int numFields = LittleEndian.getShort(mainStream, offset); | int numFields = LittleEndian.getShort(mainStream, offset); | ||||
offset += LittleEndian.SHORT_SIZE; | offset += LittleEndian.SHORT_SIZE; | ||||
for (int x = 0; x < length; x++) | for (int x = 0; x < length; x++) | ||||
{ | { | ||||
UnhandledDataStructure ds = (UnhandledDataStructure)_unknownMap.get(Integer.valueOf(x)); | |||||
UnhandledDataStructure ds = _unknownMap.get(Integer.valueOf(x)); | |||||
if (ds != null) | if (ds != null) | ||||
{ | { | ||||
LittleEndian.putInt(mainStream, offset, tableStream.getOffset()); | LittleEndian.putInt(mainStream, offset, tableStream.getOffset()); |
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.Iterator; | |||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; | ||||
*/ | */ | ||||
public final class FSPATable | public final class FSPATable | ||||
{ | { | ||||
private final List _shapes = new ArrayList(); | |||||
private final Map _shapeIndexesByPropertyStart = new HashMap(); | |||||
private final List _text; | |||||
private final List<FSPA> _shapes = new ArrayList<FSPA>(); | |||||
private final Map<Integer, Integer> _shapeIndexesByPropertyStart = new HashMap<Integer, Integer>(); | |||||
private final List<TextPiece> _text; | |||||
public FSPATable(byte[] tableStream, int fcPlcspa, int lcbPlcspa, List tpt) | |||||
public FSPATable(byte[] tableStream, int fcPlcspa, int lcbPlcspa, List<TextPiece> tpt) | |||||
{ | { | ||||
_text = tpt; | _text = tpt; | ||||
// Will be 0 if no drawing objects in document | // Will be 0 if no drawing objects in document | ||||
public FSPA getFspaFromCp(int cp) | public FSPA getFspaFromCp(int cp) | ||||
{ | { | ||||
Integer idx = (Integer)_shapeIndexesByPropertyStart.get(Integer.valueOf(cp)); | |||||
Integer idx = _shapeIndexesByPropertyStart.get(Integer.valueOf(cp)); | |||||
if (idx == null) { | if (idx == null) { | ||||
return null; | return null; | ||||
} | } | ||||
return (FSPA)_shapes.get(idx.intValue()); | |||||
return _shapes.get(idx.intValue()); | |||||
} | } | ||||
public FSPA[] getShapes() | public FSPA[] getShapes() | ||||
{ | { | ||||
StringBuffer buf = new StringBuffer(); | StringBuffer buf = new StringBuffer(); | ||||
buf.append("[FPSA PLC size=").append(_shapes.size()).append("]\n"); | buf.append("[FPSA PLC size=").append(_shapes.size()).append("]\n"); | ||||
for (Iterator it = _shapeIndexesByPropertyStart.keySet().iterator(); it.hasNext(); ) | |||||
{ | |||||
Integer i = (Integer) it.next(); | |||||
FSPA fspa = (FSPA) _shapes.get(((Integer)_shapeIndexesByPropertyStart.get(i)).intValue()); | |||||
for (Map.Entry<Integer, Integer> entry: _shapeIndexesByPropertyStart.entrySet()) { | |||||
Integer i = entry.getKey(); | |||||
FSPA fspa = _shapes.get((entry.getValue()).intValue()); | |||||
buf.append(" [FC: ").append(i.toString()).append("] "); | buf.append(" [FC: ").append(i.toString()).append("] "); | ||||
buf.append(fspa.toString()); | buf.append(fspa.toString()); | ||||
buf.append("\n"); | buf.append("\n"); |
package org.apache.poi.hwpf.model; | package org.apache.poi.hwpf.model; | ||||
import java.util.HashSet; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.HashSet; | |||||
import org.apache.poi.hwpf.model.io.*; | |||||
import org.apache.poi.hwpf.model.io.HWPFOutputStream; | |||||
import org.apache.poi.hwpf.model.types.FIBAbstractType; | import org.apache.poi.hwpf.model.types.FIBAbstractType; | ||||
/** | /** | ||||
public void fillVariableFields(byte[] mainDocument, byte[] tableStream) | public void fillVariableFields(byte[] mainDocument, byte[] tableStream) | ||||
{ | { | ||||
HashSet fieldSet = new HashSet(); | |||||
HashSet<Integer> fieldSet = new HashSet<Integer>(); | |||||
fieldSet.add(Integer.valueOf(FIBFieldHandler.STSHF)); | fieldSet.add(Integer.valueOf(FIBFieldHandler.STSHF)); | ||||
fieldSet.add(Integer.valueOf(FIBFieldHandler.CLX)); | fieldSet.add(Integer.valueOf(FIBFieldHandler.CLX)); | ||||
fieldSet.add(Integer.valueOf(FIBFieldHandler.DOP)); | fieldSet.add(Integer.valueOf(FIBFieldHandler.DOP)); |
public void adjustForInsert(int listIndex, int length) | public void adjustForInsert(int listIndex, int length) | ||||
{ | { | ||||
int size = _paragraphs.size(); | int size = _paragraphs.size(); | ||||
PAPX papx = (PAPX)_paragraphs.get(listIndex); | |||||
PAPX papx = _paragraphs.get(listIndex); | |||||
papx.setEnd(papx.getEnd() + length); | papx.setEnd(papx.getEnd() + length); | ||||
for (int x = listIndex + 1; x < size; x++) | for (int x = listIndex + 1; x < size; x++) | ||||
{ | { | ||||
papx = (PAPX)_paragraphs.get(x); | |||||
papx = _paragraphs.get(x); | |||||
papx.setStart(papx.getStart() + length); | papx.setStart(papx.getStart() + length); | ||||
papx.setEnd(papx.getEnd() + length); | papx.setEnd(papx.getEnd() + length); | ||||
} | } | ||||
int pageNum = docOffset/POIFSConstants.SMALLER_BIG_BLOCK_SIZE; | int pageNum = docOffset/POIFSConstants.SMALLER_BIG_BLOCK_SIZE; | ||||
// get the ending fc | // get the ending fc | ||||
int endingFc = ((PropertyNode)_paragraphs.get(_paragraphs.size() - 1)).getEnd(); | |||||
int endingFc = _paragraphs.get(_paragraphs.size() - 1).getEnd(); | |||||
endingFc += fcMin; | endingFc += fcMin; | ||||
ArrayList<PAPX> overflow = _paragraphs; | ArrayList<PAPX> overflow = _paragraphs; | ||||
do | do | ||||
{ | { | ||||
PropertyNode startingProp = (PropertyNode)overflow.get(0); | |||||
PAPX startingProp = overflow.get(0); | |||||
int start = startingProp.getStart() + fcMin; | int start = startingProp.getStart() + fcMin; | ||||
PAPFormattedDiskPage pfkp = new PAPFormattedDiskPage(_dataStream); | PAPFormattedDiskPage pfkp = new PAPFormattedDiskPage(_dataStream); | ||||
int end = endingFc; | int end = endingFc; | ||||
if (overflow != null) | if (overflow != null) | ||||
{ | { | ||||
end = ((PropertyNode)overflow.get(0)).getStart() + fcMin; | |||||
end = overflow.get(0).getStart() + fcMin; | |||||
} | } | ||||
byte[] intHolder = new byte[4]; | byte[] intHolder = new byte[4]; |
import java.util.Collections; | import java.util.Collections; | ||||
import java.util.List; | import java.util.List; | ||||
import org.apache.poi.hwpf.model.io.HWPFOutputStream; | |||||
import org.apache.poi.util.LittleEndian; | import org.apache.poi.util.LittleEndian; | ||||
import org.apache.poi.util.StringUtil; | import org.apache.poi.util.StringUtil; | ||||
import org.apache.poi.hwpf.model.io.HWPFOutputStream; | |||||
/** | /** | ||||
* String table containing the history of the last few revisions ("saves") of the document. | * String table containing the history of the last few revisions ("saves") of the document. | ||||
* Read-only for the time being. | * Read-only for the time being. | ||||
* | * | ||||
* @return the list of entries. | * @return the list of entries. | ||||
*/ | */ | ||||
public List getEntries() | |||||
public List<SavedByEntry> getEntries() | |||||
{ | { | ||||
return Collections.unmodifiableList(Arrays.asList(entries)); | return Collections.unmodifiableList(Arrays.asList(entries)); | ||||
} | } |
import org.apache.poi.hwpf.usermodel.Shape; | import org.apache.poi.hwpf.usermodel.Shape; | ||||
public final class ShapesTable { | public final class ShapesTable { | ||||
private List _shapes; | |||||
private List _shapesVisibili; //holds visible shapes | |||||
private List<Shape> _shapes; | |||||
private List<Shape> _shapesVisibili; //holds visible shapes | |||||
public ShapesTable(byte [] tblStream, FileInformationBlock fib) { | public ShapesTable(byte [] tblStream, FileInformationBlock fib) { | ||||
PlexOfCps binTable = new PlexOfCps(tblStream, | PlexOfCps binTable = new PlexOfCps(tblStream, | ||||
fib.getFcPlcspaMom(), fib.getLcbPlcspaMom(), 26); | fib.getFcPlcspaMom(), fib.getLcbPlcspaMom(), 26); | ||||
_shapes = new ArrayList(); | |||||
_shapesVisibili = new ArrayList(); | |||||
_shapes = new ArrayList<Shape>(); | |||||
_shapesVisibili = new ArrayList<Shape>(); | |||||
for(int i = 0; i < binTable.length(); i++) { | for(int i = 0; i < binTable.length(); i++) { | ||||
} | } | ||||
} | } | ||||
public List getAllShapes() { | |||||
public List<Shape> getAllShapes() { | |||||
return _shapes; | return _shapes; | ||||
} | } | ||||
public List getVisibleShapes() { | |||||
public List<Shape> getVisibleShapes() { | |||||
return _shapesVisibili; | return _shapesVisibili; | ||||
} | } | ||||
} | } |
// using the PieceDescriptors, build our list of TextPieces. | // using the PieceDescriptors, build our list of TextPieces. | ||||
for (int x = 0; x < pieces.length; x++) { | for (int x = 0; x < pieces.length; x++) { | ||||
int start = pieces[x].getFilePosition(); | int start = pieces[x].getFilePosition(); | ||||
PropertyNode node = pieceTable.getProperty(x); | |||||
GenericPropertyNode node = pieceTable.getProperty(x); | |||||
// Grab the start and end, which are in characters | // Grab the start and end, which are in characters | ||||
int nodeStartChars = node.getStart(); | int nodeStartChars = node.getStart(); | ||||
// Now change all subsequent ones | // Now change all subsequent ones | ||||
for (int x = listIndex + 1; x < size; x++) { | for (int x = listIndex + 1; x < size; x++) { | ||||
tp = (TextPiece) _textPieces.get(x); | |||||
tp = _textPieces.get(x); | |||||
tp.setStart(tp.getStart() + length); | tp.setStart(tp.getStart() + length); | ||||
tp.setEnd(tp.getEnd() + length); | tp.setEnd(tp.getEnd() + length); | ||||
} | } |
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.Map; | |||||
public final class HWPFFileSystem | public final class HWPFFileSystem | ||||
{ | { | ||||
HashMap _streams = new HashMap(); | |||||
Map<String, HWPFOutputStream> _streams = new HashMap<String, HWPFOutputStream>(); | |||||
public HWPFFileSystem() | public HWPFFileSystem() | ||||
{ | { | ||||
public HWPFOutputStream getStream(String name) | public HWPFOutputStream getStream(String name) | ||||
{ | { | ||||
return (HWPFOutputStream)_streams.get(name); | |||||
return _streams.get(name); | |||||
} | } | ||||
} | } |
package org.apache.poi.hwpf.sprm; | package org.apache.poi.hwpf.sprm; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.List; | |||||
import org.apache.poi.hwpf.usermodel.CharacterProperties; | import org.apache.poi.hwpf.usermodel.CharacterProperties; | ||||
import org.apache.poi.util.LittleEndian; | import org.apache.poi.util.LittleEndian; | ||||
} | } | ||||
public static byte[] compressCharacterProperty(CharacterProperties newCHP, CharacterProperties oldCHP) | public static byte[] compressCharacterProperty(CharacterProperties newCHP, CharacterProperties oldCHP) | ||||
{ | { | ||||
ArrayList sprmList = new ArrayList(); | |||||
List<byte[]> sprmList = new ArrayList<byte[]>(); | |||||
int size = 0; | int size = 0; | ||||
if (newCHP.isFRMarkDel() != oldCHP.isFRMarkDel()) | if (newCHP.isFRMarkDel() != oldCHP.isFRMarkDel()) |
{ | { | ||||
// page numbers links to Word97-2007BinaryFileFormat(doc)Specification.pdf, accessible from microsoft.com | // page numbers links to Word97-2007BinaryFileFormat(doc)Specification.pdf, accessible from microsoft.com | ||||
List sprmList = new ArrayList(); | |||||
List<byte[]> sprmList = new ArrayList<byte[]>(); | |||||
int size = 0; | int size = 0; | ||||
// Page 50 of public specification begins | // Page 50 of public specification begins |
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Collections; | import java.util.Collections; | ||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.Iterator; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
import org.apache.poi.hwpf.usermodel.BorderCode; | import org.apache.poi.hwpf.usermodel.BorderCode; | ||||
import org.apache.poi.hwpf.usermodel.DateAndTime; | import org.apache.poi.hwpf.usermodel.DateAndTime; | ||||
int[] tabPositions = pap.getRgdxaTab(); | int[] tabPositions = pap.getRgdxaTab(); | ||||
byte[] tabDescriptors = pap.getRgtbd(); | byte[] tabDescriptors = pap.getRgtbd(); | ||||
HashMap tabMap = new HashMap(); | |||||
Map<Integer, Byte> tabMap = new HashMap<Integer, Byte>(); | |||||
for (int x = 0; x < tabPositions.length; x++) | for (int x = 0; x < tabPositions.length; x++) | ||||
{ | { | ||||
tabMap.put(Integer.valueOf(tabPositions[x]), Byte.valueOf(tabDescriptors[x])); | tabMap.put(Integer.valueOf(tabPositions[x]), Byte.valueOf(tabDescriptors[x])); | ||||
tabPositions = new int[tabMap.size()]; | tabPositions = new int[tabMap.size()]; | ||||
tabDescriptors = new byte[tabPositions.length]; | tabDescriptors = new byte[tabPositions.length]; | ||||
ArrayList list = new ArrayList(); | |||||
Iterator keyIT = tabMap.keySet().iterator(); | |||||
while (keyIT.hasNext()) | |||||
{ | |||||
list.add(keyIT.next()); | |||||
} | |||||
List<Integer> list = new ArrayList<Integer>(tabMap.keySet()); | |||||
Collections.sort(list); | Collections.sort(list); | ||||
for (int x = 0; x < tabPositions.length; x++) | for (int x = 0; x < tabPositions.length; x++) | ||||
{ | { | ||||
Integer key = ((Integer)list.get(x)); | |||||
Integer key = list.get(x); | |||||
tabPositions[x] = key.intValue(); | tabPositions[x] = key.intValue(); | ||||
tabDescriptors[x] = ((Byte)tabMap.get(key)).byteValue(); | |||||
tabDescriptors[x] = tabMap.get(key).byteValue(); | |||||
} | } | ||||
pap.setRgdxaTab(tabPositions); | pap.setRgdxaTab(tabPositions); |
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Arrays; | import java.util.Arrays; | ||||
import java.util.List; | |||||
import org.apache.poi.hwpf.usermodel.SectionProperties; | import org.apache.poi.hwpf.usermodel.SectionProperties; | ||||
import org.apache.poi.util.LittleEndian; | import org.apache.poi.util.LittleEndian; | ||||
public static byte[] compressSectionProperty(SectionProperties newSEP) | public static byte[] compressSectionProperty(SectionProperties newSEP) | ||||
{ | { | ||||
int size = 0; | int size = 0; | ||||
ArrayList sprmList = new ArrayList(); | |||||
List<byte[]> sprmList = new ArrayList<byte[]>(); | |||||
if (newSEP.getCnsPgn() != DEFAULT_SEP.getCnsPgn()) | if (newSEP.getCnsPgn() != DEFAULT_SEP.getCnsPgn()) | ||||
{ | { |
return buf; | return buf; | ||||
} | } | ||||
public static int addSpecialSprm(short instruction, byte[] varParam, List list) | |||||
public static int addSpecialSprm(short instruction, byte[] varParam, List<byte[]> list) | |||||
{ | { | ||||
byte[] sprm = new byte[varParam.length + 4]; | byte[] sprm = new byte[varParam.length + 4]; | ||||
System.arraycopy(varParam, 0, sprm, 4, varParam.length); | System.arraycopy(varParam, 0, sprm, 4, varParam.length); | ||||
return sprm.length; | return sprm.length; | ||||
} | } | ||||
public static int addSprm(short instruction, int param, byte[] varParam, List list) | |||||
public static int addSprm(short instruction, int param, byte[] varParam, List<byte[]> list) | |||||
{ | { | ||||
int type = (instruction & 0xe000) >> 13; | int type = (instruction & 0xe000) >> 13; | ||||
return sprm.length; | return sprm.length; | ||||
} | } | ||||
public static byte[] getGrpprl(List sprmList, int size) | |||||
public static byte[] getGrpprl(List<byte[]> sprmList, int size) | |||||
{ | { | ||||
// spit out the final grpprl | // spit out the final grpprl | ||||
byte[] grpprl = new byte[size]; | byte[] grpprl = new byte[size]; | ||||
int index = 0; | int index = 0; | ||||
for (; listSize >= 0; listSize--) | for (; listSize >= 0; listSize--) | ||||
{ | { | ||||
byte[] sprm = (byte[])sprmList.remove(0); | |||||
byte[] sprm = sprmList.remove(0); | |||||
System.arraycopy(sprm, 0, grpprl, index, sprm.length); | System.arraycopy(sprm, 0, grpprl, index, sprm.length); | ||||
index += sprm.length; | index += sprm.length; | ||||
} | } |
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Arrays; | import java.util.Arrays; | ||||
import java.util.List; | |||||
import org.apache.poi.hwpf.usermodel.BorderCode; | import org.apache.poi.hwpf.usermodel.BorderCode; | ||||
import org.apache.poi.hwpf.usermodel.TableAutoformatLookSpecifier; | import org.apache.poi.hwpf.usermodel.TableAutoformatLookSpecifier; | ||||
public static byte[] compressTableProperty(TableProperties newTAP) | public static byte[] compressTableProperty(TableProperties newTAP) | ||||
{ | { | ||||
int size = 0; | int size = 0; | ||||
ArrayList sprmList = new ArrayList(); | |||||
List<byte[]> sprmList = new ArrayList<byte[]>(); | |||||
if (newTAP.getJc() != 0) | if (newTAP.getJc() != 0) | ||||
{ | { |
* @return An int array of length 2. The first int is the start index and | * @return An int array of length 2. The first int is the start index and | ||||
* the second int is the end index. | * the second int is the end index. | ||||
*/ | */ | ||||
private int[] findRange(List<? extends PropertyNode> rpl, int min, int start, int end) { | |||||
private int[] findRange(List<? extends PropertyNode<?>> rpl, int min, int start, int end) { | |||||
int x = min; | int x = min; | ||||
if ( rpl.size() == min ) | if ( rpl.size() == min ) | ||||
return new int[] { min, min }; | return new int[] { min, min }; | ||||
PropertyNode node = rpl.get( x ); | |||||
PropertyNode<?> node = rpl.get( x ); | |||||
while (node==null || (node.getEnd() <= start && x < rpl.size() - 1)) { | while (node==null || (node.getEnd() <= start && x < rpl.size() - 1)) { | ||||
x++; | x++; |