PluginProbe
TablePress – Tables in WordPress made easy / 3.4
TablePress – Tables in WordPress made easy v3.4
3.4 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 All 45 releases
tablepress / libraries / vendor / PhpSpreadsheet / Shared / Escher / DgContainer / SpgrContainer / SpContainer.php

SpContainer.php in TablePress – Tables in WordPress made easy 3.4, at libraries/vendor/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php

315 lines 6.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace TablePress\PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer;
4
5 use TablePress\PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer;
6
7 class SpContainer
8 {
9 /**
10 * Parent Shape Group Container.
11 */
12 private SpgrContainer $parent;
13
14 /**
15 * Is this a group shape?
16 */
17 private bool $spgr = false;
18
19 /**
20 * Shape type.
21 */
22 private int $spType;
23
24 /**
25 * Shape flag.
26 */
27 private int $spFlag;
28
29 /**
30 * Shape index (usually group shape has index 0, and the rest: 1,2,3...).
31 */
32 private int $spId;
33
34 /**
35 * Array of options.
36 *
37 * @var mixed[]
38 */
39 private array $OPT = [];
40
41 /**
42 * Cell coordinates of upper-left corner of shape, e.g. 'A1'.
43 */
44 private string $startCoordinates = '';
45
46 /**
47 * Horizontal offset of upper-left corner of shape measured in 1/1024 of column width.
48 * @var int|float
49 */
50 private $startOffsetX;
51
52 /**
53 * Vertical offset of upper-left corner of shape measured in 1/256 of row height.
54 * @var int|float
55 */
56 private $startOffsetY;
57
58 /**
59 * Cell coordinates of bottom-right corner of shape, e.g. 'B2'.
60 */
61 private string $endCoordinates;
62
63 /**
64 * Horizontal offset of bottom-right corner of shape measured in 1/1024 of column width.
65 * @var int|float
66 */
67 private $endOffsetX;
68
69 /**
70 * Vertical offset of bottom-right corner of shape measured in 1/256 of row height.
71 * @var int|float
72 */
73 private $endOffsetY;
74
75 /**
76 * Set parent Shape Group Container.
77 */
78 public function setParent(SpgrContainer $parent): void
79 {
80 $this->parent = $parent;
81 }
82
83 /**
84 * Get the parent Shape Group Container.
85 */
86 public function getParent(): SpgrContainer
87 {
88 return $this->parent;
89 }
90
91 /**
92 * Set whether this is a group shape.
93 */
94 public function setSpgr(bool $value): void
95 {
96 $this->spgr = $value;
97 }
98
99 /**
100 * Get whether this is a group shape.
101 */
102 public function getSpgr(): bool
103 {
104 return $this->spgr;
105 }
106
107 /**
108 * Set the shape type.
109 */
110 public function setSpType(int $value): void
111 {
112 $this->spType = $value;
113 }
114
115 /**
116 * Get the shape type.
117 */
118 public function getSpType(): int
119 {
120 return $this->spType;
121 }
122
123 /**
124 * Set the shape flag.
125 */
126 public function setSpFlag(int $value): void
127 {
128 $this->spFlag = $value;
129 }
130
131 /**
132 * Get the shape flag.
133 */
134 public function getSpFlag(): int
135 {
136 return $this->spFlag;
137 }
138
139 /**
140 * Set the shape index.
141 */
142 public function setSpId(int $value): void
143 {
144 $this->spId = $value;
145 }
146
147 /**
148 * Get the shape index.
149 */
150 public function getSpId(): int
151 {
152 return $this->spId;
153 }
154
155 /**
156 * Set an option for the Shape Group Container.
157 *
158 * @param int $property The number specifies the option
159 * @param mixed $value
160 */
161 public function setOPT(int $property, $value): void
162 {
163 $this->OPT[$property] = $value;
164 }
165
166 /**
167 * Get an option for the Shape Group Container.
168 *
169 * @param int $property The number specifies the option
170 * @return mixed
171 */
172 public function getOPT(int $property)
173 {
174 return $this->OPT[$property] ?? null;
175 }
176
177 /**
178 * Get the collection of options.
179 *
180 * @return mixed[]
181 */
182 public function getOPTCollection(): array
183 {
184 return $this->OPT;
185 }
186
187 /**
188 * Set cell coordinates of upper-left corner of shape.
189 *
190 * @param string $value eg: 'A1'
191 */
192 public function setStartCoordinates(string $value): void
193 {
194 $this->startCoordinates = $value;
195 }
196
197 /**
198 * Get cell coordinates of upper-left corner of shape.
199 */
200 public function getStartCoordinates(): string
201 {
202 return $this->startCoordinates;
203 }
204
205 /**
206 * Set offset in x-direction of upper-left corner of shape measured in 1/1024 of column width.
207 * @param int|float $startOffsetX
208 */
209 public function setStartOffsetX($startOffsetX): void
210 {
211 $this->startOffsetX = $startOffsetX;
212 }
213
214 /**
215 * Get offset in x-direction of upper-left corner of shape measured in 1/1024 of column width.
216 * @return int|float
217 */
218 public function getStartOffsetX()
219 {
220 return $this->startOffsetX;
221 }
222
223 /**
224 * Set offset in y-direction of upper-left corner of shape measured in 1/256 of row height.
225 * @param int|float $startOffsetY
226 */
227 public function setStartOffsetY($startOffsetY): void
228 {
229 $this->startOffsetY = $startOffsetY;
230 }
231
232 /**
233 * Get offset in y-direction of upper-left corner of shape measured in 1/256 of row height.
234 * @return int|float
235 */
236 public function getStartOffsetY()
237 {
238 return $this->startOffsetY;
239 }
240
241 /**
242 * Set cell coordinates of bottom-right corner of shape.
243 *
244 * @param string $value eg: 'A1'
245 */
246 public function setEndCoordinates(string $value): void
247 {
248 $this->endCoordinates = $value;
249 }
250
251 /**
252 * Get cell coordinates of bottom-right corner of shape.
253 */
254 public function getEndCoordinates(): string
255 {
256 return $this->endCoordinates;
257 }
258
259 /**
260 * Set offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width.
261 * @param int|float $endOffsetX
262 */
263 public function setEndOffsetX($endOffsetX): void
264 {
265 $this->endOffsetX = $endOffsetX;
266 }
267
268 /**
269 * Get offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width.
270 * @return int|float
271 */
272 public function getEndOffsetX()
273 {
274 return $this->endOffsetX;
275 }
276
277 /**
278 * Set offset in y-direction of bottom-right corner of shape measured in 1/256 of row height.
279 * @param int|float $endOffsetY
280 */
281 public function setEndOffsetY($endOffsetY): void
282 {
283 $this->endOffsetY = $endOffsetY;
284 }
285
286 /**
287 * Get offset in y-direction of bottom-right corner of shape measured in 1/256 of row height.
288 * @return int|float
289 */
290 public function getEndOffsetY()
291 {
292 return $this->endOffsetY;
293 }
294
295 /**
296 * Get the nesting level of this spContainer. This is the number of spgrContainers between this spContainer and
297 * the dgContainer. A value of 1 = immediately within first spgrContainer
298 * Higher nesting level occurs if and only if spContainer is part of a shape group.
299 *
300 * @return int Nesting level
301 */
302 public function getNestingLevel(): int
303 {
304 $nestingLevel = 0;
305
306 $parent = $this->getParent();
307 while ($parent instanceof SpgrContainer) {
308 ++$nestingLevel;
309 $parent = $parent->getParent();
310 }
311
312 return $nestingLevel;
313 }
314 }
315