widget/xpwidgets/nsPrintOptionsImpl.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:e5cc050f2362
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 nsPrintOptionsImpl_h__
8 #define nsPrintOptionsImpl_h__
9
10 #include "nsCOMPtr.h"
11 #include "nsIPrintOptions.h"
12 #include "nsIPrintSettingsService.h"
13 #include "nsString.h"
14 #include "nsFont.h"
15
16 /**
17 * Class nsPrintOptions
18 */
19 class nsPrintOptions : public nsIPrintOptions,
20 public nsIPrintSettingsService
21 {
22 public:
23 NS_DECL_ISUPPORTS
24 NS_DECL_NSIPRINTOPTIONS
25 NS_DECL_NSIPRINTSETTINGSSERVICE
26
27 /**
28 * method Init
29 * Initializes member variables. Every consumer that does manual
30 * creation (instead of do_CreateInstance) needs to call this method
31 * immediately after instantiation.
32 */
33 virtual nsresult Init();
34
35 nsPrintOptions();
36 virtual ~nsPrintOptions();
37
38 protected:
39 void ReadBitFieldPref(const char * aPrefId, int32_t anOption);
40 void WriteBitFieldPref(const char * aPrefId, int32_t anOption);
41 void ReadJustification(const char * aPrefId, int16_t& aJust,
42 int16_t aInitValue);
43 void WriteJustification(const char * aPrefId, int16_t aJust);
44 void ReadInchesToTwipsPref(const char * aPrefId, int32_t& aTwips,
45 const char * aMarginPref);
46 void WriteInchesFromTwipsPref(const char * aPrefId, int32_t aTwips);
47 void ReadInchesIntToTwipsPref(const char * aPrefId, int32_t& aTwips,
48 const char * aMarginPref);
49 void WriteInchesIntFromTwipsPref(const char * aPrefId, int32_t aTwips);
50
51 nsresult ReadPrefDouble(const char * aPrefId, double& aVal);
52 nsresult WritePrefDouble(const char * aPrefId, double aVal);
53
54 /**
55 * method ReadPrefs
56 * @param aPS a pointer to the printer settings
57 * @param aPrinterName the name of the printer for which to read prefs
58 * @param aFlags flag specifying which prefs to read
59 */
60 virtual nsresult ReadPrefs(nsIPrintSettings* aPS, const nsAString&
61 aPrinterName, uint32_t aFlags);
62 /**
63 * method WritePrefs
64 * @param aPS a pointer to the printer settings
65 * @param aPrinterName the name of the printer for which to write prefs
66 * @param aFlags flag specifying which prefs to read
67 */
68 virtual nsresult WritePrefs(nsIPrintSettings* aPS, const nsAString& aPrefName,
69 uint32_t aFlags);
70 const char* GetPrefName(const char * aPrefName,
71 const nsAString& aPrinterName);
72
73 /**
74 * method _CreatePrintSettings
75 * May be implemented by the platform-specific derived class
76 *
77 * @return printer settings instance
78 */
79 virtual nsresult _CreatePrintSettings(nsIPrintSettings **_retval);
80
81 // Members
82 nsCOMPtr<nsIPrintSettings> mGlobalPrintSettings;
83
84 nsCString mPrefName;
85
86 private:
87 // These are not supported and are not implemented!
88 nsPrintOptions(const nsPrintOptions& x);
89 nsPrintOptions& operator=(const nsPrintOptions& x);
90 };
91
92 #endif /* nsPrintOptionsImpl_h__ */

mercurial