Subversion Repositories eFlore/Applications.cel

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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