2006-02-07 01:12:56 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
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"
|
2012-07-26 19:17:33 +00:00
|
|
|
#include "mozilla/Attributes.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>
|
2012-09-14 01:56:59 +00:00
|
|
|
#if (MOZ_WIDGET_GTK == 2)
|
2009-01-03 08:25:40 +00:00
|
|
|
#include <gtk/gtkprinter.h>
|
|
|
|
#include <gtk/gtkprintjob.h>
|
2012-09-14 01:56:59 +00:00
|
|
|
#else
|
|
|
|
#include <gtk/gtkunixprint.h>
|
|
|
|
#endif
|
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);
|
2014-01-04 15:02:17 +00:00
|
|
|
NS_IMETHOD BeginDocument(const nsAString& aTitle, char16_t * aPrintToFileName, int32_t aStartPage, int32_t aEndPage);
|
2006-11-29 23:40:16 +00:00
|
|
|
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);
|
2006-02-07 01:13:09 +00:00
|
|
|
|
1999-02-18 22:35:11 +00:00
|
|
|
protected:
|
2014-06-24 16:36:44 +00:00
|
|
|
virtual ~nsDeviceContextSpecGTK();
|
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;
|
|
|
|
|
2012-06-06 02:08:30 +00:00
|
|
|
nsCString mSpoolName;
|
|
|
|
nsCOMPtr<nsIFile> mSpoolFile;
|
2008-01-21 03:47:25 +00:00
|
|
|
|
1999-02-18 22:35:11 +00:00
|
|
|
};
|
|
|
|
|
2006-02-07 01:13:09 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
// Printer Enumerator
|
|
|
|
//-------------------------------------------------------------------------
|
2012-07-26 19:17:33 +00:00
|
|
|
class nsPrinterEnumeratorGTK MOZ_FINAL : public nsIPrinterEnumerator
|
2006-02-07 01:13:09 +00:00
|
|
|
{
|
2014-06-24 16:36:44 +00:00
|
|
|
~nsPrinterEnumeratorGTK() {}
|
2006-02-07 01:13:09 +00:00
|
|
|
public:
|
|
|
|
nsPrinterEnumeratorGTK();
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIPRINTERENUMERATOR
|
|
|
|
};
|
|
|
|
|
2006-02-07 01:13:27 +00:00
|
|
|
#endif /* !nsDeviceContextSpecGTK_h___ */
|