您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

HSLFNotes.java 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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,HSLFTextParagraph> {
  29. protected static final 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. }
  49. /**
  50. * Returns an array of all the TextParagraphs found
  51. */
  52. @Override
  53. public List<List<HSLFTextParagraph>> getTextParagraphs() {
  54. return _paragraphs;
  55. }
  56. /**
  57. * Return <code>null</code> - Notes Masters are not yet supported
  58. */
  59. public HSLFMasterSheet getMasterSheet() {
  60. return null;
  61. }
  62. }