Bug 1568151 - Replace `target.getInspector()` by `target.getFront("inspector")`....
[gecko.git] / widget / nsIDeviceContextSpec.h
blob20e4a6f527faa4653a0718feb4549bd46a9c7ab1
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 nsIDeviceContextSpec_h___
7 #define nsIDeviceContextSpec_h___
9 #include "gfxPoint.h"
10 #include "nsISupports.h"
12 class nsIWidget;
13 class nsIPrintSettings;
15 namespace mozilla {
16 namespace gfx {
17 class DrawEventRecorder;
18 class PrintTarget;
19 } // namespace gfx
20 } // namespace mozilla
22 #define NS_IDEVICE_CONTEXT_SPEC_IID \
23 { \
24 0xf407cfba, 0xbe28, 0x46c9, { \
25 0x8a, 0xba, 0x04, 0x2d, 0xae, 0xbb, 0x4f, 0x23 \
26 } \
29 class nsIDeviceContextSpec : public nsISupports {
30 public:
31 typedef mozilla::gfx::PrintTarget PrintTarget;
33 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDEVICE_CONTEXT_SPEC_IID)
35 /**
36 * Initialize the device context spec.
37 * @param aWidget A widget a dialog can be hosted in
38 * @param aPrintSettings Print settings for the print operation
39 * @param aIsPrintPreview True if creating Spec for PrintPreview
40 * @return NS_OK or a suitable error code.
42 NS_IMETHOD Init(nsIWidget* aWidget, nsIPrintSettings* aPrintSettings,
43 bool aIsPrintPreview) = 0;
45 virtual already_AddRefed<PrintTarget> MakePrintTarget() = 0;
47 /**
48 * If required override to return a recorder to record the print.
50 * @param aDrawEventRecorder out param for the recorder to use
51 * @return NS_OK or a suitable error code
53 NS_IMETHOD GetDrawEventRecorder(
54 mozilla::gfx::DrawEventRecorder** aDrawEventRecorder) {
55 MOZ_ASSERT(aDrawEventRecorder);
56 *aDrawEventRecorder = nullptr;
57 return NS_OK;
60 /**
61 * Override to return something other than the default.
63 * @return DPI for printing.
65 virtual float GetDPI() { return 72.0f; }
67 /**
68 * Override to return something other than the default.
70 * @return the printing scale to be applied to the context for printing.
72 virtual float GetPrintingScale() { return 1.0f; }
74 /**
75 * Override to return something other than the default.
77 * @return the point to translate the context to for printing.
79 virtual gfxPoint GetPrintingTranslate() { return gfxPoint(0, 0); }
81 NS_IMETHOD BeginDocument(const nsAString& aTitle,
82 const nsAString& aPrintToFileName,
83 int32_t aStartPage, int32_t aEndPage) = 0;
85 NS_IMETHOD EndDocument() = 0;
86 NS_IMETHOD AbortDocument() { return EndDocument(); }
87 NS_IMETHOD BeginPage() = 0;
88 NS_IMETHOD EndPage() = 0;
91 NS_DEFINE_STATIC_IID_ACCESSOR(nsIDeviceContextSpec, NS_IDEVICE_CONTEXT_SPEC_IID)
92 #endif