parent = $pParent; // Shape collection $this->shapeCollection = new \ArrayObject(); // Set identifier $this->identifier = md5(rand(0, 9999) . time()); } /** * Get collection of shapes * * @return \ArrayObject|\PhpOffice\PhpPresentation\AbstractShape[] */ public function getShapeCollection() { return $this->shapeCollection; } /** * Add shape to slide * * @param \PhpOffice\PhpPresentation\AbstractShape $shape * @return \PhpOffice\PhpPresentation\AbstractShape * @throws \Exception */ public function addShape(AbstractShape $shape) { $shape->setContainer($this); return $shape; } /** * Create rich text shape * * @return \PhpOffice\PhpPresentation\Shape\RichText * @throws \Exception */ public function createRichTextShape() { $shape = new RichText(); $this->addShape($shape); return $shape; } /** * Get parent * * @return Slide */ public function getParent() { return $this->parent; } /** * Set parent * * @param Slide $parent * @return Note */ public function setParent(Slide $parent) { $this->parent = $parent; return $this; } /** * Get X Offset * * @return int */ public function getOffsetX() { if ($this->offsetX === null) { $offsets = GeometryCalculator::calculateOffsets($this); $this->offsetX = $offsets[GeometryCalculator::X]; $this->offsetY = $offsets[GeometryCalculator::Y]; } return $this->offsetX; } /** * Get Y Offset * * @return int */ public function getOffsetY() { if ($this->offsetY === null) { $offsets = GeometryCalculator::calculateOffsets($this); $this->offsetX = $offsets[GeometryCalculator::X]; $this->offsetY = $offsets[GeometryCalculator::Y]; } return $this->offsetY; } /** * Get X Extent * * @return int */ public function getExtentX() { if ($this->extentX === null) { $extents = GeometryCalculator::calculateExtents($this); $this->extentX = $extents[GeometryCalculator::X]; $this->extentY = $extents[GeometryCalculator::Y]; } return $this->extentX; } /** * Get Y Extent * * @return int */ public function getExtentY() { if ($this->extentY === null) { $extents = GeometryCalculator::calculateExtents($this); $this->extentX = $extents[GeometryCalculator::X]; $this->extentY = $extents[GeometryCalculator::Y]; } return $this->extentY; } /** * Get hash code * * @return string Hash code */ public function getHashCode() { return md5($this->identifier . __CLASS__); } /** * Get hash index * * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * * @return string Hash index */ public function getHashIndex() { return $this->hashIndex; } /** * Set hash index * * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * * @param string $value Hash index */ public function setHashIndex($value) { $this->hashIndex = $value; } }