Fix more HSLF generics warnings
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1024411 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2ece9ad04b
commit
392a97fef4
@ -33,7 +33,7 @@ import org.apache.poi.util.LittleEndian;
|
|||||||
public class TextPropCollection {
|
public class TextPropCollection {
|
||||||
private int charactersCovered;
|
private int charactersCovered;
|
||||||
private short reservedField;
|
private short reservedField;
|
||||||
private LinkedList textPropList;
|
private LinkedList<TextProp> textPropList;
|
||||||
private int maskSpecial = 0;
|
private int maskSpecial = 0;
|
||||||
|
|
||||||
public int getSpecialMask() { return maskSpecial; }
|
public int getSpecialMask() { return maskSpecial; }
|
||||||
@ -41,12 +41,12 @@ public class TextPropCollection {
|
|||||||
/** Fetch the number of characters this styling applies to */
|
/** Fetch the number of characters this styling applies to */
|
||||||
public int getCharactersCovered() { return charactersCovered; }
|
public int getCharactersCovered() { return charactersCovered; }
|
||||||
/** Fetch the TextProps that define this styling */
|
/** Fetch the TextProps that define this styling */
|
||||||
public LinkedList getTextPropList() { return textPropList; }
|
public LinkedList<TextProp> getTextPropList() { return textPropList; }
|
||||||
|
|
||||||
/** Fetch the TextProp with this name, or null if it isn't present */
|
/** Fetch the TextProp with this name, or null if it isn't present */
|
||||||
public TextProp findByName(String textPropName) {
|
public TextProp findByName(String textPropName) {
|
||||||
for(int i=0; i<textPropList.size(); i++) {
|
for(int i=0; i<textPropList.size(); i++) {
|
||||||
TextProp prop = (TextProp)textPropList.get(i);
|
TextProp prop = textPropList.get(i);
|
||||||
if(prop.getName().equals(textPropName)) {
|
if(prop.getName().equals(textPropName)) {
|
||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ public class TextPropCollection {
|
|||||||
TextProp textProp = (TextProp)base.clone();
|
TextProp textProp = (TextProp)base.clone();
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
for(int i=0; i<textPropList.size(); i++) {
|
for(int i=0; i<textPropList.size(); i++) {
|
||||||
TextProp curProp = (TextProp)textPropList.get(i);
|
TextProp curProp = textPropList.get(i);
|
||||||
if(textProp.getMask() > curProp.getMask()) {
|
if(textProp.getMask() > curProp.getMask()) {
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ public class TextPropCollection {
|
|||||||
public TextPropCollection(int charactersCovered, short reservedField) {
|
public TextPropCollection(int charactersCovered, short reservedField) {
|
||||||
this.charactersCovered = charactersCovered;
|
this.charactersCovered = charactersCovered;
|
||||||
this.reservedField = reservedField;
|
this.reservedField = reservedField;
|
||||||
textPropList = new LinkedList();
|
textPropList = new LinkedList<TextProp>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,7 +147,7 @@ public class TextPropCollection {
|
|||||||
public TextPropCollection(int textSize) {
|
public TextPropCollection(int textSize) {
|
||||||
charactersCovered = textSize;
|
charactersCovered = textSize;
|
||||||
reservedField = -1;
|
reservedField = -1;
|
||||||
textPropList = new LinkedList();
|
textPropList = new LinkedList<TextProp>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -187,7 +187,7 @@ public class TextPropCollection {
|
|||||||
|
|
||||||
// Then the contents of all the properties
|
// Then the contents of all the properties
|
||||||
for(int i=0; i<textPropList.size(); i++) {
|
for(int i=0; i<textPropList.size(); i++) {
|
||||||
TextProp textProp = (TextProp)textPropList.get(i);
|
TextProp textProp = textPropList.get(i);
|
||||||
int val = textProp.getValue();
|
int val = textProp.getValue();
|
||||||
if(textProp.getSize() == 2) {
|
if(textProp.getSize() == 2) {
|
||||||
StyleTextPropAtom.writeLittleEndian((short)val,o);
|
StyleTextPropAtom.writeLittleEndian((short)val,o);
|
||||||
|
@ -20,7 +20,6 @@ package org.apache.poi.hslf.record;
|
|||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import org.apache.poi.hslf.model.textproperties.AlignmentTextProp;
|
import org.apache.poi.hslf.model.textproperties.AlignmentTextProp;
|
||||||
@ -28,9 +27,9 @@ import org.apache.poi.hslf.model.textproperties.CharFlagsTextProp;
|
|||||||
import org.apache.poi.hslf.model.textproperties.ParagraphFlagsTextProp;
|
import org.apache.poi.hslf.model.textproperties.ParagraphFlagsTextProp;
|
||||||
import org.apache.poi.hslf.model.textproperties.TextProp;
|
import org.apache.poi.hslf.model.textproperties.TextProp;
|
||||||
import org.apache.poi.hslf.model.textproperties.TextPropCollection;
|
import org.apache.poi.hslf.model.textproperties.TextPropCollection;
|
||||||
|
import org.apache.poi.util.HexDump;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
import org.apache.poi.util.POILogger;
|
import org.apache.poi.util.POILogger;
|
||||||
import org.apache.poi.util.HexDump;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A StyleTextPropAtom (type 4001). Holds basic character properties
|
* A StyleTextPropAtom (type 4001). Holds basic character properties
|
||||||
@ -69,26 +68,26 @@ public final class StyleTextPropAtom extends RecordAtom
|
|||||||
* Characters the paragraph covers, and also contains the TextProps
|
* Characters the paragraph covers, and also contains the TextProps
|
||||||
* that actually define the styling of the paragraph.
|
* that actually define the styling of the paragraph.
|
||||||
*/
|
*/
|
||||||
private LinkedList paragraphStyles;
|
private LinkedList<TextPropCollection> paragraphStyles;
|
||||||
public LinkedList getParagraphStyles() { return paragraphStyles; }
|
public LinkedList<TextPropCollection> getParagraphStyles() { return paragraphStyles; }
|
||||||
/**
|
/**
|
||||||
* Updates the link list of TextPropCollections which make up the
|
* Updates the link list of TextPropCollections which make up the
|
||||||
* paragraph stylings
|
* paragraph stylings
|
||||||
*/
|
*/
|
||||||
public void setParagraphStyles(LinkedList ps) { paragraphStyles = ps; }
|
public void setParagraphStyles(LinkedList<TextPropCollection> ps) { paragraphStyles = ps; }
|
||||||
/**
|
/**
|
||||||
* The list of all the different character stylings we code for.
|
* The list of all the different character stylings we code for.
|
||||||
* Each entry is a TextPropCollection, which tells you how many
|
* Each entry is a TextPropCollection, which tells you how many
|
||||||
* Characters the character styling covers, and also contains the
|
* Characters the character styling covers, and also contains the
|
||||||
* TextProps that actually define the styling of the characters.
|
* TextProps that actually define the styling of the characters.
|
||||||
*/
|
*/
|
||||||
private LinkedList charStyles;
|
private LinkedList<TextPropCollection> charStyles;
|
||||||
public LinkedList getCharacterStyles() { return charStyles; }
|
public LinkedList<TextPropCollection> getCharacterStyles() { return charStyles; }
|
||||||
/**
|
/**
|
||||||
* Updates the link list of TextPropCollections which make up the
|
* Updates the link list of TextPropCollections which make up the
|
||||||
* character stylings
|
* character stylings
|
||||||
*/
|
*/
|
||||||
public void setCharacterStyles(LinkedList cs) { charStyles = cs; }
|
public void setCharacterStyles(LinkedList<TextPropCollection> cs) { charStyles = cs; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns how many characters the paragraph's
|
* Returns how many characters the paragraph's
|
||||||
@ -110,12 +109,9 @@ public final class StyleTextPropAtom extends RecordAtom
|
|||||||
public int getCharacterTextLengthCovered() {
|
public int getCharacterTextLengthCovered() {
|
||||||
return getCharactersCovered(charStyles);
|
return getCharactersCovered(charStyles);
|
||||||
}
|
}
|
||||||
private int getCharactersCovered(LinkedList styles) {
|
private int getCharactersCovered(LinkedList<TextPropCollection> styles) {
|
||||||
int length = 0;
|
int length = 0;
|
||||||
Iterator it = styles.iterator();
|
for(TextPropCollection tpc : styles) {
|
||||||
while(it.hasNext()) {
|
|
||||||
TextPropCollection tpc =
|
|
||||||
(TextPropCollection)it.next();
|
|
||||||
length += tpc.getCharactersCovered();
|
length += tpc.getCharactersCovered();
|
||||||
}
|
}
|
||||||
return length;
|
return length;
|
||||||
@ -199,8 +195,8 @@ public final class StyleTextPropAtom extends RecordAtom
|
|||||||
reserved = new byte[0];
|
reserved = new byte[0];
|
||||||
|
|
||||||
// Set empty linked lists, ready for when they call setParentTextSize
|
// Set empty linked lists, ready for when they call setParentTextSize
|
||||||
paragraphStyles = new LinkedList();
|
paragraphStyles = new LinkedList<TextPropCollection>();
|
||||||
charStyles = new LinkedList();
|
charStyles = new LinkedList<TextPropCollection>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -218,8 +214,8 @@ public final class StyleTextPropAtom extends RecordAtom
|
|||||||
LittleEndian.putInt(_header,4,10);
|
LittleEndian.putInt(_header,4,10);
|
||||||
|
|
||||||
// Set empty paragraph and character styles
|
// Set empty paragraph and character styles
|
||||||
paragraphStyles = new LinkedList();
|
paragraphStyles = new LinkedList<TextPropCollection>();
|
||||||
charStyles = new LinkedList();
|
charStyles = new LinkedList<TextPropCollection>();
|
||||||
|
|
||||||
TextPropCollection defaultParagraphTextProps =
|
TextPropCollection defaultParagraphTextProps =
|
||||||
new TextPropCollection(parentTextSize, (short)0);
|
new TextPropCollection(parentTextSize, (short)0);
|
||||||
@ -366,13 +362,13 @@ public final class StyleTextPropAtom extends RecordAtom
|
|||||||
|
|
||||||
// First up, we need to serialise the paragraph properties
|
// First up, we need to serialise the paragraph properties
|
||||||
for(int i=0; i<paragraphStyles.size(); i++) {
|
for(int i=0; i<paragraphStyles.size(); i++) {
|
||||||
TextPropCollection tpc = (TextPropCollection)paragraphStyles.get(i);
|
TextPropCollection tpc = paragraphStyles.get(i);
|
||||||
tpc.writeOut(baos);
|
tpc.writeOut(baos);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now, we do the character ones
|
// Now, we do the character ones
|
||||||
for(int i=0; i<charStyles.size(); i++) {
|
for(int i=0; i<charStyles.size(); i++) {
|
||||||
TextPropCollection tpc = (TextPropCollection)charStyles.get(i);
|
TextPropCollection tpc = charStyles.get(i);
|
||||||
tpc.writeOut(baos);
|
tpc.writeOut(baos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,12 +420,10 @@ public final class StyleTextPropAtom extends RecordAtom
|
|||||||
|
|
||||||
out.append("Paragraph properties\n");
|
out.append("Paragraph properties\n");
|
||||||
|
|
||||||
for (Iterator it1 = getParagraphStyles().iterator(); it1.hasNext();) {
|
for(TextPropCollection pr : getParagraphStyles()) {
|
||||||
TextPropCollection pr = (TextPropCollection)it1.next();
|
|
||||||
out.append(" chars covered: " + pr.getCharactersCovered());
|
out.append(" chars covered: " + pr.getCharactersCovered());
|
||||||
out.append(" special mask flags: 0x" + HexDump.toHex(pr.getSpecialMask()) + "\n");
|
out.append(" special mask flags: 0x" + HexDump.toHex(pr.getSpecialMask()) + "\n");
|
||||||
for (Iterator it2 = pr.getTextPropList().iterator(); it2.hasNext(); ) {
|
for(TextProp p : pr.getTextPropList()) {
|
||||||
TextProp p = (TextProp)it2.next();
|
|
||||||
out.append(" " + p.getName() + " = " + p.getValue() );
|
out.append(" " + p.getName() + " = " + p.getValue() );
|
||||||
out.append(" (0x" + HexDump.toHex(p.getValue()) + ")\n");
|
out.append(" (0x" + HexDump.toHex(p.getValue()) + ")\n");
|
||||||
}
|
}
|
||||||
@ -447,12 +441,10 @@ public final class StyleTextPropAtom extends RecordAtom
|
|||||||
}
|
}
|
||||||
|
|
||||||
out.append("Character properties\n");
|
out.append("Character properties\n");
|
||||||
for (Iterator it1 = getCharacterStyles().iterator(); it1.hasNext();) {
|
for(TextPropCollection pr : getCharacterStyles()) {
|
||||||
TextPropCollection pr = (TextPropCollection)it1.next();
|
|
||||||
out.append(" chars covered: " + pr.getCharactersCovered() );
|
out.append(" chars covered: " + pr.getCharactersCovered() );
|
||||||
out.append(" special mask flags: 0x" + HexDump.toHex(pr.getSpecialMask()) + "\n");
|
out.append(" special mask flags: 0x" + HexDump.toHex(pr.getSpecialMask()) + "\n");
|
||||||
for (Iterator it2 = pr.getTextPropList().iterator(); it2.hasNext(); ) {
|
for(TextProp p : pr.getTextPropList()) {
|
||||||
TextProp p = (TextProp)it2.next();
|
|
||||||
out.append(" " + p.getName() + " = " + p.getValue() );
|
out.append(" " + p.getName() + " = " + p.getValue() );
|
||||||
out.append(" (0x" + HexDump.toHex(p.getValue()) + ")\n");
|
out.append(" (0x" + HexDump.toHex(p.getValue()) + ")\n");
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ public final class SoundData {
|
|||||||
* @return the array with the sound data
|
* @return the array with the sound data
|
||||||
*/
|
*/
|
||||||
public static SoundData[] find(Document document){
|
public static SoundData[] find(Document document){
|
||||||
ArrayList lst = new ArrayList();
|
ArrayList<SoundData> lst = new ArrayList<SoundData>();
|
||||||
Record[] ch = document.getChildRecords();
|
Record[] ch = document.getChildRecords();
|
||||||
for (int i = 0; i < ch.length; i++) {
|
for (int i = 0; i < ch.length; i++) {
|
||||||
if(ch[i].getRecordType() == RecordTypes.SoundCollection.typeID){
|
if(ch[i].getRecordType() == RecordTypes.SoundCollection.typeID){
|
||||||
@ -89,6 +89,6 @@ public final class SoundData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return (SoundData[])lst.toArray(new SoundData[lst.size()]);
|
return lst.toArray(new SoundData[lst.size()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user