* @return the format id of a format that matches or -1 if none found and createIfNotFound
*/
public short getFormat(String format, boolean createIfNotFound) {
- Iterator iterator;
- for (iterator = formats.iterator(); iterator.hasNext();) {
- FormatRecord r = (FormatRecord)iterator.next();
+ for (FormatRecord r : formats) {
if (r.getFormatString().equals(format)) {
return (short)r.getIndexCode();
}
- }
+ }
- if (createIfNotFound) {
+ if (createIfNotFound) {
return (short)createFormat(format);
- }
+ }
- return -1;
+ return -1;
}
/**
* Returns the list of FormatRecords in the workbook.
* @return ArrayList of FormatRecords in the notebook
*/
- public List getFormats() {
- return formats;
+ public List<FormatRecord> getFormats() {
+ return formats;
}
/**
* Returns the first occurance of a record matching a particular sid.
*/
public Record findFirstRecordBySid(short sid) {
- for (Iterator iterator = records.iterator(); iterator.hasNext(); ) {
- Record record = ( Record ) iterator.next();
-
+ for (Record record : records) {
if (record.getSid() == sid) {
return record;
}
*/
public int findFirstRecordLocBySid(short sid) {
int index = 0;
- for (Iterator iterator = records.iterator(); iterator.hasNext(); ) {
- Record record = ( Record ) iterator.next();
-
+ for (Record record : records) {
if (record.getSid() == sid) {
return index;
}
*/
public Record findNextRecordBySid(short sid, int pos) {
int matches = 0;
- for (Iterator iterator = records.iterator(); iterator.hasNext(); ) {
- Record record = ( Record ) iterator.next();
-
+ for (Record record : records) {
if (record.getSid() == sid) {
if (matches++ == pos)
return record;
return null;
}
- public List getHyperlinks()
+ public List<HyperlinkRecord> getHyperlinks()
{
return hyperlinks;
}
* Finds the primary drawing group, if one already exists
*/
public void findDrawingGroup() {
+ if(drawingManager != null) {
+ // We already have it!
+ return;
+ }
+
// Need to find a DrawingGroupRecord that
// contains a EscherDggRecord
- for(Iterator<Record> rit = records.iterator(); rit.hasNext();) {
- Record r = rit.next();
-
+ for(Record r : records) {
if(r instanceof DrawingGroupRecord) {
DrawingGroupRecord dg = (DrawingGroupRecord)r;
dg.processChildRecords();
if(dgLoc != -1) {
DrawingGroupRecord dg = (DrawingGroupRecord)records.get(dgLoc);
EscherDggRecord dgg = null;
- for(Iterator it = dg.getEscherRecords().iterator(); it.hasNext();) {
- Object er = it.next();
+ for(EscherRecord er : dg.getEscherRecords()) {
if(er instanceof EscherDggRecord) {
dgg = (EscherDggRecord)er;
}
bstoreContainer = new EscherContainerRecord();
bstoreContainer.setRecordId( EscherContainerRecord.BSTORE_CONTAINER );
bstoreContainer.setOptions( (short) ( (escherBSERecords.size() << 4) | 0xF ) );
- for ( Iterator iterator = escherBSERecords.iterator(); iterator.hasNext(); )
- {
- EscherRecord escherRecord = (EscherRecord) iterator.next();
+ for (EscherRecord escherRecord : escherBSERecords) {
bstoreContainer.addChildRecord( escherRecord );
}
}