Esempio n. 1
0
 /**
  *
  * @param \DOMElement $oNodeFrame
  */
 protected function loadShapeDrawing(\DOMElement $oNodeFrame)
 {
     // Core
     $oShape = new MemoryDrawing();
     $oShape->getShadow()->setVisible(false);
     $oNodeImage = $this->oXMLReader->getElement('draw:image', $oNodeFrame);
     if ($oNodeImage) {
         if ($oNodeImage->hasAttribute('xlink:href')) {
             $imageFile = $this->oZip->getFromName($oNodeImage->getAttribute('xlink:href'));
             if (!empty($imageFile)) {
                 $oShape->setImageResource(imagecreatefromstring($imageFile));
             }
         }
     }
     $oShape->setName($oNodeFrame->hasAttribute('draw:name') ? $oNodeFrame->getAttribute('draw:name') : '');
     $oShape->setDescription($oNodeFrame->hasAttribute('draw:name') ? $oNodeFrame->getAttribute('draw:name') : '');
     $oShape->setResizeProportional(false);
     $oShape->setWidth($oNodeFrame->hasAttribute('svg:width') ? (int) round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:width'), 0, -2))) : '');
     $oShape->setHeight($oNodeFrame->hasAttribute('svg:height') ? (int) round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:height'), 0, -2))) : '');
     $oShape->setResizeProportional(true);
     $oShape->setOffsetX($oNodeFrame->hasAttribute('svg:x') ? (int) round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:x'), 0, -2))) : '');
     $oShape->setOffsetY($oNodeFrame->hasAttribute('svg:y') ? (int) round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:y'), 0, -2))) : '');
     if ($oNodeFrame->hasAttribute('draw:style-name')) {
         $keyStyle = $oNodeFrame->getAttribute('draw:style-name');
         if (isset($this->arrayStyles[$keyStyle])) {
             $oShape->setShadow($this->arrayStyles[$keyStyle]['shadow']);
         }
     }
     $this->oPhpPresentation->getActiveSlide()->addShape($oShape);
 }