001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: /* $Id: ColorProfile.java 474225 2006-11-13 10:08:19Z jeremias $ */
019:
020: package org.apache.fop.fo.pagination;
021:
022: import org.apache.fop.apps.FOPException;
023: import org.apache.fop.fo.FONode;
024: import org.apache.fop.fo.FObj;
025: import org.apache.fop.fo.PropertyList;
026: import org.apache.fop.fo.ValidationException;
027:
028: import org.xml.sax.Locator;
029:
030: /**
031: * The fo:color-profile formatting object.
032: * This loads the color profile when needed and resolves a requested color.
033: */
034: public class ColorProfile extends FObj {
035: // The value of properties relevant for fo:color-profile.
036: private String src;
037: private String colorProfileName;
038: private int renderingIntent;
039:
040: // End of property values
041:
042: /**
043: * @see org.apache.fop.fo.FONode#FONode(FONode)
044: */
045: public ColorProfile(FONode parent) {
046: super (parent);
047: }
048:
049: /**
050: * @see org.apache.fop.fo.FObj#bind(PropertyList)
051: */
052: public void bind(PropertyList pList) throws FOPException {
053: src = pList.get(PR_SRC).getString();
054: colorProfileName = pList.get(PR_COLOR_PROFILE_NAME).getString();
055: renderingIntent = pList.get(PR_RENDERING_INTENT).getEnum();
056: }
057:
058: /**
059: * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
060: XSL 1.0/FOP: EMPTY (no child nodes permitted)
061: */
062: protected void validateChildNode(Locator loc, String nsURI,
063: String localName) throws ValidationException {
064: invalidChildError(loc, nsURI, localName);
065: }
066:
067: /**
068: * Return the "color-profile-name" property.
069: */
070: public String getColorProfileName() {
071: return colorProfileName;
072: }
073:
074: /** @see org.apache.fop.fo.FONode#getLocalName() */
075: public String getLocalName() {
076: return "color-profile";
077: }
078:
079: /**
080: * @see org.apache.fop.fo.FObj#getNameId()
081: */
082: public int getNameId() {
083: return FO_COLOR_PROFILE;
084: }
085:
086: /**
087: * Get src attribute
088: *
089: * @return Value of color-profile src attribute
090: */
091: public String getSrc() {
092: return this .src;
093: }
094:
095: /**
096: * Get rendering-intent attribute
097: *
098: * Returned value is one of
099: * Constants.EN_AUTO
100: * Constants.EN_PERCEPTUAL
101: * Constants.EN_RELATIVE_COLOMETRIC
102: * Constants.EN_SATURATION
103: * Constants.EN_ABSOLUTE_COLORMETRIC
104: *
105: * @return Rendering intent attribute
106: */
107: public int getRenderingIntent() {
108: return this.renderingIntent;
109: }
110: }
|