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
|
|
|
#include <gtk/gtkunixprint.h>
|
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
|
|
|
|
2015-03-06 00:05:33 +03:00
|
|
|
class nsPrintSettingsGTK;
|
|
|
|
|
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
|
|
|
|
|
2016-06-03 13:27:31 +03:00
|
|
|
virtual already_AddRefed<PrintTarget> MakePrintTarget() final;
|
2015-01-21 00:39:44 +03:00
|
|
|
|
|
|
|
NS_IMETHOD Init(nsIWidget *aWidget, nsIPrintSettings* aPS,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aIsPrintPreview) override;
|
2016-01-05 13:08:57 +03:00
|
|
|
NS_IMETHOD BeginDocument(const nsAString& aTitle,
|
|
|
|
const nsAString& aPrintToFileName,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t aStartPage, int32_t aEndPage) override;
|
|
|
|
NS_IMETHOD EndDocument() override;
|
|
|
|
NS_IMETHOD BeginPage() override { return NS_OK; }
|
|
|
|
NS_IMETHOD EndPage() override { return NS_OK; }
|
2006-02-07 04:13:09 +03:00
|
|
|
|
1999-02-19 01:35:11 +03:00
|
|
|
protected:
|
2014-06-24 20:36:44 +04:00
|
|
|
virtual ~nsDeviceContextSpecGTK();
|
2015-03-06 00:05:33 +03:00
|
|
|
nsCOMPtr<nsPrintSettingsGTK> 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
|
|
|
GtkPrintSettings* mGtkPrintSettings;
|
|
|
|
GtkPageSetup* mGtkPageSetup;
|
|
|
|
|
2012-06-06 06:08:30 +04:00
|
|
|
nsCString mSpoolName;
|
|
|
|
nsCOMPtr<nsIFile> mSpoolFile;
|
2015-03-06 00:05:33 +03:00
|
|
|
nsCString mTitle;
|
2008-01-21 06:47:25 +03:00
|
|
|
|
2015-03-06 00:05:33 +03:00
|
|
|
private:
|
|
|
|
void EnumeratePrinters();
|
2015-07-28 00:11:46 +03:00
|
|
|
void StartPrintJob();
|
2015-03-06 00:05:33 +03:00
|
|
|
static gboolean PrinterEnumerator(GtkPrinter *aPrinter, gpointer aData);
|
1999-02-19 01:35:11 +03:00
|
|
|
};
|
|
|
|
|
2006-02-07 04:13:09 +03:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
// Printer Enumerator
|
|
|
|
//-------------------------------------------------------------------------
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsPrinterEnumeratorGTK final : public nsIPrinterEnumerator
|
2006-02-07 04:13:09 +03:00
|
|
|
{
|
2014-06-24 20:36:44 +04:00
|
|
|
~nsPrinterEnumeratorGTK() {}
|
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___ */
|