Skip to content

Commit def4684

Browse files
committed
Merge pull request #195 from Progi1984/decoratorODP
PhpOffice\PhpPresentation\Writer\ODPresentation : Move to Design Patt…
2 parents 00da3e2 + ee0cb47 commit def4684

32 files changed

+960
-1463
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Fixed the image project - @mvargasmoran GH-177
77

88
### Changes
9+
- PhpOffice\PhpPresentation\Writer\ODPresentation : Move to Design Pattern Decorator - @Progi1984
910
- PhpOffice\PhpPresentation\Writer\PowerPoint2007 : Move to Design Pattern Decorator - @Progi1984
1011
- PhpOffice\PhpPresentation\Shape\Type\AbstracType\getData has been deprecated for PhpOffice\PhpPresentation\Shape\Type\AbstracType\getSeries - @Progi1984 GH-169
1112
- PhpOffice\PhpPresentation\Shape\Type\AbstracType\setData has been deprecated for PhpOffice\PhpPresentation\Shape\Type\AbstracType\setSeries - @Progi1984 GH-169
@@ -18,7 +19,7 @@
1819
- ODPresentation & PowerPoint2007 Writer : Support for images in base 64 - @Progi1984 GH-168
1920
- ODPresentation & PowerPoint2007 Writer : Marker of Series in Line & Scatter chart is customizable - @Progi1984 GH-169
2021
- ODPresentation & PowerPoint2007 Writer : Outline of Series in Line & Scatter chart is customizable - @Progi1984 GH-169
21-
- PowerPoint2007 & Serialized Writer : Support for Zip Adapter - @Progi1984 GH-176
22+
- ODPresentation & PowerPoint2007 & Serialized Writer : Support for Zip Adapter - @Progi1984 GH-176
2223
- ODPresentation & PowerPoint2007 Writer : language property to TextElement - @skrajewski & @Progi1984 GH-180
2324
- ODPresentation & PowerPoint2007 Writer : Add Font Support For Chart Axis - @jrking4 GH-186
2425

src/PhpPresentation/Shape/Chart/PlotArea.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
namespace PhpOffice\PhpPresentation\Shape\Chart;
1919

2020
use PhpOffice\PhpPresentation\ComparableInterface;
21+
use PhpOffice\PhpPresentation\Shape\Chart\Type\AbstractType;
2122

2223
/**
2324
* \PhpOffice\PhpPresentation\Shape\Chart\PlotArea
@@ -92,7 +93,7 @@ public function __clone()
9293
/**
9394
* Get type
9495
*
95-
* @return \PhpOffice\PhpPresentation\Shape\Chart\AbstractType
96+
* @return AbstractType
9697
* @throws \Exception
9798
*/
9899
public function getType()

src/PhpPresentation/Shape/Chart/Series.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public function getDataPointFill($dataPointIndex)
251251
/**
252252
* Get DataPointFills
253253
*
254-
* @return array
254+
* @return Fill[]
255255
*/
256256
public function getDataPointFills()
257257
{
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?php
2+
3+
namespace PhpOffice\PhpPresentation\Writer;
4+
5+
use PhpOffice\Common\Adapter\Zip\ZipInterface;
6+
use PhpOffice\PhpPresentation\HashTable;
7+
use PhpOffice\PhpPresentation\PhpPresentation;
8+
9+
abstract class AbstractDecoratorWriter
10+
{
11+
/**
12+
* @return ZipInterface
13+
*/
14+
abstract public function render();
15+
16+
/**
17+
* @var \PhpOffice\PhpPresentation\HashTable
18+
*/
19+
protected $oHashTable;
20+
21+
/**
22+
* @var PhpPresentation
23+
*/
24+
protected $oPresentation;
25+
26+
/**
27+
* @var ZipInterface
28+
*/
29+
protected $oZip;
30+
31+
/**
32+
* @param HashTable $hashTable
33+
* @return $this
34+
*/
35+
public function setDrawingHashTable(HashTable $hashTable)
36+
{
37+
$this->oHashTable = $hashTable;
38+
return $this;
39+
}
40+
41+
/**
42+
* @return HashTable
43+
*/
44+
public function getDrawingHashTable()
45+
{
46+
return $this->oHashTable;
47+
}
48+
49+
/**
50+
* @param PhpPresentation $oPresentation
51+
* @return $this
52+
*/
53+
public function setPresentation(PhpPresentation $oPresentation)
54+
{
55+
$this->oPresentation = $oPresentation;
56+
return $this;
57+
}
58+
59+
/**
60+
* @return PhpPresentation
61+
*/
62+
public function getPresentation()
63+
{
64+
return $this->oPresentation;
65+
}
66+
67+
/**
68+
* @param ZipInterface $oZip
69+
* @return $this
70+
*/
71+
public function setZip(ZipInterface $oZip)
72+
{
73+
$this->oZip = $oZip;
74+
return $this;
75+
}
76+
77+
/**
78+
* @return ZipInterface
79+
*/
80+
public function getZip()
81+
{
82+
return $this->oZip;
83+
}
84+
}

src/PhpPresentation/Writer/AbstractWriter.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,67 @@
33
namespace PhpOffice\PhpPresentation\Writer;
44

55
use PhpOffice\Common\Adapter\Zip\ZipInterface;
6+
use PhpOffice\PhpPresentation\PhpPresentation;
67

78
abstract class AbstractWriter
89
{
10+
/**
11+
* Private unique hash table
12+
*
13+
* @var \PhpOffice\PhpPresentation\HashTable
14+
*/
15+
protected $oDrawingHashTable;
16+
17+
/**
18+
* Private PhpPresentation
19+
*
20+
* @var PhpPresentation
21+
*/
22+
protected $oPresentation;
23+
924
/**
1025
* @var ZipInterface
1126
*/
1227
protected $oZipAdapter;
1328

29+
/**
30+
* Get drawing hash table
31+
*
32+
* @return \PhpOffice\PhpPresentation\HashTable
33+
*/
34+
public function getDrawingHashTable()
35+
{
36+
return $this->oDrawingHashTable;
37+
}
38+
39+
/**
40+
* Get PhpPresentation object
41+
*
42+
* @return PhpPresentation
43+
* @throws \Exception
44+
*/
45+
public function getPhpPresentation()
46+
{
47+
if (empty($this->oPresentation)) {
48+
throw new \Exception("No PhpPresentation assigned.");
49+
}
50+
return $this->oPresentation;
51+
}
52+
53+
/**
54+
* Get PhpPresentation object
55+
*
56+
* @param PhpPresentation $pPhpPresentation PhpPresentation object
57+
* @throws \Exception
58+
* @return \PhpOffice\PhpPresentation\Writer\ODPresentation
59+
*/
60+
public function setPhpPresentation(PhpPresentation $pPhpPresentation = null)
61+
{
62+
$this->oPresentation = $pPhpPresentation;
63+
return $this;
64+
}
65+
66+
1467
/**
1568
* @param ZipInterface $oZipAdapter
1669
* @return $this

0 commit comments

Comments
 (0)