PR middle-end/19616
[official-gcc.git] / libjava / javax / print / PrintService.java
blobde113681b5ee5532ab6facfdd19c870e46b928b3
1 /* PrintService.java --
2 Copyright (C) 2004 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package javax.print;
41 import javax.print.attribute.Attribute;
42 import javax.print.attribute.AttributeSet;
43 import javax.print.attribute.PrintServiceAttribute;
44 import javax.print.attribute.PrintServiceAttributeSet;
45 import javax.print.event.PrintServiceAttributeListener;
47 /**
48 * @author Michael Koch (konqueror@gmx.de)
50 public interface PrintService
52 /**
53 * Returns a new print job capable to handle all supported document flavors.
55 * @return the new print job
57 DocPrintJob createPrintJob();
59 /**
60 * Determines if two services refer to the same underlying service.
62 * @param obj the service to check against
64 * @return <code>true</code> if both services refer to the sam underlying
65 * service, <code>false</code> otherwise
67 boolean equals(Object obj);
69 /**
70 * Returns the value of a single specified attribute.
72 * @param category the category of a <code>PrintServiceAttribute</code>
74 * @return the value of the attribute
76 * @throws NullPointerException if category is null
77 * @throws IllegalArgumentException if category is not a class that
78 * implements <code>PrintServiceAttribute</code>
80 PrintServiceAttribute getAttribute(Class category);
82 /**
83 * Returns all attributes of this printer service
85 * @return all attributes of this print service
87 PrintServiceAttributeSet getAttributes();
89 /**
90 * Returns the service's default value for a given attribute.
92 * @param category the category of the attribute
94 * @return the default value
96 * @throws NullPointerException if <code>category</code> is null
97 * @throws IllegalArgumentException if <code>category</code> is a class
98 * not implementing <code>Attribute</code>
100 Object getDefaultAttributeValue(Class category);
103 * Returns the name of this print service.
105 * @return the name
107 String getName();
110 * Returns a factory for UI components.
112 * @return the factory
114 ServiceUIFactory getServiceUIFactory();
117 * Returns all supported attribute categories.
119 * @return an array of all supported attribute categories
121 Class[] getSupportedAttributeCategories();
124 * Returns all supported attribute values a client can use when setting up
125 * a print job with this service.
127 * @param category the attribute category to test
128 * @param flavor the document flavor to use, or null
129 * @param attributes set of printing attributes for a supposed job, or null
131 * @return object indicating supported values for <code>category</code>,
132 * or null if this print service doesnt support specifying doc-level or
133 * job-level attribute in a print request.
135 * @throws NullPointerException if <code>category</code> is null
136 * @throws IllegalArgumentException if <code>category</code> is a class not
137 * implementing <code>Attribute</code>, or if <code>flavor</code> is not
138 * supported
140 Object getSupportedAttributeValues(Class category, DocFlavor flavor, AttributeSet attributes);
143 * Returns an array of all supproted document flavors.
145 * @return the supported document flavors
147 DocFlavor[] getSupportedDocFlavors();
150 * Returns all attributes that are unsupported for a print request in the
151 * context of a particular document flavor.
153 * @param flavor document flavor to test, or null
154 * @param attributes set of printing attributes for a supposed job
156 * @return null if this <code>PrintService</code> supports the print request
157 * specification, else the unsupported attributes
159 * @throws IllegalArgumentException if <code>flavor</code> is unsupported
161 AttributeSet getUnsupportedAttributes(DocFlavor flavor, AttributeSet attributes);
164 * Returns a hashcode for this printer service.
166 * @return the hashcode
168 int hashCode();
171 * Determines a given attribute category is supported or not.
173 * @param category the category to check
175 * @return <code>true</code> if <code>category</code> is supported,
176 * <code>false</code> otherwise
178 * @throws NullPointerException if <code>category</code> is null
179 * @throws IllegalArgumentException if <code>category</code> is a class not
180 * implementing <code>Attribute</code>.
182 boolean isAttributeCategorySupported(Class category);
185 * Determines a given attribute value is supported when creating a print job
186 * for this print service.
188 * @param attrval the attribute value to check
189 * @param flavor the document flavor to use, or null
190 * @param attributes set of printing attributes to use, or null
192 * @return <code>true</code> if the attribute value is supported,
193 * <code>false</code> otherwise
195 * @throws NullPointerException if <code>attrval</code> is null
196 * @throws IllegalArgumentException if <code>flavor</code> is not supported
197 * by this print service
199 boolean isAttributeValueSupported(Attribute attrval, DocFlavor flavor, AttributeSet attributes);
202 * Determines a given document flavor is supported or not.
204 * @param flavor the document flavor to check
206 * @return <code>true</code> if <code>flavor</code> is supported,
207 * <code>false</code> otherwise
209 * @throws NullPointerException if <code>flavor</code> is null
211 boolean isDocFlavorSupported(DocFlavor flavor);
214 * Registers a print service attribute listener to this print service.
216 * @param listener the listener to add
218 void addPrintServiceAttributeListener(PrintServiceAttributeListener listener);
221 * De-registers a print service attribute listener from this print service.
223 * @param listener the listener to remove
225 void removePrintServiceAttributeListener(PrintServiceAttributeListener listener);