unioffice/schema/soo/dml/CT_BaseStyles.go

117 lines
3.5 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.
2017-09-23 08:39:08 -05:00
package dml
2017-08-28 20:56:18 -05:00
import (
"encoding/xml"
"baliance.com/gooxml"
2017-08-28 20:56:18 -05:00
)
type CT_BaseStyles struct {
ClrScheme *CT_ColorScheme
FontScheme *CT_FontScheme
FmtScheme *CT_StyleMatrix
ExtLst *CT_OfficeArtExtensionList
}
func NewCT_BaseStyles() *CT_BaseStyles {
ret := &CT_BaseStyles{}
ret.ClrScheme = NewCT_ColorScheme()
ret.FontScheme = NewCT_FontScheme()
ret.FmtScheme = NewCT_StyleMatrix()
return ret
}
2017-08-28 20:56:18 -05:00
func (m *CT_BaseStyles) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
e.EncodeToken(start)
seclrScheme := xml.StartElement{Name: xml.Name{Local: "a:clrScheme"}}
e.EncodeElement(m.ClrScheme, seclrScheme)
sefontScheme := xml.StartElement{Name: xml.Name{Local: "a:fontScheme"}}
e.EncodeElement(m.FontScheme, sefontScheme)
sefmtScheme := xml.StartElement{Name: xml.Name{Local: "a:fmtScheme"}}
e.EncodeElement(m.FmtScheme, sefmtScheme)
if m.ExtLst != nil {
seextLst := xml.StartElement{Name: xml.Name{Local: "a:extLst"}}
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_BaseStyles) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
m.ClrScheme = NewCT_ColorScheme()
m.FontScheme = NewCT_FontScheme()
m.FmtScheme = NewCT_StyleMatrix()
lCT_BaseStyles:
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/main", Local: "clrScheme"}:
2017-08-28 20:56:18 -05:00
if err := d.DecodeElement(m.ClrScheme, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/main", Local: "fontScheme"}:
2017-08-28 20:56:18 -05:00
if err := d.DecodeElement(m.FontScheme, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/main", Local: "fmtScheme"}:
2017-08-28 20:56:18 -05:00
if err := d.DecodeElement(m.FmtScheme, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/main", Local: "extLst"}:
2017-08-28 20:56:18 -05:00
m.ExtLst = NewCT_OfficeArtExtensionList()
if err := d.DecodeElement(m.ExtLst, &el); err != nil {
return err
}
default:
gooxml.Log("skipping unsupported element on CT_BaseStyles %v", el.Name)
2017-08-28 20:56:18 -05:00
if err := d.Skip(); err != nil {
return err
}
}
case xml.EndElement:
break lCT_BaseStyles
case xml.CharData:
}
}
return nil
}
// Validate validates the CT_BaseStyles and its children
2017-08-28 20:56:18 -05:00
func (m *CT_BaseStyles) Validate() error {
return m.ValidateWithPath("CT_BaseStyles")
}
// ValidateWithPath validates the CT_BaseStyles and its children, prefixing error messages with path
2017-08-28 20:56:18 -05:00
func (m *CT_BaseStyles) ValidateWithPath(path string) error {
if err := m.ClrScheme.ValidateWithPath(path + "/ClrScheme"); err != nil {
return err
}
if err := m.FontScheme.ValidateWithPath(path + "/FontScheme"); err != nil {
return err
}
if err := m.FmtScheme.ValidateWithPath(path + "/FmtScheme"); err != nil {
return err
}
if m.ExtLst != nil {
if err := m.ExtLst.ValidateWithPath(path + "/ExtLst"); err != nil {
return err
}
}
return nil
}