1 Star 2 Fork 1

wx-fork/unioffice

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
CT_Shape.go 36.21 KB
一键复制 编辑 原始数据 按行查看 历史
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113
// 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 vml
import (
"encoding/xml"
"fmt"
"strconv"
"baliance.com/gooxml"
"baliance.com/gooxml/schema/soo/ofc/sharedTypes"
"baliance.com/gooxml/schema/urn/schemas_microsoft_com/office/excel"
"baliance.com/gooxml/schema/urn/schemas_microsoft_com/office/powerpoint"
"baliance.com/gooxml/schema/urn/schemas_microsoft_com/office/word"
)
type CT_Shape struct {
GfxdataAttr *string
EquationxmlAttr *string
Ink []*OfcInk
Iscomment []*powerpoint.Iscomment
Equationxml []*OfcEquationxml
EG_ShapeElements []*EG_ShapeElements
HrefAttr *string
TargetAttr *string
ClassAttr *string
TitleAttr *string
AltAttr *string
CoordsizeAttr *string
CoordoriginAttr *string
WrapcoordsAttr *string
PrintAttr sharedTypes.ST_TrueFalse
IdAttr *string
StyleAttr *string
SpidAttr *string
OnedAttr sharedTypes.ST_TrueFalse
RegroupidAttr *int64
DoubleclicknotifyAttr sharedTypes.ST_TrueFalse
ButtonAttr sharedTypes.ST_TrueFalse
UserhiddenAttr sharedTypes.ST_TrueFalse
BulletAttr sharedTypes.ST_TrueFalse
HrAttr sharedTypes.ST_TrueFalse
HrstdAttr sharedTypes.ST_TrueFalse
HrnoshadeAttr sharedTypes.ST_TrueFalse
HrpctAttr *float32
HralignAttr OfcST_HrAlign
AllowincellAttr sharedTypes.ST_TrueFalse
AllowoverlapAttr sharedTypes.ST_TrueFalse
UserdrawnAttr sharedTypes.ST_TrueFalse
BordertopcolorAttr *string
BorderleftcolorAttr *string
BorderbottomcolorAttr *string
BorderrightcolorAttr *string
DgmlayoutAttr OfcST_DiagramLayout
DgmnodekindAttr *int64
DgmlayoutmruAttr OfcST_DiagramLayout
InsetmodeAttr OfcST_InsetMode
OpacityAttr *string
StrokedAttr sharedTypes.ST_TrueFalse
StrokecolorAttr *string
StrokeweightAttr *string
InsetpenAttr sharedTypes.ST_TrueFalse
ChromakeyAttr *string
FilledAttr sharedTypes.ST_TrueFalse
FillcolorAttr *string
SptAttr *float32
ConnectortypeAttr OfcST_ConnectorType
BwmodeAttr OfcST_BWMode
BwpureAttr OfcST_BWMode
BwnormalAttr OfcST_BWMode
ForcedashAttr sharedTypes.ST_TrueFalse
OleiconAttr sharedTypes.ST_TrueFalse
OleAttr sharedTypes.ST_TrueFalseBlank
PreferrelativeAttr sharedTypes.ST_TrueFalse
CliptowrapAttr sharedTypes.ST_TrueFalse
ClipAttr sharedTypes.ST_TrueFalse
TypeAttr *string
AdjAttr *string
PathAttr *string
}
func NewCT_Shape() *CT_Shape {
ret := &CT_Shape{}
return ret
}
func (m *CT_Shape) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if m.GfxdataAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "o:gfxdata"},
Value: fmt.Sprintf("%v", *m.GfxdataAttr)})
}
if m.EquationxmlAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "equationxml"},
Value: fmt.Sprintf("%v", *m.EquationxmlAttr)})
}
if m.HrefAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "href"},
Value: fmt.Sprintf("%v", *m.HrefAttr)})
}
if m.TargetAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "target"},
Value: fmt.Sprintf("%v", *m.TargetAttr)})
}
if m.ClassAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "class"},
Value: fmt.Sprintf("%v", *m.ClassAttr)})
}
if m.TitleAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "title"},
Value: fmt.Sprintf("%v", *m.TitleAttr)})
}
if m.AltAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "alt"},
Value: fmt.Sprintf("%v", *m.AltAttr)})
}
if m.CoordsizeAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "coordsize"},
Value: fmt.Sprintf("%v", *m.CoordsizeAttr)})
}
if m.CoordoriginAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "coordorigin"},
Value: fmt.Sprintf("%v", *m.CoordoriginAttr)})
}
if m.WrapcoordsAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "wrapcoords"},
Value: fmt.Sprintf("%v", *m.WrapcoordsAttr)})
}
if m.PrintAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.PrintAttr.MarshalXMLAttr(xml.Name{Local: "print"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.IdAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "id"},
Value: fmt.Sprintf("%v", *m.IdAttr)})
}
if m.StyleAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "style"},
Value: fmt.Sprintf("%v", *m.StyleAttr)})
}
if m.SpidAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "o:spid"},
Value: fmt.Sprintf("%v", *m.SpidAttr)})
}
if m.OnedAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.OnedAttr.MarshalXMLAttr(xml.Name{Local: "oned"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.RegroupidAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "o:regroupid"},
Value: fmt.Sprintf("%v", *m.RegroupidAttr)})
}
if m.DoubleclicknotifyAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.DoubleclicknotifyAttr.MarshalXMLAttr(xml.Name{Local: "doubleclicknotify"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.ButtonAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.ButtonAttr.MarshalXMLAttr(xml.Name{Local: "button"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.UserhiddenAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.UserhiddenAttr.MarshalXMLAttr(xml.Name{Local: "userhidden"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.BulletAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.BulletAttr.MarshalXMLAttr(xml.Name{Local: "bullet"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.HrAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.HrAttr.MarshalXMLAttr(xml.Name{Local: "hr"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.HrstdAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.HrstdAttr.MarshalXMLAttr(xml.Name{Local: "hrstd"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.HrnoshadeAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.HrnoshadeAttr.MarshalXMLAttr(xml.Name{Local: "hrnoshade"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.HrpctAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "o:hrpct"},
Value: fmt.Sprintf("%v", *m.HrpctAttr)})
}
if m.HralignAttr != OfcST_HrAlignUnset {
attr, err := m.HralignAttr.MarshalXMLAttr(xml.Name{Local: "hralign"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.AllowincellAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.AllowincellAttr.MarshalXMLAttr(xml.Name{Local: "allowincell"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.AllowoverlapAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.AllowoverlapAttr.MarshalXMLAttr(xml.Name{Local: "allowoverlap"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.UserdrawnAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.UserdrawnAttr.MarshalXMLAttr(xml.Name{Local: "userdrawn"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.BordertopcolorAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "o:bordertopcolor"},
Value: fmt.Sprintf("%v", *m.BordertopcolorAttr)})
}
if m.BorderleftcolorAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "o:borderleftcolor"},
Value: fmt.Sprintf("%v", *m.BorderleftcolorAttr)})
}
if m.BorderbottomcolorAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "o:borderbottomcolor"},
Value: fmt.Sprintf("%v", *m.BorderbottomcolorAttr)})
}
if m.BorderrightcolorAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "o:borderrightcolor"},
Value: fmt.Sprintf("%v", *m.BorderrightcolorAttr)})
}
if m.DgmlayoutAttr != OfcST_DiagramLayoutUnset {
attr, err := m.DgmlayoutAttr.MarshalXMLAttr(xml.Name{Local: "dgmlayout"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.DgmnodekindAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "o:dgmnodekind"},
Value: fmt.Sprintf("%v", *m.DgmnodekindAttr)})
}
if m.DgmlayoutmruAttr != OfcST_DiagramLayoutUnset {
attr, err := m.DgmlayoutmruAttr.MarshalXMLAttr(xml.Name{Local: "dgmlayoutmru"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.InsetmodeAttr != OfcST_InsetModeUnset {
attr, err := m.InsetmodeAttr.MarshalXMLAttr(xml.Name{Local: "insetmode"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.OpacityAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "opacity"},
Value: fmt.Sprintf("%v", *m.OpacityAttr)})
}
if m.StrokedAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.StrokedAttr.MarshalXMLAttr(xml.Name{Local: "stroked"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.StrokecolorAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "strokecolor"},
Value: fmt.Sprintf("%v", *m.StrokecolorAttr)})
}
if m.StrokeweightAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "strokeweight"},
Value: fmt.Sprintf("%v", *m.StrokeweightAttr)})
}
if m.InsetpenAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.InsetpenAttr.MarshalXMLAttr(xml.Name{Local: "insetpen"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.ChromakeyAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "chromakey"},
Value: fmt.Sprintf("%v", *m.ChromakeyAttr)})
}
if m.FilledAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.FilledAttr.MarshalXMLAttr(xml.Name{Local: "filled"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.FillcolorAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "fillcolor"},
Value: fmt.Sprintf("%v", *m.FillcolorAttr)})
}
if m.SptAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "o:spt"},
Value: fmt.Sprintf("%v", *m.SptAttr)})
}
if m.ConnectortypeAttr != OfcST_ConnectorTypeUnset {
attr, err := m.ConnectortypeAttr.MarshalXMLAttr(xml.Name{Local: "connectortype"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.BwmodeAttr != OfcST_BWModeUnset {
attr, err := m.BwmodeAttr.MarshalXMLAttr(xml.Name{Local: "bwmode"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.BwpureAttr != OfcST_BWModeUnset {
attr, err := m.BwpureAttr.MarshalXMLAttr(xml.Name{Local: "bwpure"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.BwnormalAttr != OfcST_BWModeUnset {
attr, err := m.BwnormalAttr.MarshalXMLAttr(xml.Name{Local: "bwnormal"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.ForcedashAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.ForcedashAttr.MarshalXMLAttr(xml.Name{Local: "forcedash"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.OleiconAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.OleiconAttr.MarshalXMLAttr(xml.Name{Local: "oleicon"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.OleAttr != sharedTypes.ST_TrueFalseBlankUnset {
attr, err := m.OleAttr.MarshalXMLAttr(xml.Name{Local: "ole"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.PreferrelativeAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.PreferrelativeAttr.MarshalXMLAttr(xml.Name{Local: "preferrelative"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.CliptowrapAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.CliptowrapAttr.MarshalXMLAttr(xml.Name{Local: "cliptowrap"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.ClipAttr != sharedTypes.ST_TrueFalseUnset {
attr, err := m.ClipAttr.MarshalXMLAttr(xml.Name{Local: "clip"})
if err != nil {
return err
}
start.Attr = append(start.Attr, attr)
}
if m.TypeAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "type"},
Value: fmt.Sprintf("%v", *m.TypeAttr)})
}
if m.AdjAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "adj"},
Value: fmt.Sprintf("%v", *m.AdjAttr)})
}
if m.PathAttr != nil {
start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "path"},
Value: fmt.Sprintf("%v", *m.PathAttr)})
}
e.EncodeToken(start)
if m.Ink != nil {
seink := xml.StartElement{Name: xml.Name{Local: "o:ink"}}
for _, c := range m.Ink {
e.EncodeElement(c, seink)
}
}
if m.Iscomment != nil {
seiscomment := xml.StartElement{Name: xml.Name{Local: "ur:iscomment"}}
for _, c := range m.Iscomment {
e.EncodeElement(c, seiscomment)
}
}
if m.Equationxml != nil {
seequationxml := xml.StartElement{Name: xml.Name{Local: "o:equationxml"}}
for _, c := range m.Equationxml {
e.EncodeElement(c, seequationxml)
}
}
if m.EG_ShapeElements != nil {
for _, c := range m.EG_ShapeElements {
c.MarshalXML(e, xml.StartElement{})
}
}
e.EncodeToken(xml.EndElement{Name: start.Name})
return nil
}
func (m *CT_Shape) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
for _, attr := range start.Attr {
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "regroupid" {
parsed, err := strconv.ParseInt(attr.Value, 10, 64)
if err != nil {
return err
}
m.RegroupidAttr = &parsed
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "doubleclicknotify" {
m.DoubleclicknotifyAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "clip" {
m.ClipAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "button" {
m.ButtonAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "userhidden" {
m.UserhiddenAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "bullet" {
m.BulletAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "gfxdata" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.GfxdataAttr = &parsed
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "hr" {
m.HrAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "ole" {
m.OleAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "allowincell" {
m.AllowincellAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "borderleftcolor" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.BorderleftcolorAttr = &parsed
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "hrpct" {
parsed, err := strconv.ParseFloat(attr.Value, 64)
if err != nil {
return err
}
pt := float32(parsed)
m.HrpctAttr = &pt
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "dgmnodekind" {
parsed, err := strconv.ParseInt(attr.Value, 10, 64)
if err != nil {
return err
}
m.DgmnodekindAttr = &parsed
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "insetmode" {
m.InsetmodeAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "userdrawn" {
m.UserdrawnAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "connectortype" {
m.ConnectortypeAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "borderrightcolor" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.BorderrightcolorAttr = &parsed
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "preferrelative" {
m.PreferrelativeAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "hrnoshade" {
m.HrnoshadeAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "dgmlayoutmru" {
m.DgmlayoutmruAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "oned" {
m.OnedAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "hralign" {
m.HralignAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "bwmode" {
m.BwmodeAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "allowoverlap" {
m.AllowoverlapAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "bordertopcolor" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.BordertopcolorAttr = &parsed
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "bwnormal" {
m.BwnormalAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "borderbottomcolor" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.BorderbottomcolorAttr = &parsed
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "cliptowrap" {
m.CliptowrapAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "dgmlayout" {
m.DgmlayoutAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "spt" {
parsed, err := strconv.ParseFloat(attr.Value, 64)
if err != nil {
return err
}
pt := float32(parsed)
m.SptAttr = &pt
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "oleicon" {
m.OleiconAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "forcedash" {
m.ForcedashAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "bwpure" {
m.BwpureAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "spid" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.SpidAttr = &parsed
continue
}
if attr.Name.Space == "urn:schemas-microsoft-com:office:office" && attr.Name.Local == "hrstd" {
m.HrstdAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "target" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.TargetAttr = &parsed
continue
}
if attr.Name.Local == "wrapcoords" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.WrapcoordsAttr = &parsed
continue
}
if attr.Name.Local == "opacity" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.OpacityAttr = &parsed
continue
}
if attr.Name.Local == "coordorigin" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.CoordoriginAttr = &parsed
continue
}
if attr.Name.Local == "strokecolor" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.StrokecolorAttr = &parsed
continue
}
if attr.Name.Local == "coordsize" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.CoordsizeAttr = &parsed
continue
}
if attr.Name.Local == "insetpen" {
m.InsetpenAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "alt" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.AltAttr = &parsed
continue
}
if attr.Name.Local == "filled" {
m.FilledAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "title" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.TitleAttr = &parsed
continue
}
if attr.Name.Local == "style" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.StyleAttr = &parsed
continue
}
if attr.Name.Local == "print" {
m.PrintAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "stroked" {
m.StrokedAttr.UnmarshalXMLAttr(attr)
continue
}
if attr.Name.Local == "strokeweight" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.StrokeweightAttr = &parsed
continue
}
if attr.Name.Local == "chromakey" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.ChromakeyAttr = &parsed
continue
}
if attr.Name.Local == "path" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.PathAttr = &parsed
continue
}
if attr.Name.Local == "id" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.IdAttr = &parsed
continue
}
if attr.Name.Local == "class" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.ClassAttr = &parsed
continue
}
if attr.Name.Local == "href" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.HrefAttr = &parsed
continue
}
if attr.Name.Local == "equationxml" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.EquationxmlAttr = &parsed
continue
}
if attr.Name.Local == "type" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.TypeAttr = &parsed
continue
}
if attr.Name.Local == "adj" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.AdjAttr = &parsed
continue
}
if attr.Name.Local == "fillcolor" {
parsed, err := attr.Value, error(nil)
if err != nil {
return err
}
m.FillcolorAttr = &parsed
continue
}
}
lCT_Shape:
for {
tok, err := d.Token()
if err != nil {
return err
}
switch el := tok.(type) {
case xml.StartElement:
switch el.Name {
case xml.Name{Space: "urn:schemas-microsoft-com:office:office", Local: "ink"}:
tmp := NewOfcInk()
if err := d.DecodeElement(tmp, &el); err != nil {
return err
}
m.Ink = append(m.Ink, tmp)
case xml.Name{Space: "urn:schemas-microsoft-com:office:powerpoint", Local: "iscomment"}:
tmp := powerpoint.NewIscomment()
if err := d.DecodeElement(tmp, &el); err != nil {
return err
}
m.Iscomment = append(m.Iscomment, tmp)
case xml.Name{Space: "urn:schemas-microsoft-com:office:office", Local: "equationxml"}:
tmp := NewOfcEquationxml()
if err := d.DecodeElement(tmp, &el); err != nil {
return err
}
m.Equationxml = append(m.Equationxml, tmp)
case xml.Name{Space: "urn:schemas-microsoft-com:vml", Local: "path"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Path = NewPath()
if err := d.DecodeElement(tmpshapeelements.Path, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:vml", Local: "formulas"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Formulas = NewFormulas()
if err := d.DecodeElement(tmpshapeelements.Formulas, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:vml", Local: "handles"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Handles = NewHandles()
if err := d.DecodeElement(tmpshapeelements.Handles, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:vml", Local: "fill"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Fill = NewFill()
if err := d.DecodeElement(tmpshapeelements.Fill, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:vml", Local: "stroke"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Stroke = NewStroke()
if err := d.DecodeElement(tmpshapeelements.Stroke, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:vml", Local: "shadow"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Shadow = NewShadow()
if err := d.DecodeElement(tmpshapeelements.Shadow, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:vml", Local: "textbox"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Textbox = NewTextbox()
if err := d.DecodeElement(tmpshapeelements.Textbox, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:vml", Local: "textpath"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Textpath = NewTextpath()
if err := d.DecodeElement(tmpshapeelements.Textpath, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:vml", Local: "imagedata"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Imagedata = NewImagedata()
if err := d.DecodeElement(tmpshapeelements.Imagedata, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:office:office", Local: "skew"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Skew = NewOfcSkew()
if err := d.DecodeElement(tmpshapeelements.Skew, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:office:office", Local: "extrusion"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Extrusion = NewOfcExtrusion()
if err := d.DecodeElement(tmpshapeelements.Extrusion, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:office:office", Local: "callout"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Callout = NewOfcCallout()
if err := d.DecodeElement(tmpshapeelements.Callout, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:office:office", Local: "lock"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Lock = NewOfcLock()
if err := d.DecodeElement(tmpshapeelements.Lock, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:office:office", Local: "clippath"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Clippath = NewOfcClippath()
if err := d.DecodeElement(tmpshapeelements.Clippath, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:office:office", Local: "signatureline"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Signatureline = NewOfcSignatureline()
if err := d.DecodeElement(tmpshapeelements.Signatureline, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:office:word", Local: "wrap"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Wrap = word.NewWrap()
if err := d.DecodeElement(tmpshapeelements.Wrap, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:office:word", Local: "anchorlock"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Anchorlock = word.NewAnchorlock()
if err := d.DecodeElement(tmpshapeelements.Anchorlock, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:office:word", Local: "bordertop"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Bordertop = word.NewBordertop()
if err := d.DecodeElement(tmpshapeelements.Bordertop, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:office:word", Local: "borderbottom"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Borderbottom = word.NewBorderbottom()
if err := d.DecodeElement(tmpshapeelements.Borderbottom, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:office:word", Local: "borderleft"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Borderleft = word.NewBorderleft()
if err := d.DecodeElement(tmpshapeelements.Borderleft, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:office:word", Local: "borderright"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Borderright = word.NewBorderright()
if err := d.DecodeElement(tmpshapeelements.Borderright, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:office:excel", Local: "ClientData"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.ClientData = excel.NewClientData()
if err := d.DecodeElement(tmpshapeelements.ClientData, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
case xml.Name{Space: "urn:schemas-microsoft-com:office:powerpoint", Local: "textdata"}:
tmpshapeelements := NewEG_ShapeElements()
tmpshapeelements.Textdata = powerpoint.NewTextdata()
if err := d.DecodeElement(tmpshapeelements.Textdata, &el); err != nil {
return err
}
m.EG_ShapeElements = append(m.EG_ShapeElements, tmpshapeelements)
default:
gooxml.Log("skipping unsupported element on CT_Shape %v", el.Name)
if err := d.Skip(); err != nil {
return err
}
}
case xml.EndElement:
break lCT_Shape
case xml.CharData:
}
}
return nil
}
// Validate validates the CT_Shape and its children
func (m *CT_Shape) Validate() error {
return m.ValidateWithPath("CT_Shape")
}
// ValidateWithPath validates the CT_Shape and its children, prefixing error messages with path
func (m *CT_Shape) ValidateWithPath(path string) error {
for i, v := range m.Ink {
if err := v.ValidateWithPath(fmt.Sprintf("%s/Ink[%d]", path, i)); err != nil {
return err
}
}
for i, v := range m.Iscomment {
if err := v.ValidateWithPath(fmt.Sprintf("%s/Iscomment[%d]", path, i)); err != nil {
return err
}
}
for i, v := range m.Equationxml {
if err := v.ValidateWithPath(fmt.Sprintf("%s/Equationxml[%d]", path, i)); err != nil {
return err
}
}
for i, v := range m.EG_ShapeElements {
if err := v.ValidateWithPath(fmt.Sprintf("%s/EG_ShapeElements[%d]", path, i)); err != nil {
return err
}
}
if err := m.PrintAttr.ValidateWithPath(path + "/PrintAttr"); err != nil {
return err
}
if err := m.OnedAttr.ValidateWithPath(path + "/OnedAttr"); err != nil {
return err
}
if err := m.DoubleclicknotifyAttr.ValidateWithPath(path + "/DoubleclicknotifyAttr"); err != nil {
return err
}
if err := m.ButtonAttr.ValidateWithPath(path + "/ButtonAttr"); err != nil {
return err
}
if err := m.UserhiddenAttr.ValidateWithPath(path + "/UserhiddenAttr"); err != nil {
return err
}
if err := m.BulletAttr.ValidateWithPath(path + "/BulletAttr"); err != nil {
return err
}
if err := m.HrAttr.ValidateWithPath(path + "/HrAttr"); err != nil {
return err
}
if err := m.HrstdAttr.ValidateWithPath(path + "/HrstdAttr"); err != nil {
return err
}
if err := m.HrnoshadeAttr.ValidateWithPath(path + "/HrnoshadeAttr"); err != nil {
return err
}
if err := m.HralignAttr.ValidateWithPath(path + "/HralignAttr"); err != nil {
return err
}
if err := m.AllowincellAttr.ValidateWithPath(path + "/AllowincellAttr"); err != nil {
return err
}
if err := m.AllowoverlapAttr.ValidateWithPath(path + "/AllowoverlapAttr"); err != nil {
return err
}
if err := m.UserdrawnAttr.ValidateWithPath(path + "/UserdrawnAttr"); err != nil {
return err
}
if err := m.DgmlayoutAttr.ValidateWithPath(path + "/DgmlayoutAttr"); err != nil {
return err
}
if err := m.DgmlayoutmruAttr.ValidateWithPath(path + "/DgmlayoutmruAttr"); err != nil {
return err
}
if err := m.InsetmodeAttr.ValidateWithPath(path + "/InsetmodeAttr"); err != nil {
return err
}
if err := m.StrokedAttr.ValidateWithPath(path + "/StrokedAttr"); err != nil {
return err
}
if err := m.InsetpenAttr.ValidateWithPath(path + "/InsetpenAttr"); err != nil {
return err
}
if err := m.FilledAttr.ValidateWithPath(path + "/FilledAttr"); err != nil {
return err
}
if err := m.ConnectortypeAttr.ValidateWithPath(path + "/ConnectortypeAttr"); err != nil {
return err
}
if err := m.BwmodeAttr.ValidateWithPath(path + "/BwmodeAttr"); err != nil {
return err
}
if err := m.BwpureAttr.ValidateWithPath(path + "/BwpureAttr"); err != nil {
return err
}
if err := m.BwnormalAttr.ValidateWithPath(path + "/BwnormalAttr"); err != nil {
return err
}
if err := m.ForcedashAttr.ValidateWithPath(path + "/ForcedashAttr"); err != nil {
return err
}
if err := m.OleiconAttr.ValidateWithPath(path + "/OleiconAttr"); err != nil {
return err
}
if err := m.OleAttr.ValidateWithPath(path + "/OleAttr"); err != nil {
return err
}
if err := m.PreferrelativeAttr.ValidateWithPath(path + "/PreferrelativeAttr"); err != nil {
return err
}
if err := m.CliptowrapAttr.ValidateWithPath(path + "/CliptowrapAttr"); err != nil {
return err
}
if err := m.ClipAttr.ValidateWithPath(path + "/ClipAttr"); err != nil {
return err
}
return nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wx-fork/unioffice.git
git@gitee.com:wx-fork/unioffice.git
wx-fork
unioffice
unioffice
v0.6.0

搜索帮助