2006-02-07 01:12:56 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2006-02-07 01:14:50 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-02-18 22:35:11 +00:00
|
|
|
*
|
2006-02-07 01:14:50 +00:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1999-02-18 22:35:11 +00:00
|
|
|
*
|
2006-02-07 01:12:56 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-02-18 22:35:11 +00:00
|
|
|
*
|
1999-11-06 03:43:54 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2006-02-07 01:14:50 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
2006-02-07 01:12:56 +00:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 03:43:54 +00:00
|
|
|
*
|
2006-02-07 01:12:56 +00:00
|
|
|
* Contributor(s):
|
2006-02-07 01:12:44 +00:00
|
|
|
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
|
2006-02-07 01:12:56 +00:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2006-02-07 01:14:50 +00:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2006-02-07 01:12:56 +00:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2006-02-07 01:14:50 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2006-02-07 01:12:56 +00:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2006-02-07 01:14:50 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2006-02-07 01:12:56 +00:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-02-18 22:35:11 +00:00
|
|
|
|
2006-02-07 01:13:27 +00:00
|
|
|
#ifndef nsDeviceContextSpecGTK_h___
|
|
|
|
#define nsDeviceContextSpecGTK_h___
|
1999-02-18 22:35:11 +00:00
|
|
|
|
|
|
|
#include "nsIDeviceContextSpec.h"
|
2006-02-07 01:13:27 +00:00
|
|
|
#include "nsIPrintSettings.h"
|
|
|
|
#include "nsIPrintOptions.h"
|
2006-02-07 01:14:15 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2008-01-21 03:47:25 +00:00
|
|
|
#include "nsString.h"
|
2006-11-30 02:12:03 +00:00
|
|
|
|
2006-02-07 01:14:01 +00:00
|
|
|
#include "nsCRT.h" /* should be <limits.h>? */
|
2006-02-07 01:13:27 +00:00
|
|
|
|
2008-01-21 03:47:25 +00:00
|
|
|
#include <gtk/gtk.h>
|
2009-01-03 08:25:40 +00:00
|
|
|
#include <gtk/gtkprinter.h>
|
|
|
|
#include <gtk/gtkprintjob.h>
|
2006-11-29 23:40:16 +00:00
|
|
|
|
2006-02-07 01:13:27 +00:00
|
|
|
#define NS_PORTRAIT 0
|
|
|
|
#define NS_LANDSCAPE 1
|
1999-03-13 03:39:38 +00:00
|
|
|
|
2006-02-07 01:12:44 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
2006-02-07 01:13:09 +00:00
|
|
|
pmInvalid = 0,
|
2006-02-07 01:12:44 +00:00
|
|
|
pmPostScript
|
|
|
|
} PrintMethod;
|
2006-02-07 01:13:27 +00:00
|
|
|
|
2006-02-07 01:13:43 +00:00
|
|
|
class nsDeviceContextSpecGTK : public nsIDeviceContextSpec
|
1999-02-18 22:35:11 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsDeviceContextSpecGTK();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2006-02-10 20:44:48 +00:00
|
|
|
NS_IMETHOD GetSurfaceForPrinter(gfxASurface **surface);
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD Init(nsIWidget *aWidget, nsIPrintSettings* aPS, bool aIsPrintPreview);
|
2006-11-29 23:40:16 +00:00
|
|
|
NS_IMETHOD BeginDocument(PRUnichar * aTitle, PRUnichar * aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage);
|
|
|
|
NS_IMETHOD EndDocument();
|
2008-03-27 01:21:46 +00:00
|
|
|
NS_IMETHOD BeginPage() { return NS_OK; }
|
|
|
|
NS_IMETHOD EndPage() { return NS_OK; }
|
2006-02-07 01:13:09 +00:00
|
|
|
|
2006-02-07 01:13:27 +00:00
|
|
|
NS_IMETHOD GetPath (const char **aPath);
|
2006-02-07 01:13:44 +00:00
|
|
|
static nsresult GetPrintMethod(const char *aPrinter, PrintMethod &aMethod);
|
1999-02-18 22:35:11 +00:00
|
|
|
virtual ~nsDeviceContextSpecGTK();
|
2006-02-07 01:13:09 +00:00
|
|
|
|
1999-02-18 22:35:11 +00:00
|
|
|
protected:
|
2006-02-07 01:13:12 +00:00
|
|
|
nsCOMPtr<nsIPrintSettings> mPrintSettings;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mToPrinter : 1; /* If true, print to printer */
|
|
|
|
bool mIsPPreview : 1; /* If true, is print preview */
|
2011-10-03 07:56:21 +00:00
|
|
|
char mPath[PATH_MAX]; /* If toPrinter = false, dest file */
|
2006-02-07 01:13:27 +00:00
|
|
|
char mPrinter[256]; /* Printer name */
|
2008-01-21 03:47:25 +00:00
|
|
|
GtkPrintJob* mPrintJob;
|
|
|
|
GtkPrinter* mGtkPrinter;
|
|
|
|
GtkPrintSettings* mGtkPrintSettings;
|
|
|
|
GtkPageSetup* mGtkPageSetup;
|
|
|
|
|
|
|
|
nsCString mSpoolName;
|
|
|
|
nsCOMPtr<nsILocalFile> mSpoolFile;
|
|
|
|
|
1999-02-18 22:35:11 +00:00
|
|
|
};
|
|
|
|
|
2006-02-07 01:13:09 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
// Printer Enumerator
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
class nsPrinterEnumeratorGTK : public nsIPrinterEnumerator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsPrinterEnumeratorGTK();
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIPRINTERENUMERATOR
|
|
|
|
};
|
|
|
|
|
2006-02-07 01:13:27 +00:00
|
|
|
#endif /* !nsDeviceContextSpecGTK_h___ */
|