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/. */
6 #ifndef nsDeviceContextSpecX_h_
7 #define nsDeviceContextSpecX_h_
9 #include "nsIDeviceContextSpec.h"
10 #include "nsIPrinter.h"
11 #include "nsIPrinterList.h"
15 #include "mozilla/gfx/PrintPromise.h"
17 #include <ApplicationServices/ApplicationServices.h>
19 class nsDeviceContextSpecX
: public nsIDeviceContextSpec
{
23 nsDeviceContextSpecX();
25 NS_IMETHOD
Init(nsIPrintSettings
* aPS
, bool aIsPrintPreview
) override
;
26 already_AddRefed
<PrintTarget
> MakePrintTarget() final
;
27 NS_IMETHOD
BeginDocument(const nsAString
& aTitle
,
28 const nsAString
& aPrintToFileName
,
29 int32_t aStartPage
, int32_t aEndPage
) override
;
30 RefPtr
<mozilla::gfx::PrintEndDocumentPromise
> EndDocument() override
;
31 NS_IMETHOD
BeginPage(const IntSize
& aSizeInPoints
) override
{ return NS_OK
; };
32 NS_IMETHOD
EndPage() override
{ return NS_OK
; };
34 void GetPaperRect(double* aTop
, double* aLeft
, double* aBottom
,
38 virtual ~nsDeviceContextSpecX();
41 PMPrintSession mPrintSession
= nullptr;
42 PMPageFormat mPageFormat
= nullptr;
43 PMPrintSettings mPMPrintSettings
= nullptr;
44 nsCOMPtr
<nsIOutputStream
> mOutputStream
; // Output stream from settings.
45 #ifdef MOZ_ENABLE_SKIA_PDF
46 // file "print" output generated if printing via PDF
47 nsCOMPtr
<nsIFile
> mTempFile
;
50 nsresult
DoEndDocument();
53 #endif // nsDeviceContextSpecX_h_