_parent = $pParent; // Shape collection $this->_shapeCollection = new ArrayObject(); // Set identifier $this->_identifier = md5(rand(0,9999) . time()); } /** * Get collection of shapes * * @return PHPPowerPoint_Shape[] */ public function getShapeCollection() { return $this->_shapeCollection; } /** * Add shape to slide * * @param PHPPowerPoint_Shape $shape */ public function addShape(PHPPowerPoint_Shape $shape) { $shape->setSlide($this); } /** * Create rich text shape * * @return PHPPowerPoint_Shape_RichText */ public function createRichTextShape() { $shape = new PHPPowerPoint_Shape_RichText(); $this->addShape($shape); return $shape; } /** * Create drawing shape * * @return PHPPowerPoint_Shape_Drawing */ public function createDrawingShape() { $shape = new PHPPowerPoint_Shape_Drawing(); $this->addShape($shape); return $shape; } /** * Get parent * * @return PHPPowerPoint */ public function getParent() { return $this->_parent; } /** * Re-bind parent * * @param PHPPowerPoint $parent */ public function rebindParent(PHPPowerPoint $parent) { $this->_parent->removeSlideByIndex( $this->_parent->getIndex($this) ); $this->_parent = $parent; } /** * Get slide layout * * @return string */ public function getSlideLayout() { return $this->_slideLayout; } /** * Set slide layout * * @param string $layout */ public function setSlideLayout($layout = PHPPowerPoint_Slide_Layout::BLANK) { $this->_slideLayout = $layout; } /** * Get hash code * * @return string Hash code */ public function getHashCode() { return md5( $this->_identifier . __CLASS__ ); } /** * Hash index * * @var string */ private $_hashIndex; /** * 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; } /** * Copy slide (!= clone!) * * @return PHPPowerPoint_Slide */ public function copy() { $copied = clone $this; return $copied; } /** * Implement PHP __clone to create a deep clone, not just a shallow copy. */ public function __clone() { foreach ($this as $key => $val) { if (is_object($val) || (is_array($val))) { $this->{$key} = unserialize(serialize($val)); } } } }