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

Revision 1473, 12.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.XmlAttribute;
31import javax.xml.bind.annotation.XmlElementRef;
32import javax.xml.bind.annotation.XmlElementRefs;
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_CustomXmlRun 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_CustomXmlRun">
47 *   &lt;complexContent>
48 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
49 *       &lt;sequence>
50 *         &lt;element name="customXmlPr" type="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}CT_CustomXmlPr" minOccurs="0"/>
51 *         &lt;group ref="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}EG_PContent" maxOccurs="unbounded" minOccurs="0"/>
52 *       &lt;/sequence>
53 *       &lt;attribute name="uri" type="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}ST_String" />
54 *       &lt;attribute name="element" use="required" type="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}ST_String" />
55 *     &lt;/restriction>
56 *   &lt;/complexContent>
57 * &lt;/complexType>
58 * </pre>
59 *
60 *
61 */
62@XmlAccessorType(XmlAccessType.FIELD)
63@XmlType(name = "CT_CustomXmlRun", propOrder = {
64    "customXmlPr",
65    "paragraphContent"
66})
67public class CTCustomXmlRun implements CTCustomXmlElement, ContentAccessor
68{
69
70    protected CTCustomXmlPr customXmlPr;
71    @XmlElementRefs({
72        @XmlElementRef(name = "fldSimple", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
73        @XmlElementRef(name = "permEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
74        @XmlElementRef(name = "customXmlDelRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
75        @XmlElementRef(name = "commentRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = CommentRangeStart.class),
76        @XmlElementRef(name = "customXmlDelRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
77        @XmlElementRef(name = "ins", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = RunIns.class),
78        @XmlElementRef(name = "moveFrom", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
79        @XmlElementRef(name = "moveToRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
80        @XmlElementRef(name = "r", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = R.class),
81        @XmlElementRef(name = "oMath", namespace = "http://schemas.openxmlformats.org/officeDocument/2006/math", type = JAXBElement.class),
82        @XmlElementRef(name = "sdt", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
83        @XmlElementRef(name = "subDoc", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
84        @XmlElementRef(name = "moveFromRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
85        @XmlElementRef(name = "customXmlMoveFromRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
86        @XmlElementRef(name = "commentRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = CommentRangeEnd.class),
87        @XmlElementRef(name = "moveTo", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
88        @XmlElementRef(name = "bookmarkStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
89        @XmlElementRef(name = "customXmlInsRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
90        @XmlElementRef(name = "customXmlInsRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
91        @XmlElementRef(name = "bookmarkEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
92        @XmlElementRef(name = "moveToRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
93        @XmlElementRef(name = "proofErr", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = ProofErr.class),
94        @XmlElementRef(name = "del", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = RunDel.class),
95        @XmlElementRef(name = "customXmlMoveToRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
96        @XmlElementRef(name = "oMathPara", namespace = "http://schemas.openxmlformats.org/officeDocument/2006/math", type = JAXBElement.class),
97        @XmlElementRef(name = "customXml", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
98        @XmlElementRef(name = "customXmlMoveFromRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
99        @XmlElementRef(name = "smartTag", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
100        @XmlElementRef(name = "hyperlink", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
101        @XmlElementRef(name = "permStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
102        @XmlElementRef(name = "customXmlMoveToRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
103        @XmlElementRef(name = "moveFromRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class)
104    })
105    protected List<Object> paragraphContent;
106    @XmlAttribute(namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")
107    protected String uri;
108    @XmlAttribute(namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", required = true)
109    protected String element;
110    @XmlTransient
111    private Object parent;
112
113    /**
114     * Gets the value of the customXmlPr property.
115     *
116     * @return
117     *     possible object is
118     *     {@link CTCustomXmlPr }
119     *     
120     */
121    public CTCustomXmlPr getCustomXmlPr() {
122        if(this.customXmlPr == null) {
123            this.customXmlPr = new CTCustomXmlPr();
124        }
125        return this.customXmlPr;
126    }
127
128    /**
129     * Sets the value of the customXmlPr property.
130     *
131     * @param value
132     *     allowed object is
133     *     {@link CTCustomXmlPr }
134     *     
135     */
136    public void setCustomXmlPr(CTCustomXmlPr value) {
137        this.customXmlPr = value;
138    }
139
140    /**
141     * Gets the value of the paragraphContent property.
142     *
143     * <p>
144     * This accessor method returns a reference to the live list,
145     * not a snapshot. Therefore any modification you make to the
146     * returned list will be present inside the JAXB object.
147     * This is why there is not a <CODE>set</CODE> method for the paragraphContent property.
148     *
149     * <p>
150     * For example, to add a new item, do as follows:
151     * <pre>
152     *    getParagraphContent().add(newItem);
153     * </pre>
154     *
155     *
156     * <p>
157     * Objects of the following type(s) are allowed in the list
158     * {@link JAXBElement }{@code <}{@link CTSimpleField }{@code >}
159     * {@link JAXBElement }{@code <}{@link CTPerm }{@code >}
160     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
161     * {@link CommentRangeStart }
162     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
163     * {@link RunIns }
164     * {@link JAXBElement }{@code <}{@link RunTrackChange }{@code >}
165     * {@link JAXBElement }{@code <}{@link CTMoveBookmark }{@code >}
166     * {@link R }
167     * {@link JAXBElement }{@code <}{@link CTOMath }{@code >}
168     * {@link JAXBElement }{@code <}{@link SdtRun }{@code >}
169     * {@link JAXBElement }{@code <}{@link CTRel }{@code >}
170     * {@link JAXBElement }{@code <}{@link CTMoveBookmark }{@code >}
171     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
172     * {@link CommentRangeEnd }
173     * {@link JAXBElement }{@code <}{@link RunTrackChange }{@code >}
174     * {@link JAXBElement }{@code <}{@link CTBookmark }{@code >}
175     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
176     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
177     * {@link JAXBElement }{@code <}{@link CTMarkupRange }{@code >}
178     * {@link JAXBElement }{@code <}{@link CTMarkupRange }{@code >}
179     * {@link ProofErr }
180     * {@link RunDel }
181     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
182     * {@link JAXBElement }{@code <}{@link CTCustomXmlRun }{@code >}
183     * {@link JAXBElement }{@code <}{@link CTOMathPara }{@code >}
184     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
185     * {@link JAXBElement }{@code <}{@link org.docx4j.wml.P.Hyperlink }{@code >}
186     * {@link JAXBElement }{@code <}{@link CTSmartTagRun }{@code >}
187     * {@link JAXBElement }{@code <}{@link RangePermissionStart }{@code >}
188     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
189     * {@link JAXBElement }{@code <}{@link CTMarkupRange }{@code >}
190     *
191     *
192     */
193    @Deprecated
194    public List<Object> getParagraphContent() {
195        if (paragraphContent == null) {
196            paragraphContent = new ArrayList<Object>();
197        }
198        return this.paragraphContent;
199    }
200   
201    /**
202     * Get the content of this element.
203     * @since 2.7
204     */
205    public List<Object> getContent() {
206        return getParagraphContent();
207    }
208
209    /**
210     * Gets the value of the uri property.
211     *
212     * @return
213     *     possible object is
214     *     {@link String }
215     *     
216     */
217    public String getUri() {
218        return uri;
219    }
220
221    /**
222     * Sets the value of the uri property.
223     *
224     * @param value
225     *     allowed object is
226     *     {@link String }
227     *     
228     */
229    public void setUri(String value) {
230        this.uri = value;
231    }
232
233    /**
234     * Gets the value of the element property.
235     *
236     * @return
237     *     possible object is
238     *     {@link String }
239     *     
240     */
241    public String getElement() {
242        return element;
243    }
244
245    /**
246     * Sets the value of the element property.
247     *
248     * @param value
249     *     allowed object is
250     *     {@link String }
251     *     
252     */
253    public void setElement(String value) {
254        this.element = value;
255    }
256
257    /**
258     * Gets the parent object in the object tree representing the unmarshalled xml document.
259     *
260     * @return
261     *     The parent object.
262     */
263    public Object getParent() {
264        return this.parent;
265    }
266
267    public void setParent(Object parent) {
268        this.parent = parent;
269    }
270
271    /**
272     * This method is invoked by the JAXB implementation on each instance when unmarshalling completes.
273     *
274     * @param parent
275     *     The parent object in the object tree.
276     * @param unmarshaller
277     *     The unmarshaller that generated the instance.
278     */
279    public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
280        setParent(parent);
281    }
282
283}
Note: See TracBrowser for help on using the repository browser.