Lines 1016-1019
Link Here
|
1016 |
} |
1016 |
} |
1017 |
return comment; |
1017 |
return comment; |
1018 |
} |
1018 |
} |
|
|
1019 |
/** |
1020 |
* Returns the comment associated with this cell |
1021 |
* |
1022 |
* @return comment associated with this cell |
1023 |
*/ |
1024 |
public void removeCellComment() { |
1025 |
int objectIndex = -1; |
1026 |
HashMap txshapes = new HashMap(); //map shapeId and TextObjectRecord |
1027 |
for (Iterator it = sheet.getRecords().iterator(); it.hasNext();) { |
1028 |
Record rec = (Record) it.next(); |
1029 |
objectIndex++; |
1030 |
if (rec instanceof NoteRecord) { |
1031 |
NoteRecord note = (NoteRecord) rec; |
1032 |
if (note.getRow() == record.getRow() |
1033 |
&& note.getColumn() == record.getColumn()) { |
1034 |
it.remove(); // removes NoteRecord |
1035 |
|
1036 |
// sheet.getRecords().remove(txshapes.get(new Integer(note |
1037 |
// .getShapeId()))); |
1038 |
// remove the object records |
1039 |
// for (int i = 0; i < vAssocObj.size(); i++) { |
1040 |
// sheet.getRecords().remove( |
1041 |
// ((Integer) vAssocObj.get(i)).intValue()); |
1042 |
// } |
1043 |
// sheet.getRecords().remove(objectIndex); // remove the note record |
1044 |
comment = null; |
1045 |
break; |
1046 |
|
1047 |
} |
1048 |
} else if (rec instanceof ObjRecord) { |
1049 |
ObjRecord obj = (ObjRecord) rec; |
1050 |
ObjRecord ObjParent = obj; |
1051 |
SubRecord sub = (SubRecord) obj.getSubRecords().get(0); |
1052 |
if (sub instanceof CommonObjectDataSubRecord) { |
1053 |
CommonObjectDataSubRecord cmo = (CommonObjectDataSubRecord) sub; |
1054 |
if (cmo.getObjectType() == CommonObjectDataSubRecord.OBJECT_TYPE_COMMENT) { |
1055 |
int parentObjectIndex = objectIndex; |
1056 |
//find the nearest TextObjectRecord which holds comment's text and map it to its shapeId |
1057 |
while (it.hasNext()) { |
1058 |
rec = (Record) it.next(); |
1059 |
objectIndex++; |
1060 |
if (rec instanceof TextObjectRecord) { |
1061 |
Vector vAssocObj = new Vector(); |
1062 |
// vAssocObj.add(new Integer(objectIndex)); |
1063 |
// vAssocObj.add(ew Integer(parentObjectIndex)); |
1064 |
txshapes.put(new Integer(cmo.getObjectId()), |
1065 |
ObjParent); |
1066 |
break; |
1067 |
} |
1068 |
} |
1069 |
|
1070 |
} |
1071 |
} |
1072 |
} |
1073 |
} |
1074 |
} |
1019 |
} |
1075 |
} |