You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

XMLSlideShow.java 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. /* ====================================================================
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi.xslf.usermodel;
  16. import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
  17. import java.awt.Dimension;
  18. import java.io.File;
  19. import java.io.FileInputStream;
  20. import java.io.IOException;
  21. import java.io.InputStream;
  22. import java.io.OutputStream;
  23. import java.util.ArrayList;
  24. import java.util.Arrays;
  25. import java.util.Collections;
  26. import java.util.HashMap;
  27. import java.util.List;
  28. import java.util.Map;
  29. import java.util.regex.Pattern;
  30. import org.apache.poi.POIXMLDocument;
  31. import org.apache.poi.POIXMLDocumentPart;
  32. import org.apache.poi.POIXMLException;
  33. import org.apache.poi.POIXMLPropertiesTextExtractor;
  34. import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
  35. import org.apache.poi.openxml4j.opc.OPCPackage;
  36. import org.apache.poi.openxml4j.opc.PackagePart;
  37. import org.apache.poi.sl.usermodel.MasterSheet;
  38. import org.apache.poi.sl.usermodel.PictureData.PictureType;
  39. import org.apache.poi.sl.usermodel.Resources;
  40. import org.apache.poi.sl.usermodel.SlideShow;
  41. import org.apache.poi.util.Beta;
  42. import org.apache.poi.util.IOUtils;
  43. import org.apache.poi.util.Internal;
  44. import org.apache.poi.util.LittleEndian;
  45. import org.apache.poi.util.LittleEndianConsts;
  46. import org.apache.poi.util.POILogFactory;
  47. import org.apache.poi.util.POILogger;
  48. import org.apache.poi.util.PackageHelper;
  49. import org.apache.poi.util.Units;
  50. import org.apache.xmlbeans.XmlException;
  51. import org.apache.xmlbeans.XmlObject;
  52. import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties;
  53. import org.openxmlformats.schemas.presentationml.x2006.main.CTNotesMasterIdList;
  54. import org.openxmlformats.schemas.presentationml.x2006.main.CTNotesMasterIdListEntry;
  55. import org.openxmlformats.schemas.presentationml.x2006.main.CTPresentation;
  56. import org.openxmlformats.schemas.presentationml.x2006.main.CTSlideIdList;
  57. import org.openxmlformats.schemas.presentationml.x2006.main.CTSlideIdListEntry;
  58. import org.openxmlformats.schemas.presentationml.x2006.main.CTSlideMasterIdListEntry;
  59. import org.openxmlformats.schemas.presentationml.x2006.main.CTSlideSize;
  60. import org.openxmlformats.schemas.presentationml.x2006.main.PresentationDocument;
  61. /**
  62. * High level representation of a ooxml slideshow.
  63. * This is the first object most users will construct whether
  64. * they are reading or writing a slideshow. It is also the
  65. * top level object for creating new slides/etc.
  66. */
  67. @Beta
  68. public class XMLSlideShow extends POIXMLDocument
  69. implements SlideShow<XSLFShape, XSLFTextParagraph> {
  70. private static final POILogger LOG = POILogFactory.getLogger(XMLSlideShow.class);
  71. //arbitrarily selected; may need to increase
  72. private static final int MAX_RECORD_LENGTH = 1_000_000;
  73. private CTPresentation _presentation;
  74. private List<XSLFSlide> _slides;
  75. private List<XSLFSlideMaster> _masters;
  76. private List<XSLFPictureData> _pictures;
  77. private List<XSLFChart> _charts;
  78. private XSLFTableStyles _tableStyles;
  79. private XSLFNotesMaster _notesMaster;
  80. private XSLFCommentAuthors _commentAuthors;
  81. public XMLSlideShow() {
  82. this(empty());
  83. }
  84. public XMLSlideShow(OPCPackage pkg) {
  85. super(pkg);
  86. try {
  87. if (getCorePart().getContentType().equals(XSLFRelation.THEME_MANAGER.getContentType())) {
  88. rebase(getPackage());
  89. }
  90. //build a tree of POIXMLDocumentParts, this presentation being the root
  91. load(XSLFFactory.getInstance());
  92. } catch (Exception e) {
  93. throw new POIXMLException(e);
  94. }
  95. }
  96. public XMLSlideShow(InputStream is) throws IOException {
  97. this(PackageHelper.open(is));
  98. }
  99. static OPCPackage empty() {
  100. InputStream is = XMLSlideShow.class.getResourceAsStream("empty.pptx");
  101. if (is == null) {
  102. throw new POIXMLException("Missing resource 'empty.pptx'");
  103. }
  104. try {
  105. return OPCPackage.open(is);
  106. } catch (Exception e) {
  107. throw new POIXMLException(e);
  108. } finally {
  109. IOUtils.closeQuietly(is);
  110. }
  111. }
  112. @Override
  113. protected void onDocumentRead() throws IOException {
  114. try {
  115. PresentationDocument doc =
  116. PresentationDocument.Factory.parse(getCorePart().getInputStream(), DEFAULT_XML_OPTIONS);
  117. _presentation = doc.getPresentation();
  118. Map<String, XSLFSlideMaster> masterMap = new HashMap<>();
  119. Map<String, XSLFSlide> shIdMap = new HashMap<>();
  120. Map<String, XSLFChart> chartMap = new HashMap<>();
  121. for (RelationPart rp : getRelationParts()) {
  122. POIXMLDocumentPart p = rp.getDocumentPart();
  123. if (p instanceof XSLFSlide) {
  124. shIdMap.put(rp.getRelationship().getId(), (XSLFSlide) p);
  125. for (POIXMLDocumentPart c : p.getRelations()) {
  126. if (c instanceof XSLFChart) {
  127. chartMap.put(c.getPackagePart().getPartName().getName(), (XSLFChart) c);
  128. }
  129. }
  130. } else if (p instanceof XSLFSlideMaster) {
  131. masterMap.put(getRelationId(p), (XSLFSlideMaster) p);
  132. } else if (p instanceof XSLFTableStyles) {
  133. _tableStyles = (XSLFTableStyles) p;
  134. } else if (p instanceof XSLFNotesMaster) {
  135. _notesMaster = (XSLFNotesMaster) p;
  136. } else if (p instanceof XSLFCommentAuthors) {
  137. _commentAuthors = (XSLFCommentAuthors) p;
  138. }
  139. }
  140. _charts = new ArrayList<>(chartMap.size());
  141. for (XSLFChart chart : chartMap.values()) {
  142. _charts.add(chart);
  143. }
  144. _masters = new ArrayList<>(masterMap.size());
  145. for (CTSlideMasterIdListEntry masterId : _presentation.getSldMasterIdLst().getSldMasterIdList()) {
  146. XSLFSlideMaster master = masterMap.get(masterId.getId2());
  147. _masters.add(master);
  148. }
  149. _slides = new ArrayList<>(shIdMap.size());
  150. if (_presentation.isSetSldIdLst()) {
  151. for (CTSlideIdListEntry slId : _presentation.getSldIdLst().getSldIdList()) {
  152. XSLFSlide sh = shIdMap.get(slId.getId2());
  153. if (sh == null) {
  154. LOG.log(POILogger.WARN, "Slide with r:id " + slId.getId() + " was defined, but didn't exist in package, skipping");
  155. continue;
  156. }
  157. _slides.add(sh);
  158. }
  159. }
  160. } catch (XmlException e) {
  161. throw new POIXMLException(e);
  162. }
  163. }
  164. @Override
  165. protected void commit() throws IOException {
  166. PackagePart part = getPackagePart();
  167. OutputStream out = part.getOutputStream();
  168. _presentation.save(out, DEFAULT_XML_OPTIONS);
  169. out.close();
  170. }
  171. /**
  172. * Get the document's embedded files.
  173. */
  174. @Override
  175. public List<PackagePart> getAllEmbedds() throws OpenXML4JException {
  176. return Collections.unmodifiableList(
  177. getPackage().getPartsByName(Pattern.compile("/ppt/embeddings/.*?"))
  178. );
  179. }
  180. @Override
  181. public List<XSLFPictureData> getPictureData() {
  182. if (_pictures == null) {
  183. List<PackagePart> mediaParts = getPackage().getPartsByName(Pattern.compile("/ppt/media/.*?"));
  184. _pictures = new ArrayList<>(mediaParts.size());
  185. for (PackagePart part : mediaParts) {
  186. XSLFPictureData pd = new XSLFPictureData(part);
  187. pd.setIndex(_pictures.size());
  188. _pictures.add(pd);
  189. }
  190. }
  191. return Collections.unmodifiableList(_pictures);
  192. }
  193. /**
  194. * Create a slide and initialize it from the specified layout.
  195. *
  196. * @param layout The layout to use for the new slide.
  197. * @return created slide
  198. */
  199. public XSLFSlide createSlide(XSLFSlideLayout layout) {
  200. int slideNumber = 256, cnt = 1;
  201. CTSlideIdList slideList;
  202. XSLFRelation relationType = XSLFRelation.SLIDE;
  203. if (!_presentation.isSetSldIdLst()) {
  204. slideList = _presentation.addNewSldIdLst();
  205. } else {
  206. slideList = _presentation.getSldIdLst();
  207. for (CTSlideIdListEntry slideId : slideList.getSldIdArray()) {
  208. slideNumber = (int) Math.max(slideId.getId() + 1, slideNumber);
  209. cnt++;
  210. }
  211. cnt = findNextAvailableFileNameIndex(relationType, cnt);
  212. }
  213. RelationPart rp = createRelationship
  214. (relationType, XSLFFactory.getInstance(), cnt, false);
  215. XSLFSlide slide = rp.getDocumentPart();
  216. CTSlideIdListEntry slideId = slideList.addNewSldId();
  217. slideId.setId(slideNumber);
  218. slideId.setId2(rp.getRelationship().getId());
  219. layout.copyLayout(slide);
  220. slide.getPackagePart().clearRelationships();
  221. slide.addRelation(null, XSLFRelation.SLIDE_LAYOUT, layout);
  222. _slides.add(slide);
  223. return slide;
  224. }
  225. private int findNextAvailableFileNameIndex(XSLFRelation relationType, int idx) {
  226. // Bug 55791: We also need to check that the resulting file name is not already taken
  227. // this can happen when removing/adding slides, notes or charts
  228. while (true) {
  229. String fileName = relationType.getFileName(idx);
  230. boolean found = false;
  231. for (POIXMLDocumentPart relation : getRelations()) {
  232. if (relation.getPackagePart() != null &&
  233. fileName.equals(relation.getPackagePart().getPartName().getName())) {
  234. // name is taken => try next one
  235. found = true;
  236. break;
  237. }
  238. }
  239. if (!found &&
  240. getPackage().getPartsByName(Pattern.compile(Pattern.quote(fileName))).size() > 0) {
  241. // name is taken => try next one
  242. found = true;
  243. }
  244. if (!found) {
  245. break;
  246. }
  247. idx++;
  248. }
  249. return idx;
  250. }
  251. /**
  252. * Create a blank slide using the default (first) master.
  253. */
  254. @Override
  255. public XSLFSlide createSlide() {
  256. XSLFSlideMaster sm = _masters.get(0);
  257. XSLFSlideLayout layout = sm.getLayout(SlideLayout.BLANK);
  258. if (layout == null) {
  259. LOG.log(POILogger.WARN, "Blank layout was not found - defaulting to first slide layout in master");
  260. XSLFSlideLayout sl[] = sm.getSlideLayouts();
  261. if (sl.length == 0) {
  262. throw new POIXMLException("SlideMaster must contain a SlideLayout.");
  263. }
  264. layout = sl[0];
  265. }
  266. return createSlide(layout);
  267. }
  268. /**
  269. * Create a blank chart on the given slide.
  270. */
  271. public XSLFChart createChart(XSLFSlide slide) {
  272. int chartIdx = findNextAvailableFileNameIndex(XSLFRelation.CHART, _charts.size() + 1);
  273. XSLFChart chart = (XSLFChart) createRelationship(XSLFRelation.CHART, XSLFFactory.getInstance(), chartIdx, true).getDocumentPart();
  274. slide.addRelation(null, XSLFRelation.CHART, chart);
  275. chart.setChartIndex(chartIdx);
  276. _charts.add(chart);
  277. return chart;
  278. }
  279. /**
  280. * Return notes slide for the specified slide or create new if it does not exist yet.
  281. */
  282. public XSLFNotes getNotesSlide(XSLFSlide slide) {
  283. XSLFNotes notesSlide = slide.getNotes();
  284. if (notesSlide == null) {
  285. notesSlide = createNotesSlide(slide);
  286. }
  287. return notesSlide;
  288. }
  289. /**
  290. * Create a blank notes slide.
  291. */
  292. private XSLFNotes createNotesSlide(XSLFSlide slide) {
  293. if (_notesMaster == null) {
  294. createNotesMaster();
  295. }
  296. int slideIndex = XSLFRelation.SLIDE.getFileNameIndex(slide);
  297. XSLFRelation relationType = XSLFRelation.NOTES;
  298. slideIndex = findNextAvailableFileNameIndex(relationType, slideIndex);
  299. // add notes slide to presentation
  300. XSLFNotes notesSlide = (XSLFNotes) createRelationship
  301. (relationType, XSLFFactory.getInstance(), slideIndex);
  302. // link slide and notes slide with each other
  303. slide.addRelation(null, relationType, notesSlide);
  304. notesSlide.addRelation(null, XSLFRelation.NOTES_MASTER, _notesMaster);
  305. notesSlide.addRelation(null, XSLFRelation.SLIDE, slide);
  306. notesSlide.importContent(_notesMaster);
  307. return notesSlide;
  308. }
  309. /**
  310. * Create a notes master.
  311. */
  312. public void createNotesMaster() {
  313. RelationPart rp = createRelationship
  314. (XSLFRelation.NOTES_MASTER, XSLFFactory.getInstance(), 1, false);
  315. _notesMaster = rp.getDocumentPart();
  316. CTNotesMasterIdList notesMasterIdList = _presentation.addNewNotesMasterIdLst();
  317. CTNotesMasterIdListEntry notesMasterId = notesMasterIdList.addNewNotesMasterId();
  318. notesMasterId.setId(rp.getRelationship().getId());
  319. Integer themeIndex = 1;
  320. // TODO: check if that list can be replaced by idx = Math.max(idx,themeIdx)
  321. List<Integer> themeIndexList = new ArrayList<>();
  322. for (POIXMLDocumentPart p : getRelations()) {
  323. if (p instanceof XSLFTheme) {
  324. themeIndexList.add(XSLFRelation.THEME.getFileNameIndex(p));
  325. }
  326. }
  327. if (!themeIndexList.isEmpty()) {
  328. Boolean found = false;
  329. for (Integer i = 1; i <= themeIndexList.size(); i++) {
  330. if (!themeIndexList.contains(i)) {
  331. found = true;
  332. themeIndex = i;
  333. }
  334. }
  335. if (!found) {
  336. themeIndex = themeIndexList.size() + 1;
  337. }
  338. }
  339. XSLFTheme theme = (XSLFTheme) createRelationship
  340. (XSLFRelation.THEME, XSLFFactory.getInstance(), themeIndex);
  341. theme.importTheme(getSlides().get(0).getTheme());
  342. _notesMaster.addRelation(null, XSLFRelation.THEME, theme);
  343. }
  344. /**
  345. * Return the Notes Master, if there is one.
  346. * (May not be present if no notes exist)
  347. */
  348. public XSLFNotesMaster getNotesMaster() {
  349. return _notesMaster;
  350. }
  351. @Override
  352. public List<XSLFSlideMaster> getSlideMasters() {
  353. return _masters;
  354. }
  355. /**
  356. * Return all the slides in the slideshow
  357. */
  358. @Override
  359. public List<XSLFSlide> getSlides() {
  360. return _slides;
  361. }
  362. /**
  363. * Return all the charts in the slideshow
  364. */
  365. public List<XSLFChart> getCharts() {
  366. return _charts;
  367. }
  368. /**
  369. * Returns the list of comment authors, if there is one.
  370. * Will only be present if at least one slide has comments on it.
  371. */
  372. public XSLFCommentAuthors getCommentAuthors() {
  373. return _commentAuthors;
  374. }
  375. /**
  376. * @param newIndex 0-based index of the slide
  377. */
  378. public void setSlideOrder(XSLFSlide slide, int newIndex) {
  379. int oldIndex = _slides.indexOf(slide);
  380. if (oldIndex == -1) {
  381. throw new IllegalArgumentException("Slide not found");
  382. }
  383. if (oldIndex == newIndex) {
  384. return;
  385. }
  386. // fix the usermodel container
  387. _slides.add(newIndex, _slides.remove(oldIndex));
  388. // fix ordering in the low-level xml
  389. CTSlideIdList sldIdLst = _presentation.getSldIdLst();
  390. CTSlideIdListEntry[] entries = sldIdLst.getSldIdArray();
  391. CTSlideIdListEntry oldEntry = entries[oldIndex];
  392. if (oldIndex < newIndex) {
  393. System.arraycopy(entries, oldIndex + 1, entries, oldIndex, newIndex - oldIndex);
  394. } else {
  395. System.arraycopy(entries, newIndex, entries, newIndex + 1, oldIndex - newIndex);
  396. }
  397. entries[newIndex] = oldEntry;
  398. sldIdLst.setSldIdArray(entries);
  399. }
  400. public XSLFSlide removeSlide(int index) {
  401. XSLFSlide slide = _slides.remove(index);
  402. removeRelation(slide);
  403. _presentation.getSldIdLst().removeSldId(index);
  404. for (POIXMLDocumentPart p : slide.getRelations()) {
  405. if (p instanceof XSLFChart) {
  406. XSLFChart chart = (XSLFChart) p;
  407. slide.removeChartRelation(chart);
  408. _charts.remove(chart);
  409. } else if (p instanceof XSLFSlideLayout) {
  410. XSLFSlideLayout layout = (XSLFSlideLayout) p;
  411. slide.removeLayoutRelation(layout);
  412. }
  413. }
  414. return slide;
  415. }
  416. @Override
  417. public Dimension getPageSize() {
  418. CTSlideSize sz = _presentation.getSldSz();
  419. int cx = sz.getCx();
  420. int cy = sz.getCy();
  421. return new Dimension((int) Units.toPoints(cx), (int) Units.toPoints(cy));
  422. }
  423. @Override
  424. public void setPageSize(Dimension pgSize) {
  425. CTSlideSize sz = CTSlideSize.Factory.newInstance();
  426. sz.setCx(Units.toEMU(pgSize.getWidth()));
  427. sz.setCy(Units.toEMU(pgSize.getHeight()));
  428. _presentation.setSldSz(sz);
  429. }
  430. @Internal
  431. public CTPresentation getCTPresentation() {
  432. return _presentation;
  433. }
  434. /**
  435. * Adds a picture to the workbook.
  436. *
  437. * @param pictureData The bytes of the picture
  438. * @param format The format of the picture.
  439. * @return the picture data
  440. */
  441. @Override
  442. public XSLFPictureData addPicture(byte[] pictureData, PictureType format) {
  443. XSLFPictureData img = findPictureData(pictureData);
  444. if (img != null) {
  445. return img;
  446. }
  447. int imageNumber = _pictures.size();
  448. XSLFRelation relType = XSLFPictureData.getRelationForType(format);
  449. if (relType == null) {
  450. throw new IllegalArgumentException("Picture type " + format + " is not supported.");
  451. }
  452. img = createRelationship(relType, XSLFFactory.getInstance(), imageNumber + 1, true).getDocumentPart();
  453. img.setIndex(imageNumber);
  454. _pictures.add(img);
  455. try (OutputStream out = img.getPackagePart().getOutputStream()) {
  456. out.write(pictureData);
  457. } catch (IOException e) {
  458. throw new POIXMLException(e);
  459. }
  460. return img;
  461. }
  462. /**
  463. * Adds a picture to the slideshow.
  464. *
  465. * @param is The stream to read image from
  466. * @param format The format of the picture
  467. * @return the picture data
  468. * @since 3.15 beta 2
  469. */
  470. @Override
  471. public XSLFPictureData addPicture(InputStream is, PictureType format) throws IOException {
  472. return addPicture(IOUtils.toByteArray(is), format);
  473. }
  474. /**
  475. * Adds a picture to the presentation.
  476. *
  477. * @param pict The file containing the image to add
  478. * @param format The format of the picture.
  479. * @return the picture data
  480. * @since 3.15 beta 2
  481. */
  482. @Override
  483. public XSLFPictureData addPicture(File pict, PictureType format) throws IOException {
  484. int length = (int) pict.length();
  485. byte[] data = IOUtils.safelyAllocate(length, MAX_RECORD_LENGTH);
  486. try (InputStream is = new FileInputStream(pict)) {
  487. IOUtils.readFully(is, data);
  488. }
  489. return addPicture(data, format);
  490. }
  491. /**
  492. * check if a picture with this picture data already exists in this presentation
  493. *
  494. * @param pictureData The picture data to find in the SlideShow
  495. * @return {@code null} if picture data is not found in this slideshow
  496. * @since 3.15 beta 2
  497. */
  498. @Override
  499. public XSLFPictureData findPictureData(byte[] pictureData) {
  500. long checksum = IOUtils.calculateChecksum(pictureData);
  501. byte cs[] = new byte[LittleEndianConsts.LONG_SIZE];
  502. LittleEndian.putLong(cs, 0, checksum);
  503. for (XSLFPictureData pic : getPictureData()) {
  504. if (Arrays.equals(pic.getChecksum(), cs)) {
  505. return pic;
  506. }
  507. }
  508. return null;
  509. }
  510. /**
  511. * Scan the master slides for the first slide layout with the given name.
  512. *
  513. * @param name The layout name (case-insensitive). Cannot be null.
  514. * @return the first layout found or null on failure
  515. */
  516. public XSLFSlideLayout findLayout(String name) {
  517. for (XSLFSlideMaster master : getSlideMasters()) {
  518. XSLFSlideLayout layout = master.getLayout(name);
  519. if (layout != null) {
  520. return layout;
  521. }
  522. }
  523. return null;
  524. }
  525. public XSLFTableStyles getTableStyles() {
  526. return _tableStyles;
  527. }
  528. CTTextParagraphProperties getDefaultParagraphStyle(int level) {
  529. XmlObject[] o = _presentation.selectPath(
  530. "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' " +
  531. "declare namespace a='http://schemas.openxmlformats.org/drawingml/2006/main' " +
  532. ".//p:defaultTextStyle/a:lvl" + (level + 1) + "pPr");
  533. if (o.length == 1) {
  534. return (CTTextParagraphProperties) o[0];
  535. }
  536. return null;
  537. }
  538. @Override
  539. public MasterSheet<XSLFShape, XSLFTextParagraph> createMasterSheet() throws IOException {
  540. // TODO: implement!
  541. throw new UnsupportedOperationException();
  542. }
  543. @Override
  544. public Resources getResources() {
  545. // TODO: implement!
  546. throw new UnsupportedOperationException();
  547. }
  548. @Override
  549. public POIXMLPropertiesTextExtractor getMetadataTextExtractor() {
  550. return new POIXMLPropertiesTextExtractor(this);
  551. }
  552. }