From: Nick Burch Date: Sun, 19 Mar 2006 18:09:20 +0000 (+0000) Subject: Fix for adding slides to sheets which already have some - get the SlidePersistAtom... X-Git-Tag: REL_3_0_ALPHA3~154 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=349e75e3bfdac4c48a1b5bc312834be3c71b603e;p=poi.git Fix for adding slides to sheets which already have some - get the SlidePersistAtom correctly git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@387010 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java index c47294495a..a114ee91f9 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java @@ -399,10 +399,14 @@ public class SlideShow _documentRecord.addChildBefore(slist, endDoc); } - Record[] rec = slist.getChildRecords(); - - // Add SlidePersistAtom - SlidePersistAtom prev = rec.length == 0 ? null : (SlidePersistAtom)rec[rec.length - 1]; + // Grab the last SlidePersistAtom, if there was one + SlidePersistAtom prev = null; + SlideAtomsSet[] sas = slist.getSlideAtomsSets(); + if(sas != null && sas.length > 0) { + prev = sas[sas.length - 1].getSlidePersistAtom(); + } + + // Add a new SlidePersistAtom SlidePersistAtom sp = new SlidePersistAtom(); // Refernce is the 1-based index of the slide container in @@ -413,6 +417,7 @@ public class SlideShow // First slideId is always 256 sp.setSlideIdentifier(prev == null ? 256 : (prev.getSlideIdentifier() + 1)); + // Add this new SlidePersistAtom to the SlideListWithText slist.appendChildRecord(sp); // Create a new Slide