| 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.dml; |
|---|
| 23 | |
|---|
| 24 | import java.util.ArrayList; |
|---|
| 25 | import java.util.List; |
|---|
| 26 | |
|---|
| 27 | import javax.xml.bind.JAXBElement; |
|---|
| 28 | import javax.xml.bind.annotation.XmlAccessType; |
|---|
| 29 | import javax.xml.bind.annotation.XmlAccessorType; |
|---|
| 30 | import javax.xml.bind.annotation.XmlAnyElement; |
|---|
| 31 | import javax.xml.bind.annotation.XmlAttribute; |
|---|
| 32 | import javax.xml.bind.annotation.XmlSchemaType; |
|---|
| 33 | import javax.xml.bind.annotation.XmlType; |
|---|
| 34 | import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; |
|---|
| 35 | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
|---|
| 36 | |
|---|
| 37 | import org.docx4j.XmlUtils; |
|---|
| 38 | import org.docx4j.dml.picture.Pic; |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | /** |
|---|
| 42 | * <p>Java class for CT_GraphicalObjectData complex type. |
|---|
| 43 | * |
|---|
| 44 | * <p>The following schema fragment specifies the expected content contained within this class. |
|---|
| 45 | * |
|---|
| 46 | * <pre> |
|---|
| 47 | * <complexType name="CT_GraphicalObjectData"> |
|---|
| 48 | * <complexContent> |
|---|
| 49 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> |
|---|
| 50 | * <sequence> |
|---|
| 51 | * <any maxOccurs="unbounded" minOccurs="0"/> |
|---|
| 52 | * </sequence> |
|---|
| 53 | * <attribute name="uri" type="{http://www.w3.org/2001/XMLSchema}token" /> |
|---|
| 54 | * </restriction> |
|---|
| 55 | * </complexContent> |
|---|
| 56 | * </complexType> |
|---|
| 57 | * </pre> |
|---|
| 58 | * |
|---|
| 59 | * |
|---|
| 60 | */ |
|---|
| 61 | @XmlAccessorType(XmlAccessType.FIELD) |
|---|
| 62 | @XmlType(name = "CT_GraphicalObjectData", propOrder = { |
|---|
| 63 | "any" |
|---|
| 64 | }) |
|---|
| 65 | public class GraphicData { |
|---|
| 66 | |
|---|
| 67 | @XmlAnyElement(lax = true) |
|---|
| 68 | protected List<Object> any; |
|---|
| 69 | @XmlAttribute |
|---|
| 70 | @XmlJavaTypeAdapter(CollapsedStringAdapter.class) |
|---|
| 71 | @XmlSchemaType(name = "token") |
|---|
| 72 | protected String uri; |
|---|
| 73 | |
|---|
| 74 | /** |
|---|
| 75 | * Gets the value of the any property. |
|---|
| 76 | * |
|---|
| 77 | * <p> |
|---|
| 78 | * This accessor method returns a reference to the live list, |
|---|
| 79 | * not a snapshot. Therefore any modification you make to the |
|---|
| 80 | * returned list will be present inside the JAXB object. |
|---|
| 81 | * This is why there is not a <CODE>set</CODE> method for the any property. |
|---|
| 82 | * |
|---|
| 83 | * <p> |
|---|
| 84 | * For example, to add a new item, do as follows: |
|---|
| 85 | * <pre> |
|---|
| 86 | * getAny().add(newItem); |
|---|
| 87 | * </pre> |
|---|
| 88 | * |
|---|
| 89 | * |
|---|
| 90 | * <p> |
|---|
| 91 | * Objects of the following type(s) are allowed in the list |
|---|
| 92 | * {@link Object } |
|---|
| 93 | * |
|---|
| 94 | * |
|---|
| 95 | */ |
|---|
| 96 | public List<Object> getAny() { |
|---|
| 97 | if (any == null) { |
|---|
| 98 | any = new ArrayList<Object>(); |
|---|
| 99 | } |
|---|
| 100 | return this.any; |
|---|
| 101 | } |
|---|
| 102 | |
|---|
| 103 | public org.docx4j.dml.picture.Pic getPic() { |
|---|
| 104 | |
|---|
| 105 | for (Object o : getAny() ) { |
|---|
| 106 | |
|---|
| 107 | if (o instanceof JAXBElement |
|---|
| 108 | && ((JAXBElement)o).getDeclaredType().getName().equals("org.docx4j.dml.picture.Pic") ) { |
|---|
| 109 | |
|---|
| 110 | return (Pic)((JAXBElement)o).getValue(); |
|---|
| 111 | } |
|---|
| 112 | } |
|---|
| 113 | return null; |
|---|
| 114 | } |
|---|
| 115 | |
|---|
| 116 | /** |
|---|
| 117 | * Gets the value of the uri property. |
|---|
| 118 | * |
|---|
| 119 | * @return |
|---|
| 120 | * possible object is |
|---|
| 121 | * {@link String } |
|---|
| 122 | * |
|---|
| 123 | */ |
|---|
| 124 | public String getUri() { |
|---|
| 125 | return uri; |
|---|
| 126 | } |
|---|
| 127 | |
|---|
| 128 | /** |
|---|
| 129 | * Sets the value of the uri property. |
|---|
| 130 | * |
|---|
| 131 | * @param value |
|---|
| 132 | * allowed object is |
|---|
| 133 | * {@link String } |
|---|
| 134 | * |
|---|
| 135 | */ |
|---|
| 136 | public void setUri(String value) { |
|---|
| 137 | this.uri = value; |
|---|
| 138 | } |
|---|
| 139 | |
|---|
| 140 | } |
|---|