|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of PHPPresentation - A pure PHP library for reading and writing |
|
4
|
|
|
* presentations documents. |
|
5
|
|
|
* |
|
6
|
|
|
* PHPPresentation is free software distributed under the terms of the GNU Lesser |
|
7
|
|
|
* General Public License version 3 as published by the Free Software Foundation. |
|
8
|
|
|
* |
|
9
|
|
|
* For the full copyright and license information, please read the LICENSE |
|
10
|
|
|
* file that was distributed with this source code. For the full list of |
|
11
|
|
|
* contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors. |
|
12
|
|
|
* |
|
13
|
|
|
* @link https://github.com/PHPOffice/PHPPresentation |
|
14
|
|
|
* @copyright 2009-2015 PHPPresentation contributors |
|
15
|
|
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 |
|
16
|
|
|
*/ |
|
17
|
|
|
|
|
18
|
|
|
namespace PhpOffice\PhpPresentation; |
|
19
|
|
|
|
|
20
|
|
|
use PhpOffice\PhpPresentation\Shape\Chart; |
|
21
|
|
|
use PhpOffice\PhpPresentation\Shape\RichText; |
|
22
|
|
|
use PhpOffice\PhpPresentation\Shape\Table; |
|
23
|
|
|
use PhpOffice\PhpPresentation\Slide\AbstractSlide; |
|
24
|
|
|
use PhpOffice\PhpPresentation\Slide\Note; |
|
25
|
|
|
use PhpOffice\PhpPresentation\Slide\SlideLayout; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Slide class |
|
29
|
|
|
*/ |
|
30
|
|
|
class Slide extends AbstractSlide implements ComparableInterface, ShapeContainerInterface |
|
31
|
|
|
{ |
|
32
|
|
|
/** |
|
33
|
|
|
* The slide is shown in presentation |
|
34
|
|
|
* @var bool |
|
35
|
|
|
*/ |
|
36
|
|
|
protected $isVisible = true; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Slide layout |
|
40
|
|
|
* |
|
41
|
|
|
* @var SlideLayout |
|
42
|
|
|
*/ |
|
43
|
|
|
private $slideLayout; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Slide master id |
|
47
|
|
|
* |
|
48
|
|
|
* @var integer |
|
49
|
|
|
*/ |
|
50
|
|
|
private $slideMasterId = 1; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* |
|
54
|
|
|
* @var \PhpOffice\PhpPresentation\Slide\Note |
|
55
|
|
|
*/ |
|
56
|
|
|
private $slideNote; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* |
|
60
|
|
|
* @var \PhpOffice\PhpPresentation\Slide\Animation[] |
|
61
|
|
|
*/ |
|
62
|
|
|
protected $animations = array(); |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* Name of the title |
|
66
|
|
|
* |
|
67
|
|
|
* @var string |
|
68
|
|
|
*/ |
|
69
|
|
|
protected $name; |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* Create a new slide |
|
73
|
|
|
* |
|
74
|
|
|
* @param PhpPresentation $pParent |
|
75
|
|
|
*/ |
|
76
|
|
|
public function __construct(PhpPresentation $pParent = null) |
|
77
|
|
|
{ |
|
78
|
|
|
// Set parent |
|
79
|
|
|
$this->parent = $pParent; |
|
80
|
|
|
// Shape collection |
|
81
|
|
|
$this->shapeCollection = new \ArrayObject(); |
|
82
|
|
|
// Set identifier |
|
83
|
|
|
$this->identifier = md5(rand(0, 9999) . time()); |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* Get slide layout |
|
88
|
|
|
* |
|
89
|
|
|
* @return SlideLayout |
|
90
|
|
|
*/ |
|
91
|
|
|
public function getSlideLayout() |
|
92
|
|
|
{ |
|
93
|
|
|
return $this->slideLayout; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* Set slide layout |
|
98
|
|
|
* |
|
99
|
|
|
* @param SlideLayout $layout |
|
100
|
|
|
* @return \PhpOffice\PhpPresentation\Slide |
|
101
|
|
|
*/ |
|
102
|
|
|
public function setSlideLayout(SlideLayout $layout) |
|
103
|
|
|
{ |
|
104
|
|
|
$this->slideLayout = $layout; |
|
105
|
|
|
return $this; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* Get slide master id |
|
110
|
|
|
* |
|
111
|
|
|
* @return int |
|
112
|
|
|
*/ |
|
113
|
|
|
public function getSlideMasterId() |
|
114
|
|
|
{ |
|
115
|
|
|
return $this->slideMasterId; |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
/** |
|
119
|
|
|
* Set slide master id |
|
120
|
|
|
* |
|
121
|
|
|
* @param int $masterId |
|
122
|
|
|
* @return \PhpOffice\PhpPresentation\Slide |
|
123
|
|
|
*/ |
|
124
|
|
|
public function setSlideMasterId($masterId = 1) |
|
125
|
|
|
{ |
|
126
|
|
|
$this->slideMasterId = $masterId; |
|
127
|
|
|
|
|
128
|
|
|
return $this; |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
/** |
|
132
|
|
|
* Copy slide (!= clone!) |
|
133
|
|
|
* |
|
134
|
|
|
* @return \PhpOffice\PhpPresentation\Slide |
|
135
|
|
|
*/ |
|
136
|
|
|
public function copy() |
|
137
|
|
|
{ |
|
138
|
|
|
$copied = clone $this; |
|
139
|
|
|
|
|
140
|
|
|
return $copied; |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
/** |
|
144
|
|
|
* |
|
145
|
|
|
* @return \PhpOffice\PhpPresentation\Slide\Note |
|
146
|
|
|
*/ |
|
147
|
|
|
public function getNote() |
|
148
|
|
|
{ |
|
149
|
|
|
if (is_null($this->slideNote)) { |
|
150
|
206 |
|
$this->setNote(); |
|
151
|
|
|
} |
|
152
|
|
|
return $this->slideNote; |
|
153
|
206 |
|
} |
|
154
|
|
|
|
|
155
|
206 |
|
/** |
|
156
|
|
|
* |
|
157
|
|
|
* @param \PhpOffice\PhpPresentation\Slide\Note $note |
|
158
|
206 |
|
* @return \PhpOffice\PhpPresentation\Slide |
|
159
|
|
|
*/ |
|
160
|
|
|
public function setNote(Note $note = null) |
|
161
|
206 |
|
{ |
|
162
|
206 |
|
$this->slideNote = (is_null($note) ? new Note() : $note); |
|
163
|
|
|
$this->slideNote->setParent($this); |
|
164
|
|
|
|
|
165
|
|
|
return $this; |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
174 |
|
* Get the name of the slide |
|
170
|
|
|
* @return string |
|
171
|
174 |
|
*/ |
|
172
|
|
|
public function getName() |
|
173
|
|
|
{ |
|
174
|
|
|
return $this->name; |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
/** |
|
178
|
|
|
* Set the name of the slide |
|
179
|
|
|
* @param string $name |
|
180
|
140 |
|
* @return $this |
|
181
|
|
|
*/ |
|
182
|
140 |
|
public function setName($name = null) |
|
183
|
|
|
{ |
|
184
|
140 |
|
$this->name = $name; |
|
185
|
|
|
return $this; |
|
186
|
|
|
} |
|
187
|
|
|
|
|
188
|
|
|
/** |
|
189
|
|
|
* @return boolean |
|
190
|
|
|
*/ |
|
191
|
|
|
public function isVisible() |
|
192
|
42 |
|
{ |
|
193
|
|
|
return $this->isVisible; |
|
194
|
42 |
|
} |
|
195
|
42 |
|
|
|
196
|
|
|
/** |
|
197
|
42 |
|
* @param boolean $value |
|
198
|
|
|
* @return Slide |
|
199
|
|
|
*/ |
|
200
|
|
|
public function setIsVisible($value = true) |
|
201
|
|
|
{ |
|
202
|
|
|
$this->isVisible = (bool)$value; |
|
203
|
|
|
return $this; |
|
204
|
|
|
} |
|
205
|
|
|
|
|
206
|
|
|
/** |
|
207
|
|
|
* Add an animation to the slide |
|
208
|
|
|
* |
|
209
|
2 |
|
* @param \PhpOffice\PhpPresentation\Slide\Animation |
|
210
|
|
|
* @return Slide |
|
211
|
2 |
|
*/ |
|
212
|
2 |
|
public function addAnimation($animation) |
|
213
|
|
|
{ |
|
214
|
2 |
|
$this->animations[] = $animation; |
|
215
|
|
|
return $this; |
|
216
|
|
|
} |
|
217
|
|
|
|
|
218
|
|
|
/** |
|
219
|
|
|
* Get collection of animations |
|
220
|
|
|
* |
|
221
|
|
|
* @return \PhpOffice\PhpPresentation\Slide\Animation[] |
|
222
|
46 |
|
*/ |
|
223
|
|
|
public function getAnimations() |
|
224
|
46 |
|
{ |
|
225
|
46 |
|
return $this->animations; |
|
226
|
|
|
} |
|
227
|
46 |
|
|
|
228
|
|
|
/** |
|
229
|
|
|
* Set collection of animations |
|
230
|
|
|
* @param \PhpOffice\PhpPresentation\Slide\Animation[] $array |
|
231
|
|
|
* @return Slide |
|
232
|
|
|
*/ |
|
233
|
|
|
public function setAnimations(array $array = array()) |
|
234
|
|
|
{ |
|
235
|
13 |
|
$this->animations = $array; |
|
236
|
|
|
return $this; |
|
237
|
13 |
|
} |
|
238
|
|
|
} |
|
239
|
|
|
|