2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1995 Matthias Ettrich
8 * Copyright 1995-2001 The LyX Team
10 * This file Copyright 1999-2001
12 *======================================================
15 #ifndef PRINTERPARAMS_H
16 #define PRINTERPARAMS_H
20 #ifdef ENABLE_ASSERTIONS
21 #include "support/lstrings.h"
22 #include "support/LAssert.h"
27 This struct contains (or should contain) all the parameters required for
28 printing a buffer. Some work still needs to be done on this struct and
29 printing handling in general to make it nice and full-featured.
30 The main things I'd like to add now is the ability to print a read-only
31 document with different orientation, papersize or single/duplex state
32 than the document's settings. ARRae 20000423
34 struct PrinterParams {
50 /** Print a page range. Both from_page and to_page used to be strings
51 because they're actually easier to work with that way. I've
52 switched to_page to be an int. However, from_page will remain a
53 string because I want the from_page field to be able to be used as
54 a page range "1,3-5" and so on.
55 I've modified the invariant test to match. ARRae 20000518
57 unsigned int from_page;
65 unsigned int count_copies;
70 // The settings below should allow us to print any read-only doc in
71 // whatever size/orientation we want it -- overriding the documents
73 // Override the documents orientation
75 // Print n pages per physical sheet
77 // Override document settings for duplex.
80 /** Test that all the fields contain valid entries. It's unlikely
81 that the internal code will get this wrong (at least for the
82 xforms code anyway) however new ports and external scripts
83 might drive the wrong values in.
85 void testInvariant() const
87 #ifdef ENABLE_ASSERTIONS
90 //lyx::support::Assert(!printer_name.empty());
93 lyx::support::Assert(!file_name.empty());
96 lyx::support::Assert(false);
103 PrinterParams(Target const & t = PRINTER,
104 string const & pname = lyxrc.printer,
105 string const & fname = string(),
106 bool const all = true,
107 unsigned int const & from = 1,
108 unsigned int const & to = 0,
109 bool const odd = true,
110 bool const even = true,
111 unsigned int const & copies = 1,
112 bool const sorted = false,
113 bool const reverse = false)
122 count_copies(copies),
123 sorted_copies(sorted),
124 reverse_order(reverse)
129 PrinterParams(PrinterParams const & pp)
131 printer_name(pp.printer_name),
132 file_name(pp.file_name),
133 all_pages(pp.all_pages),
134 from_page(pp.from_page),
136 odd_pages(pp.odd_pages),
137 even_pages(pp.even_pages),
138 count_copies(pp.count_copies),
139 sorted_copies(pp.sorted_copies),
140 reverse_order(pp.reverse_order)