001/*
002 * Copyright (c) 2000 World Wide Web Consortium,
003 * (Massachusetts Institute of Technology, Institut National de
004 * Recherche en Informatique et en Automatique, Keio University). All
005 * Rights Reserved. This program is distributed under the W3C's Software
006 * Intellectual Property License. This program is distributed in the
007 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
008 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
009 * PURPOSE.
010 * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
011 */
012
013package org.w3c.dom.css;
014
015import org.w3c.dom.DOMException;
016
017/**
018 *  The <code>CSSValue</code> interface represents a simple or a complex 
019 * value. A <code>CSSValue</code> object only occurs in a context of a CSS 
020 * property. 
021 * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
022 * @since DOM Level 2
023 */
024public interface CSSValue {
025    // UnitTypes
026    /**
027     * The value is inherited and the <code>cssText</code> contains "inherit".
028     */
029    public static final short CSS_INHERIT               = 0;
030    /**
031     * The value is a primitive value and an instance of the 
032     * <code>CSSPrimitiveValue</code> interface can be obtained by using 
033     * binding-specific casting methods on this instance of the 
034     * <code>CSSValue</code> interface.
035     */
036    public static final short CSS_PRIMITIVE_VALUE       = 1;
037    /**
038     * The value is a <code>CSSValue</code> list and an instance of the 
039     * <code>CSSValueList</code> interface can be obtained by using 
040     * binding-specific casting methods on this instance of the 
041     * <code>CSSValue</code> interface.
042     */
043    public static final short CSS_VALUE_LIST            = 2;
044    /**
045     * The value is a custom value.
046     */
047    public static final short CSS_CUSTOM                = 3;
048
049    /**
050     *  A string representation of the current value. 
051     */
052    public String getCssText();
053    /**
054     *  A string representation of the current value. 
055     * @exception DOMException
056     *    SYNTAX_ERR: Raised if the specified CSS string value has a syntax 
057     *   error (according to the attached property) or is unparsable. 
058     *   <br>INVALID_MODIFICATION_ERR: Raised if the specified CSS string 
059     *   value represents a different type of values than the values allowed 
060     *   by the CSS property.
061     *   <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this value is readonly. 
062     */
063    public void setCssText(String cssText)
064                       throws DOMException;
065
066    /**
067     *  A code defining the type of the value as defined above. 
068     */
069    public short getCssValueType();
070
071}