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