Back to index

lightning-sunbird  0.9+nobinonly
nsDeviceContextSpecOS2.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  *   John Fairhurst <john_fairhurst@iname.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #ifndef nsDeviceContextSpecOS2_h___
00040 #define nsDeviceContextSpecOS2_h___
00041 
00042 #define INCL_PM
00043 #define INCL_DOS
00044 #define INCL_DOSERRORS
00045 #define INCL_SPLDOSPRINT
00046 #define INCL_DEV
00047 #define INCL_DEVDJP
00048 #define INCL_GRE_DEVICE
00049 
00050 #include "nsCOMPtr.h"
00051 #include "nsIDeviceContextSpec.h"
00052 #include "nsIPrintOptions.h"
00053 #include "nsIPrintSettings.h"
00054 #include "nsVoidArray.h"
00055 #ifdef USE_XPRINT
00056 #include "nsIDeviceContextSpecXPrint.h"
00057 #endif /* USE_XPRINT */
00058 #include "nsGFXDefs.h"
00059 #include "nsPrintdOS2.h"
00060 #include <os2.h>
00061 #include <pmddim.h>
00062 
00063 //---------------------------------------------------------------------------
00064 // OS/2 Printing   - was in libprint
00065 //---------------------------------------------------------------------------
00066 // Library init and term; job properties per queue are cached during run.
00067 BOOL PrnInitialize(HMODULE hmodResources);
00068 BOOL PrnTerminate(void);
00069 
00070 // opaque type to describe a print queue (printer)
00071 class PRTQUEUE;
00072 
00073 #define MAX_PRINT_QUEUES  (128)
00074 
00075 class PRINTDLG
00076 {
00077 public:
00078    PRINTDLG();
00079   ~PRINTDLG();
00080    void      RefreshPrintQueue();
00081    ULONG     GetNumPrinters();
00082    void      GetPrinter(ULONG printerNdx, char** printerName);
00083    PRTQUEUE* SetPrinterQueue(ULONG printerNdx);
00084    LONG      GetPrintDriverSize(ULONG printerNdx);
00085    PDRIVDATA GetPrintDriver(ULONG printerNdx);
00086    HDC       GetDCHandle(ULONG printerNdx);
00087    char*     GetDriverType(ULONG printerNdx);
00088    BOOL      ShowProperties(ULONG printerNdx);
00089 
00090 private:
00091   ULONG      mQueueCount;
00092   PRTQUEUE*  mPQBuf[MAX_PRINT_QUEUES];
00093 };
00094 
00095 
00096 // Release app. resources associated with a printer
00097 BOOL PrnClosePrinter( PRTQUEUE *pPrintQueue);
00098 
00099 // Get a DC for the selected printer.  Must supply the application name.
00100 HDC PrnOpenDC( PRTQUEUE *pPrintQueue, PSZ pszApplicationName, int copies, int destination, char *file);
00101 
00102 // Get the hardcopy caps for the selected form
00103 BOOL PrnQueryHardcopyCaps( HDC hdc, PHCINFO pHCInfo);
00104 
00105 // Abort the current job started with PrnStartJob().
00106 BOOL PrnAbortJob( HDC hdc);
00107 
00108 
00109 //---------------------------------------------------------------------
00110 // nsDeviceContextSpecOS2
00111 //---------------------------------------------------------------------
00112 
00113 class nsDeviceContextSpecOS2 : public nsIDeviceContextSpec
00114 #ifdef USE_XPRINT
00115                              , public nsIDeviceContextSpecXp
00116 #endif
00117 {
00118 public:
00123   nsDeviceContextSpecOS2();
00124 
00125   NS_DECL_ISUPPORTS
00126 
00133   NS_IMETHOD Init(nsIPrintSettings* aPS, PRBool  aIsPrintPreview);
00134   
00135   NS_IMETHOD ClosePrintManager();
00136 
00137   NS_IMETHOD GetDestination ( int &aDestination ); 
00138 
00139   NS_IMETHOD GetPrinterName ( char **aPrinter );
00140 
00141   NS_IMETHOD GetCopies ( int &aCopies );
00142 
00143   NS_IMETHOD GetPath ( char **aPath );    
00144 
00145   NS_IMETHOD GetUserCancelled( PRBool &aCancel );      
00146 
00147   NS_IMETHOD GetPRTQUEUE(PRTQUEUE *&p);
00148 
00153   virtual ~nsDeviceContextSpecOS2();
00154 
00155   static PRINTDLG PrnDlg;
00156   static nsresult SetPrintSettingsFromDevMode(nsIPrintSettings* aPrintSettings, ULONG printer);
00157 
00158 protected:
00159 
00160   OS2PrData mPrData;
00161   PRTQUEUE *mQueue;
00162   nsCOMPtr<nsIPrintSettings> mPrintSettings;
00163 };
00164 
00165 //-------------------------------------------------------------------------
00166 // Printer Enumerator
00167 //-------------------------------------------------------------------------
00168 class nsPrinterEnumeratorOS2 : public nsIPrinterEnumerator
00169 {
00170 public:
00171   nsPrinterEnumeratorOS2();
00172   NS_DECL_ISUPPORTS
00173   NS_DECL_NSIPRINTERENUMERATOR
00174 
00175 protected:
00176 };
00177 
00178 
00179 #endif
00180