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 "nsIPrinterEnumerator.h" 11 12 #include "nsCOMPtr.h" 13 14 #include <ApplicationServices/ApplicationServices.h> 15 16 class nsDeviceContextSpecX : public nsIDeviceContextSpec { 17 public: 18 NS_DECL_ISUPPORTS 19 20 nsDeviceContextSpecX(); 21 22 NS_IMETHOD Init(nsIWidget* aWidget, nsIPrintSettings* aPS, 23 bool aIsPrintPreview) override; 24 already_AddRefed<PrintTarget> MakePrintTarget() final; 25 NS_IMETHOD BeginDocument(const nsAString& aTitle, 26 const nsAString& aPrintToFileName, 27 int32_t aStartPage, int32_t aEndPage) override; 28 NS_IMETHOD EndDocument() override; BeginPage()29 NS_IMETHOD BeginPage() override { return NS_OK; }; EndPage()30 NS_IMETHOD EndPage() override { return NS_OK; }; 31 32 void GetPaperRect(double* aTop, double* aLeft, double* aBottom, 33 double* aRight); 34 35 protected: 36 virtual ~nsDeviceContextSpecX(); 37 38 protected: 39 PMPrintSession mPrintSession; // printing context. 40 PMPageFormat mPageFormat; // page format. 41 PMPrintSettings mPrintSettings; // print settings. 42 #ifdef MOZ_ENABLE_SKIA_PDF 43 nsCOMPtr<nsIFile> 44 mTempFile; // file "print" output is generated to if printing via PDF 45 bool mPrintViaSkPDF; 46 #endif 47 }; 48 49 //---------------------------------------------------------------------- 50 // nsPrinterErnumeratorX 51 52 class nsPrinterEnumeratorX final : public nsIPrinterEnumerator { 53 public: 54 NS_DECL_ISUPPORTS 55 NS_DECL_NSIPRINTERENUMERATOR 56 nsPrinterEnumeratorX() = default; 57 58 private: 59 ~nsPrinterEnumeratorX() = default; 60 }; 61 62 #endif // nsDeviceContextSpecX_h_ 63