forked from 36150592/unioffice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CT_DrawingHF.go
338 lines (330 loc) · 8.41 KB
/
CT_DrawingHF.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
// 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 sml
import (
"encoding/xml"
"fmt"
"strconv"
)
type CT_DrawingHF struct {
IdAttr string
// Left Header for Odd Pages
LhoAttr *uint32
// Left Header for Even Pages
LheAttr *uint32
// Left Header for First Page
LhfAttr *uint32
// Center Header for Odd Pages
ChoAttr *uint32
// Center Header for Even Pages
CheAttr *uint32
// Center Header for First Page
ChfAttr *uint32
// Right Header for Odd Pages
RhoAttr *uint32
// Right Header for Even Pages
RheAttr *uint32
// Right Header for First Page
RhfAttr *uint32
// Left Footer for Odd Pages
LfoAttr *uint32
// Left Footer for Even Pages
LfeAttr *uint32
// Left Footer for First Page
LffAttr *uint32
// Center Footer for Odd Pages
CfoAttr *uint32
// Center Footer for Even Pages
CfeAttr *uint32
// Center Footer for First Page
CffAttr *uint32
// Right Footer for Odd Pages
RfoAttr *uint32
// Right Footer for Even Pages
RfeAttr *uint32
// Right Footer for First Page
RffAttr *uint32
}
func NewCT_DrawingHF() *CT_DrawingHF {
ret := &CT_DrawingHF{}
return ret
}
func (m *CT_DrawingHF) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "r:id"},
Value: fmt.Sprintf("%v", m.IdAttr)})
if m.LhoAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "lho"},
Value: fmt.Sprintf("%v", *m.LhoAttr)})
}
if m.LheAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "lhe"},
Value: fmt.Sprintf("%v", *m.LheAttr)})
}
if m.LhfAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "lhf"},
Value: fmt.Sprintf("%v", *m.LhfAttr)})
}
if m.ChoAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "cho"},
Value: fmt.Sprintf("%v", *m.ChoAttr)})
}
if m.CheAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "che"},
Value: fmt.Sprintf("%v", *m.CheAttr)})
}
if m.ChfAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "chf"},
Value: fmt.Sprintf("%v", *m.ChfAttr)})
}
if m.RhoAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "rho"},
Value: fmt.Sprintf("%v", *m.RhoAttr)})
}
if m.RheAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "rhe"},
Value: fmt.Sprintf("%v", *m.RheAttr)})
}
if m.RhfAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "rhf"},
Value: fmt.Sprintf("%v", *m.RhfAttr)})
}
if m.LfoAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "lfo"},
Value: fmt.Sprintf("%v", *m.LfoAttr)})
}
if m.LfeAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "lfe"},
Value: fmt.Sprintf("%v", *m.LfeAttr)})
}
if m.LffAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "lff"},
Value: fmt.Sprintf("%v", *m.LffAttr)})
}
if m.CfoAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "cfo"},
Value: fmt.Sprintf("%v", *m.CfoAttr)})
}
if m.CfeAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "cfe"},
Value: fmt.Sprintf("%v", *m.CfeAttr)})
}
if m.CffAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "cff"},
Value: fmt.Sprintf("%v", *m.CffAttr)})
}
if m.RfoAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "rfo"},
Value: fmt.Sprintf("%v", *m.RfoAttr)})
}
if m.RfeAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "rfe"},
Value: fmt.Sprintf("%v", *m.RfeAttr)})
}
if m.RffAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "rff"},
Value: fmt.Sprintf("%v", *m.RffAttr)})
}
e.EncodeToken(start)
e.EncodeToken(xml.EndElement{Name: start.Name})
return nil
}
func (m *CT_DrawingHF) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
for _, attr := range start.Attr {
if attr.Name.Space == "http://schemas.openxmlformats.org/officeDocument/2006/relationships" && attr.Name.Local == "id" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.IdAttr = parsed
continue
}
if attr.Name.Local == "rhf" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
pt := uint32(parsed)
m.RhfAttr = &pt
continue
}
if attr.Name.Local == "lfo" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
pt := uint32(parsed)
m.LfoAttr = &pt
continue
}
if attr.Name.Local == "lfe" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
pt := uint32(parsed)
m.LfeAttr = &pt
continue
}
if attr.Name.Local == "lhf" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
pt := uint32(parsed)
m.LhfAttr = &pt
continue
}
if attr.Name.Local == "lff" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
pt := uint32(parsed)
m.LffAttr = &pt
continue
}
if attr.Name.Local == "che" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
pt := uint32(parsed)
m.CheAttr = &pt
continue
}
if attr.Name.Local == "rho" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
pt := uint32(parsed)
m.RhoAttr = &pt
continue
}
if attr.Name.Local == "rhe" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
pt := uint32(parsed)
m.RheAttr = &pt
continue
}
if attr.Name.Local == "lho" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
pt := uint32(parsed)
m.LhoAttr = &pt
continue
}
if attr.Name.Local == "lhe" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
pt := uint32(parsed)
m.LheAttr = &pt
continue
}
if attr.Name.Local == "cho" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
pt := uint32(parsed)
m.ChoAttr = &pt
continue
}
if attr.Name.Local == "chf" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
pt := uint32(parsed)
m.ChfAttr = &pt
continue
}
if attr.Name.Local == "cfo" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
pt := uint32(parsed)
m.CfoAttr = &pt
continue
}
if attr.Name.Local == "cfe" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
pt := uint32(parsed)
m.CfeAttr = &pt
continue
}
if attr.Name.Local == "cff" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
pt := uint32(parsed)
m.CffAttr = &pt
continue
}
if attr.Name.Local == "rfo" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
pt := uint32(parsed)
m.RfoAttr = &pt
continue
}
if attr.Name.Local == "rfe" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
pt := uint32(parsed)
m.RfeAttr = &pt
continue
}
if attr.Name.Local == "rff" {
parsed, err := strconv.ParseUint(attr.Value, 10, 32)
if err != nil {
return err
}
pt := uint32(parsed)
m.RffAttr = &pt
continue
}
}
// skip any extensions we may find, but don't support
for {
tok, err := d.Token()
if err != nil {
return fmt.Errorf("parsing CT_DrawingHF: %s", err)
}
if el, ok := tok.(xml.EndElement); ok && el.Name == start.Name {
break
}
}
return nil
}
// Validate validates the CT_DrawingHF and its children
func (m *CT_DrawingHF) Validate() error {
return m.ValidateWithPath("CT_DrawingHF")
}
// ValidateWithPath validates the CT_DrawingHF and its children, prefixing error messages with path
func (m *CT_DrawingHF) ValidateWithPath(path string) error {
return nil
}