|
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\Style; |
|
19
|
|
|
|
|
20
|
|
|
use PhpOffice\PhpPresentation\ComparableInterface; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* \PhpOffice\PhpPresentation\Style\Bullet |
|
24
|
|
|
*/ |
|
25
|
|
|
class Bullet implements ComparableInterface |
|
26
|
|
|
{ |
|
27
|
|
|
/* Bullet types */ |
|
28
|
|
|
const TYPE_NONE = 'none'; |
|
29
|
|
|
const TYPE_BULLET = 'bullet'; |
|
30
|
|
|
const TYPE_NUMERIC = 'numeric'; |
|
31
|
|
|
|
|
32
|
|
|
/* Numeric bullet styles */ |
|
33
|
|
|
const NUMERIC_DEFAULT = 'arabicPeriod'; |
|
34
|
|
|
const NUMERIC_ALPHALCPARENBOTH = 'alphaLcParenBoth'; |
|
35
|
|
|
const NUMERIC_ALPHAUCPARENBOTH = 'alphaUcParenBoth'; |
|
36
|
|
|
const NUMERIC_ALPHALCPARENR = 'alphaLcParenR'; |
|
37
|
|
|
const NUMERIC_ALPHAUCPARENR = 'alphaUcParenR'; |
|
38
|
|
|
const NUMERIC_ALPHALCPERIOD = 'alphaLcPeriod'; |
|
39
|
|
|
const NUMERIC_ALPHAUCPERIOD = 'alphaUcPeriod'; |
|
40
|
|
|
const NUMERIC_ARABICPARENBOTH = 'arabicParenBoth'; |
|
41
|
|
|
const NUMERIC_ARABICPARENR = 'arabicParenR'; |
|
42
|
|
|
const NUMERIC_ARABICPERIOD = 'arabicPeriod'; |
|
43
|
|
|
const NUMERIC_ARABICPLAIN = 'arabicPlain'; |
|
44
|
|
|
const NUMERIC_ROMANLCPARENBOTH = 'romanLcParenBoth'; |
|
45
|
|
|
const NUMERIC_ROMANUCPARENBOTH = 'romanUcParenBoth'; |
|
46
|
|
|
const NUMERIC_ROMANLCPARENR = 'romanLcParenR'; |
|
47
|
|
|
const NUMERIC_ROMANUCPARENR = 'romanUcParenR'; |
|
48
|
|
|
const NUMERIC_ROMANLCPERIOD = 'romanLcPeriod'; |
|
49
|
|
|
const NUMERIC_ROMANUCPERIOD = 'romanUcPeriod'; |
|
50
|
|
|
const NUMERIC_CIRCLENUMDBPLAIN = 'circleNumDbPlain'; |
|
51
|
|
|
const NUMERIC_CIRCLENUMWDBLACKPLAIN = 'circleNumWdBlackPlain'; |
|
52
|
|
|
const NUMERIC_CIRCLENUMWDWHITEPLAIN = 'circleNumWdWhitePlain'; |
|
53
|
|
|
const NUMERIC_ARABICDBPERIOD = 'arabicDbPeriod'; |
|
54
|
|
|
const NUMERIC_ARABICDBPLAIN = 'arabicDbPlain'; |
|
55
|
|
|
const NUMERIC_EA1CHSPERIOD = 'ea1ChsPeriod'; |
|
56
|
|
|
const NUMERIC_EA1CHSPLAIN = 'ea1ChsPlain'; |
|
57
|
|
|
const NUMERIC_EA1CHTPERIOD = 'ea1ChtPeriod'; |
|
58
|
|
|
const NUMERIC_EA1CHTPLAIN = 'ea1ChtPlain'; |
|
59
|
|
|
const NUMERIC_EA1JPNCHSDBPERIOD = 'ea1JpnChsDbPeriod'; |
|
60
|
|
|
const NUMERIC_EA1JPNKORPLAIN = 'ea1JpnKorPlain'; |
|
61
|
|
|
const NUMERIC_EA1JPNKORPERIOD = 'ea1JpnKorPeriod'; |
|
62
|
|
|
const NUMERIC_ARABIC1MINUS = 'arabic1Minus'; |
|
63
|
|
|
const NUMERIC_ARABIC2MINUS = 'arabic2Minus'; |
|
64
|
|
|
const NUMERIC_HEBREW2MINUS = 'hebrew2Minus'; |
|
65
|
|
|
const NUMERIC_THAIALPHAPERIOD = 'thaiAlphaPeriod'; |
|
66
|
|
|
const NUMERIC_THAIALPHAPARENR = 'thaiAlphaParenR'; |
|
67
|
|
|
const NUMERIC_THAIALPHAPARENBOTH = 'thaiAlphaParenBoth'; |
|
68
|
|
|
const NUMERIC_THAINUMPERIOD = 'thaiNumPeriod'; |
|
69
|
|
|
const NUMERIC_THAINUMPARENR = 'thaiNumParenR'; |
|
70
|
|
|
const NUMERIC_THAINUMPARENBOTH = 'thaiNumParenBoth'; |
|
71
|
|
|
const NUMERIC_HINDIALPHAPERIOD = 'hindiAlphaPeriod'; |
|
72
|
|
|
const NUMERIC_HINDINUMPERIOD = 'hindiNumPeriod'; |
|
73
|
|
|
const NUMERIC_HINDINUMPARENR = 'hindiNumParenR'; |
|
74
|
|
|
const NUMERIC_HINDIALPHA1PERIOD = 'hindiAlpha1Period'; |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Bullet type |
|
78
|
|
|
* |
|
79
|
|
|
* @var string |
|
80
|
|
|
*/ |
|
81
|
|
|
private $bulletType = self::TYPE_NONE; |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Bullet font |
|
85
|
|
|
* |
|
86
|
|
|
* @var string |
|
87
|
|
|
*/ |
|
88
|
|
|
private $bulletFont; |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* Bullet char |
|
92
|
|
|
* |
|
93
|
|
|
* @var string |
|
94
|
|
|
*/ |
|
95
|
|
|
private $bulletChar = '-'; |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* Bullet char |
|
99
|
|
|
* |
|
100
|
|
|
* @var Color |
|
101
|
|
|
*/ |
|
102
|
|
|
private $bulletColor; |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* Bullet numeric style |
|
106
|
|
|
* |
|
107
|
|
|
* @var string |
|
108
|
|
|
*/ |
|
109
|
|
|
private $bulletNumericStyle = self::NUMERIC_DEFAULT; |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* Bullet numeric start at |
|
113
|
|
|
* |
|
114
|
|
|
* @var int |
|
115
|
|
|
*/ |
|
116
|
|
|
private $bulletNumericStartAt = 1; |
|
117
|
|
|
|
|
118
|
|
|
/** |
|
119
|
|
|
* Hash index |
|
120
|
|
|
* |
|
121
|
|
|
* @var string |
|
122
|
|
|
*/ |
|
123
|
|
|
private $hashIndex; |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* Create a new \PhpOffice\PhpPresentation\Style\Bullet |
|
127
|
|
|
*/ |
|
128
|
272 |
|
public function __construct() |
|
129
|
|
|
{ |
|
130
|
|
|
// Initialise values |
|
131
|
272 |
|
$this->bulletType = self::TYPE_NONE; |
|
132
|
272 |
|
$this->bulletFont = 'Calibri'; |
|
133
|
272 |
|
$this->bulletChar = '-'; |
|
134
|
272 |
|
$this->bulletColor = new Color(); |
|
135
|
272 |
|
$this->bulletNumericStyle = self::NUMERIC_DEFAULT; |
|
136
|
272 |
|
$this->bulletNumericStartAt = 1; |
|
137
|
272 |
|
} |
|
138
|
|
|
|
|
139
|
|
|
/** |
|
140
|
|
|
* Get bullet type |
|
141
|
|
|
* |
|
142
|
|
|
* @return string |
|
143
|
|
|
*/ |
|
144
|
52 |
|
public function getBulletType() |
|
145
|
|
|
{ |
|
146
|
52 |
|
return $this->bulletType; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* Set bullet type |
|
151
|
|
|
* |
|
152
|
|
|
* @param string $pValue |
|
153
|
|
|
* @return \PhpOffice\PhpPresentation\Style\Bullet |
|
154
|
|
|
*/ |
|
155
|
13 |
|
public function setBulletType($pValue = self::TYPE_NONE) |
|
156
|
|
|
{ |
|
157
|
13 |
|
$this->bulletType = $pValue; |
|
158
|
|
|
|
|
159
|
13 |
|
return $this; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
/** |
|
163
|
|
|
* Get bullet font |
|
164
|
|
|
* |
|
165
|
|
|
* @return string |
|
166
|
|
|
*/ |
|
167
|
18 |
|
public function getBulletFont() |
|
168
|
|
|
{ |
|
169
|
18 |
|
return $this->bulletFont; |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
/** |
|
173
|
|
|
* Set bullet font |
|
174
|
|
|
* |
|
175
|
|
|
* @param string $pValue |
|
176
|
|
|
* @return \PhpOffice\PhpPresentation\Style\Bullet |
|
177
|
|
|
*/ |
|
178
|
6 |
|
public function setBulletFont($pValue = 'Calibri') |
|
179
|
|
|
{ |
|
180
|
6 |
|
if ($pValue == '') { |
|
181
|
1 |
|
$pValue = 'Calibri'; |
|
182
|
|
|
} |
|
183
|
6 |
|
$this->bulletFont = $pValue; |
|
184
|
|
|
|
|
185
|
6 |
|
return $this; |
|
186
|
|
|
} |
|
187
|
|
|
|
|
188
|
|
|
/** |
|
189
|
|
|
* Get bullet char |
|
190
|
|
|
* |
|
191
|
|
|
* @return string |
|
192
|
|
|
*/ |
|
193
|
17 |
|
public function getBulletChar() |
|
194
|
|
|
{ |
|
195
|
17 |
|
return $this->bulletChar; |
|
196
|
|
|
} |
|
197
|
|
|
|
|
198
|
|
|
/** |
|
199
|
|
|
* Set bullet char |
|
200
|
|
|
* |
|
201
|
|
|
* @param string $pValue |
|
202
|
|
|
* @return \PhpOffice\PhpPresentation\Style\Bullet |
|
203
|
|
|
*/ |
|
204
|
7 |
|
public function setBulletChar($pValue = '-') |
|
205
|
|
|
{ |
|
206
|
7 |
|
$this->bulletChar = $pValue; |
|
207
|
|
|
|
|
208
|
7 |
|
return $this; |
|
209
|
|
|
} |
|
210
|
|
|
|
|
211
|
|
|
/** |
|
212
|
|
|
* Get bullet numeric style |
|
213
|
|
|
* |
|
214
|
|
|
* @return string |
|
215
|
|
|
*/ |
|
216
|
3 |
|
public function getBulletNumericStyle() |
|
217
|
|
|
{ |
|
218
|
3 |
|
return $this->bulletNumericStyle; |
|
219
|
|
|
} |
|
220
|
|
|
|
|
221
|
|
|
/** |
|
222
|
|
|
* Set bullet numeric style |
|
223
|
|
|
* |
|
224
|
|
|
* @param string $pValue |
|
225
|
|
|
* @return \PhpOffice\PhpPresentation\Style\Bullet |
|
226
|
|
|
*/ |
|
227
|
2 |
|
public function setBulletNumericStyle($pValue = self::NUMERIC_DEFAULT) |
|
228
|
|
|
{ |
|
229
|
2 |
|
$this->bulletNumericStyle = $pValue; |
|
230
|
|
|
|
|
231
|
2 |
|
return $this; |
|
232
|
|
|
} |
|
233
|
|
|
|
|
234
|
|
|
/** |
|
235
|
|
|
* Get bullet numeric start at |
|
236
|
|
|
* |
|
237
|
|
|
* @return string |
|
238
|
|
|
*/ |
|
239
|
3 |
|
public function getBulletNumericStartAt() |
|
240
|
|
|
{ |
|
241
|
3 |
|
return $this->bulletNumericStartAt; |
|
242
|
|
|
} |
|
243
|
|
|
|
|
244
|
|
|
/** |
|
245
|
|
|
* Set bullet numeric start at |
|
246
|
|
|
* |
|
247
|
|
|
* @param int|string $pValue |
|
248
|
|
|
* @return \PhpOffice\PhpPresentation\Style\Bullet |
|
249
|
|
|
*/ |
|
250
|
2 |
|
public function setBulletNumericStartAt($pValue = 1) |
|
251
|
|
|
{ |
|
252
|
2 |
|
$this->bulletNumericStartAt = $pValue; |
|
253
|
|
|
|
|
254
|
2 |
|
return $this; |
|
255
|
|
|
} |
|
256
|
|
|
|
|
257
|
|
|
/** |
|
258
|
|
|
* Get hash code |
|
259
|
|
|
* |
|
260
|
|
|
* @return string Hash code |
|
261
|
|
|
*/ |
|
262
|
14 |
|
public function getHashCode() |
|
263
|
|
|
{ |
|
264
|
14 |
|
return md5( |
|
265
|
14 |
|
$this->bulletType |
|
266
|
14 |
|
. $this->bulletFont |
|
267
|
14 |
|
. $this->bulletChar |
|
268
|
14 |
|
. $this->bulletNumericStyle |
|
269
|
14 |
|
. $this->bulletNumericStartAt |
|
270
|
14 |
|
. __CLASS__ |
|
271
|
|
|
); |
|
272
|
|
|
} |
|
273
|
|
|
|
|
274
|
|
|
/** |
|
275
|
|
|
* Get hash index |
|
276
|
|
|
* |
|
277
|
|
|
* Note that this index may vary during script execution! Only reliable moment is |
|
278
|
|
|
* while doing a write of a workbook and when changes are not allowed. |
|
279
|
|
|
* |
|
280
|
|
|
* @return string Hash index |
|
281
|
|
|
*/ |
|
282
|
1 |
|
public function getHashIndex() |
|
283
|
|
|
{ |
|
284
|
1 |
|
return $this->hashIndex; |
|
285
|
|
|
} |
|
286
|
|
|
|
|
287
|
|
|
/** |
|
288
|
|
|
* Set hash index |
|
289
|
|
|
* |
|
290
|
|
|
* Note that this index may vary during script execution! Only reliable moment is |
|
291
|
|
|
* while doing a write of a workbook and when changes are not allowed. |
|
292
|
|
|
* |
|
293
|
|
|
* @param string $value Hash index |
|
294
|
|
|
*/ |
|
295
|
1 |
|
public function setHashIndex($value) |
|
296
|
|
|
{ |
|
297
|
1 |
|
$this->hashIndex = $value; |
|
298
|
1 |
|
} |
|
299
|
|
|
|
|
300
|
|
|
/** |
|
301
|
|
|
* @return Color |
|
302
|
|
|
*/ |
|
303
|
3 |
|
public function getBulletColor() |
|
304
|
|
|
{ |
|
305
|
3 |
|
return $this->bulletColor; |
|
306
|
|
|
} |
|
307
|
|
|
|
|
308
|
|
|
/** |
|
309
|
|
|
* @param Color $bulletColor |
|
310
|
|
|
* @return Bullet |
|
311
|
|
|
*/ |
|
312
|
2 |
|
public function setBulletColor(Color $bulletColor) |
|
313
|
|
|
{ |
|
314
|
2 |
|
$this->bulletColor = $bulletColor; |
|
315
|
2 |
|
return $this; |
|
316
|
|
|
} |
|
317
|
|
|
} |
|
318
|
|
|
|