diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4e99e00e3..fd9325484 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@
- PHP 7.1 is now supported - @Progi1984 GH-355
- PhpOffice\PhpPresentation\Style\Color : Define only the transparency - @Progi1984 GH-370
- PowerPoint2007 Reader : Background Color based on SchemeColor - @Progi1984 GH-397
+- PowerPoint2007 Reader : Support for hyperlinks under pictures - @ulziibuyan
### Features
- ODPresentation Writer : Support for the position of Legend - @Progi1984 GH-355
diff --git a/samples/Sample_Header.php b/samples/Sample_Header.php
index 6cf01f8e0..91d04e91f 100644
--- a/samples/Sample_Header.php
+++ b/samples/Sample_Header.php
@@ -109,7 +109,7 @@
function write($phpPresentation, $filename, $writers)
{
$result = '';
-
+
// Write documents
foreach ($writers as $writer => $extension) {
$result .= date('H:i:s') . " Write to {$writer} format";
@@ -177,7 +177,7 @@ function createTemplatedSlide(PhpOffice\PhpPresentation\PhpPresentation $objPHPP
{
// Create slide
$slide = $objPHPPresentation->createSlide();
-
+
// Add logo
$shape = $slide->createDrawingShape();
$shape->setName('PHPPresentation logo')
@@ -301,7 +301,7 @@ protected function displayPhpPresentationInfo(PhpPresentation $oPHPPpt)
$this->append('
');
$this->append('- HashCode
- '.$oSlide->getHashCode().'
');
$this->append('- Slide Layout
- Layout::'.$this->getConstantName('\PhpOffice\PhpPresentation\Slide\Layout', $oSlide->getSlideLayout()).'
');
-
+
$this->append('- Offset X
- '.$oSlide->getOffsetX().'
');
$this->append('- Offset Y
- '.$oSlide->getOffsetY().'
');
$this->append('- Extent X
- '.$oSlide->getExtentX().'
');
@@ -379,6 +379,10 @@ protected function displayShapeInfo(AbstractShape $oShape)
ob_end_clean();
$this->append('- Mime-Type
- '.$oShape->getMimeType().'
');
$this->append('- Image
.';base64,'.base64_encode($sShapeImgContents).')
');
+ if ($oShape->hasHyperlink()) {
+ $this->append('- Hyperlink URL
- '.$oShape->getHyperlink()->getUrl().'
');
+ $this->append('- Hyperlink Tooltip
- '.$oShape->getHyperlink()->getTooltip().'
');
+ }
} elseif($oShape instanceof Drawing\AbstractDrawingAdapter) {
$this->append('- Name
- '.$oShape->getName().'
');
$this->append('- Description
- '.$oShape->getDescription().'
');
@@ -449,7 +453,7 @@ protected function displayShapeInfo(AbstractShape $oShape)
$this->append('
');
$this->append('');
}
-
+
protected function getConstantName($class, $search, $startWith = '') {
$fooClass = new ReflectionClass($class);
$constants = $fooClass->getConstants();
diff --git a/src/PhpPresentation/Reader/PowerPoint2007.php b/src/PhpPresentation/Reader/PowerPoint2007.php
index 2548b377f..f28425e1c 100644
--- a/src/PhpPresentation/Reader/PowerPoint2007.php
+++ b/src/PhpPresentation/Reader/PowerPoint2007.php
@@ -734,6 +734,17 @@ protected function loadShapeDrawing(XMLReader $document, \DOMElement $node, Abst
if ($oElement instanceof \DOMElement) {
$oShape->setName($oElement->hasAttribute('name') ? $oElement->getAttribute('name') : '');
$oShape->setDescription($oElement->hasAttribute('descr') ? $oElement->getAttribute('descr') : '');
+
+ // Hyperlink
+ $oElementHlinkClick = $document->getElement('a:hlinkClick', $oElement);
+ if (is_object($oElementHlinkClick)) {
+ if ($oElementHlinkClick->hasAttribute('tooltip')) {
+ $oShape->getHyperlink()->setTooltip($oElementHlinkClick->getAttribute('tooltip'));
+ }
+ if ($oElementHlinkClick->hasAttribute('r:id') && isset($this->arrayRels[$fileRels][$oElementHlinkClick->getAttribute('r:id')]['Target'])) {
+ $oShape->getHyperlink()->setUrl($this->arrayRels[$fileRels][$oElementHlinkClick->getAttribute('r:id')]['Target']);
+ }
+ }
}
$oElement = $document->getElement('p:blipFill/a:blip', $node);