From 0d880ef000366230d6f9e1f69256a2e3bfb40fd2 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Thu, 14 Dec 2006 11:50:54 +0000 Subject: [PATCH] Try to work with files that don't have a master SlideListWithText, but go straight into a Slides one. Throw a better exception on slides with a mixed first SlideListWithText (see bug 41176 for more details) git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@487182 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/hslf/usermodel/SlideShow.java | 48 ++++++++++++++++--- 1 file changed, 42 insertions(+), 6 deletions(-) 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 0e91cc7ebf..6068d7f65d 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java @@ -304,23 +304,59 @@ public class SlideShow // we have to go and find their matching records // We always use the latest versions of these records, and use the // SlideAtom/NotesAtom to match them with the StyleAtomSet + // + // Some crazy documents don't have a master SlideListWithText, their + // first one is the slide containing one, which makes things fun... SlideListWithText masterSLWT = _documentRecord.getMasterSlideListWithText(); SlideListWithText slidesSLWT = _documentRecord.getSlideSlideListWithText(); SlideListWithText notesSLWT = _documentRecord.getNotesSlideListWithText(); - //find master slides + // Find master slides + // Need to ensure they're really master slides, and we're not dealing + // with a crazy document that doesn't have any master slides SlideAtomsSet[] masterSets = new SlideAtomsSet[0]; org.apache.poi.hslf.record.MainMaster[] masterRecords = null; if (masterSLWT != null){ - masterSets = masterSLWT.getSlideAtomsSets(); - masterRecords = new org.apache.poi.hslf.record.MainMaster[masterSets.length]; - for(int i=0; i 0 && masterCount == 0) { + // Actually the Slide SlideListWithTexts + notesSLWT = slidesSLWT; + slidesSLWT = masterSLWT; + masterSLWT = null; + } else if(masterCount >= 0 && slideCount == 0) { + // Is a normal, proper Masters SlideListWithTexts + masterRecords = new org.apache.poi.hslf.record.MainMaster[masterSets.length]; + + // Grab the Main Master records + for(int i=0; i