1 /* -*- Mode: C++; tab-width: 4; 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/. */
5 
6 #ifndef nsDeviceContextSpecX_h_
7 #define nsDeviceContextSpecX_h_
8 
9 #include "nsIDeviceContextSpec.h"
10 #include "nsIPrinter.h"
11 #include "nsIPrinterList.h"
12 
13 #include "nsCOMPtr.h"
14 
15 #include <ApplicationServices/ApplicationServices.h>
16 
17 class nsDeviceContextSpecX : public nsIDeviceContextSpec {
18  public:
19   NS_DECL_ISUPPORTS
20 
21   nsDeviceContextSpecX();
22 
23   NS_IMETHOD Init(nsIWidget* aWidget, nsIPrintSettings* aPS,
24                   bool aIsPrintPreview) override;
25   already_AddRefed<PrintTarget> MakePrintTarget() final;
26   NS_IMETHOD BeginDocument(const nsAString& aTitle,
27                            const nsAString& aPrintToFileName,
28                            int32_t aStartPage, int32_t aEndPage) override;
29   NS_IMETHOD EndDocument() override;
BeginPage()30   NS_IMETHOD BeginPage() override { return NS_OK; };
EndPage()31   NS_IMETHOD EndPage() override { return NS_OK; };
32 
33   void GetPaperRect(double* aTop, double* aLeft, double* aBottom,
34                     double* aRight);
35 
36  protected:
37   virtual ~nsDeviceContextSpecX();
38 
39  protected:
40   PMPrintSession mPrintSession;    // printing context.
41   PMPageFormat mPageFormat;        // page format.
42   PMPrintSettings mPrintSettings;  // print settings.
43 #ifdef MOZ_ENABLE_SKIA_PDF
44   nsCOMPtr<nsIFile>
45       mTempFile;  // file "print" output is generated to if printing via PDF
46   bool mPrintViaSkPDF;
47 #endif
48 };
49 
50 #endif  // nsDeviceContextSpecX_h_
51