source: trunk/docx4j/src/main/java/org/docx4j/wml/Body.java @ 1473

Revision 1473, 10.5 KB checked in by jharrop, 13 months ago (diff)

Implement ContentAccessor? interface

Line 
1/*
2 *  Copyright 2007-2008, Plutext Pty Ltd.
3 *   
4 *  This file is part of docx4j.
5
6    docx4j is licensed under the Apache License, Version 2.0 (the "License");
7    you may not use this file except in compliance with the License.
8
9    You may obtain a copy of the License at
10
11        http://www.apache.org/licenses/LICENSE-2.0
12
13    Unless required by applicable law or agreed to in writing, software
14    distributed under the License is distributed on an "AS IS" BASIS,
15    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16    See the License for the specific language governing permissions and
17    limitations under the License.
18
19 */
20
21
22package org.docx4j.wml;
23
24import java.util.ArrayList;
25import java.util.List;
26import javax.xml.bind.JAXBElement;
27import javax.xml.bind.Unmarshaller;
28import javax.xml.bind.annotation.XmlAccessType;
29import javax.xml.bind.annotation.XmlAccessorType;
30import javax.xml.bind.annotation.XmlElementRef;
31import javax.xml.bind.annotation.XmlElementRefs;
32import javax.xml.bind.annotation.XmlRootElement;
33import javax.xml.bind.annotation.XmlTransient;
34import javax.xml.bind.annotation.XmlType;
35import org.docx4j.math.CTOMath;
36import org.docx4j.math.CTOMathPara;
37import org.jvnet.jaxb2_commons.ppp.Child;
38
39
40/**
41 * <p>Java class for CT_Body complex type.
42 *
43 * <p>The following schema fragment specifies the expected content contained within this class.
44 *
45 * <pre>
46 * &lt;complexType name="CT_Body">
47 *   &lt;complexContent>
48 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
49 *       &lt;sequence>
50 *         &lt;group ref="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}EG_BlockLevelElts" maxOccurs="unbounded" minOccurs="0"/>
51 *         &lt;element name="sectPr" type="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}CT_SectPr" minOccurs="0"/>
52 *       &lt;/sequence>
53 *     &lt;/restriction>
54 *   &lt;/complexContent>
55 * &lt;/complexType>
56 * </pre>
57 *
58 *
59 */
60@XmlAccessorType(XmlAccessType.FIELD)
61@XmlType(name = "CT_Body", propOrder = {
62    "egBlockLevelElts",
63    "sectPr"
64})
65@XmlRootElement(name = "body")
66public class Body
67    implements Child, ContentAccessor
68{
69
70    @XmlElementRefs({
71        @XmlElementRef(name = "moveFrom", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
72        @XmlElementRef(name = "moveToRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
73        @XmlElementRef(name = "customXmlDelRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
74        @XmlElementRef(name = "commentRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = CommentRangeStart.class),
75        @XmlElementRef(name = "moveToRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
76        @XmlElementRef(name = "ins", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = RunIns.class),
77        @XmlElementRef(name = "customXmlMoveToRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
78        @XmlElementRef(name = "p", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = P.class),
79        @XmlElementRef(name = "customXmlInsRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
80        @XmlElementRef(name = "oMath", namespace = "http://schemas.openxmlformats.org/officeDocument/2006/math", type = JAXBElement.class),
81        @XmlElementRef(name = "customXmlMoveToRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
82        @XmlElementRef(name = "sdt", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = SdtBlock.class),
83        @XmlElementRef(name = "permStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
84        @XmlElementRef(name = "commentRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = CommentRangeEnd.class),
85        @XmlElementRef(name = "customXmlInsRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
86        @XmlElementRef(name = "permEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
87        @XmlElementRef(name = "customXmlDelRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
88        @XmlElementRef(name = "moveTo", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
89        @XmlElementRef(name = "proofErr", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = ProofErr.class),
90        @XmlElementRef(name = "del", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = RunDel.class),
91        @XmlElementRef(name = "customXmlMoveFromRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
92        @XmlElementRef(name = "bookmarkEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
93        @XmlElementRef(name = "oMathPara", namespace = "http://schemas.openxmlformats.org/officeDocument/2006/math", type = JAXBElement.class),
94        @XmlElementRef(name = "tbl", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
95        @XmlElementRef(name = "moveFromRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
96        @XmlElementRef(name = "bookmarkStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
97        @XmlElementRef(name = "customXmlMoveFromRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
98        @XmlElementRef(name = "customXml", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
99        @XmlElementRef(name = "moveFromRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
100        @XmlElementRef(name = "altChunk", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class)
101    })
102    protected List<Object> egBlockLevelElts;
103    protected SectPr sectPr;
104    @XmlTransient
105    private Object parent;
106
107    /**
108     * Gets the value of the egBlockLevelElts property.
109     *
110     * <p>
111     * This accessor method returns a reference to the live list,
112     * not a snapshot. Therefore any modification you make to the
113     * returned list will be present inside the JAXB object.
114     * This is why there is not a <CODE>set</CODE> method for the egBlockLevelElts property.
115     *
116     * <p>
117     * For example, to add a new item, do as follows:
118     * <pre>
119     *    getEGBlockLevelElts().add(newItem);
120     * </pre>
121     *
122     *
123     * <p>
124     * Objects of the following type(s) are allowed in the list
125     * {@link JAXBElement }{@code <}{@link RunTrackChange }{@code >}
126     * {@link JAXBElement }{@code <}{@link CTMarkupRange }{@code >}
127     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
128     * {@link CommentRangeStart }
129     * {@link JAXBElement }{@code <}{@link CTMoveBookmark }{@code >}
130     * {@link RunIns }
131     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
132     * {@link P }
133     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
134     * {@link JAXBElement }{@code <}{@link CTOMath }{@code >}
135     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
136     * {@link SdtBlock }
137     * {@link JAXBElement }{@code <}{@link RangePermissionStart }{@code >}
138     * {@link CommentRangeEnd }
139     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
140     * {@link JAXBElement }{@code <}{@link CTPerm }{@code >}
141     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
142     * {@link JAXBElement }{@code <}{@link RunTrackChange }{@code >}
143     * {@link ProofErr }
144     * {@link RunDel }
145     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
146     * {@link JAXBElement }{@code <}{@link CTMarkupRange }{@code >}
147     * {@link JAXBElement }{@code <}{@link CTOMathPara }{@code >}
148     * {@link JAXBElement }{@code <}{@link Tbl }{@code >}
149     * {@link JAXBElement }{@code <}{@link CTMarkupRange }{@code >}
150     * {@link JAXBElement }{@code <}{@link CTBookmark }{@code >}
151     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
152     * {@link JAXBElement }{@code <}{@link CTMoveBookmark }{@code >}
153     * {@link JAXBElement }{@code <}{@link CTCustomXmlBlock }{@code >}
154     * {@link JAXBElement }{@code <}{@link CTAltChunk }{@code >}
155     *
156     *
157     */
158    @Deprecated
159    public List<Object> getEGBlockLevelElts() {
160        if (egBlockLevelElts == null) {
161            egBlockLevelElts = new ArrayList<Object>();
162        }
163        return this.egBlockLevelElts;
164    }
165
166    /**
167     * Get the content of this element.
168     * @since 2.7
169     */
170    public List<Object> getContent() {
171        if (egBlockLevelElts == null) {
172            egBlockLevelElts = new ArrayList<Object>();
173        }
174        return this.egBlockLevelElts;
175    }
176   
177    /**
178     * Gets the value of the sectPr property.
179     *
180     * @return
181     *     possible object is
182     *     {@link SectPr }
183     *     
184     */
185    public SectPr getSectPr() {
186        return sectPr;
187    }
188
189    /**
190     * Sets the value of the sectPr property.
191     *
192     * @param value
193     *     allowed object is
194     *     {@link SectPr }
195     *     
196     */
197    public void setSectPr(SectPr value) {
198        this.sectPr = value;
199    }
200
201    /**
202     * Gets the parent object in the object tree representing the unmarshalled xml document.
203     *
204     * @return
205     *     The parent object.
206     */
207    public Object getParent() {
208        return this.parent;
209    }
210
211    public void setParent(Object parent) {
212        this.parent = parent;
213    }
214
215    /**
216     * This method is invoked by the JAXB implementation on each instance when unmarshalling completes.
217     *
218     * @param parent
219     *     The parent object in the object tree.
220     * @param unmarshaller
221     *     The unmarshaller that generated the instance.
222     */
223    public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
224        setParent(parent);
225    }
226
227}
Note: See TracBrowser for help on using the repository browser.