aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/java/org/apache/poi/xslf/extractor
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2011-09-21 16:54:22 +0000
committerNick Burch <nick@apache.org>2011-09-21 16:54:22 +0000
commitd12375b4c0e45d2010251ef0bf07ffdd6d74b1ea (patch)
tree48c77ce9127bd46ceee2fea165059af7ce6544b6 /src/ooxml/java/org/apache/poi/xslf/extractor
parent3f43242f1a483845c17a217cd3c2b0faf3e5e6a0 (diff)
downloadpoi-d12375b4c0e45d2010251ef0bf07ffdd6d74b1ea.tar.gz
poi-d12375b4c0e45d2010251ef0bf07ffdd6d74b1ea.zip
Update the XSLF slide master text extraction to be optional, as HSLF already is, plus fix some indents
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1173756 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java/org/apache/poi/xslf/extractor')
-rw-r--r--src/ooxml/java/org/apache/poi/xslf/extractor/XSLFPowerPointExtractor.java22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/ooxml/java/org/apache/poi/xslf/extractor/XSLFPowerPointExtractor.java b/src/ooxml/java/org/apache/poi/xslf/extractor/XSLFPowerPointExtractor.java
index 930d16142c..9563f664a2 100644
--- a/src/ooxml/java/org/apache/poi/xslf/extractor/XSLFPowerPointExtractor.java
+++ b/src/ooxml/java/org/apache/poi/xslf/extractor/XSLFPowerPointExtractor.java
@@ -45,6 +45,7 @@ public class XSLFPowerPointExtractor extends POIXMLTextExtractor {
private XMLSlideShow slideshow;
private boolean slidesByDefault = true;
private boolean notesByDefault = false;
+ private boolean masterByDefault = false;
public XSLFPowerPointExtractor(XMLSlideShow slideshow) {
super(slideshow);
@@ -84,6 +85,13 @@ public class XSLFPowerPointExtractor extends POIXMLTextExtractor {
this.notesByDefault = notesByDefault;
}
+ /**
+ * Should a call to getText() return text from master? Default is no
+ */
+ public void setMasterByDefault(boolean masterByDefault) {
+ this.masterByDefault = masterByDefault;
+ }
+
/**
* Gets the slide text, but not the notes text
*/
@@ -97,6 +105,16 @@ public class XSLFPowerPointExtractor extends POIXMLTextExtractor {
* @param notesText Should we retrieve text from notes?
*/
public String getText(boolean slideText, boolean notesText) {
+ return getText(slideText, notesText, masterByDefault);
+ }
+
+ /**
+ * Gets the requested text from the file
+ * @param slideText Should we retrieve text from slides?
+ * @param notesText Should we retrieve text from notes?
+ * @param masterText Should we retrieve text from master slides?
+ */
+ public String getText(boolean slideText, boolean notesText, boolean masterText) {
StringBuffer text = new StringBuffer();
XSLFSlide[] slides = slideshow.getSlides();
@@ -115,8 +133,8 @@ public class XSLFPowerPointExtractor extends POIXMLTextExtractor {
if (slideText) {
extractText(slide.getCommonSlideData(), text);
- // If there's a master sheet, grab text from there
- if(master != null) {
+ // If there's a master sheet and it's requested, grab text from there
+ if(masterText && master != null) {
extractText(master.getCommonSlideData(), text);
}