PageRenderTime 20ms CodeModel.GetById 11ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/common/libraries/plugin/phpexcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php

https://bitbucket.org/cbenelug/chamilo
PHP | 370 lines | 122 code | 37 blank | 211 comment | 2 complexity | 3628152acaa17e0e6a6aad80a4625bab MD5 | raw file
  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_SpContainer
 30 *
 31 * @category   PHPExcel
 32 * @package    PHPExcel_Shared_Escher
 33 * @copyright  Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
 34 */
 35class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
 36{
 37    /**
 38     * Parent Shape Group Container
 39     *
 40     * @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer
 41     */
 42    private $_parent;
 43    
 44    /**
 45     * Is this a group shape?
 46     *
 47     * @var boolean
 48     */
 49    private $_spgr = false;
 50    
 51    /**
 52     * Shape type
 53     *
 54     * @var int
 55     */
 56    private $_spType;
 57    
 58    /**
 59     * Shape index (usually group shape has index 0, and the rest: 1,2,3...)
 60     *
 61     * @var boolean
 62     */
 63    private $_spId;
 64    
 65    /**
 66     * Array of options
 67     *
 68     * @var array
 69     */
 70    private $_OPT;
 71    
 72    /**
 73     * Cell coordinates of upper-left corner of shape, e.g. 'A1'
 74     *
 75     * @var string
 76     */
 77    private $_startCoordinates;
 78    
 79    /**
 80     * Horizontal offset of upper-left corner of shape measured in 1/1024 of column width
 81     *
 82     * @var int
 83     */
 84    private $_startOffsetX;
 85    
 86    /**
 87     * Vertical offset of upper-left corner of shape measured in 1/256 of row height
 88     *
 89     * @var int
 90     */
 91    private $_startOffsetY;
 92    
 93    /**
 94     * Cell coordinates of bottom-right corner of shape, e.g. 'B2'
 95     *
 96     * @var string
 97     */
 98    private $_endCoordinates;
 99    
100    /**
101     * Horizontal offset of bottom-right corner of shape measured in 1/1024 of column width
102     *
103     * @var int
104     */
105    private $_endOffsetX;
106    
107    /**
108     * Vertical offset of bottom-right corner of shape measured in 1/256 of row height
109     *
110     * @var int
111     */
112    private $_endOffsetY;
113
114    /**
115     * Set parent Shape Group Container
116     *
117     * @param PHPExcel_Shared_Escher_DgContainer_SpgrContainer $parent
118     */
119    public function setParent($parent)
120    {
121        $this->_parent = $parent;
122    }
123
124    /**
125     * Get the parent Shape Group Container
126     *
127     * @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer
128     */
129    public function getParent()
130    {
131        return $this->_parent;
132    }
133
134    /**
135     * Set whether this is a group shape
136     *
137     * @param boolean $value
138     */
139    public function setSpgr($value = false)
140    {
141        $this->_spgr = $value;
142    }
143
144    /**
145     * Get whether this is a group shape
146     *
147     * @return boolean
148     */
149    public function getSpgr()
150    {
151        return $this->_spgr;
152    }
153
154    /**
155     * Set the shape type
156     *
157     * @param int $value
158     */
159    public function setSpType($value)
160    {
161        $this->_spType = $value;
162    }
163
164    /**
165     * Get the shape type
166     *
167     * @return int
168     */
169    public function getSpType()
170    {
171        return $this->_spType;
172    }
173
174    /**
175     * Set the shape index
176     *
177     * @param int $value
178     */
179    public function setSpId($value)
180    {
181        $this->_spId = $value;
182    }
183
184    /**
185     * Get the shape index
186     *
187     * @return int
188     */
189    public function getSpId()
190    {
191        return $this->_spId;
192    }
193
194    /**
195     * Set an option for the Shape Group Container
196     *
197     * @param int $property The number specifies the option
198     * @param mixed $value
199     */
200    public function setOPT($property, $value)
201    {
202        $this->_OPT[$property] = $value;
203    }
204
205    /**
206     * Get an option for the Shape Group Container
207     *
208     * @param int $property The number specifies the option
209     * @return mixed
210     */
211    public function getOPT($property)
212    {
213        if (isset($this->_OPT[$property]))
214        {
215            return $this->_OPT[$property];
216        }
217        return null;
218    }
219
220    /**
221     * Get the collection of options
222     *
223     * @return array
224     */
225    public function getOPTCollection()
226    {
227        return $this->_OPT;
228    }
229
230    /**
231     * Set cell coordinates of upper-left corner of shape
232     *
233     * @param string $value
234     */
235    public function setStartCoordinates($value = 'A1')
236    {
237        $this->_startCoordinates = $value;
238    }
239
240    /**
241     * Get cell coordinates of upper-left corner of shape
242     *
243     * @return string
244     */
245    public function getStartCoordinates()
246    {
247        return $this->_startCoordinates;
248    }
249
250    /**
251     * Set offset in x-direction of upper-left corner of shape measured in 1/1024 of column width
252     *
253     * @param int $startOffsetX
254     */
255    public function setStartOffsetX($startOffsetX = 0)
256    {
257        $this->_startOffsetX = $startOffsetX;
258    }
259
260    /**
261     * Get offset in x-direction of upper-left corner of shape measured in 1/1024 of column width
262     *
263     * @return int
264     */
265    public function getStartOffsetX()
266    {
267        return $this->_startOffsetX;
268    }
269
270    /**
271     * Set offset in y-direction of upper-left corner of shape measured in 1/256 of row height
272     *
273     * @param int $startOffsetY
274     */
275    public function setStartOffsetY($startOffsetY = 0)
276    {
277        $this->_startOffsetY = $startOffsetY;
278    }
279
280    /**
281     * Get offset in y-direction of upper-left corner of shape measured in 1/256 of row height
282     *
283     * @return int
284     */
285    public function getStartOffsetY()
286    {
287        return $this->_startOffsetY;
288    }
289
290    /**
291     * Set cell coordinates of bottom-right corner of shape
292     *
293     * @param string $value
294     */
295    public function setEndCoordinates($value = 'A1')
296    {
297        $this->_endCoordinates = $value;
298    }
299
300    /**
301     * Get cell coordinates of bottom-right corner of shape
302     *
303     * @return string
304     */
305    public function getEndCoordinates()
306    {
307        return $this->_endCoordinates;
308    }
309
310    /**
311     * Set offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width
312     *
313     * @param int $startOffsetX
314     */
315    public function setEndOffsetX($endOffsetX = 0)
316    {
317        $this->_endOffsetX = $endOffsetX;
318    }
319
320    /**
321     * Get offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width
322     *
323     * @return int
324     */
325    public function getEndOffsetX()
326    {
327        return $this->_endOffsetX;
328    }
329
330    /**
331     * Set offset in y-direction of bottom-right corner of shape measured in 1/256 of row height
332     *
333     * @param int $endOffsetY
334     */
335    public function setEndOffsetY($endOffsetY = 0)
336    {
337        $this->_endOffsetY = $endOffsetY;
338    }
339
340    /**
341     * Get offset in y-direction of bottom-right corner of shape measured in 1/256 of row height
342     *
343     * @return int
344     */
345    public function getEndOffsetY()
346    {
347        return $this->_endOffsetY;
348    }
349
350    /**
351     * Get the nesting level of this spContainer. This is the number of spgrContainers between this spContainer and
352     * the dgContainer. A value of 1 = immediately within first spgrContainer
353     * Higher nesting level occurs if and only if spContainer is part of a shape group
354     *
355     * @return int Nesting level
356     */
357    public function getNestingLevel()
358    {
359        $nestingLevel = 0;
360        
361        $parent = $this->getParent();
362        while ($parent instanceof PHPExcel_Shared_Escher_DgContainer_SpgrContainer)
363        {
364            ++ $nestingLevel;
365            $parent = $parent->getParent();
366        }
367        
368        return $nestingLevel;
369    }
370}