24 #include <tqpaintdevice.h>
25 #include <tqprinter.h>
28 #include <tqstringlist.h>
29 #include <tqvaluelist.h>
30 #include <tdemacros.h>
31 #include <tdelibs_export.h>
33 #include <tdeprint/kpreloadobject.h>
37 class KPrinterPrivate;
88 class TDEPRINT_EXPORT
KPrinter :
public TQPaintDevice,
public KPReloadObject
90 friend class KPrinterWrapper;
91 friend class KPrinterImpl;
126 enum ApplicationType { Dialog = 0x00, StandAlone = 0x01, StandAlonePersistent = 0x02 };
137 enum PageSetType { AllPages = 0x00, OddPages = 0x01, EvenPages = 0x02 };
152 enum ColorMode { GrayScale = TQPrinter::GrayScale, Color = TQPrinter::Color };
157 enum Orientation { Portrait = TQPrinter::Portrait, Landscape = TQPrinter::Landscape };
162 enum PageOrder { FirstPageFirst = TQPrinter::FirstPageFirst, LastPageFirst = TQPrinter::LastPageFirst };
171 Letter = TQPrinter::Letter,
172 Legal = TQPrinter::Legal,
173 Executive = TQPrinter::Executive,
185 B10 = TQPrinter::B10,
193 C5E = TQPrinter::C5E,
194 Comm10E = TQPrinter::Comm10E,
195 DLE = TQPrinter::DLE,
196 Folio = TQPrinter::Folio,
197 Ledger = TQPrinter::Ledger,
198 Tabloid = TQPrinter::Tabloid,
199 NPageSize = TQPrinter::NPageSize
210 KPrinter(
bool restore =
true, TQPrinter::PrinterMode m = TQPrinter::ScreenResolution );
228 bool aborted()
const;
232 bool outputToFile()
const;
236 void setOutputToFile(
bool);
240 TQString outputFileName()
const;
244 void setOutputFileName(
const TQString&);
248 TQString docName()
const;
252 void setDocName(
const TQString&);
256 TQString creator()
const;
260 void setCreator(
const TQString&);
264 bool fullPage()
const;
268 void setFullPage(
bool);
272 ColorMode colorMode()
const;
276 void setColorMode(ColorMode);
280 int numCopies()
const;
284 void setNumCopies(
int n);
288 Orientation orientation()
const;
292 void setOrientation(Orientation,
bool locking =
false);
296 PageOrder pageOrder()
const;
300 void setPageOrder(PageOrder);
304 CollateType collate()
const;
308 void setCollate(CollateType type);
320 void setMinMax(
int,
int);
329 int fromPage() const TDE_DEPRECATED;
342 void setFromTo(
int,
int);
346 PageSize pageSize() const;
350 void setPageSize(PageSize,
bool locking = false);
354 TQString printerName() const;
358 void setPrinterName(const TQString&);
365 TQString printProgram() const;
394 void setPrintProgram(const TQString& cmd);
398 TQString printerSelectionOption() const;
402 void setPrinterSelectionOption(const TQString&);
407 int currentPage() const;
435 void setCurrentPage(
int p = 0);
439 PageSetType pageSet() const;
447 bool setup(TQWidget *parent = 0, const TQString& caption = TQString::null,
bool forceExpand = false);
451 TQSize margins() const;
455 void setMargins(TQSize m);
465 TQSize realPageSize() const;
470 void setRealPageSize( TQSize p );
475 void setRealDrawableArea( const TQRect& r );
480 TQRect realDrawableArea() const;
482 void margins( uint *top, uint *left, uint *bottom, uint *right ) const;
483 void setMargins( uint top, uint left, uint bottom, uint right );
491 TQValueList<
int> pageList() const;
511 void setPreviewOnly(
bool on);
516 bool previewOnly() const;
525 void setResolution(
int dpi);
531 int resolution() const;
543 void setUsePrinterResolution(
bool on );
548 KPrinterImpl* implementation() const;
556 bool printFiles(const TQStringList& files,
bool removeafter = false,
bool startviewer = true);
574 static
void setPageSelection(PageSelectionType _mode);
580 static PageSelectionType pageSelection();
587 static
void setApplicationType(ApplicationType type);
593 static ApplicationType applicationType();
600 static
void addStandardPage(
int p);
608 static
void removeStandardPage(
int p);
647 const TQString& option(const TQString& key) const;
656 void setOption(const TQString& key, const TQString& value);
661 const TQMap<TQString,TQString>& options() const;
668 void setOptions(const TQMap<TQString,TQString>& opts);
675 void initOptions(const TQMap<TQString,TQString>& opts);
683 TQString searchName() const;
689 void setSearchName(const TQString& n);
694 TQString errorMessage() const;
699 void setErrorMessage(const TQString& msg);
717 bool autoConfigure(const TQString& prname = TQString::null, TQWidget *parent = 0);
726 void setDocFileName(const TQString& filename);
733 TQString docFileName() const;
741 void setDocDirectory( const TQString& dir );
748 TQString docDirectory() const;
751 virtual
bool cmd(
int, TQPainter*, TQPDevCmdParam*);
752 virtual
int metric(
int) const;
753 void translateQtOptions();
756 void preparePrinting();
757 void finishPrinting();
759 void init(
bool restore = true, TQPrinter::PrinterMode m = TQPrinter::ScreenResolution);
760 bool doPreview(const TQString& file);
761 void setRealPageSize(DrPageSize* p);
762 void setOption( const TQString& key, const TQString& value,
bool broadcast );
772 TDEPRINT_EXPORT
KPrinter::PageSize pageNameToPageSize(const TQString& name);
773 TDEPRINT_EXPORT const
char* pageSizeToPageName(
KPrinter::PageSize s);
778 TQSize rangeToSize( const TQString& );
This class is intended to be used as base class for customized print dialog page.
This class is the main interface to access the TDE print framework.
PageSize
Defines the paper size to use.
ApplicationType
Defines the type of the application, this affects the GUI of the print dialog:
StandardPageType
Defines the standard pages available for the print dialog:
PageSelectionType
Defines whether the application can perform page selection itself or not.
PageSetType
Defines the page set to print:
CollateType
Defines the collate property of the printer (if supported by the print system):
PageOrder
Defines the page order of the print job.
ColorMode
Defines the color mode of the printer.
Orientation
Defines the orientation of the paper.