forked from unidoc/unioffice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OfcCT_Callout.go
258 lines (249 loc) · 6.9 KB
/
OfcCT_Callout.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
// 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 vml
import (
"encoding/xml"
"fmt"
"baliance.com/gooxml/schema/soo/ofc/sharedTypes"
)
type OfcCT_Callout struct {
OnAttr sharedTypes.ST_TrueFalse
TypeAttr *string
GapAttr *string
AngleAttr OfcST_Angle
DropautoAttr sharedTypes.ST_TrueFalse
DropAttr *string
DistanceAttr *string
LengthspecifiedAttr sharedTypes.ST_TrueFalse
LengthAttr *string
AccentbarAttr sharedTypes.ST_TrueFalse
TextborderAttr sharedTypes.ST_TrueFalse
MinusxAttr sharedTypes.ST_TrueFalse
MinusyAttr sharedTypes.ST_TrueFalse
ExtAttr ST_Ext
}
func NewOfcCT_Callout() *OfcCT_Callout {
ret := &OfcCT_Callout{}
return ret
}
func (m *OfcCT_Callout) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if m.OnAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.OnAttr.MarshalXMLAttr(xml.Name{Local: "on"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.TypeAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "type"},
Value: fmt.Sprintf("%v", *m.TypeAttr)})
}
if m.GapAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "gap"},
Value: fmt.Sprintf("%v", *m.GapAttr)})
}
if m.AngleAttr != OfcST_AngleUnset {
attr, err := m.AngleAttr.MarshalXMLAttr(xml.Name{Local: "angle"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.DropautoAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.DropautoAttr.MarshalXMLAttr(xml.Name{Local: "dropauto"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.DropAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "drop"},
Value: fmt.Sprintf("%v", *m.DropAttr)})
}
if m.DistanceAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "distance"},
Value: fmt.Sprintf("%v", *m.DistanceAttr)})
}
if m.LengthspecifiedAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.LengthspecifiedAttr.MarshalXMLAttr(xml.Name{Local: "lengthspecified"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.LengthAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "length"},
Value: fmt.Sprintf("%v", *m.LengthAttr)})
}
if m.AccentbarAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.AccentbarAttr.MarshalXMLAttr(xml.Name{Local: "accentbar"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.TextborderAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.TextborderAttr.MarshalXMLAttr(xml.Name{Local: "textborder"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.MinusxAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.MinusxAttr.MarshalXMLAttr(xml.Name{Local: "minusx"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.MinusyAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.MinusyAttr.MarshalXMLAttr(xml.Name{Local: "minusy"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.ExtAttr != ST_ExtUnset {
attr, err := m.ExtAttr.MarshalXMLAttr(xml.Name{Local: "ext"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
e.EncodeToken(start)
e.EncodeToken(xml.EndElement{Name: start.Name})
return nil
}
func (m *OfcCT_Callout) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
for _, attr := range start.Attr {
if attr.Name.Local == "lengthspecified" {
m.LengthspecifiedAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "on" {
m.OnAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "gap" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.GapAttr = &parsed
continue
}
if attr.Name.Local == "angle" {
m.AngleAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "dropauto" {
m.DropautoAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "drop" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.DropAttr = &parsed
continue
}
if attr.Name.Local == "distance" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.DistanceAttr = &parsed
continue
}
if attr.Name.Local == "type" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.TypeAttr = &parsed
continue
}
if attr.Name.Local == "length" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.LengthAttr = &parsed
continue
}
if attr.Name.Local == "accentbar" {
m.AccentbarAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "textborder" {
m.TextborderAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "minusx" {
m.MinusxAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "minusy" {
m.MinusyAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "ext" {
m.ExtAttr.UnmarshalXMLAttr(attr)
continue
}
}
// skip any extensions we may find, but don't support
for {
tok, err := d.Token()
if err != nil {
return fmt.Errorf("parsing OfcCT_Callout: %s", err)
}
if el, ok := tok.(xml.EndElement); ok && el.Name == start.Name {
break
}
}
return nil
}
// Validate validates the OfcCT_Callout and its children
func (m *OfcCT_Callout) Validate() error {
return m.ValidateWithPath("OfcCT_Callout")
}
// ValidateWithPath validates the OfcCT_Callout and its children, prefixing error messages with path
func (m *OfcCT_Callout) ValidateWithPath(path string) error {
if err := m.OnAttr.ValidateWithPath(path + "/OnAttr"); err != nil {
return err
}
if err := m.AngleAttr.ValidateWithPath(path + "/AngleAttr"); err != nil {
return err
}
if err := m.DropautoAttr.ValidateWithPath(path + "/DropautoAttr"); err != nil {
return err
}
if err := m.LengthspecifiedAttr.ValidateWithPath(path + "/LengthspecifiedAttr"); err != nil {
return err
}
if err := m.AccentbarAttr.ValidateWithPath(path + "/AccentbarAttr"); err != nil {
return err
}
if err := m.TextborderAttr.ValidateWithPath(path + "/TextborderAttr"); err != nil {
return err
}
if err := m.MinusxAttr.ValidateWithPath(path + "/MinusxAttr"); err != nil {
return err
}
if err := m.MinusyAttr.ValidateWithPath(path + "/MinusyAttr"); err != nil {
return err
}
if err := m.ExtAttr.ValidateWithPath(path + "/ExtAttr"); err != nil {
return err
}
return nil
}