1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 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/. */
7 #ifndef nsPrintOptionsImpl_h__
8 #define nsPrintOptionsImpl_h__
10 #include "mozilla/embedding/PPrinting.h"
12 #include "nsIPrintOptions.h"
13 #include "nsIPrintSettingsService.h"
17 class nsIPrintSettings
;
18 class nsIWebBrowserPrint
;
21 * Class nsPrintOptions
23 class nsPrintOptions
: public nsIPrintOptions
,
24 public nsIPrintSettingsService
28 NS_DECL_NSIPRINTOPTIONS
29 NS_DECL_NSIPRINTSETTINGSSERVICE
33 * Initializes member variables. Every consumer that does manual
34 * creation (instead of do_CreateInstance) needs to call this method
35 * immediately after instantiation.
37 virtual nsresult
Init();
42 virtual ~nsPrintOptions();
44 void ReadBitFieldPref(const char * aPrefId
, int32_t anOption
);
45 void WriteBitFieldPref(const char * aPrefId
, int32_t anOption
);
46 void ReadJustification(const char * aPrefId
, int16_t& aJust
,
48 void WriteJustification(const char * aPrefId
, int16_t aJust
);
49 void ReadInchesToTwipsPref(const char * aPrefId
, int32_t& aTwips
,
50 const char * aMarginPref
);
51 void WriteInchesFromTwipsPref(const char * aPrefId
, int32_t aTwips
);
52 void ReadInchesIntToTwipsPref(const char * aPrefId
, int32_t& aTwips
,
53 const char * aMarginPref
);
54 void WriteInchesIntFromTwipsPref(const char * aPrefId
, int32_t aTwips
);
56 nsresult
ReadPrefDouble(const char * aPrefId
, double& aVal
);
57 nsresult
WritePrefDouble(const char * aPrefId
, double aVal
);
61 * @param aPS a pointer to the printer settings
62 * @param aPrinterName the name of the printer for which to read prefs
63 * @param aFlags flag specifying which prefs to read
65 virtual nsresult
ReadPrefs(nsIPrintSettings
* aPS
, const nsAString
&
66 aPrinterName
, uint32_t aFlags
);
69 * @param aPS a pointer to the printer settings
70 * @param aPrinterName the name of the printer for which to write prefs
71 * @param aFlags flag specifying which prefs to read
73 virtual nsresult
WritePrefs(nsIPrintSettings
* aPS
, const nsAString
& aPrefName
,
75 const char* GetPrefName(const char * aPrefName
,
76 const nsAString
& aPrinterName
);
79 * method _CreatePrintSettings
80 * May be implemented by the platform-specific derived class
82 * @return printer settings instance
84 virtual nsresult
_CreatePrintSettings(nsIPrintSettings
**_retval
);
87 nsCOMPtr
<nsIPrintSettings
> mGlobalPrintSettings
;
92 // These are not supported and are not implemented!
93 nsPrintOptions(const nsPrintOptions
& x
);
94 nsPrintOptions
& operator=(const nsPrintOptions
& x
);
97 #endif /* nsPrintOptionsImpl_h__ */