123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434 |
- /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
- /* $Id$ */
-
- package org.apache.fop.fo;
-
- import org.xml.sax.Locator;
-
- import org.apache.xmlgraphics.util.QName;
-
- import org.apache.fop.apps.FOPException;
- import org.apache.fop.events.EventBroadcaster;
- import org.apache.fop.events.EventProducer;
- import org.apache.fop.fo.expr.PropertyException;
-
- /**
- * Event producer interface for XSL-FO validation messages.
- */
- public interface FOValidationEventProducer extends EventProducer {
-
- /**
- * Provider class for the event producer.
- */
- final class Provider {
-
- private Provider() { }
-
- /**
- * Returns an event producer.
- * @param broadcaster the event broadcaster to use
- * @return the event producer
- */
- public static FOValidationEventProducer get(EventBroadcaster broadcaster) {
- return broadcaster.getEventProducerFor(FOValidationEventProducer.class);
- }
- }
-
- /**
- * Too many child nodes.
- * @param source the event source
- * @param elementName the name of the context node
- * @param offendingNode the offending node
- * @param loc the location of the error or null
- * @throws ValidationException the validation error provoked by the method call
- * @event.severity FATAL
- */
- void tooManyNodes(Object source, String elementName, QName offendingNode,
- Locator loc) throws ValidationException;
-
- /**
- * The node order is wrong.
- * @param source the event source
- * @param elementName the name of the context node
- * @param tooLateNode string name of node that should be earlier in document
- * @param tooEarlyNode string name of node that should be later in document
- * @param canRecover indicates whether FOP can recover from this problem and continue working
- * @param loc the location of the error or null
- * @throws ValidationException the validation error provoked by the method call
- */
- void nodeOutOfOrder(Object source, String elementName,
- String tooLateNode, String tooEarlyNode, boolean canRecover,
- Locator loc) throws ValidationException;
-
- /**
- * An invalid child was encountered.
- * @param source the event source
- * @param elementName the name of the context node
- * @param offendingNode the offending node
- * @param ruleViolated the rule that was violated or null
- * @param loc the location of the error or null
- * @throws ValidationException the validation error provoked by the method call
- */
- void invalidChild(Object source, String elementName, QName offendingNode, String ruleViolated,
- Locator loc) throws ValidationException;
-
- /**
- * A valid but not yet supported child was encountered.
- *
- * @param source the event source
- * @param elementName the name of the context node
- * @param offendingNode the offending node
- * @param loc the location of the error or null
- * @throws ValidationException the validation error provoked by the method call
- */
- void notSupportedChild(Object source, String elementName, QName offendingNode, Locator loc)
- throws ValidationException;
-
- /**
- * A required child element is missing.
- * @param source the event source
- * @param elementName the name of the context node
- * @param contentModel the expected content model
- * @param canRecover indicates whether FOP can recover from this problem and continue working
- * @param loc the location of the error or null
- * @throws ValidationException the validation error provoked by the method call
- * @event.severity FATAL
- */
- void missingChildElement(Object source, String elementName,
- String contentModel, boolean canRecover,
- Locator loc) throws ValidationException;
-
- /**
- * An element is missing a required property.
- * @param source the event source
- * @param elementName the name of the context node
- * @param propertyName the name of the missing property
- * @param loc the location of the error or null
- * @throws ValidationException the validation error provoked by the method call
- * @event.severity FATAL
- */
- void missingProperty(Object source, String elementName, String propertyName,
- Locator loc) throws ValidationException;
-
- /**
- * An id was used twice in a document.
- * @param source the event source
- * @param elementName the name of the context node
- * @param id the id that was reused
- * @param canRecover indicates whether FOP can recover from this problem and continue working
- * @param loc the location of the error or null
- * @throws ValidationException the validation error provoked by the method call
- * @event.severity FATAL
- */
- void idNotUnique(Object source, String elementName, String id, boolean canRecover,
- Locator loc) throws ValidationException;
-
- /**
- * There are multiple color profiles defined with the same name.
- * @param source the event source
- * @param elementName the name of the context node
- * @param name the duplicate color profile name
- * @param loc the location of the error or null
- * @event.severity WARN
- */
- void colorProfileNameNotUnique(Object source, String elementName, String name,
- Locator loc);
-
- /**
- * There are multiple page masters defined with the same name.
- * @param source the event source
- * @param elementName the name of the context node
- * @param name the duplicate page master name
- * @param loc the location of the error or null
- * @throws ValidationException the validation error provoked by the method call
- * @event.severity FATAL
- */
- void masterNameNotUnique(Object source, String elementName, String name,
- Locator loc) throws ValidationException;
-
- /**
- * An fo:marker appears as initial descendant in an fo:block-container
- * that generates absolutely positioned areas
- * @param source the event source
- * @param loc the location of the error (possibly null)
- * @event.severity ERROR
- */
- void markerBlockContainerAbsolutePosition(Object source, Locator loc);
-
- /**
- * A marker is not an initial child on a node.
- * @param source the event source
- * @param elementName the name of the context node
- * @param mcname the marker class name
- * @param loc the location of the error or null
- * @event.severity ERROR
- */
- void markerNotInitialChild(Object source, String elementName, String mcname, Locator loc);
-
- /**
- * A marker class name is not unique within the same parent.
- * @param source the event source
- * @param elementName the name of the context node
- * @param mcname the marker class name
- * @param loc the location of the error or null
- * @event.severity ERROR
- */
- void markerNotUniqueForSameParent(Object source, String elementName,
- String mcname, Locator loc);
-
- /**
- * An invalid property was found.
- * @param source the event source
- * @param elementName the name of the context node
- * @param attr the invalid attribute
- * @param canRecover indicates whether FOP can recover from this problem and continue working
- * @param loc the location of the error or null
- * @throws ValidationException the validation error provoked by the method call
- * @event.severity FATAL
- */
- void invalidProperty(Object source, String elementName, QName attr, boolean canRecover,
- Locator loc) throws ValidationException;
-
- /**
- * An invalid property value was encountered.
- * @param source the event source
- * @param elementName the name of the context node
- * @param propName the property name
- * @param propValue the property value
- * @param e the property exception caused by the invalid value
- * @param loc the location of the error or null
- * @event.severity ERROR
- */
- void invalidPropertyValue(Object source, String elementName,
- String propName, String propValue, PropertyException e,
- Locator loc);
-
- /**
- * An invalid property value was encountered.
- * @param source the event source
- * @param elementName the name of the context node
- * @param propName the property name
- * @param propValue the property value
- * @param e the property exception caused by the invalid value
- * @param loc the location of the error or null
- * @event.severity WARN
- */
- void warnOnInvalidPropertyValue(Object source, String elementName,
- String propName, String propValue, PropertyException e,
- Locator loc);
-
- /**
- * A feature is not supported, yet.
- * @param source the event source
- * @param elementName the name of the context node
- * @param feature the unsupported feature
- * @param loc the location of the error or null
- * @event.severity WARN
- */
- void unimplementedFeature(Object source, String elementName, String feature,
- Locator loc);
-
- /**
- * Missing internal-/external-destination on basic-link or bookmark.
- * @param source the event source
- * @param elementName the name of the context node
- * @param loc the location of the error or null
- * @throws ValidationException the validation error provoked by the method call
- * @event.severity FATAL
- */
- void missingLinkDestination(Object source, String elementName, Locator loc)
- throws ValidationException;
-
- /**
- * Indicates a problem while cloning a marker (ex. due to invalid property values).
- * @param source the event source
- * @param markerClassName the "marker-class-name" of the marker
- * @param fe the FOP exception that cause this problem
- * @param loc the location of the error or null
- * @event.severity ERROR
- */
- void markerCloningFailed(Object source, String markerClassName, FOPException fe, Locator loc);
-
- /**
- * A region name is mapped to multiple region classes.
- * @param source the event source
- * @param regionName the region name
- * @param defaultRegionClass1 the first default region class
- * @param defaultRegionClass2 the second default region class
- * @param loc the location of the error or null
- * @throws ValidationException the validation error provoked by the method call
- * @event.severity FATAL
- */
- void regionNameMappedToMultipleRegionClasses(Object source, String regionName,
- String defaultRegionClass1, String defaultRegionClass2, Locator loc)
- throws ValidationException;
-
- /**
- * There are multiple flows with the same name.
- * @param source the event source
- * @param elementName the name of the context node
- * @param flowName the flow name
- * @param loc the location of the error or null
- * @throws ValidationException the validation error provoked by the method call
- * @event.severity FATAL
- */
- void duplicateFlowNameInPageSequence(Object source, String elementName, String flowName,
- Locator loc) throws ValidationException;
-
- /**
- * A flow name could not be mapped to a region.
- * @param source the event source
- * @param elementName the name of the context node
- * @param flowName the flow name
- * @param loc the location of the error or null
- * @throws ValidationException the validation error provoked by the method call
- * @event.severity FATAL
- */
- void flowNameNotMapped(Object source, String elementName, String flowName,
- Locator loc) throws ValidationException;
-
- /**
- * A page master could not be found.
- * @param source the event source
- * @param elementName the name of the context node
- * @param masterReference the page master reference
- * @param loc the location of the error or null
- * @throws ValidationException the validation error provoked by the method call
- * @event.severity FATAL
- */
- void masterNotFound(Object source, String elementName, String masterReference,
- Locator loc) throws ValidationException;
-
- /**
- * An illegal region name was used.
- * @param source the event source
- * @param elementName the name of the context node
- * @param regionName the region name
- * @param loc the location of the error or null
- * @throws ValidationException the validation error provoked by the method call
- * @event.severity FATAL
- */
- void illegalRegionName(Object source, String elementName, String regionName,
- Locator loc) throws ValidationException;
-
- /**
- * A non-zero border and/or padding has been encountered on a region.
- * @param source the event source
- * @param elementName the name of the context node
- * @param regionName the region name
- * @param canRecover indicates whether FOP can recover from this problem and continue working
- * @param loc the location of the error or null
- * @throws ValidationException the validation error provoked by the method call
- * @event.severity FATAL
- */
- void nonZeroBorderPaddingOnRegion(Object source, String elementName, String regionName,
- boolean canRecover, Locator loc) throws ValidationException;
-
- /**
- * If overflow property is set to "scroll", a column-count other than "1" may not be specified.
- * @param source the event source
- * @param elementName the name of the context node
- * @param loc the location of the error or null
- * @throws ValidationException the validation error provoked by the method call
- * @event.severity FATAL
- */
- void columnCountErrorOnRegionBodyOverflowScroll(Object source, String elementName,
- Locator loc) throws ValidationException;
-
- /**
- * fo:root must be root.
- * @param source the event source
- * @param elementName the name of the context node
- * @param loc the location of the error or null
- * @throws ValidationException the validation error provoked by the method call
- * @event.severity FATAL
- */
- void invalidFORoot(Object source, String elementName,
- Locator loc) throws ValidationException;
-
- /**
- * No FO document was found.
- * @param source the event source
- * @throws ValidationException the validation error provoked by the method call
- * @event.severity FATAL
- */
- void emptyDocument(Object source) throws ValidationException;
-
- /**
- * An unknown/unsupported formatting object has been encountered.
- * @param source the event source
- * @param elementName the name of the context node
- * @param offendingNode the offending node
- * @param loc the location of the error or null
- * @event.severity WARN
- */
- void unknownFormattingObject(Object source, String elementName,
- QName offendingNode, Locator loc);
-
- /**
- * A class for change bars is not unique.
- * @param source the event source
- * @param elementName the name of the context node
- * @param name the class name
- * @param loc the location of the error or null
- * @event.severity FATAL
- */
- void changeBarClassNotUnique(Object source, String elementName, String name,
- Locator loc);
-
- /**
- * Change bars were not stacked correctly
- * @param source the event source
- * @param elementName the name of the context node
- * @param beginName the class name of the beginning change bar
- * @param endName the class name of the ending change bar
- * @param loc the location of the error or null
- * @event.severity FATAL
- */
- void changeBarWrongStacking(Object source, String elementName, String beginName,
- String endName, Locator loc);
-
- /**
- * Change bar ended without a start of bar occurred
- * @param source the event source
- * @param elementName the name of the context node
- * @param loc the location of the error or null
- * @event.severity FATAL
- */
- void changeBarNoBegin(Object source, String elementName, Locator loc);
-
- /**
- * Change bar not descendant of fo:flow or fo:static-content
- * @param source the event source
- * @param elementName the name of the context node
- * @param loc the location of the error or null
- * @event.severity FATAL
- */
- void changeBarWrongAncestor(Object source, String elementName, Locator loc);
-
- /**
- * Alternate text is missing for a graphic element.
- *
- * @param source the event source
- * @param foElement name of the element (external-graphic or instream-foreign-object)
- * @param loc the location of the error or null
- * @event.severity WARN
- */
- void altTextMissing(Object source, String foElement, Locator loc);
- }
|