try to make CommentsTable more extensible

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895176 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2021-11-19 14:26:15 +00:00
parent 8c0d90c60c
commit b4f36926dc
3 changed files with 27 additions and 0 deletions

View File

@ -91,7 +91,17 @@ public interface Comments {
* we can reflect that in our cache
* @param oldReference the comment to remove from the commentRefs map
* @param comment the comment to replace in the commentRefs map
* @see #commentUpdated(XSSFComment)
* @since POI 5.2.0
*/
void referenceUpdated(CellAddress oldReference, XSSFComment comment);
/**
* Called after the comment is updated, so that
* we can reflect that in our cache
* @param comment the comment to replace in the commentRefs map
* @since POI 5.2.0
* @see #referenceUpdated(CellAddress, XSSFComment)
*/
void commentUpdated(XSSFComment comment);
}

View File

@ -141,6 +141,7 @@ public class CommentsTable extends POIXMLDocumentPart implements Comments {
* we can reflect that in our cache
* @param oldReference the comment to remove from the commentRefs map
* @param comment the comment to replace in the commentRefs map
* @see #commentUpdated(XSSFComment)
* @since POI 5.2.0
*/
@Override
@ -151,6 +152,18 @@ public class CommentsTable extends POIXMLDocumentPart implements Comments {
}
}
/**
* Called after the comment is updated, so that
* we can reflect that in our cache
* @param comment the comment to replace in the commentRefs map
* @since POI 5.2.0
* @see #referenceUpdated(CellAddress, XSSFComment)
*/
@Override
public void commentUpdated(XSSFComment comment) {
//no-op in this implementation
}
@Override
public int getNumberOfComments() {
return comments.getCommentList().sizeOfCommentArray();

View File

@ -92,6 +92,7 @@ public class XSSFComment implements Comment {
@Override
public void setAuthor(String author) {
_comment.setAuthorId(_comments.findAuthor(author));
_comments.commentUpdated(this);
}
/**
@ -152,6 +153,7 @@ public class XSSFComment implements Comment {
}
}
}
_comments.commentUpdated(this);
}
@Override
@ -182,6 +184,7 @@ public class XSSFComment implements Comment {
avoidXmlbeansCorruptPointer(_vmlShape);
}
_comments.commentUpdated(this);
}
/**
@ -232,6 +235,7 @@ public class XSSFComment implements Comment {
}
_str = (XSSFRichTextString)string;
_comment.setText(_str.getCTRst());
_comments.commentUpdated(this);
}
public void setString(String string) {