2017-08-28 20:56:18 -05:00
|
|
|
// Copyright 2017 Baliance. All rights reserved.
|
|
|
|
//
|
2017-09-09 10:21:47 -05:00
|
|
|
// 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-10 10:02:39 -05:00
|
|
|
package wordprocessingml
|
2017-08-28 20:56:18 -05:00
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/xml"
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"baliance.com/gooxml/schema/schemas.openxmlformats.org/drawingml"
|
|
|
|
)
|
|
|
|
|
2017-09-10 10:02:39 -05:00
|
|
|
type WdCT_WordprocessingCanvas struct {
|
2017-08-28 20:56:18 -05:00
|
|
|
Bg *drawingml.CT_BackgroundFormatting
|
|
|
|
Whole *drawingml.CT_WholeE2oFormatting
|
2017-09-10 10:02:39 -05:00
|
|
|
Choice []*WdCT_WordprocessingCanvasChoice
|
2017-08-28 20:56:18 -05:00
|
|
|
ExtLst *drawingml.CT_OfficeArtExtensionList
|
|
|
|
}
|
|
|
|
|
2017-09-10 10:02:39 -05:00
|
|
|
func NewWdCT_WordprocessingCanvas() *WdCT_WordprocessingCanvas {
|
|
|
|
ret := &WdCT_WordprocessingCanvas{}
|
2017-08-28 20:56:18 -05:00
|
|
|
return ret
|
|
|
|
}
|
2017-09-01 15:19:23 -05:00
|
|
|
|
2017-09-10 10:02:39 -05:00
|
|
|
func (m *WdCT_WordprocessingCanvas) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
|
2017-08-28 20:56:18 -05:00
|
|
|
e.EncodeToken(start)
|
|
|
|
if m.Bg != nil {
|
|
|
|
sebg := xml.StartElement{Name: xml.Name{Local: "wp:bg"}}
|
|
|
|
e.EncodeElement(m.Bg, sebg)
|
|
|
|
}
|
|
|
|
if m.Whole != nil {
|
|
|
|
sewhole := xml.StartElement{Name: xml.Name{Local: "wp:whole"}}
|
|
|
|
e.EncodeElement(m.Whole, sewhole)
|
|
|
|
}
|
|
|
|
if m.Choice != nil {
|
|
|
|
for _, c := range m.Choice {
|
2017-09-04 13:47:32 -05:00
|
|
|
c.MarshalXML(e, xml.StartElement{})
|
2017-08-28 20:56:18 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if m.ExtLst != nil {
|
|
|
|
seextLst := xml.StartElement{Name: xml.Name{Local: "wp:extLst"}}
|
|
|
|
e.EncodeElement(m.ExtLst, seextLst)
|
|
|
|
}
|
|
|
|
e.EncodeToken(xml.EndElement{Name: start.Name})
|
|
|
|
return nil
|
|
|
|
}
|
2017-09-01 15:19:23 -05:00
|
|
|
|
2017-09-10 10:02:39 -05:00
|
|
|
func (m *WdCT_WordprocessingCanvas) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
|
2017-08-28 20:56:18 -05:00
|
|
|
// initialize to default
|
2017-09-10 10:02:39 -05:00
|
|
|
lWdCT_WordprocessingCanvas:
|
2017-08-28 20:56:18 -05:00
|
|
|
for {
|
|
|
|
tok, err := d.Token()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
switch el := tok.(type) {
|
|
|
|
case xml.StartElement:
|
2017-09-10 10:02:39 -05:00
|
|
|
switch el.Name {
|
|
|
|
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", Local: "bg"}:
|
2017-08-28 20:56:18 -05:00
|
|
|
m.Bg = drawingml.NewCT_BackgroundFormatting()
|
|
|
|
if err := d.DecodeElement(m.Bg, &el); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2017-09-10 10:02:39 -05:00
|
|
|
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", Local: "whole"}:
|
2017-08-28 20:56:18 -05:00
|
|
|
m.Whole = drawingml.NewCT_WholeE2oFormatting()
|
|
|
|
if err := d.DecodeElement(m.Whole, &el); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2017-09-10 10:02:39 -05:00
|
|
|
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", Local: "wsp"}:
|
|
|
|
tmp := NewWdCT_WordprocessingCanvasChoice()
|
2017-08-28 20:56:18 -05:00
|
|
|
if err := d.DecodeElement(&tmp.Wsp, &el); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
m.Choice = append(m.Choice, tmp)
|
2017-09-10 10:02:39 -05:00
|
|
|
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/picture", Local: "pic"}:
|
|
|
|
tmp := NewWdCT_WordprocessingCanvasChoice()
|
2017-08-28 20:56:18 -05:00
|
|
|
if err := d.DecodeElement(&tmp.Pic, &el); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
m.Choice = append(m.Choice, tmp)
|
2017-09-10 10:02:39 -05:00
|
|
|
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", Local: "contentPart"}:
|
|
|
|
tmp := NewWdCT_WordprocessingCanvasChoice()
|
2017-08-28 20:56:18 -05:00
|
|
|
if err := d.DecodeElement(&tmp.ContentPart, &el); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
m.Choice = append(m.Choice, tmp)
|
2017-09-10 10:02:39 -05:00
|
|
|
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", Local: "wgp"}:
|
|
|
|
tmp := NewWdCT_WordprocessingCanvasChoice()
|
2017-08-28 20:56:18 -05:00
|
|
|
if err := d.DecodeElement(&tmp.Wgp, &el); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
m.Choice = append(m.Choice, tmp)
|
2017-09-10 10:02:39 -05:00
|
|
|
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", Local: "graphicFrame"}:
|
|
|
|
tmp := NewWdCT_WordprocessingCanvasChoice()
|
2017-08-28 20:56:18 -05:00
|
|
|
if err := d.DecodeElement(&tmp.GraphicFrame, &el); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
m.Choice = append(m.Choice, tmp)
|
2017-09-10 10:02:39 -05:00
|
|
|
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", Local: "extLst"}:
|
2017-08-28 20:56:18 -05:00
|
|
|
m.ExtLst = drawingml.NewCT_OfficeArtExtensionList()
|
|
|
|
if err := d.DecodeElement(m.ExtLst, &el); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
default:
|
2017-09-10 10:02:39 -05:00
|
|
|
log.Printf("skipping unsupported element on WdCT_WordprocessingCanvas %v", el.Name)
|
2017-08-28 20:56:18 -05:00
|
|
|
if err := d.Skip(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case xml.EndElement:
|
2017-09-10 10:02:39 -05:00
|
|
|
break lWdCT_WordprocessingCanvas
|
2017-08-28 20:56:18 -05:00
|
|
|
case xml.CharData:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
2017-09-01 15:19:23 -05:00
|
|
|
|
2017-09-10 10:02:39 -05:00
|
|
|
// Validate validates the WdCT_WordprocessingCanvas and its children
|
|
|
|
func (m *WdCT_WordprocessingCanvas) Validate() error {
|
|
|
|
return m.ValidateWithPath("WdCT_WordprocessingCanvas")
|
2017-08-28 20:56:18 -05:00
|
|
|
}
|
2017-09-01 15:19:23 -05:00
|
|
|
|
2017-09-10 10:02:39 -05:00
|
|
|
// ValidateWithPath validates the WdCT_WordprocessingCanvas and its children, prefixing error messages with path
|
|
|
|
func (m *WdCT_WordprocessingCanvas) ValidateWithPath(path string) error {
|
2017-08-28 20:56:18 -05:00
|
|
|
if m.Bg != nil {
|
|
|
|
if err := m.Bg.ValidateWithPath(path + "/Bg"); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if m.Whole != nil {
|
|
|
|
if err := m.Whole.ValidateWithPath(path + "/Whole"); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for i, v := range m.Choice {
|
|
|
|
if err := v.ValidateWithPath(fmt.Sprintf("%s/Choice[%d]", path, i)); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if m.ExtLst != nil {
|
|
|
|
if err := m.ExtLst.ValidateWithPath(path + "/ExtLst"); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|