|
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 GFX_PSSURFACE_H |
|
7 #define GFX_PSSURFACE_H |
|
8 |
|
9 #include "gfxASurface.h" |
|
10 |
|
11 /* for the output stream */ |
|
12 #include "nsCOMPtr.h" |
|
13 #include "nsIOutputStream.h" |
|
14 #include "gfxContext.h" |
|
15 |
|
16 class gfxPSSurface : public gfxASurface { |
|
17 public: |
|
18 enum PageOrientation { |
|
19 PORTRAIT, |
|
20 LANDSCAPE |
|
21 }; |
|
22 |
|
23 gfxPSSurface(nsIOutputStream *aStream, const gfxSize& aSizeInPoints, PageOrientation aOrientation); |
|
24 virtual ~gfxPSSurface(); |
|
25 |
|
26 virtual nsresult BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName); |
|
27 virtual nsresult EndPrinting(); |
|
28 virtual nsresult AbortPrinting(); |
|
29 virtual nsresult BeginPage(); |
|
30 virtual nsresult EndPage(); |
|
31 virtual void Finish(); |
|
32 |
|
33 void SetDPI(double x, double y); |
|
34 void GetDPI(double *xDPI, double *yDPI); |
|
35 |
|
36 virtual bool GetRotateForLandscape() { return (mOrientation == LANDSCAPE); } |
|
37 |
|
38 // this is in points! |
|
39 virtual const gfxIntSize GetSize() const |
|
40 { |
|
41 return mSize; |
|
42 } |
|
43 |
|
44 virtual int32_t GetDefaultContextFlags() const |
|
45 { |
|
46 return gfxContext::FLAG_SIMPLIFY_OPERATORS | |
|
47 gfxContext::FLAG_DISABLE_SNAPPING; |
|
48 } |
|
49 |
|
50 private: |
|
51 nsCOMPtr<nsIOutputStream> mStream; |
|
52 double mXDPI; |
|
53 double mYDPI; |
|
54 gfxIntSize mSize; |
|
55 PageOrientation mOrientation; |
|
56 }; |
|
57 |
|
58 #endif /* GFX_PSSURFACE_H */ |