83e3ed938464784758dcff570921f63ab949e50d.svn-base 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: nhw2h8s
  5. * Date: 7/2/14
  6. * Time: 5:45 PM
  7. */
  8. abstract class PHPExcel_Properties {
  9. const
  10. EXCEL_COLOR_TYPE_STANDARD = 'prstClr',
  11. EXCEL_COLOR_TYPE_SCHEME = 'schemeClr',
  12. EXCEL_COLOR_TYPE_ARGB = 'srgbClr';
  13. const
  14. AXIS_LABELS_LOW = 'low',
  15. AXIS_LABELS_HIGH = 'high',
  16. AXIS_LABELS_NEXT_TO = 'nextTo',
  17. AXIS_LABELS_NONE = 'none';
  18. const
  19. TICK_MARK_NONE = 'none',
  20. TICK_MARK_INSIDE = 'in',
  21. TICK_MARK_OUTSIDE = 'out',
  22. TICK_MARK_CROSS = 'cross';
  23. const
  24. HORIZONTAL_CROSSES_AUTOZERO = 'autoZero',
  25. HORIZONTAL_CROSSES_MAXIMUM = 'max';
  26. const
  27. FORMAT_CODE_GENERAL = 'General',
  28. FORMAT_CODE_NUMBER = '#,##0.00',
  29. FORMAT_CODE_CURRENCY = '$#,##0.00',
  30. FORMAT_CODE_ACCOUNTING = '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)',
  31. FORMAT_CODE_DATE = 'm/d/yyyy',
  32. FORMAT_CODE_TIME = '[$-F400]h:mm:ss AM/PM',
  33. FORMAT_CODE_PERCENTAGE = '0.00%',
  34. FORMAT_CODE_FRACTION = '# ?/?',
  35. FORMAT_CODE_SCIENTIFIC = '0.00E+00',
  36. FORMAT_CODE_TEXT = '@',
  37. FORMAT_CODE_SPECIAL = '00000';
  38. const
  39. ORIENTATION_NORMAL = 'minMax',
  40. ORIENTATION_REVERSED = 'maxMin';
  41. const
  42. LINE_STYLE_COMPOUND_SIMPLE = 'sng',
  43. LINE_STYLE_COMPOUND_DOUBLE = 'dbl',
  44. LINE_STYLE_COMPOUND_THICKTHIN = 'thickThin',
  45. LINE_STYLE_COMPOUND_THINTHICK = 'thinThick',
  46. LINE_STYLE_COMPOUND_TRIPLE = 'tri',
  47. LINE_STYLE_DASH_SOLID = 'solid',
  48. LINE_STYLE_DASH_ROUND_DOT = 'sysDot',
  49. LINE_STYLE_DASH_SQUERE_DOT = 'sysDash',
  50. LINE_STYPE_DASH_DASH = 'dash',
  51. LINE_STYLE_DASH_DASH_DOT = 'dashDot',
  52. LINE_STYLE_DASH_LONG_DASH = 'lgDash',
  53. LINE_STYLE_DASH_LONG_DASH_DOT = 'lgDashDot',
  54. LINE_STYLE_DASH_LONG_DASH_DOT_DOT = 'lgDashDotDot',
  55. LINE_STYLE_CAP_SQUARE = 'sq',
  56. LINE_STYLE_CAP_ROUND = 'rnd',
  57. LINE_STYLE_CAP_FLAT = 'flat',
  58. LINE_STYLE_JOIN_ROUND = 'bevel',
  59. LINE_STYLE_JOIN_MITER = 'miter',
  60. LINE_STYLE_JOIN_BEVEL = 'bevel',
  61. LINE_STYLE_ARROW_TYPE_NOARROW = NULL,
  62. LINE_STYLE_ARROW_TYPE_ARROW = 'triangle',
  63. LINE_STYLE_ARROW_TYPE_OPEN = 'arrow',
  64. LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth',
  65. LINE_STYLE_ARROW_TYPE_DIAMOND = 'diamond',
  66. LINE_STYLE_ARROW_TYPE_OVAL = 'oval',
  67. LINE_STYLE_ARROW_SIZE_1 = 1,
  68. LINE_STYLE_ARROW_SIZE_2 = 2,
  69. LINE_STYLE_ARROW_SIZE_3 = 3,
  70. LINE_STYLE_ARROW_SIZE_4 = 4,
  71. LINE_STYLE_ARROW_SIZE_5 = 5,
  72. LINE_STYLE_ARROW_SIZE_6 = 6,
  73. LINE_STYLE_ARROW_SIZE_7 = 7,
  74. LINE_STYLE_ARROW_SIZE_8 = 8,
  75. LINE_STYLE_ARROW_SIZE_9 = 9;
  76. const
  77. SHADOW_PRESETS_NOSHADOW = NULL,
  78. SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1,
  79. SHADOW_PRESETS_OUTER_BOTTOM = 2,
  80. SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3,
  81. SHADOW_PRESETS_OUTER_RIGHT = 4,
  82. SHADOW_PRESETS_OUTER_CENTER = 5,
  83. SHADOW_PRESETS_OUTER_LEFT = 6,
  84. SHADOW_PRESETS_OUTER_TOP_RIGHT = 7,
  85. SHADOW_PRESETS_OUTER_TOP = 8,
  86. SHADOW_PRESETS_OUTER_TOP_LEFT = 9,
  87. SHADOW_PRESETS_INNER_BOTTTOM_RIGHT = 10,
  88. SHADOW_PRESETS_INNER_BOTTOM = 11,
  89. SHADOW_PRESETS_INNER_BOTTOM_LEFT = 12,
  90. SHADOW_PRESETS_INNER_RIGHT = 13,
  91. SHADOW_PRESETS_INNER_CENTER = 14,
  92. SHADOW_PRESETS_INNER_LEFT = 15,
  93. SHADOW_PRESETS_INNER_TOP_RIGHT = 16,
  94. SHADOW_PRESETS_INNER_TOP = 17,
  95. SHADOW_PRESETS_INNER_TOP_LEFT = 18,
  96. SHADOW_PRESETS_PERSPECTIVE_BELOW = 19,
  97. SHADOW_PRESETS_PERSPECTIVE_UPPER_RIGHT = 20,
  98. SHADOW_PRESETS_PERSPECTIVE_UPPER_LEFT = 21,
  99. SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22,
  100. SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23;
  101. protected function getExcelPointsWidth($width) {
  102. return $width * 12700;
  103. }
  104. protected function getExcelPointsAngle($angle) {
  105. return $angle * 60000;
  106. }
  107. protected function getTrueAlpha($alpha) {
  108. return (string) 100 - $alpha . '000';
  109. }
  110. protected function setColorProperties($color, $alpha, $type) {
  111. return array(
  112. 'type' => (string) $type,
  113. 'value' => (string) $color,
  114. 'alpha' => (string) $this->getTrueAlpha($alpha)
  115. );
  116. }
  117. protected function getLineStyleArrowSize($array_selector, $array_kay_selector) {
  118. $sizes = array(
  119. 1 => array('w' => 'sm', 'len' => 'sm'),
  120. 2 => array('w' => 'sm', 'len' => 'med'),
  121. 3 => array('w' => 'sm', 'len' => 'lg'),
  122. 4 => array('w' => 'med', 'len' => 'sm'),
  123. 5 => array('w' => 'med', 'len' => 'med'),
  124. 6 => array('w' => 'med', 'len' => 'lg'),
  125. 7 => array('w' => 'lg', 'len' => 'sm'),
  126. 8 => array('w' => 'lg', 'len' => 'med'),
  127. 9 => array('w' => 'lg', 'len' => 'lg')
  128. );
  129. return $sizes[$array_selector][$array_kay_selector];
  130. }
  131. protected function getShadowPresetsMap($shadow_presets_option) {
  132. $presets_options = array(
  133. //OUTER
  134. 1 => array(
  135. 'effect' => 'outerShdw',
  136. 'blur' => '50800',
  137. 'distance' => '38100',
  138. 'direction' => '2700000',
  139. 'algn' => 'tl',
  140. 'rotWithShape' => '0'
  141. ),
  142. 2 => array(
  143. 'effect' => 'outerShdw',
  144. 'blur' => '50800',
  145. 'distance' => '38100',
  146. 'direction' => '5400000',
  147. 'algn' => 't',
  148. 'rotWithShape' => '0'
  149. ),
  150. 3 => array(
  151. 'effect' => 'outerShdw',
  152. 'blur' => '50800',
  153. 'distance' => '38100',
  154. 'direction' => '8100000',
  155. 'algn' => 'tr',
  156. 'rotWithShape' => '0'
  157. ),
  158. 4 => array(
  159. 'effect' => 'outerShdw',
  160. 'blur' => '50800',
  161. 'distance' => '38100',
  162. 'algn' => 'l',
  163. 'rotWithShape' => '0'
  164. ),
  165. 5 => array(
  166. 'effect' => 'outerShdw',
  167. 'size' => array(
  168. 'sx' => '102000',
  169. 'sy' => '102000'
  170. )
  171. ,
  172. 'blur' => '63500',
  173. 'distance' => '38100',
  174. 'algn' => 'ctr',
  175. 'rotWithShape' => '0'
  176. ),
  177. 6 => array(
  178. 'effect' => 'outerShdw',
  179. 'blur' => '50800',
  180. 'distance' => '38100',
  181. 'direction' => '10800000',
  182. 'algn' => 'r',
  183. 'rotWithShape' => '0'
  184. ),
  185. 7 => array(
  186. 'effect' => 'outerShdw',
  187. 'blur' => '50800',
  188. 'distance' => '38100',
  189. 'direction' => '18900000',
  190. 'algn' => 'bl',
  191. 'rotWithShape' => '0'
  192. ),
  193. 8 => array(
  194. 'effect' => 'outerShdw',
  195. 'blur' => '50800',
  196. 'distance' => '38100',
  197. 'direction' => '16200000',
  198. 'rotWithShape' => '0'
  199. ),
  200. 9 => array(
  201. 'effect' => 'outerShdw',
  202. 'blur' => '50800',
  203. 'distance' => '38100',
  204. 'direction' => '13500000',
  205. 'algn' => 'br',
  206. 'rotWithShape' => '0'
  207. ),
  208. //INNER
  209. 10 => array(
  210. 'effect' => 'innerShdw',
  211. 'blur' => '63500',
  212. 'distance' => '50800',
  213. 'direction' => '2700000',
  214. ),
  215. 11 => array(
  216. 'effect' => 'innerShdw',
  217. 'blur' => '63500',
  218. 'distance' => '50800',
  219. 'direction' => '5400000',
  220. ),
  221. 12 => array(
  222. 'effect' => 'innerShdw',
  223. 'blur' => '63500',
  224. 'distance' => '50800',
  225. 'direction' => '8100000',
  226. ),
  227. 13 => array(
  228. 'effect' => 'innerShdw',
  229. 'blur' => '63500',
  230. 'distance' => '50800',
  231. ),
  232. 14 => array(
  233. 'effect' => 'innerShdw',
  234. 'blur' => '114300',
  235. ),
  236. 15 => array(
  237. 'effect' => 'innerShdw',
  238. 'blur' => '63500',
  239. 'distance' => '50800',
  240. 'direction' => '10800000',
  241. ),
  242. 16 => array(
  243. 'effect' => 'innerShdw',
  244. 'blur' => '63500',
  245. 'distance' => '50800',
  246. 'direction' => '18900000',
  247. ),
  248. 17 => array(
  249. 'effect' => 'innerShdw',
  250. 'blur' => '63500',
  251. 'distance' => '50800',
  252. 'direction' => '16200000',
  253. ),
  254. 18 => array(
  255. 'effect' => 'innerShdw',
  256. 'blur' => '63500',
  257. 'distance' => '50800',
  258. 'direction' => '13500000',
  259. ),
  260. //perspective
  261. 19 => array(
  262. 'effect' => 'outerShdw',
  263. 'blur' => '152400',
  264. 'distance' => '317500',
  265. 'size' => array(
  266. 'sx' => '90000',
  267. 'sy' => '-19000',
  268. ),
  269. 'direction' => '5400000',
  270. 'rotWithShape' => '0',
  271. ),
  272. 20 => array(
  273. 'effect' => 'outerShdw',
  274. 'blur' => '76200',
  275. 'direction' => '18900000',
  276. 'size' => array(
  277. 'sy' => '23000',
  278. 'kx' => '-1200000',
  279. ),
  280. 'algn' => 'bl',
  281. 'rotWithShape' => '0',
  282. ),
  283. 21 => array(
  284. 'effect' => 'outerShdw',
  285. 'blur' => '76200',
  286. 'direction' => '13500000',
  287. 'size' => array(
  288. 'sy' => '23000',
  289. 'kx' => '1200000',
  290. ),
  291. 'algn' => 'br',
  292. 'rotWithShape' => '0',
  293. ),
  294. 22 => array(
  295. 'effect' => 'outerShdw',
  296. 'blur' => '76200',
  297. 'distance' => '12700',
  298. 'direction' => '2700000',
  299. 'size' => array(
  300. 'sy' => '-23000',
  301. 'kx' => '-800400',
  302. ),
  303. 'algn' => 'bl',
  304. 'rotWithShape' => '0',
  305. ),
  306. 23 => array(
  307. 'effect' => 'outerShdw',
  308. 'blur' => '76200',
  309. 'distance' => '12700',
  310. 'direction' => '8100000',
  311. 'size' => array(
  312. 'sy' => '-23000',
  313. 'kx' => '800400',
  314. ),
  315. 'algn' => 'br',
  316. 'rotWithShape' => '0',
  317. ),
  318. );
  319. return $presets_options[$shadow_presets_option];
  320. }
  321. protected function getArrayElementsValue($properties, $elements) {
  322. $reference = & $properties;
  323. if (!is_array($elements)) {
  324. return $reference[$elements];
  325. } else {
  326. foreach ($elements as $keys) {
  327. $reference = & $reference[$keys];
  328. }
  329. return $reference;
  330. }
  331. return $this;
  332. }
  333. }