From c6ad45cdf80b5e78a86535a0226c95210744d497 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Sun, 26 Jun 2005 19:03:48 +0000 Subject: [PATCH] The usermodel code is now responsible for filtering out duplicate SlideAtomSets, so update to no longer check for them Add the ability to get at the Slide record that this is based on git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353732 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/apache/poi/hslf/model/Slide.java | 70 +++++++++++-------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java b/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java index 0cedae012..7657528a0 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java @@ -38,20 +38,21 @@ public class Slide extends Sheet private int _sheetNo; private org.apache.poi.hslf.record.Slide _slide; - private SlideAtomsSet[] _atomSet; + private SlideAtomsSet _atomSet; private TextRun[] _runs; private TextRun[] _otherRuns; // Any from the PPDrawing, shouldn't really be any though - private Notes _notes; + private Notes _notes; // usermodel needs to set this /** - * Constructs a Slide from the Slide record, and the SlideAtomsSets - * for ones not embeded in the PPDrawing. + * Constructs a Slide from the Slide record, and the SlideAtomsSet + * containing the text. * Initialises TextRuns, to provide easier access to the text * * @param slide the Slide record we're based on + * @param notes the Notes sheet attached to us * @param atomSet the SlideAtomsSet to get the text from */ - public Slide(org.apache.poi.hslf.record.Slide slide, Notes notes, SlideAtomsSet[] atomSet) { + public Slide(org.apache.poi.hslf.record.Slide slide, Notes notes, SlideAtomsSet atomSet) { _slide = slide; _notes = notes; _atomSet = atomSet; @@ -63,38 +64,40 @@ public class Slide extends Sheet // Grab the TextRuns from the PPDrawing _otherRuns = findTextRuns(_slide.getPPDrawing()); - - // Ensure we've only got only copy of each SlideAtomSet - // When in doubt, prefere the later one - Hashtable seenSets = new Hashtable(); - Vector useSets = new Vector(); - for(int i=0; i<_atomSet.length; i++) { - SlideAtomsSet set = _atomSet[i]; - int id = set.getSlidePersistAtom().getRefID(); - Integer idI = new Integer(id); - if(seenSets.containsKey(idI)) { - // Replace old one - Integer replacePos = (Integer)seenSets.get(idI); - useSets.set(replacePos.intValue(),set); - } else { - // Use for now - useSets.add(set); - seenSets.put(idI,new Integer(useSets.size()-1)); - } - } - // For the text coming in from the SlideAtomsSet: // Build up TextRuns from pairs of TextHeaderAtom and // one of TextBytesAtom or TextCharsAtom - Vector runSets = new Vector(); - for(int i=0; i