ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SheetView.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
7 class SheetView
8 {
9  // Sheet View types
10  const SHEETVIEW_NORMAL = 'normal';
11  const SHEETVIEW_PAGE_LAYOUT = 'pageLayout';
12  const SHEETVIEW_PAGE_BREAK_PREVIEW = 'pageBreakPreview';
13 
14  private static $sheetViewTypes = [
15  self::SHEETVIEW_NORMAL,
16  self::SHEETVIEW_PAGE_LAYOUT,
17  self::SHEETVIEW_PAGE_BREAK_PREVIEW,
18  ];
19 
27  private $zoomScale = 100;
28 
36  private $zoomScaleNormal = 100;
37 
46  private $showZeros = true;
47 
55  private $sheetviewType = self::SHEETVIEW_NORMAL;
56 
60  public function __construct()
61  {
62  }
63 
69  public function getZoomScale()
70  {
71  return $this->zoomScale;
72  }
73 
82  public function setZoomScale($pValue)
83  {
84  // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
85  // but it is apparently still able to handle any scale >= 1
86  if (($pValue >= 1) || $pValue === null) {
87  $this->zoomScale = $pValue;
88  } else {
89  throw new PhpSpreadsheetException('Scale must be greater than or equal to 1.');
90  }
91 
92  return $this;
93  }
94 
100  public function getZoomScaleNormal()
101  {
102  return $this->zoomScaleNormal;
103  }
104 
113  public function setZoomScaleNormal($pValue)
114  {
115  if (($pValue >= 1) || $pValue === null) {
116  $this->zoomScaleNormal = $pValue;
117  } else {
118  throw new PhpSpreadsheetException('Scale must be greater than or equal to 1.');
119  }
120 
121  return $this;
122  }
123 
129  public function setShowZeros($pValue): void
130  {
131  $this->showZeros = $pValue;
132  }
133 
137  public function getShowZeros()
138  {
139  return $this->showZeros;
140  }
141 
147  public function getView()
148  {
149  return $this->sheetviewType;
150  }
151 
164  public function setView($pValue)
165  {
166  // MS Excel 2007 allows setting the view to 'normal', 'pageLayout' or 'pageBreakPreview' via the user interface
167  if ($pValue === null) {
168  $pValue = self::SHEETVIEW_NORMAL;
169  }
170  if (in_array($pValue, self::$sheetViewTypes)) {
171  $this->sheetviewType = $pValue;
172  } else {
173  throw new PhpSpreadsheetException('Invalid sheetview layout type.');
174  }
175 
176  return $this;
177  }
178 
182  public function __clone()
183  {
184  $vars = get_object_vars($this);
185  foreach ($vars as $key => $value) {
186  if (is_object($value)) {
187  $this->$key = clone $value;
188  } else {
189  $this->$key = $value;
190  }
191  }
192  }
193 }
setZoomScaleNormal($pValue)
Set ZoomScale.
Definition: SheetView.php:113
__construct()
Create a new SheetView.
Definition: SheetView.php:60
setShowZeros($pValue)
Set ShowZeroes setting.
Definition: SheetView.php:129
$key
Definition: croninfo.php:18
__clone()
Implement PHP __clone to create a deep clone, not just a shallow copy.
Definition: SheetView.php:182