forked from zxzgl/unioffice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OfcCT_Lock.go
238 lines (229 loc) · 6.63 KB
/
OfcCT_Lock.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
// 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_Lock struct {
PositionAttr sharedTypes.ST_TrueFalse
SelectionAttr sharedTypes.ST_TrueFalse
GroupingAttr sharedTypes.ST_TrueFalse
UngroupingAttr sharedTypes.ST_TrueFalse
RotationAttr sharedTypes.ST_TrueFalse
CroppingAttr sharedTypes.ST_TrueFalse
VerticiesAttr sharedTypes.ST_TrueFalse
AdjusthandlesAttr sharedTypes.ST_TrueFalse
TextAttr sharedTypes.ST_TrueFalse
AspectratioAttr sharedTypes.ST_TrueFalse
ShapetypeAttr sharedTypes.ST_TrueFalse
ExtAttr ST_Ext
}
func NewOfcCT_Lock() *OfcCT_Lock {
ret := &OfcCT_Lock{}
return ret
}
func (m *OfcCT_Lock) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if m.PositionAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.PositionAttr.MarshalXMLAttr(xml.Name{Local: "position"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.SelectionAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.SelectionAttr.MarshalXMLAttr(xml.Name{Local: "selection"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.GroupingAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.GroupingAttr.MarshalXMLAttr(xml.Name{Local: "grouping"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.UngroupingAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.UngroupingAttr.MarshalXMLAttr(xml.Name{Local: "ungrouping"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.RotationAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.RotationAttr.MarshalXMLAttr(xml.Name{Local: "rotation"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.CroppingAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.CroppingAttr.MarshalXMLAttr(xml.Name{Local: "cropping"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.VerticiesAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.VerticiesAttr.MarshalXMLAttr(xml.Name{Local: "verticies"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.AdjusthandlesAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.AdjusthandlesAttr.MarshalXMLAttr(xml.Name{Local: "adjusthandles"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.TextAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.TextAttr.MarshalXMLAttr(xml.Name{Local: "text"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.AspectratioAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.AspectratioAttr.MarshalXMLAttr(xml.Name{Local: "aspectratio"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.ShapetypeAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.ShapetypeAttr.MarshalXMLAttr(xml.Name{Local: "shapetype"})
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_Lock) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
for _, attr := range start.Attr {
if attr.Name.Local == "position" {
m.PositionAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "selection" {
m.SelectionAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "grouping" {
m.GroupingAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "ungrouping" {
m.UngroupingAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "rotation" {
m.RotationAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "cropping" {
m.CroppingAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "verticies" {
m.VerticiesAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "adjusthandles" {
m.AdjusthandlesAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "text" {
m.TextAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "aspectratio" {
m.AspectratioAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "shapetype" {
m.ShapetypeAttr.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_Lock: %s", err)
}
if el, ok := tok.(xml.EndElement); ok && el.Name == start.Name {
break
}
}
return nil
}
// Validate validates the OfcCT_Lock and its children
func (m *OfcCT_Lock) Validate() error {
return m.ValidateWithPath("OfcCT_Lock")
}
// ValidateWithPath validates the OfcCT_Lock and its children, prefixing error messages with path
func (m *OfcCT_Lock) ValidateWithPath(path string) error {
if err := m.PositionAttr.ValidateWithPath(path + "/PositionAttr"); err != nil {
return err
}
if err := m.SelectionAttr.ValidateWithPath(path + "/SelectionAttr"); err != nil {
return err
}
if err := m.GroupingAttr.ValidateWithPath(path + "/GroupingAttr"); err != nil {
return err
}
if err := m.UngroupingAttr.ValidateWithPath(path + "/UngroupingAttr"); err != nil {
return err
}
if err := m.RotationAttr.ValidateWithPath(path + "/RotationAttr"); err != nil {
return err
}
if err := m.CroppingAttr.ValidateWithPath(path + "/CroppingAttr"); err != nil {
return err
}
if err := m.VerticiesAttr.ValidateWithPath(path + "/VerticiesAttr"); err != nil {
return err
}
if err := m.AdjusthandlesAttr.ValidateWithPath(path + "/AdjusthandlesAttr"); err != nil {
return err
}
if err := m.TextAttr.ValidateWithPath(path + "/TextAttr"); err != nil {
return err
}
if err := m.AspectratioAttr.ValidateWithPath(path + "/AspectratioAttr"); err != nil {
return err
}
if err := m.ShapetypeAttr.ValidateWithPath(path + "/ShapetypeAttr"); err != nil {
return err
}
if err := m.ExtAttr.ValidateWithPath(path + "/ExtAttr"); err != nil {
return err
}
return nil
}