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 "nsMargin.h"
12 #include "nsString.h"
13 #include "nsWeakReference.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   int16_t mPrintFrameTypeUsage;
59   int16_t mPrintFrameType;
60   int16_t mHowToEnableFrameUI;
61   bool mIsCancelled;
62   bool mPrintSilent;
63   bool mPrintPreview;
64   bool mShrinkToFit;
65   bool mShowPrintProgress;
66   int32_t mPrintPageDelay;
67 
68   nsString mTitle;
69   nsString mURL;
70   nsString mPageNumberFormat;
71   nsString mHeaderStrs[NUM_HEAD_FOOT];
72   nsString mFooterStrs[NUM_HEAD_FOOT];
73 
74   nsString mPaperName;
75   int16_t mPaperData;
76   double mPaperWidth;
77   double mPaperHeight;
78   int16_t mPaperSizeUnit;
79 
80   bool mPrintReversed;
81   bool mPrintInColor;    // a false means grayscale
82   int32_t mOrientation;  // see orientation consts
83   int32_t mResolution;
84   int32_t mDuplex;
85   int32_t mNumCopies;
86   nsString mPrinter;
87   bool mPrintToFile;
88   nsString mToFileName;
89   int16_t mOutputFormat;
90   bool mIsInitedFromPrinter;
91   bool mIsInitedFromPrefs;
92 };
93 
94 #endif /* nsPrintSettings_h__ */
95