widget/gtk/nsDeviceContextSpecG.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef nsDeviceContextSpecGTK_h___
     7 #define nsDeviceContextSpecGTK_h___
     9 #include "nsIDeviceContextSpec.h"
    10 #include "nsIPrintSettings.h"
    11 #include "nsIPrintOptions.h" 
    12 #include "nsCOMPtr.h"
    13 #include "nsString.h"
    14 #include "mozilla/Attributes.h"
    16 #include "nsCRT.h" /* should be <limits.h>? */
    18 #include <gtk/gtk.h>
    19 #if (MOZ_WIDGET_GTK == 2)
    20 #include <gtk/gtkprinter.h>
    21 #include <gtk/gtkprintjob.h>
    22 #else
    23 #include <gtk/gtkunixprint.h>
    24 #endif
    26 #define NS_PORTRAIT  0
    27 #define NS_LANDSCAPE 1
    29 typedef enum
    30 {
    31   pmInvalid = 0,
    32   pmPostScript
    33 } PrintMethod;
    35 class nsDeviceContextSpecGTK : public nsIDeviceContextSpec
    36 {
    37 public:
    38   nsDeviceContextSpecGTK();
    40   NS_DECL_ISUPPORTS
    42   NS_IMETHOD GetSurfaceForPrinter(gfxASurface **surface);
    44   NS_IMETHOD Init(nsIWidget *aWidget, nsIPrintSettings* aPS, bool aIsPrintPreview);
    45   NS_IMETHOD BeginDocument(const nsAString& aTitle, char16_t * aPrintToFileName, int32_t aStartPage, int32_t aEndPage);
    46   NS_IMETHOD EndDocument();
    47   NS_IMETHOD BeginPage() { return NS_OK; }
    48   NS_IMETHOD EndPage() { return NS_OK; }
    50   NS_IMETHOD GetPath (const char **aPath);    
    51   static nsresult GetPrintMethod(const char *aPrinter, PrintMethod &aMethod);
    52   virtual ~nsDeviceContextSpecGTK();
    54 protected:
    55   nsCOMPtr<nsIPrintSettings> mPrintSettings;
    56   bool mToPrinter : 1;      /* If true, print to printer */
    57   bool mIsPPreview : 1;     /* If true, is print preview */
    58   char   mPath[PATH_MAX];     /* If toPrinter = false, dest file */
    59   char   mPrinter[256];       /* Printer name */
    60   GtkPrintJob*      mPrintJob;
    61   GtkPrinter*       mGtkPrinter;
    62   GtkPrintSettings* mGtkPrintSettings;
    63   GtkPageSetup*     mGtkPageSetup;
    65   nsCString         mSpoolName;
    66   nsCOMPtr<nsIFile> mSpoolFile;
    68 };
    70 //-------------------------------------------------------------------------
    71 // Printer Enumerator
    72 //-------------------------------------------------------------------------
    73 class nsPrinterEnumeratorGTK MOZ_FINAL : public nsIPrinterEnumerator
    74 {
    75 public:
    76   nsPrinterEnumeratorGTK();
    77   NS_DECL_ISUPPORTS
    78   NS_DECL_NSIPRINTERENUMERATOR
    79 };
    81 #endif /* !nsDeviceContextSpecGTK_h___ */

mercurial