• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeprint
 

tdeprint

  • tdeprint
kprinter.h
1/*
2 * This file is part of the KDE libraries
3 * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
4 *
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License version 2 as published by the Free Software Foundation.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 **/
20
21#ifndef KPRINTER_H
22#define KPRINTER_H
23
24#include <tqpaintdevice.h>
25#include <tqprinter.h>
26#include <tqmap.h>
27#include <tqstring.h>
28#include <tqstringlist.h>
29#include <tqvaluelist.h>
30#include <tdemacros.h>
31#include <tdelibs_export.h>
32
33#include <tdeprint/kpreloadobject.h>
34
35class KPrinterImpl;
36class KPrintDialogPage;
37class KPrinterPrivate;
38class DrPageSize;
39
88class TDEPRINT_EXPORT KPrinter : public TQPaintDevice, public KPReloadObject
89{
90friend class KPrinterWrapper;
91friend class KPrinterImpl;
92public:
93 // Print global settings (set via static functions)
102 enum StandardPageType { CopiesPage = 0x01, FilesPage = 0x02, Custom = 0x10 };
116 enum PageSelectionType { ApplicationSide = 0x01, SystemSide = 0x02 };
126 enum ApplicationType { Dialog = 0x00, StandAlone = 0x01, StandAlonePersistent = 0x02 };
127
128 // TQPrinter extension
137 enum PageSetType { AllPages = 0x00, OddPages = 0x01, EvenPages = 0x02 };
145 enum CollateType { Collate = 0x00, Uncollate = 0x01 };
146
147 // from TQPrinter class
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 };
167 enum PageSize
168 {
169 A4 = TQPrinter::A4,
170 B5 = TQPrinter::B5,
171 Letter = TQPrinter::Letter,
172 Legal = TQPrinter::Legal,
173 Executive = TQPrinter::Executive,
174 A0 = TQPrinter::A0,
175 A1 = TQPrinter::A1,
176 A2 = TQPrinter::A2,
177 A3 = TQPrinter::A3,
178 A5 = TQPrinter::A5,
179 A6 = TQPrinter::A6,
180 A7 = TQPrinter::A7,
181 A8 = TQPrinter::A8,
182 A9 = TQPrinter::A9,
183 B0 = TQPrinter::B0,
184 B1 = TQPrinter::B1,
185 B10 = TQPrinter::B10,
186 B2 = TQPrinter::B2,
187 B3 = TQPrinter::B3,
188 B4 = TQPrinter::B4,
189 B6 = TQPrinter::B6,
190 B7 = TQPrinter::B7,
191 B8 = TQPrinter::B8,
192 B9 = TQPrinter::B9,
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
200 };
201
202 // constructors / destructor
210 KPrinter(bool restore = true, TQPrinter::PrinterMode m = TQPrinter::ScreenResolution );
214 ~KPrinter();
215
216 // TQPrinter interface (+ some extensions)
220 bool newPage();
224 bool abort();
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);
312 int minPage() const;
316 int maxPage() const;
320 void setMinMax(int, int);
329 int fromPage() const TDE_DEPRECATED;
338 int toPage() const;
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;
481
482 void margins( uint *top, uint *left, uint *bottom, uint *right ) const;
483 void setMargins( uint top, uint left, uint bottom, uint right );
484
491 TQValueList<int> pageList() const;
511 void setPreviewOnly(bool on);
516 bool previewOnly() const;
525 void setResolution(int dpi);
531 int resolution() const;
532
543 void setUsePrinterResolution( bool on );
544
548 KPrinterImpl* implementation() const;
556 bool printFiles(const TQStringList& files, bool removeafter = false, bool startviewer = true);
557
567 static void addDialogPage(KPrintDialogPage* _page);
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);
615 //static int addPrinterWizard(TQWidget *parent = 0);
616
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);
676
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;
749
750protected:
751 virtual bool cmd(int, TQPainter*, TQPDevCmdParam*);
752 virtual int metric(int) const;
753 void translateQtOptions();
754 void loadSettings();
755 void saveSettings();
756 void preparePrinting();
757 void finishPrinting();
758 void reload();
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 );
763
764protected:
765 KPrinterPrivate *d;
766};
767
768//**************************************************************************************
769
770// Utility functions
771
772TDEPRINT_EXPORT KPrinter::PageSize pageNameToPageSize(const TQString& name);
773TDEPRINT_EXPORT const char* pageSizeToPageName(KPrinter::PageSize s);
778TQSize rangeToSize( const TQString& );
779
780#endif
KPrintDialogPage
This class is intended to be used as base class for customized print dialog page.
Definition: kprintdialogpage.h:91
KPrinter
This class is the main interface to access the TDE print framework.
Definition: kprinter.h:89
KPrinter::PageSize
PageSize
Defines the paper size to use.
Definition: kprinter.h:168
KPrinter::ApplicationType
ApplicationType
Defines the type of the application, this affects the GUI of the print dialog:
Definition: kprinter.h:126
KPrinter::StandardPageType
StandardPageType
Defines the standard pages available for the print dialog:
Definition: kprinter.h:102
KPrinter::PageSelectionType
PageSelectionType
Defines whether the application can perform page selection itself or not.
Definition: kprinter.h:116
KPrinter::PageSetType
PageSetType
Defines the page set to print:
Definition: kprinter.h:137
KPrinter::CollateType
CollateType
Defines the collate property of the printer (if supported by the print system):
Definition: kprinter.h:145
KPrinter::PageOrder
PageOrder
Defines the page order of the print job.
Definition: kprinter.h:162
KPrinter::ColorMode
ColorMode
Defines the color mode of the printer.
Definition: kprinter.h:152
KPrinter::Orientation
Orientation
Defines the orientation of the paper.
Definition: kprinter.h:157

tdeprint

Skip menu "tdeprint"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeprint

Skip menu "tdeprint"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeprint by doxygen 1.9.4
This website is maintained by Timothy Pearson.