/** * Create a new slideMaster * * @param PhpPresentation $pParent */ public function __construct(PhpPresentation $pParent = null) { // Set parent $this->parent = $pParent; // Shape collection $this->shapeCollection = new \ArrayObject(); // Set identifier $this->identifier = md5(rand(0, 9999) . time()); // Set a basic colorMap $this->colorMap = new ColorMap(); // Set a white background $this->background = new BackgroundColor(); $this->background->setColor(new Color(Color::COLOR_WHITE)); // Set basic textStyles $this->textStyles = new TextStyle(true); // Set basic scheme colors foreach ($this->defaultSchemeColor as $key => $value) { $oSchemeColor = new SchemeColor(); $oSchemeColor->setValue($key); $oSchemeColor->setRGB($value); $this->addSchemeColor($oSchemeColor); } }
/** * @param string $sPart * @param SlideMaster $oSlideMaster */ private function loadTheme($sPart, SlideMaster $oSlideMaster) { $xmlReader = new XMLReader(); if ($xmlReader->getDomFromString($sPart)) { $oElements = $xmlReader->getElements('/a:theme/a:themeElements/a:clrScheme/*'); if ($oElements) { foreach ($oElements as $oElement) { $oSchemeColor = new SchemeColor(); $oSchemeColor->setValue(str_replace('a:', '', $oElement->tagName)); $colorElement = $xmlReader->getElement('*', $oElement); if ($colorElement) { if ($colorElement->hasAttribute('lastClr')) { $oSchemeColor->setRGB($colorElement->getAttribute('lastClr')); } elseif ($colorElement->hasAttribute('val')) { $oSchemeColor->setRGB($colorElement->getAttribute('val')); } } $oSlideMaster->addSchemeColor($oSchemeColor); } } } }