001: /*
002: * Copyright (c) 1999 World Wide Web Consortium
003: * (Massachusetts Institute of Technology, Institut National de Recherche
004: * en Informatique et en Automatique, Keio University).
005: * All Rights Reserved. http://www.w3.org/Consortium/Legal/
006: *
007: * $Id$
008: */
009: package org.w3c.css.sac;
010:
011: /**
012: * This is the main interface that most CSS applications implement: if the
013: * application needs to be informed of basic parsing events, it implements this
014: * interface and registers an instance with the CSS parser using the
015: * setCSSHandler method.
016: *
017: * @version $Revision$
018: * @author Philippe Le Hegaret
019: */
020: public interface DocumentHandler {
021:
022: /**
023: * Receive notification of the beginning of a style sheet.
024: *
025: * The CSS parser will invoke this method only once, before any other
026: * methods in this interface.
027: *
028: * @param uri The URI of the style sheet. @@TODO can be NULL ! (inline style sheet)
029: * @exception CSSException Any CSS exception, possibly wrapping another
030: * exception.
031: */
032: public void startDocument(InputSource source) throws CSSException;
033:
034: /**
035: * Receive notification of the end of a document.
036: *
037: * The CSS parser will invoke this method only once, and it will be the
038: * last method invoked during the parse. The parser shall not invoke this
039: * method until it has either abandoned parsing (because of an
040: * unrecoverable error) or reached the end of input.
041: *
042: * @param uri The URI of the style sheet.
043: * @exception CSSException Any CSS exception, possibly wrapping another
044: * exception.
045: */
046: public void endDocument(InputSource source) throws CSSException;
047:
048: /**
049: * Receive notification of a comment.
050: * If the comment appears in a declaration (e.g. color: /* comment * / blue;),
051: * the parser notifies the comment before the declaration.
052: *
053: * @param text The comment.
054: * @exception CSSException Any CSS exception, possibly wrapping another
055: * exception.
056: */
057: public void comment(String text) throws CSSException;
058:
059: /**
060: * Receive notification of an unknown rule t-rule not supported by this
061: * parser.
062: *
063: * @param at-rule The complete ignored at-rule.
064: * @exception CSSException Any CSS exception, possibly wrapping another
065: * exception.
066: */
067: public void ignorableAtRule(String atRule) throws CSSException;
068:
069: /**
070: * Receive notification of an unknown rule t-rule not supported by this
071: * parser.
072: *
073: * @param prefix <code>null</code> if this is the default namespace
074: * @param uri The URI for this namespace.
075: * @exception CSSException Any CSS exception, possibly wrapping another
076: * exception.
077: */
078: public void namespaceDeclaration(String prefix, String uri)
079: throws CSSException;
080:
081: /**
082: * Receive notification of a import statement in the style sheet.
083: *
084: * @param uri The URI of the imported style sheet.
085: * @param media The intended destination media for style information.
086: * @param defaultNamepaceURI The default namespace URI for the imported
087: * style sheet.
088: * @exception CSSException Any CSS exception, possibly wrapping another
089: * exception.
090: */
091: public void importStyle(String uri, SACMediaList media,
092: String defaultNamespaceURI) throws CSSException;
093:
094: /**
095: * Receive notification of the beginning of a media statement.
096: *
097: * The Parser will invoke this method at the beginning of every media
098: * statement in the style sheet. there will be a corresponding endMedia()
099: * event for every startElement() event.
100: *
101: * @param media The intended destination media for style information.
102: * @exception CSSException Any CSS exception, possibly wrapping another
103: * exception.
104: */
105: public void startMedia(SACMediaList media) throws CSSException;
106:
107: /**
108: * Receive notification of the end of a media statement.
109: *
110: * @param media The intended destination media for style information.
111: * @exception CSSException Any CSS exception, possibly wrapping another
112: * exception.
113: */
114: public void endMedia(SACMediaList media) throws CSSException;
115:
116: /**
117: * Receive notification of the beginning of a page statement.
118: *
119: * The Parser will invoke this method at the beginning of every page
120: * statement in the style sheet. there will be a corresponding endPage()
121: * event for every startPage() event.
122: *
123: * @param name the name of the page (if any, null otherwise)
124: * @param pseudo_page the pseudo page (if any, null otherwise)
125: * @exception CSSException Any CSS exception, possibly wrapping another
126: * exception.
127: */
128: public void startPage(String name, String pseudo_page)
129: throws CSSException;
130:
131: /**
132: * Receive notification of the end of a media statement.
133: *
134: * @param media The intended destination medium for style information.
135: * @param pseudo_page the pseudo page (if any, null otherwise)
136: * @exception CSSException Any CSS exception, possibly wrapping another
137: * exception.
138: */
139: public void endPage(String name, String pseudo_page)
140: throws CSSException;
141:
142: /**
143: * Receive notification of the beginning of a font face statement.
144: *
145: * The Parser will invoke this method at the beginning of every font face
146: * statement in the style sheet. there will be a corresponding endFontFace()
147: * event for every startFontFace() event.
148: *
149: * @exception CSSException Any CSS exception, possibly wrapping another
150: * exception.
151: */
152: public void startFontFace() throws CSSException;
153:
154: /**
155: * Receive notification of the end of a font face statement.
156: *
157: * @exception CSSException Any CSS exception, possibly wrapping another
158: * exception.
159: */
160: public void endFontFace() throws CSSException;
161:
162: /**
163: * Receive notification of the beginning of a rule statement.
164: *
165: * @param selectors All intended selectors for all declarations.
166: * @exception CSSException Any CSS exception, possibly wrapping another
167: * exception.
168: */
169: public void startSelector(SelectorList selectors)
170: throws CSSException;
171:
172: /**
173: * Receive notification of the end of a rule statement.
174: *
175: * @param selectors All intended selectors for all declarations.
176: * @exception CSSException Any CSS exception, possibly wrapping another
177: * exception.
178: */
179: public void endSelector(SelectorList selectors) throws CSSException;
180:
181: /**
182: * Receive notification of a declaration.
183: *
184: * @param name the name of the property.
185: * @param value the value of the property. All whitespace are stripped.
186: * @param important is this property important ?
187: * @exception CSSException Any CSS exception, possibly wrapping another
188: * exception.
189: */
190: public void property(String name, LexicalUnit value,
191: boolean important) throws CSSException;
192: }
|