From 7175573d2fb8ba9bcbbdec66091139e94ca26fce Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Tue, 27 Jun 2006 18:15:32 +0000 Subject: [PATCH] Hopefully fix bug 39228 - big overhaul of how slides and notes are build, based on Yegor's discoveries. Hopefully, we now return the right slide #, and in the right order git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@417541 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/apache/poi/hslf/model/Sheet.java | 13 +- .../org/apache/poi/hslf/model/TextRun.java | 15 + .../apache/poi/hslf/usermodel/SlideShow.java | 258 +++++++----------- .../poi/hslf/usermodel/TestSlideOrdering.java | 88 ++++++ 4 files changed, 218 insertions(+), 156 deletions(-) create mode 100644 src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSlideOrdering.java diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java b/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java index 334208987..57efcb0df 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java @@ -73,9 +73,18 @@ public abstract class Sheet public SlideShow getSlideShow() { return _slideShow; } /** - * Set the SlideShow we're attached to + * Set the SlideShow we're attached to. + * Also passes it on to our child RichTextRuns */ - public void setSlideShow(SlideShow ss) { _slideShow = ss; } + public void setSlideShow(SlideShow ss) { + _slideShow = ss; + TextRun[] trs = getTextRuns(); + if(trs != null) { + for(int i=0; i 0) { - // Get the SlideIdentifier of the Notes - // (Note - might not be the same as the SlideIdentifier of the Slide) - int notesSlideIdentifier = s.getSlideAtom().getNotesID(); - Integer notesSlideIdentifierI = new Integer(notesSlideIdentifier); - - // Grab the notes record - Integer notesRefI = (Integer)notesSlideIdToRefid.get(notesSlideIdentifierI); - Integer notesCoreRecNum = (Integer)_sheetIdToCoreRecordsLookup.get(notesRefI); - n = (org.apache.poi.hslf.record.Notes) - _mostRecentCoreRecords[notesCoreRecNum.intValue()]; - } - - // Grab the matching SlideAtomSet - SlideAtomsSet sas = (SlideAtomsSet) - slideSlideIdToSlideAtomsSet.get(slideIdentifierI); - - // Build the notes model, if there's notes - Notes notes = null; - if(n != null) { - // TODO: Use this - SlideAtomsSet nsas = (SlideAtomsSet) - notesSlideIdToSlideAtomsSet.get(slideIdentifierI); - - // Create the model view of the notes - notes = new Notes(n); - notesV.add(notes); - } - - // Build the slide model - Slide slide = new Slide(s, notes, sas, slideIdentifier, slideNumber); - slidesV.add(slide); - } - - // ******************* Finish up **************** - - // Finish setting up the notes - _notes = new Notes[notesV.size()]; + // Finally, generate model objects for everything + // Notes first + _notes = new Notes[notesRecords.length]; for(int i=0; i<_notes.length; i++) { - _notes[i] = (Notes)notesV.get(i); + _notes[i] = new Notes(notesRecords[i]); _notes[i].setSlideShow(this); - - // Now supply ourselves to all the rich text runs - // of this note's TextRuns - TextRun[] trs = _notes[i].getTextRuns(); - for(int j=0; j