Line data Source code
1 : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
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 MOZILLA_GFX_PRINTINGTARGETPS_H
7 : #define MOZILLA_GFX_PRINTINGTARGETPS_H
8 :
9 : #include "nsCOMPtr.h"
10 : #include "nsIOutputStream.h"
11 : #include "PrintTarget.h"
12 :
13 : namespace mozilla {
14 : namespace gfx {
15 :
16 : /**
17 : * PostScript printing target.
18 : */
19 : class PrintTargetPS final : public PrintTarget {
20 : public:
21 : enum PageOrientation {
22 : PORTRAIT,
23 : LANDSCAPE
24 : };
25 :
26 : static already_AddRefed<PrintTargetPS>
27 : CreateOrNull(nsIOutputStream *aStream,
28 : IntSize aSizeInPoints,
29 : PageOrientation aOrientation);
30 :
31 : virtual nsresult BeginPrinting(const nsAString& aTitle,
32 : const nsAString& aPrintToFileName,
33 : int32_t aStartPage,
34 : int32_t aEndPage) override;
35 : virtual nsresult EndPage() override;
36 : virtual void Finish() override;
37 :
38 0 : virtual bool GetRotateForLandscape() {
39 0 : return (mOrientation == LANDSCAPE);
40 : }
41 :
42 : private:
43 : PrintTargetPS(cairo_surface_t* aCairoSurface,
44 : const IntSize& aSize,
45 : nsIOutputStream *aStream,
46 : PageOrientation aOrientation);
47 : virtual ~PrintTargetPS();
48 :
49 : nsCOMPtr<nsIOutputStream> mStream;
50 : PageOrientation mOrientation;
51 : };
52 :
53 : } // namespace gfx
54 : } // namespace mozilla
55 :
56 : #endif /* MOZILLA_GFX_PRINTINGTARGETPS_H */
|