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 "nsIPrintSettings.h"
11 #include "nsIWeakReferenceUtils.h"
12 #include "nsMargin.h"
13 #include "nsString.h"
14 
15 #define NUM_HEAD_FOOT 3
16 
17 //*****************************************************************************
18 //***    nsPrintSettings
19 //*****************************************************************************
20 
21 class nsPrintSettings : public nsIPrintSettings {
22  public:
23   NS_DECL_ISUPPORTS
24   NS_DECL_NSIPRINTSETTINGS
25 
26   nsPrintSettings();
27   nsPrintSettings(const nsPrintSettings& aPS);
28 
29   nsPrintSettings& operator=(const nsPrintSettings& rhs);
30 
31  protected:
32   virtual ~nsPrintSettings();
33 
34   // May be implemented by the platform-specific derived class
35   virtual nsresult _Clone(nsIPrintSettings** _retval);
36   virtual nsresult _Assign(nsIPrintSettings* aPS);
37 
38   typedef enum { eHeader, eFooter } nsHeaderFooterEnum;
39 
40   // Members
41   nsWeakPtr mSession;  // Should never be touched by Clone or Assign
42 
43   // mMargin, mEdge, and mUnwriteableMargin are stored in twips
44   nsIntMargin mMargin;
45   nsIntMargin mEdge;
46   nsIntMargin mUnwriteableMargin;
47 
48   int32_t mPrintOptions;
49 
50   // scriptable data members
51   int16_t mPrintRange;
52   int32_t mStartPageNum;  // only used for ePrintRange_SpecifiedRange
53   int32_t mEndPageNum;
54   double mScaling;
55   bool mPrintBGColors;  // print background colors
56   bool mPrintBGImages;  // print background images
57 
58   bool mIsCancelled;
59   bool mSaveOnCancel;
60   bool mPrintSilent;
61   bool mShrinkToFit;
62   bool mShowPrintProgress;
63   int32_t mPrintPageDelay;
64 
65   nsString mTitle;
66   nsString mURL;
67   nsString mPageNumberFormat;
68   nsString mHeaderStrs[NUM_HEAD_FOOT];
69   nsString mFooterStrs[NUM_HEAD_FOOT];
70 
71   nsString mPaperName;
72   int16_t mPaperData;
73   double mPaperWidth;
74   double mPaperHeight;
75   int16_t mPaperSizeUnit;
76 
77   bool mPrintReversed;
78   bool mPrintInColor;    // a false means grayscale
79   int32_t mOrientation;  // see orientation consts
80   int32_t mResolution;
81   int32_t mDuplex;
82   int32_t mNumCopies;
83   nsString mPrinter;
84   bool mPrintToFile;
85   nsString mToFileName;
86   int16_t mOutputFormat;
87   bool mIsInitedFromPrinter;
88   bool mIsInitedFromPrefs;
89 };
90 
91 #endif /* nsPrintSettings_h__ */
92