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.

HSLFNotes.java 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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.hslf.usermodel;
  16. import java.util.ArrayList;
  17. import java.util.List;
  18. import org.apache.poi.sl.usermodel.Notes;
  19. import org.apache.poi.util.POILogFactory;
  20. import org.apache.poi.util.POILogger;
  21. /**
  22. * This class represents a slide's notes in a PowerPoint Document. It
  23. * allows access to the text within, and the layout. For now, it only
  24. * does the text side of things though
  25. *
  26. * @author Nick Burch
  27. */
  28. public final class HSLFNotes extends HSLFSheet implements Notes<HSLFShape, HSLFSlideShow> {
  29. protected static POILogger logger = POILogFactory.getLogger(HSLFNotes.class);
  30. private List<List<HSLFTextParagraph>> _paragraphs = new ArrayList<List<HSLFTextParagraph>>();
  31. /**
  32. * Constructs a Notes Sheet from the given Notes record.
  33. * Initialises TextRuns, to provide easier access to the text
  34. *
  35. * @param notes the Notes record to read from
  36. */
  37. public HSLFNotes(org.apache.poi.hslf.record.Notes notes) {
  38. super(notes, notes.getNotesAtom().getSlideID());
  39. // Now, build up TextRuns from pairs of TextHeaderAtom and
  40. // one of TextBytesAtom or TextCharsAtom, found inside
  41. // EscherTextboxWrapper's in the PPDrawing
  42. for (List<HSLFTextParagraph> l : HSLFTextParagraph.findTextParagraphs(getPPDrawing(), this)) {
  43. if (!_paragraphs.contains(l)) _paragraphs.add(l);
  44. }
  45. if (_paragraphs.isEmpty()) {
  46. logger.log(POILogger.WARN, "No text records found for notes sheet");
  47. }
  48. // Set the sheet on each TextRun
  49. for (List<HSLFTextParagraph> ltp : _paragraphs) {
  50. for (HSLFTextParagraph tp : ltp) {
  51. tp.supplySheet(this);
  52. }
  53. }
  54. }
  55. /**
  56. * Returns an array of all the TextParagraphs found
  57. */
  58. @Override
  59. public List<List<HSLFTextParagraph>> getTextParagraphs() {
  60. return _paragraphs;
  61. }
  62. /**
  63. * Return <code>null</code> - Notes Masters are not yet supported
  64. */
  65. public HSLFMasterSheet getMasterSheet() {
  66. return null;
  67. }
  68. }