unioffice/schema/soo/sml/CT_Stylesheet.go

241 lines
7.0 KiB
Go
Raw Permalink 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:23:34 -05:00
package sml
2017-08-28 20:56:18 -05:00
import (
"encoding/xml"
"log"
)
type CT_Stylesheet struct {
// Number Formats
NumFmts *CT_NumFmts
// Fonts
Fonts *CT_Fonts
// Fills
Fills *CT_Fills
// Borders
Borders *CT_Borders
// Formatting Records
CellStyleXfs *CT_CellStyleXfs
// Cell Formats
CellXfs *CT_CellXfs
// Cell Styles
CellStyles *CT_CellStyles
// Formats
Dxfs *CT_Dxfs
// Table Styles
TableStyles *CT_TableStyles
// Colors
Colors *CT_Colors
// Future Feature Data Storage Area
ExtLst *CT_ExtensionList
}
func NewCT_Stylesheet() *CT_Stylesheet {
ret := &CT_Stylesheet{}
return ret
}
2017-08-28 20:56:18 -05:00
func (m *CT_Stylesheet) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
e.EncodeToken(start)
if m.NumFmts != nil {
senumFmts := xml.StartElement{Name: xml.Name{Local: "ma:numFmts"}}
2017-08-28 20:56:18 -05:00
e.EncodeElement(m.NumFmts, senumFmts)
}
if m.Fonts != nil {
sefonts := xml.StartElement{Name: xml.Name{Local: "ma:fonts"}}
2017-08-28 20:56:18 -05:00
e.EncodeElement(m.Fonts, sefonts)
}
if m.Fills != nil {
sefills := xml.StartElement{Name: xml.Name{Local: "ma:fills"}}
2017-08-28 20:56:18 -05:00
e.EncodeElement(m.Fills, sefills)
}
if m.Borders != nil {
seborders := xml.StartElement{Name: xml.Name{Local: "ma:borders"}}
2017-08-28 20:56:18 -05:00
e.EncodeElement(m.Borders, seborders)
}
if m.CellStyleXfs != nil {
secellStyleXfs := xml.StartElement{Name: xml.Name{Local: "ma:cellStyleXfs"}}
2017-08-28 20:56:18 -05:00
e.EncodeElement(m.CellStyleXfs, secellStyleXfs)
}
if m.CellXfs != nil {
secellXfs := xml.StartElement{Name: xml.Name{Local: "ma:cellXfs"}}
2017-08-28 20:56:18 -05:00
e.EncodeElement(m.CellXfs, secellXfs)
}
if m.CellStyles != nil {
secellStyles := xml.StartElement{Name: xml.Name{Local: "ma:cellStyles"}}
2017-08-28 20:56:18 -05:00
e.EncodeElement(m.CellStyles, secellStyles)
}
if m.Dxfs != nil {
sedxfs := xml.StartElement{Name: xml.Name{Local: "ma:dxfs"}}
2017-08-28 20:56:18 -05:00
e.EncodeElement(m.Dxfs, sedxfs)
}
if m.TableStyles != nil {
setableStyles := xml.StartElement{Name: xml.Name{Local: "ma:tableStyles"}}
2017-08-28 20:56:18 -05:00
e.EncodeElement(m.TableStyles, setableStyles)
}
if m.Colors != nil {
secolors := xml.StartElement{Name: xml.Name{Local: "ma:colors"}}
2017-08-28 20:56:18 -05:00
e.EncodeElement(m.Colors, secolors)
}
if m.ExtLst != nil {
seextLst := xml.StartElement{Name: xml.Name{Local: "ma: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_Stylesheet) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
lCT_Stylesheet:
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/spreadsheetml/2006/main", Local: "numFmts"}:
2017-08-28 20:56:18 -05:00
m.NumFmts = NewCT_NumFmts()
if err := d.DecodeElement(m.NumFmts, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "fonts"}:
2017-08-28 20:56:18 -05:00
m.Fonts = NewCT_Fonts()
if err := d.DecodeElement(m.Fonts, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "fills"}:
2017-08-28 20:56:18 -05:00
m.Fills = NewCT_Fills()
if err := d.DecodeElement(m.Fills, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "borders"}:
2017-08-28 20:56:18 -05:00
m.Borders = NewCT_Borders()
if err := d.DecodeElement(m.Borders, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "cellStyleXfs"}:
2017-08-28 20:56:18 -05:00
m.CellStyleXfs = NewCT_CellStyleXfs()
if err := d.DecodeElement(m.CellStyleXfs, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "cellXfs"}:
2017-08-28 20:56:18 -05:00
m.CellXfs = NewCT_CellXfs()
if err := d.DecodeElement(m.CellXfs, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "cellStyles"}:
2017-08-28 20:56:18 -05:00
m.CellStyles = NewCT_CellStyles()
if err := d.DecodeElement(m.CellStyles, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "dxfs"}:
2017-08-28 20:56:18 -05:00
m.Dxfs = NewCT_Dxfs()
if err := d.DecodeElement(m.Dxfs, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "tableStyles"}:
2017-08-28 20:56:18 -05:00
m.TableStyles = NewCT_TableStyles()
if err := d.DecodeElement(m.TableStyles, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Local: "colors"}:
2017-08-28 20:56:18 -05:00
m.Colors = NewCT_Colors()
if err := d.DecodeElement(m.Colors, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", 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:
log.Printf("skipping unsupported element on CT_Stylesheet %v", el.Name)
2017-08-28 20:56:18 -05:00
if err := d.Skip(); err != nil {
return err
}
}
case xml.EndElement:
break lCT_Stylesheet
case xml.CharData:
}
}
return nil
}
// Validate validates the CT_Stylesheet and its children
2017-08-28 20:56:18 -05:00
func (m *CT_Stylesheet) Validate() error {
return m.ValidateWithPath("CT_Stylesheet")
}
// ValidateWithPath validates the CT_Stylesheet and its children, prefixing error messages with path
2017-08-28 20:56:18 -05:00
func (m *CT_Stylesheet) ValidateWithPath(path string) error {
if m.NumFmts != nil {
if err := m.NumFmts.ValidateWithPath(path + "/NumFmts"); err != nil {
return err
}
}
if m.Fonts != nil {
if err := m.Fonts.ValidateWithPath(path + "/Fonts"); err != nil {
return err
}
}
if m.Fills != nil {
if err := m.Fills.ValidateWithPath(path + "/Fills"); err != nil {
return err
}
}
if m.Borders != nil {
if err := m.Borders.ValidateWithPath(path + "/Borders"); err != nil {
return err
}
}
if m.CellStyleXfs != nil {
if err := m.CellStyleXfs.ValidateWithPath(path + "/CellStyleXfs"); err != nil {
return err
}
}
if m.CellXfs != nil {
if err := m.CellXfs.ValidateWithPath(path + "/CellXfs"); err != nil {
return err
}
}
if m.CellStyles != nil {
if err := m.CellStyles.ValidateWithPath(path + "/CellStyles"); err != nil {
return err
}
}
if m.Dxfs != nil {
if err := m.Dxfs.ValidateWithPath(path + "/Dxfs"); err != nil {
return err
}
}
if m.TableStyles != nil {
if err := m.TableStyles.ValidateWithPath(path + "/TableStyles"); err != nil {
return err
}
}
if m.Colors != nil {
if err := m.Colors.ValidateWithPath(path + "/Colors"); err != nil {
return err
}
}
if m.ExtLst != nil {
if err := m.ExtLst.ValidateWithPath(path + "/ExtLst"); err != nil {
return err
}
}
return nil
}