Back to index

lightning-sunbird  0.9+nobinonly
nsDeviceContextSpecQt.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Lars Knoll <knoll@kde.org>
00024  *   Zack Rusin <zack@kde.org>
00025  *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either the GNU General Public License Version 2 or later (the "GPL"), or
00029  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 
00041 #ifndef nsDeviceContextSpecQt_h___
00042 #define nsDeviceContextSpecQt_h___
00043 
00044 #include "nsCOMPtr.h"
00045 #include "nsIDeviceContextSpec.h"
00046 #include "nsIPrintSettings.h"
00047 #include "nsIPrintOptions.h"
00048 #include "nsVoidArray.h"
00049 #include <limits.h>
00050 #ifdef USE_POSTSCRIPT
00051 #include "nsIDeviceContextSpecPS.h"
00052 #endif /* USE_POSTSCRIPT */
00053 #ifdef USE_XPRINT
00054 #include "nsIDeviceContextSpecXPrint.h"
00055 #endif /* USE_XPRINT */
00056 
00057 #define NS_PORTRAIT  0
00058 #define NS_LANDSCAPE 1
00059 
00060 typedef enum
00061 {
00062   pmInvalid = 0,
00063   pmXprint,
00064   pmPostScript
00065 } PrintMethod;
00066 
00067 class nsDeviceContextSpecQt : public nsIDeviceContextSpec
00068 #ifdef USE_POSTSCRIPT
00069 #warning "postscript hardcore disabled"
00070 #if 0
00071 
00072                             , public nsIDeviceContextSpecPS
00073 #endif
00074 #endif /* USE_POSTSCRIPT */
00075 #ifdef USE_XPRINT
00076                               , public nsIDeviceContextSpecXp
00077 #endif /* USE_XPRINT */
00078 {
00079 public:
00080   nsDeviceContextSpecQt();
00081 
00082   NS_DECL_ISUPPORTS
00083 
00084   NS_IMETHOD Init(nsIPrintSettings* aPS);
00085   NS_IMETHOD ClosePrintManager();
00086 
00087   NS_IMETHOD GetToPrinter(PRBool &aToPrinter);
00088   NS_IMETHOD GetPrinterName ( const char **aPrinter );
00089   NS_IMETHOD GetCopies ( int &aCopies );
00090   NS_IMETHOD GetFirstPageFirst(PRBool &aFpf);
00091   NS_IMETHOD GetGrayscale(PRBool &aGrayscale);
00092   NS_IMETHOD GetTopMargin(float &value);
00093   NS_IMETHOD GetBottomMargin(float &value);
00094   NS_IMETHOD GetLeftMargin(float &value);
00095   NS_IMETHOD GetRightMargin(float &value);
00096   NS_IMETHOD GetCommand(const char **aCommand);
00097   NS_IMETHOD GetPath (const char **aPath);
00098   NS_IMETHOD GetLandscape (PRBool &aLandscape);
00099   NS_IMETHOD GetUserCancelled(PRBool &aCancel);
00100   NS_IMETHOD GetPrintMethod(PrintMethod &aMethod);
00101   static nsresult GetPrintMethod(const char *aPrinter, PrintMethod &aMethod);
00102   NS_IMETHOD GetPageSizeInTwips(PRInt32 *aWidth, PRInt32 *aHeight);
00103   NS_IMETHOD GetPaperName(const char **aPaperName);
00104   virtual ~nsDeviceContextSpecQt();
00105 
00106 protected:
00107   nsCOMPtr<nsIPrintSettings> mPrintSettings;
00108   PRBool mToPrinter;          /* If PR_TRUE, print to printer */
00109   PRBool mFpf;                /* If PR_TRUE, first page first */
00110   PRBool mGrayscale;          /* If PR_TRUE, print grayscale */
00111   int    mOrientation;        /* Orientation e.g. Portrait */
00112   char   mCommand[PATH_MAX];  /* Print command e.g., lpr */
00113   char   mPath[PATH_MAX];     /* If toPrinter = PR_FALSE, dest file */
00114   char   mPrinter[256];       /* Printer name */
00115   char   mPaperName[256];     /* Printer name */
00116   int    mCopies;             /* number of copies */
00117   PRBool mCancel;             /* If PR_TRUE, user cancelled */
00118   float  mLeft;               /* left margin */
00119   float  mRight;              /* right margin */
00120   float  mTop;                /* top margin */
00121   float  mBottom;             /* bottom margin */
00122 };
00123 
00124 //-------------------------------------------------------------------------
00125 // Printer Enumerator
00126 //-------------------------------------------------------------------------
00127 class nsPrinterEnumeratorQt : public nsIPrinterEnumerator
00128 {
00129 public:
00130   nsPrinterEnumeratorQt();
00131   NS_DECL_ISUPPORTS
00132   NS_DECL_NSIPRINTERENUMERATOR
00133 };
00134 
00135 #endif /* !nsDeviceContextSpecQt_h___ */