// Copyright 2020 FoxyUtils ehf. All rights reserved. // // DO NOT EDIT: generated by unioffice ECMA-376 generator // // Use of this software package and source code is governed by the terms of the // UniDoc End User License Agreement (EULA) that is available at: // https://unidoc.io/eula/ // A trial license code for evaluation can be obtained at https://unidoc.io website. package pml import ( "encoding/xml" "github.com/unidoc/unioffice" "github.com/unidoc/unioffice/schema/soo/dml" ) type CT_GraphicalObjectFrame struct { BwModeAttr dml.ST_BlackWhiteMode // Non-Visual Properties for a Graphic Frame NvGraphicFramePr *CT_GraphicalObjectFrameNonVisual // 2D Transform for Graphic Frame Xfrm *dml.CT_Transform2D Graphic *dml.Graphic // Extension List with Modification Flag ExtLst *CT_ExtensionListModify } func NewCT_GraphicalObjectFrame() *CT_GraphicalObjectFrame { ret := &CT_GraphicalObjectFrame{} ret.NvGraphicFramePr = NewCT_GraphicalObjectFrameNonVisual() ret.Xfrm = dml.NewCT_Transform2D() ret.Graphic = dml.NewGraphic() return ret } func (m *CT_GraphicalObjectFrame) MarshalXML(e *xml.Encoder, start xml.StartElement) error { if m.BwModeAttr != dml.ST_BlackWhiteModeUnset { attr, err := m.BwModeAttr.MarshalXMLAttr(xml.Name{Local: "bwMode"}) if err != nil { return err } start.Attr = append(start.Attr, attr) } e.EncodeToken(start) senvGraphicFramePr := xml.StartElement{Name: xml.Name{Local: "p:nvGraphicFramePr"}} e.EncodeElement(m.NvGraphicFramePr, senvGraphicFramePr) sexfrm := xml.StartElement{Name: xml.Name{Local: "p:xfrm"}} e.EncodeElement(m.Xfrm, sexfrm) segraphic := xml.StartElement{Name: xml.Name{Local: "a:graphic"}} e.EncodeElement(m.Graphic, segraphic) if m.ExtLst != nil { seextLst := xml.StartElement{Name: xml.Name{Local: "p:extLst"}} e.EncodeElement(m.ExtLst, seextLst) } e.EncodeToken(xml.EndElement{Name: start.Name}) return nil } func (m *CT_GraphicalObjectFrame) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { // initialize to default m.NvGraphicFramePr = NewCT_GraphicalObjectFrameNonVisual() m.Xfrm = dml.NewCT_Transform2D() m.Graphic = dml.NewGraphic() for _, attr := range start.Attr { if attr.Name.Local == "bwMode" { m.BwModeAttr.UnmarshalXMLAttr(attr) continue } } lCT_GraphicalObjectFrame: 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/presentationml/2006/main", Local: "nvGraphicFramePr"}, xml.Name{Space: "http://purl.oclc.org/ooxml/presentationml/main", Local: "nvGraphicFramePr"}: if err := d.DecodeElement(m.NvGraphicFramePr, &el); err != nil { return err } case xml.Name{Space: "http://schemas.openxmlformats.org/presentationml/2006/main", Local: "xfrm"}, xml.Name{Space: "http://purl.oclc.org/ooxml/presentationml/main", Local: "xfrm"}: if err := d.DecodeElement(m.Xfrm, &el); err != nil { return err } case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/main", Local: "graphic"}, xml.Name{Space: "http://purl.oclc.org/ooxml/drawingml/main", Local: "graphic"}: if err := d.DecodeElement(m.Graphic, &el); err != nil { return err } case xml.Name{Space: "http://schemas.openxmlformats.org/presentationml/2006/main", Local: "extLst"}, xml.Name{Space: "http://purl.oclc.org/ooxml/presentationml/main", Local: "extLst"}: m.ExtLst = NewCT_ExtensionListModify() if err := d.DecodeElement(m.ExtLst, &el); err != nil { return err } default: unioffice.Log("skipping unsupported element on CT_GraphicalObjectFrame %v", el.Name) if err := d.Skip(); err != nil { return err } } case xml.EndElement: break lCT_GraphicalObjectFrame case xml.CharData: } } return nil } // Validate validates the CT_GraphicalObjectFrame and its children func (m *CT_GraphicalObjectFrame) Validate() error { return m.ValidateWithPath("CT_GraphicalObjectFrame") } // ValidateWithPath validates the CT_GraphicalObjectFrame and its children, prefixing error messages with path func (m *CT_GraphicalObjectFrame) ValidateWithPath(path string) error { if err := m.BwModeAttr.ValidateWithPath(path + "/BwModeAttr"); err != nil { return err } if err := m.NvGraphicFramePr.ValidateWithPath(path + "/NvGraphicFramePr"); err != nil { return err } if err := m.Xfrm.ValidateWithPath(path + "/Xfrm"); err != nil { return err } if err := m.Graphic.ValidateWithPath(path + "/Graphic"); err != nil { return err } if m.ExtLst != nil { if err := m.ExtLst.ValidateWithPath(path + "/ExtLst"); err != nil { return err } } return nil }