Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 58b72f6c249d65a4055762a7310795564b5874f1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*******************************************************************************
 * Copyright (c) 2000, 2008 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.swt.custom;

/**
 * Use StyledTextPrintOptions to specify printing options for the
 * StyledText.print(Printer, StyledTextPrintOptions) API.
 * <p>
 * The following example prints a right aligned page number in the footer,
 * sets the job name to "Example" and prints line background colors but no other
 * formatting:
 * </p>
 * <pre>
 * StyledTextPrintOptions options = new StyledTextPrintOptions();
 * options.footer = "\t\t&lt;page&gt;";
 * options.jobName = "Example";
 * options.printLineBackground = true;
 *
 * Runnable runnable = styledText.print(new Printer(), options);
 * runnable.run();
 * </pre>
 *
 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
 *
 * @since 2.1
 */
public class StyledTextPrintOptions {
	/**
	 * Page number placeholder constant for use in <code>header</code>
	 * and <code>footer</code>. Value is <code>&lt;page&gt;</code>
	 */
	public static final String PAGE_TAG = "<page>";
	/**
	 * Separator constant for use in <code>header</code> and
	 * <code>footer</code>. Value is <code>\t</code>
	 */
	public static final String SEPARATOR = "\t";
	/**
	 * Formatted text to print in the header of each page.
	 * <p>"left '\t' center '\t' right"</p>
	 * <p>left, center, right = &lt;page&gt; | #CDATA</p>
	 * <p>Header and footer are defined as three separate regions for arbitrary
	 * text or the page number placeholder &lt;page&gt;
	 * (<code>StyledTextPrintOptions.PAGE_TAG</code>). The three regions are
	 * left aligned, centered and right aligned. They are separated by a tab
	 * character (<code>StyledTextPrintOptions.SEPARATOR</code>).
	 */
	public String header = null;
	/**
	 * Formatted text to print in the footer of each page.
	 * <p>"left '\t' center '\t' right"</p>
	 * <p>left, center, right = &lt;page&gt; | #CDATA</p>
	 * <p>Header and footer are defined as three separate regions for arbitrary
	 * text or the page number placeholder &lt;page&gt;
	 * (<code>StyledTextPrintOptions.PAGE_TAG</code>). The three regions are
	 * left aligned, centered and right aligned. They are separated by a tab
	 * character (<code>StyledTextPrintOptions.SEPARATOR</code>).
	 */
	public String footer = null;
	/**
	 * Name of the print job.
	 */
	public String jobName = null;

	/**
	 * Print the text foreground color. Default value is <code>false</code>.
	 */
	public boolean printTextForeground = false;
	/**
	 * Print the text background color. Default value is <code>false</code>.
	 */
	public boolean printTextBackground = false;
	/**
	 * Print the font styles. Default value is <code>false</code>.
	 */
	public boolean printTextFontStyle = false;
	/**
	 * Print the line background color. Default value is <code>false</code>.
	 */
	public boolean printLineBackground = false;

	/**
	 * Print line numbers. Default value is <code>false</code>.
	 *
	 * @since 3.3
	 */
	public boolean printLineNumbers = false;

	/**
	 * Labels used for printing line numbers.
	 *
	 * @since 3.4
	 */
	public String[] lineLabels = null;

}

Back to the top