| 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 | |
|---|
| 22 | package org.docx4j.wml; |
|---|
| 23 | |
|---|
| 24 | import java.util.ArrayList; |
|---|
| 25 | import java.util.List; |
|---|
| 26 | import javax.xml.bind.Unmarshaller; |
|---|
| 27 | import javax.xml.bind.annotation.XmlAccessType; |
|---|
| 28 | import javax.xml.bind.annotation.XmlAccessorType; |
|---|
| 29 | import javax.xml.bind.annotation.XmlAttribute; |
|---|
| 30 | import javax.xml.bind.annotation.XmlElement; |
|---|
| 31 | import javax.xml.bind.annotation.XmlElements; |
|---|
| 32 | import javax.xml.bind.annotation.XmlTransient; |
|---|
| 33 | import javax.xml.bind.annotation.XmlType; |
|---|
| 34 | import org.jvnet.jaxb2_commons.ppp.Child; |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | /** |
|---|
| 38 | * <p>Java class for CT_DocPartPr complex type. |
|---|
| 39 | * |
|---|
| 40 | * <p>The following schema fragment specifies the expected content contained within this class. |
|---|
| 41 | * |
|---|
| 42 | * <pre> |
|---|
| 43 | * <complexType name="CT_DocPartPr"> |
|---|
| 44 | * <complexContent> |
|---|
| 45 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> |
|---|
| 46 | * <choice maxOccurs="unbounded"> |
|---|
| 47 | * <element name="name" type="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}CT_DocPartName"/> |
|---|
| 48 | * <element name="style"> |
|---|
| 49 | * <complexType> |
|---|
| 50 | * <complexContent> |
|---|
| 51 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> |
|---|
| 52 | * <attribute name="val" type="{http://www.w3.org/2001/XMLSchema}string" /> |
|---|
| 53 | * </restriction> |
|---|
| 54 | * </complexContent> |
|---|
| 55 | * </complexType> |
|---|
| 56 | * </element> |
|---|
| 57 | * <element name="category" type="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}CT_DocPartCategory"/> |
|---|
| 58 | * <element name="types" type="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}CT_DocPartTypes"/> |
|---|
| 59 | * <element name="behaviors" type="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}CT_DocPartBehaviors"/> |
|---|
| 60 | * <element name="description"> |
|---|
| 61 | * <complexType> |
|---|
| 62 | * <complexContent> |
|---|
| 63 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> |
|---|
| 64 | * <attribute name="val" type="{http://www.w3.org/2001/XMLSchema}string" /> |
|---|
| 65 | * </restriction> |
|---|
| 66 | * </complexContent> |
|---|
| 67 | * </complexType> |
|---|
| 68 | * </element> |
|---|
| 69 | * <element name="guid" type="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}CT_Guid"/> |
|---|
| 70 | * </choice> |
|---|
| 71 | * </restriction> |
|---|
| 72 | * </complexContent> |
|---|
| 73 | * </complexType> |
|---|
| 74 | * </pre> |
|---|
| 75 | * |
|---|
| 76 | * |
|---|
| 77 | */ |
|---|
| 78 | @XmlAccessorType(XmlAccessType.FIELD) |
|---|
| 79 | @XmlType(name = "CT_DocPartPr", propOrder = { |
|---|
| 80 | "nameOrStyleOrCategory" |
|---|
| 81 | }) |
|---|
| 82 | public class CTDocPartPr |
|---|
| 83 | implements Child |
|---|
| 84 | { |
|---|
| 85 | |
|---|
| 86 | @XmlElements({ |
|---|
| 87 | @XmlElement(name = "description", type = CTDocPartPr.Description.class), |
|---|
| 88 | @XmlElement(name = "types", type = CTDocPartTypes.class), |
|---|
| 89 | @XmlElement(name = "name", type = CTDocPartName.class), |
|---|
| 90 | @XmlElement(name = "behaviors", type = CTDocPartBehaviors.class), |
|---|
| 91 | @XmlElement(name = "style", type = CTDocPartPr.Style.class), |
|---|
| 92 | @XmlElement(name = "category", type = CTDocPartCategory.class), |
|---|
| 93 | @XmlElement(name = "guid", type = CTGuid.class) |
|---|
| 94 | }) |
|---|
| 95 | protected List<Object> nameOrStyleOrCategory; |
|---|
| 96 | @XmlTransient |
|---|
| 97 | private Object parent; |
|---|
| 98 | |
|---|
| 99 | /** |
|---|
| 100 | * Gets the value of the nameOrStyleOrCategory property. |
|---|
| 101 | * |
|---|
| 102 | * <p> |
|---|
| 103 | * This accessor method returns a reference to the live list, |
|---|
| 104 | * not a snapshot. Therefore any modification you make to the |
|---|
| 105 | * returned list will be present inside the JAXB object. |
|---|
| 106 | * This is why there is not a <CODE>set</CODE> method for the nameOrStyleOrCategory property. |
|---|
| 107 | * |
|---|
| 108 | * <p> |
|---|
| 109 | * For example, to add a new item, do as follows: |
|---|
| 110 | * <pre> |
|---|
| 111 | * getNameOrStyleOrCategory().add(newItem); |
|---|
| 112 | * </pre> |
|---|
| 113 | * |
|---|
| 114 | * |
|---|
| 115 | * <p> |
|---|
| 116 | * Objects of the following type(s) are allowed in the list |
|---|
| 117 | * {@link CTDocPartPr.Description } |
|---|
| 118 | * {@link CTDocPartTypes } |
|---|
| 119 | * {@link CTDocPartName } |
|---|
| 120 | * {@link CTDocPartBehaviors } |
|---|
| 121 | * {@link CTDocPartPr.Style } |
|---|
| 122 | * {@link CTDocPartCategory } |
|---|
| 123 | * {@link CTGuid } |
|---|
| 124 | * |
|---|
| 125 | * |
|---|
| 126 | */ |
|---|
| 127 | public List<Object> getNameOrStyleOrCategory() { |
|---|
| 128 | if (nameOrStyleOrCategory == null) { |
|---|
| 129 | nameOrStyleOrCategory = new ArrayList<Object>(); |
|---|
| 130 | } |
|---|
| 131 | return this.nameOrStyleOrCategory; |
|---|
| 132 | } |
|---|
| 133 | |
|---|
| 134 | /** |
|---|
| 135 | * Gets the parent object in the object tree representing the unmarshalled xml document. |
|---|
| 136 | * |
|---|
| 137 | * @return |
|---|
| 138 | * The parent object. |
|---|
| 139 | */ |
|---|
| 140 | public Object getParent() { |
|---|
| 141 | return this.parent; |
|---|
| 142 | } |
|---|
| 143 | |
|---|
| 144 | public void setParent(Object parent) { |
|---|
| 145 | this.parent = parent; |
|---|
| 146 | } |
|---|
| 147 | |
|---|
| 148 | /** |
|---|
| 149 | * This method is invoked by the JAXB implementation on each instance when unmarshalling completes. |
|---|
| 150 | * |
|---|
| 151 | * @param parent |
|---|
| 152 | * The parent object in the object tree. |
|---|
| 153 | * @param unmarshaller |
|---|
| 154 | * The unmarshaller that generated the instance. |
|---|
| 155 | */ |
|---|
| 156 | public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { |
|---|
| 157 | setParent(parent); |
|---|
| 158 | } |
|---|
| 159 | |
|---|
| 160 | |
|---|
| 161 | /** |
|---|
| 162 | * <p>Java class for anonymous complex type. |
|---|
| 163 | * |
|---|
| 164 | * <p>The following schema fragment specifies the expected content contained within this class. |
|---|
| 165 | * |
|---|
| 166 | * <pre> |
|---|
| 167 | * <complexType> |
|---|
| 168 | * <complexContent> |
|---|
| 169 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> |
|---|
| 170 | * <attribute name="val" type="{http://www.w3.org/2001/XMLSchema}string" /> |
|---|
| 171 | * </restriction> |
|---|
| 172 | * </complexContent> |
|---|
| 173 | * </complexType> |
|---|
| 174 | * </pre> |
|---|
| 175 | * |
|---|
| 176 | * |
|---|
| 177 | */ |
|---|
| 178 | @XmlAccessorType(XmlAccessType.FIELD) |
|---|
| 179 | @XmlType(name = "") |
|---|
| 180 | public static class Description implements Child |
|---|
| 181 | { |
|---|
| 182 | |
|---|
| 183 | @XmlAttribute(namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main") |
|---|
| 184 | protected String val; |
|---|
| 185 | @XmlTransient |
|---|
| 186 | private Object parent; |
|---|
| 187 | |
|---|
| 188 | /** |
|---|
| 189 | * Gets the value of the val property. |
|---|
| 190 | * |
|---|
| 191 | * @return |
|---|
| 192 | * possible object is |
|---|
| 193 | * {@link String } |
|---|
| 194 | * |
|---|
| 195 | */ |
|---|
| 196 | public String getVal() { |
|---|
| 197 | return val; |
|---|
| 198 | } |
|---|
| 199 | |
|---|
| 200 | /** |
|---|
| 201 | * Sets the value of the val property. |
|---|
| 202 | * |
|---|
| 203 | * @param value |
|---|
| 204 | * allowed object is |
|---|
| 205 | * {@link String } |
|---|
| 206 | * |
|---|
| 207 | */ |
|---|
| 208 | public void setVal(String value) { |
|---|
| 209 | this.val = value; |
|---|
| 210 | } |
|---|
| 211 | |
|---|
| 212 | /** |
|---|
| 213 | * Gets the parent object in the object tree representing the unmarshalled xml document. |
|---|
| 214 | * |
|---|
| 215 | * @return |
|---|
| 216 | * The parent object. |
|---|
| 217 | */ |
|---|
| 218 | public Object getParent() { |
|---|
| 219 | return this.parent; |
|---|
| 220 | } |
|---|
| 221 | |
|---|
| 222 | public void setParent(Object parent) { |
|---|
| 223 | this.parent = parent; |
|---|
| 224 | } |
|---|
| 225 | |
|---|
| 226 | /** |
|---|
| 227 | * This method is invoked by the JAXB implementation on each instance when unmarshalling completes. |
|---|
| 228 | * |
|---|
| 229 | * @param parent |
|---|
| 230 | * The parent object in the object tree. |
|---|
| 231 | * @param unmarshaller |
|---|
| 232 | * The unmarshaller that generated the instance. |
|---|
| 233 | */ |
|---|
| 234 | public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { |
|---|
| 235 | setParent(parent); |
|---|
| 236 | } |
|---|
| 237 | |
|---|
| 238 | } |
|---|
| 239 | |
|---|
| 240 | |
|---|
| 241 | /** |
|---|
| 242 | * <p>Java class for anonymous complex type. |
|---|
| 243 | * |
|---|
| 244 | * <p>The following schema fragment specifies the expected content contained within this class. |
|---|
| 245 | * |
|---|
| 246 | * <pre> |
|---|
| 247 | * <complexType> |
|---|
| 248 | * <complexContent> |
|---|
| 249 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> |
|---|
| 250 | * <attribute name="val" type="{http://www.w3.org/2001/XMLSchema}string" /> |
|---|
| 251 | * </restriction> |
|---|
| 252 | * </complexContent> |
|---|
| 253 | * </complexType> |
|---|
| 254 | * </pre> |
|---|
| 255 | * |
|---|
| 256 | * |
|---|
| 257 | */ |
|---|
| 258 | @XmlAccessorType(XmlAccessType.FIELD) |
|---|
| 259 | @XmlType(name = "") |
|---|
| 260 | public static class Style implements Child |
|---|
| 261 | { |
|---|
| 262 | |
|---|
| 263 | @XmlAttribute(namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main") |
|---|
| 264 | protected String val; |
|---|
| 265 | @XmlTransient |
|---|
| 266 | private Object parent; |
|---|
| 267 | |
|---|
| 268 | /** |
|---|
| 269 | * Gets the value of the val property. |
|---|
| 270 | * |
|---|
| 271 | * @return |
|---|
| 272 | * possible object is |
|---|
| 273 | * {@link String } |
|---|
| 274 | * |
|---|
| 275 | */ |
|---|
| 276 | public String getVal() { |
|---|
| 277 | return val; |
|---|
| 278 | } |
|---|
| 279 | |
|---|
| 280 | /** |
|---|
| 281 | * Sets the value of the val property. |
|---|
| 282 | * |
|---|
| 283 | * @param value |
|---|
| 284 | * allowed object is |
|---|
| 285 | * {@link String } |
|---|
| 286 | * |
|---|
| 287 | */ |
|---|
| 288 | public void setVal(String value) { |
|---|
| 289 | this.val = value; |
|---|
| 290 | } |
|---|
| 291 | |
|---|
| 292 | /** |
|---|
| 293 | * Gets the parent object in the object tree representing the unmarshalled xml document. |
|---|
| 294 | * |
|---|
| 295 | * @return |
|---|
| 296 | * The parent object. |
|---|
| 297 | */ |
|---|
| 298 | public Object getParent() { |
|---|
| 299 | return this.parent; |
|---|
| 300 | } |
|---|
| 301 | |
|---|
| 302 | public void setParent(Object parent) { |
|---|
| 303 | this.parent = parent; |
|---|
| 304 | } |
|---|
| 305 | |
|---|
| 306 | /** |
|---|
| 307 | * This method is invoked by the JAXB implementation on each instance when unmarshalling completes. |
|---|
| 308 | * |
|---|
| 309 | * @param parent |
|---|
| 310 | * The parent object in the object tree. |
|---|
| 311 | * @param unmarshaller |
|---|
| 312 | * The unmarshaller that generated the instance. |
|---|
| 313 | */ |
|---|
| 314 | public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { |
|---|
| 315 | setParent(parent); |
|---|
| 316 | } |
|---|
| 317 | |
|---|
| 318 | } |
|---|
| 319 | |
|---|
| 320 | } |
|---|