1 | package pro.verron.officestamper.preset.preprocessors.prooferror; | |
2 | ||
3 | import org.docx4j.TraversalUtil; | |
4 | import org.docx4j.openpackaging.packages.WordprocessingMLPackage; | |
5 | import org.docx4j.wml.ContentAccessor; | |
6 | import org.docx4j.wml.ProofErr; | |
7 | import pro.verron.officestamper.api.PreProcessor; | |
8 | ||
9 | public class RemoveProofErrors | |
10 | implements PreProcessor { | |
11 | ||
12 | /** | |
13 | * {@inheritDoc} | |
14 | */ | |
15 | @Override | |
16 | public void process(WordprocessingMLPackage document) { | |
17 | var mainDocumentPart = document.getMainDocumentPart(); | |
18 | var visitor = new ProofErrVisitor(); | |
19 |
1
1. process : removed call to org/docx4j/TraversalUtil::visit → KILLED |
TraversalUtil.visit(mainDocumentPart, visitor); |
20 | for (ProofErr proofErr : visitor.getProofErrs()) { | |
21 | var proofErrParent = proofErr.getParent(); | |
22 |
1
1. process : negated conditional → KILLED |
if (proofErrParent instanceof ContentAccessor parent) { |
23 | var parentContent = parent.getContent(); | |
24 | parentContent.remove(proofErr); | |
25 | } | |
26 | } | |
27 | } | |
28 | ||
29 | } | |
Mutations | ||
19 |
1.1 |
|
22 |
1.1 |