RemoveLang.java

1
package pro.verron.officestamper.preset.preprocessors.rmlang;
2
3
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
4
import pro.verron.officestamper.api.PreProcessor;
5
6
import static pro.verron.officestamper.utils.wml.WmlUtils.visitDocument;
7
8
/// The [RemoveLang] preprocessor removes language settings from paragraphs and runs within a Word document. This is
9
/// useful when working with templates where language-specific formatting might interfere with the stamping process.
10
///
11
/// This preprocessor specifically targets and removes `w:lang` elements from both run properties (`w:rPr`) and
12
/// paragraph properties (`w:pPr`) throughout the document.
13
///
14
/// @author Joseph Verron
15
/// @version ${version}
16
public class RemoveLang
17
        implements PreProcessor {
18
19
    @Override
20
    public void process(WordprocessingMLPackage document) {
21 1 1. process : removed call to pro/verron/officestamper/preset/preprocessors/rmlang/RemoveLang::removeRprLang → TIMED_OUT
        removeRprLang(document);
22 1 1. process : removed call to pro/verron/officestamper/preset/preprocessors/rmlang/RemoveLang::removePprLang → TIMED_OUT
        removePprLang(document);
23
    }
24
25
    private static void removeRprLang(WordprocessingMLPackage document) {
26
        var visitor = new RprLangVisitor();
27 1 1. removeRprLang : removed call to pro/verron/officestamper/utils/wml/WmlUtils::visitDocument → TIMED_OUT
        visitDocument(document, visitor);
28
        for (var rPr : visitor.getrPrs()) {
29 1 1. removeRprLang : removed call to org/docx4j/wml/RPr::setLang → NO_COVERAGE
            rPr.setLang(null);
30
        }
31
    }
32
33
    private static void removePprLang(WordprocessingMLPackage document) {
34
        var visitor2 = new PprLangVisitor();
35 1 1. removePprLang : removed call to pro/verron/officestamper/utils/wml/WmlUtils::visitDocument → TIMED_OUT
        visitDocument(document, visitor2);
36
        for (var rPr : visitor2.getParaPrs()) {
37 1 1. removePprLang : removed call to org/docx4j/wml/ParaRPr::setLang → KILLED
            rPr.setLang(null);
38
        }
39
    }
40
}

Mutations

21

1.1
Location : process
Killed by : none
removed call to pro/verron/officestamper/preset/preprocessors/rmlang/RemoveLang::removeRprLang → TIMED_OUT

22

1.1
Location : process
Killed by : none
removed call to pro/verron/officestamper/preset/preprocessors/rmlang/RemoveLang::removePprLang → TIMED_OUT

27

1.1
Location : removeRprLang
Killed by : none
removed call to pro/verron/officestamper/utils/wml/WmlUtils::visitDocument → TIMED_OUT

29

1.1
Location : removeRprLang
Killed by : none
removed call to org/docx4j/wml/RPr::setLang → NO_COVERAGE

35

1.1
Location : removePprLang
Killed by : none
removed call to pro/verron/officestamper/utils/wml/WmlUtils::visitDocument → TIMED_OUT

37

1.1
Location : removePprLang
Killed by : pro.verron.officestamper.test.ProcessorDisplayIfTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ProcessorDisplayIfTest]/[test-template:conditionalDisplayOfEndnotes(pro.verron.officestamper.test.utils.ContextFactory)]/[test-template-invocation:#2]
removed call to org/docx4j/wml/ParaRPr::setLang → KILLED

Active mutators

Tests examined


Report generated by PIT 1.22.0