LocaleSetModel.java
34.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.localeset;
import com.adobe.xfa.AppModel;
import com.adobe.xfa.Attribute;
import com.adobe.xfa.Document;
import com.adobe.xfa.Element;
import com.adobe.xfa.EnumAttr;
import com.adobe.xfa.EnumValue;
import com.adobe.xfa.LogMessenger;
import com.adobe.xfa.Model;
import com.adobe.xfa.ModelFactory;
import com.adobe.xfa.Node;
import com.adobe.xfa.NodeList;
import com.adobe.xfa.Obj;
import com.adobe.xfa.Schema;
import com.adobe.xfa.StringAttr;
import com.adobe.xfa.TextNode;
import com.adobe.xfa.XFA;
import com.adobe.xfa.localeset.LocaleSetModelFactory;
import com.adobe.xfa.localeset.LocaleSetSchema;
import com.adobe.xfa.protocol.ProtocolUtils;
import com.adobe.xfa.service.storage.XMLStorage;
import com.adobe.xfa.template.TemplateModel;
import com.adobe.xfa.ut.ExFull;
import com.adobe.xfa.ut.LcData;
import com.adobe.xfa.ut.LcLocale;
import com.adobe.xfa.ut.MsgFormatPos;
import com.adobe.xfa.ut.Numeric;
import com.adobe.xfa.ut.PictureFmt;
import com.adobe.xfa.ut.ResId;
import com.adobe.xfa.ut.StringHolder;
import com.adobe.xfa.ut.StringUtils;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import org.xml.sax.Attributes;
public final class LocaleSetModel
extends Model {
private static final int[] geDateTimePats = new int[]{-2142175232, -2142175231, -2142175230, -2142175229};
private static final int[] geNumPats = new int[]{-2142109696, -2142109695, -2142109694};
private static final LocaleSetSchema gLocaleSchema = new LocaleSetSchema();
private static final String gsAmbient = "ambient";
@Override
public Node createNode(int eTag, Element parent, String aName, String aNS, boolean bDoVersionCheck) {
assert (aName != null);
assert (aNS != null);
Element retVal = this.getSchema().getInstance(eTag, this, parent, null, bDoVersionCheck);
if (aName != "") {
retVal.setName(aName);
}
return retVal;
}
@Override
public String getBaseNS() {
return "http://www.xfa.org/schema/xfa-locale-set/";
}
@Override
public String getHeadNS() {
return LocaleSetModel.localeSetNS();
}
public static LocaleSetModel getLocaleSetModel(AppModel appModel, boolean bCreateIfNotFound) {
LocaleSetModel lsm = (LocaleSetModel)Model.getNamedModel(appModel, "localeSet");
if (bCreateIfNotFound && lsm == null) {
LocaleSetModelFactory factory = new LocaleSetModelFactory();
lsm = (LocaleSetModel)factory.createDOM((Element)appModel.getXmlPeer());
lsm.setDocument(appModel.getDocument());
appModel.notifyPeers(4, "localeSet", lsm);
}
return lsm;
}
protected static Schema getModelSchema() {
return gLocaleSchema;
}
public static String localeSetNS() {
return "http://www.xfa.org/schema/xfa-locale-set/2.7/";
}
public static boolean setLocaleSetModel(AppModel oAppModel, Element oNode) {
ArrayList<String> oLocales = new ArrayList<String>();
LocaleSetModel.find(oNode, oLocales);
if (oLocales.size() == 0) {
return true;
}
LocaleSetModel oModel = LocaleSetModel.getLocaleSetModel(oAppModel, true);
ArrayList<String> oLsLocales = new ArrayList<String>();
LocaleSetModel.find(oModel, oLsLocales);
int n = oLsLocales.size();
block0 : for (int i = oLocales.size(); i > 0; --i) {
for (int j = 0; j < n; ++j) {
if (oLsLocales.get(j) != oLocales.get(i - 1)) continue;
oLocales.remove(i - 1);
continue block0;
}
}
int nLocales = oLocales.size();
if (nLocales == 0) {
return true;
}
Element oLocaleSym = oModel.createElement(null, null, null, "locale", "locale", null, 0, null);
Element oCalendarSyms = oModel.createElement(null, null, null, "calendarSymbols", "calendarSymbols", null, 0, null);
Element oMonthNames = oModel.createElement(null, null, null, "monthNames", "monthNames", null, 0, null);
Element oDayNames = oModel.createElement(null, null, null, "dayNames", "dayNames", null, 0, null);
Element oMeridiemNames = oModel.createElement(null, null, null, "meridiemNames", "meridiemNames", null, 0, null);
Element oEraNames = oModel.createElement(null, null, null, "eraNames", "eraNames", null, 0, null);
Element oDatePats = oModel.createElement(null, null, null, "datePatterns", "datePatterns", null, 0, null);
Element oTimePats = oModel.createElement(null, null, null, "timePatterns", "timePatterns", null, 0, null);
Element oDateTimeSym = oModel.createElement(null, null, null, "dateTimeSymbols", "dateTimeSymbols", null, 0, null);
Element oNumPats = oModel.createElement(null, null, null, "numberPatterns", "numberPatterns", null, 0, null);
Element oNumSyms = oModel.createElement(null, null, null, "numberSymbols", "numberSymbols", null, 0, null);
Element oCurSyms = oModel.createElement(null, null, null, "currencySymbols", "currencySymbols", null, 0, null);
Element oTypefaces = oModel.createElement(null, null, null, "typefaces", "typefaces", null, 0, null);
Model model = oLocaleSym.getModel();
boolean bLocalesOk = true;
for (int i2 = 0; i2 < nLocales; ++i2) {
TextNode tval;
Element oDay;
Element oSym;
TextNode tval2;
int j;
TextNode tval3;
Element oMonth;
int j2;
String sLocale = oLocales.get(i2);
LcLocale oLocale = new LcLocale(sLocale);
if (!oLocale.isValid()) {
MsgFormatPos oMessage = new MsgFormatPos(ResId.LocaleUnknown);
oMessage.format(sLocale);
ExFull oErr = new ExFull(oMessage.resId(), oMessage.toString());
model.addErrorList(oErr, 3, oNode);
bLocalesOk = false;
continue;
}
LcData oLcData = new LcData(oLocale.getIsoName());
Element oLocaleSymClone = oLocaleSym.clone(null, true);
Attribute oProp = new StringAttr("name", oLocale.getIsoName());
oLocaleSymClone.setAttribute(oProp, XFA.NAMETAG);
String sDesc = "";
if (!StringUtils.isEmpty(sDesc)) {
oProp = new StringAttr("desc", sDesc);
oLocaleSymClone.setAttribute(oProp, XFA.DESCTAG);
}
oModel.appendChild(oLocaleSymClone, false);
Element oCalendarSymsClone = oCalendarSyms.clone(null, true);
oProp = new StringAttr("name", "gregorian");
oCalendarSymsClone.setAttribute(oProp, XFA.NAMETAG);
oLocaleSymClone.appendChild(oCalendarSymsClone, false);
Element oMonthNamesClone = oMonthNames.clone(null, true);
for (j2 = 0; j2 <= 11; ++j2) {
oMonth = oMonthNamesClone.getElement(XFA.MONTHTAG, j2);
tval = oMonth.getText(false, true, false);
tval.setValue(oLcData.getMonthName(j2), true, false);
}
oCalendarSymsClone.appendChild(oMonthNamesClone, false);
oMonthNamesClone = oMonthNames.clone(null, true);
oProp = new StringAttr("abbr", "1");
oMonthNamesClone.setAttribute(oProp, XFA.ABBRTAG);
for (j2 = 0; j2 <= 11; ++j2) {
oMonth = oMonthNamesClone.getElement(XFA.MONTHTAG, j2);
tval = oMonth.getText(false, true, false);
tval.setValue(oLcData.getAbbrMonthName(j2), true, false);
}
oCalendarSymsClone.appendChild(oMonthNamesClone, false);
Element oDayNamesClone = oDayNames.clone(null, true);
for (j = 0; j <= 6; ++j) {
oDay = oDayNamesClone.getElement(XFA.DAYTAG, j);
tval2 = oDay.getText(false, true, false);
tval2.setValue(oLcData.getWeekDayName(j), true, false);
}
oCalendarSymsClone.appendChild(oDayNamesClone, false);
oDayNamesClone = oDayNames.clone(null, true);
oProp = new StringAttr("abbr", "1");
oDayNamesClone.setAttribute(oProp, XFA.ABBRTAG);
for (j = 0; j <= 6; ++j) {
oDay = oDayNamesClone.getElement(XFA.DAYTAG, j);
tval2 = oDay.getText(false, true, false);
tval2.setValue(oLcData.getAbbrWeekdayName(j), true, false);
}
oCalendarSymsClone.getNodes().append(oDayNamesClone);
Element oMeridiemNamesClone = oMeridiemNames.clone(null, true);
for (int j3 = 0; j3 <= 1; ++j3) {
Element oMeri = oMeridiemNamesClone.getElement(XFA.MERIDIEMTAG, j3);
TextNode tval4 = oMeri.getText(false, true, false);
tval4.setValue(oLcData.getMeridiemName(j3), true, false);
}
oCalendarSymsClone.getNodes().append(oMeridiemNamesClone);
Element oEraNamesClone = oEraNames.clone(null, true);
for (int j4 = 0; j4 <= 1; ++j4) {
Element oEra = oEraNamesClone.getElement(XFA.ERATAG, j4);
TextNode tval5 = oEra.getText(false, true, false);
tval5.setValue(oLcData.getEraName(j4), true, false);
}
oCalendarSymsClone.getNodes().append(oEraNamesClone);
Element oDatePatsClone = oDatePats.clone(null, true);
for (int j5 = 0; j5 <= 3; ++j5) {
Element oPat = oDatePatsClone.getElement(XFA.DATEPATTERNTAG, j5);
oProp = EnumValue.getEnum(XFA.NAMETAG, EnumAttr.getEnum(geDateTimePats[j5]));
oPat.setAttribute(oProp, XFA.NAMETAG);
tval3 = oPat.getText(false, true, false);
tval3.setValue(oLcData.getDateFormat(3 - j5 + 1), true, false);
}
oLocaleSymClone.getNodes().append(oDatePatsClone);
Element oTimePatsClone = oTimePats.clone(null, true);
for (int j6 = 0; j6 <= 3; ++j6) {
Element oPat = oTimePatsClone.getElement(XFA.TIMEPATTERNTAG, j6);
oProp = EnumValue.getEnum(XFA.NAMETAG, EnumAttr.getEnum(geDateTimePats[j6]));
oPat.setAttribute(oProp, XFA.NAMETAG);
TextNode tval6 = oPat.getText(false, true, false);
tval6.setValue(oLcData.getTimeFormat(3 - j6 + 1), true, false);
}
oLocaleSymClone.getNodes().append(oTimePatsClone);
Element oDateTimeClone = oDateTimeSym.clone(null, true);
tval3 = oDateTimeClone.getText(false, true, false);
tval3.setValue(oLcData.getDateTimePattern(), true, false);
oLocaleSymClone.getNodes().append(oDateTimeClone);
Element oNumPatsClone = oNumPats.clone(null, true);
for (int j7 = 0; j7 <= 2; ++j7) {
Element oPat = oNumPatsClone.getElement(XFA.NUMBERPATTERNTAG, j7);
oProp = EnumValue.getEnum(XFA.NAMETAG, EnumAttr.getEnum(geNumPats[j7]));
oPat.setAttribute(oProp, XFA.NAMETAG);
tval3 = oPat.getText(false, true, false);
tval3.setValue(oLcData.getNumericFormat(j7), true, false);
}
oLocaleSymClone.getNodes().append(oNumPatsClone);
Element oNumSymsClone = oNumSyms.clone(null, true);
for (int j8 = 0; j8 <= 4; ++j8) {
int eTag;
String sSymbol;
if (j8 == 0) {
sSymbol = oLcData.getRadixSymbol();
eTag = -2142044160;
} else if (j8 == 1) {
sSymbol = oLcData.getGroupingSymbol();
eTag = -2142044159;
} else if (j8 == 2) {
sSymbol = oLcData.getPercentSymbol();
eTag = -2142044158;
} else if (j8 == 3) {
sSymbol = oLcData.getNegativeSymbol();
eTag = -2142044157;
} else {
sSymbol = oLcData.getZeroSymbol();
eTag = -2142044156;
}
Element oSym2 = oNumSymsClone.getElement(XFA.NUMBERSYMBOLTAG, j8);
oProp = EnumValue.getEnum(XFA.NAMETAG, EnumAttr.getEnum(eTag));
oSym2.setAttribute(oProp, XFA.NAMETAG);
tval3 = oSym2.getText(false, true, false);
tval3.setValue(sSymbol, true, false);
}
oLocaleSymClone.getNodes().append(oNumSymsClone);
Element oCurSymsClone = oCurSyms.clone(null, true);
for (int j9 = 0; j9 <= 2; ++j9) {
int eTag;
String sSymbol;
if (j9 == 0) {
sSymbol = oLcData.getCurrencySymbol();
eTag = -2141978624;
} else if (j9 == 1) {
sSymbol = oLcData.getCurrencyName();
eTag = -2141978623;
} else {
sSymbol = oLcData.getCurrencyRadix();
eTag = -2141978622;
}
oSym = oCurSymsClone.getElement(XFA.CURRENCYSYMBOLTAG, j9);
oProp = EnumValue.getEnum(XFA.NAMETAG, EnumAttr.getEnum(eTag));
oSym.setAttribute(oProp, XFA.NAMETAG);
tval3 = oSym.getText(false, true, false);
tval3.setValue(sSymbol, true, false);
}
oLocaleSymClone.getNodes().append(oCurSymsClone);
Element oTypefacesClone = oTypefaces.clone(null, true);
List<String> oTypefaceList = oLcData.getTypefaces();
for (int k = 0; k < oTypefaceList.size(); ++k) {
oSym = oModel.createElement(null, null, null, "typeface", "typeface", null, 0, null);
oProp = new StringAttr("name", oTypefaceList.get(k));
oSym.setAttribute(oProp, XFA.NAMETAG);
oTypefacesClone.appendChild(oSym, false);
}
oLocaleSymClone.getNodes().append(oTypefacesClone);
}
return bLocalesOk;
}
public LocaleSetModel(Element parent, Node prevSibling) {
super(parent, prevSibling, LocaleSetModel.localeSetNS(), "localeSet", "localeSet", "$localeSet", XFA.LOCALESETTAG, "localeSet", LocaleSetModel.getModelSchema());
}
@Override
protected void postLoad() {
this.refreshLocales();
}
public void refreshLocales() {
Model oModel = this.getModel();
for (Node oChild = this.getFirstXFAChild(); oChild != null; oChild = oChild.getNextXFASibling()) {
LcData.LcRunTimeData oLcData;
block5 : {
StringHolder sLoc = new StringHolder();
try {
ExFull oErr;
MsgFormatPos oMessage;
oLcData = this.walk(oChild, sLoc, null);
if (oLcData == null || StringUtils.isEmpty(oLcData.localeName)) {
oMessage = new MsgFormatPos(ResId.LocaleUnknown);
oMessage.format("");
oErr = new ExFull(oMessage);
oModel.addErrorList(oErr, 3, this);
continue;
}
if (!LcData.validate(oLcData)) {
oMessage = new MsgFormatPos(ResId.LocaleDataIncomplete);
oMessage.format(oLcData.localeName);
oErr = new ExFull(oMessage);
oModel.addErrorList(oErr, 3, this);
}
break block5;
}
catch (ExFull oErr) {
oModel.addErrorList(oErr, 3, this);
}
continue;
}
LcData.update(oLcData);
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public static void loadLocalesFromConfig(Node oContext) {
String sLocaleSetPath = null;
String sBasePath = null;
String sUriPath = null;
if (oContext != null) {
Node oTree = oContext.resolveNode("localeSet");
if (oTree != null && oTree.getXFAChildCount() == 1) {
TextNode textNode = (TextNode)oTree.getFirstXFAChild();
sLocaleSetPath = textNode.getValue();
}
sBasePath = ProtocolUtils.getTemplateBasePathFromConfig(oContext);
sUriPath = ProtocolUtils.getTemplateUriPathFromConfig(oContext);
}
if (StringUtils.isEmpty(sLocaleSetPath)) {
return;
}
InputStream isResolved = null;
AppModel oTmpAppModel = new AppModel(null);
try {
StringHolder resolvedUrl = new StringHolder();
isResolved = ProtocolUtils.checkUrl(sBasePath, sLocaleSetPath, true, resolvedUrl);
if (isResolved == null) {
isResolved = ProtocolUtils.checkUrl(sUriPath, sLocaleSetPath, true, resolvedUrl);
}
if (isResolved == null) {
MsgFormatPos oMsg = new MsgFormatPos(ResId.XFAHrefStoreException);
oMsg.format(sLocaleSetPath);
throw new ExFull(oMsg);
}
LocaleSetModelFactory oLocaleSetFactory = new LocaleSetModelFactory();
oTmpAppModel.addFactory(oLocaleSetFactory);
XMLStorage oXMLStorage = new XMLStorage();
oXMLStorage.loadModel(oTmpAppModel, isResolved, resolvedUrl.value, "", null);
}
finally {
try {
if (isResolved != null) {
isResolved.close();
}
}
catch (IOException ex) {}
}
LocaleSetModel oLocaleSetModel = LocaleSetModel.getLocaleSetModel(oTmpAppModel, false);
if (oLocaleSetModel != null && oLocaleSetModel.getErrorList().size() > 0) {
List<ExFull> errorList = oLocaleSetModel.getErrorList();
int n = errorList.size();
for (int i = 0; i < n; ++i) {
ExFull error = errorList.get(i);
error.resolve();
}
}
}
@Override
public int getHeadVersion() {
return 27;
}
@Override
public String getNS() {
int nVersion = this.getCurrentVersion();
AppModel appModel = this.getAppModel();
if (appModel != null) {
for (Node child = appModel.getFirstXFAChild(); child != null; child = child.getNextXFASibling()) {
if (!(child instanceof TemplateModel)) continue;
nVersion = ((TemplateModel)child).getCurrentVersion();
break;
}
}
if (nVersion > 0) {
if (nVersion > 27) {
nVersion = 27;
}
if (nVersion <= 25) {
nVersion = 21;
}
String sNS = this.getBaseNS();
double dVersion = (double)nVersion / 10.0;
sNS = sNS + Numeric.doubleToString(dVersion, 1, false);
sNS = sNS + '/';
return sNS.intern();
}
return super.getNS();
}
@Override
public boolean isVersionCompatible(int nVersion, int nTargetVersion) {
if (nVersion <= 25) {
nVersion = 25;
}
if (nTargetVersion <= 25) {
nTargetVersion = 25;
}
return super.isVersionCompatible(nVersion, nTargetVersion);
}
private static void find(Element oNode, List<String> oLocales) {
String sLocale;
LcLocale oLocale;
if (oNode == null) {
return;
}
if (oNode.isSameClass(XFA.SUBFORMTAG) || oNode.isSameClass(XFA.DRAWTAG) || oNode.isSameClass(XFA.FIELDTAG)) {
LcLocale oLocale2;
String sLocale2;
Attribute oAttr;
int eLocale = XFA.LOCALETAG;
if (oNode.isPropertyValid(eLocale) && oNode.isPropertySpecified(eLocale, true, 0) && (oAttr = oNode.getAttribute(eLocale)) != null && !oAttr.isEmpty() && !(sLocale2 = oAttr.toString()).equals("ambient") && (oLocale2 = new LcLocale(sLocale2)).isValid()) {
int i;
sLocale2 = oLocale2.getName();
int n = oLocales.size();
for (i = 0; i < n && !oLocales.get(i).equals(sLocale2); ++i) {
}
if (i == n) {
oLocales.add(sLocale2);
}
}
} else if (oNode.isSameClass(XFA.PICTURETAG)) {
LcLocale oLocale3;
String sPicture;
StringBuilder sMask;
StringBuilder sCat;
StringBuilder sLoc;
TextNode oPicture = oNode.getText(true, false, false);
if (oPicture != null && PictureFmt.isSubPicture(sPicture = oPicture.getValue(), 0, sCat = new StringBuilder(), sLoc = new StringBuilder(), sMask = new StringBuilder()) && (oLocale3 = new LcLocale(sLoc.toString())).isValid()) {
int i;
String sLocale3 = oLocale3.getName();
int n = oLocales.size();
for (i = 0; i < n && !oLocales.get(i).equals(sLocale3); ++i) {
}
if (i == n) {
oLocales.add(sLocale3);
}
}
} else if (oNode.isSameClass(XFA.LOCALETAG) && !(sLocale = oNode.getName()).equals("ambient") && (oLocale = new LcLocale(sLocale)).isValid()) {
int i;
sLocale = oLocale.getName();
int n = oLocales.size();
for (i = 0; i < n && !oLocales.get(i).equals(sLocale); ++i) {
}
if (i == n) {
oLocales.add(sLocale);
}
}
if (!oNode.isSameClass(XFA.DRAWTAG) && !oNode.isSameClass(XFA.LOCALETAG)) {
Node oChild = oNode.getFirstXFAChild();
while (oChild instanceof Element) {
LocaleSetModel.find((Element)oChild, oLocales);
oChild = oChild.getNextXFASibling();
}
}
}
/*
* Enabled force condition propagation
* Lifted jumps to return sites
*/
private LcData.LcRunTimeData walk(Node oNode, StringHolder sLoc, LcData.LcRunTimeData oLcData) {
if (oNode == null) {
return oLcData;
}
if (oNode.isSameClass(XFA.LOCALETAG)) {
String sDesc = ((Element)oNode).getAttribute(XFA.DESCTAG).toString();
String sName = oNode.getName();
if (StringUtils.isEmpty(sName)) {
return oLcData;
}
oLcData = LcData.get(sName);
for (Node oChild = oNode.getFirstXFAChild(); oChild != null; oChild = oChild.getNextXFASibling()) {
oLcData = this.walk(oChild, sLoc, oLcData);
}
LcLocale oLocale = new LcLocale(sName);
if (!oLocale.isValid()) {
LcLocale.update(sName, sDesc);
}
sLoc.value = LcLocale.normalize(sName);
return oLcData;
} else if (oNode.isSameClass(XFA.CALENDARSYMBOLSTAG)) {
for (Node oChild = oNode.getFirstXFAChild(); oChild != null; oChild = oChild.getNextXFASibling()) {
oLcData = this.walk(oChild, sLoc, oLcData);
}
return oLcData;
} else {
if (oNode.isSameClass(XFA.MONTHNAMESTAG)) {
int eAbbr = ((Element)oNode).getEnum(XFA.ABBRTAG);
switch (eAbbr) {
case 1074003968:
case 1074003969: {
break;
}
default: {
return oLcData;
}
}
Element oMonth = (Element)oNode.getFirstXFAChild();
int i = 0;
while (oMonth != null) {
if (i >= 12) return oLcData;
String sMonth = oMonth.getText(false, false, false).getValue();
if (eAbbr == 1074003969) {
oLcData.abbrMonthNames[i] = sMonth;
} else {
oLcData.monthNames[i] = sMonth;
}
oMonth = (Element)oMonth.getNextXFASibling();
++i;
}
return oLcData;
}
if (oNode.isSameClass(XFA.DAYNAMESTAG)) {
int eAbbr = ((Element)oNode).getEnum(XFA.ABBRTAG);
switch (eAbbr) {
case 1074003968:
case 1074003969: {
break;
}
default: {
return oLcData;
}
}
Element oDay = (Element)oNode.getFirstXFAChild();
int i = 0;
while (oDay != null) {
if (i >= 7) return oLcData;
String sDay = oDay.getText(false, false, false).getValue();
if (eAbbr == 1074003969) {
oLcData.abbrWeekdayNames[i] = sDay;
} else {
oLcData.dayNames[i] = sDay;
}
oDay = (Element)oDay.getNextXFASibling();
++i;
}
return oLcData;
}
if (oNode.isSameClass(XFA.MERIDIEMNAMESTAG)) {
Element oMeridiem = (Element)oNode.getFirstXFAChild();
int i = 0;
while (oMeridiem != null) {
String sMeridiem;
if (i >= 2) return oLcData;
oLcData.meridiemNames[i] = sMeridiem = oMeridiem.getText(false, false, false).getValue();
oMeridiem = (Element)oMeridiem.getNextXFASibling();
++i;
}
return oLcData;
}
if (oNode.isSameClass(XFA.ERANAMESTAG)) {
Element oEra = (Element)oNode.getFirstXFAChild();
int i = 0;
while (oEra != null) {
String sEra;
if (i >= 2) return oLcData;
oLcData.eraNames[i] = sEra = oEra.getText(false, false, false).getValue();
oEra = (Element)oEra.getNextXFASibling();
++i;
}
return oLcData;
}
if (oNode.isSameClass(XFA.DATEPATTERNSTAG)) {
block41 : for (Element oDatePat = (Element)oNode.getFirstXFAChild(); oDatePat != null; oDatePat = (Element)oDatePat.getNextXFASibling()) {
int eName = oDatePat.getEnum(XFA.NAMETAG);
String sPat = oDatePat.getText(false, false, false).getValue();
switch (eName) {
case -2142175232: {
oLcData.datePatterns[0] = sPat;
continue block41;
}
case -2142175231: {
oLcData.datePatterns[1] = sPat;
continue block41;
}
case -2142175230: {
oLcData.datePatterns[2] = sPat;
continue block41;
}
case -2142175229: {
oLcData.datePatterns[3] = sPat;
continue block41;
}
default: {
return oLcData;
}
}
}
return oLcData;
} else if (oNode.isSameClass(XFA.TIMEPATTERNSTAG)) {
block42 : for (Element oTimePat = (Element)oNode.getFirstXFAChild(); oTimePat != null; oTimePat = (Element)oTimePat.getNextXFASibling()) {
int eName = oTimePat.getEnum(XFA.NAMETAG);
String sPat = oTimePat.getText(false, false, false).getValue();
switch (eName) {
case -2142175232: {
oLcData.timePatterns[0] = sPat;
continue block42;
}
case -2142175231: {
oLcData.timePatterns[1] = sPat;
continue block42;
}
case -2142175230: {
oLcData.timePatterns[2] = sPat;
continue block42;
}
case -2142175229: {
oLcData.timePatterns[3] = sPat;
continue block42;
}
default: {
return oLcData;
}
}
}
return oLcData;
} else if (oNode.isSameClass(XFA.DATETIMESYMBOLSTAG)) {
String sPat;
Element oDateTimePat = (Element)oNode;
oLcData.dateTimeSymbols[0] = sPat = oDateTimePat.getText(false, false, false).getValue();
return oLcData;
} else if (oNode.isSameClass(XFA.NUMBERPATTERNSTAG)) {
block43 : for (Element oNumPat = (Element)oNode.getFirstXFAChild(); oNumPat != null; oNumPat = (Element)oNumPat.getNextXFASibling()) {
int eName = oNumPat.getEnum(XFA.NAMETAG);
String sPat = oNumPat.getText(false, false, false).getValue();
switch (eName) {
case -2142109696: {
oLcData.numberPatterns[0] = sPat;
continue block43;
}
case -2142109695: {
oLcData.numberPatterns[1] = sPat;
continue block43;
}
case -2142109694: {
oLcData.numberPatterns[2] = sPat;
continue block43;
}
default: {
return oLcData;
}
}
}
return oLcData;
} else if (oNode.isSameClass(XFA.NUMBERSYMBOLSTAG)) {
block44 : for (Element oNumSym = (Element)oNode.getFirstXFAChild(); oNumSym != null; oNumSym = (Element)oNumSym.getNextXFASibling()) {
int eName = oNumSym.getEnum(XFA.NAMETAG);
String sSym = oNumSym.getText(false, false, false).getValue();
switch (eName) {
case -2142044160: {
oLcData.numericSymbols[0] = sSym;
continue block44;
}
case -2142044159: {
oLcData.numericSymbols[1] = sSym;
continue block44;
}
case -2142044158: {
oLcData.numericSymbols[2] = sSym;
continue block44;
}
case -2142044157: {
oLcData.numericSymbols[3] = sSym;
continue block44;
}
case -2142044156: {
oLcData.numericSymbols[4] = sSym;
continue block44;
}
default: {
return oLcData;
}
}
}
return oLcData;
} else if (oNode.isSameClass(XFA.CURRENCYSYMBOLSTAG)) {
block45 : for (Element oCurSym = (Element)oNode.getFirstXFAChild(); oCurSym != null; oCurSym = (Element)oCurSym.getNextXFASibling()) {
int eName = oCurSym.getEnum(XFA.NAMETAG);
String sSym = oCurSym.getText(false, false, false).getValue();
switch (eName) {
case -2141978624: {
oLcData.currencySymbols[0] = sSym;
continue block45;
}
case -2141978623: {
oLcData.currencySymbols[1] = sSym;
continue block45;
}
case -2141978622: {
oLcData.currencySymbols[2] = sSym;
continue block45;
}
default: {
return oLcData;
}
}
}
return oLcData;
} else {
if (!oNode.isSameClass(XFA.TYPEFACESTAG)) return oLcData;
int nTypefaces = oNode.getXMLChildCount();
oLcData.typefaceList.clear();
for (int i = 0; i < nTypefaces; ++i) {
Element oTypeface = ((Element)oNode).getElement(XFA.TYPEFACETAG, i);
String sName = oTypeface.getAttribute(XFA.NAMETAG).toString();
String sCorrectedName = null;
if (sName.equals("Kozuka Gothic Pro VI")) {
sCorrectedName = "Kozuka Gothic Pro-VI M";
} else if (sName.equals("Kozuka Mincho Pro VI")) {
sCorrectedName = "Kozuka Mincho Pro-VI R";
} else if (sName.equals("Adobe Ming Std")) {
sCorrectedName = "Adobe Ming Std L";
} else if (sName.equals("Adobe Song Std")) {
sCorrectedName = "Adobe Song Std L";
} else if (sName.equals("Adobe Myungjo Std")) {
sCorrectedName = "Adobe Myungjo Std M";
}
if (!StringUtils.isEmpty(sCorrectedName)) {
sName = sCorrectedName;
StringAttr oProp = new StringAttr("name", sName);
oTypeface.setAttribute(oProp, XFA.NAMETAG);
}
oLcData.typefaceList.add(sName);
}
LcData oRootData = new LcData("root");
List<String> oRootList = oRootData.getTypefaces();
int i2 = 0;
while (i2 < oRootList.size()) {
String sName = oRootList.get(i2);
if (!oLcData.typefaceList.contains(sName)) {
oLcData.typefaceList.add(sName);
}
++i2;
}
return oLcData;
}
}
}
}