1 /*******************************************************************************
2 * Copyright (c) 2000, 2008 IBM Corporation and others.
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/
9 * SPDX-License-Identifier: EPL-2.0
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.custom;
17 * Use StyledTextPrintOptions to specify printing options for the
18 * StyledText.print(Printer, StyledTextPrintOptions) API.
20 * The following example prints a right aligned page number in the footer,
21 * sets the job name to "Example" and prints line background colors but no other
25 * StyledTextPrintOptions options = new StyledTextPrintOptions();
26 * options.footer = "\t\t<page>";
27 * options.jobName = "Example";
28 * options.printLineBackground = true;
30 * Runnable runnable = styledText.print(new Printer(), options);
34 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
38 public class StyledTextPrintOptions {
40 * Page number placeholder constant for use in <code>header</code>
41 * and <code>footer</code>. Value is <code><page></code>
43 public static final String PAGE_TAG = "<page>";
45 * Separator constant for use in <code>header</code> and
46 * <code>footer</code>. Value is <code>\t</code>
48 public static final String SEPARATOR = "\t";
50 * Formatted text to print in the header of each page.
51 * <p>"left '\t' center '\t' right"</p>
52 * <p>left, center, right = <page> | #CDATA</p>
53 * <p>Header and footer are defined as three separate regions for arbitrary
54 * text or the page number placeholder <page>
55 * (<code>StyledTextPrintOptions.PAGE_TAG</code>). The three regions are
56 * left aligned, centered and right aligned. They are separated by a tab
57 * character (<code>StyledTextPrintOptions.SEPARATOR</code>).
59 public String header = null;
61 * Formatted text to print in the footer of each page.
62 * <p>"left '\t' center '\t' right"</p>
63 * <p>left, center, right = <page> | #CDATA</p>
64 * <p>Header and footer are defined as three separate regions for arbitrary
65 * text or the page number placeholder <page>
66 * (<code>StyledTextPrintOptions.PAGE_TAG</code>). The three regions are
67 * left aligned, centered and right aligned. They are separated by a tab
68 * character (<code>StyledTextPrintOptions.SEPARATOR</code>).
70 public String footer = null;
72 * Name of the print job.
74 public String jobName = null;
77 * Print the text foreground color. Default value is <code>false</code>.
79 public boolean printTextForeground = false;
81 * Print the text background color. Default value is <code>false</code>.
83 public boolean printTextBackground = false;
85 * Print the font styles. Default value is <code>false</code>.
87 public boolean printTextFontStyle = false;
89 * Print the line background color. Default value is <code>false</code>.
91 public boolean printLineBackground = false;
94 * Print line numbers. Default value is <code>false</code>.
98 public boolean printLineNumbers = false;
101 * Labels used for printing line numbers.
105 public String[] lineLabels = null;