Exemple #1
0
  /**
   * Create a slide and initialize it from the specified layout.
   *
   * @param layout
   * @return created slide
   */
  @SuppressWarnings("deprecation")
  public XSLFSlide createSlide(XSLFSlideLayout layout) {
    int slideNumber = 256, cnt = 1;
    CTSlideIdList slideList;
    if (!_presentation.isSetSldIdLst()) slideList = _presentation.addNewSldIdLst();
    else {
      slideList = _presentation.getSldIdLst();
      for (CTSlideIdListEntry slideId : slideList.getSldIdArray()) {
        slideNumber = (int) Math.max(slideId.getId() + 1, slideNumber);
        cnt++;
      }
    }

    XSLFSlide slide =
        (XSLFSlide) createRelationship(XSLFRelation.SLIDE, XSLFFactory.getInstance(), cnt);

    CTSlideIdListEntry slideId = slideList.addNewSldId();
    slideId.setId(slideNumber);
    slideId.setId2(slide.getPackageRelationship().getId());

    layout.copyLayout(slide);
    slide.addRelation(layout.getPackageRelationship().getId(), layout);

    PackagePartName ppName = layout.getPackagePart().getPartName();
    slide
        .getPackagePart()
        .addRelationship(
            ppName, TargetMode.INTERNAL, layout.getPackageRelationship().getRelationshipType());

    _slides.add(slide);
    return slide;
  }
Exemple #2
0
  /** Return notes slide for the specified slide or create new if it does not exist yet. */
  public XSLFNotes getNotesSlide(XSLFSlide slide) {

    XSLFNotes notesSlide = slide.getNotes();
    if (notesSlide == null) {
      notesSlide = createNotesSlide(slide);
    }

    return notesSlide;
  }
Exemple #3
0
  /** Create a blank notes slide. */
  private XSLFNotes createNotesSlide(XSLFSlide slide) {

    if (_notesMaster == null) {
      createNotesMaster();
    }

    Integer slideIndex = XSLFRelation.SLIDE.getFileNameIndex(slide);

    XSLFNotes notesSlide =
        (XSLFNotes) createRelationship(XSLFRelation.NOTES, XSLFFactory.getInstance(), slideIndex);

    notesSlide.addRelation(_notesMaster.getPackageRelationship().getId(), _notesMaster);
    PackagePartName notesMasterPackagePartName = _notesMaster.getPackagePart().getPartName();
    notesSlide
        .getPackagePart()
        .addRelationship(
            notesMasterPackagePartName,
            TargetMode.INTERNAL,
            _notesMaster.getPackageRelationship().getRelationshipType());

    slide.addRelation(notesSlide.getPackageRelationship().getId(), notesSlide);
    PackagePartName notesSlidesPackagePartName = notesSlide.getPackagePart().getPartName();
    slide
        .getPackagePart()
        .addRelationship(
            notesSlidesPackagePartName,
            TargetMode.INTERNAL,
            notesSlide.getPackageRelationship().getRelationshipType());

    notesSlide.addRelation(slide.getPackageRelationship().getId(), slide);
    PackagePartName slidesPackagePartName = slide.getPackagePart().getPartName();
    notesSlide
        .getPackagePart()
        .addRelationship(
            slidesPackagePartName,
            TargetMode.INTERNAL,
            slide.getPackageRelationship().getRelationshipType());

    notesSlide.importContent(_notesMaster);

    return notesSlide;
  }