Example usage for org.apache.poi.xslf.usermodel XSLFSlideLayout getSlideMaster

List of usage examples for org.apache.poi.xslf.usermodel XSLFSlideLayout getSlideMaster

Introduction

In this page you can find the example usage for org.apache.poi.xslf.usermodel XSLFSlideLayout getSlideMaster.

Prototype

@SuppressWarnings("WeakerAccess")
public XSLFSlideMaster getSlideMaster() 

Source Link

Document

Slide master object associated with this layout.

Usage

From source file:com.opensearchserver.extractor.parser.Pptx.java

License:Apache License

/**
 * Declined from XSLFPowerPointExtractor.java
 * //from w w w  .  j  av a 2  s. com
 * @param pptSlideShow
 */
private void extractSides(XMLSlideShow slideshow) {

    XSLFSlide[] slides = (XSLFSlide[]) slideshow.getSlides();
    XSLFCommentAuthors commentAuthors = slideshow.getCommentAuthors();

    for (XSLFSlide slide : slides) {

        // One document per slide
        ParserDocument result = getNewParserDocument();

        XSLFNotes notes = slide.getNotes();
        XSLFComments comments = slide.getComments();
        XSLFSlideLayout layout = slide.getSlideLayout();
        XSLFSlideMaster master = layout.getSlideMaster();

        // TODO Do the slide's name
        // (Stored in docProps/app.xml)

        // Do the slide's text
        result.add(SLIDES, extractText(slide.getCommonSlideData(), false));
        result.add(LANG_DETECTION, languageDetection(SLIDES, 10000));

        // If requested, get text from the master and it's layout
        if (layout != null) {
            result.add(MASTER, extractText(layout.getCommonSlideData(), true));
        }
        if (master != null) {
            result.add(MASTER, extractText(master.getCommonSlideData(), true));
        }

        // If the slide has comments, do those too
        if (comments != null) {
            for (CTComment comment : comments.getCTCommentsList().getCmList()) {
                StringBuilder sbComment = new StringBuilder();
                // Do the author if we can
                if (commentAuthors != null) {
                    CTCommentAuthor author = commentAuthors.getAuthorById(comment.getAuthorId());
                    if (author != null) {
                        sbComment.append(author.getName());
                        sbComment.append(": ");
                    }
                }

                // Then the comment text, with a new line afterwards
                sbComment.append(comment.getText());
                sbComment.append("\n");
                if (sbComment.length() > 0)
                    result.add(COMMENTS, sbComment.toString());
            }
        }

        // Do the notes if requested
        if (notes != null) {
            result.add(NOTES, extractText(notes.getCommonSlideData(), false));
        }
    }
}

From source file:com.qwazr.extractor.parser.Pptx.java

License:Apache License

/**
 * Declined from XSLFPowerPointExtractor.java
 *
 * @param slideshow/* www. j  a v a2 s.c o  m*/
 */
private void extractSides(XMLSlideShow slideshow) {

    List<XSLFSlide> slides = slideshow.getSlides();
    XSLFCommentAuthors commentAuthors = slideshow.getCommentAuthors();

    for (XSLFSlide slide : slides) {

        // One document per slide
        ParserDocument result = getNewParserDocument();

        XSLFNotes notes = slide.getNotes();
        XSLFComments comments = slide.getComments();
        XSLFSlideLayout layout = slide.getSlideLayout();
        XSLFSlideMaster master = layout.getSlideMaster();

        // TODO Do the slide's name
        // (Stored in docProps/app.xml)

        // Do the slide's text
        result.add(SLIDES, extractText(slide.getCommonSlideData(), false));
        result.add(LANG_DETECTION, languageDetection(SLIDES, 10000));

        // If requested, get text from the master and it's layout
        if (layout != null) {
            result.add(MASTER, extractText(layout.getCommonSlideData(), true));
        }
        if (master != null) {
            result.add(MASTER, extractText(master.getCommonSlideData(), true));
        }

        // If the slide has comments, do those too
        if (comments != null) {
            for (CTComment comment : comments.getCTCommentsList().getCmList()) {
                StringBuilder sbComment = new StringBuilder();
                // Do the author if we can
                if (commentAuthors != null) {
                    CTCommentAuthor author = commentAuthors.getAuthorById(comment.getAuthorId());
                    if (author != null) {
                        sbComment.append(author.getName());
                        sbComment.append(": ");
                    }
                }

                // Then the comment text, with a new line afterwards
                sbComment.append(comment.getText());
                sbComment.append("\n");
                if (sbComment.length() > 0)
                    result.add(COMMENTS, sbComment.toString());
            }
        }

        // Do the notes if requested
        if (notes != null) {
            result.add(NOTES, extractText(notes.getCommonSlideData(), false));
        }
    }
}

From source file:com.qwazr.library.poi.PptxParser.java

License:Apache License

/**
 * Declined from XSLFPowerPointExtractor.java
 *
 * @param slideshow/*from w w  w .  j  a  v  a2s .co m*/
 * @param resultBuilder
 */
private void extractSides(final XMLSlideShow slideshow, final ParserResultBuilder resultBuilder) {

    final List<XSLFSlide> slides = slideshow.getSlides();
    final XSLFCommentAuthors commentAuthors = slideshow.getCommentAuthors();

    for (XSLFSlide slide : slides) {

        // One document per slide
        final ParserFieldsBuilder result = resultBuilder.newDocument();

        final XSLFNotes notes = slide.getNotes();
        final XSLFComments comments = slide.getComments();
        final XSLFSlideLayout layout = slide.getSlideLayout();
        final XSLFSlideMaster master = layout.getSlideMaster();

        // TODO Do the slide's name
        // (Stored in docProps/app.xml)

        // Do the slide's text
        final String slideText = extractText(slide.getCommonSlideData(), false);
        result.add(SLIDES, slideText);
        result.add(CONTENT, slideText);

        // If requested, get text from the master and it's layout
        if (layout != null) {
            final String text = extractText(layout.getCommonSlideData(), true);
            result.add(MASTER, text);
            result.add(CONTENT, text);
        }
        if (master != null) {
            final String text = extractText(master.getCommonSlideData(), true);
            result.add(MASTER, text);
            result.add(CONTENT, text);
        }

        // If the slide has comments, do those too
        if (comments != null) {
            for (CTComment comment : comments.getCTCommentsList().getCmList()) {
                final StringBuilder sbComment = new StringBuilder();
                // Do the author if we can
                if (commentAuthors != null) {
                    CTCommentAuthor author = commentAuthors.getAuthorById(comment.getAuthorId());
                    if (author != null) {
                        sbComment.append(author.getName());
                        sbComment.append(": ");
                    }
                }

                // Then the comment text, with a new line afterwards
                sbComment.append(comment.getText());
                sbComment.append("\n");
                if (sbComment.length() > 0) {
                    final String text = sbComment.toString();
                    result.add(COMMENTS, text);
                    result.add(CONTENT, text);
                }
            }
        }

        // Do the notes if requested
        if (notes != null) {
            final String text = extractText(notes.getCommonSlideData(), false);
            result.add(NOTES, text);
            result.add(CONTENT, text);
        }

        result.add(LANG_DETECTION, languageDetection(result, CONTENT, 10000));

    }
}