116 $this->description =
'';
117 $this->worksheet = null;
118 $this->coordinates =
'A1';
123 $this->resizeProportional =
true;
125 $this->shadow =
new Drawing\Shadow();
128 ++self::$imageCounter;
129 $this->imageIndex = self::$imageCounter;
161 $this->name = $pValue;
210 if ($this->worksheet === null) {
212 $this->worksheet = $pValue;
213 $this->worksheet->getCell($this->coordinates);
214 $this->worksheet->getDrawingCollection()->append($this);
218 $iterator = $this->worksheet->getDrawingCollection()->getIterator();
220 while ($iterator->valid()) {
221 if ($iterator->current()->getHashCode() === $this->
getHashCode()) {
222 $this->worksheet->getDrawingCollection()->offsetUnset($iterator->key());
223 $this->worksheet = null;
232 throw new PhpSpreadsheetException(
'A Worksheet has already been assigned. Drawings can only exist on one \\PhpOffice\\PhpSpreadsheet\\Worksheet.');
258 $this->coordinates = $pValue;
282 $this->offsetX = $pValue;
306 $this->offsetY = $pValue;
331 if ($this->resizeProportional && $pValue != 0) {
332 $ratio = $this->height / ($this->width != 0 ? $this->width : 1);
333 $this->height = (int) round($ratio * $pValue);
337 $this->width = $pValue;
362 if ($this->resizeProportional && $pValue != 0) {
363 $ratio = $this->width / ($this->height != 0 ? $this->height : 1);
364 $this->width = (int) round($ratio * $pValue);
368 $this->height = $pValue;
391 $xratio =
$width / ($this->width != 0 ? $this->width : 1);
392 $yratio =
$height / ($this->height != 0 ? $this->height : 1);
393 if ($this->resizeProportional && !(
$width == 0 ||
$height == 0)) {
394 if (($xratio * $this->height) <
$height) {
395 $this->height = (int) ceil($xratio * $this->height);
398 $this->width = (int) ceil($yratio * $this->width);
428 $this->resizeProportional = $pValue;
452 $this->rotation = $pValue;
476 $this->shadow = $pValue;
491 $this->worksheet->getHashCode() .
498 $this->shadow->getHashCode() .
508 $vars = get_object_vars($this);
509 foreach ($vars as
$key => $value) {
510 if (
$key ==
'worksheet') {
511 $this->worksheet = null;
512 } elseif (is_object($value)) {
513 $this->
$key = clone $value;
515 $this->
$key = $value;
522 $this->hyperlink = $pHyperlink;
setWorksheet(?Worksheet $pValue=null, $pOverrideOld=false)
Set Worksheet.
getWorksheet()
Get Worksheet.
setDescription($description)
Set Description.
__clone()
Implement PHP __clone to create a deep clone, not just a shallow copy.
getImageIndex()
Get image index.
setShadow(?Drawing\Shadow $pValue=null)
Set Shadow.
__construct()
Create a new BaseDrawing.
setWidth($pValue)
Set Width.
setHeight($pValue)
Set Height.
getDescription()
Get Description.
setOffsetY($pValue)
Set OffsetY.
setWidthAndHeight($width, $height)
Set width and height with proportional resize.
getRotation()
Get Rotation.
setHyperlink(?Hyperlink $pHyperlink=null)
getResizeProportional()
Get ResizeProportional.
setRotation($pValue)
Set Rotation.
getCoordinates()
Get Coordinates.
setOffsetX($pValue)
Set OffsetX.
setResizeProportional($pValue)
Set ResizeProportional.
setName($pValue)
Set Name.
setCoordinates($pValue)
Set Coordinates.
getHashCode()
Get hash code.