PptxRenderer.java

1
package pro.verron.officestamper.utils.pml;
2
3
import org.docx4j.dml.CTRegularTextRun;
4
import org.docx4j.dml.CTTextParagraph;
5
import org.docx4j.openpackaging.packages.PresentationMLPackage;
6
7
import static java.util.stream.Collectors.joining;
8
9
/// Utility class for rendering PowerPoint presentations to string representations.
10
///
11
/// This class provides methods to extract text content from PowerPoint files and convert them into formatted strings.
12
/// It is designed as a utility class with only static methods and cannot be instantiated.
13
///
14
/// @author Joseph Verron
15
/// @since 3.0
16
public class PptxRenderer {
17
18
    private PptxRenderer() {
19
        throw new IllegalStateException("Utility class");
20
    }
21
22
    /// Converts the content of a PowerPoint presentation into a string by extracting text paragraphs from the
23
    /// presentation and formatting them as strings.
24
    ///
25
    /// @param presentation the PowerPoint presentation represented as a [PresentationMLPackage].
26
    ///
27
    /// @return a string representation of the text content within the PowerPoint presentation.
28
    public static String pptxToString(PresentationMLPackage presentation) {
29 1 1. pptxToString : replaced return value with "" for pro/verron/officestamper/utils/pml/PptxRenderer::pptxToString → NO_COVERAGE
        return new PptxIterator(presentation).filter(CTTextParagraph.class::isInstance)
30
                                             .map(CTTextParagraph.class::cast)
31
                                             .map(CTTextParagraph::getEGTextRun)
32
                                             .map(l -> l.stream()
33
                                                        .filter(CTRegularTextRun.class::isInstance)
34
                                                        .map(CTRegularTextRun.class::cast)
35
                                                        .map(CTRegularTextRun::getT)
36 1 1. lambda$pptxToString$0 : replaced return value with "" for pro/verron/officestamper/utils/pml/PptxRenderer::lambda$pptxToString$0 → NO_COVERAGE
                                                        .collect(joining()))
37
                                             .collect(joining("\n", "", "\n"));
38
    }
39
}

Mutations

29

1.1
Location : pptxToString
Killed by : none
replaced return value with "" for pro/verron/officestamper/utils/pml/PptxRenderer::pptxToString → NO_COVERAGE

36

1.1
Location : lambda$pptxToString$0
Killed by : none
replaced return value with "" for pro/verron/officestamper/utils/pml/PptxRenderer::lambda$pptxToString$0 → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.22.0