/** * Get hash code * * @return string Hash code */ public function getHashCode() { return md5($this->getBorder()->getLineStyle() . parent::getHashCode() . __CLASS__); }
protected function displayShapeInfo(AbstractShape $oShape) { $this->append('<div class="infoBlk" id="div' . $oShape->getHashCode() . 'Info">'); $this->append('<dl>'); $this->append('<dt>HashCode</dt><dd>' . $oShape->getHashCode() . '</dd>'); $this->append('<dt>Offset X</dt><dd>' . $oShape->getOffsetX() . '</dd>'); $this->append('<dt>Offset Y</dt><dd>' . $oShape->getOffsetY() . '</dd>'); $this->append('<dt>Height</dt><dd>' . $oShape->getHeight() . '</dd>'); $this->append('<dt>Width</dt><dd>' . $oShape->getWidth() . '</dd>'); $this->append('<dt>Rotation</dt><dd>' . $oShape->getRotation() . '°</dd>'); $this->append('<dt>Hyperlink</dt><dd>' . ucfirst(var_export($oShape->hasHyperlink(), true)) . '</dd>'); $this->append('<dt>Fill</dt><dd>@Todo</dd>'); $this->append('<dt>Border</dt><dd>@Todo</dd>'); $this->append('<dt>IsPlaceholder</dt><dd>' . ($oShape->isPlaceholder() ? 'true' : 'false') . '</dd>'); if ($oShape instanceof Drawing\Gd) { $this->append('<dt>Name</dt><dd>' . $oShape->getName() . '</dd>'); $this->append('<dt>Description</dt><dd>' . $oShape->getDescription() . '</dd>'); ob_start(); call_user_func($oShape->getRenderingFunction(), $oShape->getImageResource()); $sShapeImgContents = ob_get_contents(); ob_end_clean(); $this->append('<dt>Mime-Type</dt><dd>' . $oShape->getMimeType() . '</dd>'); $this->append('<dt>Image</dt><dd><img src="data:' . $oShape->getMimeType() . ';base64,' . base64_encode($sShapeImgContents) . '"></dd>'); } elseif ($oShape instanceof Drawing) { $this->append('<dt>Name</dt><dd>' . $oShape->getName() . '</dd>'); $this->append('<dt>Description</dt><dd>' . $oShape->getDescription() . '</dd>'); } elseif ($oShape instanceof RichText) { $this->append('<dt># of paragraphs</dt><dd>' . count($oShape->getParagraphs()) . '</dd>'); $this->append('<dt>Inset (T / R / B / L)</dt><dd>' . $oShape->getInsetTop() . 'px / ' . $oShape->getInsetRight() . 'px / ' . $oShape->getInsetBottom() . 'px / ' . $oShape->getInsetLeft() . 'px</dd>'); $this->append('<dt>Text</dt>'); $this->append('<dd>'); foreach ($oShape->getParagraphs() as $oParagraph) { $this->append('Paragraph<dl>'); $this->append('<dt>Alignment Horizontal</dt><dd> Alignment::' . $this->getConstantName('\\PhpOffice\\PhpPresentation\\Style\\Alignment', $oParagraph->getAlignment()->getHorizontal()) . '</dd>'); $this->append('<dt>Alignment Vertical</dt><dd> Alignment::' . $this->getConstantName('\\PhpOffice\\PhpPresentation\\Style\\Alignment', $oParagraph->getAlignment()->getVertical()) . '</dd>'); $this->append('<dt>Alignment Margin (L / R)</dt><dd>' . $oParagraph->getAlignment()->getMarginLeft() . ' px / ' . $oParagraph->getAlignment()->getMarginRight() . 'px</dd>'); $this->append('<dt>Alignment Indent</dt><dd>' . $oParagraph->getAlignment()->getIndent() . ' px</dd>'); $this->append('<dt>Alignment Level</dt><dd>' . $oParagraph->getAlignment()->getLevel() . '</dd>'); $this->append('<dt>Bullet Style</dt><dd> Bullet::' . $this->getConstantName('\\PhpOffice\\PhpPresentation\\Style\\Bullet', $oParagraph->getBulletStyle()->getBulletType()) . '</dd>'); if ($oParagraph->getBulletStyle()->getBulletType() != Bullet::TYPE_NONE) { $this->append('<dt>Bullet Font</dt><dd>' . $oParagraph->getBulletStyle()->getBulletFont() . '</dd>'); $this->append('<dt>Bullet Color</dt><dd>' . $oParagraph->getBulletStyle()->getBulletColor()->getARGB() . '</dd>'); } if ($oParagraph->getBulletStyle()->getBulletType() == Bullet::TYPE_BULLET) { $this->append('<dt>Bullet Char</dt><dd>' . $oParagraph->getBulletStyle()->getBulletChar() . '</dd>'); } if ($oParagraph->getBulletStyle()->getBulletType() == Bullet::TYPE_NUMERIC) { $this->append('<dt>Bullet Start At</dt><dd>' . $oParagraph->getBulletStyle()->getBulletNumericStartAt() . '</dd>'); $this->append('<dt>Bullet Style</dt><dd>' . $oParagraph->getBulletStyle()->getBulletNumericStyle() . '</dd>'); } $this->append('<dt>Line Spacing</dt><dd>' . $oParagraph->getLineSpacing() . '</dd>'); $this->append('<dt>RichText</dt><dd><dl>'); foreach ($oParagraph->getRichTextElements() as $oRichText) { if ($oRichText instanceof BreakElement) { $this->append('<dt><i>Break</i></dt>'); } else { if ($oRichText instanceof TextElement) { $this->append('<dt><i>TextElement</i></dt>'); } else { $this->append('<dt><i>Run</i></dt>'); } $this->append('<dd>' . $oRichText->getText()); $this->append('<dl>'); $this->append('<dt>Font Name</dt><dd>' . $oRichText->getFont()->getName() . '</dd>'); $this->append('<dt>Font Size</dt><dd>' . $oRichText->getFont()->getSize() . '</dd>'); $this->append('<dt>Font Color</dt><dd>#' . $oRichText->getFont()->getColor()->getARGB() . '</dd>'); $this->append('<dt>Font Transform</dt><dd>'); $this->append('<abbr title="Bold">Bold</abbr> : ' . ($oRichText->getFont()->isBold() ? 'Y' : 'N') . ' - '); $this->append('<abbr title="Italic">Italic</abbr> : ' . ($oRichText->getFont()->isItalic() ? 'Y' : 'N') . ' - '); $this->append('<abbr title="Underline">Underline</abbr> : Underline::' . $this->getConstantName('\\PhpOffice\\PhpPresentation\\Style\\Font', $oRichText->getFont()->getUnderline()) . ' - '); $this->append('<abbr title="Strikethrough">Strikethrough</abbr> : ' . ($oRichText->getFont()->isStrikethrough() ? 'Y' : 'N') . ' - '); $this->append('<abbr title="SubScript">SubScript</abbr> : ' . ($oRichText->getFont()->isSubScript() ? 'Y' : 'N') . ' - '); $this->append('<abbr title="SuperScript">SuperScript</abbr> : ' . ($oRichText->getFont()->isSuperScript() ? 'Y' : 'N')); $this->append('</dd>'); if ($oRichText instanceof TextElement) { if ($oRichText->hasHyperlink()) { $this->append('<dt>Hyperlink URL</dt><dd>' . $oRichText->getHyperlink()->getUrl() . '</dd>'); $this->append('<dt>Hyperlink Tooltip</dt><dd>' . $oRichText->getHyperlink()->getTooltip() . '</dd>'); } } $this->append('</dl>'); $this->append('</dd>'); } } $this->append('</dl></dd></dl>'); } $this->append('</dd>'); } else { // Add another shape } $this->append('</dl>'); $this->append('</div>'); }
/** * Add shape to slide * * @param \PhpOffice\PhpPresentation\AbstractShape $shape * @return \PhpOffice\PhpPresentation\AbstractShape */ public function addShape(AbstractShape $shape) { $shape->setContainer($this); return $shape; }
/** * Get hash code * * @return string Hash code */ public function getHashCode() { $hashElements = ''; foreach ($this->richTextParagraphs as $element) { $hashElements .= $element->getHashCode(); } return md5($hashElements . $this->wrap . $this->autoFit . $this->horizontalOverflow . $this->verticalOverflow . ($this->upright ? '1' : '0') . ($this->vertical ? '1' : '0') . $this->columns . $this->bottomInset . $this->leftInset . $this->rightInset . $this->topInset . parent::getHashCode() . __CLASS__); }
/** * Write hyperlink * * @param \PhpOffice\Common\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPresentation\AbstractShape|\PhpOffice\PhpPresentation\Shape\RichText\TextElement $shape */ protected function writeHyperlink(XMLWriter $objWriter, $shape) { // a:hlinkClick $objWriter->startElement('a:hlinkClick'); $objWriter->writeAttribute('r:id', $shape->getHyperlink()->relationId); $objWriter->writeAttribute('tooltip', $shape->getHyperlink()->getTooltip()); if ($shape->getHyperlink()->isInternal()) { $objWriter->writeAttribute('action', $shape->getHyperlink()->getUrl()); } $objWriter->endElement(); }
public function __construct() { parent::__construct(); $this->setDate(time()); }
/** * Get hash code * * @return string Hash code */ public function getHashCode() { return md5($this->name . $this->description . parent::getHashCode() . __CLASS__); }