X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FPrinterParams.h;h=61e96f6807fa7d1bf99a6012b99dd50982714ed9;hb=068e2cfb25bfbab62f80bc0c776ca169032c2219;hp=2c19c0af7418c4305617ed0b68a5b1facfcc6743;hpb=946895278050e4a464c9591e99232a72f5f4dec9;p=lyx.git diff --git a/src/PrinterParams.h b/src/PrinterParams.h index 2c19c0af74..61e96f6807 100644 --- a/src/PrinterParams.h +++ b/src/PrinterParams.h @@ -21,8 +21,10 @@ #ifdef ENABLE_ASSERTIONS #include "support/LAssert.h" +extern bool containsOnly(string const &, char const *); #endif + /** 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 @@ -33,15 +35,27 @@ */ struct PrinterParams { /// - enum Target{PRINTER, FILE}; + enum Target { + /// + PRINTER, + /// + FILE + }; /// Target target; /// string printer_name; /// string file_name; - ///We allow printing of even pages in a range and so on. - enum WhichPages{ALL, ODD, EVEN}; + /// We allow printing of even pages in a range and so on. + enum WhichPages{ + /// + ALL, + /// + ODD, + /// + EVEN + }; /// WhichPages which_pages; /** Print a page range. Both from_page and to_page used to be strings @@ -63,60 +77,13 @@ struct PrinterParams { // The settings below should allow us to print any read-only doc in // whatever size/orientation we want it -- overriding the documents // settings. - /// Override the documents orientation - //bool orientation; - /// Print n pages per physical sheet - //unsigned int nup; - /// Override document settings for duplex. - //bool duplex; - - //@name Constructors and Deconstructors - //@{ - /// - PrinterParams(Target const & t = PRINTER, - string const & pname = lyxrc.printer, - string const & fname = string(), - WhichPages const wp = ALL, - string const & from = string(), - int const & to = 0, - bool const reversed = false, - bool const unsorted = false, - int const & num_copies = 1) - : target(t), - printer_name(pname), - file_name(fname), - which_pages(wp), - from_page(from), - to_page(to), - reverse_order(reversed), - unsorted_copies(unsorted), - count_copies(num_copies) - { - testInvariant(); - } - /// - PrinterParams(PrinterParams const & pp) - : target(pp.target), - printer_name(pp.printer_name), - file_name(pp.file_name), - which_pages(pp.which_pages), - from_page(pp.from_page), - to_page(pp.to_page), - reverse_order(pp.reverse_order), - unsorted_copies(pp.unsorted_copies), - count_copies(pp.count_copies) - { - testInvariant(); - } - //@} - - -// do we need these? -// friend bool operator==(PrinterParams const &, PrinterParams const &); -// friend bool operator<(PrinterParams const &, PrinterParams const &); + // Override the documents orientation + // bool orientation; + // Print n pages per physical sheet + // unsigned int nup; + // Override document settings for duplex. + // bool duplex; - //@name Invariant Test Method - //@{ /** 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 @@ -125,7 +92,6 @@ struct PrinterParams { void testInvariant() const { #ifdef ENABLE_ASSERTIONS - extern bool containsOnly(string const &, char const *); if (!from_page.empty()) { // Assert(from_page == number or empty) Assert(containsOnly(from_page, "1234567890")); @@ -157,10 +123,43 @@ struct PrinterParams { } #endif } - //@} + + /// + PrinterParams(Target const & t = PRINTER, + string const & pname = lyxrc.printer, + string const & fname = string(), + WhichPages const wp = ALL, + string const & from = string(), + int const & to = 0, + bool const reversed = false, + bool const unsorted = false, + int const & num_copies = 1) + : target(t), + printer_name(pname), + file_name(fname), + which_pages(wp), + from_page(from), + to_page(to), + reverse_order(reversed), + unsorted_copies(unsorted), + count_copies(num_copies) + { + testInvariant(); + } + /// + PrinterParams(PrinterParams const & pp) + : target(pp.target), + printer_name(pp.printer_name), + file_name(pp.file_name), + which_pages(pp.which_pages), + from_page(pp.from_page), + to_page(pp.to_page), + reverse_order(pp.reverse_order), + unsorted_copies(pp.unsorted_copies), + count_copies(pp.count_copies) + { + testInvariant(); + } }; #endif - - -