-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CT_SolidColorFillProperties.go
152 lines (144 loc) · 4.73 KB
/
CT_SolidColorFillProperties.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
package dml
import (
"encoding/xml"
"go.devnw.com/ooxml"
)
type CT_SolidColorFillProperties struct {
ScrgbClr *CT_ScRgbColor
SrgbClr *CT_SRgbColor
HslClr *CT_HslColor
SysClr *CT_SystemColor
SchemeClr *CT_SchemeColor
PrstClr *CT_PresetColor
}
func NewCT_SolidColorFillProperties() *CT_SolidColorFillProperties {
ret := &CT_SolidColorFillProperties{}
return ret
}
func (m *CT_SolidColorFillProperties) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
e.EncodeToken(start)
if m.ScrgbClr != nil {
sescrgbClr := xml.StartElement{Name: xml.Name{Local: "a:scrgbClr"}}
e.EncodeElement(m.ScrgbClr, sescrgbClr)
}
if m.SrgbClr != nil {
sesrgbClr := xml.StartElement{Name: xml.Name{Local: "a:srgbClr"}}
e.EncodeElement(m.SrgbClr, sesrgbClr)
}
if m.HslClr != nil {
sehslClr := xml.StartElement{Name: xml.Name{Local: "a:hslClr"}}
e.EncodeElement(m.HslClr, sehslClr)
}
if m.SysClr != nil {
sesysClr := xml.StartElement{Name: xml.Name{Local: "a:sysClr"}}
e.EncodeElement(m.SysClr, sesysClr)
}
if m.SchemeClr != nil {
seschemeClr := xml.StartElement{Name: xml.Name{Local: "a:schemeClr"}}
e.EncodeElement(m.SchemeClr, seschemeClr)
}
if m.PrstClr != nil {
seprstClr := xml.StartElement{Name: xml.Name{Local: "a:prstClr"}}
e.EncodeElement(m.PrstClr, seprstClr)
}
e.EncodeToken(xml.EndElement{Name: start.Name})
return nil
}
func (m *CT_SolidColorFillProperties) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
lCT_SolidColorFillProperties:
for {
tok, err := d.Token()
if err != nil {
return err
}
switch el := tok.(type) {
case xml.StartElement:
switch el.Name {
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/main", Local: "scrgbClr"},
xml.Name{Space: "http://purl.oclc.org/ooxml/drawingml/main", Local: "scrgbClr"}:
m.ScrgbClr = NewCT_ScRgbColor()
if err := d.DecodeElement(m.ScrgbClr, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/main", Local: "srgbClr"},
xml.Name{Space: "http://purl.oclc.org/ooxml/drawingml/main", Local: "srgbClr"}:
m.SrgbClr = NewCT_SRgbColor()
if err := d.DecodeElement(m.SrgbClr, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/main", Local: "hslClr"},
xml.Name{Space: "http://purl.oclc.org/ooxml/drawingml/main", Local: "hslClr"}:
m.HslClr = NewCT_HslColor()
if err := d.DecodeElement(m.HslClr, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/main", Local: "sysClr"},
xml.Name{Space: "http://purl.oclc.org/ooxml/drawingml/main", Local: "sysClr"}:
m.SysClr = NewCT_SystemColor()
if err := d.DecodeElement(m.SysClr, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/main", Local: "schemeClr"},
xml.Name{Space: "http://purl.oclc.org/ooxml/drawingml/main", Local: "schemeClr"}:
m.SchemeClr = NewCT_SchemeColor()
if err := d.DecodeElement(m.SchemeClr, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/main", Local: "prstClr"},
xml.Name{Space: "http://purl.oclc.org/ooxml/drawingml/main", Local: "prstClr"}:
m.PrstClr = NewCT_PresetColor()
if err := d.DecodeElement(m.PrstClr, &el); err != nil {
return err
}
default:
office.Log("skipping unsupported element on CT_SolidColorFillProperties %v", el.Name)
if err := d.Skip(); err != nil {
return err
}
}
case xml.EndElement:
break lCT_SolidColorFillProperties
case xml.CharData:
}
}
return nil
}
// Validate validates the CT_SolidColorFillProperties and its children
func (m *CT_SolidColorFillProperties) Validate() error {
return m.ValidateWithPath("CT_SolidColorFillProperties")
}
// ValidateWithPath validates the CT_SolidColorFillProperties and its children, prefixing error messages with path
func (m *CT_SolidColorFillProperties) ValidateWithPath(path string) error {
if m.ScrgbClr != nil {
if err := m.ScrgbClr.ValidateWithPath(path + "/ScrgbClr"); err != nil {
return err
}
}
if m.SrgbClr != nil {
if err := m.SrgbClr.ValidateWithPath(path + "/SrgbClr"); err != nil {
return err
}
}
if m.HslClr != nil {
if err := m.HslClr.ValidateWithPath(path + "/HslClr"); err != nil {
return err
}
}
if m.SysClr != nil {
if err := m.SysClr.ValidateWithPath(path + "/SysClr"); err != nil {
return err
}
}
if m.SchemeClr != nil {
if err := m.SchemeClr.ValidateWithPath(path + "/SchemeClr"); err != nil {
return err
}
}
if m.PrstClr != nil {
if err := m.PrstClr.ValidateWithPath(path + "/PrstClr"); err != nil {
return err
}
}
return nil
}