widget/gtk/nsDeviceContextSpecG.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/gtk/nsDeviceContextSpecG.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,81 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsDeviceContextSpecGTK_h___
    1.10 +#define nsDeviceContextSpecGTK_h___
    1.11 +
    1.12 +#include "nsIDeviceContextSpec.h"
    1.13 +#include "nsIPrintSettings.h"
    1.14 +#include "nsIPrintOptions.h" 
    1.15 +#include "nsCOMPtr.h"
    1.16 +#include "nsString.h"
    1.17 +#include "mozilla/Attributes.h"
    1.18 +
    1.19 +#include "nsCRT.h" /* should be <limits.h>? */
    1.20 +
    1.21 +#include <gtk/gtk.h>
    1.22 +#if (MOZ_WIDGET_GTK == 2)
    1.23 +#include <gtk/gtkprinter.h>
    1.24 +#include <gtk/gtkprintjob.h>
    1.25 +#else
    1.26 +#include <gtk/gtkunixprint.h>
    1.27 +#endif
    1.28 +
    1.29 +#define NS_PORTRAIT  0
    1.30 +#define NS_LANDSCAPE 1
    1.31 +
    1.32 +typedef enum
    1.33 +{
    1.34 +  pmInvalid = 0,
    1.35 +  pmPostScript
    1.36 +} PrintMethod;
    1.37 +
    1.38 +class nsDeviceContextSpecGTK : public nsIDeviceContextSpec
    1.39 +{
    1.40 +public:
    1.41 +  nsDeviceContextSpecGTK();
    1.42 +
    1.43 +  NS_DECL_ISUPPORTS
    1.44 +
    1.45 +  NS_IMETHOD GetSurfaceForPrinter(gfxASurface **surface);
    1.46 +
    1.47 +  NS_IMETHOD Init(nsIWidget *aWidget, nsIPrintSettings* aPS, bool aIsPrintPreview);
    1.48 +  NS_IMETHOD BeginDocument(const nsAString& aTitle, char16_t * aPrintToFileName, int32_t aStartPage, int32_t aEndPage);
    1.49 +  NS_IMETHOD EndDocument();
    1.50 +  NS_IMETHOD BeginPage() { return NS_OK; }
    1.51 +  NS_IMETHOD EndPage() { return NS_OK; }
    1.52 +
    1.53 +  NS_IMETHOD GetPath (const char **aPath);    
    1.54 +  static nsresult GetPrintMethod(const char *aPrinter, PrintMethod &aMethod);
    1.55 +  virtual ~nsDeviceContextSpecGTK();
    1.56 +  
    1.57 +protected:
    1.58 +  nsCOMPtr<nsIPrintSettings> mPrintSettings;
    1.59 +  bool mToPrinter : 1;      /* If true, print to printer */
    1.60 +  bool mIsPPreview : 1;     /* If true, is print preview */
    1.61 +  char   mPath[PATH_MAX];     /* If toPrinter = false, dest file */
    1.62 +  char   mPrinter[256];       /* Printer name */
    1.63 +  GtkPrintJob*      mPrintJob;
    1.64 +  GtkPrinter*       mGtkPrinter;
    1.65 +  GtkPrintSettings* mGtkPrintSettings;
    1.66 +  GtkPageSetup*     mGtkPageSetup;
    1.67 +
    1.68 +  nsCString         mSpoolName;
    1.69 +  nsCOMPtr<nsIFile> mSpoolFile;
    1.70 +
    1.71 +};
    1.72 +
    1.73 +//-------------------------------------------------------------------------
    1.74 +// Printer Enumerator
    1.75 +//-------------------------------------------------------------------------
    1.76 +class nsPrinterEnumeratorGTK MOZ_FINAL : public nsIPrinterEnumerator
    1.77 +{
    1.78 +public:
    1.79 +  nsPrinterEnumeratorGTK();
    1.80 +  NS_DECL_ISUPPORTS
    1.81 +  NS_DECL_NSIPRINTERENUMERATOR
    1.82 +};
    1.83 +
    1.84 +#endif /* !nsDeviceContextSpecGTK_h___ */

mercurial