Skip to content

Commit f5b44fe

Browse files
committed
#161 : Fix for validating ppt\theme1.xml with OpenXML SDK Validatorl
1 parent 76ef8f3 commit f5b44fe

File tree

4 files changed

+684
-13
lines changed

4 files changed

+684
-13
lines changed

src/PhpPresentation/Slide/SlideMaster.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,23 @@ class SlideMaster extends AbstractSlide implements ComparableInterface, ShapeCon
5050
* @var \PhpOffice\PhpPresentation\Style\SchemeColor[]
5151
*/
5252
protected $arraySchemeColor = array();
53+
/**
54+
* @var array
55+
*/
56+
protected $defaultSchemeColor = array(
57+
'dk1' => '000000',
58+
'lt1' => 'FFFFFF',
59+
'dk2' => '1F497D',
60+
'lt2' => 'EEECE1',
61+
'accent1' => '4F81BD',
62+
'accent2' => 'C0504D',
63+
'accent3' => '9BBB59',
64+
'accent4' => '8064A2',
65+
'accent5' => '4BACC6',
66+
'accent6' => 'F79646',
67+
'hlink' => '0000FF',
68+
'folHlink' => '800080',
69+
);
5370

5471
/**
5572
* Create a new slideMaster
@@ -71,6 +88,13 @@ public function __construct(PhpPresentation $pParent = null)
7188
$this->background->setColor(new Color(Color::COLOR_WHITE));
7289
// Set basic textStyles
7390
$this->textStyles = new TextStyle(true);
91+
// Set basic scheme colors
92+
foreach ($this->defaultSchemeColor as $key => $value) {
93+
$oSchemeColor = new SchemeColor();
94+
$oSchemeColor->setValue($key);
95+
$oSchemeColor->setRGB($value);
96+
$this->addSchemeColor($oSchemeColor);
97+
}
7498
}
7599

76100
/**
@@ -130,7 +154,7 @@ public function setTextStyles(TextStyle $textStyle)
130154
*/
131155
public function addSchemeColor(SchemeColor $schemeColor)
132156
{
133-
$this->arraySchemeColor[] = $schemeColor;
157+
$this->arraySchemeColor[$schemeColor->getValue()] = $schemeColor;
134158
return $this;
135159
}
136160

src/PhpPresentation/Writer/PowerPoint2007/PptSlides.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ protected function writeSlideRelationships(Slide $pSlide)
7878
$idxSlide = $pSlide->getParent()->getIndex($pSlide);
7979

8080
// Write slideLayout relationship
81-
if (($pSlide->getSlideLayout())) {
81+
if ($pSlide->getSlideLayout()) {
8282
$layoutId = $pSlide->getSlideLayout()->layoutNr;
8383
$this->writeRelationship($objWriter, $relId++, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout', '../slideLayouts/slideLayout' . $layoutId . '.xml');
8484
}

0 commit comments

Comments
 (0)