X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FPrinterParams.h;h=73b10c368ccb50ff178a7120f8148f3b83af7592;hb=3d4076b598deb18660e50ec9c327efc3b15f15d0;hp=06dd555d15db2d4c9f808b7711414b60e90a89ab;hpb=ec3f0632501769bee4a14e97cfdcb1e2dc84ac33;p=lyx.git diff --git a/src/PrinterParams.h b/src/PrinterParams.h index 06dd555d15..73b10c368c 100644 --- a/src/PrinterParams.h +++ b/src/PrinterParams.h @@ -1,37 +1,36 @@ // -*- C++ -*- -/* This file is part of - * ====================================================== - * - * LyX, The Document Processor +/** + * \file PrinterParams.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team + * \author Allan Rae * - * This file Copyright 1999-2001 - * Allan Rae - *====================================================== + * Full author contact details are available in file CREDITS. */ #ifndef PRINTERPARAMS_H #define PRINTERPARAMS_H -#include "lyxrc.h" +#include -#ifdef ENABLE_ASSERTIONS -#include "support/lstrings.h" -#include "support/LAssert.h" -#endif +namespace lyx { /** - This struct contains (or should contain) all the parameters required for - printing a buffer. Some work still needs to be done on this struct and + This class contains (or should contain) all the parameters required for + printing a buffer. Some work still needs to be done on this class and printing handling in general to make it nice and full-featured. The main things I'd like to add now is the ability to print a read-only document with different orientation, papersize or single/duplex state than the document's settings. ARRae 20000423 */ -struct PrinterParams { +class PrinterParams +{ +public: + /// + PrinterParams(); + /// enum Target { /// @@ -39,12 +38,20 @@ struct PrinterParams { /// FILE }; + + /** Test that all the fields contain valid entries. It's unlikely + that the internal code will get this wrong however new ports + and external scripts might drive the wrong values in. + */ + void testInvariant() const; + +public: /// Target target; /// - string printer_name; + std::string printer_name; /// - string file_name; + std::string file_name; /// bool all_pages; /** Print a page range. Both from_page and to_page used to be strings @@ -77,70 +84,9 @@ struct PrinterParams { // Override document settings for duplex. // bool duplex; - /** Test that all the fields contain valid entries. It's unlikely - that the internal code will get this wrong (at least for the - xforms code anyway) however new ports and external scripts - might drive the wrong values in. - */ - void testInvariant() const - { -#ifdef ENABLE_ASSERTIONS - switch (target) { - case PRINTER: - //Assert(!printer_name.empty()); - break; - case FILE: - lyx::Assert(!file_name.empty()); - break; - default: - lyx::Assert(false); - break; - } -#endif - } - - /// - PrinterParams(Target const & t = PRINTER, - string const & pname = lyxrc.printer, - string const & fname = string(), - bool const all = true, - unsigned int const & from = 1, - unsigned int const & to = 0, - bool const odd = true, - bool const even = true, - unsigned int const & copies = 1, - bool const sorted = false, - bool const reverse = false) - : target(t), - printer_name(pname), - file_name(fname), - all_pages(all), - from_page(from), - to_page(to), - odd_pages(odd), - even_pages(even), - count_copies(copies), - sorted_copies(sorted), - reverse_order(reverse) - { - testInvariant(); - } - /// - PrinterParams(PrinterParams const & pp) - : target(pp.target), - printer_name(pp.printer_name), - file_name(pp.file_name), - all_pages(pp.all_pages), - from_page(pp.from_page), - to_page(pp.to_page), - odd_pages(pp.odd_pages), - even_pages(pp.even_pages), - count_copies(pp.count_copies), - sorted_copies(pp.sorted_copies), - reverse_order(pp.reverse_order) - { - testInvariant(); - } }; + +} // namespace lyx + #endif