unioffice/schema/soo/dml/chart/CT_Title.go

157 lines
4.3 KiB
Go
Raw Normal View History

2017-08-28 20:56:18 -05:00
// Copyright 2017 Baliance. All rights reserved.
//
// DO NOT EDIT: generated by gooxml ECMA-376 generator
//
2017-08-28 20:56:18 -05:00
// 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 chart
import (
"encoding/xml"
"baliance.com/gooxml"
2017-09-23 08:39:08 -05:00
"baliance.com/gooxml/schema/soo/dml"
2017-08-28 20:56:18 -05:00
)
type CT_Title struct {
Tx *CT_Tx
Layout *CT_Layout
Overlay *CT_Boolean
2017-09-23 08:39:08 -05:00
SpPr *dml.CT_ShapeProperties
TxPr *dml.CT_TextBody
2017-08-28 20:56:18 -05:00
ExtLst *CT_ExtensionList
}
func NewCT_Title() *CT_Title {
ret := &CT_Title{}
return ret
}
2017-08-28 20:56:18 -05:00
func (m *CT_Title) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
e.EncodeToken(start)
if m.Tx != nil {
2017-09-03 09:29:13 -05:00
setx := xml.StartElement{Name: xml.Name{Local: "c:tx"}}
2017-08-28 20:56:18 -05:00
e.EncodeElement(m.Tx, setx)
}
if m.Layout != nil {
2017-09-03 09:29:13 -05:00
selayout := xml.StartElement{Name: xml.Name{Local: "c:layout"}}
2017-08-28 20:56:18 -05:00
e.EncodeElement(m.Layout, selayout)
}
if m.Overlay != nil {
2017-09-03 09:29:13 -05:00
seoverlay := xml.StartElement{Name: xml.Name{Local: "c:overlay"}}
2017-08-28 20:56:18 -05:00
e.EncodeElement(m.Overlay, seoverlay)
}
if m.SpPr != nil {
2017-09-03 09:29:13 -05:00
sespPr := xml.StartElement{Name: xml.Name{Local: "c:spPr"}}
2017-08-28 20:56:18 -05:00
e.EncodeElement(m.SpPr, sespPr)
}
if m.TxPr != nil {
2017-09-03 09:29:13 -05:00
setxPr := xml.StartElement{Name: xml.Name{Local: "c:txPr"}}
2017-08-28 20:56:18 -05:00
e.EncodeElement(m.TxPr, setxPr)
}
if m.ExtLst != nil {
2017-09-03 09:29:13 -05:00
seextLst := xml.StartElement{Name: xml.Name{Local: "c:extLst"}}
2017-08-28 20:56:18 -05:00
e.EncodeElement(m.ExtLst, seextLst)
}
e.EncodeToken(xml.EndElement{Name: start.Name})
return nil
}
2017-08-28 20:56:18 -05:00
func (m *CT_Title) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
lCT_Title:
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/chart", Local: "tx"}:
2017-08-28 20:56:18 -05:00
m.Tx = NewCT_Tx()
if err := d.DecodeElement(m.Tx, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/chart", Local: "layout"}:
2017-08-28 20:56:18 -05:00
m.Layout = NewCT_Layout()
if err := d.DecodeElement(m.Layout, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/chart", Local: "overlay"}:
2017-08-28 20:56:18 -05:00
m.Overlay = NewCT_Boolean()
if err := d.DecodeElement(m.Overlay, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/chart", Local: "spPr"}:
2017-09-23 08:39:08 -05:00
m.SpPr = dml.NewCT_ShapeProperties()
2017-08-28 20:56:18 -05:00
if err := d.DecodeElement(m.SpPr, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/chart", Local: "txPr"}:
2017-09-23 08:39:08 -05:00
m.TxPr = dml.NewCT_TextBody()
2017-08-28 20:56:18 -05:00
if err := d.DecodeElement(m.TxPr, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/chart", Local: "extLst"}:
2017-08-28 20:56:18 -05:00
m.ExtLst = NewCT_ExtensionList()
if err := d.DecodeElement(m.ExtLst, &el); err != nil {
return err
}
default:
gooxml.Log("skipping unsupported element on CT_Title %v", el.Name)
2017-08-28 20:56:18 -05:00
if err := d.Skip(); err != nil {
return err
}
}
case xml.EndElement:
break lCT_Title
case xml.CharData:
}
}
return nil
}
// Validate validates the CT_Title and its children
2017-08-28 20:56:18 -05:00
func (m *CT_Title) Validate() error {
return m.ValidateWithPath("CT_Title")
}
// ValidateWithPath validates the CT_Title and its children, prefixing error messages with path
2017-08-28 20:56:18 -05:00
func (m *CT_Title) ValidateWithPath(path string) error {
if m.Tx != nil {
if err := m.Tx.ValidateWithPath(path + "/Tx"); err != nil {
return err
}
}
if m.Layout != nil {
if err := m.Layout.ValidateWithPath(path + "/Layout"); err != nil {
return err
}
}
if m.Overlay != nil {
if err := m.Overlay.ValidateWithPath(path + "/Overlay"); err != nil {
return err
}
}
if m.SpPr != nil {
if err := m.SpPr.ValidateWithPath(path + "/SpPr"); err != nil {
return err
}
}
if m.TxPr != nil {
if err := m.TxPr.ValidateWithPath(path + "/TxPr"); err != nil {
return err
}
}
if m.ExtLst != nil {
if err := m.ExtLst.ValidateWithPath(path + "/ExtLst"); err != nil {
return err
}
}
return nil
}