forked from unidoc/unioffice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.go
12199 lines (11746 loc) · 302 KB
/
common.go
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
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2017 Baliance. All rights reserved.
//
// DO NOT EDIT: generated by gooxml ECMA-376 generator
//
// Use of this source code is governed by the terms of the Affero GNU General
// Public License version 3.0 as published by the Free Software Foundation and
// appearing in the file LICENSE included in the packaging of this file. A
// commercial license can be purchased by contacting sales@baliance.com.
package dml
import (
"encoding/xml"
"fmt"
"regexp"
"strconv"
"time"
"baliance.com/gooxml"
"baliance.com/gooxml/schema/soo/ofc/sharedTypes"
)
const ST_TextBulletSizePercentPattern = `0*((2[5-9])|([3-9][0-9])|([1-3][0-9][0-9])|400)%`
var ST_TextBulletSizePercentPatternRe = regexp.MustCompile(ST_TextBulletSizePercentPattern)
func ParseUnionST_Percentage(s string) (ST_Percentage, error) {
r := ST_Percentage{}
if sharedTypes.ST_PercentagePatternRe.MatchString(s) {
r.ST_Percentage = &s
} else {
v, err := strconv.ParseInt(s, 10, 64)
if err != nil {
return r, fmt.Errorf("parsing %s as int", err)
}
v32 := int32(v)
r.ST_PercentageDecimal = &v32
}
return r, nil
}
func ParseUnionST_PositivePercentage(s string) (ST_PositivePercentage, error) {
r := ST_PositivePercentage{}
if sharedTypes.ST_PositivePercentagePatternRe.MatchString(s) {
r.ST_PositivePercentage = &ST_Percentage{}
r.ST_PositivePercentage.ST_Percentage = &s
} else {
v, err := strconv.ParseInt(s, 10, 32)
if err != nil {
return r, fmt.Errorf("parsing %s as int", err)
}
v32 := int32(v)
r.ST_PositivePercentageDecimal = &v32
}
return r, nil
}
func ParseUnionST_PositiveFixedPercentage(s string) (ST_PositiveFixedPercentage, error) {
r := ST_PositiveFixedPercentage{}
if sharedTypes.ST_PercentagePatternRe.MatchString(s) {
r.ST_PositiveFixedPercentage = &ST_Percentage{}
r.ST_PositiveFixedPercentage.ST_Percentage = &s
} else {
v, err := strconv.ParseInt(s, 10, 64)
if err != nil {
return r, fmt.Errorf("parsing %s as int", err)
}
v32 := int32(v)
r.ST_PositiveFixedPercentageDecimal = &v32
}
return r, nil
}
func ParseUnionST_FixedPercentage(s string) (ST_FixedPercentage, error) {
r := ST_FixedPercentage{}
if sharedTypes.ST_FixedPercentagePatternRe.MatchString(s) {
r.ST_FixedPercentage = &ST_Percentage{}
r.ST_FixedPercentage.ST_Percentage = &s
} else {
v, err := strconv.ParseInt(s, 10, 64)
if err != nil {
return r, fmt.Errorf("parsing %s as int", err)
}
v32 := int32(v)
r.ST_FixedPercentageDecimal = &v32
}
return r, nil
}
func ParseUnionST_Coordinate(s string) (ST_Coordinate, error) {
r := ST_Coordinate{}
if sharedTypes.ST_UniversalMeasurePatternRe.MatchString(s) {
r.ST_UniversalMeasure = &s
} else {
v, err := strconv.ParseInt(s, 10, 64)
if err != nil {
return r, fmt.Errorf("parsing %s as int", err)
}
r.ST_CoordinateUnqualified = &v
}
return r, nil
}
func ParseUnionST_Coordinate32(s string) (ST_Coordinate32, error) {
r := ST_Coordinate32{}
if sharedTypes.ST_UniversalMeasurePatternRe.MatchString(s) {
r.ST_UniversalMeasure = &s
} else {
v, err := strconv.ParseInt(s, 10, 32)
if err != nil {
return r, fmt.Errorf("parsing %s as int", err)
}
v32 := int32(v)
r.ST_Coordinate32Unqualified = &v32
}
return r, nil
}
func ParseUnionST_AdjCoordinate(s string) (ST_AdjCoordinate, error) {
r := ST_AdjCoordinate{}
if sharedTypes.ST_UniversalMeasurePatternRe.MatchString(s) {
r.ST_Coordinate = &ST_Coordinate{}
r.ST_Coordinate.ST_UniversalMeasure = &s
} else {
v, err := strconv.ParseInt(s, 10, 64)
if err != nil {
// geom guide name can be anything
r.ST_GeomGuideName = &s
} else {
r.ST_Coordinate.ST_CoordinateUnqualified = &v
}
}
return r, nil
}
func ParseUnionST_AdjAngle(s string) (ST_AdjAngle, error) {
r := ST_AdjAngle{}
v, err := strconv.ParseInt(s, 10, 64)
if err != nil {
// geom guide name can be anything
r.ST_GeomGuideName = &s
} else {
v32 := int32(v)
r.ST_Angle = &v32
}
return r, nil
}
func ParseUnionST_OnOff(s string) (sharedTypes.ST_OnOff, error) {
return sharedTypes.ST_OnOff{}, nil
}
func ParseUnionST_TextPoint(s string) (ST_TextPoint, error) {
r := ST_TextPoint{}
if sharedTypes.ST_UniversalMeasurePatternRe.MatchString(s) {
r.ST_UniversalMeasure = &s
} else {
v, err := strconv.ParseInt(s, 10, 32)
if err != nil {
return r, fmt.Errorf("parsing %s as int", err)
}
v32 := int32(v)
r.ST_TextPointUnqualified = &v32
}
return r, nil
}
func ParseUnionST_AnimationDgmBuildType(s string) (ST_AnimationDgmBuildType, error) {
r := ST_AnimationDgmBuildType{}
switch s {
case "allAtOnce":
r.ST_AnimationBuildType = ST_AnimationBuildTypeAllAtOnce
case "one":
r.ST_AnimationDgmOnlyBuildType = ST_AnimationDgmOnlyBuildTypeOne
case "lvlOne":
r.ST_AnimationDgmOnlyBuildType = ST_AnimationDgmOnlyBuildTypeLvlOne
case "lvlAtOnce":
r.ST_AnimationDgmOnlyBuildType = ST_AnimationDgmOnlyBuildTypeLvlAtOnce
}
return r, nil
}
func ParseUnionST_AnimationChartBuildType(s string) (ST_AnimationChartBuildType, error) {
r := ST_AnimationChartBuildType{}
switch s {
case "allAtOnce":
r.ST_AnimationBuildType = ST_AnimationBuildTypeAllAtOnce
case "series":
r.ST_AnimationChartOnlyBuildType = ST_AnimationChartOnlyBuildTypeSeries
case "category":
r.ST_AnimationChartOnlyBuildType = ST_AnimationChartOnlyBuildTypeCategory
case "seriesEl":
r.ST_AnimationChartOnlyBuildType = ST_AnimationChartOnlyBuildTypeSeriesEl
case "categoryEl":
r.ST_AnimationChartOnlyBuildType = ST_AnimationChartOnlyBuildTypeCategoryEl
}
return r, nil
}
func ParseUnionST_TextSpacingPercentOrPercentString(s string) (ST_TextSpacingPercentOrPercentString, error) {
r := ST_TextSpacingPercentOrPercentString{}
if sharedTypes.ST_PercentagePatternRe.MatchString(s) {
r.ST_Percentage = &s
} else {
v, err := strconv.ParseInt(s, 10, 64)
if err != nil {
return r, fmt.Errorf("parsing %s as int", err)
}
v32 := int32(v)
r.ST_TextSpacingPercent = &v32
}
return r, nil
}
func ParseUnionST_TextFontScalePercentOrPercentString(s string) (ST_TextFontScalePercentOrPercentString, error) {
r := ST_TextFontScalePercentOrPercentString{}
if sharedTypes.ST_PercentagePatternRe.MatchString(s) {
r.ST_Percentage = &s
} else {
v, err := strconv.ParseInt(s, 10, 64)
if err != nil {
return r, fmt.Errorf("parsing %s as int", err)
}
v32 := int32(v)
r.ST_TextFontScalePercent = &v32
}
return r, nil
}
func ParseStdlibTime(s string) (time.Time, error) {
// TODO: implement this
return time.Time{}, nil
}
type Any interface {
MarshalXML(e *xml.Encoder, start xml.StartElement) error
UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
}
func b2i(b bool) uint8 {
if b {
return 1
}
return 0
}
type ST_FontCollectionIndex byte
const (
ST_FontCollectionIndexUnset ST_FontCollectionIndex = 0
ST_FontCollectionIndexMajor ST_FontCollectionIndex = 1
ST_FontCollectionIndexMinor ST_FontCollectionIndex = 2
ST_FontCollectionIndexNone ST_FontCollectionIndex = 3
)
func (e ST_FontCollectionIndex) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {
attr := xml.Attr{}
attr.Name = name
switch e {
case ST_FontCollectionIndexUnset:
attr.Value = ""
case ST_FontCollectionIndexMajor:
attr.Value = "major"
case ST_FontCollectionIndexMinor:
attr.Value = "minor"
case ST_FontCollectionIndexNone:
attr.Value = "none"
}
return attr, nil
}
func (e *ST_FontCollectionIndex) UnmarshalXMLAttr(attr xml.Attr) error {
switch attr.Value {
case "":
*e = 0
case "major":
*e = 1
case "minor":
*e = 2
case "none":
*e = 3
}
return nil
}
func (m ST_FontCollectionIndex) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
return e.EncodeElement(m.String(), start)
}
func (m *ST_FontCollectionIndex) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
tok, err := d.Token()
if err != nil {
return err
}
if el, ok := tok.(xml.EndElement); ok && el.Name == start.Name {
*m = 1
return nil
}
if cd, ok := tok.(xml.CharData); !ok {
return fmt.Errorf("expected char data, got %T", tok)
} else {
switch string(cd) {
case "":
*m = 0
case "major":
*m = 1
case "minor":
*m = 2
case "none":
*m = 3
}
}
tok, err = d.Token()
if err != nil {
return err
}
if el, ok := tok.(xml.EndElement); ok && el.Name == start.Name {
return nil
}
return fmt.Errorf("expected end element, got %v", tok)
}
func (m ST_FontCollectionIndex) String() string {
switch m {
case 0:
return ""
case 1:
return "major"
case 2:
return "minor"
case 3:
return "none"
}
return ""
}
func (m ST_FontCollectionIndex) Validate() error {
return m.ValidateWithPath("")
}
func (m ST_FontCollectionIndex) ValidateWithPath(path string) error {
switch m {
case 0, 1, 2, 3:
default:
return fmt.Errorf("%s: out of range value %d", path, int(m))
}
return nil
}
type ST_ColorSchemeIndex byte
const (
ST_ColorSchemeIndexUnset ST_ColorSchemeIndex = 0
ST_ColorSchemeIndexDk1 ST_ColorSchemeIndex = 1
ST_ColorSchemeIndexLt1 ST_ColorSchemeIndex = 2
ST_ColorSchemeIndexDk2 ST_ColorSchemeIndex = 3
ST_ColorSchemeIndexLt2 ST_ColorSchemeIndex = 4
ST_ColorSchemeIndexAccent1 ST_ColorSchemeIndex = 5
ST_ColorSchemeIndexAccent2 ST_ColorSchemeIndex = 6
ST_ColorSchemeIndexAccent3 ST_ColorSchemeIndex = 7
ST_ColorSchemeIndexAccent4 ST_ColorSchemeIndex = 8
ST_ColorSchemeIndexAccent5 ST_ColorSchemeIndex = 9
ST_ColorSchemeIndexAccent6 ST_ColorSchemeIndex = 10
ST_ColorSchemeIndexHlink ST_ColorSchemeIndex = 11
ST_ColorSchemeIndexFolHlink ST_ColorSchemeIndex = 12
)
func (e ST_ColorSchemeIndex) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {
attr := xml.Attr{}
attr.Name = name
switch e {
case ST_ColorSchemeIndexUnset:
attr.Value = ""
case ST_ColorSchemeIndexDk1:
attr.Value = "dk1"
case ST_ColorSchemeIndexLt1:
attr.Value = "lt1"
case ST_ColorSchemeIndexDk2:
attr.Value = "dk2"
case ST_ColorSchemeIndexLt2:
attr.Value = "lt2"
case ST_ColorSchemeIndexAccent1:
attr.Value = "accent1"
case ST_ColorSchemeIndexAccent2:
attr.Value = "accent2"
case ST_ColorSchemeIndexAccent3:
attr.Value = "accent3"
case ST_ColorSchemeIndexAccent4:
attr.Value = "accent4"
case ST_ColorSchemeIndexAccent5:
attr.Value = "accent5"
case ST_ColorSchemeIndexAccent6:
attr.Value = "accent6"
case ST_ColorSchemeIndexHlink:
attr.Value = "hlink"
case ST_ColorSchemeIndexFolHlink:
attr.Value = "folHlink"
}
return attr, nil
}
func (e *ST_ColorSchemeIndex) UnmarshalXMLAttr(attr xml.Attr) error {
switch attr.Value {
case "":
*e = 0
case "dk1":
*e = 1
case "lt1":
*e = 2
case "dk2":
*e = 3
case "lt2":
*e = 4
case "accent1":
*e = 5
case "accent2":
*e = 6
case "accent3":
*e = 7
case "accent4":
*e = 8
case "accent5":
*e = 9
case "accent6":
*e = 10
case "hlink":
*e = 11
case "folHlink":
*e = 12
}
return nil
}
func (m ST_ColorSchemeIndex) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
return e.EncodeElement(m.String(), start)
}
func (m *ST_ColorSchemeIndex) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
tok, err := d.Token()
if err != nil {
return err
}
if el, ok := tok.(xml.EndElement); ok && el.Name == start.Name {
*m = 1
return nil
}
if cd, ok := tok.(xml.CharData); !ok {
return fmt.Errorf("expected char data, got %T", tok)
} else {
switch string(cd) {
case "":
*m = 0
case "dk1":
*m = 1
case "lt1":
*m = 2
case "dk2":
*m = 3
case "lt2":
*m = 4
case "accent1":
*m = 5
case "accent2":
*m = 6
case "accent3":
*m = 7
case "accent4":
*m = 8
case "accent5":
*m = 9
case "accent6":
*m = 10
case "hlink":
*m = 11
case "folHlink":
*m = 12
}
}
tok, err = d.Token()
if err != nil {
return err
}
if el, ok := tok.(xml.EndElement); ok && el.Name == start.Name {
return nil
}
return fmt.Errorf("expected end element, got %v", tok)
}
func (m ST_ColorSchemeIndex) String() string {
switch m {
case 0:
return ""
case 1:
return "dk1"
case 2:
return "lt1"
case 3:
return "dk2"
case 4:
return "lt2"
case 5:
return "accent1"
case 6:
return "accent2"
case 7:
return "accent3"
case 8:
return "accent4"
case 9:
return "accent5"
case 10:
return "accent6"
case 11:
return "hlink"
case 12:
return "folHlink"
}
return ""
}
func (m ST_ColorSchemeIndex) Validate() error {
return m.ValidateWithPath("")
}
func (m ST_ColorSchemeIndex) ValidateWithPath(path string) error {
switch m {
case 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12:
default:
return fmt.Errorf("%s: out of range value %d", path, int(m))
}
return nil
}
type ST_SystemColorVal byte
const (
ST_SystemColorValUnset ST_SystemColorVal = 0
ST_SystemColorValScrollBar ST_SystemColorVal = 1
ST_SystemColorValBackground ST_SystemColorVal = 2
ST_SystemColorValActiveCaption ST_SystemColorVal = 3
ST_SystemColorValInactiveCaption ST_SystemColorVal = 4
ST_SystemColorValMenu ST_SystemColorVal = 5
ST_SystemColorValWindow ST_SystemColorVal = 6
ST_SystemColorValWindowFrame ST_SystemColorVal = 7
ST_SystemColorValMenuText ST_SystemColorVal = 8
ST_SystemColorValWindowText ST_SystemColorVal = 9
ST_SystemColorValCaptionText ST_SystemColorVal = 10
ST_SystemColorValActiveBorder ST_SystemColorVal = 11
ST_SystemColorValInactiveBorder ST_SystemColorVal = 12
ST_SystemColorValAppWorkspace ST_SystemColorVal = 13
ST_SystemColorValHighlight ST_SystemColorVal = 14
ST_SystemColorValHighlightText ST_SystemColorVal = 15
ST_SystemColorValBtnFace ST_SystemColorVal = 16
ST_SystemColorValBtnShadow ST_SystemColorVal = 17
ST_SystemColorValGrayText ST_SystemColorVal = 18
ST_SystemColorValBtnText ST_SystemColorVal = 19
ST_SystemColorValInactiveCaptionText ST_SystemColorVal = 20
ST_SystemColorValBtnHighlight ST_SystemColorVal = 21
ST_SystemColorVal3dDkShadow ST_SystemColorVal = 22
ST_SystemColorVal3dLight ST_SystemColorVal = 23
ST_SystemColorValInfoText ST_SystemColorVal = 24
ST_SystemColorValInfoBk ST_SystemColorVal = 25
ST_SystemColorValHotLight ST_SystemColorVal = 26
ST_SystemColorValGradientActiveCaption ST_SystemColorVal = 27
ST_SystemColorValGradientInactiveCaption ST_SystemColorVal = 28
ST_SystemColorValMenuHighlight ST_SystemColorVal = 29
ST_SystemColorValMenuBar ST_SystemColorVal = 30
)
func (e ST_SystemColorVal) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {
attr := xml.Attr{}
attr.Name = name
switch e {
case ST_SystemColorValUnset:
attr.Value = ""
case ST_SystemColorValScrollBar:
attr.Value = "scrollBar"
case ST_SystemColorValBackground:
attr.Value = "background"
case ST_SystemColorValActiveCaption:
attr.Value = "activeCaption"
case ST_SystemColorValInactiveCaption:
attr.Value = "inactiveCaption"
case ST_SystemColorValMenu:
attr.Value = "menu"
case ST_SystemColorValWindow:
attr.Value = "window"
case ST_SystemColorValWindowFrame:
attr.Value = "windowFrame"
case ST_SystemColorValMenuText:
attr.Value = "menuText"
case ST_SystemColorValWindowText:
attr.Value = "windowText"
case ST_SystemColorValCaptionText:
attr.Value = "captionText"
case ST_SystemColorValActiveBorder:
attr.Value = "activeBorder"
case ST_SystemColorValInactiveBorder:
attr.Value = "inactiveBorder"
case ST_SystemColorValAppWorkspace:
attr.Value = "appWorkspace"
case ST_SystemColorValHighlight:
attr.Value = "highlight"
case ST_SystemColorValHighlightText:
attr.Value = "highlightText"
case ST_SystemColorValBtnFace:
attr.Value = "btnFace"
case ST_SystemColorValBtnShadow:
attr.Value = "btnShadow"
case ST_SystemColorValGrayText:
attr.Value = "grayText"
case ST_SystemColorValBtnText:
attr.Value = "btnText"
case ST_SystemColorValInactiveCaptionText:
attr.Value = "inactiveCaptionText"
case ST_SystemColorValBtnHighlight:
attr.Value = "btnHighlight"
case ST_SystemColorVal3dDkShadow:
attr.Value = "3dDkShadow"
case ST_SystemColorVal3dLight:
attr.Value = "3dLight"
case ST_SystemColorValInfoText:
attr.Value = "infoText"
case ST_SystemColorValInfoBk:
attr.Value = "infoBk"
case ST_SystemColorValHotLight:
attr.Value = "hotLight"
case ST_SystemColorValGradientActiveCaption:
attr.Value = "gradientActiveCaption"
case ST_SystemColorValGradientInactiveCaption:
attr.Value = "gradientInactiveCaption"
case ST_SystemColorValMenuHighlight:
attr.Value = "menuHighlight"
case ST_SystemColorValMenuBar:
attr.Value = "menuBar"
}
return attr, nil
}
func (e *ST_SystemColorVal) UnmarshalXMLAttr(attr xml.Attr) error {
switch attr.Value {
case "":
*e = 0
case "scrollBar":
*e = 1
case "background":
*e = 2
case "activeCaption":
*e = 3
case "inactiveCaption":
*e = 4
case "menu":
*e = 5
case "window":
*e = 6
case "windowFrame":
*e = 7
case "menuText":
*e = 8
case "windowText":
*e = 9
case "captionText":
*e = 10
case "activeBorder":
*e = 11
case "inactiveBorder":
*e = 12
case "appWorkspace":
*e = 13
case "highlight":
*e = 14
case "highlightText":
*e = 15
case "btnFace":
*e = 16
case "btnShadow":
*e = 17
case "grayText":
*e = 18
case "btnText":
*e = 19
case "inactiveCaptionText":
*e = 20
case "btnHighlight":
*e = 21
case "3dDkShadow":
*e = 22
case "3dLight":
*e = 23
case "infoText":
*e = 24
case "infoBk":
*e = 25
case "hotLight":
*e = 26
case "gradientActiveCaption":
*e = 27
case "gradientInactiveCaption":
*e = 28
case "menuHighlight":
*e = 29
case "menuBar":
*e = 30
}
return nil
}
func (m ST_SystemColorVal) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
return e.EncodeElement(m.String(), start)
}
func (m *ST_SystemColorVal) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
tok, err := d.Token()
if err != nil {
return err
}
if el, ok := tok.(xml.EndElement); ok && el.Name == start.Name {
*m = 1
return nil
}
if cd, ok := tok.(xml.CharData); !ok {
return fmt.Errorf("expected char data, got %T", tok)
} else {
switch string(cd) {
case "":
*m = 0
case "scrollBar":
*m = 1
case "background":
*m = 2
case "activeCaption":
*m = 3
case "inactiveCaption":
*m = 4
case "menu":
*m = 5
case "window":
*m = 6
case "windowFrame":
*m = 7
case "menuText":
*m = 8
case "windowText":
*m = 9
case "captionText":
*m = 10
case "activeBorder":
*m = 11
case "inactiveBorder":
*m = 12
case "appWorkspace":
*m = 13
case "highlight":
*m = 14
case "highlightText":
*m = 15
case "btnFace":
*m = 16
case "btnShadow":
*m = 17
case "grayText":
*m = 18
case "btnText":
*m = 19
case "inactiveCaptionText":
*m = 20
case "btnHighlight":
*m = 21
case "3dDkShadow":
*m = 22
case "3dLight":
*m = 23
case "infoText":
*m = 24
case "infoBk":
*m = 25
case "hotLight":
*m = 26
case "gradientActiveCaption":
*m = 27
case "gradientInactiveCaption":
*m = 28
case "menuHighlight":
*m = 29
case "menuBar":
*m = 30
}
}
tok, err = d.Token()
if err != nil {
return err
}
if el, ok := tok.(xml.EndElement); ok && el.Name == start.Name {
return nil
}
return fmt.Errorf("expected end element, got %v", tok)
}
func (m ST_SystemColorVal) String() string {
switch m {
case 0:
return ""
case 1:
return "scrollBar"
case 2:
return "background"
case 3:
return "activeCaption"
case 4:
return "inactiveCaption"
case 5:
return "menu"
case 6:
return "window"
case 7:
return "windowFrame"
case 8:
return "menuText"
case 9:
return "windowText"
case 10:
return "captionText"
case 11:
return "activeBorder"
case 12:
return "inactiveBorder"
case 13:
return "appWorkspace"
case 14:
return "highlight"
case 15:
return "highlightText"
case 16:
return "btnFace"
case 17:
return "btnShadow"
case 18:
return "grayText"
case 19:
return "btnText"
case 20:
return "inactiveCaptionText"
case 21:
return "btnHighlight"
case 22:
return "3dDkShadow"
case 23:
return "3dLight"
case 24:
return "infoText"
case 25:
return "infoBk"
case 26:
return "hotLight"
case 27:
return "gradientActiveCaption"
case 28:
return "gradientInactiveCaption"
case 29:
return "menuHighlight"
case 30:
return "menuBar"
}
return ""
}
func (m ST_SystemColorVal) Validate() error {
return m.ValidateWithPath("")
}
func (m ST_SystemColorVal) ValidateWithPath(path string) error {
switch m {
case 0, 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:
default:
return fmt.Errorf("%s: out of range value %d", path, int(m))
}
return nil
}
type ST_SchemeColorVal byte
const (
ST_SchemeColorValUnset ST_SchemeColorVal = 0
ST_SchemeColorValBg1 ST_SchemeColorVal = 1
ST_SchemeColorValTx1 ST_SchemeColorVal = 2
ST_SchemeColorValBg2 ST_SchemeColorVal = 3
ST_SchemeColorValTx2 ST_SchemeColorVal = 4
ST_SchemeColorValAccent1 ST_SchemeColorVal = 5
ST_SchemeColorValAccent2 ST_SchemeColorVal = 6
ST_SchemeColorValAccent3 ST_SchemeColorVal = 7
ST_SchemeColorValAccent4 ST_SchemeColorVal = 8
ST_SchemeColorValAccent5 ST_SchemeColorVal = 9
ST_SchemeColorValAccent6 ST_SchemeColorVal = 10
ST_SchemeColorValHlink ST_SchemeColorVal = 11
ST_SchemeColorValFolHlink ST_SchemeColorVal = 12
ST_SchemeColorValPhClr ST_SchemeColorVal = 13
ST_SchemeColorValDk1 ST_SchemeColorVal = 14
ST_SchemeColorValLt1 ST_SchemeColorVal = 15
ST_SchemeColorValDk2 ST_SchemeColorVal = 16
ST_SchemeColorValLt2 ST_SchemeColorVal = 17
)
func (e ST_SchemeColorVal) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {
attr := xml.Attr{}
attr.Name = name
switch e {
case ST_SchemeColorValUnset:
attr.Value = ""
case ST_SchemeColorValBg1:
attr.Value = "bg1"
case ST_SchemeColorValTx1:
attr.Value = "tx1"
case ST_SchemeColorValBg2:
attr.Value = "bg2"
case ST_SchemeColorValTx2:
attr.Value = "tx2"
case ST_SchemeColorValAccent1:
attr.Value = "accent1"
case ST_SchemeColorValAccent2:
attr.Value = "accent2"
case ST_SchemeColorValAccent3:
attr.Value = "accent3"
case ST_SchemeColorValAccent4:
attr.Value = "accent4"
case ST_SchemeColorValAccent5:
attr.Value = "accent5"
case ST_SchemeColorValAccent6:
attr.Value = "accent6"
case ST_SchemeColorValHlink:
attr.Value = "hlink"
case ST_SchemeColorValFolHlink:
attr.Value = "folHlink"
case ST_SchemeColorValPhClr:
attr.Value = "phClr"
case ST_SchemeColorValDk1:
attr.Value = "dk1"
case ST_SchemeColorValLt1:
attr.Value = "lt1"
case ST_SchemeColorValDk2:
attr.Value = "dk2"
case ST_SchemeColorValLt2:
attr.Value = "lt2"
}
return attr, nil
}
func (e *ST_SchemeColorVal) UnmarshalXMLAttr(attr xml.Attr) error {
switch attr.Value {
case "":
*e = 0
case "bg1":
*e = 1
case "tx1":
*e = 2
case "bg2":
*e = 3
case "tx2":
*e = 4
case "accent1":
*e = 5
case "accent2":
*e = 6
case "accent3":
*e = 7
case "accent4":
*e = 8
case "accent5":
*e = 9
case "accent6":
*e = 10
case "hlink":
*e = 11
case "folHlink":
*e = 12
case "phClr":
*e = 13
case "dk1":
*e = 14
case "lt1":
*e = 15
case "dk2":
*e = 16
case "lt2":
*e = 17
}
return nil
}
func (m ST_SchemeColorVal) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
return e.EncodeElement(m.String(), start)
}
func (m *ST_SchemeColorVal) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
tok, err := d.Token()
if err != nil {
return err
}
if el, ok := tok.(xml.EndElement); ok && el.Name == start.Name {
*m = 1
return nil
}
if cd, ok := tok.(xml.CharData); !ok {