<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * Object representation of Microsoft Excel Spreadsheets
 *
 * PHP version 5
 *
 * @category   File Formats
 * @package    Spreadsheet_Excel
 * @author     David Sanders <shangxiao@php.net>
 * @copyright  Copyright &copy; 2007, David Sanders
 * @license    LGPL <http://www.gnu.org/licenses/lgpl.html>
 * @version    Release: @release@
 * @link       http://pear.php.net/package/Spreadsheet_Excel
 * @see        Spreadsheet_Excel_Reader
 */

require_once 'Spreadsheet/Excel/Reader/Workbook.php';
require_once 
'Spreadsheet/Excel/Reader/Cell.php';

/**
 * Storage for worksheets 
 *
 * PHP version 5
 *
 * @category   File Formats
 * @package    Spreadsheet_Excel
 * @author     David Sanders <shangxiao@php.net>
 * @copyright  Copyright &copy; 2007, David Sanders
 * @license    LGPL <http://www.gnu.org/licenses/lgpl.html>
 */

class Spreadsheet_Excel_Worksheet
{
    
/**
     * Name of the worksheet as appears on the tab
     * 
     * @access public
     * @var string name of the worksheet
     */
    
public $name;

    private 
$_workbook;

    public 
$cells = array();
    public 
$selected_cells = array();

    public 
$first_row 0;
    public 
$last_row 0;
    
    public 
$first_col 0;
    public 
$last_col 0;

    public 
$numRows 0;
    public 
$numCols 0;
    
    function 
__construct(Excel_Workbook $workbook)
    {
        
$this->workbook $workbook;
    }

    public function 
addCell($row$col$xf$value$type 'Unknown'$raw null)
    {
        if (
is_null($type)) {
            
$raw $value;
        }

        
$cell = new Excel_Cell($this$row$col$xf$value);
        
$this->cells[$row][$col] = $cell;
    }

    public function 
toArray()
    {
    }

    public function 
getCell($x$y)
    {
        if (
is_string($x) && !is_numeric($x)) {
            
$col 0;
            foreach (
str_split(strtoupper($x)) as $letter) {
                
$col += ord($letter) - 65;
            }
            
$row $y 1;
        } else {
            
$row $x;
            
$col $y;
        }
        return 
$this->cells[$row][$col];
    }

    public function 
getSelectedCells()
    {
        
    }
}

/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * c-hanging-comment-ender-p: nil
 * End:
 */
?>