7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
17 * @subpackage Spreadsheets
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
24 * @see Zend_Gdata_Entry
26 require_once 'Zend/Gdata/Entry.php';
29 * @see Zend_Gdata_Extension
31 require_once 'Zend/Gdata/Extension.php';
35 * Concrete class for working with cell elements.
39 * @subpackage Spreadsheets
40 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
41 * @license http://framework.zend.com/license/new-bsd New BSD License
43 class Zend_Gdata_Spreadsheets_Extension_Cell extends Zend_Gdata_Extension
45 protected $_rootElement = 'cell';
46 protected $_rootNamespace = 'gs';
49 * The row attribute of this cell
53 protected $_row = null;
56 * The column attribute of this cell
60 protected $_col = null;
63 * The inputValue attribute of this cell
67 protected $_inputValue = null;
70 * The numericValue attribute of this cell
74 protected $_numericValue = null;
77 * Constructs a new Zend_Gdata_Spreadsheets_Extension_Cell element.
79 * @param string $text (optional) Text contents of the element.
80 * @param string $row (optional) Row attribute of the element.
81 * @param string $col (optional) Column attribute of the element.
82 * @param string $inputValue (optional) Input value attribute of the element.
83 * @param string $numericValue (optional) Numeric value attribute of the element.
85 public function __construct($text = null, $row = null, $col = null, $inputValue = null, $numericValue = null)
87 $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces);
88 parent::__construct();
92 $this->_inputValue = $inputValue;
93 $this->_numericValue = $numericValue;
96 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
98 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
99 $element->setAttribute('row', $this->_row);
100 $element->setAttribute('col', $this->_col);
101 if ($this->_inputValue) $element->setAttribute('inputValue', $this->_inputValue);
102 if ($this->_numericValue) $element->setAttribute('numericValue', $this->_numericValue);
106 protected function takeAttributeFromDOM($attribute)
108 switch ($attribute->localName) {
110 $this->_row = $attribute->nodeValue;
113 $this->_col = $attribute->nodeValue;
116 $this->_inputValue = $attribute->nodeValue;
119 $this->_numericValue = $attribute->nodeValue;
122 parent::takeAttributeFromDOM($attribute);
127 * Gets the row attribute of the Cell element.
128 * @return string Row of the Cell.
130 public function getRow()
136 * Gets the column attribute of the Cell element.
137 * @return string Column of the Cell.
139 public function getColumn()
145 * Gets the input value attribute of the Cell element.
146 * @return string Input value of the Cell.
148 public function getInputValue()
150 return $this->_inputValue;
154 * Gets the numeric value attribute of the Cell element.
155 * @return string Numeric value of the Cell.
157 public function getNumericValue()
159 return $this->_numericValue;
163 * Sets the row attribute of the Cell element.
164 * @param string $row New row of the Cell.
166 public function setRow($row)
173 * Sets the column attribute of the Cell element.
174 * @param string $col New column of the Cell.
176 public function setColumn($col)
183 * Sets the input value attribute of the Cell element.
184 * @param string $inputValue New input value of the Cell.
186 public function setInputValue($inputValue)
188 $this->_inputValue = $inputValue;
193 * Sets the numeric value attribute of the Cell element.
194 * @param string $numericValue New numeric value of the Cell.
196 public function setNumericValue($numericValue)
198 $this->_numericValue = $numericValue;