pro.verron.officestamper.core.StandardComment Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of engine Show documentation
Show all versions of engine Show documentation
Office-stamper is a Java template engine for docx documents, forked from org.wickedsource.docx-stamper
The newest version!
package pro.verron.officestamper.core;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.docx4j.wml.CommentRangeEnd;
import org.docx4j.wml.CommentRangeStart;
import org.docx4j.wml.Comments;
import org.docx4j.wml.ContentAccessor;
import org.docx4j.wml.R.CommentReference;
import pro.verron.officestamper.api.Comment;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* CommentWrapper class.
*
* @author Joseph Verron
* @author Tom Hombergs
* @version ${version}
* @since 1.0.2
*/
public class StandardComment
implements Comment {
private final Set children = new HashSet<>();
private final WordprocessingMLPackage document;
private Comments.Comment comment;
private CommentRangeStart commentRangeStart;
private CommentRangeEnd commentRangeEnd;
private CommentReference commentReference;
/**
* Constructs a new StandardComment object.
*
* @param document the WordprocessingMLPackage document instance
*/
public StandardComment(WordprocessingMLPackage document) {
this.document = document;
}
/**
* getParent.
*
* @return the comment's author.
*/
@Override
public ContentAccessor getParent() {
return DocumentUtil.findSmallestCommonParent(getCommentRangeStart(), getCommentRangeEnd());
}
/**
* @return the elements in the document that are between the comment range anchors.
*/
@Override
public List