|
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 * |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #ifndef nsPrintSettingsImpl_h__ |
|
8 #define nsPrintSettingsImpl_h__ |
|
9 |
|
10 #include "gfxCore.h" |
|
11 #include "nsIPrintSettings.h" |
|
12 #include "nsMargin.h" |
|
13 #include "nsString.h" |
|
14 #include "nsWeakReference.h" |
|
15 |
|
16 #define NUM_HEAD_FOOT 3 |
|
17 |
|
18 //***************************************************************************** |
|
19 //*** nsPrintSettings |
|
20 //***************************************************************************** |
|
21 |
|
22 class nsPrintSettings : public nsIPrintSettings |
|
23 { |
|
24 public: |
|
25 NS_DECL_ISUPPORTS |
|
26 NS_DECL_NSIPRINTSETTINGS |
|
27 |
|
28 nsPrintSettings(); |
|
29 nsPrintSettings(const nsPrintSettings& aPS); |
|
30 virtual ~nsPrintSettings(); |
|
31 |
|
32 nsPrintSettings& operator=(const nsPrintSettings& rhs); |
|
33 |
|
34 protected: |
|
35 // May be implemented by the platform-specific derived class |
|
36 virtual nsresult _Clone(nsIPrintSettings **_retval); |
|
37 virtual nsresult _Assign(nsIPrintSettings *aPS); |
|
38 |
|
39 typedef enum { |
|
40 eHeader, |
|
41 eFooter |
|
42 } nsHeaderFooterEnum; |
|
43 |
|
44 |
|
45 nsresult GetMarginStrs(char16_t * *aTitle, nsHeaderFooterEnum aType, int16_t aJust); |
|
46 nsresult SetMarginStrs(const char16_t * aTitle, nsHeaderFooterEnum aType, int16_t aJust); |
|
47 |
|
48 // Members |
|
49 nsWeakPtr mSession; // Should never be touched by Clone or Assign |
|
50 |
|
51 // mMargin, mEdge, and mUnwriteableMargin are stored in twips |
|
52 nsIntMargin mMargin; |
|
53 nsIntMargin mEdge; |
|
54 nsIntMargin mUnwriteableMargin; |
|
55 |
|
56 int32_t mPrintOptions; |
|
57 |
|
58 // scriptable data members |
|
59 int16_t mPrintRange; |
|
60 int32_t mStartPageNum; // only used for ePrintRange_SpecifiedRange |
|
61 int32_t mEndPageNum; |
|
62 double mScaling; |
|
63 bool mPrintBGColors; // print background colors |
|
64 bool mPrintBGImages; // print background images |
|
65 |
|
66 int16_t mPrintFrameTypeUsage; |
|
67 int16_t mPrintFrameType; |
|
68 int16_t mHowToEnableFrameUI; |
|
69 bool mIsCancelled; |
|
70 bool mPrintSilent; |
|
71 bool mPrintPreview; |
|
72 bool mShrinkToFit; |
|
73 bool mShowPrintProgress; |
|
74 int32_t mPrintPageDelay; |
|
75 |
|
76 nsString mTitle; |
|
77 nsString mURL; |
|
78 nsString mPageNumberFormat; |
|
79 nsString mHeaderStrs[NUM_HEAD_FOOT]; |
|
80 nsString mFooterStrs[NUM_HEAD_FOOT]; |
|
81 |
|
82 nsString mPaperName; |
|
83 nsString mPlexName; |
|
84 int16_t mPaperData; |
|
85 int16_t mPaperSizeType; |
|
86 double mPaperWidth; |
|
87 double mPaperHeight; |
|
88 int16_t mPaperSizeUnit; |
|
89 |
|
90 bool mPrintReversed; |
|
91 bool mPrintInColor; // a false means grayscale |
|
92 int32_t mOrientation; // see orientation consts |
|
93 nsString mColorspace; |
|
94 nsString mResolutionName; |
|
95 int32_t mResolution; |
|
96 int32_t mDuplex; |
|
97 bool mDownloadFonts; |
|
98 nsString mPrintCommand; |
|
99 int32_t mNumCopies; |
|
100 nsXPIDLString mPrinter; |
|
101 bool mPrintToFile; |
|
102 nsString mToFileName; |
|
103 int16_t mOutputFormat; |
|
104 bool mIsInitedFromPrinter; |
|
105 bool mIsInitedFromPrefs; |
|
106 bool mPersistMarginBoxSettings; |
|
107 }; |
|
108 |
|
109 #endif /* nsPrintSettings_h__ */ |