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);
}
Aggregations