ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
GridLines.php
Go to the documentation of this file.
1<?php
2require_once 'Properties.php';
12
23 private
26 'color' => array(
27 'type' => self::EXCEL_COLOR_TYPE_STANDARD,
28 'value' => NULL,
29 'alpha' => 0
30 ),
31 'style' => array(
32 'width' => '9525',
33 'compound' => self::LINE_STYLE_COMPOUND_SIMPLE,
34 'dash' => self::LINE_STYLE_DASH_SOLID,
35 'cap' => self::LINE_STYLE_CAP_FLAT,
36 'join' => self::LINE_STYLE_JOIN_BEVEL,
37 'arrow' => array(
38 'head' => array(
39 'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
40 'size' => self::LINE_STYLE_ARROW_SIZE_5
41 ),
42 'end' => array(
43 'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
44 'size' => self::LINE_STYLE_ARROW_SIZE_8
45 ),
46 )
47 )
48 ),
50 'presets' => self::SHADOW_PRESETS_NOSHADOW,
51 'effect' => NULL,
52 'color' => array(
53 'type' => self::EXCEL_COLOR_TYPE_STANDARD,
54 'value' => 'black',
55 'alpha' => 85,
56 ),
57 'size' => array(
58 'sx' => NULL,
59 'sy' => NULL,
60 'kx' => NULL
61 ),
62 'blur' => NULL,
63 'direction' => NULL,
64 'distance' => NULL,
65 'algn' => NULL,
66 'rotWithShape' => NULL
67 ),
69 'size' => NULL,
70 'color' => array(
71 'type' => self::EXCEL_COLOR_TYPE_STANDARD,
72 'value' => 'black',
73 'alpha' => 40
74 )
75 ),
76 $_soft_edges = array(
77 'size' => NULL
78 );
79
86 public function getObjectState() {
88 }
89
96 private function _activateObject() {
97 $this->_object_state = TRUE;
98
99 return $this;
100 }
101
110 public function setLineColorProperties($value, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_STANDARD) {
111 $this
112 ->_activateObject()
113 ->_line_properties['color'] = $this->setColorProperties(
114 $value,
115 $alpha,
116 $type);
117 }
118
133 public function setLineStyleProperties($line_width = NULL, $compound_type = NULL, $dash_type = NULL, $cap_type = NULL, $join_type = NULL, $head_arrow_type = NULL, $head_arrow_size = NULL, $end_arrow_type = NULL, $end_arrow_size = NULL) {
134 $this->_activateObject();
135 (!is_null($line_width))
136 ? $this->_line_properties['style']['width'] = $this->getExcelPointsWidth((float) $line_width)
137 : NULL;
138 (!is_null($compound_type))
139 ? $this->_line_properties['style']['compound'] = (string) $compound_type
140 : NULL;
141 (!is_null($dash_type))
142 ? $this->_line_properties['style']['dash'] = (string) $dash_type
143 : NULL;
144 (!is_null($cap_type))
145 ? $this->_line_properties['style']['cap'] = (string) $cap_type
146 : NULL;
147 (!is_null($join_type))
148 ? $this->_line_properties['style']['join'] = (string) $join_type
149 : NULL;
150 (!is_null($head_arrow_type))
151 ? $this->_line_properties['style']['arrow']['head']['type'] = (string) $head_arrow_type
152 : NULL;
153 (!is_null($head_arrow_size))
154 ? $this->_line_properties['style']['arrow']['head']['size'] = (string) $head_arrow_size
155 : NULL;
156 (!is_null($end_arrow_type))
157 ? $this->_line_properties['style']['arrow']['end']['type'] = (string) $end_arrow_type
158 : NULL;
159 (!is_null($end_arrow_size))
160 ? $this->_line_properties['style']['arrow']['end']['size'] = (string) $end_arrow_size
161 : NULL;
162 }
163
172 public function getLineColorProperty($parameter) {
173 return $this->_line_properties['color'][$parameter];
174 }
175
184 public function getLineStyleProperty($elements) {
185 return $this->getArrayElementsValue($this->_line_properties['style'], $elements);
186 }
187
198 public function setGlowProperties($size, $color_value = NULL, $color_alpha = NULL, $color_type = NULL) {
199 $this
200 ->_activateObject()
201 ->_setGlowSize($size)
202 ->_setGlowColor($color_value, $color_alpha, $color_type);
203 }
204
213 public function getGlowColor($property) {
214 return $this->_glow_properties['color'][$property];
215 }
216
223 public function getGlowSize() {
224 return $this->_glow_properties['size'];
225 }
226
235 private function _setGlowSize($size) {
236 $this->_glow_properties['size'] = $this->getExcelPointsWidth((float) $size);
237
238 return $this;
239 }
240
251 private function _setGlowColor($color, $alpha, $type) {
252 if (!is_null($color)) {
253 $this->_glow_properties['color']['value'] = (string) $color;
254 }
255 if (!is_null($alpha)) {
256 $this->_glow_properties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
257 }
258 if (!is_null($type)) {
259 $this->_glow_properties['color']['type'] = (string) $type;
260 }
261
262 return $this;
263 }
264
274 public function getLineStyleArrowParameters($arrow_selector, $property_selector) {
275 return $this->getLineStyleArrowSize($this->_line_properties['style']['arrow'][$arrow_selector]['size'], $property_selector);
276 }
277
291 public function setShadowProperties($sh_presets, $sh_color_value = NULL, $sh_color_type = NULL, $sh_color_alpha = NULL, $sh_blur = NULL, $sh_angle = NULL, $sh_distance = NULL) {
292 $this
293 ->_activateObject()
294 ->_setShadowPresetsProperties((int) $sh_presets)
295 ->_setShadowColor(
296 is_null($sh_color_value) ? $this->_shadow_properties['color']['value'] : $sh_color_value
297 , is_null($sh_color_alpha) ? (int) $this->_shadow_properties['color']['alpha']
298 : $this->getTrueAlpha($sh_color_alpha)
299 , is_null($sh_color_type) ? $this->_shadow_properties['color']['type'] : $sh_color_type)
300 ->_setShadowBlur($sh_blur)
301 ->_setShadowAngle($sh_angle)
302 ->_setShadowDistance($sh_distance);
303 }
304
313 private function _setShadowPresetsProperties($shadow_presets) {
314 $this->_shadow_properties['presets'] = $shadow_presets;
315 $this->_setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
316
317 return $this;
318 }
319
329 private function _setShadowProperiesMapValues(array $properties_map, &$reference = NULL) {
330 $base_reference = $reference;
331 foreach ($properties_map as $property_key => $property_val) {
332 if (is_array($property_val)) {
333 if ($reference === NULL) {
334 $reference = & $this->_shadow_properties[$property_key];
335 } else {
336 $reference = & $reference[$property_key];
337 }
338 $this->_setShadowProperiesMapValues($property_val, $reference);
339 } else {
340 if ($base_reference === NULL) {
341 $this->_shadow_properties[$property_key] = $property_val;
342 } else {
343 $reference[$property_key] = $property_val;
344 }
345 }
346 }
347
348 return $this;
349 }
350
361 private function _setShadowColor($color, $alpha, $type) {
362 if (!is_null($color)) {
363 $this->_shadow_properties['color']['value'] = (string) $color;
364 }
365 if (!is_null($alpha)) {
366 $this->_shadow_properties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
367 }
368 if (!is_null($type)) {
369 $this->_shadow_properties['color']['type'] = (string) $type;
370 }
371
372 return $this;
373 }
374
383 private function _setShadowBlur($blur) {
384 if ($blur !== NULL) {
385 $this->_shadow_properties['blur'] = (string) $this->getExcelPointsWidth($blur);
386 }
387
388 return $this;
389 }
390
399 private function _setShadowAngle($angle) {
400 if ($angle !== NULL) {
401 $this->_shadow_properties['direction'] = (string) $this->getExcelPointsAngle($angle);
402 }
403
404 return $this;
405 }
406
415 private function _setShadowDistance($distance) {
416 if ($distance !== NULL) {
417 $this->_shadow_properties['distance'] = (string) $this->getExcelPointsWidth($distance);
418 }
419
420 return $this;
421 }
422
432 public function getShadowProperty($elements) {
433 return $this->getArrayElementsValue($this->_shadow_properties, $elements);
434 }
435
442 public function setSoftEdgesSize($size) {
443 if (!is_null($size)) {
444 $this->_activateObject();
445 $_soft_edges['size'] = (string) $this->getExcelPointsWidth($size);
446 }
447 }
448
455 public function getSoftEdgesSize() {
456 return $this->_soft_edges['size'];
457 }
458}
$size
Definition: RandomTest.php:84
An exception for terminatinating execution or to throw for unit testing.
Created by PhpStorm.
Definition: GridLines.php:11
_activateObject()
Change Object State to True.
Definition: GridLines.php:96
getGlowSize()
Get Glow Size.
Definition: GridLines.php:223
_setShadowPresetsProperties($shadow_presets)
Set Shadow Presets Properties.
Definition: GridLines.php:313
_setShadowAngle($angle)
Set Shadow Angle.
Definition: GridLines.php:399
_setShadowBlur($blur)
Set Shadow Blur.
Definition: GridLines.php:383
getLineColorProperty($parameter)
Get Line Color Property.
Definition: GridLines.php:172
setGlowProperties($size, $color_value=NULL, $color_alpha=NULL, $color_type=NULL)
Set Glow Properties.
Definition: GridLines.php:198
getObjectState()
Get Object State.
Definition: GridLines.php:86
getLineStyleProperty($elements)
Get Line Style Property.
Definition: GridLines.php:184
setLineStyleProperties($line_width=NULL, $compound_type=NULL, $dash_type=NULL, $cap_type=NULL, $join_type=NULL, $head_arrow_type=NULL, $head_arrow_size=NULL, $end_arrow_type=NULL, $end_arrow_size=NULL)
Set Line Color Properties.
Definition: GridLines.php:133
setLineColorProperties($value, $alpha=0, $type=self::EXCEL_COLOR_TYPE_STANDARD)
Set Line Color Properties.
Definition: GridLines.php:110
getLineStyleArrowParameters($arrow_selector, $property_selector)
Get Line Style Arrow Parameters.
Definition: GridLines.php:274
_setGlowSize($size)
Set Glow Size.
Definition: GridLines.php:235
setShadowProperties($sh_presets, $sh_color_value=NULL, $sh_color_type=NULL, $sh_color_alpha=NULL, $sh_blur=NULL, $sh_angle=NULL, $sh_distance=NULL)
Set Shadow Properties.
Definition: GridLines.php:291
getSoftEdgesSize()
Get Soft Edges Size.
Definition: GridLines.php:455
_setShadowDistance($distance)
Set Shadow Distance.
Definition: GridLines.php:415
_setGlowColor($color, $alpha, $type)
Set Glow Color.
Definition: GridLines.php:251
_setShadowColor($color, $alpha, $type)
Set Shadow Color.
Definition: GridLines.php:361
_setShadowProperiesMapValues(array $properties_map, &$reference=NULL)
Set Shadow Properties Values.
Definition: GridLines.php:329
getShadowProperty($elements)
Get Shadow Property.
Definition: GridLines.php:432
setSoftEdgesSize($size)
Set Soft Edges Size.
Definition: GridLines.php:442
getGlowColor($property)
Get Glow Color Property.
Definition: GridLines.php:213
Created by PhpStorm.
Definition: Properties.php:9
getLineStyleArrowSize($array_selector, $array_kay_selector)
Definition: Properties.php:136
getShadowPresetsMap($shadow_presets_option)
Definition: Properties.php:152
getArrayElementsValue($properties, $elements)
Definition: Properties.php:344
setColorProperties($color, $alpha, $type)
Definition: Properties.php:128
getExcelPointsWidth($width)
Definition: Properties.php:116
getExcelPointsAngle($angle)
Definition: Properties.php:120
$angle
$type