home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / include / scribus-ng / scprintengine_gdi.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-03-10  |  5.4 KB  |  148 lines

  1. /*
  2. For general Scribus (>=1.3.2) copyright and licensing information please refer
  3. to the COPYING file provided with the program. Following this notice may exist
  4. a copyright and/or license notice that predates the release of Scribus 1.3.2
  5. for which a new license (GPL+exception) is in place.
  6. */
  7. #ifndef __SCPRINTENGINE_GDI_H__
  8. #define __SCPRINTENGINE_GDI_H__
  9.  
  10. #include <QByteArray>
  11. #include <QImage>
  12.  
  13. #include "scconfig.h"
  14. #include "scprintengine.h"
  15. #include "scribusdoc.h"
  16. #include "scribusstructs.h"
  17.  
  18. #include <cairo.h>
  19. #include <windows.h>
  20.  
  21. class SCRIBUS_API ScPrintEngine_GDI : public ScPrintEngine
  22. {
  23. protected:
  24.  
  25.     bool m_forceGDI;
  26.  
  27.     void resetData(void);
  28.  
  29.     typedef bool (ScPrintEngine_GDI::*PrintPageFunc) ( ScribusDoc* doc, Page* page, PrintOptions& options, HDC printerDC, cairo_t* context );
  30.  
  31.     /*! \brief Print selected pages to a printer or a file
  32.     \param doc the document whose pages are to be printer
  33.     \param options print options
  34.     \param printerDC an initialized printer device context
  35.     \param devMode the DEVMODE structure used for creating printerDC
  36.     \param fileName file name to print into
  37.     \retval bool true on success 
  38.     \author Jean Ghali
  39.     */
  40.     bool printPages( ScribusDoc* doc, PrintOptions& options, HDC printerDC, DEVMODEW* devMode, QString& fileName );
  41.     /*! \brief Print a page to a gdi printer
  42.     Print a page using GDI drawing code ( works on all printers : PS, PCL, GDI... )
  43.     \param doc the document whose page is to be printed
  44.     \param page the page to print
  45.     \param options print options
  46.     \param printerDC an initialized printer device context
  47.     \param context cairo context (not used by this function)
  48.     \retval bool true on success 
  49.     \author Jean Ghali
  50.     */
  51.     bool printPage_GDI ( ScribusDoc* doc, Page* page, PrintOptions& options, HDC printerDC, cairo_t* context );
  52.     /*! \brief Print a page to a PostScript printer using passthroughs
  53.     Print a page using PS drawing code and PS passthroughs ( works on PS printers only )
  54.     \param doc the document whose page is to be printed
  55.     \param page the page to print
  56.     \param options print options
  57.     \param printerDC an initialized printer device context
  58.     \param context cairo context (not used by this function)
  59.     \retval bool true on success 
  60.     \author Jean Ghali
  61.     */
  62.     bool printPage_PS  ( ScribusDoc* doc, Page* page, PrintOptions& options, HDC printerDC, cairo_t* context );
  63.     /*! \brief Print a page separations to a PostScript printer using passthroughs
  64.     Print a page using PS drawing code and PS passthroughs ( works on PS printers only )
  65.     \param doc the document whose page is to be printed
  66.     \param page the page to print
  67.     \param options print options
  68.     \param printerDC an initialized printer device context
  69.     \param context cairo context (not used by this function)
  70.     \retval bool true on success 
  71.     \author Jean Ghali
  72.     */
  73.     bool printPage_PS_Sep  ( ScribusDoc* doc, Page* page, PrintOptions& options, HDC printerDC, cairo_t* context );
  74.     /*! \brief Send a file to printer using PostScript Passthrough
  75.     Send a postscript file to a printer using ps passthrough ( works on PS printers only )
  76.     \param filePath the Postscript file path
  77.     \param printerDC the printer deice context
  78.     \param pageWidth width
  79.     \param pageHeight height
  80.     \retval bool true on success 
  81.     \author Jean Ghali
  82.     */
  83.     bool sendPSFile ( QString filePath, HDC printerDC, int pageWidth, int pageHeight );
  84.     /*! \brief Set device params into DEVMODE structure according to print options
  85.     Set printing params according to options and DEVMODE structure
  86.     \param options print options
  87.     \param devMode pointer to a DEVMODE structure
  88.     \author Jean Ghali
  89.     */
  90.     void setDeviceParams ( ScribusDoc* doc, PrintOptions& options, DEVMODEW* devMode );
  91.     /*! \brief Get support for PostScript Passthrough
  92.     Get ps passthrough support and escape code
  93.     \param printerDC the printer device context
  94.     \retval int the postscript passthrough escape code if success, 0 if the function fails
  95.     \author Jean Ghali
  96.     */
  97.     int getPSPassthroughSupport( HDC printerDC );
  98.     /*! \brief Check if a specified printer use the FILE: port
  99.     \param printerName the printer name
  100.     \retval bool return true if the specified printer print to the FILE: port 
  101.     \author Jean Ghali
  102.     */
  103.     bool printerUseFilePort ( QString& printerName );
  104.     /*! \brief Check if PostScript is supported by a printer device context
  105.     \param dc the printer device context
  106.     \retval bool return true if PostScript is supported 
  107.     \author Jean Ghali
  108.     */
  109.     bool isPostscriptPrinter( HDC dc );
  110.  
  111. public:
  112.  
  113.     ScPrintEngine_GDI(void);
  114.  
  115.     /*! \brief Force use of gdi even on ps printers
  116.     \param force if gdi should be forced
  117.     \author Jean Ghali
  118.     */
  119.     void setForceGDI(bool force);
  120.  
  121.     /*! \brief Print a document using gdi or ps methods
  122.     \param doc the document whose pages are to be printer
  123.     \param options print options
  124.     \retval bool return true if no error occurred 
  125.     \author Jean Ghali
  126.     */
  127.     virtual bool print(ScribusDoc& doc, PrintOptions& options);
  128.  
  129.     /*! \brief Draw print preview to an image using gdi method
  130.     \param doc the document whose page is to be preview
  131.     \param page the page to be previewed
  132.     \param image the image on which preview is to be drawn
  133.     \param options print options
  134.     \param scale optional double value for scaling. 1:1 = 1.0
  135.     \retval bool true on success 
  136.     \author Jean Ghali
  137.     */
  138.     bool gdiPrintPreview( ScribusDoc* doc, Page* page, QImage* image, PrintOptions& options, double scale = 1.0 );
  139.  
  140.     /*! \brief Get the default printer name
  141.     \retval QString the default printer name on success or an empty string 
  142.     \author Jean Ghali
  143.     */
  144.     static QString getDefaultPrinter( void );
  145. };
  146.  
  147. #endif
  148.