]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/printing/PrinterData.java
Remove invalid SHA-256-Digests
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / printing / PrinterData.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2011 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.swt.printing;
15
16
17 import org.eclipse.swt.*;
18 import org.eclipse.swt.graphics.*;
19
20 /**
21  * Instances of this class are descriptions of a print job
22  * in terms of the printer, and the scope and type of printing
23  * that is desired. For example, the number of pages and copies
24  * can be specified, as well as whether or not the print job
25  * should go to a file.
26  * <p>
27  * Application code does <em>not</em> need to explicitly release the
28  * resources managed by each instance when those instances are no longer
29  * required, and thus no <code>dispose()</code> method is provided.
30  * </p>
31  *
32  * @see Printer
33  * @see Printer#getPrinterList
34  * @see PrintDialog#open
35  * @see <a href="http://www.eclipse.org/swt/snippets/#printing">Printing snippets</a>
36  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
37  */
38
39 public final class PrinterData extends DeviceData {
40
41         /**
42          * the printer driver
43          * On Windows systems, this is the name of the driver (often "winspool").
44          * On Mac OSX, this is the destination type ("Printer", "Fax", "File", or "Preview").
45          * On X/Window systems, this is the name of a display connection to the
46          * Xprt server (the default is ":1").
47          * On GTK+, this is the backend type name (eg. GtkPrintBackendCups).
48          */
49         // TODO: note that this api is not finalized for GTK+
50         public String driver;
51
52         /**
53          * the name of the printer
54          * On Windows systems, this is the name of the 'device'.
55          * On Mac OSX, X/Window systems, and GTK+, this is the printer's 'name'.
56          */
57         public String name;
58
59         /**
60          * the scope of the print job, expressed as one of the following values:
61          * <dl>
62          * <dt><code>ALL_PAGES</code></dt>
63          * <dd>Print all pages in the current document</dd>
64          * <dt><code>PAGE_RANGE</code></dt>
65          * <dd>Print the range of pages specified by startPage and endPage</dd>
66          * <dt><code>SELECTION</code></dt>
67          * <dd>Print the current selection</dd>
68          * </dl>
69          */
70         public int scope = ALL_PAGES;
71
72         /**
73          * the start page of a page range, used when scope is PAGE_RANGE.
74          * This value can be from 1 to the maximum number of pages for the platform.
75          */
76         public int startPage = 1;
77
78         /**
79          * the end page of a page range, used when scope is PAGE_RANGE.
80          * This value can be from 1 to the maximum number of pages for the platform.
81          */
82         public int endPage = 1;
83
84         /**
85          * whether or not the print job should go to a file
86          */
87         public boolean printToFile = false;
88
89         /**
90          * the name of the file to print to if printToFile is true.
91          * Note that this field is ignored if printToFile is false.
92          */
93         public String fileName;
94
95         /**
96          * the number of copies to print.
97          * Note that this field may be controlled by the printer driver
98          * In other words, the printer itself may be capable of printing
99          * multiple copies, and if so, the value of this field will always be 1.
100          */
101         public int copyCount = 1;
102
103         /**
104          * whether or not the printer should collate the printed paper
105          * Note that this field may be controlled by the printer driver.
106          * In other words, the printer itself may be capable of doing the
107          * collation, and if so, the value of this field will always be false.
108          */
109         public boolean collate = false;
110
111         /**
112          * The orientation of the paper, which can be either PORTRAIT
113          * or LANDSCAPE.
114          *
115          * @since 3.5
116          */
117         public int orientation = PORTRAIT;
118
119         /**
120          * Single-sided or double-sided printing, expressed as one of the
121          * following values:
122          * <dl>
123          * <dt><code>SWT.DEFAULT</code></dt>
124          * <dd>the default duplex value for the printer</dd>
125          * <dt><code>DUPLEX_NONE</code></dt>
126          * <dd>single-sided printing</dd>
127          * <dt><code>DUPLEX_LONG_EDGE</code></dt>
128          * <dd>double-sided printing as if bound on the long edge</dd>
129          * <dt><code>DUPLEX_SHORT_EDGE</code></dt>
130          * <dd>double-sided printing as if bound on the short edge</dd>
131          * </dl>
132          * <p>
133          * The default value is <code>SWT.DEFAULT</code>, meaning do not set a value;
134          * use the printer's default duplex setting.
135          * A printer's default value is typically single-sided,
136          * however it can default to double-sided in order to save paper.
137          * </p>
138          *
139          * @since 3.7
140          */
141         public int duplex = SWT.DEFAULT;
142
143         /**
144          * <code>scope</code> field value indicating that
145          * all pages should be printed
146          */
147         public static final int ALL_PAGES = 0;
148
149         /**
150          * <code>scope</code> field value indicating that
151          * the range of pages specified by startPage and endPage
152          * should be printed
153          */
154         public static final int PAGE_RANGE = 1;
155
156         /**
157          * <code>scope</code> field value indicating that
158          * the current selection should be printed
159          */
160         public static final int SELECTION = 2;
161
162         /**
163          * <code>orientation</code> field value indicating
164          * portrait paper orientation
165          *
166          * @since 3.5
167          */
168         public static final int PORTRAIT = 1;
169
170         /**
171          * <code>orientation</code> field value indicating
172          * landscape paper orientation
173          *
174          * @since 3.5
175          */
176         public static final int LANDSCAPE = 2;
177
178         /**
179          * <code>duplex</code> field value indicating
180          * single-sided printing.
181          * <p>
182          * This is also known as simplex printing.
183          * </p>
184          *
185          * @since 3.7
186          */
187         public static final int DUPLEX_NONE = 0;
188
189         /**
190          * <code>duplex</code> field value indicating
191          * double-sided printing for binding on the long edge.
192          * <p>
193          * For portrait orientation, the long edge is vertical.
194          * For landscape orientation, the long edge is horizontal.
195          * </p><p>
196          * This is also known as duplex printing.
197          * </p>
198          *
199          * @since 3.7
200          */
201         public static final int DUPLEX_LONG_EDGE = 1;
202
203         /**
204          * <code>duplex</code> field value indicating
205          * double-sided printing for binding on the short edge.
206          * <p>
207          * For portrait orientation, the short edge is horizontal.
208          * For landscape orientation, the short edge is vertical.
209          * </p><p>
210          * This is also known as duplex tumble printing.
211          * </p>
212          *
213          * @since 3.7
214          */
215         public static final int DUPLEX_SHORT_EDGE = 2;
216
217         /**
218          * private, platform-specific data
219          * On Windows, this contains a copy of the DEVMODE struct
220          * returned from the <code>PrintDialog</code>.
221          * On GTK, this contains a copy of the print_settings and page_setup
222          * returned from the <code>PrintDialog</code>.
223          * On OS X Cocoa, this contains a copy of the PrintSettings and PageFormat
224          * returned from the <code>PrintDialog</code>.
225          * This field is not currently used on the X/Window System.
226          */
227         byte [] otherData;
228
229         /**
230          * Constructs an instance of this class that can be
231          * used to print to the default printer.
232          *
233          * @see Printer#getDefaultPrinterData
234          */
235         public PrinterData() {
236         }
237
238         /**
239          * Constructs an instance of this class with the given
240          * printer driver and printer name.
241          *
242          * @param driver the printer driver for the printer
243          * @param name the name of the printer
244          *
245          * @see #driver
246          * @see #name
247          */
248         public PrinterData(String driver, String name) {
249                 this.driver = driver;
250                 this.name = name;
251         }
252
253         /**
254          * Returns a string containing a concise, human-readable
255          * description of the receiver.
256          *
257          * @return a string representation of the receiver
258          */
259         @Override
260         public String toString() {
261                 return "PrinterData {" + "driver = " + driver + ", name = " + name + "}";  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
262         }
263 }