Updated gui for user facility settings (#1327)
[openemr.git] / vendor / phpoffice / phpexcel / Classes / PHPExcel / Chart / GridLines.php
blob269860ca1f896280b3d6298ffefce326c9dd8e09
1 <?php
2 require_once 'Properties.php';
3 /**
4 * Created by PhpStorm.
5 * User: Wiktor Trzonkowski
6 * Date: 7/2/14
7 * Time: 2:36 PM
8 */
10 class PHPExcel_Chart_GridLines extends
11 PHPExcel_Properties {
13 /**
14 * Properties of Class:
15 * Object State (State for Minor Tick Mark) @var bool
16 * Line Properties @var array of mixed
17 * Shadow Properties @var array of mixed
18 * Glow Properties @var array of mixed
19 * Soft Properties @var array of mixed
23 private
24 $_object_state = FALSE,
25 $_line_properties = array(
26 'color' => array(
27 'type' => self::EXCEL_COLOR_TYPE_STANDARD,
28 'value' => NULL,
29 'alpha' => 0
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
42 'end' => array(
43 'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
44 'size' => self::LINE_STYLE_ARROW_SIZE_8
49 $_shadow_properties = array(
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,
57 'size' => array(
58 'sx' => NULL,
59 'sy' => NULL,
60 'kx' => NULL
62 'blur' => NULL,
63 'direction' => NULL,
64 'distance' => NULL,
65 'algn' => NULL,
66 'rotWithShape' => NULL
68 $_glow_properties = array(
69 'size' => NULL,
70 'color' => array(
71 'type' => self::EXCEL_COLOR_TYPE_STANDARD,
72 'value' => 'black',
73 'alpha' => 40
76 $_soft_edges = array(
77 'size' => NULL
80 /**
81 * Get Object State
83 * @return bool
86 public function getObjectState() {
87 return $this->_object_state;
90 /**
91 * Change Object State to True
93 * @return PHPExcel_Chart_GridLines
96 private function _activateObject() {
97 $this->_object_state = TRUE;
99 return $this;
103 * Set Line Color Properties
105 * @param string $value
106 * @param int $alpha
107 * @param string $type
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);
120 * Set Line Color Properties
122 * @param float $line_width
123 * @param string $compound_type
124 * @param string $dash_type
125 * @param string $cap_type
126 * @param string $join_type
127 * @param string $head_arrow_type
128 * @param string $head_arrow_size
129 * @param string $end_arrow_type
130 * @param string $end_arrow_size
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;
165 * Get Line Color Property
167 * @param string $parameter
169 * @return string
172 public function getLineColorProperty($parameter) {
173 return $this->_line_properties['color'][$parameter];
177 * Get Line Style Property
179 * @param array|string $elements
181 * @return string
184 public function getLineStyleProperty($elements) {
185 return $this->getArrayElementsValue($this->_line_properties['style'], $elements);
189 * Set Glow Properties
191 * @param float $size
192 * @param string $color_value
193 * @param int $color_alpha
194 * @param string $color_type
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);
206 * Get Glow Color Property
208 * @param string $property
210 * @return string
213 public function getGlowColor($property) {
214 return $this->_glow_properties['color'][$property];
218 * Get Glow Size
220 * @return string
223 public function getGlowSize() {
224 return $this->_glow_properties['size'];
228 * Set Glow Size
230 * @param float $size
232 * @return PHPExcel_Chart_GridLines
235 private function _setGlowSize($size) {
236 $this->_glow_properties['size'] = $this->getExcelPointsWidth((float) $size);
238 return $this;
242 * Set Glow Color
244 * @param string $color
245 * @param int $alpha
246 * @param string $type
248 * @return PHPExcel_Chart_GridLines
251 private function _setGlowColor($color, $alpha, $type) {
252 if (!is_null($color)) {
253 $this->_glow_properties['color']['value'] = (string) $color;
255 if (!is_null($alpha)) {
256 $this->_glow_properties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
258 if (!is_null($type)) {
259 $this->_glow_properties['color']['type'] = (string) $type;
262 return $this;
266 * Get Line Style Arrow Parameters
268 * @param string $arrow_selector
269 * @param string $property_selector
271 * @return string
274 public function getLineStyleArrowParameters($arrow_selector, $property_selector) {
275 return $this->getLineStyleArrowSize($this->_line_properties['style']['arrow'][$arrow_selector]['size'], $property_selector);
279 * Set Shadow Properties
281 * @param int $sh_presets
282 * @param string $sh_color_value
283 * @param string $sh_color_type
284 * @param int $sh_color_alpha
285 * @param string $sh_blur
286 * @param int $sh_angle
287 * @param float $sh_distance
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);
306 * Set Shadow Presets Properties
308 * @param int $shadow_presets
310 * @return PHPExcel_Chart_GridLines
313 private function _setShadowPresetsProperties($shadow_presets) {
314 $this->_shadow_properties['presets'] = $shadow_presets;
315 $this->_setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
317 return $this;
321 * Set Shadow Properties Values
323 * @param array $properties_map
324 * @param * $reference
326 * @return PHPExcel_Chart_GridLines
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];
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;
348 return $this;
352 * Set Shadow Color
354 * @param string $color
355 * @param int $alpha
356 * @param string $type
358 * @return PHPExcel_Chart_GridLines
361 private function _setShadowColor($color, $alpha, $type) {
362 if (!is_null($color)) {
363 $this->_shadow_properties['color']['value'] = (string) $color;
365 if (!is_null($alpha)) {
366 $this->_shadow_properties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
368 if (!is_null($type)) {
369 $this->_shadow_properties['color']['type'] = (string) $type;
372 return $this;
376 * Set Shadow Blur
378 * @param float $blur
380 * @return PHPExcel_Chart_GridLines
383 private function _setShadowBlur($blur) {
384 if ($blur !== NULL) {
385 $this->_shadow_properties['blur'] = (string) $this->getExcelPointsWidth($blur);
388 return $this;
392 * Set Shadow Angle
394 * @param int $angle
396 * @return PHPExcel_Chart_GridLines
399 private function _setShadowAngle($angle) {
400 if ($angle !== NULL) {
401 $this->_shadow_properties['direction'] = (string) $this->getExcelPointsAngle($angle);
404 return $this;
408 * Set Shadow Distance
410 * @param float $distance
412 * @return PHPExcel_Chart_GridLines
415 private function _setShadowDistance($distance) {
416 if ($distance !== NULL) {
417 $this->_shadow_properties['distance'] = (string) $this->getExcelPointsWidth($distance);
420 return $this;
424 * Get Shadow Property
426 * @param string $elements
427 * @param array $elements
429 * @return string
432 public function getShadowProperty($elements) {
433 return $this->getArrayElementsValue($this->_shadow_properties, $elements);
437 * Set Soft Edges Size
439 * @param float $size
442 public function setSoftEdgesSize($size) {
443 if (!is_null($size)) {
444 $this->_activateObject();
445 $_soft_edges['size'] = (string) $this->getExcelPointsWidth($size);
450 * Get Soft Edges Size
452 * @return string
455 public function getSoftEdgesSize() {
456 return $this->_soft_edges['size'];