/** * check if any shapes contain wrong data * At now(13.08.2010) check if patriarch contains 2 or more comments with same coordinates */ protected void preSerialize(){ Map<Integer, NoteRecord> tailRecords = _boundAggregate.getTailRecords(); /* * contains coordinates of comments we iterate over */ Set<String> coordinates = new HashSet<>(tailRecords.size()); for(NoteRecord rec : tailRecords.values()){ String noteRef = new CellReference(rec.getRow(), rec.getColumn(), true, true).formatAsString(); // A1-style notation if(coordinates.contains(noteRef )){ throw new IllegalStateException("found multiple cell comments for cell " + noteRef ); } else { coordinates.add(noteRef); } } }
private static NoteRecord createNoteRecord() { NoteRecord note = new NoteRecord(); note.setFlags(NoteRecord.NOTE_HIDDEN); note.setAuthor(""); return note; }
/** * Name of the original comment author * * @return the name of the original author of the comment */ @Override public String getAuthor() { return _note.getAuthor(); }
if (rec instanceof NoteRecord) { NoteRecord note = (NoteRecord) rec; if (note.getRow() == row && note.getColumn() == column) { if(i < noteTxo.size()) { TextObjectRecord txo = noteTxo.get(note.getShapeId()); if(txo != null){ comment = new HSSFComment(note, txo); comment.setRow(note.getRow()); comment.setColumn(note.getColumn()); comment.setAuthor(note.getAuthor()); comment.setVisible(note.getFlags() == NoteRecord.NOTE_VISIBLE); comment.setString(txo.getStr()); } else{
/** * Creates the low level <code>NoteRecord</code> * which holds the comment attributes. */ private NoteRecord createNoteRecord( HSSFComment shape, int shapeId ) { NoteRecord note = new NoteRecord(); note.setColumn(shape.getColumn()); note.setRow(shape.getRow()); note.setFlags(shape.isVisible() ? NoteRecord.NOTE_VISIBLE : NoteRecord.NOTE_HIDDEN); note.setShapeId(shapeId); note.setAuthor(shape.getAuthor() == null ? "" : shape.getAuthor()); return note; }
/** * Return the row of the cell that contains the comment * * @return the 0-based row of the cell that contains the comment */ @Override public int getRow() { return _note.getRow(); }
/** * Return the column of the cell that contains the comment * * @return the 0-based column of the cell that contains the comment */ @Override public int getColumn() { return _note.getColumn(); }
/** * Remove tail record from the existing map * @param note to be removed */ public void removeTailRecord(NoteRecord note) { tailRec.remove(note.getShapeId()); } }
@Override public NoteRecord clone() { NoteRecord rec = new NoteRecord(); rec.field_1_row = field_1_row; rec.field_2_col = field_2_col; rec.field_3_flags = field_3_flags; rec.field_4_shapeid = field_4_shapeid; rec.field_6_author = field_6_author; return rec; } }
/** * Set the row of the cell that contains the comment * * @param row the 0-based row of the cell that contains the comment */ @Override public void setRow(int row) { _note.setRow(row); }
/** * Sets whether this comment is visible. * * @param visible <code>true</code> if the comment is visible, <code>false</code> otherwise */ @Override public void setVisible(boolean visible) { _note.setFlags(visible ? NoteRecord.NOTE_VISIBLE : NoteRecord.NOTE_HIDDEN); setHidden(!visible); }
/** * Set the column of the cell that contains the comment * * @param col the 0-based column of the cell that contains the comment */ @Override public void setColumn(int col) { _note.setColumn(col); }
/** * Name of the original comment author * * @param author the name of the original author of the comment */ @Override public void setAuthor(String author) { if (_note != null) _note.setAuthor(author); }
/** * Returns whether this comment is visible. * * @return <code>true</code> if the comment is visible, <code>false</code> otherwise */ @Override public boolean isVisible() { return _note.getFlags() == NoteRecord.NOTE_VISIBLE; }
/** * Creates the low level <code>NoteRecord</code> * which holds the comment attributes. */ private NoteRecord createNoteRecord( HSSFComment shape, int shapeId ) { NoteRecord note = new NoteRecord(); note.setColumn(shape.getColumn()); note.setRow(shape.getRow()); note.setFlags(shape.isVisible() ? NoteRecord.NOTE_VISIBLE : NoteRecord.NOTE_HIDDEN); note.setShapeId(shapeId); note.setAuthor(shape.getAuthor() == null ? "" : shape.getAuthor()); return note; }
case NoteRecord.sid: NoteRecord nrec = (NoteRecord) record; thisRow = nrec.getRow();
/** * Return the column of the cell that contains the comment * * @return the 0-based column of the cell that contains the comment */ @Override public int getColumn() { return _note.getColumn(); }
/** * Add tail record to existing map * @param note to be added */ public void addTailRecord(NoteRecord note) { tailRec.put(note.getShapeId(), note); }
public Object clone() { NoteRecord rec = new NoteRecord(); rec.field_1_row = field_1_row; rec.field_2_col = field_2_col; rec.field_3_flags = field_3_flags; rec.field_4_shapeid = field_4_shapeid; rec.field_6_author = field_6_author; return rec; } }
/** * Set the row of the cell that contains the comment * * @param row the 0-based row of the cell that contains the comment */ public void setRow(int row) { _note.setRow(row); }