Create the Tile corresponding to a cell.

@param Cell? $cell A cell, or `null`.
@return null If `null` is given.
@return false If the `$cell` is `WIDE_LEFT` or `TALL_BOTTOM`, or
@return Tile The Tile corresponding to the Cell value.
6048
public static function fromCell($cell)
    {
        switch (Cell::toValue($cell)) {
            case null:
                return null;
            case Cell::SMALL:
                return self::SMALL();
            case Cell::TALL_TOP:
                return self::TALL();
            case Cell::WIDE_LEFT:
                return self::WIDE();
            default:
                return false;
        }
    }
1150055
function _substituteCellref($cell)
    {
        $cell = strtoupper($cell);

        // Convert a column range: 'A:A' or 'B:G'
        if (preg_match("/([A-I]?[A-Z]):([A-I]?[A-Z])/", $cell, $match)) {
            list($no_use, $col1) =  $this->_cellToRowcol($match[1] .'1'); // Add a dummy row
            list($no_use, $col2) =  $this->_cellToRowcol($match[2] .'1'); // Add a dummy row
            return(array($col1, $col2));
        }

        // Convert a cell range: 'A1:B7'
        if (preg_match("/\$?([A-I]?[A-Z]\$?\d+):\$?([A-I]?[A-Z]\$?\d+)/", $cell, $match)) {
            list($row1, $col1) =  $this->_cellToRowcol($match[1]);
            list($row2, $col2) =  $this->_cellToRowcol($match[2]);
            return(array($row1, $col1, $row2, $col2));
        }

        // Convert a cell reference: 'A1' or 'AD2000'
        if (preg_match("/\$?([A-I]?[A-Z]\$?\d+)/", $cell)) {
            list($row1, $col1) =  $this->_cellToRowcol($match[1]);
            return(array($row1, $col1));
        }

        // TODO use real error codes
        $this->raiseError("Unknown cell reference $cell", 0, PEAR_ERROR_DIE);
    }
867144
public function addRow($rows = null) {
        if( ! is_array($rows) ) {
            $rows = func_get_args();
        }
        $row = new TableRow;
        foreach( $rows as $arg ) {
            $cell = new TableCell;
            $cell->addChild( $arg );
            $row->addChild( $cell );
        }
        $this->addChild($row);
        return $row;
    }
1331339
public boolean removeCellLink(GridCell<P> cell) {
		final int idx = this.cells.indexOf(cell);
		if (idx >= 0) {
			this.cells.remove(idx);
		}
		return idx == 0;
	}
1328727
public function prependCell($cell, $name = null)
    {
        $cell = $this->buildCell($cell);
        if ($name == null && $cell->getName() != '') {
            $name = $cell->getName();
        }
        if ($name == null) {
            array_unshift($this->cells, $cell);
        } else {
            $this->cells = [$name => $cell] + $this->cells;
        }
        reset($this->cells);
        $cell->setName(key($this->cells));
        return $this;
    }
174721
public function getCell($uuid)
    {
        $found = null;
        foreach ($this->cells as $cell) {
            if ($cell->getUuid() === $uuid) {
                $found = $cell;
                break;
            }
        }

        return $found;
    }
568592
public function cell($cell, array $data = [], array $options = [])
    {
        $parts = explode('::', $cell);
        if (count($parts) === 2) {
            list($cell, $action) = [$parts[0], $parts[1]];
        } else {
            list($cell, $action) = [$parts[0], 'display'];
        }
        $className = Application::className($cell, 'View/' . self::VIEW_TYPE_CELL);
        $class = new $className($data);
        return $class->{$action}($options);
    }
1172876
public function getCell($pCoordinate = 'A1')
    {
        // Check cell collection
        if ($this->cellCollection->isDataSet(strtoupper($pCoordinate))) {
            return $this->cellCollection->getCacheData($pCoordinate);
        }

        // Worksheet reference?
        if (strpos($pCoordinate, '!') !== false) {
            $worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pCoordinate, true);
            return $this->parent->getSheetByName($worksheetReference[0])->getCell(strtoupper($worksheetReference[1]));
        }

        // Named range?
        if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) &&
            (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) {
            $namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this);
            if ($namedRange !== null) {
                $pCoordinate = $namedRange->getRange();
                return $namedRange->getWorksheet()->getCell($pCoordinate);
            }
        }

        // Uppercase coordinate
        $pCoordinate = strtoupper($pCoordinate);

        if (strpos($pCoordinate, ':') !== false || strpos($pCoordinate, ',') !== false) {
            throw new PHPExcel_Exception('Cell coordinate can not be a range of cells.');
        } elseif (strpos($pCoordinate, '$') !== false) {
            throw new PHPExcel_Exception('Cell coordinate must not be absolute.');
        }

        // Create new cell object
        return $this->createNewCell($pCoordinate);
    }
