1 Star 0 Fork 1

窦雪峰 / unioffice

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
CT_ColorTransform.go 4.99 KB
一键复制 编辑 原始数据 按行查看 历史
// 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 diagram
import (
"encoding/xml"
"fmt"
"baliance.com/gooxml"
"baliance.com/gooxml/schema/soo/dml"
)
type CT_ColorTransform struct {
UniqueIdAttr *string
MinVerAttr *string
Title []*CT_CTName
Desc []*CT_CTDescription
CatLst *CT_CTCategories
StyleLbl []*CT_CTStyleLabel
ExtLst *dml.CT_OfficeArtExtensionList
}
func NewCT_ColorTransform() *CT_ColorTransform {
ret := &CT_ColorTransform{}
return ret
}
func (m *CT_ColorTransform) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if m.UniqueIdAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "uniqueId"},
Value: fmt.Sprintf("%v", *m.UniqueIdAttr)})
}
if m.MinVerAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "minVer"},
Value: fmt.Sprintf("%v", *m.MinVerAttr)})
}
e.EncodeToken(start)
if m.Title != nil {
setitle := xml.StartElement{Name: xml.Name{Local: "title"}}
for _, c := range m.Title {
e.EncodeElement(c, setitle)
}
}
if m.Desc != nil {
sedesc := xml.StartElement{Name: xml.Name{Local: "desc"}}
for _, c := range m.Desc {
e.EncodeElement(c, sedesc)
}
}
if m.CatLst != nil {
secatLst := xml.StartElement{Name: xml.Name{Local: "catLst"}}
e.EncodeElement(m.CatLst, secatLst)
}
if m.StyleLbl != nil {
sestyleLbl := xml.StartElement{Name: xml.Name{Local: "styleLbl"}}
for _, c := range m.StyleLbl {
e.EncodeElement(c, sestyleLbl)
}
}
if m.ExtLst != nil {
seextLst := xml.StartElement{Name: xml.Name{Local: "extLst"}}
e.EncodeElement(m.ExtLst, seextLst)
}
e.EncodeToken(xml.EndElement{Name: start.Name})
return nil
}
func (m *CT_ColorTransform) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
for _, attr := range start.Attr {
if attr.Name.Local == "uniqueId" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.UniqueIdAttr = &parsed
continue
}
if attr.Name.Local == "minVer" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.MinVerAttr = &parsed
continue
}
}
lCT_ColorTransform:
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/diagram", Local: "title"}:
tmp := NewCT_CTName()
if err := d.DecodeElement(tmp, &el); err != nil {
return err
}
m.Title = append(m.Title, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/diagram", Local: "desc"}:
tmp := NewCT_CTDescription()
if err := d.DecodeElement(tmp, &el); err != nil {
return err
}
m.Desc = append(m.Desc, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/diagram", Local: "catLst"}:
m.CatLst = NewCT_CTCategories()
if err := d.DecodeElement(m.CatLst, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/diagram", Local: "styleLbl"}:
tmp := NewCT_CTStyleLabel()
if err := d.DecodeElement(tmp, &el); err != nil {
return err
}
m.StyleLbl = append(m.StyleLbl, tmp)
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/diagram", Local: "extLst"}:
m.ExtLst = dml.NewCT_OfficeArtExtensionList()
if err := d.DecodeElement(m.ExtLst, &el); err != nil {
return err
}
default:
gooxml.Log("skipping unsupported element on CT_ColorTransform %v", el.Name)
if err := d.Skip(); err != nil {
return err
}
}
case xml.EndElement:
break lCT_ColorTransform
case xml.CharData:
}
}
return nil
}
// Validate validates the CT_ColorTransform and its children
func (m *CT_ColorTransform) Validate() error {
return m.ValidateWithPath("CT_ColorTransform")
}
// ValidateWithPath validates the CT_ColorTransform and its children, prefixing error messages with path
func (m *CT_ColorTransform) ValidateWithPath(path string) error {
for i, v := range m.Title {
if err := v.ValidateWithPath(fmt.Sprintf("%s/Title[%d]", path, i)); err != nil {
return err
}
}
for i, v := range m.Desc {
if err := v.ValidateWithPath(fmt.Sprintf("%s/Desc[%d]", path, i)); err != nil {
return err
}
}
if m.CatLst != nil {
if err := m.CatLst.ValidateWithPath(path + "/CatLst"); err != nil {
return err
}
}
for i, v := range m.StyleLbl {
if err := v.ValidateWithPath(fmt.Sprintf("%s/StyleLbl[%d]", path, i)); err != nil {
return err
}
}
if m.ExtLst != nil {
if err := m.ExtLst.ValidateWithPath(path + "/ExtLst"); err != nil {
return err
}
}
return nil
}
1
https://gitee.com/douxuefeng/unioffice.git
git@gitee.com:douxuefeng/unioffice.git
douxuefeng
unioffice
unioffice
v0.7.1

搜索帮助