4
* PHPExcel_Worksheet_HeaderFooterDrawing
6
* Copyright (c) 2006 - 2015 PHPExcel
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License as published by the Free Software Foundation; either
11
* version 2.1 of the License, or (at your option) any later version.
13
* This library is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with this library; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23
* @package PHPExcel_Worksheet
24
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
26
* @version ##VERSION##, ##DATE##
28
class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing implements PHPExcel_IComparable
77
protected $resizeProportional;
80
* Create a new PHPExcel_Worksheet_HeaderFooterDrawing
82
public function __construct()
91
$this->resizeProportional = true;
99
public function getName()
107
* @param string $pValue
108
* @return PHPExcel_Worksheet_HeaderFooterDrawing
110
public function setName($pValue = '')
112
$this->name = $pValue;
121
public function getOffsetX()
123
return $this->offsetX;
130
* @return PHPExcel_Worksheet_HeaderFooterDrawing
132
public function setOffsetX($pValue = 0)
134
$this->offsetX = $pValue;
143
public function getOffsetY()
145
return $this->offsetY;
152
* @return PHPExcel_Worksheet_HeaderFooterDrawing
154
public function setOffsetY($pValue = 0)
156
$this->offsetY = $pValue;
165
public function getWidth()
174
* @return PHPExcel_Worksheet_HeaderFooterDrawing
176
public function setWidth($pValue = 0)
178
// Resize proportional?
179
if ($this->resizeProportional && $pValue != 0) {
180
$ratio = $this->width / $this->height;
181
$this->height = round($ratio * $pValue);
185
$this->width = $pValue;
195
public function getHeight()
197
return $this->height;
204
* @return PHPExcel_Worksheet_HeaderFooterDrawing
206
public function setHeight($pValue = 0)
208
// Resize proportional?
209
if ($this->resizeProportional && $pValue != 0) {
210
$ratio = $this->width / $this->height;
211
$this->width = round($ratio * $pValue);
215
$this->height = $pValue;
221
* Set width and height with proportional resize
224
* $objDrawing->setResizeProportional(true);
225
* $objDrawing->setWidthAndHeight(160,120);
228
* @author Vincent@luo MSN:kele_100@hotmail.com
231
* @return PHPExcel_Worksheet_HeaderFooterDrawing
233
public function setWidthAndHeight($width = 0, $height = 0)
235
$xratio = $width / $this->width;
236
$yratio = $height / $this->height;
237
if ($this->resizeProportional && !($width == 0 || $height == 0)) {
238
if (($xratio * $this->height) < $height) {
239
$this->height = ceil($xratio * $this->height);
240
$this->width = $width;
242
$this->width = ceil($yratio * $this->width);
243
$this->height = $height;
250
* Get ResizeProportional
254
public function getResizeProportional()
256
return $this->resizeProportional;
260
* Set ResizeProportional
262
* @param boolean $pValue
263
* @return PHPExcel_Worksheet_HeaderFooterDrawing
265
public function setResizeProportional($pValue = true)
267
$this->resizeProportional = $pValue;
276
public function getFilename()
278
return basename($this->path);
286
public function getExtension()
288
$parts = explode(".", basename($this->path));
297
public function getPath()
305
* @param string $pValue File path
306
* @param boolean $pVerifyFile Verify file
307
* @throws PHPExcel_Exception
308
* @return PHPExcel_Worksheet_HeaderFooterDrawing
310
public function setPath($pValue = '', $pVerifyFile = true)
313
if (file_exists($pValue)) {
314
$this->path = $pValue;
316
if ($this->width == 0 && $this->height == 0) {
318
list($this->width, $this->height) = getimagesize($pValue);
321
throw new PHPExcel_Exception("File $pValue not found!");
324
$this->path = $pValue;
332
* @return string Hash code
334
public function getHashCode()
348
* Implement PHP __clone to create a deep clone, not just a shallow copy.
350
public function __clone()
352
$vars = get_object_vars($this);
353
foreach ($vars as $key => $value) {
354
if (is_object($value)) {
355
$this->$key = clone $value;
357
$this->$key = $value;