prinfo.h
上传用户:hzhsqp
上传日期:2007-01-06
资源大小:1600k
文件大小:11k
- /*
- * prinfo.h
- *
- * Printer job information class.
- *
- * Portable Windows Library
- *
- * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is Portable Windows Library.
- *
- * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
- *
- * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
- * All Rights Reserved.
- *
- * Contributor(s): ______________________________________.
- *
- * $Log: prinfo.h,v $
- * Revision 1.12 1999/03/10 03:49:52 robertj
- * More documentation adjustments.
- *
- * Revision 1.11 1999/03/09 08:01:49 robertj
- * Changed comments for doc++ support (more to come).
- *
- * Revision 1.10 1999/02/16 08:08:46 robertj
- * MSVC 6.0 compatibility changes.
- *
- * Revision 1.9 1998/12/12 00:42:58 robertj
- * Added functions for user request on printing selection only.
- * Fixed transfer of start and end pages from PPrintDialog.
- *
- * Revision 1.8 1998/09/23 06:28:24 robertj
- * Added open source copyright license.
- *
- * Revision 1.7 1995/06/17 11:13:01 robertj
- * Documentation update.
- *
- * Revision 1.6 1995/03/14 12:42:11 robertj
- * Updated documentation to use HTML codes.
- *
- * Revision 1.5 1995/01/11 09:45:05 robertj
- * Documentation and normalisation.
- *
- * Revision 1.4 1994/08/23 11:32:52 robertj
- * Oops
- *
- * Revision 1.3 1994/08/22 00:46:48 robertj
- * Added pragma fro GNU C++ compiler.
- *
- * Revision 1.2 1994/06/25 11:55:15 robertj
- * Unix version synchronisation.
- *
- * Revision 1.1 1994/04/01 14:25:36 robertj
- * Initial revision
- *
- */
- #define _PPRINTINFO
- #ifdef __GNUC__
- #pragma interface
- #endif
- /**This class defines the setup parameters for a printer. Instances of this
- class are usually created by the Ref{PPrintJobDialog} or
- Ref{PPrinterSetupDialog} standard dialogs.
- Not all of the specified parameters will have an effect on all platforms,
- or even on all printers for a particular platform.
- */
- class PPrintInfo : public PObject
- {
- PCLASSINFO(PPrintInfo, PObject);
- public:
- /**Create an object to encapsulate printing information. The first form
- selects the system default printer and port, the second allows an
- arbitrary printer and port to be specified by the application.
-
- It is possible for there to be a different setup for the same printer
- type on different devices, eg a "postscript" printer type on "LPT1" is
- only A4 but on "LPT2" is capabile of A3.
- Explicit selection of a printer type and device is rare as the string
- contents are platform dependent. It is possible though that they may
- come from a configuration file that is itself platform dependent.
- */
- PPrintInfo();
- PPrintInfo(
- const PString & printerType,
- /**Printer type name for printing to, eg "Postscript". The possible
- values for this parameter are platform dependent and would rarely be
- set explicitly by the application.
- */
- const PString & devicePort
- /**Output device or queue for printer, eg "LPT1" for MS-Windows or
- "PS_LASER" for Unix. The possible values for this parameter are
- platform dependent and would rarely be set explicitly by the
- application.
- */
- );
- /**@name New members for class */
- /**Get the printer type name that this printer setup information is for.
-
- @return
- string name of the printer type.
- */
- PString GetPrinter() const;
- /**Get the printer device name that this printer setup information is for.
-
- @return
- string name of the printer device.
- */
- PString GetDevice() const;
- /** Standard paper sizes for printer setup. */
- enum Forms {
- /**Custom form size, the page size must be set by the
- Ref{SetPaperSize()} function if this form type is used.
- */
- Custom,
- /// Standard metric A3 size paper.
- A3,
- /// Standard metric A4 size paper.
- A4,
- /// Standard metric A5 size paper.
- A5,
- /// Standard metric B4 size paper.
- B4,
- /// Standard metric B5 size paper.
- B5,
- /// Standard US letter size paper.
- USLetter,
- /// Standard US legal size paper.
- USLegal,
- /// Total number of form types thsi setup can understand.
- MaxForm
- };
- /**Set the print form used. This can be a standard paper size or the
- #Custom# value which allows arbitrary paper sizes.
-
- Note that not all printers will take any notice of this parameter.
- */
- void SetForm(
- Forms newForm /// New standard paper size for printer setup.
- );
- /**Get the print form used. This can be a standard paper size or the
- #Custom# value which allows arbitrary paper sizes.
-
- Note that not all printers will take any notice of this parameter.
- @return
- current form for printer setup.
- */
- Forms GetForm() const;
- /**Set the paper size in tenths of a millimeter. A call to this function
- will automatically set the form type to #Custom#.
- Note that not all printers will take any notice of this parameter.
- */
- void SetPaperSize(
- const PDim & dim /// Dimensions of the paper page.
- );
- /**Get the paper size in tenths of a millimeter. If the form is
- #Custom# then the value set in Ref{SetPaperSize()} is
- returned. If a standard form is selected, eg #A4#, then the
- size of the standard form is returned.
- @return
- current paper size.
- */
- PDim GetPaperSize() const;
- /**Get the printer device resolution in dots per inch for the horizontal
- and vertical dimensions. Usually these are the same but some dot matrix
- or ink jet printers cannot render vertically as well as horizontally.
- @return
- printer resolution in DPI.
- */
- PDim GetResolution() const;
- /** Set the number of copies to be produced by the print job. */
- void SetCopies(
- unsigned count /// Number of copies to print.
- );
- /**Get the number of copies to be produced by the print job.
-
- @return
- total copies to print.
- */
- unsigned GetCopies() const;
- /**Set the paper orientation. The printing can be either {it portrait}
- or {it landscape}.
- */
- void SetPortrait(
- BOOL port = TRUE /// Flag for portrait (TRUE) or landscape (FALSE).
- );
- /**Set the paper orientation to landscape. This is equivalent to
- #SetPortrait(FALSE)#.
- */
- void SetLandscape();
- /**Determine the paper orientation.
-
- @return
- TRUE if paper is in portait mode, FALSE if landscape.
- */
- BOOL IsPortrait() const;
- /**Determine if printer quality is in draft mode, otherwise final or letter
- quality mode is used. Some printers, eg lasers, are never in draft
- quality mode.
- @return
- TRUE if printing is in draft quality.
- */
- BOOL IsDraftQuality() const;
- /**Set the starting page for the print job. This is effectively a count of
- pages to skip before outputing data. Page 1 is the first page and will
- print from the start of the print job.
- Note if the Start page is set to zero, then the ability to set the page
- range is disabled.
- */
- void SetStartPage(
- unsigned page /// First page to print.
- );
- /**Get the starting page for the print job. This is effectively a count of
- pages to skip before outputing data. Page 1 is the first page and will
- print from the start of the print job.
- Note if the Start page is set to zero, then the ability to set the page
- range is disabled.
- @return
- first page to print.
- */
- unsigned GetStartPage() const;
- /**Set the ending page for the print job. Page 1 is the first page and will
- print only that page. Use 0 or a very large number to print through to
- the end of the print job.
- */
- void SetEndPage(
- unsigned page /// Last page to print.
- );
- /**Set the ending page for the print job. Page 1 is the first page and will
- print only that page. Use 0 or a very large number to print through to
- the end of the print job.
- @return
- last page to print.
- */
- unsigned GetEndPage() const;
- /** Options for printing selected "items" only. */
- enum SelectionOnly {
- /// There is no such option as print selection.
- NoSelectionOnly,
- /// Print selection is available but is not required.
- SelectionOnlyOff,
- /// Only print the selection.
- SelectionOnlyOn,
- };
- /**Set the flag for if the selection in the document is to be printed. If
- the #NoSelectionOnly# valus is used then there is no
- provision for the user to indicate that only the selction is to be
- printed.
- */
- void SetSelectionOnly(
- SelectionOnly selOnly
- );
- /**Get the flag for if the selection in the document is to be printed. If
- the #NoSelectionOnly# valus is used then there is no
- provision for the user to indicate that only the selction is to be
- printed.
- @return
- Current selection only print flag state.
- */
- SelectionOnly GetSelectionOnly() const;
- /**Simplification of the GetSelectionOnly() function which indicates that
- the document selection is to be printed.
- @return
- TRUE if selection is to be printed.
- */
- BOOL IsSelectionOnly() const;
- protected:
- // Member variables
- /** Printer type string. */
- PString printer;
-
- /** Printer device string. */
- PString device;
- /** Standard paper size for setup. */
- Forms form;
- /** Current forms paper fize in tenths of a millimeter. */
- PDim paperSize;
- /** Current printer types resultion in dots per inch. */
- PDim resolution;
- /** First page to print. */
- unsigned startPage;
- /** Last page to print. */
- unsigned endPage;
- /** Print the selection */
- SelectionOnly selectionOnly;
- /** Number of copies to print. */
- unsigned copies;
- /** Page orientation, TRUE is portrait mode. */
- BOOL orientation;
- /** Printer is to print in draft quality. */
- BOOL draftQuality;
- #ifdef DOC_PLUS_PLUS
- };
- #endif
- // Class declaration continued in platform specific header file ///////////////