PHPPowerPoint
[ class tree: PHPPowerPoint ] [ index: PHPPowerPoint ] [ all elements ]

Source for file SlideIterator.php

Documentation is available at SlideIterator.php

  1. <?php
  2. /**
  3.  * PHPPowerPoint
  4.  *
  5.  * Copyright (c) 2009 - 2010 PHPPowerPoint
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  *
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  20.  *
  21.  * @category   PHPPowerPoint
  22.  * @package    PHPPowerPoint
  23.  * @copyright  Copyright (c) 2009 - 2010 PHPPowerPoint (http://www.codeplex.com/PHPPowerPoint)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    0.1.0, 2009-04-27
  26.  */
  27.  
  28.  
  29. /** PHPPowerPoint */
  30. require_once 'PHPPowerPoint.php';
  31.  
  32. /** PHPPowerPoint_Slide */
  33. require_once 'PHPPowerPoint/Slide.php';
  34.  
  35.  
  36. /**
  37.  * PHPPowerPoint_SlideIterator
  38.  * 
  39.  * Used to iterate slides in PHPPowerPoint
  40.  *
  41.  * @category   PHPPowerPoint
  42.  * @package    PHPPowerPoint
  43.  * @copyright  Copyright (c) 2009 - 2010 PHPPowerPoint (http://www.codeplex.com/PHPPowerPoint)
  44.  */
  45. class PHPPowerPoint_SlideIterator extends IteratorIterator
  46. {
  47.     /**
  48.      * Presentation to iterate
  49.      *
  50.      * @var PHPPowerPoint 
  51.      */
  52.     private $_subject;
  53.     
  54.     /**
  55.      * Current iterator position
  56.      *
  57.      * @var int 
  58.      */
  59.     private $_position = 0;
  60.  
  61.     /**
  62.      * Create a new slide iterator
  63.      *
  64.      * @param PHPPowerPoint         $subject 
  65.      */
  66.     public function __construct(PHPPowerPoint $subject null{
  67.         // Set subject
  68.         $this->_subject = $subject;
  69.     }
  70.     
  71.     /**
  72.      * Destructor
  73.      */
  74.     public function __destruct({
  75.         unset($this->_subject);
  76.     }
  77.     
  78.     /**
  79.      * Rewind iterator
  80.      */
  81.     public function rewind({
  82.         $this->_position = 0;
  83.     }
  84.  
  85.     /**
  86.      * Current PHPPowerPoint_Slide
  87.      *
  88.      * @return PHPPowerPoint_Slide 
  89.      */
  90.     public function current({
  91.         return $this->_subject->getSlide($this->_position);
  92.     }
  93.  
  94.     /**
  95.      * Current key
  96.      *
  97.      * @return int 
  98.      */
  99.     public function key({
  100.         return $this->_position;
  101.     }
  102.  
  103.     /**
  104.      * Next value
  105.      */
  106.     public function next({
  107.         ++$this->_position;
  108.     }
  109.  
  110.     /**
  111.      * More PHPPowerPoint_Slide instances available?
  112.      *
  113.      * @return boolean 
  114.      */
  115.     public function valid({
  116.         return $this->_position < $this->_subject->getSlideCount();
  117.     }
  118. }

Documentation generated on Sat, 25 Apr 2009 11:38:14 +0200 by phpDocumentor 1.4.1