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

Source for file SpgrContainer.php

Documentation is available at SpgrContainer.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2011 PHPExcel
  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   PHPExcel
  22.  * @package    PHPExcel_Shared_Escher
  23.  * @copyright  Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.7.6, 2011-02-27
  26.  */
  27.  
  28. /**
  29.  * PHPExcel_Shared_Escher_DgContainer_SpgrContainer
  30.  *
  31.  * @category   PHPExcel
  32.  * @package    PHPExcel_Shared_Escher
  33.  * @copyright  Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
  34.  */
  35. {
  36.     /**
  37.      * Parent Shape Group Container
  38.      *
  39.      * @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer 
  40.      */
  41.     private $_parent;
  42.  
  43.     /**
  44.      * Shape Container collection
  45.      *
  46.      * @var array 
  47.      */
  48.     private $_children array();
  49.  
  50.     /**
  51.      * Set parent Shape Group Container
  52.      *
  53.      * @param PHPExcel_Shared_Escher_DgContainer_SpgrContainer $parent 
  54.      */
  55.     public function setParent($parent)
  56.     {
  57.         $this->_parent $parent;
  58.     }
  59.  
  60.     /**
  61.      * Get the parent Shape Group Container if any
  62.      *
  63.      * @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer|null
  64.      */
  65.     public function getParent()
  66.     {
  67.         return $this->_parent;
  68.     }
  69.  
  70.     /**
  71.      * Add a child. This will be either spgrContainer or spContainer
  72.      *
  73.      * @param mixed $child 
  74.      */
  75.     public function addChild($child)
  76.     {
  77.         $this->_children[$child;
  78.         $child->setParent($this);
  79.     }
  80.  
  81.     /**
  82.      * Get collection of Shape Containers
  83.      */
  84.     public function getChildren()
  85.     {
  86.         return $this->_children;
  87.     }
  88.  
  89.     /**
  90.      * Recursively get all spContainers within this spgrContainer
  91.      *
  92.      * @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer[] 
  93.      */
  94.     public function getAllSpContainers()
  95.     {
  96.         $allSpContainers array();
  97.  
  98.         foreach ($this->_children as $child{
  99.             if ($child instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer{
  100.                 $allSpContainers array_merge($allSpContainers$child->getAllSpContainers());
  101.             else {
  102.                 $allSpContainers[$child;
  103.             }
  104.         }
  105.  
  106.         return $allSpContainers;
  107.     }
  108. }

Documentation generated on Sun, 27 Feb 2011 16:33:55 -0800 by phpDocumentor 1.4.3