]> git.lyx.org Git - lyx.git/blob - src/PrinterParams.h
The std::string mammoth path.
[lyx.git] / src / PrinterParams.h
1 // -*- C++ -*-
2 /**
3  * \file PrinterParams.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Allan Rae
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef PRINTERPARAMS_H
13 #define PRINTERPARAMS_H
14
15 #include "lyxrc.h"
16
17 /**
18   This struct contains (or should contain) all the parameters required for
19   printing a buffer.  Some work still needs to be done on this struct and
20   printing handling in general to make it nice and full-featured.
21   The main things I'd like to add now is the ability to print a read-only
22   document with different orientation, papersize or single/duplex state
23   than the document's settings. ARRae 20000423
24 */
25 struct PrinterParams {
26         ///
27         enum Target {
28                 ///
29                 PRINTER,
30                 ///
31                 FILE
32         };
33         ///
34         Target target;
35         ///
36         std::string printer_name;
37         ///
38         std::string file_name;
39         ///
40         bool all_pages;
41         /** Print a page range. Both from_page and to_page used to be strings
42             because they're actually easier to work with that way.  I've
43             switched to_page to be an int.  However, from_page will remain a
44             string because I want the from_page field to be able to be used as
45             a page range "1,3-5" and so on.
46             I've modified the invariant test to match. ARRae 20000518
47          */
48         unsigned int from_page;
49         ///
50         unsigned int to_page;
51         ///
52         bool odd_pages;
53         ///
54         bool even_pages;
55         ///
56         unsigned int count_copies;
57         ///
58         bool sorted_copies;
59         ///
60         bool reverse_order;
61         // The settings below should allow us to print any read-only doc in
62         // whatever size/orientation we want it -- overriding the documents
63         // settings.
64         // Override the documents orientation
65         // bool orientation;
66         // Print n pages per physical sheet
67         // unsigned int nup;
68         // Override document settings for duplex.
69         // bool duplex;
70
71         /** Test that all the fields contain valid entries.  It's unlikely
72             that the internal code will get this wrong (at least for the
73             xforms code anyway) however new ports and external scripts
74             might drive the wrong values in.
75          */
76         void testInvariant() const;
77         ///
78         PrinterParams(Target t = PRINTER,
79                       std::string const & pname = lyxrc.printer,
80                       std::string const & fname = std::string(),
81                       bool all = true,
82                       unsigned int from = 1,
83                       unsigned int to = 0,
84                       bool odd = true,
85                       bool even = true,
86                       unsigned int copies = 1,
87                       bool sorted = false,
88                       bool reverse = false);
89         ///
90         PrinterParams(PrinterParams const & pp);
91 };
92
93 #endif