2006-02-07 04:12:56 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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-19 01:35:11 +03:00
|
|
|
|
2006-02-07 04:13:27 +03:00
|
|
|
#ifndef nsDeviceContextSpecGTK_h___
|
|
|
|
#define nsDeviceContextSpecGTK_h___
|
1999-02-19 01:35:11 +03:00
|
|
|
|
|
|
|
#include "nsIDeviceContextSpec.h"
|
2006-02-07 04:13:27 +03:00
|
|
|
#include "nsIPrintSettings.h"
|
|
|
|
#include "nsIPrintOptions.h"
|
2006-02-07 04:14:15 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2008-01-21 06:47:25 +03:00
|
|
|
#include "nsString.h"
|
2012-07-26 23:17:33 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2006-11-30 05:12:03 +03:00
|
|
|
|
2006-02-07 04:14:01 +03:00
|
|
|
#include "nsCRT.h" /* should be <limits.h>? */
|
2006-02-07 04:13:27 +03:00
|
|
|
|
2008-01-21 06:47:25 +03:00
|
|
|
#include <gtk/gtk.h>
|
2012-09-14 05:56:59 +04:00
|
|
|
#if (MOZ_WIDGET_GTK == 2)
|
2009-01-03 11:25:40 +03:00
|
|
|
#include <gtk/gtkprinter.h>
|
|
|
|
#include <gtk/gtkprintjob.h>
|
2012-09-14 05:56:59 +04:00
|
|
|
#else
|
|
|
|
#include <gtk/gtkunixprint.h>
|
|
|
|
#endif
|
2006-11-30 02:40:16 +03:00
|
|
|
|
2006-02-07 04:13:27 +03:00
|
|
|
#define NS_PORTRAIT 0
|
|
|
|
#define NS_LANDSCAPE 1
|
1999-03-13 06:39:38 +03:00
|
|
|
|
2006-02-07 04:12:44 +03:00
|
|
|
typedef enum
|
|
|
|
{
|
2006-02-07 04:13:09 +03:00
|
|
|
pmInvalid = 0,
|
2006-02-07 04:12:44 +03:00
|
|
|
pmPostScript
|
|
|
|
} PrintMethod;
|
2006-02-07 04:13:27 +03:00
|
|
|
|
2006-02-07 04:13:43 +03:00
|
|
|
class nsDeviceContextSpecGTK : public nsIDeviceContextSpec
|
1999-02-19 01:35:11 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsDeviceContextSpecGTK();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2006-02-10 23:44:48 +03:00
|
|
|
NS_IMETHOD GetSurfaceForPrinter(gfxASurface **surface);
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD Init(nsIWidget *aWidget, nsIPrintSettings* aPS, bool aIsPrintPreview);
|
2013-07-24 15:48:37 +04:00
|
|
|
NS_IMETHOD BeginDocument(const nsAString& aTitle, PRUnichar * aPrintToFileName, int32_t aStartPage, int32_t aEndPage);
|
2006-11-30 02:40:16 +03:00
|
|
|
NS_IMETHOD EndDocument();
|
2008-03-27 04:21:46 +03:00
|
|
|
NS_IMETHOD BeginPage() { return NS_OK; }
|
|
|
|
NS_IMETHOD EndPage() { return NS_OK; }
|
2006-02-07 04:13:09 +03:00
|
|
|
|
2006-02-07 04:13:27 +03:00
|
|
|
NS_IMETHOD GetPath (const char **aPath);
|
2006-02-07 04:13:44 +03:00
|
|
|
static nsresult GetPrintMethod(const char *aPrinter, PrintMethod &aMethod);
|
1999-02-19 01:35:11 +03:00
|
|
|
virtual ~nsDeviceContextSpecGTK();
|
2006-02-07 04:13:09 +03:00
|
|
|
|
1999-02-19 01:35:11 +03:00
|
|
|
protected:
|
2006-02-07 04:13:12 +03:00
|
|
|
nsCOMPtr<nsIPrintSettings> mPrintSettings;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mToPrinter : 1; /* If true, print to printer */
|
|
|
|
bool mIsPPreview : 1; /* If true, is print preview */
|
2011-10-03 11:56:21 +04:00
|
|
|
char mPath[PATH_MAX]; /* If toPrinter = false, dest file */
|
2006-02-07 04:13:27 +03:00
|
|
|
char mPrinter[256]; /* Printer name */
|
2008-01-21 06:47:25 +03:00
|
|
|
GtkPrintJob* mPrintJob;
|
|
|
|
GtkPrinter* mGtkPrinter;
|
|
|
|
GtkPrintSettings* mGtkPrintSettings;
|
|
|
|
GtkPageSetup* mGtkPageSetup;
|
|
|
|
|
2012-06-06 06:08:30 +04:00
|
|
|
nsCString mSpoolName;
|
|
|
|
nsCOMPtr<nsIFile> mSpoolFile;
|
2008-01-21 06:47:25 +03:00
|
|
|
|
1999-02-19 01:35:11 +03:00
|
|
|
};
|
|
|
|
|
2006-02-07 04:13:09 +03:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
// Printer Enumerator
|
|
|
|
//-------------------------------------------------------------------------
|
2012-07-26 23:17:33 +04:00
|
|
|
class nsPrinterEnumeratorGTK MOZ_FINAL : public nsIPrinterEnumerator
|
2006-02-07 04:13:09 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsPrinterEnumeratorGTK();
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIPRINTERENUMERATOR
|
|
|
|
};
|
|
|
|
|
2006-02-07 04:13:27 +03:00
|
|
|
#endif /* !nsDeviceContextSpecGTK_h___ */
|