56
|
1 |
/*
|
87
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
56
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
package com.nokia.microedition.m2g;
|
|
19 |
|
|
20 |
import java.util.Hashtable;
|
|
21 |
import java.util.Enumeration;
|
|
22 |
import java.util.Vector;
|
|
23 |
import org.w3c.dom.svg.SVGPath;
|
|
24 |
|
|
25 |
/*
|
|
26 |
* General constants
|
|
27 |
*/
|
|
28 |
public class M2GSVGConstants
|
|
29 |
{
|
|
30 |
|
|
31 |
//--------------------------------------------------
|
|
32 |
// STATIC CONSTANTS - General exception messages
|
|
33 |
//--------------------------------------------------
|
|
34 |
public static final String ACCESS_RIGHTS_ESTR =
|
|
35 |
"Not necessary privilege rights to access this (SVG) content.";
|
|
36 |
|
|
37 |
//--------------------------------------------------
|
|
38 |
// STATIC CONSTANTS
|
|
39 |
//--------------------------------------------------
|
|
40 |
static final String SVG_NAMESPACE_URI =
|
|
41 |
"http://www.w3.org/2000/svg";
|
|
42 |
static final String XLINK_NAMESPACE_URI =
|
|
43 |
"http://www.w3.org/1999/xlink";
|
|
44 |
static final String ROOT_SVG_ELEMENT_NAME =
|
|
45 |
"svg";
|
|
46 |
|
|
47 |
//--------------------------------------------------
|
|
48 |
// STATIC CONSTANTS - Supported event types
|
|
49 |
//--------------------------------------------------
|
|
50 |
static final String EVENT_ACTIVATE = "DOMActivate";
|
|
51 |
static final String EVENT_CLICK = "click";
|
|
52 |
static final String EVENT_FOCUS_IN = "DOMFocusIn";
|
|
53 |
static final String EVENT_FOCUS_OUT = "DOMFocusOut";
|
|
54 |
|
|
55 |
//--------------------------------------------------
|
|
56 |
// STATIC CONSTANTS - SVGT element ids
|
|
57 |
//--------------------------------------------------
|
|
58 |
static final short EL_UNDEFINED = -1;
|
|
59 |
static final short EL_A = 0;
|
|
60 |
static final short EL_ANIMATE = 1;
|
|
61 |
static final short EL_ANIMATECOLOR = 2;
|
|
62 |
static final short EL_ANIMATEMOTION = 3;
|
|
63 |
static final short EL_ANIMATETRANSFORM = 4;
|
|
64 |
static final short EL_CIRCLE = 5;
|
|
65 |
static final short EL_DEFS = 6;
|
|
66 |
static final short EL_DESC = 7;
|
|
67 |
static final short EL_ELLIPSE = 8;
|
|
68 |
static final short EL_FONT = 9;
|
|
69 |
static final short EL_FONTFACE = 10;
|
|
70 |
static final short EL_FONTFACENAME = 11;
|
|
71 |
static final short EL_FONTFACESRC = 12;
|
|
72 |
static final short EL_FOREIGNOBJECT = 13;
|
|
73 |
static final short EL_G = 14;
|
|
74 |
static final short EL_GLYPH = 15;
|
|
75 |
static final short EL_HKERN = 16;
|
|
76 |
static final short EL_IMAGE = 17;
|
|
77 |
static final short EL_LINE = 18;
|
|
78 |
static final short EL_METADATA = 19;
|
|
79 |
static final short EL_MISSINGGLYPH = 20;
|
|
80 |
static final short EL_MPATH = 21;
|
|
81 |
static final short EL_PATH = 22;
|
|
82 |
static final short EL_POLYGON = 23;
|
|
83 |
static final short EL_POLYLINE = 24;
|
|
84 |
static final short EL_RECT = 25;
|
|
85 |
static final short EL_SET = 26;
|
|
86 |
static final short EL_SVG = 27;
|
|
87 |
static final short EL_SWITCH = 28;
|
|
88 |
static final short EL_TEXT = 29;
|
|
89 |
static final short EL_TITLE = 30;
|
|
90 |
static final short EL_USE = 31;
|
|
91 |
|
|
92 |
//--------------------------------------------------
|
|
93 |
// STATIC CONSTANTS - SVGT Attribute ids
|
|
94 |
//--------------------------------------------------
|
|
95 |
static final short AT_UNDEFINED = -1;
|
|
96 |
static final short AT_ACCENTHEIGHT = 50;
|
|
97 |
static final short AT_ACCUMULATE = 51;
|
|
98 |
static final short AT_ADDITIVE = 52;
|
|
99 |
static final short AT_ALPHABETIC = 53;
|
|
100 |
static final short AT_ARABICFORM = 54;
|
|
101 |
static final short AT_ASCENT = 55;
|
|
102 |
static final short AT_ATTRIBUTENAME = 56;
|
|
103 |
static final short AT_ATTRIBUTETYPE = 57;
|
|
104 |
static final short AT_BASEPROFILE = 58;
|
|
105 |
static final short AT_BBOX = 59;
|
|
106 |
static final short AT_BEGIN = 60;
|
|
107 |
static final short AT_BY = 61;
|
|
108 |
static final short AT_CALCMODE = 62;
|
|
109 |
static final short AT_CAPHEIGHT = 63;
|
|
110 |
static final short AT_COLOR = 64;
|
|
111 |
static final short AT_COLORRENDERING = 65;
|
|
112 |
// static final short AT_CONTENT = 66;
|
|
113 |
static final short AT_CX = 67;
|
|
114 |
static final short AT_CY = 68;
|
|
115 |
static final short AT_D = 69;
|
|
116 |
static final short AT_DESCENT = 70;
|
|
117 |
static final short AT_DISPLAY = 71;
|
|
118 |
static final short AT_DUR = 72;
|
|
119 |
static final short AT_END = 73;
|
|
120 |
static final short AT_FILL = 74;
|
|
121 |
static final short AT_FILLRULE = 75;
|
|
122 |
static final short AT_FONTFAMILY = 76;
|
|
123 |
static final short AT_FONTSIZE = 77;
|
|
124 |
static final short AT_FONTSTRETCH = 78;
|
|
125 |
static final short AT_FONTSTYLE = 79;
|
|
126 |
static final short AT_FONTVARIANT = 80;
|
|
127 |
static final short AT_FONTWEIGHT = 81;
|
|
128 |
static final short AT_FROM = 82;
|
|
129 |
static final short AT_G1 = 83;
|
|
130 |
static final short AT_G2 = 84;
|
|
131 |
static final short AT_GLYPHNAME = 85;
|
|
132 |
static final short AT_HANGING = 86;
|
|
133 |
static final short AT_HEIGHT = 87;
|
|
134 |
static final short AT_HORIZADVX = 88;
|
|
135 |
static final short AT_HORIZORIGINX = 89;
|
|
136 |
static final short AT_ID = 90;
|
|
137 |
static final short AT_IDEOGRAPHIC = 91;
|
|
138 |
static final short AT_K = 92;
|
|
139 |
static final short AT_KEYPOINTS = 93;
|
|
140 |
static final short AT_KEYSPLINES = 94;
|
|
141 |
static final short AT_KEYTIMES = 95;
|
|
142 |
static final short AT_LANG = 96;
|
|
143 |
static final short AT_MATHEMATICAL = 97;
|
|
144 |
static final short AT_MAX = 98;
|
|
145 |
static final short AT_MIN = 99;
|
|
146 |
static final short AT_NAME = 100;
|
|
147 |
static final short AT_ORIGIN = 101;
|
|
148 |
static final short AT_OVERLINEPOSITION = 102;
|
|
149 |
static final short AT_OVERLINETHICKNESS = 103;
|
|
150 |
static final short AT_PANOSE1 = 104;
|
|
151 |
static final short AT_PATH = 105;
|
|
152 |
static final short AT_PATHLENGTH = 106;
|
|
153 |
static final short AT_POINTS = 107;
|
|
154 |
static final short AT_PRESERVEASPECTRATIO = 108;
|
|
155 |
static final short AT_R = 109;
|
|
156 |
static final short AT_REPEATCOUNT = 110;
|
|
157 |
static final short AT_REPEATDUR = 111;
|
|
158 |
static final short AT_REQUIREDEXTENSIONS = 112;
|
|
159 |
static final short AT_REQUIREDFEATURES = 113;
|
|
160 |
static final short AT_RESTART = 114;
|
|
161 |
static final short AT_ROTATE = 115;
|
|
162 |
static final short AT_RX = 116;
|
|
163 |
static final short AT_RY = 117;
|
|
164 |
static final short AT_SLOPE = 118;
|
|
165 |
static final short AT_STEMH = 119;
|
|
166 |
static final short AT_STEMV = 120;
|
|
167 |
static final short AT_STRIKETHROUGHPOSITION = 121;
|
|
168 |
static final short AT_STRIKETHROUGHTHICKNESS = 122;
|
|
169 |
static final short AT_STROKE = 123;
|
|
170 |
static final short AT_STROKEDASHARRAY = 124;
|
|
171 |
static final short AT_STROKEDASHOFFSET = 125;
|
|
172 |
static final short AT_STROKELINECAP = 126;
|
|
173 |
static final short AT_STROKELINEJOIN = 127;
|
|
174 |
static final short AT_STROKEMITERLIMIT = 128;
|
|
175 |
static final short AT_STROKEWIDTH = 129;
|
|
176 |
static final short AT_STYLE = 130;
|
|
177 |
static final short AT_SYSTEMLANGUAGE = 131;
|
|
178 |
static final short AT_TARGET = 132;
|
|
179 |
static final short AT_TEXTANCHOR = 133;
|
|
180 |
static final short AT_TO = 134;
|
|
181 |
static final short AT_TRANSFORM = 135;
|
|
182 |
static final short AT_TYPE = 136;
|
|
183 |
static final short AT_U1 = 137;
|
|
184 |
static final short AT_U2 = 138;
|
|
185 |
static final short AT_UNDERLINEPOSITION = 139;
|
|
186 |
static final short AT_UNDERLINETHICKNESS = 140;
|
|
187 |
static final short AT_UNICODE = 141;
|
|
188 |
static final short AT_UNICODERANGE = 142;
|
|
189 |
static final short AT_UNITSPEREM = 143;
|
|
190 |
static final short AT_VALUES = 144;
|
|
191 |
static final short AT_VERSION = 145;
|
|
192 |
static final short AT_VIEWBOX = 146;
|
|
193 |
static final short AT_VISIBILITY = 147;
|
|
194 |
static final short AT_WIDTH = 148;
|
|
195 |
static final short AT_WIDTHS = 149;
|
|
196 |
static final short AT_X = 150;
|
|
197 |
static final short AT_XHEIGHT = 151;
|
|
198 |
static final short AT_X1 = 152;
|
|
199 |
static final short AT_X2 = 153;
|
|
200 |
static final short AT_XLINKACTUATE = 154;
|
|
201 |
static final short AT_XLINKARCROLE = 155;
|
|
202 |
static final short AT_XLINKHREF = 156;
|
|
203 |
static final short AT_XLINKROLE = 157;
|
|
204 |
static final short AT_XLINKSHOW = 158;
|
|
205 |
static final short AT_XLINKTITLE = 159;
|
|
206 |
static final short AT_XLINKTYPE = 160;
|
|
207 |
static final short AT_XMLBASE = 161;
|
|
208 |
static final short AT_XMLLANG = 162;
|
|
209 |
static final short AT_XMLSPACE = 163;
|
|
210 |
static final short AT_Y = 164;
|
|
211 |
static final short AT_Y1 = 165;
|
|
212 |
static final short AT_Y2 = 166;
|
|
213 |
static final short AT_ZOOMANDPAN = 167;
|
|
214 |
// not in the spec but used to correctly implement animateMotion
|
|
215 |
static final short AT_MOTIONTRANSFORM = 168;
|
|
216 |
// not actually an attribute, but needed for desc, title, and text
|
|
217 |
static final short AT_STRING = 169;
|
|
218 |
static final short AT_TEXTDECORATION = 170;
|
|
219 |
static final short AT_HORIZORIGINY = 171;
|
|
220 |
static final short AT_MOUSEEVENT = 172;
|
|
221 |
static final short AT_USERBBOX = 173;
|
|
222 |
|
|
223 |
//--------------------------------------------------
|
|
224 |
// STATIC CONSTANTS - Error flags
|
|
225 |
//--------------------------------------------------
|
|
226 |
static final short DEFAULT_INHERIT = -2; // = null on native engine;
|
|
227 |
static final short SVG_ERROR = -1;
|
|
228 |
static final short TEXT_NOT_SHORT = -3;
|
|
229 |
|
|
230 |
//--------------------------------------------------
|
|
231 |
// STATIC CONSTANTS - A constant for each type of value
|
|
232 |
//--------------------------------------------------
|
|
233 |
static final short VAL_EVENT = 200;
|
|
234 |
static final short VAL_INTEGER = 201;
|
|
235 |
static final short VAL_PAINT = 202;
|
|
236 |
static final short VAL_POINT = 203;
|
|
237 |
static final short VAL_REAL = 204;
|
|
238 |
static final short VAL_STRING = 205;
|
|
239 |
static final short VAL_TIME = 206;
|
|
240 |
static final short VAL_TRANSFORM = 207;
|
|
241 |
static final short VAL_VECTOR = 208;
|
|
242 |
// These are used for animation purposes
|
|
243 |
static final short VAL_VECTOR_POINT = 215;
|
|
244 |
static final short VAL_VECTOR_REAL = 216;
|
|
245 |
static final short VAL_VECTOR_STRING = 217;
|
|
246 |
static final short VAL_VECTOR_PATH = 218;
|
|
247 |
// VAL_VECTOR_X + VECTOR_TO_VAL = VAL_X
|
|
248 |
static final short VECTOR_TO_VAL = -12;
|
|
249 |
|
|
250 |
//--------------------------------------------------
|
|
251 |
// STATIC CONSTANTS - Constants for "choices"
|
|
252 |
//--------------------------------------------------
|
|
253 |
// Preserve aspect ratio constants
|
|
254 |
static final short PAR_NONE = 310;
|
|
255 |
static final short PAR_XMIDYMID = 311;
|
|
256 |
// Zoom and pan constants
|
|
257 |
static final short ZPN_MAGNIFY = 320;
|
|
258 |
static final short ZPN_DISABLE = 321;
|
|
259 |
// Paint
|
|
260 |
static final short PAINT_NONE = 325;
|
|
261 |
static final short PAINT_CURRENT = 326;
|
|
262 |
static final short PAINT_COLOR = 327;
|
|
263 |
static final short PAINT_INHERIT = 328;
|
|
264 |
// Fonts
|
|
265 |
static final short FONT_ALL = 330;
|
|
266 |
static final short FONT_NORMAL = 331;
|
|
267 |
static final short FONT_STYLE_ITALIC = 332;
|
|
268 |
static final short FONT_STYLE_OBLIQUE = 333;
|
|
269 |
static final short FONT_VARIANT_SMALLCAPS = 334;
|
|
270 |
static final short FONT_WEIGHT_BOLD = 335;
|
|
271 |
static final short FONT_WEIGHT_BOLDER = 336;
|
|
272 |
static final short FONT_WEIGHT_LIGHTER = 337;
|
|
273 |
static final short FONT_WEIGHT_100 = 338;
|
|
274 |
static final short FONT_WEIGHT_200 = 339;
|
|
275 |
static final short FONT_WEIGHT_300 = 340;
|
|
276 |
static final short FONT_WEIGHT_400 = 341;
|
|
277 |
static final short FONT_WEIGHT_500 = 342;
|
|
278 |
static final short FONT_WEIGHT_600 = 343;
|
|
279 |
static final short FONT_WEIGHT_700 = 344;
|
|
280 |
static final short FONT_WEIGHT_800 = 345;
|
|
281 |
static final short FONT_WEIGHT_900 = 346;
|
|
282 |
static final short FONT_STRETCH_WIDER = 347;
|
|
283 |
static final short FONT_STRETCH_NARROWER = 348;
|
|
284 |
static final short FONT_STRETCH_ULTRA_COND = 349;
|
|
285 |
static final short FONT_STRETCH_EXTRA_COND = 350;
|
|
286 |
static final short FONT_STRETCH_COND = 351;
|
|
287 |
static final short FONT_STRETCH_SEMI_COND = 352;
|
|
288 |
static final short FONT_STRETCH_SEMI_EXPD = 353;
|
|
289 |
static final short FONT_STRETCH_EXPD = 354;
|
|
290 |
static final short FONT_STRETCH_EXTRA_EXPD = 355;
|
|
291 |
static final short FONT_STRETCH_ULTRA_EXPD = 356;
|
|
292 |
// Text
|
|
293 |
static final short TEXT_ANCHOR_START = 360;
|
|
294 |
static final short TEXT_ANCHOR_MIDDLE = 361;
|
|
295 |
static final short TEXT_ANCHOR_END = 362;
|
|
296 |
static final short TEXT_UNDER_LINE = 363;
|
|
297 |
static final short TEXT_OVER_LINE = 364;
|
|
298 |
static final short TEXT_LINE_THROUGH = 365;
|
|
299 |
// These are actual sizes in 8:8 fixed point, not "choices"
|
|
300 |
static final int FONT_SIZE_XXSMALL = 0x20000;
|
|
301 |
static final int FONT_SIZE_XSMALL = 0x40000;
|
|
302 |
static final int FONT_SIZE_SMALL = 0x60000;
|
|
303 |
static final int FONT_SIZE_MEDIUM = 0xa0000;
|
|
304 |
static final int FONT_SIZE_LARGE = 0x100000;
|
|
305 |
static final int FONT_SIZE_XLARGE = 0x140000;
|
|
306 |
static final int FONT_SIZE_XXLARGE = 0x180000;
|
|
307 |
|
|
308 |
//--------------------------------------------------
|
|
309 |
// STATIC CONSTANTS - Styles
|
|
310 |
//--------------------------------------------------
|
|
311 |
// Fill
|
|
312 |
static final short FILL_RULE_EVENODD = 375;
|
|
313 |
static final short FILL_RULE_NONZERO = 376;
|
|
314 |
// Display
|
|
315 |
static final short DISPLAY_NONE = 380;
|
|
316 |
static final short DISPLAY_OTHER = 381;
|
|
317 |
// Visibility
|
|
318 |
static final short VISIBILITY_VISIBLE = 385;
|
|
319 |
static final short VISIBILITY_OTHER = 386;
|
|
320 |
// Color-rendering
|
|
321 |
static final short COLOR_RENDERING_AUTO = 390;
|
|
322 |
static final short COLOR_RENDERING_SPEED = 391;
|
|
323 |
static final short COLOR_RENDERING_QUALITY = 392;
|
|
324 |
// Strokes
|
|
325 |
// MUST PRESERVE ORDER!!
|
|
326 |
static final short STROKE_LINECAP_BUTT = 395;
|
|
327 |
static final short STROKE_LINECAP_ROUND = 396;
|
|
328 |
static final short STROKE_LINECAP_SQUARE = 397;
|
|
329 |
static final short STROKE_LINEJOIN_MITER = 400;
|
|
330 |
static final short STROKE_LINEJOIN_ROUND = 401;
|
|
331 |
static final short STROKE_LINEJOIN_BEVEL = 402;
|
|
332 |
|
|
333 |
//--------------------------------------------------
|
|
334 |
// STATIC CONSTANTS - Animation
|
|
335 |
//--------------------------------------------------
|
|
336 |
static final short ANIM_INDEFINITE = 445;
|
|
337 |
static final short ACCUMULATE_NONE = 450;
|
|
338 |
static final short ACCUMULATE_SUM = 451;
|
|
339 |
static final short ADDITIVE_REPLACE = 455;
|
|
340 |
static final short ADDITIVE_SUM = 456;
|
|
341 |
static final short CALC_MODE_DISCRETE = 460;
|
|
342 |
static final short CALC_MODE_LINEAR = 461;
|
|
343 |
static final short CALC_MODE_PACED = 462;
|
|
344 |
static final short CALC_MODE_SPLINE = 463;
|
|
345 |
static final short FILL_REMOVE = 465;
|
|
346 |
static final short FILL_FREEZE = 466;
|
|
347 |
static final short RESTART_ALWAYS = 470;
|
|
348 |
static final short RESTART_NEVER = 471;
|
|
349 |
static final short RESTART_WHENNOTACTIVE = 472;
|
|
350 |
static final short TYPE_TRANSLATE = 475;
|
|
351 |
static final short TYPE_SCALE = 476;
|
|
352 |
static final short TYPE_ROTATE = 477;
|
|
353 |
static final short TYPE_SKEWX = 478;
|
|
354 |
static final short TYPE_SKEWY = 479;
|
|
355 |
static final short ATTR_TYPE_CSS = 485;
|
|
356 |
static final short ATTR_TYPE_XML = 486;
|
|
357 |
static final short ATTR_TYPE_AUTO = 487;
|
|
358 |
static final short ROTATE_AUTO = 490;
|
|
359 |
static final short ROTATE_AUTOREVERSE = 491;
|
|
360 |
static final short ANIM_FROM_TO = 500;
|
|
361 |
static final short ANIM_FROM_BY = 501;
|
|
362 |
static final short ANIM_BY = 502;
|
|
363 |
static final short ANIM_TO = 503;
|
|
364 |
static final short ANIM_VALUES = 504;
|
|
365 |
static final short ANIM_PATH = 505;
|
|
366 |
|
|
367 |
//--------------------------------------------------
|
|
368 |
// STATIC CONSTANTS - Path Commands
|
|
369 |
//--------------------------------------------------
|
|
370 |
static final short PATH_COMMAND_M = 600;
|
|
371 |
static final short PATH_COMMAND_m = 601;
|
|
372 |
static final short PATH_COMMAND_Z = 602;
|
|
373 |
static final short PATH_COMMAND_L = 603;
|
|
374 |
static final short PATH_COMMAND_l = 604;
|
|
375 |
static final short PATH_COMMAND_H = 605;
|
|
376 |
static final short PATH_COMMAND_h = 606;
|
|
377 |
static final short PATH_COMMAND_V = 607;
|
|
378 |
static final short PATH_COMMAND_v = 608;
|
|
379 |
static final short PATH_COMMAND_C = 609;
|
|
380 |
static final short PATH_COMMAND_c = 610;
|
|
381 |
static final short PATH_COMMAND_S = 611;
|
|
382 |
static final short PATH_COMMAND_s = 612;
|
|
383 |
static final short PATH_COMMAND_Q = 613;
|
|
384 |
static final short PATH_COMMAND_q = 614;
|
|
385 |
static final short PATH_COMMAND_T = 615;
|
|
386 |
static final short PATH_COMMAND_t = 616;
|
|
387 |
|
|
388 |
//--------------------------------------------------
|
|
389 |
// STATIC CONSTANTS - Events
|
|
390 |
//--------------------------------------------------
|
|
391 |
// Indicates that the animation has started
|
|
392 |
static final short EVENT_BEGIN = 650;
|
|
393 |
// Indicates that the animation has finished
|
|
394 |
static final short EVENT_END = 651;
|
|
395 |
// Indicates that the animation has repeated
|
|
396 |
static final short EVENT_REPEAT = 652;
|
|
397 |
static final short EVENT_BEGIN_EL = 653;
|
|
398 |
static final short EVENT_END_EL = 654;
|
|
399 |
|
|
400 |
//--------------------------------------------------
|
|
401 |
// VARIABLES
|
|
402 |
//--------------------------------------------------
|
|
403 |
private static M2GSVGConstants sInstance = null;
|
|
404 |
|
|
405 |
String iEmptySvgDocument = null;
|
|
406 |
String iSvgBaseProfileName = null;
|
|
407 |
String iSvgBaseProfileVersion = null;
|
|
408 |
Hashtable iAllElements = null;
|
|
409 |
Hashtable iAllAttributes = null;
|
|
410 |
Vector iQualifiedElements = null;
|
|
411 |
Vector iAnimatableElements = null;
|
|
412 |
Vector iReadOnlyElements = null;
|
|
413 |
|
|
414 |
//--------------------------------------------------
|
|
415 |
// METHODS
|
|
416 |
//--------------------------------------------------
|
|
417 |
/**
|
|
418 |
* Constructor
|
|
419 |
*/
|
|
420 |
private M2GSVGConstants()
|
|
421 |
{
|
|
422 |
// Profile name
|
|
423 |
iSvgBaseProfileName = System.getProperty("microedition.m2g.svg.baseProfile");
|
|
424 |
// Profile version
|
|
425 |
iSvgBaseProfileVersion = System.getProperty("microedition.m2g.svg.version");
|
|
426 |
|
|
427 |
// Empty svg document
|
|
428 |
// "<svg version=\"1.1\" baseProfile=\"tiny\" width=\"100\" height=\"100\"></svg>";
|
|
429 |
StringBuffer buf = new StringBuffer();
|
|
430 |
buf.append("<svg version=\"").append(iSvgBaseProfileVersion);
|
|
431 |
buf.append("\" baseProfile=\"").append(iSvgBaseProfileName);
|
|
432 |
buf.append("\" width=\"100\" height=\"100\"></svg>");
|
|
433 |
iEmptySvgDocument = buf.toString();
|
|
434 |
|
|
435 |
// Elements
|
|
436 |
iAllElements = new Hashtable(32);
|
|
437 |
iAllElements.put(new Short(EL_A), "a"); // 1
|
|
438 |
iAllElements.put(new Short(EL_ANIMATE), "animate"); // 2
|
|
439 |
iAllElements.put(new Short(EL_ANIMATECOLOR), "animateColor"); // 3
|
|
440 |
iAllElements.put(new Short(EL_ANIMATEMOTION), "animateMotion"); // 4
|
|
441 |
iAllElements.put(new Short(EL_ANIMATETRANSFORM), "animateTransform"); // 5
|
|
442 |
iAllElements.put(new Short(EL_CIRCLE), "circle"); // 6
|
|
443 |
iAllElements.put(new Short(EL_DEFS), "defs"); // 7
|
|
444 |
iAllElements.put(new Short(EL_DESC), "desc"); // 8
|
|
445 |
iAllElements.put(new Short(EL_ELLIPSE), "ellipse"); // 9
|
|
446 |
iAllElements.put(new Short(EL_FONT), "font"); // 10
|
|
447 |
iAllElements.put(new Short(EL_FONTFACE), "font-face"); // 11
|
|
448 |
iAllElements.put(new Short(EL_FONTFACENAME), "font-face-name"); // 12
|
|
449 |
iAllElements.put(new Short(EL_FONTFACESRC), "font-face-src"); // 13
|
|
450 |
iAllElements.put(new Short(EL_FOREIGNOBJECT), "foreignObject"); // 14
|
|
451 |
iAllElements.put(new Short(EL_G), "g"); // 15
|
|
452 |
iAllElements.put(new Short(EL_GLYPH), "glyph"); // 16
|
|
453 |
iAllElements.put(new Short(EL_HKERN), "hkern"); // 17
|
|
454 |
iAllElements.put(new Short(EL_IMAGE), "image"); // 18
|
|
455 |
iAllElements.put(new Short(EL_LINE), "line"); // 19
|
|
456 |
iAllElements.put(new Short(EL_METADATA), "metadata"); // 20
|
|
457 |
iAllElements.put(new Short(EL_MISSINGGLYPH), "missing-glyph"); // 21
|
|
458 |
iAllElements.put(new Short(EL_MPATH), "mpath"); // 22
|
|
459 |
iAllElements.put(new Short(EL_PATH), "path"); // 23
|
|
460 |
iAllElements.put(new Short(EL_POLYGON), "polygon"); // 24
|
|
461 |
iAllElements.put(new Short(EL_POLYLINE), "polyline"); // 25
|
|
462 |
iAllElements.put(new Short(EL_RECT), "rect"); // 26
|
|
463 |
iAllElements.put(new Short(EL_SET), "set"); // 27
|
|
464 |
iAllElements.put(new Short(EL_SVG), "svg"); // 28
|
|
465 |
iAllElements.put(new Short(EL_SWITCH), "switch"); // 29
|
|
466 |
iAllElements.put(new Short(EL_TEXT), "text"); // 30
|
|
467 |
iAllElements.put(new Short(EL_TITLE), "title"); // 31
|
|
468 |
iAllElements.put(new Short(EL_USE), "use"); // 32
|
|
469 |
|
|
470 |
// Attributes
|
|
471 |
iAllAttributes = new Hashtable(118);
|
|
472 |
iAllAttributes.put(new Short(AT_STRING), "#text"); // 1
|
|
473 |
iAllAttributes.put(new Short(AT_ACCENTHEIGHT), "accent-heigh"); // 2
|
|
474 |
iAllAttributes.put(new Short(AT_ACCUMULATE), "accumulate"); // 3
|
|
475 |
iAllAttributes.put(new Short(AT_ADDITIVE), "additive"); // 4
|
|
476 |
iAllAttributes.put(new Short(AT_ALPHABETIC), "alphabetic"); // 5
|
|
477 |
iAllAttributes.put(new Short(AT_ARABICFORM), "arabic-form"); // 6
|
|
478 |
iAllAttributes.put(new Short(AT_ASCENT), "ascent"); // 7
|
|
479 |
iAllAttributes.put(new Short(AT_ATTRIBUTENAME), "attributeName"); // 8
|
|
480 |
iAllAttributes.put(new Short(AT_ATTRIBUTETYPE), "attributeType"); // 9
|
|
481 |
iAllAttributes.put(new Short(AT_BASEPROFILE), "baseProfile"); // 10
|
|
482 |
iAllAttributes.put(new Short(AT_BBOX), "bbox"); // 11
|
|
483 |
iAllAttributes.put(new Short(AT_BEGIN), "begin"); // 12
|
|
484 |
iAllAttributes.put(new Short(AT_BY), "by"); // 13
|
|
485 |
iAllAttributes.put(new Short(AT_CALCMODE), "calcMode"); // 14
|
|
486 |
iAllAttributes.put(new Short(AT_CAPHEIGHT), "cap-height"); // 15
|
|
487 |
iAllAttributes.put(new Short(AT_COLOR), "color"); // 16
|
|
488 |
iAllAttributes.put(new Short(AT_COLORRENDERING), "color-rendering"); // 17
|
|
489 |
iAllAttributes.put(new Short(AT_CX), "cx"); // 18
|
|
490 |
iAllAttributes.put(new Short(AT_CY), "cy"); // 19
|
|
491 |
iAllAttributes.put(new Short(AT_D), "d"); // 20
|
|
492 |
iAllAttributes.put(new Short(AT_DESCENT), "descent"); // 21
|
|
493 |
iAllAttributes.put(new Short(AT_DISPLAY), "display"); // 22
|
|
494 |
iAllAttributes.put(new Short(AT_DUR), "dur"); // 23
|
|
495 |
iAllAttributes.put(new Short(AT_END), "end"); // 24
|
|
496 |
iAllAttributes.put(new Short(AT_FILL), "fill"); // 25
|
|
497 |
iAllAttributes.put(new Short(AT_FILLRULE), "fill-rule"); // 26
|
|
498 |
iAllAttributes.put(new Short(AT_FONTFAMILY), "font-family"); // 27
|
|
499 |
iAllAttributes.put(new Short(AT_FONTSIZE), "font-size"); // 28
|
|
500 |
iAllAttributes.put(new Short(AT_FONTSTRETCH), "font-stretch"); // 29
|
|
501 |
iAllAttributes.put(new Short(AT_FONTSTYLE), "font-style"); // 30
|
|
502 |
iAllAttributes.put(new Short(AT_FONTVARIANT), "font-variant"); // 31
|
|
503 |
iAllAttributes.put(new Short(AT_FONTWEIGHT), "font-weight"); // 32
|
|
504 |
iAllAttributes.put(new Short(AT_FROM), "from"); // 33
|
|
505 |
iAllAttributes.put(new Short(AT_G1), "g1"); // 34
|
|
506 |
iAllAttributes.put(new Short(AT_G2), "g2"); // 35
|
|
507 |
iAllAttributes.put(new Short(AT_GLYPHNAME), "glyph-name"); // 36
|
|
508 |
iAllAttributes.put(new Short(AT_HANGING), "hanging"); // 37
|
|
509 |
iAllAttributes.put(new Short(AT_HEIGHT), "height"); // 38
|
|
510 |
iAllAttributes.put(new Short(AT_HORIZADVX), "horiz-adv-x"); // 39
|
|
511 |
iAllAttributes.put(new Short(AT_HORIZORIGINX), "horiz-origin-x"); // 40
|
|
512 |
iAllAttributes.put(new Short(AT_ID), "id"); // 41
|
|
513 |
iAllAttributes.put(new Short(AT_IDEOGRAPHIC), "ideographic"); // 42
|
|
514 |
iAllAttributes.put(new Short(AT_K), "k"); // 43
|
|
515 |
iAllAttributes.put(new Short(AT_KEYPOINTS), "keyPoints"); // 44
|
|
516 |
iAllAttributes.put(new Short(AT_KEYSPLINES), "keySplines"); // 45
|
|
517 |
iAllAttributes.put(new Short(AT_KEYTIMES), "keyTimes"); // 46
|
|
518 |
iAllAttributes.put(new Short(AT_LANG), "lang"); // 47
|
|
519 |
iAllAttributes.put(new Short(AT_MATHEMATICAL), "mathematical"); // 48
|
|
520 |
iAllAttributes.put(new Short(AT_MAX), "max"); // 49
|
|
521 |
iAllAttributes.put(new Short(AT_MIN), "min"); // 50
|
|
522 |
iAllAttributes.put(new Short(AT_NAME), "name"); // 51
|
|
523 |
iAllAttributes.put(new Short(AT_ORIGIN), "origin"); // 52
|
|
524 |
iAllAttributes.put(new Short(AT_OVERLINEPOSITION), "overline-position"); // 53
|
|
525 |
iAllAttributes.put(new Short(AT_OVERLINETHICKNESS), "overline-thickness"); // 54
|
|
526 |
iAllAttributes.put(new Short(AT_PANOSE1), "panose-1"); // 55
|
|
527 |
iAllAttributes.put(new Short(AT_PATH), "path"); // 56
|
|
528 |
iAllAttributes.put(new Short(AT_PATHLENGTH), "pathLength"); // 57
|
|
529 |
iAllAttributes.put(new Short(AT_POINTS), "points"); // 58
|
|
530 |
iAllAttributes.put(new Short(AT_PRESERVEASPECTRATIO), "preserveAspectRatio"); // 59
|
|
531 |
iAllAttributes.put(new Short(AT_R), "r"); // 60
|
|
532 |
iAllAttributes.put(new Short(AT_REPEATCOUNT), "repeatCount"); // 61
|
|
533 |
iAllAttributes.put(new Short(AT_REPEATDUR), "repeatDur"); // 62
|
|
534 |
iAllAttributes.put(new Short(AT_REQUIREDEXTENSIONS), "requiredExtensions"); // 63
|
|
535 |
iAllAttributes.put(new Short(AT_REQUIREDFEATURES), "requiredFeatures"); // 64
|
|
536 |
iAllAttributes.put(new Short(AT_RESTART), "restart"); // 65
|
|
537 |
iAllAttributes.put(new Short(AT_ROTATE), "rotate"); // 66
|
|
538 |
iAllAttributes.put(new Short(AT_RX), "rx"); // 67
|
|
539 |
iAllAttributes.put(new Short(AT_RY), "ry"); // 68
|
|
540 |
iAllAttributes.put(new Short(AT_SLOPE), "slope"); // 69
|
|
541 |
iAllAttributes.put(new Short(AT_STEMH), "stemh"); // 70
|
|
542 |
iAllAttributes.put(new Short(AT_STEMV), "stemv"); // 71
|
|
543 |
iAllAttributes.put(new Short(AT_STRIKETHROUGHPOSITION), "strikethrough-position"); // 72
|
|
544 |
iAllAttributes.put(new Short(AT_STRIKETHROUGHTHICKNESS), "strikethrough-thickness"); // 73
|
|
545 |
iAllAttributes.put(new Short(AT_STROKE), "stroke"); // 74
|
|
546 |
iAllAttributes.put(new Short(AT_STROKEDASHARRAY), "stroke-dasharray"); // 75
|
|
547 |
iAllAttributes.put(new Short(AT_STROKEDASHOFFSET), "stroke-dashoffset"); // 76
|
|
548 |
iAllAttributes.put(new Short(AT_STROKELINECAP), "stroke-linecap"); // 77
|
|
549 |
iAllAttributes.put(new Short(AT_STROKELINEJOIN), "stroke-linejoin"); // 78
|
|
550 |
iAllAttributes.put(new Short(AT_STROKEMITERLIMIT), "stroke-miterlimit"); // 79
|
|
551 |
iAllAttributes.put(new Short(AT_STROKEWIDTH), "stroke-width"); // 80
|
|
552 |
iAllAttributes.put(new Short(AT_STYLE), "style"); // 81
|
|
553 |
iAllAttributes.put(new Short(AT_SYSTEMLANGUAGE), "systemLanguage"); // 82
|
|
554 |
iAllAttributes.put(new Short(AT_TARGET), "target"); // 83
|
|
555 |
iAllAttributes.put(new Short(AT_TEXTANCHOR), "text-anchor"); // 84
|
|
556 |
iAllAttributes.put(new Short(AT_TO), "to"); // 85
|
|
557 |
iAllAttributes.put(new Short(AT_TRANSFORM), "transform"); // 86
|
|
558 |
iAllAttributes.put(new Short(AT_TYPE), "type"); // 87
|
|
559 |
iAllAttributes.put(new Short(AT_U1), "u1"); // 88
|
|
560 |
iAllAttributes.put(new Short(AT_U2), "u2"); // 89
|
|
561 |
iAllAttributes.put(new Short(AT_UNDERLINEPOSITION), "underline-position"); // 90
|
|
562 |
iAllAttributes.put(new Short(AT_UNDERLINETHICKNESS), "underline-thickness"); // 91
|
|
563 |
iAllAttributes.put(new Short(AT_UNICODE), "unicode"); // 92
|
|
564 |
iAllAttributes.put(new Short(AT_UNICODERANGE), "unicode-range"); // 93
|
|
565 |
iAllAttributes.put(new Short(AT_UNITSPEREM), "units-per-em"); // 94
|
|
566 |
iAllAttributes.put(new Short(AT_VALUES), "values"); // 95
|
|
567 |
iAllAttributes.put(new Short(AT_VERSION), "version"); // 96
|
|
568 |
iAllAttributes.put(new Short(AT_VIEWBOX), "viewBox"); // 97
|
|
569 |
iAllAttributes.put(new Short(AT_VISIBILITY), "visibility"); // 98
|
|
570 |
iAllAttributes.put(new Short(AT_WIDTH), "width"); // 99
|
|
571 |
iAllAttributes.put(new Short(AT_WIDTHS), "widths"); // 100
|
|
572 |
iAllAttributes.put(new Short(AT_X), "x"); // 101
|
|
573 |
iAllAttributes.put(new Short(AT_XHEIGHT), "xheight"); // 102
|
|
574 |
iAllAttributes.put(new Short(AT_X1), "x1"); // 103
|
|
575 |
iAllAttributes.put(new Short(AT_X2), "x2"); // 104
|
|
576 |
iAllAttributes.put(new Short(AT_XLINKACTUATE), "xlink:actuate"); // 105
|
|
577 |
iAllAttributes.put(new Short(AT_XLINKARCROLE), "xlink:arcrole"); // 106
|
|
578 |
iAllAttributes.put(new Short(AT_XMLBASE), "xlink:base"); // 107
|
|
579 |
iAllAttributes.put(new Short(AT_XLINKHREF), "xlink:href"); // 108
|
|
580 |
iAllAttributes.put(new Short(AT_XLINKROLE), "xlink:role"); // 109
|
|
581 |
iAllAttributes.put(new Short(AT_XLINKSHOW), "xlink:show"); // 110
|
|
582 |
iAllAttributes.put(new Short(AT_XLINKTITLE), "xlink:title"); // 111
|
|
583 |
iAllAttributes.put(new Short(AT_XLINKTYPE), "xlink:type"); // 112
|
|
584 |
iAllAttributes.put(new Short(AT_XMLLANG), "xml:lang"); // 113
|
|
585 |
iAllAttributes.put(new Short(AT_XMLSPACE), "xml:space"); // 114
|
|
586 |
iAllAttributes.put(new Short(AT_Y), "y"); // 115
|
|
587 |
iAllAttributes.put(new Short(AT_Y1), "y1"); // 116
|
|
588 |
iAllAttributes.put(new Short(AT_Y2), "y2"); // 117
|
|
589 |
iAllAttributes.put(new Short(AT_ZOOMANDPAN), "zoomAndPan"); // 118
|
|
590 |
|
|
591 |
// Qualified elements
|
|
592 |
iQualifiedElements = new Vector(10);
|
|
593 |
iQualifiedElements.addElement("a"); // 1
|
|
594 |
iQualifiedElements.addElement("circle"); // 2
|
|
595 |
iQualifiedElements.addElement("ellipse"); // 3
|
|
596 |
iQualifiedElements.addElement("g"); // 4
|
|
597 |
iQualifiedElements.addElement("image"); // 5
|
|
598 |
iQualifiedElements.addElement("line"); // 6
|
|
599 |
iQualifiedElements.addElement("path"); // 7
|
|
600 |
iQualifiedElements.addElement("rect"); // 8
|
|
601 |
iQualifiedElements.addElement("text"); // 9
|
|
602 |
iQualifiedElements.addElement("use"); // 10
|
|
603 |
|
|
604 |
// Animatable elements
|
|
605 |
iAnimatableElements = new Vector(6);
|
|
606 |
iAnimatableElements.addElement("animate"); // 1
|
|
607 |
iAnimatableElements.addElement("animateColor"); // 2
|
|
608 |
iAnimatableElements.addElement("animateMotion"); // 3
|
|
609 |
iAnimatableElements.addElement("animateTransform"); // 4
|
|
610 |
iAnimatableElements.addElement("mpath"); // 5
|
|
611 |
iAnimatableElements.addElement("set"); // 6
|
|
612 |
|
|
613 |
// Read only elements
|
|
614 |
iReadOnlyElements = new Vector(19);
|
|
615 |
iReadOnlyElements.addElement("animateColor"); // 1
|
|
616 |
iReadOnlyElements.addElement("animateMotion"); // 2
|
|
617 |
iReadOnlyElements.addElement("animateTransform"); // 3
|
|
618 |
iReadOnlyElements.addElement("defs"); // 4
|
|
619 |
iReadOnlyElements.addElement("desc"); // 5
|
|
620 |
iReadOnlyElements.addElement("font"); // 6
|
|
621 |
iReadOnlyElements.addElement("font-face"); // 7
|
|
622 |
iReadOnlyElements.addElement("font-face-name"); // 8
|
|
623 |
iReadOnlyElements.addElement("font-face-src"); // 9
|
|
624 |
iReadOnlyElements.addElement("foreignObject"); // 10
|
|
625 |
iReadOnlyElements.addElement("glyph"); // 11
|
|
626 |
iReadOnlyElements.addElement("hkern"); // 12
|
|
627 |
iReadOnlyElements.addElement("metadata"); // 13
|
|
628 |
iReadOnlyElements.addElement("missing-glyph"); // 14
|
|
629 |
iReadOnlyElements.addElement("mpath"); // 15
|
|
630 |
iReadOnlyElements.addElement("polygon"); // 16
|
|
631 |
iReadOnlyElements.addElement("polyline"); // 17
|
|
632 |
iReadOnlyElements.addElement("set"); // 18
|
|
633 |
iReadOnlyElements.addElement("switch"); // 19
|
|
634 |
}
|
|
635 |
|
|
636 |
//--------------------------------------------------
|
|
637 |
// STATIC METHODS
|
|
638 |
//--------------------------------------------------
|
|
639 |
/**
|
|
640 |
* Determines if the specified parentElement can have the specified childElement.
|
|
641 |
* This method works for only the element types that can be added in JSR-226.
|
|
642 |
*/
|
|
643 |
static final boolean checkElementAsChild(short aParentElement, short aChildElement)
|
|
644 |
{
|
|
645 |
switch (aParentElement)
|
|
646 |
{
|
|
647 |
case EL_A:
|
|
648 |
switch (aChildElement)
|
|
649 |
{
|
|
650 |
case EL_A:
|
|
651 |
case EL_CIRCLE:
|
|
652 |
case EL_ELLIPSE:
|
|
653 |
case EL_G:
|
|
654 |
case EL_IMAGE:
|
|
655 |
case EL_LINE:
|
|
656 |
case EL_PATH:
|
|
657 |
case EL_RECT:
|
|
658 |
case EL_TEXT:
|
|
659 |
case EL_USE:
|
|
660 |
return true;
|
|
661 |
default:
|
|
662 |
return false;
|
|
663 |
}
|
|
664 |
|
|
665 |
case EL_ANIMATE:
|
|
666 |
case EL_ANIMATECOLOR:
|
|
667 |
case EL_ANIMATEMOTION:
|
|
668 |
case EL_ANIMATETRANSFORM:
|
|
669 |
case EL_CIRCLE:
|
|
670 |
return false;
|
|
671 |
|
|
672 |
case EL_DEFS:
|
|
673 |
switch (aChildElement)
|
|
674 |
{
|
|
675 |
case EL_A:
|
|
676 |
case EL_CIRCLE:
|
|
677 |
case EL_ELLIPSE:
|
|
678 |
case EL_G:
|
|
679 |
case EL_IMAGE:
|
|
680 |
case EL_LINE:
|
|
681 |
case EL_PATH:
|
|
682 |
case EL_RECT:
|
|
683 |
case EL_TEXT:
|
|
684 |
case EL_USE:
|
|
685 |
return true;
|
|
686 |
default:
|
|
687 |
return false;
|
|
688 |
}
|
|
689 |
|
|
690 |
case EL_DESC:
|
|
691 |
case EL_ELLIPSE:
|
|
692 |
case EL_FONT:
|
|
693 |
case EL_FONTFACE:
|
|
694 |
case EL_FONTFACENAME:
|
|
695 |
case EL_FONTFACESRC:
|
|
696 |
case EL_FOREIGNOBJECT:
|
|
697 |
return false;
|
|
698 |
|
|
699 |
case EL_G:
|
|
700 |
switch (aChildElement)
|
|
701 |
{
|
|
702 |
case EL_A:
|
|
703 |
case EL_CIRCLE:
|
|
704 |
case EL_ELLIPSE:
|
|
705 |
case EL_G:
|
|
706 |
case EL_IMAGE:
|
|
707 |
case EL_LINE:
|
|
708 |
case EL_PATH:
|
|
709 |
case EL_RECT:
|
|
710 |
case EL_TEXT:
|
|
711 |
case EL_USE:
|
|
712 |
return true;
|
|
713 |
default:
|
|
714 |
return false;
|
|
715 |
}
|
|
716 |
|
|
717 |
case EL_GLYPH:
|
|
718 |
case EL_HKERN:
|
|
719 |
case EL_IMAGE:
|
|
720 |
case EL_LINE:
|
|
721 |
case EL_METADATA:
|
|
722 |
case EL_MISSINGGLYPH:
|
|
723 |
case EL_MPATH:
|
|
724 |
case EL_PATH:
|
|
725 |
case EL_POLYGON:
|
|
726 |
case EL_POLYLINE:
|
|
727 |
case EL_RECT:
|
|
728 |
case EL_SET:
|
|
729 |
return false;
|
|
730 |
|
|
731 |
case EL_SVG:
|
|
732 |
case EL_SWITCH:
|
|
733 |
switch (aChildElement)
|
|
734 |
{
|
|
735 |
case EL_A:
|
|
736 |
case EL_CIRCLE:
|
|
737 |
case EL_ELLIPSE:
|
|
738 |
case EL_G:
|
|
739 |
case EL_IMAGE:
|
|
740 |
case EL_LINE:
|
|
741 |
case EL_PATH:
|
|
742 |
case EL_RECT:
|
|
743 |
case EL_TEXT:
|
|
744 |
case EL_USE:
|
|
745 |
return true;
|
|
746 |
default:
|
|
747 |
return false;
|
|
748 |
}
|
|
749 |
|
|
750 |
case EL_TEXT:
|
|
751 |
switch (aChildElement)
|
|
752 |
{
|
|
753 |
case EL_A:
|
|
754 |
return true;
|
|
755 |
default:
|
|
756 |
return false;
|
|
757 |
}
|
|
758 |
|
|
759 |
case EL_TITLE:
|
|
760 |
case EL_USE:
|
|
761 |
default:
|
|
762 |
return false;
|
|
763 |
}
|
|
764 |
}
|
|
765 |
|
|
766 |
/**
|
|
767 |
* Determines if the specified attribute type can be set on the specified element type.
|
|
768 |
* @param aAttribute
|
|
769 |
* @param aElement
|
|
770 |
* @return true if ok
|
|
771 |
*/
|
|
772 |
static final boolean checkElementAttribute(short aAttribute, short aElement)
|
|
773 |
{
|
|
774 |
switch (aElement)
|
|
775 |
{
|
|
776 |
case EL_A:
|
|
777 |
switch (aAttribute)
|
|
778 |
{
|
|
779 |
case AT_COLOR:
|
|
780 |
case AT_DISPLAY:
|
|
781 |
case AT_FILL:
|
|
782 |
case AT_FILLRULE:
|
|
783 |
case AT_STROKE:
|
|
784 |
case AT_STROKEDASHOFFSET:
|
|
785 |
case AT_STROKELINECAP:
|
|
786 |
case AT_STROKELINEJOIN:
|
|
787 |
case AT_STROKEMITERLIMIT:
|
|
788 |
case AT_STROKEWIDTH:
|
|
789 |
case AT_VISIBILITY:
|
|
790 |
case AT_FONTFAMILY:
|
|
791 |
case AT_FONTSIZE:
|
|
792 |
case AT_FONTSTYLE:
|
|
793 |
case AT_FONTWEIGHT:
|
|
794 |
case AT_TEXTANCHOR:
|
|
795 |
case AT_TRANSFORM:
|
|
796 |
case AT_TARGET:
|
|
797 |
case AT_XLINKHREF:
|
|
798 |
return true;
|
|
799 |
default:
|
|
800 |
return false;
|
|
801 |
}
|
|
802 |
case EL_CIRCLE:
|
|
803 |
switch (aAttribute)
|
|
804 |
{
|
|
805 |
case AT_COLOR:
|
|
806 |
case AT_DISPLAY:
|
|
807 |
case AT_FILL:
|
|
808 |
case AT_FILLRULE:
|
|
809 |
case AT_STROKE:
|
|
810 |
case AT_STROKEDASHOFFSET:
|
|
811 |
case AT_STROKELINECAP:
|
|
812 |
case AT_STROKELINEJOIN:
|
|
813 |
case AT_STROKEMITERLIMIT:
|
|
814 |
case AT_STROKEWIDTH:
|
|
815 |
case AT_VISIBILITY:
|
|
816 |
case AT_TRANSFORM:
|
|
817 |
case AT_CX:
|
|
818 |
case AT_CY:
|
|
819 |
case AT_R:
|
|
820 |
return true;
|
|
821 |
default:
|
|
822 |
return false;
|
|
823 |
}
|
|
824 |
case EL_ELLIPSE:
|
|
825 |
switch (aAttribute)
|
|
826 |
{
|
|
827 |
case AT_COLOR:
|
|
828 |
case AT_DISPLAY:
|
|
829 |
case AT_FILL:
|
|
830 |
case AT_FILLRULE:
|
|
831 |
case AT_STROKE:
|
|
832 |
case AT_STROKEDASHOFFSET:
|
|
833 |
case AT_STROKELINECAP:
|
|
834 |
case AT_STROKELINEJOIN:
|
|
835 |
case AT_STROKEMITERLIMIT:
|
|
836 |
case AT_STROKEWIDTH:
|
|
837 |
case AT_VISIBILITY:
|
|
838 |
case AT_TRANSFORM:
|
|
839 |
case AT_CX:
|
|
840 |
case AT_CY:
|
|
841 |
case AT_RX:
|
|
842 |
case AT_RY:
|
|
843 |
return true;
|
|
844 |
default:
|
|
845 |
return false;
|
|
846 |
}
|
|
847 |
case EL_G:
|
|
848 |
switch (aAttribute)
|
|
849 |
{
|
|
850 |
case AT_COLOR:
|
|
851 |
case AT_DISPLAY:
|
|
852 |
case AT_FILL:
|
|
853 |
case AT_FILLRULE:
|
|
854 |
case AT_STROKE:
|
|
855 |
case AT_STROKEDASHOFFSET:
|
|
856 |
case AT_STROKELINECAP:
|
|
857 |
case AT_STROKELINEJOIN:
|
|
858 |
case AT_STROKEMITERLIMIT:
|
|
859 |
case AT_STROKEWIDTH:
|
|
860 |
case AT_VISIBILITY:
|
|
861 |
case AT_FONTFAMILY:
|
|
862 |
case AT_FONTSIZE:
|
|
863 |
case AT_FONTSTYLE:
|
|
864 |
case AT_FONTWEIGHT:
|
|
865 |
case AT_TEXTANCHOR:
|
|
866 |
case AT_TRANSFORM:
|
|
867 |
return true;
|
|
868 |
default:
|
|
869 |
return false;
|
|
870 |
}
|
|
871 |
case EL_IMAGE:
|
|
872 |
switch (aAttribute)
|
|
873 |
{
|
|
874 |
case AT_COLOR:
|
|
875 |
case AT_DISPLAY:
|
|
876 |
case AT_FILL:
|
|
877 |
case AT_FILLRULE:
|
|
878 |
case AT_STROKE:
|
|
879 |
case AT_STROKEDASHOFFSET:
|
|
880 |
case AT_STROKELINECAP:
|
|
881 |
case AT_STROKELINEJOIN:
|
|
882 |
case AT_STROKEMITERLIMIT:
|
|
883 |
case AT_STROKEWIDTH:
|
|
884 |
case AT_VISIBILITY:
|
|
885 |
case AT_TRANSFORM:
|
|
886 |
case AT_X:
|
|
887 |
case AT_Y:
|
|
888 |
case AT_WIDTH:
|
|
889 |
case AT_HEIGHT:
|
|
890 |
case AT_XLINKHREF:
|
|
891 |
return true;
|
|
892 |
default:
|
|
893 |
return false;
|
|
894 |
}
|
|
895 |
case EL_LINE:
|
|
896 |
switch (aAttribute)
|
|
897 |
{
|
|
898 |
case AT_COLOR:
|
|
899 |
case AT_DISPLAY:
|
|
900 |
case AT_FILL:
|
|
901 |
case AT_FILLRULE:
|
|
902 |
case AT_STROKE:
|
|
903 |
case AT_STROKEDASHOFFSET:
|
|
904 |
case AT_STROKELINECAP:
|
|
905 |
case AT_STROKELINEJOIN:
|
|
906 |
case AT_STROKEMITERLIMIT:
|
|
907 |
case AT_STROKEWIDTH:
|
|
908 |
case AT_VISIBILITY:
|
|
909 |
case AT_TRANSFORM:
|
|
910 |
case AT_X1:
|
|
911 |
case AT_X2:
|
|
912 |
case AT_Y1:
|
|
913 |
case AT_Y2:
|
|
914 |
return true;
|
|
915 |
default:
|
|
916 |
return false;
|
|
917 |
}
|
|
918 |
case EL_PATH:
|
|
919 |
switch (aAttribute)
|
|
920 |
{
|
|
921 |
case AT_COLOR:
|
|
922 |
case AT_DISPLAY:
|
|
923 |
case AT_FILL:
|
|
924 |
case AT_FILLRULE:
|
|
925 |
case AT_STROKE:
|
|
926 |
case AT_STROKEDASHOFFSET:
|
|
927 |
case AT_STROKELINECAP:
|
|
928 |
case AT_STROKELINEJOIN:
|
|
929 |
case AT_STROKEMITERLIMIT:
|
|
930 |
case AT_STROKEWIDTH:
|
|
931 |
case AT_VISIBILITY:
|
|
932 |
case AT_TRANSFORM:
|
|
933 |
case AT_D:
|
|
934 |
return true;
|
|
935 |
default:
|
|
936 |
return false;
|
|
937 |
}
|
|
938 |
case EL_RECT:
|
|
939 |
switch (aAttribute)
|
|
940 |
{
|
|
941 |
case AT_COLOR:
|
|
942 |
case AT_DISPLAY:
|
|
943 |
case AT_FILL:
|
|
944 |
case AT_FILLRULE:
|
|
945 |
case AT_STROKE:
|
|
946 |
case AT_STROKEDASHOFFSET:
|
|
947 |
case AT_STROKELINECAP:
|
|
948 |
case AT_STROKELINEJOIN:
|
|
949 |
case AT_STROKEMITERLIMIT:
|
|
950 |
case AT_STROKEWIDTH:
|
|
951 |
case AT_VISIBILITY:
|
|
952 |
case AT_TRANSFORM:
|
|
953 |
case AT_HEIGHT:
|
|
954 |
case AT_WIDTH:
|
|
955 |
case AT_X:
|
|
956 |
case AT_Y:
|
|
957 |
case AT_RX:
|
|
958 |
case AT_RY:
|
|
959 |
return true;
|
|
960 |
default:
|
|
961 |
return false;
|
|
962 |
}
|
|
963 |
case EL_SVG:
|
|
964 |
switch (aAttribute)
|
|
965 |
{
|
|
966 |
case AT_COLOR:
|
|
967 |
case AT_DISPLAY:
|
|
968 |
case AT_FILL:
|
|
969 |
case AT_FILLRULE:
|
|
970 |
case AT_STROKE:
|
|
971 |
case AT_STROKEDASHOFFSET:
|
|
972 |
case AT_STROKELINECAP:
|
|
973 |
case AT_STROKELINEJOIN:
|
|
974 |
case AT_STROKEMITERLIMIT:
|
|
975 |
case AT_STROKEWIDTH:
|
|
976 |
case AT_VISIBILITY:
|
|
977 |
case AT_FONTFAMILY:
|
|
978 |
case AT_FONTSIZE:
|
|
979 |
case AT_FONTSTYLE:
|
|
980 |
case AT_FONTWEIGHT:
|
|
981 |
case AT_TEXTANCHOR:
|
|
982 |
case AT_VERSION:
|
|
983 |
case AT_BASEPROFILE:
|
|
984 |
case AT_VIEWBOX:
|
|
985 |
case AT_ZOOMANDPAN:
|
|
986 |
return true;
|
|
987 |
default:
|
|
988 |
return false;
|
|
989 |
}
|
|
990 |
case EL_TEXT:
|
|
991 |
switch (aAttribute)
|
|
992 |
{
|
|
993 |
case AT_COLOR:
|
|
994 |
case AT_DISPLAY:
|
|
995 |
case AT_FILL:
|
|
996 |
case AT_FILLRULE:
|
|
997 |
case AT_STROKE:
|
|
998 |
case AT_STROKEDASHOFFSET:
|
|
999 |
case AT_STROKELINECAP:
|
|
1000 |
case AT_STROKELINEJOIN:
|
|
1001 |
case AT_STROKEMITERLIMIT:
|
|
1002 |
case AT_STROKEWIDTH:
|
|
1003 |
case AT_VISIBILITY:
|
|
1004 |
case AT_FONTFAMILY:
|
|
1005 |
case AT_FONTSIZE:
|
|
1006 |
case AT_FONTSTYLE:
|
|
1007 |
case AT_FONTWEIGHT:
|
|
1008 |
case AT_TEXTANCHOR:
|
|
1009 |
case AT_TRANSFORM:
|
|
1010 |
case AT_X:
|
|
1011 |
case AT_Y:
|
|
1012 |
case AT_STRING:
|
|
1013 |
return true;
|
|
1014 |
default:
|
|
1015 |
return false;
|
|
1016 |
}
|
|
1017 |
case EL_USE:
|
|
1018 |
switch (aAttribute)
|
|
1019 |
{
|
|
1020 |
case AT_COLOR:
|
|
1021 |
case AT_DISPLAY:
|
|
1022 |
case AT_FILL:
|
|
1023 |
case AT_FILLRULE:
|
|
1024 |
case AT_STROKE:
|
|
1025 |
case AT_STROKEDASHOFFSET:
|
|
1026 |
case AT_STROKELINECAP:
|
|
1027 |
case AT_STROKELINEJOIN:
|
|
1028 |
case AT_STROKEMITERLIMIT:
|
|
1029 |
case AT_STROKEWIDTH:
|
|
1030 |
case AT_VISIBILITY:
|
|
1031 |
case AT_FONTFAMILY:
|
|
1032 |
case AT_FONTSIZE:
|
|
1033 |
case AT_FONTSTYLE:
|
|
1034 |
case AT_FONTWEIGHT:
|
|
1035 |
case AT_TEXTANCHOR:
|
|
1036 |
case AT_TRANSFORM:
|
|
1037 |
case AT_X:
|
|
1038 |
case AT_Y:
|
|
1039 |
case AT_XLINKHREF:
|
|
1040 |
return true;
|
|
1041 |
default:
|
|
1042 |
return false;
|
|
1043 |
}
|
|
1044 |
default:
|
|
1045 |
return false;
|
|
1046 |
}
|
|
1047 |
}
|
|
1048 |
|
|
1049 |
/**
|
|
1050 |
* Checks if the attribute name needs prefix
|
|
1051 |
* @param aAttributeTypeName
|
|
1052 |
* @return Attribute name
|
|
1053 |
*/
|
|
1054 |
static final String checkPrefixNeed(String aAttributeTypeName)
|
|
1055 |
{
|
|
1056 |
if (aAttributeTypeName.equals("actuate")) return "xlink:actuate";
|
|
1057 |
|
|
1058 |
else if (aAttributeTypeName.equals("arcrole")) return "xlink:arcrole";
|
|
1059 |
|
|
1060 |
else if (aAttributeTypeName.equals("href")) return "xlink:href";
|
|
1061 |
|
|
1062 |
else if (aAttributeTypeName.equals("role")) return "xlink:role";
|
|
1063 |
|
|
1064 |
else if (aAttributeTypeName.equals("show")) return "xlink:show";
|
|
1065 |
|
|
1066 |
else if (aAttributeTypeName.equals("title")) return "xlink:title";
|
|
1067 |
|
|
1068 |
else if (aAttributeTypeName.equals("type")) return "xlink:type";
|
|
1069 |
|
|
1070 |
else if (aAttributeTypeName.equals("base")) return "xml:base";
|
|
1071 |
|
|
1072 |
else if (aAttributeTypeName.equals("lang")) return "xml:lang";
|
|
1073 |
|
|
1074 |
else if (aAttributeTypeName.equals("space")) return "xml:space";
|
|
1075 |
|
|
1076 |
else return aAttributeTypeName;
|
|
1077 |
}
|
|
1078 |
|
|
1079 |
/**
|
|
1080 |
* Get internal data containers
|
|
1081 |
* @return Data containers
|
|
1082 |
*/
|
|
1083 |
static M2GSVGConstants getInstance()
|
|
1084 |
{
|
|
1085 |
if (sInstance == null)
|
|
1086 |
{
|
|
1087 |
|
|
1088 |
sInstance = new M2GSVGConstants();
|
|
1089 |
}
|
|
1090 |
return sInstance;
|
|
1091 |
}
|
|
1092 |
|
|
1093 |
/**
|
|
1094 |
* Checks if element can be inserted.
|
|
1095 |
* @param aElementTypeId -
|
|
1096 |
* @return true if ok
|
|
1097 |
*/
|
|
1098 |
static final boolean isAllowedToInsertElement(short aElementTypeId)
|
|
1099 |
{
|
|
1100 |
switch (aElementTypeId)
|
|
1101 |
{
|
|
1102 |
case EL_A:
|
|
1103 |
case EL_CIRCLE:
|
|
1104 |
case EL_ELLIPSE:
|
|
1105 |
case EL_G:
|
|
1106 |
case EL_IMAGE:
|
|
1107 |
case EL_LINE:
|
|
1108 |
case EL_PATH:
|
|
1109 |
case EL_RECT:
|
|
1110 |
case EL_TEXT:
|
|
1111 |
case EL_USE:
|
|
1112 |
return true;
|
|
1113 |
default:
|
|
1114 |
return false;
|
|
1115 |
}
|
|
1116 |
}
|
|
1117 |
|
|
1118 |
/**
|
|
1119 |
* Checks if element can be removed.
|
|
1120 |
* @param aElementTypeId -
|
|
1121 |
* @return true if ok
|
|
1122 |
*/
|
|
1123 |
static final boolean isAllowedToRemoveElement(short aElementTypeId)
|
|
1124 |
{
|
|
1125 |
switch (aElementTypeId)
|
|
1126 |
{
|
|
1127 |
case EL_A:
|
|
1128 |
case EL_CIRCLE:
|
|
1129 |
case EL_ELLIPSE:
|
|
1130 |
case EL_G:
|
|
1131 |
case EL_IMAGE:
|
|
1132 |
case EL_LINE:
|
|
1133 |
case EL_PATH:
|
|
1134 |
case EL_RECT:
|
|
1135 |
case EL_TEXT:
|
|
1136 |
case EL_USE:
|
|
1137 |
return true;
|
|
1138 |
default:
|
|
1139 |
return false;
|
|
1140 |
}
|
|
1141 |
}
|
|
1142 |
|
|
1143 |
/**
|
|
1144 |
* Checks if element is animatable
|
|
1145 |
* @param aElementTypeName
|
|
1146 |
* @return true if element is animatable
|
|
1147 |
*/
|
|
1148 |
static boolean isAnimatableElement(String aElementTypeName)
|
|
1149 |
{
|
|
1150 |
if (getInstance().iAnimatableElements.contains(
|
|
1151 |
aElementTypeName))
|
|
1152 |
{
|
|
1153 |
return true;
|
|
1154 |
}
|
|
1155 |
return false;
|
|
1156 |
}
|
|
1157 |
|
|
1158 |
/**
|
|
1159 |
* Checks that float trait is allowed to get
|
|
1160 |
* @param aAttributeTypeId
|
|
1161 |
* @return true if float trait is allowed to get
|
|
1162 |
*/
|
|
1163 |
static final boolean isGetFloatTraitAllowed(short aAttributeTypeId)
|
|
1164 |
{
|
|
1165 |
switch (aAttributeTypeId)
|
|
1166 |
{
|
|
1167 |
case AT_STROKEDASHOFFSET:
|
|
1168 |
case AT_STROKEMITERLIMIT:
|
|
1169 |
case AT_STROKEWIDTH:
|
|
1170 |
case AT_FONTSIZE:
|
|
1171 |
case AT_HEIGHT:
|
|
1172 |
case AT_WIDTH:
|
|
1173 |
case AT_X:
|
|
1174 |
case AT_Y:
|
|
1175 |
case AT_RX:
|
|
1176 |
case AT_RY:
|
|
1177 |
case AT_CX:
|
|
1178 |
case AT_CY:
|
|
1179 |
case AT_R:
|
|
1180 |
case AT_X1:
|
|
1181 |
case AT_X2:
|
|
1182 |
case AT_Y1:
|
|
1183 |
case AT_Y2:
|
|
1184 |
return true;
|
|
1185 |
default:
|
|
1186 |
return false;
|
|
1187 |
}
|
|
1188 |
}
|
|
1189 |
|
|
1190 |
/**
|
|
1191 |
* Checks that matrix trait is allowed to set
|
|
1192 |
* @param aAttributeTypeId
|
|
1193 |
* @return true if matrix trait is allowed to set
|
|
1194 |
*/
|
|
1195 |
static final boolean isGetMatrixTraitAllowed(short aAttributeTypeId)
|
|
1196 |
{
|
|
1197 |
switch (aAttributeTypeId)
|
|
1198 |
{
|
|
1199 |
case AT_TRANSFORM:
|
|
1200 |
return true;
|
|
1201 |
default:
|
|
1202 |
return false;
|
|
1203 |
}
|
|
1204 |
}
|
|
1205 |
|
|
1206 |
/**
|
|
1207 |
* Checks that path trait is allowed to get
|
|
1208 |
* @param aAttributeTypeId
|
|
1209 |
* @return true if path trait is allowed to get
|
|
1210 |
*/
|
|
1211 |
static final boolean isGetPathTraitAllowed(short aAttributeTypeId)
|
|
1212 |
{
|
|
1213 |
switch (aAttributeTypeId)
|
|
1214 |
{
|
|
1215 |
case AT_D:
|
|
1216 |
return true;
|
|
1217 |
default:
|
|
1218 |
return false;
|
|
1219 |
}
|
|
1220 |
}
|
|
1221 |
|
|
1222 |
/**
|
|
1223 |
* Checks that rect trait is allowed to get
|
|
1224 |
* @param aAttributeTypeId
|
|
1225 |
* @return true if rect trait is allowed to get
|
|
1226 |
*/
|
|
1227 |
static final boolean isGetRectTraitAllowed(short aAttributeTypeId)
|
|
1228 |
{
|
|
1229 |
switch (aAttributeTypeId)
|
|
1230 |
{
|
|
1231 |
case AT_VIEWBOX:
|
|
1232 |
return true;
|
|
1233 |
default:
|
|
1234 |
return false;
|
|
1235 |
}
|
|
1236 |
}
|
|
1237 |
|
|
1238 |
/**
|
|
1239 |
* Checks that RGB trait is allowed to get.
|
|
1240 |
* @param aAttributeTypeId
|
|
1241 |
* @return true if RGB trait is allowed to get.
|
|
1242 |
*/
|
|
1243 |
static final boolean isGetRgbColorTraitAllowed(short aAttributeTypeId)
|
|
1244 |
{
|
|
1245 |
switch (aAttributeTypeId)
|
|
1246 |
{
|
|
1247 |
case AT_COLOR:
|
|
1248 |
case AT_FILL:
|
|
1249 |
case AT_STROKE:
|
|
1250 |
return true;
|
|
1251 |
default:
|
|
1252 |
return false;
|
|
1253 |
}
|
|
1254 |
}
|
|
1255 |
|
|
1256 |
/**
|
|
1257 |
* Checks that trait that can be obtained as a string is allowed to get.
|
|
1258 |
* In SVG Tiny only certain traits can be obtained as a String value.
|
|
1259 |
* @param aAttributeTypeId
|
|
1260 |
* @return true if ok
|
|
1261 |
*/
|
|
1262 |
static final boolean isGetTraitNSStringAllowed(short aAttributeTypeId)
|
|
1263 |
{
|
|
1264 |
switch (aAttributeTypeId)
|
|
1265 |
{
|
|
1266 |
case AT_DISPLAY:
|
|
1267 |
case AT_FILLRULE:
|
|
1268 |
case AT_STROKELINECAP:
|
|
1269 |
case AT_STROKELINEJOIN:
|
|
1270 |
case AT_VISIBILITY:
|
|
1271 |
case AT_FONTFAMILY:
|
|
1272 |
case AT_FONTSTYLE:
|
|
1273 |
case AT_FONTWEIGHT:
|
|
1274 |
case AT_TEXTANCHOR:
|
|
1275 |
case AT_TARGET:
|
|
1276 |
case AT_STRING: // not an SVG aTrait, but represents the contents of <text>
|
|
1277 |
case AT_VERSION:
|
|
1278 |
case AT_BASEPROFILE:
|
|
1279 |
case AT_XLINKHREF:
|
|
1280 |
case AT_ZOOMANDPAN:
|
|
1281 |
return true;
|
|
1282 |
default:
|
|
1283 |
return false;
|
|
1284 |
}
|
|
1285 |
}
|
|
1286 |
|
|
1287 |
|
|
1288 |
/**
|
|
1289 |
* Check trait
|
|
1290 |
* @param aAttributeTypeId
|
|
1291 |
* @return
|
|
1292 |
*/
|
|
1293 |
static final boolean isGetTraitNSAllowed(short aAttributeTypeId)
|
|
1294 |
{
|
|
1295 |
switch (aAttributeTypeId)
|
|
1296 |
{
|
|
1297 |
case AT_XLINKHREF:
|
|
1298 |
return true;
|
|
1299 |
default:
|
|
1300 |
return false;
|
|
1301 |
}
|
|
1302 |
}
|
|
1303 |
|
|
1304 |
/**
|
|
1305 |
* Checks that an element is locatable
|
|
1306 |
* @param aElementTypeName
|
|
1307 |
* @return true if the element is locatable
|
|
1308 |
*/
|
|
1309 |
static boolean isLocatableElement(String aElementTypeName)
|
|
1310 |
{
|
|
1311 |
if (isRootElement(aElementTypeName))
|
|
1312 |
{
|
|
1313 |
return true;
|
|
1314 |
}
|
|
1315 |
if (getInstance().iQualifiedElements.contains(
|
|
1316 |
aElementTypeName))
|
|
1317 |
{
|
|
1318 |
return true;
|
|
1319 |
}
|
|
1320 |
return false;
|
|
1321 |
}
|
|
1322 |
|
|
1323 |
/**
|
|
1324 |
* Checks that an element is qualified
|
|
1325 |
* @param aElementTypeName
|
|
1326 |
* @return true if the element is qualified
|
|
1327 |
*/
|
|
1328 |
static boolean isQualifiedElement(String aElementTypeName)
|
|
1329 |
{
|
|
1330 |
if (getInstance().iQualifiedElements.contains(
|
|
1331 |
aElementTypeName))
|
|
1332 |
{
|
|
1333 |
return true;
|
|
1334 |
}
|
|
1335 |
return false;
|
|
1336 |
}
|
|
1337 |
|
|
1338 |
/**
|
|
1339 |
* Checks if element is read only
|
|
1340 |
* @param aElementTypeName
|
|
1341 |
* @return true if the element is read only
|
|
1342 |
*/
|
|
1343 |
static boolean isElementReadOnly(String aElementTypeName)
|
|
1344 |
{
|
|
1345 |
if (aElementTypeName != null)
|
|
1346 |
{
|
|
1347 |
return getInstance().iReadOnlyElements.contains(
|
|
1348 |
aElementTypeName);
|
|
1349 |
}
|
|
1350 |
return false;
|
|
1351 |
}
|
|
1352 |
|
|
1353 |
/**
|
|
1354 |
* Checks that an element is a root element
|
|
1355 |
* @param aElementTypeName
|
|
1356 |
* @return true if the element is a root element
|
|
1357 |
*/
|
|
1358 |
static boolean isRootElement(String aElementTypeName)
|
|
1359 |
{
|
|
1360 |
return ROOT_SVG_ELEMENT_NAME.equals(aElementTypeName);
|
|
1361 |
}
|
|
1362 |
|
|
1363 |
/**
|
|
1364 |
* Checks that float trait is allowed to set
|
|
1365 |
* @param aAttributeTypeId
|
|
1366 |
* @return true if float trait is allowed to set
|
|
1367 |
*/
|
|
1368 |
static final boolean isSetFloatTraitAllowed(short aAttributeTypeId)
|
|
1369 |
{
|
|
1370 |
return isGetFloatTraitAllowed(aAttributeTypeId);
|
|
1371 |
}
|
|
1372 |
|
|
1373 |
/**
|
|
1374 |
* Checks that matrix trait is allowed to set
|
|
1375 |
* @param aAttributeTypeId
|
|
1376 |
* @return true if matrix trait is allowed to set
|
|
1377 |
*/
|
|
1378 |
static final boolean isSetMatrixTraitAllowed(short aAttributeTypeId)
|
|
1379 |
{
|
|
1380 |
return isGetMatrixTraitAllowed(aAttributeTypeId);
|
|
1381 |
}
|
|
1382 |
|
|
1383 |
|
|
1384 |
/**
|
|
1385 |
* Checks that path trait is allowed to set
|
|
1386 |
* @param aAttributeTypeId
|
|
1387 |
* @return true if path trait is allowed to set
|
|
1388 |
*/
|
|
1389 |
static final boolean isSetPathTraitAllowed(short aAttributeTypeId)
|
|
1390 |
{
|
|
1391 |
return isGetPathTraitAllowed(aAttributeTypeId);
|
|
1392 |
}
|
|
1393 |
|
|
1394 |
/**
|
|
1395 |
* Checks that rect trait is allowed to set
|
|
1396 |
* @param aAttributeTypeId
|
|
1397 |
* @return true if rect trait is allowed to set
|
|
1398 |
*/
|
|
1399 |
static final boolean isSetRectTraitAllowed(short aAttributeTypeId)
|
|
1400 |
{
|
|
1401 |
switch (aAttributeTypeId)
|
|
1402 |
{
|
|
1403 |
case AT_VIEWBOX:
|
|
1404 |
return true;
|
|
1405 |
default:
|
|
1406 |
return false;
|
|
1407 |
}
|
|
1408 |
}
|
|
1409 |
|
|
1410 |
/**
|
|
1411 |
* Checks that RGB trait is allowed to set.
|
|
1412 |
* @param aAttributeTypeId
|
|
1413 |
* @return true if RGB trait is allowed to set.
|
|
1414 |
*/
|
|
1415 |
static final boolean isSetRgbColorTraitAllowed(short aAttributeTypeId)
|
|
1416 |
{
|
|
1417 |
switch (aAttributeTypeId)
|
|
1418 |
{
|
|
1419 |
case AT_COLOR:
|
|
1420 |
case AT_FILL:
|
|
1421 |
case AT_STROKE:
|
|
1422 |
return true;
|
|
1423 |
default:
|
|
1424 |
return false;
|
|
1425 |
}
|
|
1426 |
}
|
|
1427 |
|
|
1428 |
/**
|
|
1429 |
* Checks that trait that can be obtained as a string is allowed to set.
|
|
1430 |
* In SVG Tiny only certain traits can be obtained as a String value.
|
|
1431 |
* @param aAttributeTypeId
|
|
1432 |
* @return true if ok
|
|
1433 |
*/
|
|
1434 |
static final boolean isSetTraitNSStringAllowed(short aAttributeTypeId)
|
|
1435 |
{
|
|
1436 |
switch (aAttributeTypeId)
|
|
1437 |
{
|
|
1438 |
case AT_COLOR:
|
|
1439 |
case AT_DISPLAY:
|
|
1440 |
case AT_FILL:
|
|
1441 |
case AT_FILLRULE:
|
|
1442 |
case AT_STROKE:
|
|
1443 |
case AT_STROKEDASHOFFSET:
|
|
1444 |
case AT_STROKELINECAP:
|
|
1445 |
case AT_STROKELINEJOIN:
|
|
1446 |
case AT_STROKEMITERLIMIT:
|
|
1447 |
case AT_STROKEWIDTH:
|
|
1448 |
case AT_VISIBILITY:
|
|
1449 |
case AT_FONTFAMILY:
|
|
1450 |
case AT_FONTSIZE:
|
|
1451 |
case AT_FONTSTYLE:
|
|
1452 |
case AT_FONTWEIGHT:
|
|
1453 |
case AT_TEXTANCHOR:
|
|
1454 |
case AT_TARGET:
|
|
1455 |
case AT_STRING: // not an SVG trait, but represents the contents of <text>
|
|
1456 |
case AT_XLINKHREF:
|
|
1457 |
case AT_ZOOMANDPAN:
|
|
1458 |
return true;
|
|
1459 |
default:
|
|
1460 |
return false;
|
|
1461 |
}
|
|
1462 |
}
|
|
1463 |
|
|
1464 |
/**
|
|
1465 |
* Check trait
|
|
1466 |
* @param aAttributeTypeId
|
|
1467 |
* @return
|
|
1468 |
*/
|
|
1469 |
static final boolean isSetTraitNSAllowed(short aAttributeTypeId)
|
|
1470 |
{
|
|
1471 |
return isGetTraitNSAllowed(aAttributeTypeId);
|
|
1472 |
}
|
|
1473 |
|
|
1474 |
/**
|
|
1475 |
* Converts a string trait name to the appropriate short constant.
|
|
1476 |
* This method covers all of SVGT 1.1 and not just JSR-226.
|
|
1477 |
* @param aAttributeTypeName
|
|
1478 |
* @return Attribute's type id
|
|
1479 |
*/
|
|
1480 |
static final short parseAttributeTypeId(String aAttributeTypeName)
|
|
1481 |
{
|
|
1482 |
String name = checkPrefixNeed(aAttributeTypeName);
|
|
1483 |
Enumeration keys = getInstance().iAllAttributes.keys();
|
|
1484 |
while (keys.hasMoreElements())
|
|
1485 |
{
|
|
1486 |
Object id = keys.nextElement();
|
|
1487 |
try
|
|
1488 |
{
|
|
1489 |
if (((String)getInstance().iAllAttributes.get(
|
|
1490 |
id)).equals(name))
|
|
1491 |
{
|
|
1492 |
return ((Short)id).shortValue();
|
|
1493 |
}
|
|
1494 |
}
|
|
1495 |
catch (Exception e)
|
|
1496 |
{
|
|
1497 |
}
|
|
1498 |
|
|
1499 |
}
|
|
1500 |
return SVG_ERROR;
|
|
1501 |
}
|
|
1502 |
|
|
1503 |
/**
|
|
1504 |
* Converts a short constant to the string representation of a SVGT 1.1 trait name.
|
|
1505 |
* This method covers all of SVGT 1.1 and not just JSR-226.
|
|
1506 |
* @param aAttributeTypeId
|
|
1507 |
* @return Attribute's type name
|
|
1508 |
*/
|
|
1509 |
static final String parseAttributeTypeName(short aAttributeTypeId)
|
|
1510 |
{
|
|
1511 |
|
|
1512 |
Object attributeName = getInstance().iAllAttributes.get(
|
|
1513 |
new Short(aAttributeTypeId));
|
|
1514 |
if (attributeName != null)
|
|
1515 |
{
|
|
1516 |
return (String)attributeName;
|
|
1517 |
}
|
|
1518 |
return "";
|
|
1519 |
}
|
|
1520 |
|
|
1521 |
/**
|
|
1522 |
* Converts a string element name to the appropriate short constant.
|
|
1523 |
* This method covers all of SVGT 1.1 and not just JSR-226.
|
|
1524 |
* @param aElementTypeName
|
|
1525 |
* @return Element's type id
|
|
1526 |
*/
|
|
1527 |
static final short parseElementTypeId(String aElementTypeName)
|
|
1528 |
{
|
|
1529 |
Enumeration keys = getInstance().iAllElements.keys();
|
|
1530 |
while (keys.hasMoreElements())
|
|
1531 |
{
|
|
1532 |
Object id = keys.nextElement();
|
|
1533 |
try
|
|
1534 |
{
|
|
1535 |
if (((String)getInstance().iAllElements.get(
|
|
1536 |
id)).equals(aElementTypeName))
|
|
1537 |
{
|
|
1538 |
return ((Short)id).shortValue();
|
|
1539 |
}
|
|
1540 |
}
|
|
1541 |
catch (Exception e)
|
|
1542 |
{
|
|
1543 |
}
|
|
1544 |
}
|
|
1545 |
return SVG_ERROR;
|
|
1546 |
}
|
|
1547 |
|
|
1548 |
/**
|
|
1549 |
* Converts a short constant to the string representation of a SVGT 1.1 element name.
|
|
1550 |
* This method covers all of SVGT 1.1 and not just JSR-226.
|
|
1551 |
* @param aElementTypeId
|
|
1552 |
* @return Element's type name
|
|
1553 |
*/
|
|
1554 |
static final String parseElementTypeName(short aElementTypeId)
|
|
1555 |
{
|
|
1556 |
Object elementName = getInstance().iAllElements.get(
|
|
1557 |
new Short(aElementTypeId));
|
|
1558 |
if (elementName != null)
|
|
1559 |
{
|
|
1560 |
return (String)elementName;
|
|
1561 |
}
|
|
1562 |
return "";
|
|
1563 |
}
|
|
1564 |
|
|
1565 |
/**
|
|
1566 |
* Converts a string trait value to the appropriate short constant.
|
|
1567 |
* NOTE: This method only handles traits that can be set as a string in JSR-226.
|
|
1568 |
* @param aAttributeTypeId
|
|
1569 |
* @param aValue
|
|
1570 |
* @return Value's id
|
|
1571 |
*/
|
|
1572 |
static final short parseAttributeValueNameId(short aAttributeTypeId, String aValue)
|
|
1573 |
{
|
|
1574 |
switch (aAttributeTypeId)
|
|
1575 |
{
|
|
1576 |
case AT_STRING: // element content (i.e. <text>, etc.)
|
|
1577 |
return TEXT_NOT_SHORT;
|
|
1578 |
|
|
1579 |
case AT_COLOR: // inherit
|
|
1580 |
if (aValue.equals("inherit")) return PAINT_INHERIT;
|
|
1581 |
else return SVG_ERROR;
|
|
1582 |
|
|
1583 |
case AT_DISPLAY: // inline | none | inherit
|
|
1584 |
if (aValue.equals("none")) return DISPLAY_NONE;
|
|
1585 |
else if (aValue.equals("inline")) return DISPLAY_OTHER;
|
|
1586 |
else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
|
|
1587 |
else return SVG_ERROR;
|
|
1588 |
|
|
1589 |
case AT_FILL: // none | currentColor | inherit
|
|
1590 |
if (aValue.equals("none")) return PAINT_NONE;
|
|
1591 |
else if (aValue.equals("currentColor")) return PAINT_CURRENT;
|
|
1592 |
else if (aValue.equals("inherit")) return PAINT_INHERIT;
|
|
1593 |
else return SVG_ERROR;
|
|
1594 |
|
|
1595 |
case AT_FILLRULE: // nonzero | evenodd | inherit
|
|
1596 |
if (aValue.equals("evenodd")) return FILL_RULE_EVENODD;
|
|
1597 |
else if (aValue.equals("nonzero")) return FILL_RULE_NONZERO;
|
|
1598 |
else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
|
|
1599 |
else return SVG_ERROR;
|
|
1600 |
|
|
1601 |
case AT_FONTFAMILY: // same syntax as font-family attribute
|
|
1602 |
if (aValue.equals("inherit")) return DEFAULT_INHERIT;
|
|
1603 |
else return TEXT_NOT_SHORT;
|
|
1604 |
|
|
1605 |
case AT_FONTSIZE: // inherit
|
|
1606 |
if (aValue.equals("inherit")) return DEFAULT_INHERIT;
|
|
1607 |
else return SVG_ERROR;
|
|
1608 |
|
|
1609 |
case AT_FONTSTYLE: // normal | italic | oblique | inherit
|
|
1610 |
if (aValue.equals("normal")) return FONT_NORMAL;
|
|
1611 |
else if (aValue.equals("italic")) return FONT_STYLE_ITALIC;
|
|
1612 |
else if (aValue.equals("oblique")) return FONT_STYLE_OBLIQUE;
|
|
1613 |
else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
|
|
1614 |
else return SVG_ERROR;
|
|
1615 |
|
|
1616 |
case AT_FONTWEIGHT: // normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit
|
|
1617 |
if (aValue.equals("normal")) return FONT_NORMAL;
|
|
1618 |
else if (aValue.equals("bold")) return FONT_WEIGHT_BOLD;
|
|
1619 |
else if (aValue.equals("bolder")) return FONT_WEIGHT_BOLDER;
|
|
1620 |
else if (aValue.equals("lighter")) return FONT_WEIGHT_LIGHTER;
|
|
1621 |
else if (aValue.equals("100")) return FONT_WEIGHT_100;
|
|
1622 |
else if (aValue.equals("200")) return FONT_WEIGHT_200;
|
|
1623 |
else if (aValue.equals("300")) return FONT_WEIGHT_300;
|
|
1624 |
else if (aValue.equals("400")) return FONT_WEIGHT_400;
|
|
1625 |
else if (aValue.equals("500")) return FONT_WEIGHT_500;
|
|
1626 |
else if (aValue.equals("600")) return FONT_WEIGHT_600;
|
|
1627 |
else if (aValue.equals("700")) return FONT_WEIGHT_700;
|
|
1628 |
else if (aValue.equals("800")) return FONT_WEIGHT_800;
|
|
1629 |
else if (aValue.equals("900")) return FONT_WEIGHT_900;
|
|
1630 |
else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
|
|
1631 |
else return SVG_ERROR;
|
|
1632 |
|
|
1633 |
case AT_STROKE: // none | currentColor | inherit
|
|
1634 |
if (aValue.equals("none")) return PAINT_NONE;
|
|
1635 |
else if (aValue.equals("currentColor")) return PAINT_CURRENT;
|
|
1636 |
else if (aValue.equals("inherit")) return PAINT_INHERIT;
|
|
1637 |
else return SVG_ERROR;
|
|
1638 |
|
|
1639 |
case AT_STROKEDASHOFFSET: // inherit
|
|
1640 |
if (aValue.equals("inherit")) return DEFAULT_INHERIT;
|
|
1641 |
else return SVG_ERROR;
|
|
1642 |
|
|
1643 |
case AT_STROKELINECAP: // butt | round | square | inherit
|
|
1644 |
if (aValue.equals("butt")) return STROKE_LINECAP_BUTT;
|
|
1645 |
else if (aValue.equals("round")) return STROKE_LINECAP_ROUND;
|
|
1646 |
else if (aValue.equals("square")) return STROKE_LINECAP_SQUARE;
|
|
1647 |
else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
|
|
1648 |
else return SVG_ERROR;
|
|
1649 |
|
|
1650 |
case AT_STROKELINEJOIN: // miter | round | bevel | inherit
|
|
1651 |
if (aValue.equals("miter")) return STROKE_LINEJOIN_MITER;
|
|
1652 |
else if (aValue.equals("round")) return STROKE_LINEJOIN_ROUND;
|
|
1653 |
else if (aValue.equals("bevel")) return STROKE_LINEJOIN_BEVEL;
|
|
1654 |
else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
|
|
1655 |
else return SVG_ERROR;
|
|
1656 |
|
|
1657 |
case AT_STROKEMITERLIMIT: // inherit
|
|
1658 |
if (aValue.equals("inherit")) return DEFAULT_INHERIT;
|
|
1659 |
else return SVG_ERROR;
|
|
1660 |
|
|
1661 |
case AT_STROKEWIDTH: // inherit
|
|
1662 |
if (aValue.equals("inherit")) return DEFAULT_INHERIT;
|
|
1663 |
else return SVG_ERROR;
|
|
1664 |
|
|
1665 |
case AT_TARGET: // string
|
|
1666 |
return TEXT_NOT_SHORT;
|
|
1667 |
|
|
1668 |
case AT_TEXTANCHOR: // start | middle | end | inherit
|
|
1669 |
if (aValue.equals("start")) return TEXT_ANCHOR_START;
|
|
1670 |
else if (aValue.equals("middle")) return TEXT_ANCHOR_MIDDLE;
|
|
1671 |
else if (aValue.equals("end")) return TEXT_ANCHOR_END;
|
|
1672 |
else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
|
|
1673 |
else return SVG_ERROR;
|
|
1674 |
|
|
1675 |
case AT_VISIBILITY: // visible | hidden | inherit
|
|
1676 |
if (aValue.equals("visible")) return VISIBILITY_VISIBLE;
|
|
1677 |
else if (aValue.equals("hidden")) return VISIBILITY_OTHER;
|
|
1678 |
else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
|
|
1679 |
else return SVG_ERROR;
|
|
1680 |
|
|
1681 |
case AT_XLINKHREF: // URI aValue
|
|
1682 |
return TEXT_NOT_SHORT;
|
|
1683 |
|
|
1684 |
case AT_ZOOMANDPAN: // disable | magnify
|
|
1685 |
if (aValue.equals("magnify")) return ZPN_MAGNIFY;
|
|
1686 |
else if (aValue.equals("disable")) return ZPN_DISABLE;
|
|
1687 |
else return SVG_ERROR;
|
|
1688 |
|
|
1689 |
default:
|
|
1690 |
return SVG_ERROR;
|
|
1691 |
}
|
|
1692 |
}
|
|
1693 |
|
|
1694 |
/**
|
|
1695 |
* Parse attribute
|
|
1696 |
* @param aValueId
|
|
1697 |
* @return Value's name
|
|
1698 |
*/
|
|
1699 |
static final String parseAttributeValueName(short aAttributeTypeId, short aValueId)
|
|
1700 |
{
|
|
1701 |
if (aValueId == 0)
|
|
1702 |
{
|
|
1703 |
return "";
|
|
1704 |
}
|
|
1705 |
if (aAttributeTypeId == AT_FONTWEIGHT && aValueId == FONT_WEIGHT_LIGHTER)
|
|
1706 |
{
|
|
1707 |
return "300";
|
|
1708 |
}
|
|
1709 |
else if (aAttributeTypeId == AT_FONTWEIGHT && aValueId == FONT_NORMAL)
|
|
1710 |
{
|
|
1711 |
return "400";
|
|
1712 |
}
|
|
1713 |
else if (aAttributeTypeId == AT_FONTWEIGHT && aValueId == FONT_WEIGHT_BOLD)
|
|
1714 |
{
|
|
1715 |
return "700";
|
|
1716 |
}
|
|
1717 |
else if (aAttributeTypeId == AT_FONTWEIGHT && aValueId == FONT_WEIGHT_BOLDER)
|
|
1718 |
{
|
|
1719 |
return "800";
|
|
1720 |
}
|
|
1721 |
else
|
|
1722 |
{
|
|
1723 |
return parseAttributeValueName(aValueId);
|
|
1724 |
}
|
|
1725 |
}
|
|
1726 |
|
|
1727 |
/**
|
|
1728 |
* Converts a short constant to the string representation of a
|
|
1729 |
* SVGT 1.1 attribute value literal.
|
|
1730 |
* This method covers all of SVGT 1.1 and not just JSR-226.
|
|
1731 |
* @param aValueId
|
|
1732 |
* @return Value's name
|
|
1733 |
*/
|
|
1734 |
static final String parseAttributeValueName(short aValueId)
|
|
1735 |
{
|
|
1736 |
|
|
1737 |
switch (aValueId)
|
|
1738 |
{
|
|
1739 |
case TEXT_NOT_SHORT:
|
|
1740 |
return "#text";
|
|
1741 |
|
|
1742 |
case DEFAULT_INHERIT:
|
|
1743 |
case PAINT_INHERIT:
|
|
1744 |
return "inherit";
|
|
1745 |
|
|
1746 |
case DISPLAY_NONE:
|
|
1747 |
case PAINT_NONE:
|
|
1748 |
return "none";
|
|
1749 |
|
|
1750 |
case DISPLAY_OTHER:
|
|
1751 |
return "inline";
|
|
1752 |
|
|
1753 |
case PAINT_CURRENT:
|
|
1754 |
return "currentColor";
|
|
1755 |
|
|
1756 |
case FILL_RULE_NONZERO:
|
|
1757 |
return "nonzero";
|
|
1758 |
|
|
1759 |
case FILL_RULE_EVENODD:
|
|
1760 |
return "evenodd";
|
|
1761 |
|
|
1762 |
case FONT_NORMAL:
|
|
1763 |
return "normal";
|
|
1764 |
|
|
1765 |
case FONT_STYLE_ITALIC:
|
|
1766 |
return "italic";
|
|
1767 |
|
|
1768 |
case FONT_STYLE_OBLIQUE:
|
|
1769 |
return "oblique";
|
|
1770 |
|
|
1771 |
case FONT_WEIGHT_BOLD:
|
|
1772 |
return "bold";
|
|
1773 |
|
|
1774 |
case FONT_WEIGHT_BOLDER:
|
|
1775 |
return "bolder";
|
|
1776 |
|
|
1777 |
case FONT_WEIGHT_LIGHTER:
|
|
1778 |
return "lighter";
|
|
1779 |
|
|
1780 |
case FONT_WEIGHT_100:
|
|
1781 |
return "100";
|
|
1782 |
|
|
1783 |
case FONT_WEIGHT_200:
|
|
1784 |
return "200";
|
|
1785 |
|
|
1786 |
case FONT_WEIGHT_300:
|
|
1787 |
return "300";
|
|
1788 |
|
|
1789 |
case FONT_WEIGHT_400:
|
|
1790 |
return "400";
|
|
1791 |
|
|
1792 |
case FONT_WEIGHT_500:
|
|
1793 |
return "500";
|
|
1794 |
|
|
1795 |
case FONT_WEIGHT_600:
|
|
1796 |
return "600";
|
|
1797 |
|
|
1798 |
case FONT_WEIGHT_700:
|
|
1799 |
return "700";
|
|
1800 |
|
|
1801 |
case FONT_WEIGHT_800:
|
|
1802 |
return "800";
|
|
1803 |
|
|
1804 |
case FONT_WEIGHT_900:
|
|
1805 |
return "900";
|
|
1806 |
|
|
1807 |
case STROKE_LINECAP_BUTT:
|
|
1808 |
return "butt";
|
|
1809 |
|
|
1810 |
case STROKE_LINECAP_ROUND:
|
|
1811 |
case STROKE_LINEJOIN_ROUND:
|
|
1812 |
return "round";
|
|
1813 |
|
|
1814 |
case STROKE_LINECAP_SQUARE:
|
|
1815 |
return "square";
|
|
1816 |
|
|
1817 |
case STROKE_LINEJOIN_MITER:
|
|
1818 |
return "miter";
|
|
1819 |
|
|
1820 |
case STROKE_LINEJOIN_BEVEL:
|
|
1821 |
return "bevel";
|
|
1822 |
|
|
1823 |
case TEXT_ANCHOR_START:
|
|
1824 |
return "start";
|
|
1825 |
|
|
1826 |
case TEXT_ANCHOR_MIDDLE:
|
|
1827 |
return "middle";
|
|
1828 |
|
|
1829 |
case TEXT_ANCHOR_END:
|
|
1830 |
return "end";
|
|
1831 |
|
|
1832 |
case VISIBILITY_VISIBLE:
|
|
1833 |
return "visible";
|
|
1834 |
|
|
1835 |
case VISIBILITY_OTHER:
|
|
1836 |
return "hidden";
|
|
1837 |
|
|
1838 |
case ZPN_MAGNIFY:
|
|
1839 |
return "magnify";
|
|
1840 |
|
|
1841 |
case ZPN_DISABLE:
|
|
1842 |
return "disable";
|
|
1843 |
|
|
1844 |
default:
|
|
1845 |
return "";
|
|
1846 |
}
|
|
1847 |
}
|
|
1848 |
|
|
1849 |
/*
|
|
1850 |
* Parses path command
|
|
1851 |
* @param aPathCommandIndex
|
|
1852 |
* @return path command
|
|
1853 |
*/
|
|
1854 |
static short parsePathCommand(short aPathCommandIndex)
|
|
1855 |
{
|
|
1856 |
short command = SVG_ERROR;
|
|
1857 |
switch (aPathCommandIndex)
|
|
1858 |
{
|
|
1859 |
case PATH_COMMAND_m:
|
|
1860 |
case PATH_COMMAND_M:
|
|
1861 |
command = SVGPath.MOVE_TO;
|
|
1862 |
break;
|
|
1863 |
case PATH_COMMAND_Z:
|
|
1864 |
command = SVGPath.CLOSE;
|
|
1865 |
break;
|
|
1866 |
case PATH_COMMAND_h:
|
|
1867 |
case PATH_COMMAND_v:
|
|
1868 |
case PATH_COMMAND_l:
|
|
1869 |
case PATH_COMMAND_H:
|
|
1870 |
case PATH_COMMAND_V:
|
|
1871 |
case PATH_COMMAND_L:
|
|
1872 |
command = SVGPath.LINE_TO;
|
|
1873 |
break;
|
|
1874 |
case PATH_COMMAND_s:
|
|
1875 |
case PATH_COMMAND_c:
|
|
1876 |
case PATH_COMMAND_S:
|
|
1877 |
case PATH_COMMAND_C:
|
|
1878 |
command = SVGPath.CURVE_TO;
|
|
1879 |
break;
|
|
1880 |
case PATH_COMMAND_t:
|
|
1881 |
case PATH_COMMAND_q:
|
|
1882 |
case PATH_COMMAND_T:
|
|
1883 |
case PATH_COMMAND_Q:
|
|
1884 |
command = SVGPath.QUAD_TO;
|
|
1885 |
break;
|
|
1886 |
default:
|
|
1887 |
command = SVG_ERROR;
|
|
1888 |
break;
|
|
1889 |
}
|
|
1890 |
return command;
|
|
1891 |
}
|
|
1892 |
}
|
|
1893 |
|