View | Details | Raw Unified | Return to bug 46635
Collapse All | Expand All

(-)poi-3.2-FINAL.orig/src/scratchpad/src/org/apache/poi/hslf/record/SlideListWithText.java (+5 lines)
Lines 163-168 Link Here
163
	 */
163
	 */
164
	public SlideAtomsSet[] getSlideAtomsSets() { return slideAtomsSets; }
164
	public SlideAtomsSet[] getSlideAtomsSets() { return slideAtomsSets; }
165
165
166
    /**
167
	 * Get access to the SlideAtomsSets of the children of this record
168
	 */
169
	public void setSlideAtomsSets( SlideAtomsSet[] sas ) { slideAtomsSets = sas; }
170
166
	/**
171
	/**
167
	 * Return the value we were given at creation
172
	 * Return the value we were given at creation
168
	 */
173
	 */
(-)poi-3.2-FINAL.orig/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java (+40 lines)
Lines 569-574 Link Here
569
        slwt.setChildRecord(r);
569
        slwt.setChildRecord(r);
570
	}
570
	}
571
571
572
	/**
573
	 * Remove a slide.
574
	 * @param slideNumber Remove slide with this number (1 based)
575
	 */
576
	public void removeSlide(int slideNumber) {
577
		// Ensure these numbers are valid
578
		if(slideNumber < 1) {
579
			throw new IllegalArgumentException("Old and new slide numbers must be greater than 0");
580
		}
581
		if(slideNumber > _slides.length) {
582
			throw new IllegalArgumentException("Old and new slide numbers must not exceed the number of slides (" + _slides.length + ")");
583
		}
584
585
        SlideListWithText slwt = _documentRecord.getSlideSlideListWithText();
586
        SlideAtomsSet[] sas = slwt.getSlideAtomsSets();
587
588
        SlideAtomsSet[] nsas = new SlideAtomsSet[sas.length-1];
589
        for( int i = 0; i < nsas.length; i++ ) {
590
           if( i+1 < slideNumber ) {
591
              nsas[ i ] = sas[ i ];
592
           }
593
           else {
594
              nsas[ i ] = sas[ i+1 ];
595
           }
596
        }
597
        slwt.setSlideAtomsSets( nsas );
598
        sas = nsas;
599
        ArrayList lst = new ArrayList();
600
        for (int i = 0; i < sas.length; i++) {
601
            lst.add(sas[i].getSlidePersistAtom());
602
            Record[] r = sas[i].getSlideRecords();
603
            for (int j = 0; j < r.length; j++) {
604
                lst.add(r[j]);
605
            }
606
            _slides[i].setSlideNumber(i+1);
607
        }
608
        Record[] r = (Record[])lst.toArray(new Record[lst.size()]);
609
        slwt.setChildRecord(r);
610
	}
611
572
	/* ===============================================================
612
	/* ===============================================================
573
	 *                       Addition Code
613
	 *                       Addition Code
574
	 * ===============================================================
614
	 * ===============================================================

Return to bug 46635