Search in sources :

Example 1 with CTNotesMasterIdList

use of org.openxmlformats.schemas.presentationml.x2006.main.CTNotesMasterIdList in project poi by apache.

the class XMLSlideShow method createNotesMaster.

/**
     * Create a notes master.
     */
public void createNotesMaster() {
    RelationPart rp = createRelationship(XSLFRelation.NOTES_MASTER, XSLFFactory.getInstance(), 1, false);
    _notesMaster = rp.getDocumentPart();
    CTNotesMasterIdList notesMasterIdList = _presentation.addNewNotesMasterIdLst();
    CTNotesMasterIdListEntry notesMasterId = notesMasterIdList.addNewNotesMasterId();
    notesMasterId.setId(rp.getRelationship().getId());
    Integer themeIndex = 1;
    // TODO: check if that list can be replaced by idx = Math.max(idx,themeIdx)
    List<Integer> themeIndexList = new ArrayList<Integer>();
    for (POIXMLDocumentPart p : getRelations()) {
        if (p instanceof XSLFTheme) {
            themeIndexList.add(XSLFRelation.THEME.getFileNameIndex(p));
        }
    }
    if (!themeIndexList.isEmpty()) {
        Boolean found = false;
        for (Integer i = 1; i <= themeIndexList.size(); i++) {
            if (!themeIndexList.contains(i)) {
                found = true;
                themeIndex = i;
            }
        }
        if (!found) {
            themeIndex = themeIndexList.size() + 1;
        }
    }
    XSLFTheme theme = (XSLFTheme) createRelationship(XSLFRelation.THEME, XSLFFactory.getInstance(), themeIndex);
    theme.importTheme(getSlides().get(0).getTheme());
    _notesMaster.addRelation(null, XSLFRelation.THEME, theme);
}
Also used : CTNotesMasterIdList(org.openxmlformats.schemas.presentationml.x2006.main.CTNotesMasterIdList) CTNotesMasterIdListEntry(org.openxmlformats.schemas.presentationml.x2006.main.CTNotesMasterIdListEntry) POIXMLDocumentPart(org.apache.poi.POIXMLDocumentPart) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 POIXMLDocumentPart (org.apache.poi.POIXMLDocumentPart)1 CTNotesMasterIdList (org.openxmlformats.schemas.presentationml.x2006.main.CTNotesMasterIdList)1 CTNotesMasterIdListEntry (org.openxmlformats.schemas.presentationml.x2006.main.CTNotesMasterIdListEntry)1