[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * PHPExcel 4 * 5 * Copyright (c) 2006 - 2014 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_Worksheet 23 * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) 24 * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL 25 * @version ##VERSION##, ##DATE## 26 */ 27 28 29 /** 30 * PHPExcel_Worksheet_SheetView 31 * 32 * @category PHPExcel 33 * @package PHPExcel_Worksheet 34 * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) 35 */ 36 class PHPExcel_Worksheet_SheetView 37 { 38 39 /* Sheet View types */ 40 const SHEETVIEW_NORMAL = 'normal'; 41 const SHEETVIEW_PAGE_LAYOUT = 'pageLayout'; 42 const SHEETVIEW_PAGE_BREAK_PREVIEW = 'pageBreakPreview'; 43 44 private static $_sheetViewTypes = array( 45 self::SHEETVIEW_NORMAL, 46 self::SHEETVIEW_PAGE_LAYOUT, 47 self::SHEETVIEW_PAGE_BREAK_PREVIEW, 48 ); 49 50 /** 51 * ZoomScale 52 * 53 * Valid values range from 10 to 400. 54 * 55 * @var int 56 */ 57 private $_zoomScale = 100; 58 59 /** 60 * ZoomScaleNormal 61 * 62 * Valid values range from 10 to 400. 63 * 64 * @var int 65 */ 66 private $_zoomScaleNormal = 100; 67 68 /** 69 * View 70 * 71 * Valid values range from 10 to 400. 72 * 73 * @var string 74 */ 75 private $_sheetviewType = self::SHEETVIEW_NORMAL; 76 77 /** 78 * Create a new PHPExcel_Worksheet_SheetView 79 */ 80 public function __construct() 81 { 82 } 83 84 /** 85 * Get ZoomScale 86 * 87 * @return int 88 */ 89 public function getZoomScale() { 90 return $this->_zoomScale; 91 } 92 93 /** 94 * Set ZoomScale 95 * 96 * Valid values range from 10 to 400. 97 * 98 * @param int $pValue 99 * @throws PHPExcel_Exception 100 * @return PHPExcel_Worksheet_SheetView 101 */ 102 public function setZoomScale($pValue = 100) { 103 // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface, 104 // but it is apparently still able to handle any scale >= 1 105 if (($pValue >= 1) || is_null($pValue)) { 106 $this->_zoomScale = $pValue; 107 } else { 108 throw new PHPExcel_Exception("Scale must be greater than or equal to 1."); 109 } 110 return $this; 111 } 112 113 /** 114 * Get ZoomScaleNormal 115 * 116 * @return int 117 */ 118 public function getZoomScaleNormal() { 119 return $this->_zoomScaleNormal; 120 } 121 122 /** 123 * Set ZoomScale 124 * 125 * Valid values range from 10 to 400. 126 * 127 * @param int $pValue 128 * @throws PHPExcel_Exception 129 * @return PHPExcel_Worksheet_SheetView 130 */ 131 public function setZoomScaleNormal($pValue = 100) { 132 if (($pValue >= 1) || is_null($pValue)) { 133 $this->_zoomScaleNormal = $pValue; 134 } else { 135 throw new PHPExcel_Exception("Scale must be greater than or equal to 1."); 136 } 137 return $this; 138 } 139 140 /** 141 * Get View 142 * 143 * @return string 144 */ 145 public function getView() { 146 return $this->_sheetviewType; 147 } 148 149 /** 150 * Set View 151 * 152 * Valid values are 153 * 'normal' self::SHEETVIEW_NORMAL 154 * 'pageLayout' self::SHEETVIEW_PAGE_LAYOUT 155 * 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW 156 * 157 * @param string $pValue 158 * @throws PHPExcel_Exception 159 * @return PHPExcel_Worksheet_SheetView 160 */ 161 public function setView($pValue = NULL) { 162 // MS Excel 2007 allows setting the view to 'normal', 'pageLayout' or 'pageBreakPreview' 163 // via the user interface 164 if ($pValue === NULL) 165 $pValue = self::SHEETVIEW_NORMAL; 166 if (in_array($pValue, self::$_sheetViewTypes)) { 167 $this->_sheetviewType = $pValue; 168 } else { 169 throw new PHPExcel_Exception("Invalid sheetview layout type."); 170 } 171 172 return $this; 173 } 174 175 /** 176 * Implement PHP __clone to create a deep clone, not just a shallow copy. 177 */ 178 public function __clone() { 179 $vars = get_object_vars($this); 180 foreach ($vars as $key => $value) { 181 if (is_object($value)) { 182 $this->$key = clone $value; 183 } else { 184 $this->$key = $value; 185 } 186 } 187 } 188 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |