textRunsToText(xhtml, notes.getTextParagraphs());
interface Slide<SS extends SlideShow> { Notes<SS> getNotes(); void setNotes(Notes<SS> n); } class HSLFSlide implements Slide<HSLFSlideShow> { Notes<HSLFSlideShow> notes = new HSLFNotes(); @Override public Notes<HSLFSlideShow> getNotes() { return notes; } @Override public void setNotes(Notes<HSLFSlideShow> n) { notes = n; } }
xhtml.startElement("div", "class", "slide-notes"); textRunsToText(xhtml, notes.getTextParagraphs()); continue; Integer id = notes._getSheetNumber(); if (seenNotes.contains(id)) { continue; textRunsToText(xhtml, notes.getTextParagraphs());
slideIdToNotes.put(slideId, idx); HSLFNotes hn = new HSLFNotes(notesRecord); hn.setSlideShow(this); _notes.add(hn);
/** * Sets the Notes that are associated with this. Updates the * references in the records to point to the new ID */ @Override public void setNotes(Notes<HSLFShape,HSLFTextParagraph> notes) { if (notes != null && !(notes instanceof HSLFNotes)) { throw new IllegalArgumentException("notes needs to be of type HSLFNotes"); } _notes = (HSLFNotes)notes; // Update the Slide Atom's ID of where to point to SlideAtom sa = getSlideRecord().getSlideAtom(); if(_notes == null) { // Set to 0 sa.setNotesID(0); } else { // Set to the value from the notes' sheet id sa.setNotesID(_notes._getSheetNumber()); } }
/** * Constructs a Notes Sheet from the given Notes record. * Initialises TextRuns, to provide easier access to the text * * @param notes the Notes record to read from */ public HSLFNotes(org.apache.poi.hslf.record.Notes notes) { super(notes, notes.getNotesAtom().getSlideID()); // Now, build up TextRuns from pairs of TextHeaderAtom and // one of TextBytesAtom or TextCharsAtom, found inside // EscherTextboxWrapper's in the PPDrawing for (List<HSLFTextParagraph> l : HSLFTextParagraph.findTextParagraphs(getPPDrawing(), this)) { if (!_paragraphs.contains(l)) _paragraphs.add(l); } if (_paragraphs.isEmpty()) { logger.log(POILogger.WARN, "No text records found for notes sheet"); } }
private static SlideMetadata processSlide(HSLFSlideShow rawSlideShow, HSLFSlide slide) { SlideMetadata slideMetadata = new SlideMetadata(); // process title String title = slide.getTitle(); slideMetadata.setTitle(title); // process notes slideMetadata.setNotes(collectText(slide.getNotes().getTextParagraphs(), title)); // process text slideMetadata.setText(collectText(slide.getTextParagraphs(), title)); // process thumbnail Dimension pgsize = rawSlideShow.getPageSize(); BufferedImage img = new BufferedImage(pgsize.width, pgsize.height, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = img.createGraphics(); // clear the drawing area graphics.setPaint(Color.white); graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height)); // render slide.draw(graphics); try { ByteArrayOutputStream out = new ByteArrayOutputStream(); javax.imageio.ImageIO.write(img, "png", out); slideMetadata.setThumbnail(out.toByteArray()); } catch (IOException e) { throw new RuntimeException(e); } return slideMetadata; }
interface Slide<N extends Notes<?>> { N getNotes(); void setNotes(N n); } class HSLFSlide implements Slide<HSLFNotes> { HSLFNotes notes = new HSLFNotes(); @Override public HSLFNotes getNotes() { return notes; } @Override public void setNotes(HSLFNotes n) { notes = n; } }
private static SlideMetadata processSlide(HSLFSlideShow rawSlideShow, HSLFSlide slide) { SlideMetadata slideMetadata = new SlideMetadata(); // process title String title = slide.getTitle(); slideMetadata.setTitle(title); // process notes slideMetadata.setNotes(collectText(slide.getNotes().getTextParagraphs(), title)); // process text slideMetadata.setText(collectText(slide.getTextParagraphs(), title)); // process thumbnail Dimension pgsize = rawSlideShow.getPageSize(); BufferedImage img = new BufferedImage(pgsize.width, pgsize.height, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = img.createGraphics(); // clear the drawing area graphics.setPaint(Color.white); graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height)); // render slide.draw(graphics); try { ByteArrayOutputStream out = new ByteArrayOutputStream(); javax.imageio.ImageIO.write(img, "png", out); slideMetadata.setThumbnail(out.toByteArray()); } catch (IOException e) { throw new RuntimeException(e); } return slideMetadata; }
textRunsToText(xhtml, notes.getTextParagraphs());