001: /*
002:
003: Licensed to the Apache Software Foundation (ASF) under one or more
004: contributor license agreements. See the NOTICE file distributed with
005: this work for additional information regarding copyright ownership.
006: The ASF licenses this file to You under the Apache License, Version 2.0
007: (the "License"); you may not use this file except in compliance with
008: the License. You may obtain a copy of the License at
009:
010: http://www.apache.org/licenses/LICENSE-2.0
011:
012: Unless required by applicable law or agreed to in writing, software
013: distributed under the License is distributed on an "AS IS" BASIS,
014: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: See the License for the specific language governing permissions and
016: limitations under the License.
017:
018: */
019: package org.apache.batik.css.engine;
020:
021: import org.apache.batik.css.engine.value.Value;
022: import org.apache.batik.util.ParsedURL;
023: import org.w3c.dom.Element;
024:
025: /**
026: * This interface allows the user of a CSSEngine to provide contextual
027: * informations.
028: *
029: * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
030: * @version $Id: CSSContext.java 478160 2006-11-22 13:35:06Z dvholten $
031: */
032: public interface CSSContext {
033:
034: /**
035: * Returns the Value corresponding to the given system color.
036: */
037: Value getSystemColor(String ident);
038:
039: /**
040: * Returns the value corresponding to the default font-family.
041: */
042: Value getDefaultFontFamily();
043:
044: /**
045: * Returns a lighter font-weight.
046: */
047: float getLighterFontWeight(float f);
048:
049: /**
050: * Returns a bolder font-weight.
051: */
052: float getBolderFontWeight(float f);
053:
054: /**
055: * Returns the size of a px CSS unit in millimeters.
056: */
057: float getPixelUnitToMillimeter();
058:
059: /**
060: * Returns the size of a px CSS unit in millimeters.
061: * This will be removed after next release.
062: * @see #getPixelUnitToMillimeter()
063: */
064: float getPixelToMillimeter();
065:
066: /**
067: * Returns the medium font size.
068: */
069: float getMediumFontSize();
070:
071: /**
072: * Returns the width of the block which directly contains the
073: * given element.
074: */
075: float getBlockWidth(Element elt);
076:
077: /**
078: * Returns the height of the block which directly contains the
079: * given element.
080: */
081: float getBlockHeight(Element elt);
082:
083: /**
084: * This method should throw a SecurityException if the resource
085: * found at url and referenced from docURL should not be loaded.
086: *
087: * @param resourceURL url for the resource, as defined in
088: * the resource's xlink:href attribute. If that
089: * attribute was empty, then this parameter should
090: * be null
091: * @param docURL url for the document into which the
092: * resource was found.
093: */
094: void checkLoadExternalResource(ParsedURL resourceURL,
095: ParsedURL docURL) throws SecurityException;
096:
097: /**
098: * Returns true if the document is dynamic, false otherwise.
099: */
100: boolean isDynamic();
101:
102: /**
103: * Returns true if the document is interactive, false otherwise.
104: */
105: boolean isInteractive();
106:
107: /**
108: * Returns the CSS engine associated with given element.
109: */
110: CSSEngine getCSSEngineForElement(Element e);
111: }
|