-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CT_RubyPr.go
143 lines (135 loc) · 4.59 KB
/
CT_RubyPr.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
package wml
import (
"encoding/xml"
"go.devnw.com/ooxml"
)
type CT_RubyPr struct {
// Phonetic Guide Text Alignment
RubyAlign *CT_RubyAlign
// Phonetic Guide Text Font Size
Hps *CT_HpsMeasure
// Distance Between Phonetic Guide Text and Phonetic Guide Base Text
HpsRaise *CT_HpsMeasure
// Phonetic Guide Base Text Font Size
HpsBaseText *CT_HpsMeasure
// Language ID for Phonetic Guide
Lid *CT_Lang
// Invalidated Field Cache
Dirty *CT_OnOff
}
func NewCT_RubyPr() *CT_RubyPr {
ret := &CT_RubyPr{}
ret.RubyAlign = NewCT_RubyAlign()
ret.Hps = NewCT_HpsMeasure()
ret.HpsRaise = NewCT_HpsMeasure()
ret.HpsBaseText = NewCT_HpsMeasure()
ret.Lid = NewCT_Lang()
return ret
}
func (m *CT_RubyPr) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
e.EncodeToken(start)
serubyAlign := xml.StartElement{Name: xml.Name{Local: "w:rubyAlign"}}
e.EncodeElement(m.RubyAlign, serubyAlign)
sehps := xml.StartElement{Name: xml.Name{Local: "w:hps"}}
e.EncodeElement(m.Hps, sehps)
sehpsRaise := xml.StartElement{Name: xml.Name{Local: "w:hpsRaise"}}
e.EncodeElement(m.HpsRaise, sehpsRaise)
sehpsBaseText := xml.StartElement{Name: xml.Name{Local: "w:hpsBaseText"}}
e.EncodeElement(m.HpsBaseText, sehpsBaseText)
selid := xml.StartElement{Name: xml.Name{Local: "w:lid"}}
e.EncodeElement(m.Lid, selid)
if m.Dirty != nil {
sedirty := xml.StartElement{Name: xml.Name{Local: "w:dirty"}}
e.EncodeElement(m.Dirty, sedirty)
}
e.EncodeToken(xml.EndElement{Name: start.Name})
return nil
}
func (m *CT_RubyPr) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
m.RubyAlign = NewCT_RubyAlign()
m.Hps = NewCT_HpsMeasure()
m.HpsRaise = NewCT_HpsMeasure()
m.HpsBaseText = NewCT_HpsMeasure()
m.Lid = NewCT_Lang()
lCT_RubyPr:
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/wordprocessingml/2006/main", Local: "rubyAlign"},
xml.Name{Space: "http://purl.oclc.org/ooxml/wordprocessingml/main", Local: "rubyAlign"}:
if err := d.DecodeElement(m.RubyAlign, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "hps"},
xml.Name{Space: "http://purl.oclc.org/ooxml/wordprocessingml/main", Local: "hps"}:
if err := d.DecodeElement(m.Hps, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "hpsRaise"},
xml.Name{Space: "http://purl.oclc.org/ooxml/wordprocessingml/main", Local: "hpsRaise"}:
if err := d.DecodeElement(m.HpsRaise, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "hpsBaseText"},
xml.Name{Space: "http://purl.oclc.org/ooxml/wordprocessingml/main", Local: "hpsBaseText"}:
if err := d.DecodeElement(m.HpsBaseText, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "lid"},
xml.Name{Space: "http://purl.oclc.org/ooxml/wordprocessingml/main", Local: "lid"}:
if err := d.DecodeElement(m.Lid, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "dirty"},
xml.Name{Space: "http://purl.oclc.org/ooxml/wordprocessingml/main", Local: "dirty"}:
m.Dirty = NewCT_OnOff()
if err := d.DecodeElement(m.Dirty, &el); err != nil {
return err
}
default:
office.Log("skipping unsupported element on CT_RubyPr %v", el.Name)
if err := d.Skip(); err != nil {
return err
}
}
case xml.EndElement:
break lCT_RubyPr
case xml.CharData:
}
}
return nil
}
// Validate validates the CT_RubyPr and its children
func (m *CT_RubyPr) Validate() error {
return m.ValidateWithPath("CT_RubyPr")
}
// ValidateWithPath validates the CT_RubyPr and its children, prefixing error messages with path
func (m *CT_RubyPr) ValidateWithPath(path string) error {
if err := m.RubyAlign.ValidateWithPath(path + "/RubyAlign"); err != nil {
return err
}
if err := m.Hps.ValidateWithPath(path + "/Hps"); err != nil {
return err
}
if err := m.HpsRaise.ValidateWithPath(path + "/HpsRaise"); err != nil {
return err
}
if err := m.HpsBaseText.ValidateWithPath(path + "/HpsBaseText"); err != nil {
return err
}
if err := m.Lid.ValidateWithPath(path + "/Lid"); err != nil {
return err
}
if m.Dirty != nil {
if err := m.Dirty.ValidateWithPath(path + "/Dirty"); err != nil {
return err
}
}
return nil
}