General performance improvements, and specific improvements in the CSV Reader

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@65064 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker
2010-12-09 12:07:50 +00:00
parent 500a8e763e
commit 1fad8bd2dd
23 changed files with 800 additions and 902 deletions
+27 -32
View File
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@@ -34,14 +34,14 @@
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Worksheet_ColumnDimension
{
{
/**
* Column index
*
* @var int
*/
private $_columnIndex;
/**
* Column width
*
@@ -49,35 +49,35 @@ class PHPExcel_Worksheet_ColumnDimension
*
* @var double
*/
private $_width;
private $_width = -1;
/**
* Auto size?
*
* @var bool
*/
private $_autoSize;
private $_autoSize = false;
/**
* Visible?
*
* @var bool
*/
private $_visible;
private $_visible = true;
/**
* Outline level
*
* @var int
*/
private $_outlineLevel = 0;
private $_outlineLevel = 0;
/**
* Collapsed
*
* @var bool
*/
private $_collapsed;
private $_collapsed = false;
/**
* Index to cellXf
@@ -95,16 +95,11 @@ class PHPExcel_Worksheet_ColumnDimension
{
// Initialise values
$this->_columnIndex = $pIndex;
$this->_width = -1;
$this->_autoSize = false;
$this->_visible = true;
$this->_outlineLevel = 0;
$this->_collapsed = false;
// set default index to cellXf
$this->_xfIndex = 0;
}
/**
* Get ColumnIndex
*
@@ -113,7 +108,7 @@ class PHPExcel_Worksheet_ColumnDimension
public function getColumnIndex() {
return $this->_columnIndex;
}
/**
* Set ColumnIndex
*
@@ -124,7 +119,7 @@ class PHPExcel_Worksheet_ColumnDimension
$this->_columnIndex = $pValue;
return $this;
}
/**
* Get Width
*
@@ -133,7 +128,7 @@ class PHPExcel_Worksheet_ColumnDimension
public function getWidth() {
return $this->_width;
}
/**
* Set Width
*
@@ -144,7 +139,7 @@ class PHPExcel_Worksheet_ColumnDimension
$this->_width = $pValue;
return $this;
}
/**
* Get Auto Size
*
@@ -153,7 +148,7 @@ class PHPExcel_Worksheet_ColumnDimension
public function getAutoSize() {
return $this->_autoSize;
}
/**
* Set Auto Size
*
@@ -164,7 +159,7 @@ class PHPExcel_Worksheet_ColumnDimension
$this->_autoSize = $pValue;
return $this;
}
/**
* Get Visible
*
@@ -173,7 +168,7 @@ class PHPExcel_Worksheet_ColumnDimension
public function getVisible() {
return $this->_visible;
}
/**
* Set Visible
*
@@ -184,7 +179,7 @@ class PHPExcel_Worksheet_ColumnDimension
$this->_visible = $pValue;
return $this;
}
/**
* Get Outline Level
*
@@ -193,7 +188,7 @@ class PHPExcel_Worksheet_ColumnDimension
public function getOutlineLevel() {
return $this->_outlineLevel;
}
/**
* Set Outline Level
*
@@ -207,11 +202,11 @@ class PHPExcel_Worksheet_ColumnDimension
if ($pValue < 0 || $pValue > 7) {
throw new Exception("Outline level must range between 0 and 7.");
}
$this->_outlineLevel = $pValue;
return $this;
}
/**
* Get Collapsed
*
@@ -220,7 +215,7 @@ class PHPExcel_Worksheet_ColumnDimension
public function getCollapsed() {
return $this->_collapsed;
}
/**
* Set Collapsed
*
@@ -231,7 +226,7 @@ class PHPExcel_Worksheet_ColumnDimension
$this->_collapsed = $pValue;
return $this;
}
/**
* Get index to cellXf
*
+10 -22
View File
@@ -108,70 +108,70 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @var string
*/
private $_oddHeader;
private $_oddHeader = '';
/**
* OddFooter
*
* @var string
*/
private $_oddFooter;
private $_oddFooter = '';
/**
* EvenHeader
*
* @var string
*/
private $_evenHeader;
private $_evenHeader = '';
/**
* EvenFooter
*
* @var string
*/
private $_evenFooter;
private $_evenFooter = '';
/**
* FirstHeader
*
* @var string
*/
private $_firstHeader;
private $_firstHeader = '';
/**
* FirstFooter
*
* @var string
*/
private $_firstFooter;
private $_firstFooter = '';
/**
* Different header for Odd/Even, defaults to false
*
* @var boolean
*/
private $_differentOddEven;
private $_differentOddEven = false;
/**
* Different header for first page, defaults to false
*
* @var boolean
*/
private $_differentFirst;
private $_differentFirst = false;
/**
* Scale with document, defaults to true
*
* @var boolean
*/
private $_scaleWithDocument;
private $_scaleWithDocument = true;
/**
* Align with margins, defaults to true
*
* @var boolean
*/
private $_alignWithMargins;
private $_alignWithMargins = true;
/**
* Header/footer images
@@ -185,18 +185,6 @@ class PHPExcel_Worksheet_HeaderFooter
*/
public function __construct()
{
// Initialise values
$this->_oddHeader = '';
$this->_oddFooter = '';
$this->_evenHeader = '';
$this->_evenFooter = '';
$this->_firstHeader = '';
$this->_firstFooter = '';
$this->_differentOddEven = false;
$this->_differentFirst = false;
$this->_scaleWithDocument = true;
$this->_alignWithMargins = true;
$this->_headerFooterImages = array();
}
/**
+28 -35
View File
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@@ -34,63 +34,56 @@
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Worksheet_PageMargins
{
{
/**
* Left
*
* @var double
*/
private $_left;
private $_left = 0.7;
/**
* Right
*
* @var double
*/
private $_right;
private $_right = 0.7;
/**
* Top
*
* @var double
*/
private $_top;
private $_top = 0.75;
/**
* Bottom
*
* @var double
*/
private $_bottom;
private $_bottom = 0.75;
/**
* Header
*
* @var double
*/
private $_header;
private $_header = 0.3;
/**
* Footer
*
* @var double
*/
private $_footer;
private $_footer = 0.3;
/**
* Create a new PHPExcel_Worksheet_PageMargins
*/
public function __construct()
{
// Initialise values
$this->_left = 0.7;
$this->_right = 0.7;
$this->_top = 0.75;
$this->_bottom = 0.75;
$this->_header = 0.3;
$this->_footer = 0.3;
}
/**
* Get Left
*
@@ -99,7 +92,7 @@ class PHPExcel_Worksheet_PageMargins
public function getLeft() {
return $this->_left;
}
/**
* Set Left
*
@@ -110,7 +103,7 @@ class PHPExcel_Worksheet_PageMargins
$this->_left = $pValue;
return $this;
}
/**
* Get Right
*
@@ -119,7 +112,7 @@ class PHPExcel_Worksheet_PageMargins
public function getRight() {
return $this->_right;
}
/**
* Set Right
*
@@ -130,7 +123,7 @@ class PHPExcel_Worksheet_PageMargins
$this->_right = $pValue;
return $this;
}
/**
* Get Top
*
@@ -139,7 +132,7 @@ class PHPExcel_Worksheet_PageMargins
public function getTop() {
return $this->_top;
}
/**
* Set Top
*
@@ -150,7 +143,7 @@ class PHPExcel_Worksheet_PageMargins
$this->_top = $pValue;
return $this;
}
/**
* Get Bottom
*
@@ -159,7 +152,7 @@ class PHPExcel_Worksheet_PageMargins
public function getBottom() {
return $this->_bottom;
}
/**
* Set Bottom
*
@@ -170,7 +163,7 @@ class PHPExcel_Worksheet_PageMargins
$this->_bottom = $pValue;
return $this;
}
/**
* Get Header
*
@@ -179,7 +172,7 @@ class PHPExcel_Worksheet_PageMargins
public function getHeader() {
return $this->_header;
}
/**
* Set Header
*
@@ -190,7 +183,7 @@ class PHPExcel_Worksheet_PageMargins
$this->_header = $pValue;
return $this;
}
/**
* Get Footer
*
@@ -199,7 +192,7 @@ class PHPExcel_Worksheet_PageMargins
public function getFooter() {
return $this->_footer;
}
/**
* Set Footer
*
@@ -210,7 +203,7 @@ class PHPExcel_Worksheet_PageMargins
$this->_footer = $pValue;
return $this;
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
+6 -19
View File
@@ -189,14 +189,14 @@ class PHPExcel_Worksheet_PageSetup
*
* @var int
*/
private $_paperSize;
private $_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER;
/**
* Orientation
*
* @var string
*/
private $_orientation;
private $_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT;
/**
* Scale (Print Scale)
@@ -206,7 +206,7 @@ class PHPExcel_Worksheet_PageSetup
*
* @var int?
*/
private $_scale;
private $_scale = 100;
/**
* Fit To Page
@@ -214,7 +214,7 @@ class PHPExcel_Worksheet_PageSetup
*
* @var boolean
*/
private $_fitToPage;
private $_fitToPage = false;
/**
* Fit To Height
@@ -222,7 +222,7 @@ class PHPExcel_Worksheet_PageSetup
*
* @var int?
*/
private $_fitToHeight;
private $_fitToHeight = 1;
/**
* Fit To Width
@@ -230,7 +230,7 @@ class PHPExcel_Worksheet_PageSetup
*
* @var int?
*/
private $_fitToWidth;
private $_fitToWidth = 1;
/**
* Columns to repeat at left
@@ -279,19 +279,6 @@ class PHPExcel_Worksheet_PageSetup
*/
public function __construct()
{
// Initialise values
$this->_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER;
$this->_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT;
$this->_scale = 100;
$this->_fitToPage = false;
$this->_fitToHeight = 1;
$this->_fitToWidth = 1;
$this->_columnsToRepeatAtLeft = array('', '');
$this->_rowsToRepeatAtTop = array(0, 0);
$this->_horizontalCentered = false;
$this->_verticalCentered = false;
$this->_printArea = null;
$this->_firstPageNumber = null;
}
/**
+17 -35
View File
@@ -40,143 +40,125 @@ class PHPExcel_Worksheet_Protection
*
* @var boolean
*/
private $_sheet;
private $_sheet = false;
/**
* Objects
*
* @var boolean
*/
private $_objects;
private $_objects = false;
/**
* Scenarios
*
* @var boolean
*/
private $_scenarios;
private $_scenarios = false;
/**
* Format cells
*
* @var boolean
*/
private $_formatCells;
private $_formatCells = false;
/**
* Format columns
*
* @var boolean
*/
private $_formatColumns;
private $_formatColumns = false;
/**
* Format rows
*
* @var boolean
*/
private $_formatRows;
private $_formatRows = false;
/**
* Insert columns
*
* @var boolean
*/
private $_insertColumns;
private $_insertColumns = false;
/**
* Insert rows
*
* @var boolean
*/
private $_insertRows;
private $_insertRows = false;
/**
* Insert hyperlinks
*
* @var boolean
*/
private $_insertHyperlinks;
private $_insertHyperlinks = false;
/**
* Delete columns
*
* @var boolean
*/
private $_deleteColumns;
private $_deleteColumns = false;
/**
* Delete rows
*
* @var boolean
*/
private $_deleteRows;
private $_deleteRows = false;
/**
* Select locked cells
*
* @var boolean
*/
private $_selectLockedCells;
private $_selectLockedCells = false;
/**
* Sort
*
* @var boolean
*/
private $_sort;
private $_sort = false;
/**
* AutoFilter
*
* @var boolean
*/
private $_autoFilter;
private $_autoFilter = false;
/**
* Pivot tables
*
* @var boolean
*/
private $_pivotTables;
private $_pivotTables = false;
/**
* Select unlocked cells
*
* @var boolean
*/
private $_selectUnlockedCells;
private $_selectUnlockedCells = false;
/**
* Password
*
* @var string
*/
private $_password;
private $_password = '';
/**
* Create a new PHPExcel_Worksheet_Protection
*/
public function __construct()
{
// Initialise values
$this->_sheet = false;
$this->_objects = false;
$this->_scenarios = false;
$this->_formatCells = false;
$this->_formatColumns = false;
$this->_formatRows = false;
$this->_insertColumns = false;
$this->_insertRows = false;
$this->_insertHyperlinks = false;
$this->_deleteColumns = false;
$this->_deleteRows = false;
$this->_selectLockedCells = false;
$this->_sort = false;
$this->_autoFilter = false;
$this->_pivotTables = false;
$this->_selectUnlockedCells = false;
$this->_password = '';
}
/**
+22 -26
View File
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@@ -34,14 +34,14 @@
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Worksheet_RowDimension
{
{
/**
* Row index
*
* @var int
*/
private $_rowIndex;
/**
* Row height (in pt)
*
@@ -49,28 +49,28 @@ class PHPExcel_Worksheet_RowDimension
*
* @var double
*/
private $_rowHeight;
private $_rowHeight = -1;
/**
* Visible?
*
* @var bool
*/
private $_visible;
private $_visible = true;
/**
* Outline level
*
* @var int
*/
private $_outlineLevel = 0;
private $_outlineLevel = 0;
/**
* Collapsed
*
* @var bool
*/
private $_collapsed;
private $_collapsed = false;
/**
* Index to cellXf. Null value means row has no explicit cellXf format.
@@ -88,15 +88,11 @@ class PHPExcel_Worksheet_RowDimension
{
// Initialise values
$this->_rowIndex = $pIndex;
$this->_rowHeight = -1;
$this->_visible = true;
$this->_outlineLevel = 0;
$this->_collapsed = false;
// set row dimension as unformatted by default
$this->_xfIndex = null;
}
/**
* Get Row Index
*
@@ -105,7 +101,7 @@ class PHPExcel_Worksheet_RowDimension
public function getRowIndex() {
return $this->_rowIndex;
}
/**
* Set Row Index
*
@@ -116,7 +112,7 @@ class PHPExcel_Worksheet_RowDimension
$this->_rowIndex = $pValue;
return $this;
}
/**
* Get Row Height
*
@@ -125,7 +121,7 @@ class PHPExcel_Worksheet_RowDimension
public function getRowHeight() {
return $this->_rowHeight;
}
/**
* Set Row Height
*
@@ -136,7 +132,7 @@ class PHPExcel_Worksheet_RowDimension
$this->_rowHeight = $pValue;
return $this;
}
/**
* Get Visible
*
@@ -145,7 +141,7 @@ class PHPExcel_Worksheet_RowDimension
public function getVisible() {
return $this->_visible;
}
/**
* Set Visible
*
@@ -156,7 +152,7 @@ class PHPExcel_Worksheet_RowDimension
$this->_visible = $pValue;
return $this;
}
/**
* Get Outline Level
*
@@ -165,7 +161,7 @@ class PHPExcel_Worksheet_RowDimension
public function getOutlineLevel() {
return $this->_outlineLevel;
}
/**
* Set Outline Level
*
@@ -179,11 +175,11 @@ class PHPExcel_Worksheet_RowDimension
if ($pValue < 0 || $pValue > 7) {
throw new Exception("Outline level must range between 0 and 7.");
}
$this->_outlineLevel = $pValue;
return $this;
}
/**
* Get Collapsed
*
@@ -192,7 +188,7 @@ class PHPExcel_Worksheet_RowDimension
public function getCollapsed() {
return $this->_collapsed;
}
/**
* Set Collapsed
*
+5 -8
View File
@@ -37,30 +37,27 @@ class PHPExcel_Worksheet_SheetView
{
/**
* ZoomScale
*
*
* Valid values range from 10 to 400.
*
* @var int
*/
private $_zoomScale;
private $_zoomScale = 100;
/**
* ZoomScaleNormal
*
*
* Valid values range from 10 to 400.
*
* @var int
*/
private $_zoomScaleNormal;
private $_zoomScaleNormal = 100;
/**
* Create a new PHPExcel_Worksheet_SheetView
*/
public function __construct()
{
// Initialise values
$this->_zoomScale = 100;
$this->_zoomScaleNormal = 100;
}
/**
@@ -91,7 +88,7 @@ class PHPExcel_Worksheet_SheetView
}
return $this;
}
/**
* Get ZoomScaleNormal
*