| 1 | package pro.verron.officestamper.preset.preprocessors.prooferror; | |
| 2 | ||
| 3 | import org.docx4j.openpackaging.packages.WordprocessingMLPackage; | |
| 4 | import org.docx4j.wml.ContentAccessor; | |
| 5 | import org.docx4j.wml.ProofErr; | |
| 6 | import pro.verron.officestamper.api.PreProcessor; | |
| 7 | ||
| 8 | import static pro.verron.officestamper.utils.wml.WmlUtils.visitDocument; | |
| 9 | ||
| 10 | /// This pre-processor removes all [ProofErr] elements from the document. | |
| 11 | /// | |
| 12 | /// Proof errors are markup elements that indicate potential grammar or spelling errors in the document. This | |
| 13 | /// pre-processor removes them to clean up the document before further processing. | |
| 14 | public class RemoveProofErrors | |
| 15 | implements PreProcessor { | |
| 16 | ||
| 17 | @Override | |
| 18 | public void process(WordprocessingMLPackage document) { | |
| 19 | var visitor = new ProofErrVisitor(); | |
| 20 |
1
1. process : removed call to pro/verron/officestamper/utils/wml/WmlUtils::visitDocument → TIMED_OUT |
visitDocument(document, visitor); |
| 21 | for (ProofErr proofErr : visitor.getProofErrs()) { | |
| 22 | var proofErrParent = proofErr.getParent(); | |
| 23 |
1
1. process : negated conditional → TIMED_OUT |
if (proofErrParent instanceof ContentAccessor parent) { |
| 24 | var parentContent = parent.getContent(); | |
| 25 | parentContent.remove(proofErr); | |
| 26 | } | |
| 27 | } | |
| 28 | } | |
| 29 | ||
| 30 | } | |
Mutations | ||
| 20 |
1.1 |
|
| 23 |
1.1 |