org.docx4j.wml.Highlight Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docx4j Show documentation
Show all versions of docx4j Show documentation
docx4j is a library which helps you to work with the Office Open
XML file format as used in docx
documents, pptx presentations, and xlsx spreadsheets.
/*
* Copyright 2007-2013, Plutext Pty Ltd.
*
* This file is part of docx4j.
docx4j is licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.docx4j.wml;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import org.jvnet.jaxb2_commons.ppp.Child;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Java class for anonymous complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="val" use="required">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="black",
* <enumeration value="blue",
* <enumeration value="cyan",
* <enumeration value="green",
* <enumeration value="magenta",
* <enumeration value="red",
* <enumeration value="yellow",
* <enumeration value="white",
* <enumeration value="darkBlue",
* <enumeration value="darkCyan",
* <enumeration value="darkGreen",
* <enumeration value="darkMagenta",
* <enumeration value="darkRed",
* <enumeration value="darkYellow",
* <enumeration value="darkGray",
* <enumeration value="lightGray",
* <enumeration value="none",
* </restriction>
* </simpleType>
* </attribute>
* </restriction>
* </complexContent>
* </complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@XmlRootElement(name = "highlight")
public class Highlight implements Child
{
protected static Logger log = LoggerFactory.getLogger(Highlight.class);
// See http://www.w3.org/TR/css3-color/#svg-color, except for darkYellow (for which I've used gold)
private final static String[][] colors = { { "black", "000000" }, { "blue", "0000FF" },
{ "cyan", "00FFFF" }, { "green", "008000" },
{ "magenta", "FF00FF" }, { "red", "FF0000" },
{ "yellow", "FFFF00" }, { "white", "FFFFFF" },
{ "darkBlue", "00008B" }, { "darkCyan", "008B8B" },
{ "darkGreen", "006400" }, { "darkMagenta", "8B008B" },
{ "darkRed", "8B0000" }, { "darkYellow", "FFD700" },
{ "darkGray", "A9A9A9" }, { "lightGray", "D3D3D3" } };
@XmlAttribute(name = "val", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", required = true)
protected String val;
@XmlTransient
private Object parent;
/**
* Gets the value of the val property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVal() {
return val;
}
public String getHexVal() {
if (val==null) return null;
for (int i = 0; i