| 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.XmlElement; |
|---|
| 30 | import javax.xml.bind.annotation.XmlTransient; |
|---|
| 31 | import javax.xml.bind.annotation.XmlType; |
|---|
| 32 | import org.jvnet.jaxb2_commons.ppp.Child; |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | /** |
|---|
| 36 | * <p>Java class for CT_Captions complex type. |
|---|
| 37 | * |
|---|
| 38 | * <p>The following schema fragment specifies the expected content contained within this class. |
|---|
| 39 | * |
|---|
| 40 | * <pre> |
|---|
| 41 | * <complexType name="CT_Captions"> |
|---|
| 42 | * <complexContent> |
|---|
| 43 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> |
|---|
| 44 | * <sequence> |
|---|
| 45 | * <element name="caption" type="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}CT_Caption" maxOccurs="unbounded"/> |
|---|
| 46 | * <element name="autoCaptions" type="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}CT_AutoCaptions" minOccurs="0"/> |
|---|
| 47 | * </sequence> |
|---|
| 48 | * </restriction> |
|---|
| 49 | * </complexContent> |
|---|
| 50 | * </complexType> |
|---|
| 51 | * </pre> |
|---|
| 52 | * |
|---|
| 53 | * |
|---|
| 54 | */ |
|---|
| 55 | @XmlAccessorType(XmlAccessType.FIELD) |
|---|
| 56 | @XmlType(name = "CT_Captions", propOrder = { |
|---|
| 57 | "caption", |
|---|
| 58 | "autoCaptions" |
|---|
| 59 | }) |
|---|
| 60 | public class CTCaptions |
|---|
| 61 | implements Child |
|---|
| 62 | { |
|---|
| 63 | |
|---|
| 64 | @XmlElement(required = true) |
|---|
| 65 | protected List<CTCaption> caption; |
|---|
| 66 | protected CTAutoCaptions autoCaptions; |
|---|
| 67 | @XmlTransient |
|---|
| 68 | private Object parent; |
|---|
| 69 | |
|---|
| 70 | /** |
|---|
| 71 | * Gets the value of the caption property. |
|---|
| 72 | * |
|---|
| 73 | * <p> |
|---|
| 74 | * This accessor method returns a reference to the live list, |
|---|
| 75 | * not a snapshot. Therefore any modification you make to the |
|---|
| 76 | * returned list will be present inside the JAXB object. |
|---|
| 77 | * This is why there is not a <CODE>set</CODE> method for the caption property. |
|---|
| 78 | * |
|---|
| 79 | * <p> |
|---|
| 80 | * For example, to add a new item, do as follows: |
|---|
| 81 | * <pre> |
|---|
| 82 | * getCaption().add(newItem); |
|---|
| 83 | * </pre> |
|---|
| 84 | * |
|---|
| 85 | * |
|---|
| 86 | * <p> |
|---|
| 87 | * Objects of the following type(s) are allowed in the list |
|---|
| 88 | * {@link CTCaption } |
|---|
| 89 | * |
|---|
| 90 | * |
|---|
| 91 | */ |
|---|
| 92 | public List<CTCaption> getCaption() { |
|---|
| 93 | if (caption == null) { |
|---|
| 94 | caption = new ArrayList<CTCaption>(); |
|---|
| 95 | } |
|---|
| 96 | return this.caption; |
|---|
| 97 | } |
|---|
| 98 | |
|---|
| 99 | /** |
|---|
| 100 | * Gets the value of the autoCaptions property. |
|---|
| 101 | * |
|---|
| 102 | * @return |
|---|
| 103 | * possible object is |
|---|
| 104 | * {@link CTAutoCaptions } |
|---|
| 105 | * |
|---|
| 106 | */ |
|---|
| 107 | public CTAutoCaptions getAutoCaptions() { |
|---|
| 108 | return autoCaptions; |
|---|
| 109 | } |
|---|
| 110 | |
|---|
| 111 | /** |
|---|
| 112 | * Sets the value of the autoCaptions property. |
|---|
| 113 | * |
|---|
| 114 | * @param value |
|---|
| 115 | * allowed object is |
|---|
| 116 | * {@link CTAutoCaptions } |
|---|
| 117 | * |
|---|
| 118 | */ |
|---|
| 119 | public void setAutoCaptions(CTAutoCaptions value) { |
|---|
| 120 | this.autoCaptions = value; |
|---|
| 121 | } |
|---|
| 122 | |
|---|
| 123 | /** |
|---|
| 124 | * Gets the parent object in the object tree representing the unmarshalled xml document. |
|---|
| 125 | * |
|---|
| 126 | * @return |
|---|
| 127 | * The parent object. |
|---|
| 128 | */ |
|---|
| 129 | public Object getParent() { |
|---|
| 130 | return this.parent; |
|---|
| 131 | } |
|---|
| 132 | |
|---|
| 133 | public void setParent(Object parent) { |
|---|
| 134 | this.parent = parent; |
|---|
| 135 | } |
|---|
| 136 | |
|---|
| 137 | /** |
|---|
| 138 | * This method is invoked by the JAXB implementation on each instance when unmarshalling completes. |
|---|
| 139 | * |
|---|
| 140 | * @param parent |
|---|
| 141 | * The parent object in the object tree. |
|---|
| 142 | * @param unmarshaller |
|---|
| 143 | * The unmarshaller that generated the instance. |
|---|
| 144 | */ |
|---|
| 145 | public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { |
|---|
| 146 | setParent(parent); |
|---|
| 147 | } |
|---|
| 148 | |
|---|
| 149 | } |
|---|