416100
function _convertRef2d($cell)
	{
//		$class = 2; // as far as I know, this is magick.

		// Convert the cell reference
		$cell_array = $this->_cellToPackedRowcol($cell);
		list($row, $col) = $cell_array;

		// The ptg value depends on the class of the ptg.
//		if ($class == 0) {
//			$ptgRef = pack("C", $this->ptg['ptgRef']);
//		} elseif ($class == 1) {
//			$ptgRef = pack("C", $this->ptg['ptgRefV']);
//		} elseif ($class == 2) {
			$ptgRef = pack("C", $this->ptg['ptgRefA']);
//		} else {
//			// TODO: use real error codes
//			throw new PHPExcel_Writer_Exception("Unknown class $class");
//		}
		return $ptgRef.$row.$col;
	}
348046
function _cellToPackedRowcol($cell)
    {
        $cell = strtoupper($cell);
        list($row, $col, $row_rel, $col_rel) = $this->_cellToRowcol($cell);
        if ($col >= 256) {
            return $this->raiseError("Column in: $cell greater than 255");
        }
        // FIXME: change for BIFF8
        if ($row >= 16384) {
            return $this->raiseError("Row in: $cell greater than 16384 ");
        }

        // Set the high bits to indicate if row or col are relative.
        if ($this->_BIFF_version == 0x0500) {
            $row    |= $col_rel << 14;
            $row    |= $row_rel << 15;
            $col     = pack('C', $col);
        } elseif ($this->_BIFF_version == 0x0600) {
            $col    |= $col_rel << 14;
            $col    |= $row_rel << 15;
            $col     = pack('v', $col);
        }
        $row     = pack('v', $row);

        return array($row, $col);
    }
550375
function set($data) {
		if ($data instanceof Row) {
			$this->row->__set($data->getTable()->getName() . "_id", $data->id);
			$this->row->__unset($this->name);
			return $this;
		}
		if ($data instanceof Cell) {
			$data = $data->get();
		}
		parent::set($data);
		$this->dirty = true;
		return $this;
	}
594839
public GridCell<P> createCellAt(int row, int column) {
		GridCell<P> cell = this.cells[row][column];
		if (cell == null) {
			cell = new GridCell<>(row, column, getCellBounds(row, column));
			this.cells[row][column] = cell;
			++this.cellCount;
		}
		return cell;
	}
941193
protected function _createCell($className, $action, $plugin, $options)
    {
        /* @var \Cake\View\Cell $instance */
        $instance = new $className($this->request, $this->response, $this->getEventManager(), $options);

        $builder = $instance->viewBuilder();
        $builder->setTemplate(Inflector::underscore($action));

        if (!empty($plugin)) {
            $builder->setPlugin($plugin);
        }
        if (!empty($this->helpers)) {
            $builder->setHelpers($this->helpers);
        }

        if ($this instanceof View) {
            if (!empty($this->theme)) {
                $builder->setTheme($this->theme);
            }

            $class = get_class($this);
            $builder->setClassName($class);
            $instance->viewClass = $class;

            return $instance;
        }

        if (method_exists($this, 'viewBuilder')) {
            $builder->setTheme($this->viewBuilder()->getTheme());
        }

        if (isset($this->viewClass)) {
            $builder->setClassName($this->viewClass);
            $instance->viewClass = $this->viewClass;
        }

        return $instance;
    }
28985
private function buildCell($cell)
    {
        if (is_array($cell)) {
            $cell = $this->getServiceLocator()->get('DataGrid\Factory\Cell')->get($cell);
        } elseif (!($cell instanceof CellInterface)) {
            throw new \RuntimeException('You must provide Correct cell definition or Cell instance implementing CellInterface for data grid cells set.');
        }
        return $cell;
    }
1205115
private Cell newCell(Row tmplRow, int cellCol, int rowOffset, Row row, Object cellValue, int maxLen) {
        val cell = getOrCreateCell(tmplRow, cellCol, rowOffset, row);

        val value = PoiUtil.writeCellValue(cell, cellValue);

        fixMaxRowHeightRatio(row, maxLen, value);
        return cell;
    }
1260743
public static <R> ImmutableCell<R> copyOf(Cell<? extends R> cell) {
        if (cell == null) {
            throw new IllegalArgumentException("Cell must not be null");
        }
        if (cell instanceof ImmutableCell) {
            @SuppressWarnings("unchecked")
            ImmutableCell<R> result = (ImmutableCell<R>) cell;
            return result;
        }
        return ImmutableCell.<R>of(cell.getRow(), cell.getColumn(), cell.getValue());
    }
608850
public function renderCell(CellView $cell)
    {
        $name = $cell->vars['block_prefix'] . '_cell';

        return trim($this->template->renderBlock($name, $cell->vars));
    }