You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

XSLFPresetGeometry.java 27KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. /*
  2. * ====================================================================
  3. * Licensed to the Apache Software Foundation (ASF) under one or more
  4. * contributor license agreements. See the NOTICE file distributed with
  5. * this work for additional information regarding copyright ownership.
  6. * The ASF licenses this file to You under the Apache License, Version 2.0
  7. * (the "License"); you may not use this file except in compliance with
  8. * the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. * ====================================================================
  18. */
  19. package org.apache.poi.xslf.usermodel;
  20. import java.awt.*;
  21. import java.awt.geom.*;
  22. /**
  23. * TODO: re-write and initialize from presetShapeDefinitions.xml
  24. *
  25. * @author Yegor Kozlov
  26. */
  27. public class XSLFPresetGeometry {
  28. public static final int LINE = 1;
  29. public static final int LINE_INV = 2;
  30. public static final int TRIANGLE = 3;
  31. public static final int RT_TRIANGLE = 4;
  32. public static final int RECT = 5;
  33. public static final int DIAMOND = 6;
  34. public static final int PARALLELOGRAM = 7;
  35. public static final int TRAPEZOID = 8;
  36. public static final int NON_ISOSCELES_TRAPEZOID = 9;
  37. public static final int PENTAGON = 10;
  38. public static final int HEXAGON = 11;
  39. public static final int HEPTAGON = 12;
  40. public static final int OCTAGON = 13;
  41. public static final int DECAGON = 14;
  42. public static final int DODECAGON = 15;
  43. public static final int STAR_4 = 16;
  44. public static final int STAR_5 = 17;
  45. public static final int STAR_6 = 18;
  46. public static final int STAR_7 = 19;
  47. public static final int STAR_8 = 20;
  48. public static final int STAR_10 = 21;
  49. public static final int STAR_12 = 22;
  50. public static final int STAR_16 = 23;
  51. public static final int STAR_24 = 24;
  52. public static final int STAR_32 = 25;
  53. public static final int ROUND_RECT = 26;
  54. public static final int ROUND_1_RECT = 27;
  55. public static final int ROUND_2_SAME_RECT = 28;
  56. public static final int ROUND_2_DIAG_RECT = 29;
  57. public static final int SNIP_ROUND_RECT = 30;
  58. public static final int SNIP_1_RECT = 31;
  59. public static final int SNIP_2_SAME_RECT = 32;
  60. public static final int SNIP_2_DIAG_RECT = 33;
  61. public static final int PLAQUE = 34;
  62. public static final int ELLIPSE = 35;
  63. public static final int TEARDROP = 36;
  64. public static final int HOME_PLATE = 37;
  65. public static final int CHEVRON = 38;
  66. public static final int PIE_WEDGE = 39;
  67. public static final int PIE = 40;
  68. public static final int BLOCK_ARC = 41;
  69. public static final int DONUT = 42;
  70. public static final int NO_SMOKING = 43;
  71. public static final int RIGHT_ARROW = 44;
  72. public static final int LEFT_ARROW = 45;
  73. public static final int UP_ARROW = 46;
  74. public static final int DOWN_ARROW = 47;
  75. public static final int STRIPED_RIGHT_ARROW = 48;
  76. public static final int NOTCHED_RIGHT_ARROW = 49;
  77. public static final int BENT_UP_ARROW = 50;
  78. public static final int LEFT_RIGHT_ARROW = 51;
  79. public static final int UP_DOWN_ARROW = 52;
  80. public static final int LEFT_UP_ARROW = 53;
  81. public static final int LEFT_RIGHT_UP_ARROW = 54;
  82. public static final int QUAD_ARROW = 55;
  83. public static final int LEFT_ARROW_CALLOUT = 56;
  84. public static final int RIGHT_ARROW_CALLOUT = 57;
  85. public static final int UP_ARROW_CALLOUT = 58;
  86. public static final int DOWN_ARROW_CALLOUT = 59;
  87. public static final int LEFT_RIGHT_ARROW_CALLOUT = 60;
  88. public static final int UP_DOWN_ARROW_CALLOUT = 61;
  89. public static final int QUAD_ARROW_CALLOUT = 62;
  90. public static final int BENT_ARROW = 63;
  91. public static final int UTURN_ARROW = 64;
  92. public static final int CIRCULAR_ARROW = 65;
  93. public static final int LEFT_CIRCULAR_ARROW = 66;
  94. public static final int LEFT_RIGHT_CIRCULAR_ARROW = 67;
  95. public static final int CURVED_RIGHT_ARROW = 68;
  96. public static final int CURVED_LEFT_ARROW = 69;
  97. public static final int CURVED_UP_ARROW = 70;
  98. public static final int CURVED_DOWN_ARROW = 71;
  99. public static final int SWOOSH_ARROW = 72;
  100. public static final int CUBE = 73;
  101. public static final int CAN = 74;
  102. public static final int LIGHTNING_BOLT = 75;
  103. public static final int HEART = 76;
  104. public static final int SUN = 77;
  105. public static final int MOON = 78;
  106. public static final int SMILEY_FACE = 79;
  107. public static final int IRREGULAR_SEAL_1 = 80;
  108. public static final int IRREGULAR_SEAL_2 = 81;
  109. public static final int FOLDED_CORNER = 82;
  110. public static final int BEVEL = 83;
  111. public static final int FRAME = 84;
  112. public static final int HALF_FRAME = 85;
  113. public static final int CORNER = 86;
  114. public static final int DIAG_STRIPE = 87;
  115. public static final int CHORD = 88;
  116. public static final int ARC = 89;
  117. public static final int LEFT_BRACKET = 90;
  118. public static final int RIGHT_BRACKET = 91;
  119. public static final int LEFT_BRACE = 92;
  120. public static final int RIGHT_BRACE = 93;
  121. public static final int BRACKET_PAIR = 94;
  122. public static final int BRACE_PAIR = 95;
  123. public static final int STRAIGHT_CONNECTOR_1 = 96;
  124. public static final int BENT_CONNECTOR_2 = 97;
  125. public static final int BENT_CONNECTOR_3 = 98;
  126. public static final int BENT_CONNECTOR_4 = 99;
  127. public static final int BENT_CONNECTOR_5 = 100;
  128. public static final int CURVED_CONNECTOR_2 = 101;
  129. public static final int CURVED_CONNECTOR_3 = 102;
  130. public static final int CURVED_CONNECTOR_4 = 103;
  131. public static final int CURVED_CONNECTOR_5 = 104;
  132. public static final int CALLOUT_1 = 105;
  133. public static final int CALLOUT_2 = 106;
  134. public static final int CALLOUT_3 = 107;
  135. public static final int ACCENT_CALLOUT_1 = 108;
  136. public static final int ACCENT_CALLOUT_2 = 109;
  137. public static final int ACCENT_CALLOUT_3 = 110;
  138. public static final int BORDER_CALLOUT_1 = 111;
  139. public static final int BORDER_CALLOUT_2 = 112;
  140. public static final int BORDER_CALLOUT_3 = 113;
  141. public static final int ACCENT_BORDER_CALLOUT_1 = 114;
  142. public static final int ACCENT_BORDER_CALLOUT_2 = 115;
  143. public static final int ACCENT_BORDER_CALLOUT_3 = 116;
  144. public static final int WEDGE_RECT_CALLOUT = 117;
  145. public static final int WEDGE_ROUND_RECT_CALLOUT = 118;
  146. public static final int WEDGE_ELLIPSE_CALLOUT = 119;
  147. public static final int CLOUD_CALLOUT = 120;
  148. public static final int CLOUD = 121;
  149. public static final int RIBBON = 122;
  150. public static final int RIBBON_2 = 123;
  151. public static final int ELLIPSE_RIBBON = 124;
  152. public static final int ELLIPSE_RIBBON_2 = 125;
  153. public static final int LEFT_RIGHT_RIBBON = 126;
  154. public static final int VERTICAL_SCROLL = 127;
  155. public static final int HORIZONTAL_SCROLL = 128;
  156. public static final int WAVE = 129;
  157. public static final int DOUBLE_WAVE = 130;
  158. public static final int PLUS = 131;
  159. public static final int FLOW_CHART_PROCESS = 132;
  160. public static final int FLOW_CHART_DECISION = 133;
  161. public static final int FLOW_CHART_INPUT_OUTPUT = 134;
  162. public static final int FLOW_CHART_PREDEFINED_PROCESS = 135;
  163. public static final int FLOW_CHART_INTERNAL_STORAGE = 136;
  164. public static final int FLOW_CHART_DOCUMENT = 137;
  165. public static final int FLOW_CHART_MULTIDOCUMENT = 138;
  166. public static final int FLOW_CHART_TERMINATOR = 139;
  167. public static final int FLOW_CHART_PREPARATION = 140;
  168. public static final int FLOW_CHART_MANUAL_INPUT = 141;
  169. public static final int FLOW_CHART_MANUAL_OPERATION = 142;
  170. public static final int FLOW_CHART_CONNECTOR = 143;
  171. public static final int FLOW_CHART_PUNCHED_CARD = 144;
  172. public static final int FLOW_CHART_PUNCHED_TAPE = 145;
  173. public static final int FLOW_CHART_SUMMING_JUNCTION = 146;
  174. public static final int FLOW_CHART_OR = 147;
  175. public static final int FLOW_CHART_COLLATE = 148;
  176. public static final int FLOW_CHART_SORT = 149;
  177. public static final int FLOW_CHART_EXTRACT = 150;
  178. public static final int FLOW_CHART_MERGE = 151;
  179. public static final int FLOW_CHART_OFFLINE_STORAGE = 152;
  180. public static final int FLOW_CHART_ONLINE_STORAGE = 153;
  181. public static final int FLOW_CHART_MAGNETIC_TAPE = 154;
  182. public static final int FLOW_CHART_MAGNETIC_DISK = 155;
  183. public static final int FLOW_CHART_MAGNETIC_DRUM = 156;
  184. public static final int FLOW_CHART_DISPLAY = 157;
  185. public static final int FLOW_CHART_DELAY = 158;
  186. public static final int FLOW_CHART_ALTERNATE_PROCESS = 159;
  187. public static final int FLOW_CHART_OFFPAGE_CONNECTOR = 160;
  188. public static final int ACTION_BUTTON_BLANK = 161;
  189. public static final int ACTION_BUTTON_HOME = 162;
  190. public static final int ACTION_BUTTON_HELP = 163;
  191. public static final int ACTION_BUTTON_INFORMATION = 164;
  192. public static final int ACTION_BUTTON_FORWARD_NEXT = 165;
  193. public static final int ACTION_BUTTON_BACK_PREVIOUS = 166;
  194. public static final int ACTION_BUTTON_END = 167;
  195. public static final int ACTION_BUTTON_BEGINNING = 168;
  196. public static final int ACTION_BUTTON_RETURN = 169;
  197. public static final int ACTION_BUTTON_DOCUMENT = 170;
  198. public static final int ACTION_BUTTON_SOUND = 171;
  199. public static final int ACTION_BUTTON_MOVIE = 172;
  200. public static final int GEAR_6 = 173;
  201. public static final int GEAR_9 = 174;
  202. public static final int FUNNEL = 175;
  203. public static final int MATH_PLUS = 176;
  204. public static final int MATH_MINUS = 177;
  205. public static final int MATH_MULTIPLY = 178;
  206. public static final int MATH_DIVIDE = 179;
  207. public static final int MATH_EQUAL = 180;
  208. public static final int MATH_NOT_EQUAL = 181;
  209. public static final int CORNER_TABS = 182;
  210. public static final int SQUARE_TABS = 183;
  211. public static final int PLAQUE_TABS = 184;
  212. public static final int CHART_X = 185;
  213. public static final int CHART_STAR = 186;
  214. public static final int CHART_PLUS = 187;
  215. private static interface ShapeOutline {
  216. java.awt.Shape getOutline(XSLFAutoShape shape);
  217. }
  218. static ShapeOutline[] shapes;
  219. static {
  220. shapes = new ShapeOutline[255];
  221. shapes[RECT] = new ShapeOutline(){
  222. public java.awt.Shape getOutline(XSLFAutoShape shape){
  223. Rectangle2D path = new Rectangle2D.Float(0, 0, 21600, 21600);
  224. return path;
  225. }
  226. };
  227. shapes[ROUND_RECT] = new ShapeOutline(){
  228. public java.awt.Shape getOutline(XSLFAutoShape shape){
  229. int adjval = shape.getAdjustValue("adj1", 5400);
  230. RoundRectangle2D path = new RoundRectangle2D.Float(0, 0, 21600, 21600, adjval, adjval);
  231. return path;
  232. }
  233. };
  234. shapes[ELLIPSE] = new ShapeOutline(){
  235. public java.awt.Shape getOutline(XSLFAutoShape shape){
  236. Ellipse2D path = new Ellipse2D.Float(0, 0, 21600, 21600);
  237. return path;
  238. }
  239. };
  240. shapes[DIAMOND] = new ShapeOutline(){
  241. public java.awt.Shape getOutline(XSLFAutoShape shape){
  242. GeneralPath path = new GeneralPath();
  243. path.moveTo(10800, 0);
  244. path.lineTo(21600, 10800);
  245. path.lineTo(10800, 21600);
  246. path.lineTo(0, 10800);
  247. path.closePath();
  248. return path;
  249. }
  250. };
  251. //m@0,l,21600r21600
  252. shapes[TRIANGLE] = new ShapeOutline(){
  253. public java.awt.Shape getOutline(XSLFAutoShape shape){
  254. int adjval = shape.getAdjustValue("adj1", 5400);
  255. GeneralPath path = new GeneralPath();
  256. path.moveTo(adjval, 0);
  257. path.lineTo(0, 21600);
  258. path.lineTo(21600, 21600);
  259. path.closePath();
  260. return path;
  261. }
  262. };
  263. shapes[RT_TRIANGLE] = new ShapeOutline(){
  264. public java.awt.Shape getOutline(XSLFAutoShape shape){
  265. GeneralPath path = new GeneralPath();
  266. path.moveTo(0, 0);
  267. path.lineTo(21600, 21600);
  268. path.lineTo(0, 21600);
  269. path.closePath();
  270. return path;
  271. }
  272. };
  273. shapes[PARALLELOGRAM] = new ShapeOutline(){
  274. public java.awt.Shape getOutline(XSLFAutoShape shape){
  275. int adjval = shape.getAdjustValue("adj1", 5400);
  276. GeneralPath path = new GeneralPath();
  277. path.moveTo(adjval, 0);
  278. path.lineTo(21600, 0);
  279. path.lineTo(21600 - adjval, 21600);
  280. path.lineTo(0, 21600);
  281. path.closePath();
  282. return path;
  283. }
  284. };
  285. shapes[TRAPEZOID] = new ShapeOutline(){
  286. public java.awt.Shape getOutline(XSLFAutoShape shape){
  287. int adjval = shape.getAdjustValue("adj1", 5400);
  288. GeneralPath path = new GeneralPath();
  289. path.moveTo(0, 0);
  290. path.lineTo(adjval, 21600);
  291. path.lineTo(21600 - adjval, 21600);
  292. path.lineTo(21600, 0);
  293. path.closePath();
  294. return path;
  295. }
  296. };
  297. shapes[HEXAGON] = new ShapeOutline(){
  298. public java.awt.Shape getOutline(XSLFAutoShape shape){
  299. int adjval = shape.getAdjustValue("adj1", 5400);
  300. GeneralPath path = new GeneralPath();
  301. path.moveTo(adjval, 0);
  302. path.lineTo(21600 - adjval, 0);
  303. path.lineTo(21600, 10800);
  304. path.lineTo(21600 - adjval, 21600);
  305. path.lineTo(adjval, 21600);
  306. path.lineTo(0, 10800);
  307. path.closePath();
  308. return path;
  309. }
  310. };
  311. shapes[OCTAGON] = new ShapeOutline(){
  312. public java.awt.Shape getOutline(XSLFAutoShape shape){
  313. int adjval = shape.getAdjustValue("adj1", 6324);
  314. GeneralPath path = new GeneralPath();
  315. path.moveTo(adjval, 0);
  316. path.lineTo(21600 - adjval, 0);
  317. path.lineTo(21600, adjval);
  318. path.lineTo(21600, 21600-adjval);
  319. path.lineTo(21600-adjval, 21600);
  320. path.lineTo(adjval, 21600);
  321. path.lineTo(0, 21600-adjval);
  322. path.lineTo(0, adjval);
  323. path.closePath();
  324. return path;
  325. }
  326. };
  327. shapes[PLUS] = new ShapeOutline(){
  328. public java.awt.Shape getOutline(XSLFAutoShape shape){
  329. int adjval = shape.getAdjustValue("adj1", 5400);
  330. GeneralPath path = new GeneralPath();
  331. path.moveTo(adjval, 0);
  332. path.lineTo(21600 - adjval, 0);
  333. path.lineTo(21600 - adjval, adjval);
  334. path.lineTo(21600, adjval);
  335. path.lineTo(21600, 21600-adjval);
  336. path.lineTo(21600-adjval, 21600-adjval);
  337. path.lineTo(21600-adjval, 21600);
  338. path.lineTo(adjval, 21600);
  339. path.lineTo(adjval, 21600-adjval);
  340. path.lineTo(0, 21600-adjval);
  341. path.lineTo(0, adjval);
  342. path.lineTo(adjval, adjval);
  343. path.closePath();
  344. return path;
  345. }
  346. };
  347. shapes[PENTAGON] = new ShapeOutline(){
  348. public java.awt.Shape getOutline(XSLFAutoShape shape){
  349. GeneralPath path = new GeneralPath();
  350. path.moveTo(10800, 0);
  351. path.lineTo(21600, 8259);
  352. path.lineTo(21600 - 4200, 21600);
  353. path.lineTo(4200, 21600);
  354. path.lineTo(0, 8259);
  355. path.closePath();
  356. return path;
  357. }
  358. };
  359. shapes[HOME_PLATE] = new ShapeOutline(){
  360. public java.awt.Shape getOutline(XSLFAutoShape shape){
  361. GeneralPath path = new GeneralPath();
  362. int adjval = shape.getAdjustValue("adj1", 16200);
  363. path.moveTo(0, 0);
  364. path.lineTo(adjval, 0 );
  365. path.lineTo(21600, 10800);
  366. path.lineTo(adjval, 21600);
  367. path.lineTo(0, 21600);
  368. path.closePath();
  369. return path;
  370. }
  371. };
  372. shapes[CHEVRON] = new ShapeOutline(){
  373. public java.awt.Shape getOutline(XSLFAutoShape shape){
  374. GeneralPath path = new GeneralPath();
  375. int adjval = shape.getAdjustValue("adj1", 16200);
  376. path.moveTo(0, 0);
  377. path.lineTo(adjval, 0 );
  378. path.lineTo(21600, 10800);
  379. path.lineTo(adjval, 21600);
  380. path.lineTo(0, 21600);
  381. path.lineTo(21600 - adjval, 10800);
  382. path.closePath();
  383. return path;
  384. }
  385. };
  386. shapes[CAN] = new ShapeOutline(){
  387. public java.awt.Shape getOutline(XSLFAutoShape shape){
  388. int adjval = shape.getAdjustValue("adj1", 5400);
  389. GeneralPath path = new GeneralPath();
  390. path.moveTo(0, 0);
  391. path.lineTo(21600, 0);
  392. path.lineTo(21600, 21600);
  393. path.lineTo(0, 21600);
  394. //path.lineTo(21600, adjval);
  395. path.closePath();
  396. path.moveTo(10800, 0);
  397. //path.append(new Arc2D.Float(10800, 0, 10800, adjval, 0, 90, Arc2D.OPEN), true);
  398. path.moveTo(10800, adjval/2);
  399. path.append(new Arc2D.Float(10800, adjval/2, 10800, adjval, 90, 180, Arc2D.OPEN), true);
  400. //path.append(new Arc2D.Float(0, adjval/2, 10800, adjval, 180, 270, Arc2D.OPEN), true);
  401. //path.append(new Arc2D.Float(0, 0, 10800, adjval, 270, 360, Arc2D.OPEN), true);
  402. return path;
  403. }
  404. };
  405. shapes[DOWN_ARROW] = new ShapeOutline(){
  406. public java.awt.Shape getOutline(XSLFAutoShape shape){
  407. //m0@0 l@1@0 @1,0 @2,0 @2@0,21600@0,10800,21600xe
  408. int adjval = shape.getAdjustValue("adj1", 16200);
  409. int adjval2 = shape.getAdjustValue("adj2", 5400);
  410. GeneralPath path = new GeneralPath();
  411. path.moveTo(0, adjval);
  412. path.lineTo(adjval2, adjval);
  413. path.lineTo(adjval2, 0);
  414. path.lineTo(21600-adjval2, 0);
  415. path.lineTo(21600-adjval2, adjval);
  416. path.lineTo(21600, adjval);
  417. path.lineTo(10800, 21600);
  418. path.closePath();
  419. return path;
  420. }
  421. };
  422. shapes[UP_ARROW] = new ShapeOutline(){
  423. public java.awt.Shape getOutline(XSLFAutoShape shape){
  424. //m0@0 l@1@0 @1,21600@2,21600@2@0,21600@0,10800,xe
  425. int adjval = shape.getAdjustValue("adj1", 5400);
  426. int adjval2 = shape.getAdjustValue("adj2", 5400);
  427. GeneralPath path = new GeneralPath();
  428. path.moveTo(0, adjval);
  429. path.lineTo(adjval2, adjval);
  430. path.lineTo(adjval2, 21600);
  431. path.lineTo(21600-adjval2, 21600);
  432. path.lineTo(21600-adjval2, adjval);
  433. path.lineTo(21600, adjval);
  434. path.lineTo(10800, 0);
  435. path.closePath();
  436. return path;
  437. }
  438. };
  439. shapes[RIGHT_ARROW] = new ShapeOutline(){
  440. public java.awt.Shape getOutline(XSLFAutoShape shape){
  441. //m@0, l@0@1 ,0@1,0@2@0@2@0,21600,21600,10800xe
  442. int adjval = shape.getAdjustValue("adj1", 16200);
  443. int adjval2 = shape.getAdjustValue("adj2", 5400);
  444. GeneralPath path = new GeneralPath();
  445. path.moveTo(adjval, 0);
  446. path.lineTo(adjval, adjval2);
  447. path.lineTo(0, adjval2);
  448. path.lineTo(0, 21600-adjval2);
  449. path.lineTo(adjval, 21600-adjval2);
  450. path.lineTo(adjval, 21600);
  451. path.lineTo(21600, 10800);
  452. path.closePath();
  453. return path;
  454. }
  455. };
  456. shapes[LEFT_ARROW] = new ShapeOutline(){
  457. public java.awt.Shape getOutline(XSLFAutoShape shape){
  458. //m@0, l@0@1,21600@1,21600@2@0@2@0,21600,,10800xe
  459. int adjval = shape.getAdjustValue("adj1", 5400);
  460. int adjval2 = shape.getAdjustValue("adj2", 5400);
  461. GeneralPath path = new GeneralPath();
  462. path.moveTo(adjval, 0);
  463. path.lineTo(adjval, adjval2);
  464. path.lineTo(21600, adjval2);
  465. path.lineTo(21600, 21600-adjval2);
  466. path.lineTo(adjval, 21600-adjval2);
  467. path.lineTo(adjval, 21600);
  468. path.lineTo(0, 10800);
  469. path.closePath();
  470. return path;
  471. }
  472. };
  473. shapes[LEFT_BRACE] = new ShapeOutline(){
  474. public java.awt.Shape getOutline(XSLFAutoShape shape){
  475. //m21600,qx10800@0l10800@2qy0@11,10800@3l10800@1qy21600,21600e
  476. int adjval = shape.getAdjustValue("adj1", 1800);
  477. int adjval2 = shape.getAdjustValue("adj2", 10800);
  478. GeneralPath path = new GeneralPath();
  479. path.moveTo(21600, 0);
  480. path.append(new Arc2D.Float(10800, 0, 21600, adjval*2, 90, 90, Arc2D.OPEN), false);
  481. path.moveTo(10800, adjval);
  482. path.lineTo(10800, adjval2 - adjval);
  483. path.append(new Arc2D.Float(-10800, adjval2 - 2*adjval, 21600, adjval*2, 270, 90, Arc2D.OPEN), false);
  484. path.moveTo(0, adjval2);
  485. path.append(new Arc2D.Float(-10800, adjval2, 21600, adjval*2, 0, 90, Arc2D.OPEN), false);
  486. path.moveTo(10800, adjval2 + adjval);
  487. path.lineTo(10800, 21600 - adjval);
  488. path.append(new Arc2D.Float(10800, 21600 - 2*adjval, 21600, adjval*2, 180, 90, Arc2D.OPEN), false);
  489. return path;
  490. }
  491. };
  492. shapes[RIGHT_BRACE] = new ShapeOutline(){
  493. public java.awt.Shape getOutline(XSLFAutoShape shape){
  494. //m,qx10800@0 l10800@2qy21600@11,10800@3l10800@1qy,21600e
  495. int adjval = shape.getAdjustValue("adj1", 1800);
  496. int adjval2 = shape.getAdjustValue("adj2", 10800);
  497. GeneralPath path = new GeneralPath();
  498. path.moveTo(0, 0);
  499. path.append(new Arc2D.Float(-10800, 0, 21600, adjval*2, 0, 90, Arc2D.OPEN), false);
  500. path.moveTo(10800, adjval);
  501. path.lineTo(10800, adjval2 - adjval);
  502. path.append(new Arc2D.Float(10800, adjval2 - 2*adjval, 21600, adjval*2, 180, 90, Arc2D.OPEN), false);
  503. path.moveTo(21600, adjval2);
  504. path.append(new Arc2D.Float(10800, adjval2, 21600, adjval*2, 90, 90, Arc2D.OPEN), false);
  505. path.moveTo(10800, adjval2 + adjval);
  506. path.lineTo(10800, 21600 - adjval);
  507. path.append(new Arc2D.Float(-10800, 21600 - 2*adjval, 21600, adjval*2, 270, 90, Arc2D.OPEN), false);
  508. return path;
  509. }
  510. };
  511. shapes[LEFT_RIGHT_ARROW] = new ShapeOutline(){
  512. public java.awt.Shape getOutline(XSLFAutoShape shape){
  513. //m,10800l@0,21600@0@3@2@3@2,21600,21600,10800@2,0@2@1@0@1@0,xe
  514. int adjval = shape.getAdjustValue("adj1", 4320);
  515. int adjval2 = shape.getAdjustValue("adj2", 5400);
  516. GeneralPath path = new GeneralPath();
  517. path.moveTo(0, 10800);
  518. path.lineTo(adjval, 0);
  519. path.lineTo(adjval, adjval2);
  520. path.lineTo(21600 - adjval, adjval2);
  521. path.lineTo(21600 - adjval, 0);
  522. path.lineTo(21600, 10800);
  523. path.lineTo(21600 - adjval, 21600);
  524. path.lineTo(21600 - adjval, 21600 - adjval2);
  525. path.lineTo(adjval, 21600 - adjval2);
  526. path.lineTo(adjval, 21600);
  527. path.closePath();
  528. return path;
  529. }
  530. };
  531. shapes[UP_DOWN_ARROW] = new ShapeOutline(){
  532. public java.awt.Shape getOutline(XSLFAutoShape shape){
  533. //m10800,l21600@0@3@0@3@2,21600@2,10800,21600,0@2@1@2@1@0,0@0xe
  534. int adjval1 = shape.getAdjustValue("adj1", 5400);
  535. int adjval2 = shape.getAdjustValue("adj2", 4320);
  536. GeneralPath path = new GeneralPath();
  537. path.moveTo(10800, 0);
  538. path.lineTo(21600, adjval2);
  539. path.lineTo(21600 - adjval1, adjval2);
  540. path.lineTo(21600 - adjval1, 21600 - adjval2);
  541. path.lineTo(21600, 21600 - adjval2);
  542. path.lineTo(10800, 21600);
  543. path.lineTo(0, 21600 - adjval2);
  544. path.lineTo(adjval1, 21600 - adjval2);
  545. path.lineTo(adjval1, adjval2);
  546. path.lineTo(0, adjval2);
  547. path.closePath();
  548. return path;
  549. }
  550. };
  551. shapes[NOTCHED_RIGHT_ARROW] = new ShapeOutline(){
  552. public java.awt.Shape getOutline(XSLFAutoShape shape){
  553. //m@0,l@0@1,0@1@5,10800,0@2@0@2@0,21600,21600,10800xe
  554. int adjval1 = shape.getAdjustValue("adj1", 16200);
  555. int adjval2 = shape.getAdjustValue("adj2", 5400);
  556. GeneralPath path = new GeneralPath();
  557. path.moveTo(adjval1, 0);
  558. path.lineTo(adjval1, adjval2);
  559. path.lineTo(0, adjval2);
  560. //The notch at the end stays adjusted so that it matches the shape of the arrowhead.
  561. int notch = (21600-2*adjval2)*(21600-adjval1)/21600;
  562. path.lineTo(notch, 10800);
  563. path.lineTo(0, 21600 - adjval2);
  564. path.lineTo(adjval1, 21600 - adjval2);
  565. path.lineTo(adjval1, 21600);
  566. path.lineTo(21600, 10800);
  567. path.closePath();
  568. return path;
  569. }
  570. };
  571. }
  572. static Shape getOutline(XSLFAutoShape shape){
  573. ShapeOutline outline = shapes[shape.getShapeType()];
  574. return outline == null ? null : outline.getOutline(shape);
  575. }
  576. }