private void writeDirtyParagraphs(HSLFShapeContainer container) { for (HSLFShape sh : container.getShapes()) { if (sh instanceof HSLFShapeContainer) { writeDirtyParagraphs((HSLFShapeContainer)sh); } else if (sh instanceof HSLFTextShape) { HSLFTextShape hts = (HSLFTextShape)sh; boolean isDirty = false; for (HSLFTextParagraph p : hts.getTextParagraphs()) { isDirty |= p.isDirty(); } if (isDirty) { hts.storeText(); } } } }
@Override public void write(OutputStream out) throws IOException { // check for text paragraph modifications for (HSLFSlide sl : getSlides()) { writeDirtyParagraphs(sl); } for (HSLFSlideMaster sl : getSlideMasters()) { boolean isDirty = false; for (List<HSLFTextParagraph> paras : sl.getTextParagraphs()) { for (HSLFTextParagraph p : paras) { isDirty |= p.isDirty(); } } if (isDirty) { for (TxMasterStyleAtom sa : sl.getTxMasterStyleAtoms()) { if (sa != null) { // not all master style atoms are set - index 3 is typically null sa.updateStyles(); } } } } _hslfSlideShow.write(out); }