Bumping manifests a=b2g-bump
[gecko.git] / widget / nsPrintOptionsImpl.h
blob262518b5ecf436be974f9bbe49410f55876de462
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"
11 #include "nsCOMPtr.h"
12 #include "nsIPrintOptions.h"
13 #include "nsIPrintSettingsService.h"
14 #include "nsString.h"
15 #include "nsFont.h"
17 class nsIPrintSettings;
18 class nsIWebBrowserPrint;
20 /**
21 * Class nsPrintOptions
23 class nsPrintOptions : public nsIPrintOptions,
24 public nsIPrintSettingsService
26 public:
27 NS_DECL_ISUPPORTS
28 NS_DECL_NSIPRINTOPTIONS
29 NS_DECL_NSIPRINTSETTINGSSERVICE
31 /**
32 * method Init
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();
39 nsPrintOptions();
41 protected:
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,
47 int16_t aInitValue);
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);
59 /**
60 * method ReadPrefs
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);
67 /**
68 * method WritePrefs
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,
74 uint32_t aFlags);
75 const char* GetPrefName(const char * aPrefName,
76 const nsAString& aPrinterName);
78 /**
79 * method _CreatePrintSettings
80 * May be implemented by the platform-specific derived class
82 * @return printer settings instance
84 virtual nsresult _CreatePrintSettings(nsIPrintSettings **_retval);
86 // Members
87 nsCOMPtr<nsIPrintSettings> mGlobalPrintSettings;
89 nsCString mPrefName;
91 private:
92 // These are not supported and are not implemented!
93 nsPrintOptions(const nsPrintOptions& x);
94 nsPrintOptions& operator=(const nsPrintOptions& x);
97 #endif /* nsPrintOptionsImpl_h__ */